From e6799c6ff57940265fbf3cc3957bf700372f71cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Sun, 15 Apr 2018 23:19:56 +0300 Subject: [PATCH] Improve keyed algorithm speed by keeping source type PACKED_SMI_ELEMENTS (v8) --- benchmarks/uibench/dist/bundle.js | 2 +- packages/inferno/src/DOM/patching.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/benchmarks/uibench/dist/bundle.js b/benchmarks/uibench/dist/bundle.js index 941b25c2e..296890676 100644 --- a/benchmarks/uibench/dist/bundle.js +++ b/benchmarks/uibench/dist/bundle.js @@ -1 +1 @@ -!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/home/sk/git/inferno/benchmarks/uibench",t(t.s=22)}([function(e,n,t){"use strict";function o(e){return null===e}function r(e){return!0===e}function i(e){return void 0===e}Object.defineProperty(n,"__esModule",{value:!0}),n.NO_OP="$NO_OP",n.ERROR_MSG="a runtime error occured! Use Inferno in development environment to find the error.",n.isBrowser=!("undefined"==typeof window||!window.document),n.toArray=function(e){return n.isArray(e)?e:e?[e]:e},n.isArray=Array.isArray,n.isStringOrNumber=function(e){var n=typeof e;return"string"===n||"number"===n},n.isNullOrUndef=function(e){return i(e)||o(e)},n.isInvalid=function(e){return o(e)||!1===e||r(e)||i(e)},n.isFunction=function(e){return"function"==typeof e},n.isString=function(e){return"string"==typeof e},n.isNumber=function(e){return"number"==typeof e},n.isNull=o,n.isTrue=r,n.isUndefined=i,n.isDefined=function(e){return void 0!==e},n.isObject=function(e){return"object"==typeof e},n.throwError=function(e){throw e||(e=n.ERROR_MSG),new Error("Inferno Error: "+e)},n.warning=function(e){console.error(e)},n.combineFrom=function(e,n){var t={};if(e)for(var o in e)t[o]=e[o];if(n)for(var o in n)t[o]=n[o];return t}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(13);function i(e,n){e.appendChild(n)}n.EMPTY_OBJ={},n.LIFECYCLE=[],n.appendChild=i,n.insertOrAppend=function(e,n,t){o.isNullOrUndef(t)?i(e,n):e.insertBefore(n,t)},n.documentCreateElement=function(e,n){return!0===n?document.createElementNS(r.svgNS,e):document.createElement(e)},n.replaceChild=function(e,n,t){e.replaceChild(n,t)},n.removeChild=function(e,n){e.removeChild(n)},n.callAll=function(e){for(var n;void 0!==(n=e.shift());)n()}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=(t(8),"$");function i(e,n,t,o,r,i,l,a){return{childFlags:e,children:n,className:t,dom:null,flags:o,key:void 0===r?null:r,parentVNode:null,props:void 0===i?null:i,ref:void 0===l?null:l,type:a}}function l(e,t,o,r,l,a,u,s){var c=void 0===l?1:l,f=i(c,r,o,e,u,a,s,t),p=n.options.createVNode;return"function"==typeof p&&p(f),0===c&&d(f,f.children),f}function a(e,t,r,l,a){(2&e)>0&&(e=o.isDefined(t.prototype)&&o.isFunction(t.prototype.render)?4:8);var u=t.defaultProps;if(!o.isNullOrUndef(u))for(var s in r||(r={}),u)o.isUndefined(r[s])&&(r[s]=u[s]);if((8&e)>0){var c=t.defaultHooks;if(!o.isNullOrUndef(c))if(a)for(var s in c)o.isUndefined(a[s])&&(a[s]=c[s]);else a=c}var d=i(1,null,null,e,l,r,a,t),f=n.options.createVNode;return o.isFunction(f)&&f(d),d}function u(e,n){return i(1,o.isNullOrUndef(e)?"":e,null,16,n,null,null,null)}function s(e){var n,t=e.flags;if(14&t){var r=void 0,i=e.props;if(!o.isNull(i))for(var s in r={},i)r[s]=i[s];n=a(t,e.type,r,e.key,e.ref)}else if(481&t){var c=e.children;n=l(t,e.type,e.className,c,0,e.props,e.key,e.ref)}else 16&t?n=u(e.children,e.key):1024&t&&(n=e);return n}function c(e,n,t,i){for(var l=e.length;t0;for(var u in l&&(i=a.isControlledFormElement(t))&&a.addFormElementEventHandlers(n,o,t),t)d(u,null,t[u],o,r,i,null);l&&a.processElement(n,e,o,t,!0,i)}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(2),r=t(0),i=t(1);function l(e,n){return r.isInvalid(e)?e=o.createVoidVNode():r.isStringOrNumber(e)?e=o.createTextVNode(e,null):(e.dom&&(e=o.directClone(e)),14&e.flags&&(e.parentVNode=n)),e}n.createClassComponentInstance=function(e,n,t,a){var u=new n(t,a);if(e.children=u,u.$V=e,u.$BS=!1,u.context=a,u.props===i.EMPTY_OBJ&&(u.props=t),u.$UN=!1,r.isFunction(u.componentWillMount)){if(u.$BR=!0,u.componentWillMount(),u.$PSS){var s=u.state,c=u.$PS;if(r.isNull(s))u.state=c;else for(var d in c)s[d]=c[d];u.$PSS=!1,u.$PS=null}u.$BR=!1}r.isFunction(o.options.beforeRender)&&o.options.beforeRender(u);var f,p=l(u.render(t,u.state,a),e);return r.isFunction(u.getChildContext)&&(f=u.getChildContext()),r.isNullOrUndef(f)?u.$CX=a:u.$CX=r.combineFrom(a,f),r.isFunction(o.options.afterRender)&&o.options.afterRender(u),u.$LI=p,u},n.handleComponentInput=l},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(2),i=t(12),l=t(1);function a(e,n){u(e),o.isNull(n)||(l.removeChild(n,e.dom),e.dom=null)}function u(e){var n=e.flags;if(481&n){var t=e.ref,c=e.props;o.isFunction(t)&&t(null);var d=e.children,f=e.childFlags;if(12&f?s(d):2===f&&u(d),!o.isNull(c))for(var p in c)switch(p){case"onClick":case"onDblClick":case"onFocusIn":case"onFocusOut":case"onKeyDown":case"onKeyPress":case"onKeyUp":case"onMouseDown":case"onMouseMove":case"onMouseUp":case"onSubmit":case"onTouchEnd":case"onTouchMove":case"onTouchStart":i.handleEvent(p,null,e.dom)}}else if(14&n){var m=e.children;t=e.ref;4&n?(o.isFunction(r.options.beforeUnmount)&&r.options.beforeUnmount(e),o.isFunction(m.componentWillUnmount)&&m.componentWillUnmount(),o.isFunction(t)&&t(null),m.$UN=!0,u(m.$LI)):(!o.isNullOrUndef(t)&&o.isFunction(t.onComponentWillUnmount)&&t.onComponentWillUnmount(e.dom,e.props||l.EMPTY_OBJ),u(m))}else if(1024&n){d=e.children;!o.isNull(d)&&o.isObject(d)&&a(d,e.type)}}function s(e){for(var n=0,t=e.length;n0):512&l||16&l?s(e,n):1024&l?(u(e.children,e.type,t,o,!1),e.dom=s(r.createVoidVNode(),n)):void 0}function s(e,n){var t=e.dom=document.createTextNode(e.children);return o.isNull(n)||i.appendChild(n,t),t}function c(e,n,t,r,a){var s=e.flags,c=e.children,f=e.props,p=e.className,m=e.ref,h=e.childFlags;a=a||(32&s)>0;var C=i.documentCreateElement(e.type,a);if(e.dom=C,o.isNullOrUndef(p)||""===p||(a?C.setAttribute("class",p):C.className=p),o.isNull(n)||i.appendChild(n,C),0==(1&h)){var N=!0===a&&"foreignObject"!==e.type;2===h?u(c,C,t,r,N):12&h&&d(c,C,t,r,N)}return o.isNull(f)||l.mountProps(e,s,f,C,a),o.isFunction(m)&&v(C,m,t),C}function d(e,n,t,i,l){for(var a=0,s=e.length;a0):16&u?function(e,n,t){var r,i=n.children,l=t.firstChild;o.isNull(l)?(t.textContent=i,r=t.firstChild):(r=e.dom,i!==e.children&&(r.nodeValue=i));n.dom=r}(e,n,t):512&u?n.dom=e.dom:function(e,n,t,r){var i=e.type,l=n.type,a=n.children;if(m(e.childFlags,n.childFlags,e.children,a,i,t,r,!1),n.dom=e.dom,i!==l&&!o.isInvalid(a)){var u=a.dom;i.removeChild(u),l.appendChild(u)}}(e,n,r,i)}}function p(e,n,t,r,l,c){var f=n.type;if(e.type!==f)d(e,n,t,r,l,c);else{var p=e.dom,v=n.flags,h=e.props,C=n.props,N=!1,y=!1,b=void 0;if(n.dom=p,c=c||(32&v)>0,h!==C){var g=h||a.EMPTY_OBJ;if((b=C||a.EMPTY_OBJ)!==a.EMPTY_OBJ)for(var O in(N=(448&v)>0)&&(y=u.isControlledFormElement(b)),b){var P=g[O],F=b[O];P!==F&&s.patchProp(O,P,F,p,c,y,e)}if(g!==a.EMPTY_OBJ)for(var O in g)b.hasOwnProperty(O)||o.isNullOrUndef(g[O])||s.patchProp(O,g[O],null,p,c,y,e)}var S=e.children,U=n.children,E=n.ref,$=e.className,k=n.className;S!==U&&m(e.childFlags,n.childFlags,S,U,p,r,l,c&&"foreignObject"!==f),N&&u.processElement(v,n,p,b,!1,y),$!==k&&(o.isNullOrUndef(k)?p.removeAttribute("class"):c?p.setAttribute("class",k):p.className=k),o.isFunction(E)&&e.ref!==E&&i.mountRef(p,E,r)}}function m(e,n,t,u,s,c,d,p){switch(e){case 2:switch(n){case 2:f(t,u,s,c,d,p);break;case 1:l.remove(t,s);break;default:l.remove(t,s),i.mountArrayChildren(u,s,c,d,p)}break;case 1:switch(n){case 2:i.mount(u,s,c,d,p);break;case 1:break;default:i.mountArrayChildren(u,s,c,d,p)}break;default:if(12&n){var m=t.length,v=u.length;0===m?v>0&&i.mountArrayChildren(u,s,c,d,p):0===v?l.removeAllChildren(s,t):8===n&&8===e?function(e,n,t,u,s,c,d,p){var m,v,h,C,N=d-1,y=p-1,b=0,g=0,O=e[b],P=n[g];e:{for(;O.key===P.key;){if(P.dom&&(n[g]=P=r.directClone(P)),f(O,P,t,u,s,c),g++,++b>N||g>y)break e;O=e[b],P=n[g]}for(O=e[N],P=n[y];O.key===P.key;){if(P.dom&&(n[y]=P=r.directClone(P)),f(O,P,t,u,s,c),y--,b>--N||g>y)break e;O=e[N],P=n[y]}}if(b>N){if(g<=y)for(h=(C=y+1)y)for(;b<=N;)l.remove(e[b++],t);else{var F=N-b+1,S=y-g+1,U=new Array(S);for(m=0;mb;)l.remove(e[b++],t);k>v?$=!0:k=v,P.dom&&(n[v]=P=r.directClone(P)),f(O,P,t,u,s,c),_++;break}!E&&v>y&&l.remove(O,t)}else E||l.remove(O,t);else{var V={};for(m=g;m<=y;m++)V[n[m].key]=m;for(m=b;m<=N;m++)if(O=e[m],_b;)l.remove(e[b++],t);P=n[v],U[v-g]=m,k>v?$=!0:k=v,P.dom&&(n[v]=P=r.directClone(P)),f(O,P,t,u,s,c),_++}else E||l.remove(O,t);else E||l.remove(O,t)}if(E)l.removeAllChildren(t,e),i.mountArrayChildren(n,t,u,s,c);else if($){var M=function(e){var n,t,o,r,i,l=e.slice(),a=[0],u=e.length;for(n=0;n0&&(l[n]=a[o-1]),a[o]=n)}}o=a.length,r=a[o-1];for(;o-- >0;)a[o]=r,r=l[r];return a}(U);for(v=M.length-1,m=S-1;m>=0;m--)-1===U[m]?((P=n[k=m+g]).dom&&(n[k]=P=r.directClone(P)),C=k+1,a.insertOrAppend(t,i.mount(P,null,u,s,c),C=0;m--)-1===U[m]&&((P=n[k=m+g]).dom&&(n[k]=P=r.directClone(P)),C=k+1,a.insertOrAppend(t,i.mount(P,null,u,s,c),Cc?c:s,p=0;pc)for(p=d;p0):481&f?function(e,n,t,r,a){var d=e.children,f=e.props,p=e.className,m=e.flags,v=e.ref;if(a=a||(32&m)>0,1!==n.nodeType||n.tagName.toLowerCase()!==e.type){var h=i.mountElement(e,null,t,r,a);e.dom=h,l.replaceChild(n.parentNode,h,n)}else{e.dom=n;var C=n.firstChild,N=e.childFlags;if(0==(1&N)){for(var y=null;C;)y=C.nextSibling,8===C.nodeType&&("!"===C.data?n.replaceChild(document.createTextNode(""),C):n.removeChild(C)),C=y;if(C=n.firstChild,2===N)o.isNull(C)?i.mount(d,n,t,r,a):(y=C.nextSibling,c(d,C,t,r,a),C=y);else if(12&N)for(var b=0,g=d.length;b0&&l.callAll(l.LIFECYCLE),n.$V||r.options.roots.push(n),n.$V=e,o.isFunction(t)&&t()}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0);n.NO_OP=o.NO_OP;var r=t(2);n.createComponentVNode=r.createComponentVNode,n.createTextVNode=r.createTextVNode,n.createVNode=r.createVNode,n.directClone=r.directClone,n.getFlagsForElementVnode=r.getFlagsForElementVnode,n.normalizeProps=r.normalizeProps,n.options=r.options;var i=t(21);n.linkEvent=i.linkEvent;var l=t(20);n.createPortal=l.createPortal,n.createRenderer=l.createRenderer,n.render=l.render;var a=t(1);n.EMPTY_OBJ=a.EMPTY_OBJ;var u=t(16);n.Component=u.Component;var s=t(3);n.getNumberStyleValue=s.getNumberStyleValue;var c=t(14);n.hydrate=c.hydrate;var d=Object({NODE_ENV:"production"}).INFERNO_VERSION;n.version=d},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(9),i=t(1),l="undefined"==typeof Promise?null:Promise.resolve(),a="undefined"==typeof requestAnimationFrame?setTimeout:requestAnimationFrame;function u(e,n,t){o.isFunction(n)&&(n=n(e.state,e.props,e.context));var r,u=e.$PS;if(o.isNullOrUndef(u))e.$PS=n;else for(var c in n)u[c]=n[c];if(e.$PSS||e.$BR)e.$PSS=!0,e.$BR&&o.isFunction(t)&&i.LIFECYCLE.push(t.bind(e));else if(e.$UPD){var d=e.$QU;o.isNull(d)&&(d=e.$QU=[],r=function(e,n){return function(){e.$QU=null,e.$UPD=!0,s(e,!1,function(){for(var t=0,o=n.length;t0,n,!0),e.$UN)return;if(0==(1024&e.$LI.flags))for(var m=e.$LI.dom;!o.isNull(d=d.parentVNode);)(14&d.flags)>0&&(d.dom=m);i.LIFECYCLE.length>0&&i.callAll(i.LIFECYCLE)}else e.state=e.$PS,e.$PS=null;o.isFunction(t)&&t.call(e)}}var c=function(){function e(e,n){this.state=null,this.$BR=!1,this.$BS=!0,this.$PSS=!1,this.$PS=null,this.$LI=null,this.$V=null,this.$UN=!1,this.$CX=null,this.$UPD=!0,this.$QU=null,this.props=e||i.EMPTY_OBJ,this.context=n||i.EMPTY_OBJ}return e.prototype.forceUpdate=function(e){this.$UN||s(this,!0,e)},e.prototype.setState=function(e,n){this.$UN||this.$BS||u(this,e,n)},e.prototype.render=function(e,n,t){},e.defaultProps=null,e}();n.Component=c},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(6),i=r.createWrappedFunction("onInput",a),l=r.createWrappedFunction("onChange");function a(e,n,t){var r=e.value,i=n.value;if(o.isNullOrUndef(r)){if(t){var l=e.defaultValue;o.isNullOrUndef(l)||l===i||(n.defaultValue=l,n.value=l)}}else i!==r&&(n.defaultValue=r,n.value=r)}n.textAreaEvents=function(e,n){e.oninput=i,n.onChange&&(e.onchange=l)},n.applyValueTextArea=a},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(1);function i(e,n){if("optgroup"===e.type){var t=e.children,o=e.childFlags;if(12&o)for(var r=0,i=t.length;r0&&s.callAll(s.LIFECYCLE),o.isFunction(t)&&t(),d&&14&d.flags?d.children:void 0}}n.render=d,n.createRenderer=function(e){return function(n,t){e||(e=n),d(t,e)}},n.createPortal=function(e,n){return r.createVNode(1024,n,null,e,0,null,o.isInvalid(e)?null:e.key,null)}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0);n.linkEvent=function(e,n){return o.isFunction(n)?{data:e,event:n}:null}},function(e,n,t){"use strict";t(15);var o,r=t(15);function i(e){var n=e.children;return(0,r.createVNode)(1,"li","TreeLeaf",(0,r.createTextVNode)(n),2)}function l(e,n){return e!==n}function a(e){for(var n=e.data,t=n.children.length,o=new Array(t),u=0;u0&&(e=o.isDefined(t.prototype)&&o.isFunction(t.prototype.render)?4:8);var u=t.defaultProps;if(!o.isNullOrUndef(u))for(var s in r||(r={}),u)o.isUndefined(r[s])&&(r[s]=u[s]);if((8&e)>0){var c=t.defaultHooks;if(!o.isNullOrUndef(c))if(a)for(var s in c)o.isUndefined(a[s])&&(a[s]=c[s]);else a=c}var d=i(1,null,null,e,l,r,a,t),f=n.options.createVNode;return o.isFunction(f)&&f(d),d}function u(e,n){return i(1,o.isNullOrUndef(e)?"":e,null,16,n,null,null,null)}function s(e){var n,t=e.flags;if(14&t){var r=void 0,i=e.props;if(!o.isNull(i))for(var s in r={},i)r[s]=i[s];n=a(t,e.type,r,e.key,e.ref)}else if(481&t){var c=e.children;n=l(t,e.type,e.className,c,e.childFlags,e.props,e.key,e.ref)}else 16&t?n=u(e.children,e.key):1024&t&&(n=e);return n}function c(e,n,t,i){for(var l=e.length;t0;for(var u in l&&(i=a.isControlledFormElement(t))&&a.addFormElementEventHandlers(n,o,t),t)d(u,null,t[u],o,r,i,null);l&&a.processElement(n,e,o,t,!0,i)}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(2),r=t(0),i=t(1);function l(e,n){return r.isInvalid(e)?e=o.createVoidVNode():r.isStringOrNumber(e)?e=o.createTextVNode(e,null):(e.dom&&(e=o.directClone(e)),14&e.flags&&(e.parentVNode=n)),e}n.createClassComponentInstance=function(e,n,t,a){var u=new n(t,a);if(e.children=u,u.$V=e,u.$BS=!1,u.context=a,u.props===i.EMPTY_OBJ&&(u.props=t),u.$UN=!1,r.isFunction(u.componentWillMount)){if(u.$BR=!0,u.componentWillMount(),u.$PSS){var s=u.state,c=u.$PS;if(r.isNull(s))u.state=c;else for(var d in c)s[d]=c[d];u.$PSS=!1,u.$PS=null}u.$BR=!1}r.isFunction(o.options.beforeRender)&&o.options.beforeRender(u);var f,p=l(u.render(t,u.state,a),e);return r.isFunction(u.getChildContext)&&(f=u.getChildContext()),r.isNullOrUndef(f)?u.$CX=a:u.$CX=r.combineFrom(a,f),r.isFunction(o.options.afterRender)&&o.options.afterRender(u),u.$LI=p,u},n.handleComponentInput=l},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(2),i=t(12),l=t(1);function a(e,n){u(e),o.isNull(n)||(l.removeChild(n,e.dom),e.dom=null)}function u(e){var n=e.flags;if(481&n){var t=e.ref,c=e.props;o.isFunction(t)&&t(null);var d=e.children,f=e.childFlags;if(12&f?s(d):2===f&&u(d),!o.isNull(c))for(var p in c)switch(p){case"onClick":case"onDblClick":case"onFocusIn":case"onFocusOut":case"onKeyDown":case"onKeyPress":case"onKeyUp":case"onMouseDown":case"onMouseMove":case"onMouseUp":case"onSubmit":case"onTouchEnd":case"onTouchMove":case"onTouchStart":i.handleEvent(p,null,e.dom)}}else if(14&n){var m=e.children;t=e.ref;4&n?(o.isFunction(r.options.beforeUnmount)&&r.options.beforeUnmount(e),o.isFunction(m.componentWillUnmount)&&m.componentWillUnmount(),o.isFunction(t)&&t(null),m.$UN=!0,u(m.$LI)):(!o.isNullOrUndef(t)&&o.isFunction(t.onComponentWillUnmount)&&t.onComponentWillUnmount(e.dom,e.props||l.EMPTY_OBJ),u(m))}else if(1024&n){d=e.children;!o.isNull(d)&&o.isObject(d)&&a(d,e.type)}}function s(e){for(var n=0,t=e.length;n0):512&l||16&l?s(e,n):1024&l?(u(e.children,e.type,t,o,!1),e.dom=s(r.createVoidVNode(),n)):void 0}function s(e,n){var t=e.dom=document.createTextNode(e.children);return o.isNull(n)||i.appendChild(n,t),t}function c(e,n,t,r,a){var s=e.flags,c=e.children,f=e.props,p=e.className,m=e.ref,h=e.childFlags;a=a||(32&s)>0;var C=i.documentCreateElement(e.type,a);if(e.dom=C,o.isNullOrUndef(p)||""===p||(a?C.setAttribute("class",p):C.className=p),o.isNull(n)||i.appendChild(n,C),0==(1&h)){var N=!0===a&&"foreignObject"!==e.type;2===h?u(c,C,t,r,N):12&h&&d(c,C,t,r,N)}return o.isNull(f)||l.mountProps(e,s,f,C,a),o.isFunction(m)&&v(C,m,t),C}function d(e,n,t,i,l){for(var a=0,s=e.length;a0):16&u?function(e,n,t){var r,i=n.children,l=t.firstChild;o.isNull(l)?(t.textContent=i,r=t.firstChild):(r=e.dom,i!==e.children&&(r.nodeValue=i));n.dom=r}(e,n,t):512&u?n.dom=e.dom:function(e,n,t,r){var i=e.type,l=n.type,a=n.children;if(m(e.childFlags,n.childFlags,e.children,a,i,t,r,!1),n.dom=e.dom,i!==l&&!o.isInvalid(a)){var u=a.dom;i.removeChild(u),l.appendChild(u)}}(e,n,r,i)}}function p(e,n,t,r,l,c){var f=n.type;if(e.type!==f)d(e,n,t,r,l,c);else{var p=e.dom,v=n.flags,h=e.props,C=n.props,N=!1,y=!1,b=void 0;if(n.dom=p,c=c||(32&v)>0,h!==C){var g=h||a.EMPTY_OBJ;if((b=C||a.EMPTY_OBJ)!==a.EMPTY_OBJ)for(var O in(N=(448&v)>0)&&(y=u.isControlledFormElement(b)),b){var P=g[O],F=b[O];P!==F&&s.patchProp(O,P,F,p,c,y,e)}if(g!==a.EMPTY_OBJ)for(var O in g)b.hasOwnProperty(O)||o.isNullOrUndef(g[O])||s.patchProp(O,g[O],null,p,c,y,e)}var S=e.children,U=n.children,E=n.ref,$=e.className,k=n.className;S!==U&&m(e.childFlags,n.childFlags,S,U,p,r,l,c&&"foreignObject"!==f),N&&u.processElement(v,n,p,b,!1,y),$!==k&&(o.isNullOrUndef(k)?p.removeAttribute("class"):c?p.setAttribute("class",k):p.className=k),o.isFunction(E)&&e.ref!==E&&i.mountRef(p,E,r)}}function m(e,n,t,u,s,c,d,p){switch(e){case 2:switch(n){case 2:f(t,u,s,c,d,p);break;case 1:l.remove(t,s);break;default:l.remove(t,s),i.mountArrayChildren(u,s,c,d,p)}break;case 1:switch(n){case 2:i.mount(u,s,c,d,p);break;case 1:break;default:i.mountArrayChildren(u,s,c,d,p)}break;default:if(12&n){var m=t.length,v=u.length;0===m?v>0&&i.mountArrayChildren(u,s,c,d,p):0===v?l.removeAllChildren(s,t):8===n&&8===e?function(e,n,t,u,s,c,d,p){var m,v,h,C,N=d-1,y=p-1,b=0,g=0,O=e[b],P=n[g];e:{for(;O.key===P.key;){if(P.dom&&(n[g]=P=r.directClone(P)),f(O,P,t,u,s,c),g++,++b>N||g>y)break e;O=e[b],P=n[g]}for(O=e[N],P=n[y];O.key===P.key;){if(P.dom&&(n[y]=P=r.directClone(P)),f(O,P,t,u,s,c),y--,b>--N||g>y)break e;O=e[N],P=n[y]}}if(b>N){if(g<=y)for(h=(C=y+1)y)for(;b<=N;)l.remove(e[b++],t);else{var F=N-b+1,S=y-g+1,U=[];for(m=0;mb;)l.remove(e[b++],t);k>v?$=!0:k=v,P.dom&&(n[v]=P=r.directClone(P)),f(O,P,t,u,s,c),_++;break}!E&&v>y&&l.remove(O,t)}else E||l.remove(O,t);else{var V={};for(m=g;m<=y;m++)V[n[m].key]=m;for(m=b;m<=N;m++)if(O=e[m],_b;)l.remove(e[b++],t);P=n[v],U[v-g]=m+1,k>v?$=!0:k=v,P.dom&&(n[v]=P=r.directClone(P)),f(O,P,t,u,s,c),_++}else E||l.remove(O,t);else E||l.remove(O,t)}if(E)l.removeAllChildren(t,e),i.mountArrayChildren(n,t,u,s,c);else if($){var M=function(e){var n,t,o,r,i,l=e.slice(),a=[0],u=e.length;for(n=0;n0&&(l[n]=a[o-1]),a[o]=n)}}o=a.length,r=a[o-1];for(;o-- >0;)a[o]=r,r=l[r];return a}(U);for(v=M.length-1,m=S-1;m>=0;m--)0===U[m]?((P=n[k=m+g]).dom&&(n[k]=P=r.directClone(P)),C=k+1,a.insertOrAppend(t,i.mount(P,null,u,s,c),C=0;m--)0===U[m]&&((P=n[k=m+g]).dom&&(n[k]=P=r.directClone(P)),C=k+1,a.insertOrAppend(t,i.mount(P,null,u,s,c),Cc?c:s,m=0;mc)for(m=p;m0):481&f?function(e,n,t,r,a){var d=e.children,f=e.props,p=e.className,m=e.flags,v=e.ref;if(a=a||(32&m)>0,1!==n.nodeType||n.tagName.toLowerCase()!==e.type){var h=i.mountElement(e,null,t,r,a);e.dom=h,l.replaceChild(n.parentNode,h,n)}else{e.dom=n;var C=n.firstChild,N=e.childFlags;if(0==(1&N)){for(var y=null;C;)y=C.nextSibling,8===C.nodeType&&("!"===C.data?n.replaceChild(document.createTextNode(""),C):n.removeChild(C)),C=y;if(C=n.firstChild,2===N)o.isNull(C)?i.mount(d,n,t,r,a):(y=C.nextSibling,c(d,C,t,r,a),C=y);else if(12&N)for(var b=0,g=d.length;b0&&l.callAll(l.LIFECYCLE),n.$V||r.options.roots.push(n),n.$V=e,o.isFunction(t)&&t()}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0);n.NO_OP=o.NO_OP;var r=t(2);n.createComponentVNode=r.createComponentVNode,n.createTextVNode=r.createTextVNode,n.createVNode=r.createVNode,n.directClone=r.directClone,n.getFlagsForElementVnode=r.getFlagsForElementVnode,n.normalizeProps=r.normalizeProps,n.options=r.options;var i=t(22);n.linkEvent=i.linkEvent;var l=t(21);n.createPortal=l.createPortal,n.createRenderer=l.createRenderer,n.render=l.render;var a=t(1);n.EMPTY_OBJ=a.EMPTY_OBJ;var u=t(17);n.Component=u.Component;var s=t(3);n.getNumberStyleValue=s.getNumberStyleValue;var c=t(14);n.hydrate=c.hydrate;var d=t(16);n.JSX=d;var f=Object({NODE_ENV:"production"}).INFERNO_VERSION;n.version=f},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(9),i=t(1),l="undefined"==typeof Promise?null:Promise.resolve(),a="undefined"==typeof requestAnimationFrame?setTimeout:requestAnimationFrame.bind(window);function u(e,n,t){o.isFunction(n)&&(n=n(e.state,e.props,e.context));var r,u=e.$PS;if(o.isNullOrUndef(u))e.$PS=n;else for(var c in n)u[c]=n[c];if(e.$PSS||e.$BR)e.$PSS=!0,e.$BR&&o.isFunction(t)&&i.LIFECYCLE.push(t.bind(e));else if(e.$UPD){var d=e.$QU;o.isNull(d)&&(d=e.$QU=[],r=function(e,n){return function(){e.$QU=null,e.$UPD=!0,s(e,!1,function(){for(var t=0,o=n.length;t0,n,!0),e.$UN)return;if(0==(1024&e.$LI.flags))for(var m=e.$LI.dom;!o.isNull(d=d.parentVNode);)(14&d.flags)>0&&(d.dom=m);i.LIFECYCLE.length>0&&i.callAll(i.LIFECYCLE)}else e.state=e.$PS,e.$PS=null;o.isFunction(t)&&t.call(e)}}var c=function(){function e(e,n){this.state=null,this.$BR=!1,this.$BS=!0,this.$PSS=!1,this.$PS=null,this.$LI=null,this.$V=null,this.$UN=!1,this.$CX=null,this.$UPD=!0,this.$QU=null,this.props=e||i.EMPTY_OBJ,this.context=n||i.EMPTY_OBJ}return e.prototype.forceUpdate=function(e){this.$UN||s(this,!0,e)},e.prototype.setState=function(e,n){this.$UN||this.$BS||u(this,e,n)},e.prototype.render=function(e,n,t){},e.defaultProps=null,e}();n.Component=c},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(6),i=r.createWrappedFunction("onInput",a),l=r.createWrappedFunction("onChange");function a(e,n,t){var r=e.value,i=n.value;if(o.isNullOrUndef(r)){if(t){var l=e.defaultValue;o.isNullOrUndef(l)||l===i||(n.defaultValue=l,n.value=l)}}else i!==r&&(n.defaultValue=r,n.value=r)}n.textAreaEvents=function(e,n){e.oninput=i,n.onChange&&(e.onchange=l)},n.applyValueTextArea=a},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0),r=t(1);function i(e,n){if("optgroup"===e.type){var t=e.children,o=e.childFlags;if(12&o)for(var r=0,i=t.length;r0&&s.callAll(s.LIFECYCLE),o.isFunction(t)&&t(),d&&14&d.flags?d.children:void 0}}n.render=d,n.createRenderer=function(e){return function(n,t){e||(e=n),d(t,e)}},n.createPortal=function(e,n){return r.createVNode(1024,n,null,e,0,null,o.isInvalid(e)?null:e.key,null)}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=t(0);n.linkEvent=function(e,n){return o.isFunction(n)?{data:e,event:n}:null}},function(e,n,t){"use strict";t(15);var o,r=t(15);function i(e){var n=e.children;return(0,r.createVNode)(1,"li","TreeLeaf",(0,r.createTextVNode)(n),2)}function l(e,n){return e!==n}function a(e){for(var n=e.data,t=n.children.length,o=new Array(t),u=0;u aStart) { @@ -540,7 +540,7 @@ function patchKeyedChildren(a: VNode[], b: VNode[], dom, lifecycle: Function[], } } bNode = b[j]; - sources[j - bStart] = i; + sources[j - bStart] = i + 1; if (pos > j) { moved = true; } else { @@ -568,7 +568,7 @@ function patchKeyedChildren(a: VNode[], b: VNode[], dom, lifecycle: Function[], const seq = lis_algorithm(sources); j = seq.length - 1; for (i = bLeft - 1; i >= 0; i--) { - if (sources[i] === -1) { + if (sources[i] === 0) { pos = i + bStart; bNode = b[pos]; if (bNode.dom) { @@ -589,7 +589,7 @@ function patchKeyedChildren(a: VNode[], b: VNode[], dom, lifecycle: Function[], // when patched count doesn't match b length we need to insert those new ones // loop backwards so we can use insertBefore for (i = bLeft - 1; i >= 0; i--) { - if (sources[i] === -1) { + if (sources[i] === 0) { pos = i + bStart; bNode = b[pos]; if (bNode.dom) { @@ -618,7 +618,7 @@ function lis_algorithm(arr: number[]): number[] { for (i = 0; i < len; i++) { const arrI = arr[i]; - if (arrI !== -1) { + if (arrI !== 0) { j = result[result.length - 1]; if (arr[j] < arrI) { p[i] = j;