Comparing version 0.6.4 to 0.6.5
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.snabbdom=e()}}(function(){return function e(t,n,r){function o(l,a){if(!n[l]){if(!t[l]){var d="function"==typeof require&&require;if(!a&&d)return d(l,!0);if(i)return i(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var s=n[l]={exports:{}};t[l][0].call(s.exports,function(e){var n=t[l][1][e];return o(n?n:e)},s,s.exports,e,t,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,t,n){"use strict";function r(e,t,n){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==t)for(var o=0;o<t.length;++o){var i=t[o].data;void 0!==i&&r(i,t[o].children,t[o].sel)}}function o(e,t,n){var o,a,d,u={};if(void 0!==n?(u=t,l.array(n)?o=n:l.primitive(n)?a=n:n&&n.sel&&(o=[n])):void 0!==t&&(l.array(t)?o=t:l.primitive(t)?a=t:t&&t.sel?o=[t]:u=t),l.array(o))for(d=0;d<o.length;++d)l.primitive(o[d])&&(o[d]=i.vnode(void 0,void 0,void 0,o[d]));return"s"!==e[0]||"v"!==e[1]||"g"!==e[2]||3!==e.length&&"."!==e[3]&&"#"!==e[3]||r(u,o,e),i.vnode(e,u,o,a,void 0)}var i=e("./vnode"),l=e("./is");n.h=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./is":3,"./vnode":12}],2:[function(e,t,n){"use strict";function r(e){return document.createElement(e)}function o(e,t){return document.createElementNS(e,t)}function i(e){return document.createTextNode(e)}function l(e){return document.createComment(e)}function a(e,t,n){e.insertBefore(t,n)}function d(e,t){e.removeChild(t)}function u(e,t){e.appendChild(t)}function s(e){return e.parentNode}function f(e){return e.nextSibling}function c(e){return e.tagName}function v(e,t){e.textContent=t}function p(e){return e.textContent}function m(e){return 1===e.nodeType}function h(e){return 3===e.nodeType}function y(e){return 8===e.nodeType}n.htmlDomApi={createElement:r,createElementNS:o,createTextNode:i,createComment:l,insertBefore:a,removeChild:d,appendChild:u,parentNode:s,nextSibling:f,tagName:c,setTextContent:v,getTextContent:p,isElement:m,isText:h,isComment:y},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.htmlDomApi},{}],3:[function(e,t,n){"use strict";function r(e){return"string"==typeof e||"number"==typeof e}n.array=Array.isArray,n.primitive=r},{}],4:[function(e,t,n){"use strict";function r(e,t){var n,r,i,a,d=t.elm,u=e.data.attrs,s=t.data.attrs;if((u||s)&&u!==s){u=u||{},s=s||{};for(n in s)r=s[n],i=u[n],i!==r&&(!r&&l[n]?d.removeAttribute(n):(a=n.split(":"),a.length>1&&o.hasOwnProperty(a[0])?d.setAttributeNS(o[a[0]],n,r):d.setAttribute(n,r)));for(n in u)n in s||d.removeAttribute(n)}}for(var o={xlink:"http://www.w3.org/1999/xlink"},i=["allowfullscreen","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","draggable","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","spellcheck","translate","truespeed","typemustmatch","visible"],l=Object.create(null),a=0,d=i.length;a<d;a++)l[i[a]]=!0;n.attributesModule={create:r,update:r},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.attributesModule},{}],5:[function(e,t,n){"use strict";function r(e,t){var n,r,o=t.elm,i=e.data["class"],l=t.data["class"];if((i||l)&&i!==l){i=i||{},l=l||{};for(r in i)l[r]||o.classList.remove(r);for(r in l)n=l[r],n!==i[r]&&o.classList[n?"add":"remove"](r)}}n.classModule={create:r,update:r},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.classModule},{}],6:[function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof e)e.call(t,n,t);else if("object"==typeof e)if("function"==typeof e[0])if(2===e.length)e[0].call(t,e[1],n,t);else{var o=e.slice(1);o.push(n),o.push(t),e[0].apply(t,o)}else for(var i=0;i<e.length;i++)r(e[i])}function o(e,t){var n=e.type,o=t.data.on;o&&o[n]&&r(o[n],t,e)}function i(){return function e(t){o(t,e.vnode)}}function l(e,t){var n,r=e.data.on,o=e.listener,l=e.elm,a=t&&t.data.on,d=t&&t.elm;if(r!==a){if(r&&o)if(a)for(n in r)a[n]||l.removeEventListener(n,o,!1);else for(n in r)l.removeEventListener(n,o,!1);if(a){var u=t.listener=e.listener||i();if(u.vnode=t,r)for(n in a)r[n]||d.addEventListener(n,u,!1);else for(n in a)d.addEventListener(n,u,!1)}}}n.eventListenersModule={create:l,update:l,destroy:l},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.eventListenersModule},{}],7:[function(e,t,n){"use strict";function r(e,t){var n,r,o,i=t.elm,l=e.data.props,a=t.data.props;if((l||a)&&l!==a){l=l||{},a=a||{};for(n in l)a[n]||delete i[n];for(n in a)r=a[n],o=l[n],o===r||"value"===n&&i[n]===r||(i[n]=r)}}n.propsModule={create:r,update:r},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.propsModule},{}],8:[function(e,t,n){"use strict";function r(e,t,n){d(function(){e[t]=n})}function o(e,t){var n,o,i=t.elm,l=e.data.style,a=t.data.style;if((l||a)&&l!==a){l=l||{},a=a||{};var d="delayed"in l;for(o in l)a[o]||("-"===o[0]&&"-"===o[1]?i.style.removeProperty(o):i.style[o]="");for(o in a)if(n=a[o],"delayed"===o)for(o in a.delayed)n=a.delayed[o],d&&n===l.delayed[o]||r(i.style,o,n);else"remove"!==o&&n!==l[o]&&("-"===o[0]&&"-"===o[1]?i.style.setProperty(o,n):i.style[o]=n)}}function i(e){var t,n,r=e.elm,o=e.data.style;if(o&&(t=o.destroy))for(n in t)r.style[n]=t[n]}function l(e,t){var n=e.data.style;if(!n||!n.remove)return void t();var r,o,i=e.elm,l=0,a=n.remove,d=0,u=[];for(r in a)u.push(r),i.style[r]=a[r];o=getComputedStyle(i);for(var s=o["transition-property"].split(", ");l<s.length;++l)u.indexOf(s[l])!==-1&&d++;i.addEventListener("transitionend",function(e){e.target===i&&--d,0===d&&t()})}var a="undefined"!=typeof window&&window.requestAnimationFrame||setTimeout,d=function(e){a(function(){a(e)})};n.styleModule={create:o,update:o,destroy:i,remove:l},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.styleModule},{}],9:[function(e,t,n){"use strict";var r=e("./snabbdom"),o=e("./modules/attributes"),i=e("./modules/class"),l=e("./modules/props"),a=e("./modules/style"),d=e("./modules/eventlisteners"),u=e("./h"),s=r.init([o.attributesModule,i.classModule,l.propsModule,a.styleModule,d.eventListenersModule]);n.snabbdomBundle={patch:s,h:u.h},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.snabbdomBundle},{"./h":1,"./modules/attributes":4,"./modules/class":5,"./modules/eventlisteners":6,"./modules/props":7,"./modules/style":8,"./snabbdom":10}],10:[function(e,t,n){"use strict";function r(e){return void 0===e}function o(e){return void 0!==e}function i(e,t){return e.key===t.key&&e.sel===t.sel}function l(e){return void 0!==e.sel}function a(e,t,n){var r,o,i,l={};for(r=t;r<=n;++r)i=e[r],null!=i&&(o=i.key,void 0!==o&&(l[o]=r));return l}function d(e,t){function n(e){var t=e.id?"#"+e.id:"",n=e.className?"."+e.className.split(" ").join("."):"";return u["default"](w.tagName(e).toLowerCase()+t+n,{},[],void 0,e)}function d(e,t){return function(){if(0===--t){var n=w.parentNode(e);w.removeChild(n,e)}}}function p(e,t){var n,i=e.data;void 0!==i&&o(n=i.hook)&&o(n=n.init)&&(n(e),i=e.data);var l=e.children,a=e.sel;if("!"===a)r(e.text)&&(e.text=""),e.elm=w.createComment(e.text);else if(void 0!==a){var d=a.indexOf("#"),u=a.indexOf(".",d),f=d>0?d:a.length,v=u>0?u:a.length,m=d!==-1||u!==-1?a.slice(0,Math.min(f,v)):a,h=e.elm=o(i)&&o(n=i.ns)?w.createElementNS(n,m):w.createElement(m);if(f<v&&(h.id=a.slice(f+1,v)),u>0&&(h.className=a.slice(v+1).replace(/\./g," ")),s.array(l))for(n=0;n<l.length;++n){var y=l[n];null!=y&&w.appendChild(h,p(y,t))}else s.primitive(e.text)&&w.appendChild(h,w.createTextNode(e.text));for(n=0;n<k.create.length;++n)k.create[n](c,e);n=e.data.hook,o(n)&&(n.create&&n.create(c,e),n.insert&&t.push(e))}else e.elm=w.createTextNode(e.text);return e.elm}function m(e,t,n,r,o,i){for(;r<=o;++r){var l=n[r];null!=l&&w.insertBefore(e,p(l,i),t)}}function h(e){var t,n,r=e.data;if(void 0!==r){for(o(t=r.hook)&&o(t=t.destroy)&&t(e),t=0;t<k.destroy.length;++t)k.destroy[t](e);if(void 0!==e.children)for(n=0;n<e.children.length;++n)t=e.children[n],null!=t&&"string"!=typeof t&&h(t)}}function y(e,t,n,r){for(;n<=r;++n){var i=void 0,l=void 0,a=void 0,u=t[n];if(null!=u)if(o(u.sel)){for(h(u),l=k.remove.length+1,a=d(u.elm,l),i=0;i<k.remove.length;++i)k.remove[i](u,a);o(i=u.data)&&o(i=i.hook)&&o(i=i.remove)?i(u,a):a()}else w.removeChild(e,u.elm)}}function g(e,t,n,o){for(var l,d,u,s,f=0,c=0,v=t.length-1,h=t[0],g=t[v],x=n.length-1,M=n[0],k=n[x];f<=v&&c<=x;)null==h?h=t[++f]:null==g?g=t[--v]:null==M?M=n[++c]:null==k?k=n[--x]:i(h,M)?(b(h,M,o),h=t[++f],M=n[++c]):i(g,k)?(b(g,k,o),g=t[--v],k=n[--x]):i(h,k)?(b(h,k,o),w.insertBefore(e,h.elm,w.nextSibling(g.elm)),h=t[++f],k=n[--x]):i(g,M)?(b(g,M,o),w.insertBefore(e,g.elm,h.elm),g=t[--v],M=n[++c]):(void 0===l&&(l=a(t,f,v)),d=l[M.key],r(d)?(w.insertBefore(e,p(M,o),h.elm),M=n[++c]):(u=t[d],u.sel!==M.sel?w.insertBefore(e,p(M,o),h.elm):(b(u,M,o),t[d]=void 0,w.insertBefore(e,u.elm,h.elm)),M=n[++c]));f>v?(s=null==n[x+1]?null:n[x+1].elm,m(e,s,n,c,x,o)):c>x&&y(e,t,f,v)}function b(e,t,n){var i,l;o(i=t.data)&&o(l=i.hook)&&o(i=l.prepatch)&&i(e,t);var a=t.elm=e.elm,d=e.children,u=t.children;if(e!==t){if(void 0!==t.data){for(i=0;i<k.update.length;++i)k.update[i](e,t);i=t.data.hook,o(i)&&o(i=i.update)&&i(e,t)}r(t.text)?o(d)&&o(u)?d!==u&&g(a,d,u,n):o(u)?(o(e.text)&&w.setTextContent(a,""),m(a,null,u,0,u.length-1,n)):o(d)?y(a,d,0,d.length-1):o(e.text)&&w.setTextContent(a,""):e.text!==t.text&&w.setTextContent(a,t.text),o(l)&&o(i=l.postpatch)&&i(e,t)}}var x,M,k={},w=void 0!==t?t:f["default"];for(x=0;x<v.length;++x)for(k[v[x]]=[],M=0;M<e.length;++M){var C=e[M][v[x]];void 0!==C&&k[v[x]].push(C)}return function(e,t){var r,o,a,d=[];for(r=0;r<k.pre.length;++r)k.pre[r]();for(l(e)||(e=n(e)),i(e,t)?b(e,t,d):(o=e.elm,a=w.parentNode(o),p(t,d),null!==a&&(w.insertBefore(a,t.elm,w.nextSibling(o)),y(a,[e],0,0))),r=0;r<d.length;++r)d[r].data.hook.insert(d[r]);for(r=0;r<k.post.length;++r)k.post[r]();return t}}var u=e("./vnode"),s=e("./is"),f=e("./htmldomapi"),c=u["default"]("",{},[],void 0,void 0),v=["create","update","remove","destroy","pre","post"],p=e("./h");n.h=p.h;var m=e("./thunk");n.thunk=m.thunk,n.init=d},{"./h":1,"./htmldomapi":2,"./is":3,"./thunk":11,"./vnode":12}],11:[function(e,t,n){"use strict";function r(e,t){t.elm=e.elm,e.data.fn=t.data.fn,e.data.args=t.data.args,t.data=e.data,t.children=e.children,t.text=e.text,t.elm=e.elm}function o(e){var t=e.data,n=t.fn.apply(void 0,t.args);r(n,e)}function i(e,t){var n,o=e.data,i=t.data,l=o.args,a=i.args;for(o.fn===i.fn&&l.length===a.length||r(i.fn.apply(void 0,a),t),n=0;n<a.length;++n)if(l[n]!==a[n])return void r(i.fn.apply(void 0,a),t);r(e,t)}var l=e("./h");n.thunk=function(e,t,n,r){return void 0===r&&(r=n,n=t,t=void 0),l.h(e,{key:t,hook:{init:o,prepatch:i},fn:n,args:r})},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.thunk},{"./h":1}],12:[function(e,t,n){"use strict";function r(e,t,n,r,o){var i=void 0===t?void 0:t.key;return{sel:e,data:t,children:n,text:r,elm:o,key:i}}n.vnode=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}]},{},[9])(9)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.snabbdom=e()}}(function(){return function e(t,n,r){function o(l,a){if(!n[l]){if(!t[l]){var d="function"==typeof require&&require;if(!a&&d)return d(l,!0);if(i)return i(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var s=n[l]={exports:{}};t[l][0].call(s.exports,function(e){var n=t[l][1][e];return o(n?n:e)},s,s.exports,e,t,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,t,n){"use strict";function r(e,t,n){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==t)for(var o=0;o<t.length;++o){var i=t[o].data;void 0!==i&&r(i,t[o].children,t[o].sel)}}function o(e,t,n){var o,a,d,u={};if(void 0!==n?(u=t,l.array(n)?o=n:l.primitive(n)?a=n:n&&n.sel&&(o=[n])):void 0!==t&&(l.array(t)?o=t:l.primitive(t)?a=t:t&&t.sel?o=[t]:u=t),l.array(o))for(d=0;d<o.length;++d)l.primitive(o[d])&&(o[d]=i.vnode(void 0,void 0,void 0,o[d]));return"s"!==e[0]||"v"!==e[1]||"g"!==e[2]||3!==e.length&&"."!==e[3]&&"#"!==e[3]||r(u,o,e),i.vnode(e,u,o,a,void 0)}var i=e("./vnode"),l=e("./is");n.h=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./is":3,"./vnode":12}],2:[function(e,t,n){"use strict";function r(e){return document.createElement(e)}function o(e,t){return document.createElementNS(e,t)}function i(e){return document.createTextNode(e)}function l(e){return document.createComment(e)}function a(e,t,n){e.insertBefore(t,n)}function d(e,t){e.removeChild(t)}function u(e,t){e.appendChild(t)}function s(e){return e.parentNode}function f(e){return e.nextSibling}function c(e){return e.tagName}function v(e,t){e.textContent=t}function p(e){return e.textContent}function m(e){return 1===e.nodeType}function h(e){return 3===e.nodeType}function y(e){return 8===e.nodeType}n.htmlDomApi={createElement:r,createElementNS:o,createTextNode:i,createComment:l,insertBefore:a,removeChild:d,appendChild:u,parentNode:s,nextSibling:f,tagName:c,setTextContent:v,getTextContent:p,isElement:m,isText:h,isComment:y},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.htmlDomApi},{}],3:[function(e,t,n){"use strict";function r(e){return"string"==typeof e||"number"==typeof e}n.array=Array.isArray,n.primitive=r},{}],4:[function(e,t,n){"use strict";function r(e,t){var n,r,i,a,d=t.elm,u=e.data.attrs,s=t.data.attrs;if((u||s)&&u!==s){u=u||{},s=s||{};for(n in s)r=s[n],i=u[n],i!==r&&(!r&&l[n]?d.removeAttribute(n):(a=n.split(":"),a.length>1&&o.hasOwnProperty(a[0])?d.setAttributeNS(o[a[0]],n,r):d.setAttribute(n,r)));for(n in u)n in s||d.removeAttribute(n)}}for(var o={xlink:"http://www.w3.org/1999/xlink"},i=["allowfullscreen","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","draggable","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","spellcheck","translate","truespeed","typemustmatch","visible"],l=Object.create(null),a=0,d=i.length;a<d;a++)l[i[a]]=!0;n.attributesModule={create:r,update:r},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.attributesModule},{}],5:[function(e,t,n){"use strict";function r(e,t){var n,r,o=t.elm,i=e.data["class"],l=t.data["class"];if((i||l)&&i!==l){i=i||{},l=l||{};for(r in i)l[r]||o.classList.remove(r);for(r in l)n=l[r],n!==i[r]&&o.classList[n?"add":"remove"](r)}}n.classModule={create:r,update:r},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.classModule},{}],6:[function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof e)e.call(t,n,t);else if("object"==typeof e)if("function"==typeof e[0])if(2===e.length)e[0].call(t,e[1],n,t);else{var o=e.slice(1);o.push(n),o.push(t),e[0].apply(t,o)}else for(var i=0;i<e.length;i++)r(e[i])}function o(e,t){var n=e.type,o=t.data.on;o&&o[n]&&r(o[n],t,e)}function i(){return function e(t){o(t,e.vnode)}}function l(e,t){var n,r=e.data.on,o=e.listener,l=e.elm,a=t&&t.data.on,d=t&&t.elm;if(r!==a){if(r&&o)if(a)for(n in r)a[n]||l.removeEventListener(n,o,!1);else for(n in r)l.removeEventListener(n,o,!1);if(a){var u=t.listener=e.listener||i();if(u.vnode=t,r)for(n in a)r[n]||d.addEventListener(n,u,!1);else for(n in a)d.addEventListener(n,u,!1)}}}n.eventListenersModule={create:l,update:l,destroy:l},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.eventListenersModule},{}],7:[function(e,t,n){"use strict";function r(e,t){var n,r,o,i=t.elm,l=e.data.props,a=t.data.props;if((l||a)&&l!==a){l=l||{},a=a||{};for(n in l)a[n]||delete i[n];for(n in a)r=a[n],o=l[n],o===r||"value"===n&&i[n]===r||(i[n]=r)}}n.propsModule={create:r,update:r},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.propsModule},{}],8:[function(e,t,n){"use strict";function r(e,t,n){d(function(){e[t]=n})}function o(e,t){var n,o,i=t.elm,l=e.data.style,a=t.data.style;if((l||a)&&l!==a){l=l||{},a=a||{};var d="delayed"in l;for(o in l)a[o]||("-"===o[0]&&"-"===o[1]?i.style.removeProperty(o):i.style[o]="");for(o in a)if(n=a[o],"delayed"===o)for(o in a.delayed)n=a.delayed[o],d&&n===l.delayed[o]||r(i.style,o,n);else"remove"!==o&&n!==l[o]&&("-"===o[0]&&"-"===o[1]?i.style.setProperty(o,n):i.style[o]=n)}}function i(e){var t,n,r=e.elm,o=e.data.style;if(o&&(t=o.destroy))for(n in t)r.style[n]=t[n]}function l(e,t){var n=e.data.style;if(!n||!n.remove)return void t();var r,o,i=e.elm,l=0,a=n.remove,d=0,u=[];for(r in a)u.push(r),i.style[r]=a[r];o=getComputedStyle(i);for(var s=o["transition-property"].split(", ");l<s.length;++l)u.indexOf(s[l])!==-1&&d++;i.addEventListener("transitionend",function(e){e.target===i&&--d,0===d&&t()})}var a="undefined"!=typeof window&&window.requestAnimationFrame||setTimeout,d=function(e){a(function(){a(e)})};n.styleModule={create:o,update:o,destroy:i,remove:l},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.styleModule},{}],9:[function(e,t,n){"use strict";var r=e("./snabbdom"),o=e("./modules/attributes"),i=e("./modules/class"),l=e("./modules/props"),a=e("./modules/style"),d=e("./modules/eventlisteners"),u=e("./h"),s=r.init([o.attributesModule,i.classModule,l.propsModule,a.styleModule,d.eventListenersModule]);n.snabbdomBundle={patch:s,h:u.h},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.snabbdomBundle},{"./h":1,"./modules/attributes":4,"./modules/class":5,"./modules/eventlisteners":6,"./modules/props":7,"./modules/style":8,"./snabbdom":10}],10:[function(e,t,n){"use strict";function r(e){return void 0===e}function o(e){return void 0!==e}function i(e,t){return e.key===t.key&&e.sel===t.sel}function l(e){return void 0!==e.sel}function a(e,t,n){var r,o,i,l={};for(r=t;r<=n;++r)i=e[r],null!=i&&(o=i.key,void 0!==o&&(l[o]=r));return l}function d(e,t){function n(e){var t=e.id?"#"+e.id:"",n=e.className?"."+e.className.split(" ").join("."):"";return u["default"](w.tagName(e).toLowerCase()+t+n,{},[],void 0,e)}function d(e,t){return function(){if(0===--t){var n=w.parentNode(e);w.removeChild(n,e)}}}function p(e,t){var n,i=e.data;void 0!==i&&o(n=i.hook)&&o(n=n.init)&&(n(e),i=e.data);var l=e.children,a=e.sel;if("!"===a)r(e.text)&&(e.text=""),e.elm=w.createComment(e.text);else if(void 0!==a){var d=a.indexOf("#"),u=a.indexOf(".",d),f=d>0?d:a.length,v=u>0?u:a.length,m=d!==-1||u!==-1?a.slice(0,Math.min(f,v)):a,h=e.elm=o(i)&&o(n=i.ns)?w.createElementNS(n,m):w.createElement(m);for(f<v&&(h.id=a.slice(f+1,v)),u>0&&(h.className=a.slice(v+1).replace(/\./g," ")),n=0;n<k.create.length;++n)k.create[n](c,e);if(s.array(l))for(n=0;n<l.length;++n){var y=l[n];null!=y&&w.appendChild(h,p(y,t))}else s.primitive(e.text)&&w.appendChild(h,w.createTextNode(e.text));n=e.data.hook,o(n)&&(n.create&&n.create(c,e),n.insert&&t.push(e))}else e.elm=w.createTextNode(e.text);return e.elm}function m(e,t,n,r,o,i){for(;r<=o;++r){var l=n[r];null!=l&&w.insertBefore(e,p(l,i),t)}}function h(e){var t,n,r=e.data;if(void 0!==r){for(o(t=r.hook)&&o(t=t.destroy)&&t(e),t=0;t<k.destroy.length;++t)k.destroy[t](e);if(void 0!==e.children)for(n=0;n<e.children.length;++n)t=e.children[n],null!=t&&"string"!=typeof t&&h(t)}}function y(e,t,n,r){for(;n<=r;++n){var i=void 0,l=void 0,a=void 0,u=t[n];if(null!=u)if(o(u.sel)){for(h(u),l=k.remove.length+1,a=d(u.elm,l),i=0;i<k.remove.length;++i)k.remove[i](u,a);o(i=u.data)&&o(i=i.hook)&&o(i=i.remove)?i(u,a):a()}else w.removeChild(e,u.elm)}}function g(e,t,n,o){for(var l,d,u,s,f=0,c=0,v=t.length-1,h=t[0],g=t[v],x=n.length-1,M=n[0],k=n[x];f<=v&&c<=x;)null==h?h=t[++f]:null==g?g=t[--v]:null==M?M=n[++c]:null==k?k=n[--x]:i(h,M)?(b(h,M,o),h=t[++f],M=n[++c]):i(g,k)?(b(g,k,o),g=t[--v],k=n[--x]):i(h,k)?(b(h,k,o),w.insertBefore(e,h.elm,w.nextSibling(g.elm)),h=t[++f],k=n[--x]):i(g,M)?(b(g,M,o),w.insertBefore(e,g.elm,h.elm),g=t[--v],M=n[++c]):(void 0===l&&(l=a(t,f,v)),d=l[M.key],r(d)?(w.insertBefore(e,p(M,o),h.elm),M=n[++c]):(u=t[d],u.sel!==M.sel?w.insertBefore(e,p(M,o),h.elm):(b(u,M,o),t[d]=void 0,w.insertBefore(e,u.elm,h.elm)),M=n[++c]));f>v?(s=null==n[x+1]?null:n[x+1].elm,m(e,s,n,c,x,o)):c>x&&y(e,t,f,v)}function b(e,t,n){var i,l;o(i=t.data)&&o(l=i.hook)&&o(i=l.prepatch)&&i(e,t);var a=t.elm=e.elm,d=e.children,u=t.children;if(e!==t){if(void 0!==t.data){for(i=0;i<k.update.length;++i)k.update[i](e,t);i=t.data.hook,o(i)&&o(i=i.update)&&i(e,t)}r(t.text)?o(d)&&o(u)?d!==u&&g(a,d,u,n):o(u)?(o(e.text)&&w.setTextContent(a,""),m(a,null,u,0,u.length-1,n)):o(d)?y(a,d,0,d.length-1):o(e.text)&&w.setTextContent(a,""):e.text!==t.text&&w.setTextContent(a,t.text),o(l)&&o(i=l.postpatch)&&i(e,t)}}var x,M,k={},w=void 0!==t?t:f["default"];for(x=0;x<v.length;++x)for(k[v[x]]=[],M=0;M<e.length;++M){var C=e[M][v[x]];void 0!==C&&k[v[x]].push(C)}return function(e,t){var r,o,a,d=[];for(r=0;r<k.pre.length;++r)k.pre[r]();for(l(e)||(e=n(e)),i(e,t)?b(e,t,d):(o=e.elm,a=w.parentNode(o),p(t,d),null!==a&&(w.insertBefore(a,t.elm,w.nextSibling(o)),y(a,[e],0,0))),r=0;r<d.length;++r)d[r].data.hook.insert(d[r]);for(r=0;r<k.post.length;++r)k.post[r]();return t}}var u=e("./vnode"),s=e("./is"),f=e("./htmldomapi"),c=u["default"]("",{},[],void 0,void 0),v=["create","update","remove","destroy","pre","post"],p=e("./h");n.h=p.h;var m=e("./thunk");n.thunk=m.thunk,n.init=d},{"./h":1,"./htmldomapi":2,"./is":3,"./thunk":11,"./vnode":12}],11:[function(e,t,n){"use strict";function r(e,t){t.elm=e.elm,e.data.fn=t.data.fn,e.data.args=t.data.args,t.data=e.data,t.children=e.children,t.text=e.text,t.elm=e.elm}function o(e){var t=e.data,n=t.fn.apply(void 0,t.args);r(n,e)}function i(e,t){var n,o=e.data,i=t.data,l=o.args,a=i.args;for(o.fn===i.fn&&l.length===a.length||r(i.fn.apply(void 0,a),t),n=0;n<a.length;++n)if(l[n]!==a[n])return void r(i.fn.apply(void 0,a),t);r(e,t)}var l=e("./h");n.thunk=function(e,t,n,r){return void 0===r&&(r=n,n=t,t=void 0),l.h(e,{key:t,hook:{init:o,prepatch:i},fn:n,args:r})},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.thunk},{"./h":1}],12:[function(e,t,n){"use strict";function r(e,t,n,r,o){var i=void 0===t?void 0:t.key;return{sel:e,data:t,children:n,text:r,elm:o,key:i}}n.vnode=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}]},{},[9])(9)}); | ||
//# sourceMappingURL=snabbdom-patch.min.js.map |
@@ -220,2 +220,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.snabbdom = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
elm.className = sel.slice(dot + 1).replace(/\./g, ' '); | ||
for (i = 0; i < cbs.create.length; ++i) | ||
cbs.create[i](emptyNode, vnode); | ||
if (is.array(children)) { | ||
@@ -232,4 +234,2 @@ for (i = 0; i < children.length; ++i) { | ||
} | ||
for (i = 0; i < cbs.create.length; ++i) | ||
cbs.create[i](emptyNode, vnode); | ||
i = vnode.data.hook; // Reuse variable | ||
@@ -505,2 +505,2 @@ if (isDef(i)) { | ||
}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJoLmpzIiwiaHRtbGRvbWFwaS5qcyIsImlzLmpzIiwic25hYmJkb20uanMiLCJ0aHVuay5qcyIsInZub2RlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E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9iamVjdCcgJiYgY2hpbGRyZW4gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGNoaWxkcmVuLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICB2YXIgY2hpbGREYXRhID0gY2hpbGRyZW5baV0uZGF0YTtcbiAgICAgICAgICAgIGlmIChjaGlsZERhdGEgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIGFkZE5TKGNoaWxkRGF0YSwgY2hpbGRyZW5baV0uY2hpbGRyZW4sIGNoaWxkcmVuW2ldLnNlbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG5mdW5jdGlvbiBoKHNlbCwgYiwgYykge1xuICAgIHZhciBkYXRhID0ge30sIGNoaWxkcmVuLCB0ZXh0LCBpO1xuICAgIGlmIChjICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgZGF0YSA9IGI7XG4gICAgICAgIGlmIChpcy5hcnJheShjKSkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBjO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzLnByaW1pdGl2ZShjKSkge1xuICAgICAgICAgICAgdGV4dCA9IGM7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoYyAmJiBjLnNlbCkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBbY107XG4gICAgICAgIH1cbiAgICB9XG4gICAgZWxzZSBpZiAoYiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChpcy5hcnJheShiKSkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBiO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzLnByaW1pdGl2ZShiKSkge1xuICAgICAgICAgICAgdGV4dCA9IGI7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoYiAmJiBiLnNlbCkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBbYl07XG4gICAgICA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bklkeDsgaSA8PSBlbmRJZHg7ICsraSkge1xuICAgICAgICBjaCA9IGNoaWxkcmVuW2ldO1xuICAgICAgICBpZiAoY2ggIT0gbnVsbCkge1xuICAgICAgICAgICAga2V5ID0gY2gua2V5O1xuICAgICAgICAgICAgaWYgKGtleSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgIG1hcFtrZXldID0gaTtcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gbWFwO1xufVxudmFyIGhvb2tzID0gWydjcmVhdGUnLCAndXBkYXRlJywgJ3JlbW92ZScsICdkZXN0cm95JywgJ3ByZScsICdwb3N0J107XG52YXIgaF8xID0gcmVxdWlyZShcIi4vaFwiKTtcbmV4cG9ydHMuaCA9IGhfMS5oO1xudmFyIHRodW5rXzEgPSByZXF1aXJlKFwiLi90aHVua1wiKTtcbmV4cG9ydHMudGh1bmsgPSB0aHVua18xLnRodW5rO1xuZnVuY3Rpb24gaW5pdChtb2R1bGVzLCBkb21BcGkpIHtcbiAgICB2YXIgaSwgaiwgY2JzID0ge307XG4gICAgdmFyIGFwaSA9IGRvbUFwaSAhPT0gdW5kZWZpbmVkID8gZG9tQXBpIDogaHRtbGRvbWFwaV8xLmRlZmF1bHQ7XG4gICAgZm9yIChpID0gMDsgaSA8IGhvb2tzLmxlbmd0aDsgKytpKSB7XG4gICAgICAgIGNic1tob29rc1tpXV0gPSBbXTtcbiAgICAgICAgZm9yIChqID0gMDsgaiA8IG1vZHVsZXMubGVuZ3RoOyArK2opIHtcbiAgICAgICAgICAgIHZhciBob29rID0gbW9kdWxlc1tqXVtob29rc1tpXV07XG4gICAgICAgICAgICBpZiAoaG9vayAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgY2JzW2hvb2tzW2ldXS5wdXNoKGhvb2spO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIGZ1bmN0aW9uIGVtcHR5Tm9kZUF0KGVsbSkge1xuICAgICAgICB2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PSAnIScpIHtcbiAgICAgICAgICAgIGlmIChpc1VuZGVmKHZub2RlLnRleHQpKSB7XG4gICAgICAgICAgICAgICAgdm5vZGUudGV4dCA9ICcnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdm5vZGUuZWxtID0gYXBpLmNyZWF0ZUNvbW1lbnQodm5vZGUudGV4dCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoc2VsICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIC8vIFBhcnNlIHNlbGVjdG9yXG4gICAgICAgICAgICB2YXIgaGFzaElkeCA9IHNlbC5pbmRleE9mKCcjJyk7XG4gICAgICAgICAgICB2YXIgZG90SWR4ID0gc2VsLmluZGV4T2YoJy4nLCBoYXNoSWR4KTtcbiAgICAgICAgICAgIHZhciBoYXNoID0gaGFzaElkeCA+IDAgPyBoYXNoSWR4IDogc2VsLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciBkb3QgPSBkb3RJZHggPiAwID8gZG90SWR4IDogc2VsLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciB0YWcgPSBoYXNoSWR4ICE9PSAtMSB8fCBkb3RJZHggIT09IC0xID8gc2VsLnNsaWNlKDAsIE1hdGgubWluKGhhc2gsIGRvdCkpIDogc2VsO1xuICAgICAgICAgICAgdmFyIGVsbSA9IHZub2RlLmVsbSA9IGlzRGVmKGRhdGEpICYmIGlzRGVmKGkgPSBkYXRhLm5zKSA/IGFwaS5jcmVhdGVFbGVtZW50TlMoaSwgdGFnKVxuICAgICAgICAgICAgICAgIDogYXBpLmNyZWF0ZUVsZW1lbnQodGFnKTtcbiAgICAgICAgICAgIGlmIChoYXNoIDwgZG90KVxuICAgICAgICAgICAgICAgIGVsbS5pZCA9IHNlbC5zbGljZShoYXNoICsgMSwgZG90KTtcbiAgICAgICAgICAgIGlmIChkb3RJZHggPiAwKVxuICAgICAgICAgICAgICAgIGVsbS5jbGFzc05hbWUgPSBzZWwuc2xpY2UoZG90ICsgMSkucmVwbGFjZSgvXFwuL2csICcgJyk7XG4gICAgICAgICAgICBpZiAoaXMuYXJyYXkoY2hpbGRyZW4pKSB7XG4gICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGNoaWxkcmVuLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBjaCA9IGNoaWxkcmVuW2ldO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2ggIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYXBpLmFwcGVuZENoaWxkKGVsbSwgY3JlYXRlRWxtKGNoLCBpbnNlcnRlZFZub2RlUXVldWUpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGlzLnByaW1pdGl2ZSh2bm9kZS50ZXh0KSkge1xuICAgICAgICAgICAgICAgIGFwaS5hcHBlbmRDaGlsZChlbG0sIGFwaS5jcmVhdGVUZXh0Tm9kZSh2bm9kZS50ZXh0KSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY2JzLmNyZWF0ZS5sZW5ndGg7ICsraSlcbiAgICAgICAgICAgICAgICBjYnMuY3JlYXRlW2ldKGVtcHR5Tm9kZSwgdm5vZGUpO1xuICAgICAgICAgICAgaSA9IHZub2RlLmRhdGEuaG9vazsgLy8gUmV1c2UgdmFyaWFibGVcbiAgICAgICAgICAgIGlmIChpc0RlZihpKSkge1xuICAgICAgICAgICAgICAgIGlmIChpLmNyZWF0ZSlcbiAgICAgICAgICAgICAgICAgICAgaS5jcmVhdGUoZW1wdHlOb2RlLCB2bm9kZSk7XG4gICAgICAgICAgICAgICAgaWYgKGkuaW5zZXJ0KVxuICAgICAgICAgICAgICAgICAgICBpbnNlcnRlZFZub2RlUXVldWUucHVzaCh2bm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIC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mxlbmd0aDsgKytqKSB7XG4gICAgICAgICAgICAgICAgICAgIGkgPSB2bm9kZS5jaGlsZHJlbltqXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gbnVsbCAmJiB0eXBlb2YgaSAhPT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW52b2tlRGVzdHJveUhvb2soaSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgZnVuY3Rpb24gcmVtb3ZlVm5vZGVzKHBhcmVudEVsbSwgdm5vZGVzLCBzdGFydElkeCwgZW5kSWR4KSB7XG4gICAgICAgIGZvciAoOyBzdGFydElkeCA8PSBlbmRJZHg7ICsrc3RhcnRJZHgpIHtcbiAgICAgICAgICAgIHZhciBpXzEgPSB2b2lkIDAsIGxpc3RlbmVycyA9IHZvaWQgMCwgcm0gPSB2b2lkIDAsIGNoID0gdm5vZGVzW3N0YXJ0SWR4XTtcbiAgICAgICAgICAgIGlmIChjaCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaWYgKGlzRGVmKGNoLnNlbCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52b2tlRGVzdHJveUhvb2soY2gpO1xuICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lcnMgPSBjYnMucmVtb3ZlLmxlbmd0aCArIDE7XG4gICAgICAgICAgICAgICAgICAgIHJtID0gY3JlYXRlUm1DYihjaC5lbG0sIGxpc3RlbmVycyk7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaV8xID0gMDsgaV8xIDwgY2JzLnJlbW92ZS5sZW5ndGg7ICsraV8xKVxuICAgICAgICAgICAgICAgICAgICAgICAgY2JzLnJlbW92ZVtpXzFdKGNoLCBybSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0RlZihpXzEgPSBjaC5kYXRhKSAmJiBpc0RlZihpXzEgPSBpXzEuaG9vaykgJiYgaXNEZWYoaV8xID0gaV8xLnJlbW92ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlfMShjaCwgcm0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcm0oKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYXBpLnJlbW92ZUNoaWxkKHBhcmVudEVsbSwgY2guZWxtKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgZnVuY3Rpb24gdXBkYXRlQ2hpbGRyZW4ocGFyZW50RWxtLCBvbGRDaCwgbmV3Q2gsIGluc2VydGVkVm5vZGVRdWV1ZSkge1xuICAgICAgICB2YXIgb2xkU3RhcnRJZHggPSAwLCBuZXdTdGFydElkeCA9IDA7XG4gICAgICAgIHZhciBvbGRFbmRJZHggPSBvbGRDaC5sZW5ndGggLSAxO1xuICAgICAgICB2YXIgb2xkU3RhcnRWbm9kZSA9IG9sZENoWzBdO1xuICAgICAgICB2YXIgb2xkRW5kVm5vZGUgPSBvbGRDaFtvbGRFbmRJZHhdO1xuICAgICAgICB2YXIgbmV3RW5kSWR4ID0gbmV3Q2gubGVuZ3RoIC0gMTtcbiAgICAgICAgdmFyIG5ld1N0YXJ0Vm5vZGUgPSBuZXdDaFswXTtcbiAgICAgICAgdmFyIG5ld0VuZFZub2RlID0gbmV3Q2hbbmV3RW5kSWR4XTtcbiAgICAgICAgdmFyIG9sZEtleVRvSWR4O1xuICAgICAgICB2YXIgaWR4SW5PbGQ7XG4gICAgICAgIHZhciBlbG1Ub01vdmU7XG4gICAgICAgIHZhciBiZWZvcmU7XG4gICAgICAgIHdoaWxlIChvbGRTdGFydElkeCA8PSBvbGRFbmRJZHggJiYgbmV3U3RhcnRJZHggPD0gbmV3RW5kSWR4KSB7XG4gICAgICAgICAgICBpZiAob2xkU3RhcnRWbm9kZSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgb2xkU3RhcnRWbm9kZSA9IG9sZENoWysrb2xkU3RhcnRJZHhdOyAvLyBWbm9kZSBtaWdodCBoYXZlIGJlZW4gbW92ZWQgbGVmdFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAob2xkRW5kVm5vZGUgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG9sZEVuZFZub2RlID0gb2xkQ2hbLS1vbGRFbmRJZHhdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAobmV3U3RhcnRWbm9kZSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgbmV3U3RhcnRWbm9kZSA9IG5ld0NoWysrbmV3U3RhcnRJZHhdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAobmV3RW5kVm5vZGUgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG5ld0VuZFZub2RlID0gbmV3Q2hbLS1uZXdFbmRJZHhdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoc2FtZVZub2RlKG9sZFN0YXJ0Vm5vZGUsIG5ld1N0YXJ0Vm5vZGUpKSB7XG4gICAgICAgICAgICAgICAgcGF0Y2hWbm9kZShvbGRTdGFydFZub2RlLCBuZXdTdGFydFZub2RlLCBpbnNlcnRlZFZub2RlUXVldWUpO1xuICAgICAgICAgICAgICAgIG9sZFN0YXJ0Vm5vZGUgPSBvbGRDaFsrK29sZFN0YXJ0SWR4XTtcbiAgICAgICAgICAgICAgICBuZXdTdGFydFZub2RlID0gbmV3Q2hbKytuZXdTdGFydElkeF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChzYW1lVm5vZGUob2xkRW5kVm5vZGUsIG5ld0VuZFZub2RlKSkge1xuICAgICAgICA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gICAgICAgIHBhdGNoVm5vZGUoZWxtVG9Nb3ZlLCBuZXdTdGFydFZub2RlLCBpbnNlcnRlZFZub2RlUXVldWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgb2xkQ2hbaWR4SW5PbGRdID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgYXBpLmluc2VydEJlZm9yZShwYXJlbnRFbG0sIGVsbVRvTW92ZS5lbG0sIG9sZFN0YXJ0Vm5vZGUuZWxtKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBuZXdTdGFydFZub2RlID0gbmV3Q2hbKytuZXdTdGFydElkeF07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChvbGRTdGFydElkeCA+IG9sZEVuZElkeCkge1xuICAgICAgICAgICAgYmVmb3JlID0gbmV3Q2hbbmV3RW5kSWR4ICsgMV0gPT0gbnVsbCA/IG51bGwgOiBuZXdDaFtuZXdFbmRJZHggKyAxXS5lbG07XG4gICAgICAgICAgICBhZGRWbm9kZXMocGFyZW50RWxtLCBiZWZvcmUsIG5ld0NoLCBuZXdTdGFydElkeCwgbmV3RW5kSWR4LCBpbnNlcnRlZFZub2RlUXVldWUpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKG5ld1N0YXJ0SWR4ID4gbmV3RW5kSWR4KSB7XG4gICAgICAgICAgICByZW1vdmVWbm9kZXMocGFyZW50RWxtLCBvbGRDaCwgb2xkU3RhcnRJZHgsIG9sZEVuZElkeCk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgZnVuY3Rpb24gcGF0Y2hWbm9kZShvbGRWbm9kZSwgdm5vZGUsIGluc2VydGVkVm5vZGVRdWV1ZSkge1xuICAgICAgICB2YXIgaSwgaG9vaztcbiAgICAgICAgaWYgKGlzRGVmKGkgPSB2bm9kZS5kYXRhKSAmJiBpc0RlZihob29rID0gaS5ob29rKSAmJiBpc0RlZihpID0gaG9vay5wcmVwYXRjaCkpIHtcbiAgICAgICAgICAgIGkob2xkVm5vZGUsIHZub2RlKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgZWxtID0gdm5vZGUuZWxtID0gb2xkVm5vZGUuZWxtO1xuICAgICAgICB2YXIgb2xkQ2ggPSBvbGRWbm9kZS5jaGlsZHJlbjtcbiAgICAgICAgdmFyIGNoID0gdm5vZGUuY2hpbGRyZW47XG4gICAgICAgIGlmIChvbGRWbm9kZSA9PT0gdm5vZGUpXG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIGlmICh2bm9kZS5kYXRhICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBjYnMudXBkYXRlLmxlbmd0aDsgKytpKVxuICAgICAgICAgICAgICAgIGNicy51cGRhdGVbaV0ob2xkVm5vZGUsIHZub2RlKTtcbiAgICAgICAgICAgIGkgPSB2bm9kZS5kYXRhLmhvb2s7XG4gICAgICAgICAgICBpZiAoaXNEZWYoaSkgJiYgaXNEZWYoaSA9IGkudXBkYXRlKSlcbiAgICAgICAgICAgICAgICBpKG9sZFZub2RlLCB2bm9kZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzVW5kZWYodm5vZGUudGV4dCkpIHtcbiAgICAgICAgICAgIGlmIChpc0RlZihvbGRDaCkgJiYgaXNEZWYoY2gpKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9sZENoICE9PSBjaClcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlQ2hpbGRyZW4oZWxtLCBvbGRDaCwgY2gsIGluc2VydGVkVm5vZGVRdWV1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChpc0RlZihjaCkpIHtcbiAgICAgICAgICAgICAgICBpZiAoaXNEZWYob2xkVm5vZGUudGV4dCkpXG4gICAgICAgICAgICAgICAgICAgIGFwaS5zZXRUZXh0Q29udGVudChlbG0sICcnKTtcbiAgICAgICAgICAgICAgICBhZGRWbm9kZXMoZWxtLCBudWxsLCBjaCwgMCwgY2gubGVuZ3RoIC0gMSwgaW5zZXJ0ZWRWbm9kZVF1ZXVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGlzRGVmKG9sZENoKSkge1xuICAgICAgICAgICAgICAgIHJlbW92ZVZub2RlcyhlbG0sIG9sZENoLCAwLCBvbGRDaC5sZW5ndGggLSAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGlzRGVmKG9sZFZub2RlLnRleHQpKSB7XG4gICAgICAgICAgICAgICAgYXBpLnNldFRleHRDb250ZW50KGVsbSwgJycpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKG9sZFZub2RlLnRleHQgIT09IHZub2RlLnRleHQpIHtcbiAgICAgICAgICAgIGFwaS5zZXRUZXh0Q29udGVudChlbG0sIHZub2RlLnRleHQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChpc0RlZihob29rKSAmJiBpc0RlZihpID0gaG9vay5wb3N0cGF0Y2gpKSB7XG4gICAgICAgICAgICBpKG9sZFZub2RlLCB2bm9kZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIGZ1bmN0aW9uIHBhdGNoKG9sZFZub2RlLCB2bm9kZSkge1xuICAgICAgICB2YXIgaSwgZWxtLCBwYXJlbnQ7XG4gICAgICAgIHZhciBpbnNlcnRlZFZub2RlUXVldWUgPSBbXTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGNicy5wcmUubGVuZ3RoOyArK2kpXG4gICAgICAgICAgICBjYnMucHJlW2ldKCk7XG4gICAgICAgIGlmICghaXNWbm9kZShvbGRWbm9kZSkpIHtcbiAgICAgICAgICAgIG9sZFZub2RlID0gZW1wdHlOb2RlQXQob2xkVm5vZGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzYW1lVm5vZGUob2xkVm5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cy5hcnJheShjKSkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBjO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzLnByaW1pdGl2ZShjKSkge1xuICAgICAgICAgICAgdGV4dCA9IGM7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoYyAmJiBjLnNlbCkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBbY107XG4gICAgICAgIH1cbiAgICB9XG4gICAgZWxzZSBpZiAoYiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChpcy5hcnJheShiKSkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBiO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzLnByaW1pdGl2ZShiKSkge1xuICAgICAgICAgICAgdGV4dCA9IGI7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoYiAmJiBiLnNlbCkge1xuICAgICAgICAgICAgY2hpbGRyZW4gPSBbYl07XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBkYXRhID0gYjtcbiAgICAgICAgfVxuICAgIH1cbiAgICBpZiAoaXMuYXJyYXkoY2hpbGRyZW4pKSB7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBjaGlsZHJlbi5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgaWYgKGlzLnByaW1pdGl2ZShjaGlsZHJlbltpXSkpXG4gICAgICAgICAgICAgICAgY2hpbGRyZW5baV0gPSB2bm9kZV8xLnZub2RlKHVuZGVmaW5lZCwgdW5kZWZpbmVkLCB1bmRlZmluZWQsIGNoaWxkcmVuW2ldKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBpZiAoc2VsWzBdID09PSAncycgJiYgc2VsWzFdID09PSAndicgJiYgc2VsWzJdID09PSAnZycgJiZcbiAgICAgICAgKHNlbC5sZW5ndGggPT09IDMgfHwgc2VsWzNdID09PSAnLicgfHwgc2VsWzNdID09PSAn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ICAgICAgICBhcGkucmVtb3ZlQ2hpbGQocGFyZW50XzEsIGNoaWxkRWxtKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9XG4gICAgZnVuY3Rpb24gY3JlYXRlRWxtKHZub2RlLCBpbnNlcnRlZFZub2RlUXVldWUpIHtcbiAgICAgICAgdmFyIGksIGRhdGEgPSB2bm9kZS5kYXRhO1xuICAgICAgICBpZiAoZGF0YSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBpZiAoaXNEZWYoaSA9IGRhdGEuaG9vaykgJiYgaXNEZWYoaSA9IGkuaW5pdCkpIHtcbiAgICAgICAgICAgICAgICBpKHZub2RlKTtcbiAgICAgICAgICAgICAgICBkYXRhID0gdm5vZGUuZGF0YTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgY2hpbGRyZW4gPSB2bm9kZS5jaGlsZHJlbiwgc2VsID0gdm5vZGUuc2VsO1xuICAgICAgICBpZiAoc2VsID09PSAnIScpIHtcbiAgICAgICAgICAgIGlmIChpc1VuZGVmKHZub2RlLnRleHQpKSB7XG4gICAgICAgICAgICAgICAgdm5vZGUudGV4dCA9ICcnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdm5vZGUuZWxtID0gYXBpLmNyZWF0ZUNvbW1lbnQodm5vZGUudGV4dCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoc2VsICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIC8vIFBhcnNlIHNlbGVjdG9yXG4gICAgICAgICAgICB2YXIgaGFzaElkeCA9IHNlbC5pbmRleE9mKCcjJyk7XG4gICAgICAgICAgICB2YXIgZG90SWR4ID0gc2VsLmluZGV4T2YoJy4nLCBoYXNoSWR4KTtcbiAgICAgICAgICAgIHZhciBoYXNoID0gaGFzaElkeCA+IDAgPyBoYXNoSWR4IDogc2VsLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciBkb3QgPSBkb3RJZHggPiAwID8gZG90SWR4IDogc2VsLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciB0YWcgPSBoYXNoSWR4ICE9PSAtMSB8fCBkb3RJZHggIT09IC0xID8gc2VsLnNsaWNlKDAsIE1hdGgubWluKGhhc2gsIGRvdCkpIDogc2VsO1xuICAgICAgICAgICAgdmFyIGVsbSA9IHZub2RlLmVsbSA9IGlzRGVmKGRhdGEpICYmIGlzRGVmKGkgPSBkYXRhLm5zKSA/IGFwaS5jcmVhdGVFbGVtZW50TlMoaSwgdGFnKVxuICAgICAgICAgICAgICAgIDogYXBpLmNyZWF0ZUVsZW1lbnQodGFnKTtcbiAgICAgICAgICAgIGlmIChoYXNoIDwgZG90KVxuICAgICAgICAgICAgICAgIGVsbS5pZCA9IHNlbC5zbGljZShoYXNoICsgMSwgZG90KTtcbiAgICAgICAgICAgIGlmIChkb3RJZHggPiAwKVxuICAgICAgICAgICAgICAgIGVsbS5jbGFzc05hbWUgPSBzZWwuc2xpY2UoZG90ICsgMSkucmVwbGFjZSgvXFwuL2csICcgJyk7XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY2JzLmNyZWF0ZS5sZW5ndGg7ICsraSlcbiAgICAgICAgICAgICAgICBjYnMuY3JlYXRlW2ldKGVtcHR5Tm9kZSwgdm5vZGUpO1xuICAgICAgICAgICAgaWYgKGlzLmFycmF5KGNoaWxkcmVuKSkge1xuICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBjaGlsZHJlbi5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgY2ggPSBjaGlsZHJlbltpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFwaS5hcHBlbmRDaGlsZChlbG0sIGNyZWF0ZUVsbShjaCwgaW5zZXJ0ZWRWbm9kZVF1ZXVlKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChpcy5wcmltaXRpdmUodm5vZGUudGV4dCkpIHtcbiAgICAgICAgICAgICAgICBhcGkuYXBwZW5kQ2hpbGQoZWxtLCBhcGkuY3JlYXRlVGV4dE5vZGUodm5vZGUudGV4dCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaSA9IHZub2RlLmRhdGEuaG9vazsgLy8gUmV1c2UgdmFyaWFibGVcbiAgICAgICAgICAgIGlmIChpc0RlZihpKSkge1xuICAgICAgICAgICAgICAgIGlmIChpLmNyZWF0ZSlcbiAgICAgICAgICAgICAgICAgICAgaS5jcmVhdGUoZW1wdHlOb2RlLCB2bm9kZSk7XG4gICAgICAgICAgICAgICAgaWYgKGkuaW5zZXJ0KVxuICAgICAgICAgICAgICAgICAgICBpbnNlcnRlZFZub2RlUXVldWUucHVzaCh2bm9kZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICB2bm9kZS5lbG0gPSBhcGkuY3JlYXRlVGV4dE5vZGUodm5vZGUudGV4dCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHZub2RlLmVsbTtcbiAgICB9XG4gICAgZnVuY3Rpb24gYWRkVm5vZGVzKHBhcmVudEVsbSwgYmVmb3JlLCB2bm9kZXMsIHN0YXJ0SWR4LCBlbmRJZHgsIGluc2VydGVkVm5vZGVRdWV1ZSkge1xuICAgICAgICBmb3IgKDsgc3RhcnRJZHggPD0gZW5kSWR4OyArK3N0YXJ0SWR4KSB7XG4gICAgICAgICAgICB2YXIgY2ggPSB2bm9kZXNbc3RhcnRJZHhdO1xuICAgICAgICAgICAgaWYgKGNoICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBhcGkuaW5zZXJ0QmVmb3JlKHBhcmVudEVsbSwgY3JlYXRlRWxtKGNoLCBpbnNlcnRlZFZub2RlUXVldWUpLCBiZWZvcmUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIGZ1bmN0aW9uIGludm9rZURlc3Ryb3lIb29rKHZub2RlKSB7XG4gICAgICAgIHZhciBpLCBqLCBkYXRhID0gdm5vZGUuZGF0YTtcbiAgICAgICAgaWYgKGRhdGEgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgaWYgKGlzRGVmKGkgPSBkYXRhLmhvb2spICYmIGlzRGVmKGkgPSBpLmRlc3Ryb3kpKVxuICAgICAgICAgICAgICAgIGkodm5vZGUpO1xuICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGNicy5kZXN0cm95Lmxlbmd0aDsgKytpKVxuICAgICAgICAgICAgICAgIGNicy5kZXN0cm95W2ldKHZub2RlKTtcbiAgICAgICAgICAgIGlmICh2bm9kZS5jaGlsZHJlbiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IHZub2RlLmNoaWxkcmVuLmxlbmd0aDsgKytqKSB7XG4gICAgICAgICAgICAgICAgICAgIGkgPSB2bm9kZS5jaGlsZHJlbltqXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gbnVsbCAmJiB0eXBlb2YgaSAhPT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW52b2tlRGVzdHJveUhvb2soaSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgZnVuY3Rpb24gcmVtb3ZlVm5vZGVzKHBhcmVudEVsbSwgdm5vZGVzLCBzdGFydElkeCwgZW5kSWR4KSB7XG4gICAgICAgIGZvciAoOyBzdGFydElkeCA8PSBlbmRJZHg7ICsrc3RhcnRJZHgpIHtcbiAgICAgICAgICAgIHZhciBpXzEgPSB2b2lkIDAsIGxpc3RlbmVycyA9IHZvaWQgMCwgcm0gPSB2b2lkIDAsIGNoID0gdm5vZGVzW3N0YXJ0SWR4XTtcbiAgICAgICAgICAgIGlmIChjaCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaWYgKGlzRGVmKGNoLnNlbCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaW52b2tlRGVzdHJveUhvb2soY2gpO1xuICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lcnMgPSBjYnMucmVtb3ZlLmxlbmd0aCArIDE7XG4gICAgICAgICAgICAgICAgICAgIHJtID0gY3JlYXRlUm1DYihjaC5lbG0sIGxpc3RlbmVycyk7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaV8xID0gMDsgaV8xIDwgY2JzLnJlbW92ZS5sZW5ndGg7ICsraV8xKVxuICAgICAgICAgICAgICAgICAgICAgICAgY2JzLnJlbW92ZVtpXzFdKGNoLCBybSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0RlZihpXzEgPSBjaC5kYXRhKSAmJiBpc0RlZihpXzEgPSBpXzEuaG9vaykgJiYgaXNEZWYoaV8xID0gaV8xLnJlbW92ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlfMShjaCwgcm0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcm0oKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYXBpLnJlbW92ZUNoaWxkKHBhcmVudEVsbSwgY2guZWxtKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgZnVuY3Rpb24gdXBkYXRlQ2hpbGRyZW4ocGFyZW50RWxtLCBvbGRDaCwgbmV3Q2gsIGluc2VydGVkVm5vZGVRdWV1ZSkge1xuICAgICAgICB2YXIgb2xkU3RhcnRJZHggPSAw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ldWUpLCBvbGRTdGFydFZub2RlLmVsbSk7XG4gICAgICAgICAgICAgICAgICAgIG5ld1N0YXJ0Vm5vZGUgPSBuZXdDaFsrK25ld1N0YXJ0SWR4XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGVsbVRvTW92ZSA9IG9sZENoW2lkeEluT2xkXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVsbVRvTW92ZS5zZWwgIT09IG5ld1N0YXJ0Vm5vZGUuc2VsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBhcGkuaW5zZXJ0QmVmb3JlKHBhcmVudEVsbSwgY3JlYXRlRWxtKG5ld1N0YXJ0Vm5vZGUsIGluc2VydGVkVm5vZGVRdWV1ZSksIG9sZFN0YXJ0Vm5vZGUuZWxtKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGNoVm5vZGUoZWxtVG9Nb3ZlLCBuZXdTdGFydFZub2RlLCBpbnNlcnRlZFZub2RlUXVldWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgb2xkQ2hbaWR4SW5PbGRdID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgYXBpLmluc2VydEJlZm9yZShwYXJlbnRFbG0sIGVsbVRvTW92ZS5lbG0sIG9sZFN0YXJ0Vm5vZGUuZWxtKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBuZXdTdGFydFZub2RlID0gbmV3Q2hbKytuZXdTdGFydElkeF07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChvbGRTdGFydElkeCA+IG9sZEVuZElkeCkge1xuICAgICAgICAgICAgYmVmb3JlID0gbmV3Q2hbbmV3RW5kSWR4ICsgMV0gPT0gbnVsbCA/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s7XG4gICAgICAgICAgICBpZiAoaXNEZWYoaSkgJiYgaXNEZWYoaSA9IGkudXBkYXRlKSlcbiAgICAgICAgICAgICAgICBpKG9sZFZub2RlLCB2bm9kZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzVW5kZWYodm5vZGUudGV4dCkpIHtcbiAgICAgICAgICAgIGlmIChpc0RlZihvbGRDaCkgJiYgaXNEZWYoY2gpKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9sZENoICE9PSBjaClcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlQ2hpbGRyZW4oZWxtLCBvbGRDaCwgY2gsIGluc2VydGVkVm5vZGVRdWV1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmIChpc0RlZihjaCkpIHtcbiAgICAgICAgICAgICAgICBpZiAoaXNEZWYob2xkVm5vZGUudGV4dCkpXG4gICAgICAgICAgICAgICAgICAgIGFwaS5zZXRUZXh0Q29udGVudChlbG0sICcnKTtcbiAgICAgICAgICAgICAgICBhZGRWbm9kZXMoZWxtLCBudWxsLCBjaCwgMCwgY2gubGVuZ3RoIC0gMSwgaW5zZXJ0ZWRWbm9kZVF1ZXVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGlzRGVmKG9sZENoKSkge1xuICAgICAgICAgICAgICAgIHJlbW92ZVZub2RlcyhlbG0sIG9sZENoLCAwLCBvbGRDaC5sZW5ndGggLSAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgaWYgKGlzRGVmKG9sZFZub2RlLnRleHQpKSB7XG4gICAgICAgICAgICAgICAgYXBpLnNldFRleHRDb250ZW50KGVsbSwgJycpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKG9sZFZub2RlLnRleHQgIT09IHZub2RlLnRleHQpIHtcbiAgICAgICAgICAgIGFwaS5zZXRUZXh0Q29udGVudChlbG0sIHZub2RlLnRleHQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChpc0RlZihob29rKSAmJiBpc0RlZihpID0gaG9vay5wb3N0cGF0Y2gpKSB7XG4gICAgICAgICAgICBpKG9sZFZub2RlLCB2bm9kZSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIGZ1bmN0aW9uIHBhdGNoKG9sZFZub2RlLCB2bm9kZSkge1xuICAgICAgICB2YXIgaSwgZWxtLCBwYXJlbnQ7XG4gICAgICAgIHZhciBpbnNlcnRlZFZub2RlUXVldWUgPSBbXTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGNicy5wcmUubGVuZ3RoOyArK2kpXG4gICAgICAgICAgICBjYnMucHJlW2ldKCk7XG4gICAgICAgIGlmICghaXNWbm9kZShvbGRWbm9kZSkpIHtcbiAgICAgICAgICAgIG9sZFZub2RlID0gZW1wdHlOb2RlQXQob2xkVm5vZGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzYW1lVm5vZGUob2xkVm5vZGUsIHZub2RlKSkge1xuICAgICAgICAgICAgcGF0Y2hWbm9kZShvbGRWbm9kZSwgdm5vZGUsIGluc2VydGVkVm5vZGVRdWV1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBlbG0gPSBvbGRWbm9kZS5lbG07XG4gICAgICAgICAgICBwYXJlbnQgPSBhcGkucGFyZW50Tm9kZShlbG0pO1xuICAgICAgICAgICAgY3JlYXRlRWxtKHZub2RlLCBpbnNlcnRlZFZub2RlUXVldWUpO1xuICAgICAgICAgICAgaWYgKHBhcmVudCAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIGFwaS5pbnNlcnRCZWZvcmUocGFyZW50LCB2bm9kZS5lbG0sIGFwaS5uZXh0U2libGluZyhlbG0pKTtcbiAgICAgICAgICAgICAgICByZW1vdmVWbm9kZXMocGFyZW50LCBbb2xkVm5vZGVdLCAwLCAwKTtcbiAgICAgICAgICAgIH1cbiAgICAgICA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Xhwb3J0cy50aHVuaztcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPXRodW5rLmpzLm1hcCIsIlwidXNlIHN0cmljdFwiO1xuZnVuY3Rpb24gdm5vZGUoc2VsLCBkYXRhLCBjaGlsZHJlbiwgdGV4dCwgZWxtKSB7XG4gICAgdmFyIGtleSA9IGRhdGEgPT09IHVuZGVmaW5lZCA/IHVuZGVmaW5lZCA6IGRhdGEua2V5O1xuICAgIHJldHVybiB7IHNlbDogc2VsLCBkYXRhOiBkYXRhLCBjaGlsZHJlbjogY2hpbGRyZW4sXG4gICAgICAgIHRleHQ6IHRleHQsIGVsbTogZWxtLCBrZXk6IGtleSB9O1xufVxuZXhwb3J0cy52bm9kZSA9IHZub2RlO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsIFwiX19lc01vZHVsZVwiLCB7IHZhbHVlOiB0cnVlIH0pO1xuZXhwb3J0cy5kZWZhdWx0ID0gdm5vZGU7XG4vLyMgc291cmNlTWFwcGluZ1VSTD12bm9kZS5qcy5tYXAiXX0= |
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.snabbdom=e()}}(function(){return function e(t,n,r){function o(l,a){if(!n[l]){if(!t[l]){var d="function"==typeof require&&require;if(!a&&d)return d(l,!0);if(i)return i(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[l]={exports:{}};t[l][0].call(f.exports,function(e){var n=t[l][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,t,n){"use strict";function r(e,t,n){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==t)for(var o=0;o<t.length;++o){var i=t[o].data;void 0!==i&&r(i,t[o].children,t[o].sel)}}function o(e,t,n){var o,a,d,u={};if(void 0!==n?(u=t,l.array(n)?o=n:l.primitive(n)?a=n:n&&n.sel&&(o=[n])):void 0!==t&&(l.array(t)?o=t:l.primitive(t)?a=t:t&&t.sel?o=[t]:u=t),l.array(o))for(d=0;d<o.length;++d)l.primitive(o[d])&&(o[d]=i.vnode(void 0,void 0,void 0,o[d]));return"s"!==e[0]||"v"!==e[1]||"g"!==e[2]||3!==e.length&&"."!==e[3]&&"#"!==e[3]||r(u,o,e),i.vnode(e,u,o,a,void 0)}var i=e("./vnode"),l=e("./is");n.h=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./is":3,"./vnode":6}],2:[function(e,t,n){"use strict";function r(e){return document.createElement(e)}function o(e,t){return document.createElementNS(e,t)}function i(e){return document.createTextNode(e)}function l(e){return document.createComment(e)}function a(e,t,n){e.insertBefore(t,n)}function d(e,t){e.removeChild(t)}function u(e,t){e.appendChild(t)}function f(e){return e.parentNode}function c(e){return e.nextSibling}function s(e){return e.tagName}function v(e,t){e.textContent=t}function h(e){return e.textContent}function m(e){return 1===e.nodeType}function p(e){return 3===e.nodeType}function g(e){return 8===e.nodeType}n.htmlDomApi={createElement:r,createElementNS:o,createTextNode:i,createComment:l,insertBefore:a,removeChild:d,appendChild:u,parentNode:f,nextSibling:c,tagName:s,setTextContent:v,getTextContent:h,isElement:m,isText:p,isComment:g},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.htmlDomApi},{}],3:[function(e,t,n){"use strict";function r(e){return"string"==typeof e||"number"==typeof e}n.array=Array.isArray,n.primitive=r},{}],4:[function(e,t,n){"use strict";function r(e){return void 0===e}function o(e){return void 0!==e}function i(e,t){return e.key===t.key&&e.sel===t.sel}function l(e){return void 0!==e.sel}function a(e,t,n){var r,o,i,l={};for(r=t;r<=n;++r)i=e[r],null!=i&&(o=i.key,void 0!==o&&(l[o]=r));return l}function d(e,t){function n(e){var t=e.id?"#"+e.id:"",n=e.className?"."+e.className.split(" ").join("."):"";return u["default"](b.tagName(e).toLowerCase()+t+n,{},[],void 0,e)}function d(e,t){return function(){if(0===--t){var n=b.parentNode(e);b.removeChild(n,e)}}}function h(e,t){var n,i=e.data;void 0!==i&&o(n=i.hook)&&o(n=n.init)&&(n(e),i=e.data);var l=e.children,a=e.sel;if("!"===a)r(e.text)&&(e.text=""),e.elm=b.createComment(e.text);else if(void 0!==a){var d=a.indexOf("#"),u=a.indexOf(".",d),c=d>0?d:a.length,v=u>0?u:a.length,m=d!==-1||u!==-1?a.slice(0,Math.min(c,v)):a,p=e.elm=o(i)&&o(n=i.ns)?b.createElementNS(n,m):b.createElement(m);if(c<v&&(p.id=a.slice(c+1,v)),u>0&&(p.className=a.slice(v+1).replace(/\./g," ")),f.array(l))for(n=0;n<l.length;++n){var g=l[n];null!=g&&b.appendChild(p,h(g,t))}else f.primitive(e.text)&&b.appendChild(p,b.createTextNode(e.text));for(n=0;n<N.create.length;++n)N.create[n](s,e);n=e.data.hook,o(n)&&(n.create&&n.create(s,e),n.insert&&t.push(e))}else e.elm=b.createTextNode(e.text);return e.elm}function m(e,t,n,r,o,i){for(;r<=o;++r){var l=n[r];null!=l&&b.insertBefore(e,h(l,i),t)}}function p(e){var t,n,r=e.data;if(void 0!==r){for(o(t=r.hook)&&o(t=t.destroy)&&t(e),t=0;t<N.destroy.length;++t)N.destroy[t](e);if(void 0!==e.children)for(n=0;n<e.children.length;++n)t=e.children[n],null!=t&&"string"!=typeof t&&p(t)}}function g(e,t,n,r){for(;n<=r;++n){var i=void 0,l=void 0,a=void 0,u=t[n];if(null!=u)if(o(u.sel)){for(p(u),l=N.remove.length+1,a=d(u.elm,l),i=0;i<N.remove.length;++i)N.remove[i](u,a);o(i=u.data)&&o(i=i.hook)&&o(i=i.remove)?i(u,a):a()}else b.removeChild(e,u.elm)}}function x(e,t,n,o){for(var l,d,u,f,c=0,s=0,v=t.length-1,p=t[0],x=t[v],k=n.length-1,C=n[0],N=n[k];c<=v&&s<=k;)null==p?p=t[++c]:null==x?x=t[--v]:null==C?C=n[++s]:null==N?N=n[--k]:i(p,C)?(y(p,C,o),p=t[++c],C=n[++s]):i(x,N)?(y(x,N,o),x=t[--v],N=n[--k]):i(p,N)?(y(p,N,o),b.insertBefore(e,p.elm,b.nextSibling(x.elm)),p=t[++c],N=n[--k]):i(x,C)?(y(x,C,o),b.insertBefore(e,x.elm,p.elm),x=t[--v],C=n[++s]):(void 0===l&&(l=a(t,c,v)),d=l[C.key],r(d)?(b.insertBefore(e,h(C,o),p.elm),C=n[++s]):(u=t[d],u.sel!==C.sel?b.insertBefore(e,h(C,o),p.elm):(y(u,C,o),t[d]=void 0,b.insertBefore(e,u.elm,p.elm)),C=n[++s]));c>v?(f=null==n[k+1]?null:n[k+1].elm,m(e,f,n,s,k,o)):s>k&&g(e,t,c,v)}function y(e,t,n){var i,l;o(i=t.data)&&o(l=i.hook)&&o(i=l.prepatch)&&i(e,t);var a=t.elm=e.elm,d=e.children,u=t.children;if(e!==t){if(void 0!==t.data){for(i=0;i<N.update.length;++i)N.update[i](e,t);i=t.data.hook,o(i)&&o(i=i.update)&&i(e,t)}r(t.text)?o(d)&&o(u)?d!==u&&x(a,d,u,n):o(u)?(o(e.text)&&b.setTextContent(a,""),m(a,null,u,0,u.length-1,n)):o(d)?g(a,d,0,d.length-1):o(e.text)&&b.setTextContent(a,""):e.text!==t.text&&b.setTextContent(a,t.text),o(l)&&o(i=l.postpatch)&&i(e,t)}}var k,C,N={},b=void 0!==t?t:c["default"];for(k=0;k<v.length;++k)for(N[v[k]]=[],C=0;C<e.length;++C){var T=e[C][v[k]];void 0!==T&&N[v[k]].push(T)}return function(e,t){var r,o,a,d=[];for(r=0;r<N.pre.length;++r)N.pre[r]();for(l(e)||(e=n(e)),i(e,t)?y(e,t,d):(o=e.elm,a=b.parentNode(o),h(t,d),null!==a&&(b.insertBefore(a,t.elm,b.nextSibling(o)),g(a,[e],0,0))),r=0;r<d.length;++r)d[r].data.hook.insert(d[r]);for(r=0;r<N.post.length;++r)N.post[r]();return t}}var u=e("./vnode"),f=e("./is"),c=e("./htmldomapi"),s=u["default"]("",{},[],void 0,void 0),v=["create","update","remove","destroy","pre","post"],h=e("./h");n.h=h.h;var m=e("./thunk");n.thunk=m.thunk,n.init=d},{"./h":1,"./htmldomapi":2,"./is":3,"./thunk":5,"./vnode":6}],5:[function(e,t,n){"use strict";function r(e,t){t.elm=e.elm,e.data.fn=t.data.fn,e.data.args=t.data.args,t.data=e.data,t.children=e.children,t.text=e.text,t.elm=e.elm}function o(e){var t=e.data,n=t.fn.apply(void 0,t.args);r(n,e)}function i(e,t){var n,o=e.data,i=t.data,l=o.args,a=i.args;for(o.fn===i.fn&&l.length===a.length||r(i.fn.apply(void 0,a),t),n=0;n<a.length;++n)if(l[n]!==a[n])return void r(i.fn.apply(void 0,a),t);r(e,t)}var l=e("./h");n.thunk=function(e,t,n,r){return void 0===r&&(r=n,n=t,t=void 0),l.h(e,{key:t,hook:{init:o,prepatch:i},fn:n,args:r})},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.thunk},{"./h":1}],6:[function(e,t,n){"use strict";function r(e,t,n,r,o){var i=void 0===t?void 0:t.key;return{sel:e,data:t,children:n,text:r,elm:o,key:i}}n.vnode=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}]},{},[4])(4)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.snabbdom=e()}}(function(){return function e(t,n,r){function o(l,a){if(!n[l]){if(!t[l]){var d="function"==typeof require&&require;if(!a&&d)return d(l,!0);if(i)return i(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[l]={exports:{}};t[l][0].call(f.exports,function(e){var n=t[l][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,t,n){"use strict";function r(e,t,n){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==t)for(var o=0;o<t.length;++o){var i=t[o].data;void 0!==i&&r(i,t[o].children,t[o].sel)}}function o(e,t,n){var o,a,d,u={};if(void 0!==n?(u=t,l.array(n)?o=n:l.primitive(n)?a=n:n&&n.sel&&(o=[n])):void 0!==t&&(l.array(t)?o=t:l.primitive(t)?a=t:t&&t.sel?o=[t]:u=t),l.array(o))for(d=0;d<o.length;++d)l.primitive(o[d])&&(o[d]=i.vnode(void 0,void 0,void 0,o[d]));return"s"!==e[0]||"v"!==e[1]||"g"!==e[2]||3!==e.length&&"."!==e[3]&&"#"!==e[3]||r(u,o,e),i.vnode(e,u,o,a,void 0)}var i=e("./vnode"),l=e("./is");n.h=o,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=o},{"./is":3,"./vnode":6}],2:[function(e,t,n){"use strict";function r(e){return document.createElement(e)}function o(e,t){return document.createElementNS(e,t)}function i(e){return document.createTextNode(e)}function l(e){return document.createComment(e)}function a(e,t,n){e.insertBefore(t,n)}function d(e,t){e.removeChild(t)}function u(e,t){e.appendChild(t)}function f(e){return e.parentNode}function c(e){return e.nextSibling}function s(e){return e.tagName}function v(e,t){e.textContent=t}function h(e){return e.textContent}function m(e){return 1===e.nodeType}function p(e){return 3===e.nodeType}function g(e){return 8===e.nodeType}n.htmlDomApi={createElement:r,createElementNS:o,createTextNode:i,createComment:l,insertBefore:a,removeChild:d,appendChild:u,parentNode:f,nextSibling:c,tagName:s,setTextContent:v,getTextContent:h,isElement:m,isText:p,isComment:g},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.htmlDomApi},{}],3:[function(e,t,n){"use strict";function r(e){return"string"==typeof e||"number"==typeof e}n.array=Array.isArray,n.primitive=r},{}],4:[function(e,t,n){"use strict";function r(e){return void 0===e}function o(e){return void 0!==e}function i(e,t){return e.key===t.key&&e.sel===t.sel}function l(e){return void 0!==e.sel}function a(e,t,n){var r,o,i,l={};for(r=t;r<=n;++r)i=e[r],null!=i&&(o=i.key,void 0!==o&&(l[o]=r));return l}function d(e,t){function n(e){var t=e.id?"#"+e.id:"",n=e.className?"."+e.className.split(" ").join("."):"";return u["default"](b.tagName(e).toLowerCase()+t+n,{},[],void 0,e)}function d(e,t){return function(){if(0===--t){var n=b.parentNode(e);b.removeChild(n,e)}}}function h(e,t){var n,i=e.data;void 0!==i&&o(n=i.hook)&&o(n=n.init)&&(n(e),i=e.data);var l=e.children,a=e.sel;if("!"===a)r(e.text)&&(e.text=""),e.elm=b.createComment(e.text);else if(void 0!==a){var d=a.indexOf("#"),u=a.indexOf(".",d),c=d>0?d:a.length,v=u>0?u:a.length,m=d!==-1||u!==-1?a.slice(0,Math.min(c,v)):a,p=e.elm=o(i)&&o(n=i.ns)?b.createElementNS(n,m):b.createElement(m);for(c<v&&(p.id=a.slice(c+1,v)),u>0&&(p.className=a.slice(v+1).replace(/\./g," ")),n=0;n<N.create.length;++n)N.create[n](s,e);if(f.array(l))for(n=0;n<l.length;++n){var g=l[n];null!=g&&b.appendChild(p,h(g,t))}else f.primitive(e.text)&&b.appendChild(p,b.createTextNode(e.text));n=e.data.hook,o(n)&&(n.create&&n.create(s,e),n.insert&&t.push(e))}else e.elm=b.createTextNode(e.text);return e.elm}function m(e,t,n,r,o,i){for(;r<=o;++r){var l=n[r];null!=l&&b.insertBefore(e,h(l,i),t)}}function p(e){var t,n,r=e.data;if(void 0!==r){for(o(t=r.hook)&&o(t=t.destroy)&&t(e),t=0;t<N.destroy.length;++t)N.destroy[t](e);if(void 0!==e.children)for(n=0;n<e.children.length;++n)t=e.children[n],null!=t&&"string"!=typeof t&&p(t)}}function g(e,t,n,r){for(;n<=r;++n){var i=void 0,l=void 0,a=void 0,u=t[n];if(null!=u)if(o(u.sel)){for(p(u),l=N.remove.length+1,a=d(u.elm,l),i=0;i<N.remove.length;++i)N.remove[i](u,a);o(i=u.data)&&o(i=i.hook)&&o(i=i.remove)?i(u,a):a()}else b.removeChild(e,u.elm)}}function x(e,t,n,o){for(var l,d,u,f,c=0,s=0,v=t.length-1,p=t[0],x=t[v],k=n.length-1,C=n[0],N=n[k];c<=v&&s<=k;)null==p?p=t[++c]:null==x?x=t[--v]:null==C?C=n[++s]:null==N?N=n[--k]:i(p,C)?(y(p,C,o),p=t[++c],C=n[++s]):i(x,N)?(y(x,N,o),x=t[--v],N=n[--k]):i(p,N)?(y(p,N,o),b.insertBefore(e,p.elm,b.nextSibling(x.elm)),p=t[++c],N=n[--k]):i(x,C)?(y(x,C,o),b.insertBefore(e,x.elm,p.elm),x=t[--v],C=n[++s]):(void 0===l&&(l=a(t,c,v)),d=l[C.key],r(d)?(b.insertBefore(e,h(C,o),p.elm),C=n[++s]):(u=t[d],u.sel!==C.sel?b.insertBefore(e,h(C,o),p.elm):(y(u,C,o),t[d]=void 0,b.insertBefore(e,u.elm,p.elm)),C=n[++s]));c>v?(f=null==n[k+1]?null:n[k+1].elm,m(e,f,n,s,k,o)):s>k&&g(e,t,c,v)}function y(e,t,n){var i,l;o(i=t.data)&&o(l=i.hook)&&o(i=l.prepatch)&&i(e,t);var a=t.elm=e.elm,d=e.children,u=t.children;if(e!==t){if(void 0!==t.data){for(i=0;i<N.update.length;++i)N.update[i](e,t);i=t.data.hook,o(i)&&o(i=i.update)&&i(e,t)}r(t.text)?o(d)&&o(u)?d!==u&&x(a,d,u,n):o(u)?(o(e.text)&&b.setTextContent(a,""),m(a,null,u,0,u.length-1,n)):o(d)?g(a,d,0,d.length-1):o(e.text)&&b.setTextContent(a,""):e.text!==t.text&&b.setTextContent(a,t.text),o(l)&&o(i=l.postpatch)&&i(e,t)}}var k,C,N={},b=void 0!==t?t:c["default"];for(k=0;k<v.length;++k)for(N[v[k]]=[],C=0;C<e.length;++C){var T=e[C][v[k]];void 0!==T&&N[v[k]].push(T)}return function(e,t){var r,o,a,d=[];for(r=0;r<N.pre.length;++r)N.pre[r]();for(l(e)||(e=n(e)),i(e,t)?y(e,t,d):(o=e.elm,a=b.parentNode(o),h(t,d),null!==a&&(b.insertBefore(a,t.elm,b.nextSibling(o)),g(a,[e],0,0))),r=0;r<d.length;++r)d[r].data.hook.insert(d[r]);for(r=0;r<N.post.length;++r)N.post[r]();return t}}var u=e("./vnode"),f=e("./is"),c=e("./htmldomapi"),s=u["default"]("",{},[],void 0,void 0),v=["create","update","remove","destroy","pre","post"],h=e("./h");n.h=h.h;var m=e("./thunk");n.thunk=m.thunk,n.init=d},{"./h":1,"./htmldomapi":2,"./is":3,"./thunk":5,"./vnode":6}],5:[function(e,t,n){"use strict";function r(e,t){t.elm=e.elm,e.data.fn=t.data.fn,e.data.args=t.data.args,t.data=e.data,t.children=e.children,t.text=e.text,t.elm=e.elm}function o(e){var t=e.data,n=t.fn.apply(void 0,t.args);r(n,e)}function i(e,t){var n,o=e.data,i=t.data,l=o.args,a=i.args;for(o.fn===i.fn&&l.length===a.length||r(i.fn.apply(void 0,a),t),n=0;n<a.length;++n)if(l[n]!==a[n])return void r(i.fn.apply(void 0,a),t);r(e,t)}var l=e("./h");n.thunk=function(e,t,n,r){return void 0===r&&(r=n,n=t,t=void 0),l.h(e,{key:t,hook:{init:o,prepatch:i},fn:n,args:r})},Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=n.thunk},{"./h":1}],6:[function(e,t,n){"use strict";function r(e,t,n,r,o){var i=void 0===t?void 0:t.key;return{sel:e,data:t,children:n,text:r,elm:o,key:i}}n.vnode=r,Object.defineProperty(n,"__esModule",{value:!0}),n["default"]=r},{}]},{},[4])(4)}); | ||
//# sourceMappingURL=snabbdom.min.js.map |
@@ -27,2 +27,6 @@ var gulp = require('gulp') | ||
gulp.task('bundle:snabbdom:tovnode', function() { | ||
return standalone('tovnode', './tovnode.js') | ||
}) | ||
gulp.task('bundle:module:class', function() { | ||
@@ -52,2 +56,3 @@ return standalone('snabbdom_class', './modules/class.js') | ||
'bundle:snabbdom:h', | ||
'bundle:snabbdom:tovnode', | ||
'bundle:module:attributes', | ||
@@ -62,3 +67,3 @@ 'bundle:module:class', | ||
return gulp.src(['dist/*.js', '!dist/*.min.js']) | ||
.pipe(sourcemaps.init()) | ||
.pipe(sourcemaps.init()) | ||
.pipe(uglify()) | ||
@@ -70,7 +75,7 @@ .pipe(rename({ suffix: '.min' })) | ||
gulp.task('clean', function() { | ||
return gulp.src('dist/*.*', {read: false}) | ||
.pipe(clean()) | ||
gulp.task('clean', function() { | ||
return gulp.src('dist/*.*', {read: false}) | ||
.pipe(clean()) | ||
}) | ||
gulp.task('default', ['bundle']) |
"use strict"; | ||
var CAPS_REGEX = /[A-Z]/g; | ||
function updateDataset(oldVnode, vnode) { | ||
@@ -10,5 +11,11 @@ var elm = vnode.elm, oldDataset = oldVnode.data.dataset, dataset = vnode.data.dataset, key; | ||
dataset = dataset || {}; | ||
var d = elm.dataset; | ||
for (key in oldDataset) { | ||
if (!dataset[key]) { | ||
delete elm.dataset[key]; | ||
if (d) { | ||
delete d[key]; | ||
} | ||
else { | ||
elm.removeAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase()); | ||
} | ||
} | ||
@@ -18,3 +25,8 @@ } | ||
if (oldDataset[key] !== dataset[key]) { | ||
elm.dataset[key] = dataset[key]; | ||
if (d) { | ||
d[key] = dataset[key]; | ||
} | ||
else { | ||
elm.setAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase(), dataset[key]); | ||
} | ||
} | ||
@@ -21,0 +33,0 @@ } |
{ | ||
"name": "snabbdom", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "A virtual DOM library with focus on simplicity, modularity, powerful features and performance.", | ||
@@ -5,0 +5,0 @@ "main": "snabbdom.js", |
@@ -655,2 +655,4 @@ # Snabbdom | ||
Stateful components and observables on top of snabbdom | ||
* [Tweed](https://tweedjs.github.io) – | ||
An Object Oriented approach to reactive interfaces. | ||
@@ -657,0 +659,0 @@ Be sure to share it if you're building an application in another way |
@@ -84,2 +84,4 @@ "use strict"; | ||
elm.className = sel.slice(dot + 1).replace(/\./g, ' '); | ||
for (i = 0; i < cbs.create.length; ++i) | ||
cbs.create[i](emptyNode, vnode); | ||
if (is.array(children)) { | ||
@@ -96,4 +98,2 @@ for (i = 0; i < children.length; ++i) { | ||
} | ||
for (i = 0; i < cbs.create.length; ++i) | ||
cbs.create[i](emptyNode, vnode); | ||
i = vnode.data.hook; // Reuse variable | ||
@@ -100,0 +100,0 @@ if (isDef(i)) { |
import {VNode, VNodeData} from '../vnode'; | ||
import {Module} from './module'; | ||
const CAPS_REGEX = /[A-Z]/g; | ||
function updateDataset(oldVnode: VNode, vnode: VNode): void { | ||
var elm: HTMLElement = vnode.elm as HTMLElement, | ||
let elm: HTMLElement = vnode.elm as HTMLElement, | ||
oldDataset = (oldVnode.data as VNodeData).dataset, | ||
@@ -14,6 +16,11 @@ dataset = (vnode.data as VNodeData).dataset, | ||
dataset = dataset || {}; | ||
const d = elm.dataset; | ||
for (key in oldDataset) { | ||
if (!dataset[key]) { | ||
delete elm.dataset[key]; | ||
if (d) { | ||
delete d[key]; | ||
} else { | ||
elm.removeAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase()); | ||
} | ||
} | ||
@@ -23,3 +30,7 @@ } | ||
if (oldDataset[key] !== dataset[key]) { | ||
elm.dataset[key] = dataset[key]; | ||
if (d) { | ||
d[key] = dataset[key]; | ||
} else { | ||
elm.setAttribute('data-' + key.replace(CAPS_REGEX, '-$&').toLowerCase(), dataset[key]); | ||
} | ||
} | ||
@@ -26,0 +37,0 @@ } |
@@ -103,2 +103,3 @@ /* global module, document, Node */ | ||
if (dotIdx > 0) elm.className = sel.slice(dot + 1).replace(/\./g, ' '); | ||
for (i = 0; i < cbs.create.length; ++i) cbs.create[i](emptyNode, vnode); | ||
if (is.array(children)) { | ||
@@ -114,3 +115,2 @@ for (i = 0; i < children.length; ++i) { | ||
} | ||
for (i = 0; i < cbs.create.length; ++i) cbs.create[i](emptyNode, vnode); | ||
i = (vnode.data as VNodeData).hook; // Reuse variable | ||
@@ -117,0 +117,0 @@ if (isDef(i)) { |
@@ -30,3 +30,3 @@ import vnode, {VNode} from './vnode'; | ||
text = api.getTextContent(node) as string; | ||
return vnode(undefined, undefined, undefined, text, undefined); | ||
return vnode(undefined, undefined, undefined, text, node); | ||
} else if (api.isComment(node)) { | ||
@@ -33,0 +33,0 @@ text = api.getTextContent(node) as string; |
@@ -31,3 +31,3 @@ "use strict"; | ||
text = api.getTextContent(node); | ||
return vnode_1.default(undefined, undefined, undefined, text, undefined); | ||
return vnode_1.default(undefined, undefined, undefined, text, node); | ||
} | ||
@@ -34,0 +34,0 @@ else if (api.isComment(node)) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
714800
128
7038
661
10
45