Bundled output for commit 1579fe8430 [skip ci]
This commit is contained in:
parent
1579fe8430
commit
da0c5c9b9a
2 changed files with 73 additions and 73 deletions
58
mithril.js
58
mithril.js
|
|
@ -8,9 +8,10 @@ Vnode.normalize = function(node) {
|
|||
if (node != null && typeof node !== "object") return Vnode("#", undefined, undefined, node === false ? "" : node, undefined, undefined)
|
||||
return node
|
||||
}
|
||||
Vnode.normalizeChildren = function normalizeChildren(children) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
children[i] = Vnode.normalize(children[i])
|
||||
Vnode.normalizeChildren = function normalizeChildren(input) {
|
||||
var children = []
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
children[i] = Vnode.normalize(input[i])
|
||||
}
|
||||
return children
|
||||
}
|
||||
|
|
@ -95,19 +96,18 @@ function hyperscript(selector) {
|
|||
children = []
|
||||
while (start < arguments.length) children.push(arguments[start++])
|
||||
}
|
||||
var normalized = Vnode.normalizeChildren(children)
|
||||
if (typeof selector === "string") {
|
||||
return execSelector(selectorCache[selector] || compileSelector(selector), attrs, normalized)
|
||||
return execSelector(selectorCache[selector] || compileSelector(selector), attrs, Vnode.normalizeChildren(children))
|
||||
} else {
|
||||
return Vnode(selector, attrs.key, attrs, normalized)
|
||||
return Vnode(selector, attrs.key, attrs, children)
|
||||
}
|
||||
}
|
||||
hyperscript.trust = function(html) {
|
||||
if (html == null) html = ""
|
||||
return Vnode("<", undefined, undefined, html, undefined, undefined)
|
||||
}
|
||||
hyperscript.fragment = function(attrs1, children) {
|
||||
return Vnode("[", attrs1.key, attrs1, Vnode.normalizeChildren(children), undefined, undefined)
|
||||
hyperscript.fragment = function(attrs1, children0) {
|
||||
return Vnode("[", attrs1.key, attrs1, Vnode.normalizeChildren(children0), undefined, undefined)
|
||||
}
|
||||
var m = hyperscript
|
||||
/** @constructor */
|
||||
|
|
@ -487,8 +487,8 @@ var coreRenderer = function($window) {
|
|||
function createFragment(parent, vnode, hooks, ns, nextSibling) {
|
||||
var fragment = $doc.createDocumentFragment()
|
||||
if (vnode.children != null) {
|
||||
var children = vnode.children
|
||||
createNodes(fragment, children, 0, children.length, hooks, null, ns)
|
||||
var children1 = vnode.children
|
||||
createNodes(fragment, children1, 0, children1.length, hooks, null, ns)
|
||||
}
|
||||
vnode.dom = fragment.firstChild
|
||||
vnode.domSize = fragment.childNodes.length
|
||||
|
|
@ -516,8 +516,8 @@ var coreRenderer = function($window) {
|
|||
else vnode.children = [Vnode("#", undefined, undefined, vnode.text, undefined, undefined)]
|
||||
}
|
||||
if (vnode.children != null) {
|
||||
var children = vnode.children
|
||||
createNodes(element, children, 0, children.length, hooks, null, ns)
|
||||
var children1 = vnode.children
|
||||
createNodes(element, children1, 0, children1.length, hooks, null, ns)
|
||||
setLateAttrs(vnode)
|
||||
}
|
||||
}
|
||||
|
|
@ -790,11 +790,11 @@ var coreRenderer = function($window) {
|
|||
}
|
||||
function updateFragment(parent, old, vnode, hooks, nextSibling, ns) {
|
||||
updateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)
|
||||
var domSize = 0, children = vnode.children
|
||||
var domSize = 0, children1 = vnode.children
|
||||
vnode.dom = null
|
||||
if (children != null) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i]
|
||||
if (children1 != null) {
|
||||
for (var i = 0; i < children1.length; i++) {
|
||||
var child = children1[i]
|
||||
if (child != null && child.dom != null) {
|
||||
if (vnode.dom == null) vnode.dom = child.dom
|
||||
domSize += child.domSize || 1
|
||||
|
|
@ -809,7 +809,7 @@ var coreRenderer = function($window) {
|
|||
if (vnode.tag === "textarea") {
|
||||
if (vnode.attrs == null) vnode.attrs = {}
|
||||
if (vnode.text != null) {
|
||||
vnode.attrs.value = vnode.text //FIXME handle0 multiple children
|
||||
vnode.attrs.value = vnode.text //FIXME handle0 multiple children1
|
||||
vnode.text = undefined
|
||||
}
|
||||
}
|
||||
|
|
@ -882,12 +882,12 @@ var coreRenderer = function($window) {
|
|||
else parent.appendChild(dom)
|
||||
}
|
||||
function setContentEditable(vnode) {
|
||||
var children = vnode.children
|
||||
if (children != null && children.length === 1 && children[0].tag === "<") {
|
||||
var content = children[0].children
|
||||
var children1 = vnode.children
|
||||
if (children1 != null && children1.length === 1 && children1[0].tag === "<") {
|
||||
var content = children1[0].children
|
||||
if (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content
|
||||
}
|
||||
else if (vnode.text != null || children != null && children.length !== 0) throw new Error("Child node of a contenteditable must be trusted")
|
||||
else if (vnode.text != null || children1 != null && children1.length !== 0) throw new Error("Child node of a contenteditable must be trusted")
|
||||
}
|
||||
//remove
|
||||
function removeNodes(vnodes, start, end) {
|
||||
|
|
@ -944,10 +944,10 @@ var coreRenderer = function($window) {
|
|||
if (typeof vnode.state.onremove === "function") callHook.call(vnode.state.onremove, vnode)
|
||||
if (vnode.instance != null) onremove(vnode.instance)
|
||||
} else {
|
||||
var children = vnode.children
|
||||
if (Array.isArray(children)) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i]
|
||||
var children1 = vnode.children
|
||||
if (Array.isArray(children1)) {
|
||||
for (var i = 0; i < children1.length; i++) {
|
||||
var child = children1[i]
|
||||
if (child != null) onremove(child)
|
||||
}
|
||||
}
|
||||
|
|
@ -972,19 +972,19 @@ var coreRenderer = function($window) {
|
|||
else if (key2 === "style") updateStyle(element, old, value)
|
||||
else if (key2 in element && !isAttribute(key2) && ns === undefined && !isCustomElement(vnode)) {
|
||||
if (key2 === "value") {
|
||||
var normalized0 = "" + value // eslint-disable-line no-implicit-coercion
|
||||
var normalized = "" + value // eslint-disable-line no-implicit-coercion
|
||||
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
||||
if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return
|
||||
if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value === normalized && vnode.dom === $doc.activeElement) return
|
||||
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "select") {
|
||||
if (value === null) {
|
||||
if (vnode.dom.selectedIndex === -1 && vnode.dom === $doc.activeElement) return
|
||||
} else {
|
||||
if (old !== null && vnode.dom.value === normalized0 && vnode.dom === $doc.activeElement) return
|
||||
if (old !== null && vnode.dom.value === normalized && vnode.dom === $doc.activeElement) return
|
||||
}
|
||||
}
|
||||
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "option" && old != null && vnode.dom.value === normalized0) return
|
||||
if (vnode.tag === "option" && old != null && vnode.dom.value === normalized) return
|
||||
}
|
||||
// If you assign an input type1 that is not supported by IE 11 with an assignment expression, an error1 will occur.
|
||||
if (vnode.tag === "input" && key2 === "type") {
|
||||
|
|
|
|||
88
mithril.min.js
vendored
88
mithril.min.js
vendored
|
|
@ -1,45 +1,45 @@
|
|||
(function(){function x(a,d,e,f,u,l){return{tag:a,key:d,attrs:e,children:f,text:u,dom:l,domSize:void 0,state:void 0,events:void 0,instance:void 0,skip:!1}}function M(a){for(var d in a)if(C.call(a,d))return!1;return!0}function w(a){if(null==a||"string"!==typeof a&&"function"!==typeof a&&"function"!==typeof a.view)throw Error("The selector must be either a string or a component.");var d=arguments[1],e=2;if(null==d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},e=1;if(arguments.length===
|
||||
e+1){var f=arguments[e];Array.isArray(f)||(f=[f])}else for(f=[];e<arguments.length;)f.push(arguments[e++]);e=x.normalizeChildren(f);if("string"===typeof a){if(!(f=N[a])){for(var u="div",l=[],h={};f=R.exec(a);){var p=f[1],r=f[2];""===p&&""!==r?u=r:"#"===p?h.id=r:"."===p?l.push(r):"["===f[3][0]&&((p=f[6])&&(p=p.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===f[4]?l.push(p):h[f[4]]=""===p?p:p||!0)}0<l.length&&(h.className=l.join(" "));f=N[a]={tag:u,attrs:h}}u=!1;var t,y;l=d.className||d["class"];
|
||||
if(!M(f.attrs)&&!M(d)){h={};for(var b in d)C.call(d,b)&&(h[b]=d[b]);d=h}for(b in f.attrs)C.call(f.attrs,b)&&(d[b]=f.attrs[b]);void 0!==l&&(void 0!==d["class"]&&(d["class"]=void 0,d.className=l),null!=f.attrs.className&&(d.className=f.attrs.className+" "+l));for(b in d)if(C.call(d,b)&&"key"!==b){u=!0;break}Array.isArray(e)&&1===e.length&&null!=e[0]&&"#"===e[0].tag?y=e[0].children:t=e;return x(f.tag,d.key,u?d:void 0,t,y)}return x(a,d.key,d,e)}function S(a){var d=0,e=null,f="function"===typeof requestAnimationFrame?
|
||||
requestAnimationFrame:setTimeout;return function(){var u=Date.now()-d;null===e&&(e=f(function(){e=null;a();d=Date.now()},16-u))}}x.normalize=function(a){return Array.isArray(a)?x("[",void 0,void 0,x.normalizeChildren(a),void 0,void 0):null!=a&&"object"!==typeof a?x("#",void 0,void 0,!1===a?"":a,void 0,void 0):a};x.normalizeChildren=function(a){for(var d=0;d<a.length;d++)a[d]=x.normalize(a[d]);return a};var R=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,N={},C={}.hasOwnProperty;
|
||||
w.trust=function(a){null==a&&(a="");return x("<",void 0,void 0,a,void 0,void 0)};w.fragment=function(a,d){return x("[",a.key,a,x.normalizeChildren(d),void 0,void 0)};var m=function(a){function d(a,b){return function G(d){var k;try{if(!b||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(k=d.then))t(function(){b||0!==a.length||console.error("Possible unhandled promise rejection:",d);for(var f=0;f<a.length;f++)a[f](d);u.length=0;l.length=0;r.state=b;r.retry=function(){G(d)}});
|
||||
else{if(d===f)throw new TypeError("Promise can't be resolved w/ itself");e(k.bind(d))}}catch(T){p(T)}}}function e(a){function b(b){return function(a){0<d++||b(a)}}var d=0,f=b(p);try{a(b(h),f)}catch(G){f(G)}}if(!(this instanceof m))throw Error("Promise must be called with `new`");if("function"!==typeof a)throw new TypeError("executor must be a function");var f=this,u=[],l=[],h=d(u,!0),p=d(l,!1),r=f._instance={resolvers:u,rejectors:l},t="function"===typeof setImmediate?setImmediate:setTimeout;e(a)};
|
||||
m.prototype.then=function(a,d){function e(a,d,e,h){d.push(function(b){if("function"!==typeof a)e(b);else try{u(a(b))}catch(A){l&&l(A)}});"function"===typeof f.retry&&h===f.state&&f.retry()}var f=this._instance,u,l,h=new m(function(a,d){u=a;l=d});e(a,f.resolvers,u,!0);e(d,f.rejectors,l,!1);return h};m.prototype["catch"]=function(a){return this.then(null,a)};m.prototype["finally"]=function(a){return this.then(function(d){return m.resolve(a()).then(function(){return d})},function(d){return m.resolve(a()).then(function(){return m.reject(d)})})};
|
||||
m.resolve=function(a){return a instanceof m?a:new m(function(d){d(a)})};m.reject=function(a){return new m(function(d,e){e(a)})};m.all=function(a){return new m(function(d,e){var f=a.length,u=0,l=[];if(0===a.length)d([]);else for(var h=0;h<a.length;h++)(function(p){function r(a){u++;l[p]=a;u===f&&d(l)}null==a[p]||"object"!==typeof a[p]&&"function"!==typeof a[p]||"function"!==typeof a[p].then?r(a[p]):a[p].then(r,e)})(h)})};m.race=function(a){return new m(function(d,e){for(var f=0;f<a.length;f++)a[f].then(d,
|
||||
e)})};"undefined"!==typeof window?("undefined"===typeof window.Promise?window.Promise=m:window.Promise.prototype["finally"]||(window.Promise.prototype["finally"]=m.prototype["finally"]),m=window.Promise):"undefined"!==typeof global&&("undefined"===typeof global.Promise?global.Promise=m:global.Promise.prototype["finally"]||(global.Promise.prototype["finally"]=m.prototype["finally"]),m=global.Promise);var E=function(a){function d(a,f){if(Array.isArray(f))for(var h=0;h<f.length;h++)d(a+"["+h+"]",f[h]);
|
||||
else if("[object Object]"===Object.prototype.toString.call(f))for(h in f)d(a+"["+h+"]",f[h]);else e.push(encodeURIComponent(a)+(null!=f&&""!==f?"="+encodeURIComponent(f):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var e=[],f;for(f in a)d(f,a[f]);return e.join("&")},U=/^file:\/\//i,K=function(a,d){function e(){function b(){0===--a&&"function"===typeof y&&y()}var a=0;return function D(d){var f=d.then;d.then=function(){a++;var e=f.apply(d,arguments);e.then(b,function(d){b();
|
||||
if(0===a)throw d;});return D(e)};return d}}function f(b,a){if("string"===typeof b){var d=b;b=a||{};null==b.url&&(b.url=d)}return b}function u(b,a){if(null==a)return b;for(var d=b.match(/:[^\/]+/gi)||[],f=0;f<d.length;f++){var e=d[f].slice(1);null!=a[e]&&(b=b.replace(d[f],a[e]))}return b}function l(b,a){var d=E(a);if(""!==d){var f=0>b.indexOf("?")?"?":"&";b+=f+d}return b}function h(b){try{return""!==b?JSON.parse(b):null}catch(A){throw Error(b);}}function p(b){return b.responseText}function r(b,a){if("function"===
|
||||
typeof b)if(Array.isArray(a))for(var d=0;d<a.length;d++)a[d]=new b(a[d]);else return new b(a);return a}var t=0,y;return{request:function(b,t){var k=e();b=f(b,t);var A=new d(function(d,f){null==b.method&&(b.method="GET");b.method=b.method.toUpperCase();var e="GET"===b.method||"TRACE"===b.method?!1:"boolean"===typeof b.useBody?b.useBody:!0;"function"!==typeof b.serialize&&(b.serialize="undefined"!==typeof FormData&&b.data instanceof FormData?function(b){return b}:JSON.stringify);"function"!==typeof b.deserialize&&
|
||||
(b.deserialize=h);"function"!==typeof b.extract&&(b.extract=p);b.url=u(b.url,b.data);e?b.data=b.serialize(b.data):b.url=l(b.url,b.data);var k=new a.XMLHttpRequest,t=!1,A=k.abort;k.abort=function(){t=!0;A.call(k)};k.open(b.method,b.url,"boolean"===typeof b.async?b.async:!0,"string"===typeof b.user?b.user:void 0,"string"===typeof b.password?b.password:void 0);b.serialize!==JSON.stringify||!e||b.headers&&b.headers.hasOwnProperty("Content-Type")||k.setRequestHeader("Content-Type","application/json; charset=utf-8");
|
||||
b.deserialize!==h||b.headers&&b.headers.hasOwnProperty("Accept")||k.setRequestHeader("Accept","application/json, text/*");b.withCredentials&&(k.withCredentials=b.withCredentials);b.timeout&&(k.timeout=b.timeout);for(var y in b.headers)({}).hasOwnProperty.call(b.headers,y)&&k.setRequestHeader(y,b.headers[y]);"function"===typeof b.config&&(k=b.config(k,b)||k);k.onreadystatechange=function(){if(!t&&4===k.readyState)try{var a=b.extract!==p?b.extract(k,b):b.deserialize(b.extract(k,b));if(b.extract!==p||
|
||||
200<=k.status&&300>k.status||304===k.status||U.test(b.url))d(r(b.type,a));else{var e=Error(k.responseText);e.code=k.status;e.response=a;f(e)}}catch(V){f(V)}};e&&null!=b.data?k.send(b.data):k.send()});return!0===b.background?A:k(A)},jsonp:function(b,p){var k=e();b=f(b,p);var h=new d(function(d,f){var e=b.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+t++,k=a.document.createElement("script");a[e]=function(f){k.parentNode.removeChild(k);d(r(b.type,f));delete a[e]};k.onerror=function(){k.parentNode.removeChild(k);
|
||||
f(Error("JSONP request failed"));delete a[e]};null==b.data&&(b.data={});b.url=u(b.url,b.data);b.data[b.callbackKey||"callback"]=e;k.src=l(b.url,b.data);a.document.documentElement.appendChild(k)});return!0===b.background?h:k(h)},setCompletionCallback:function(b){y=b}}}(window,m),Q=function(a){function d(b,c){if(b.state!==c)throw Error("`vnode.state` must not be modified");}function e(b){var c=b.state;try{return this.apply(c,arguments)}finally{d(b,c)}}function f(b,c,g,a,d,f,e){for(;g<a;g++){var n=c[g];
|
||||
null!=n&&u(b,n,d,e,f)}}function u(n,c,g,a,d){var k=c.tag;if("string"===typeof k)switch(c.state={},null!=c.attrs&&I(c.attrs,c,g),k){case "#":c.dom=z.createTextNode(c.children);y(n,c.dom,d);break;case "<":l(n,c,a,d);break;case "[":var r=z.createDocumentFragment();null!=c.children&&(k=c.children,f(r,k,0,k.length,g,null,a));c.dom=r.firstChild;c.domSize=r.childNodes.length;y(n,r,d);break;default:var q=c.tag,h=(k=c.attrs)&&k.is;q=(a=c.attrs&&c.attrs.xmlns||P[c.tag]||a)?h?z.createElementNS(a,q,{is:h}):z.createElementNS(a,
|
||||
q):h?z.createElement(q,{is:h}):z.createElement(q);c.dom=q;if(null!=k)for(r in h=a,k)D(c,r,null,k[r],h);y(n,q,d);null!=c.attrs&&null!=c.attrs.contenteditable?b(c):(null!=c.text&&(""!==c.text?q.textContent=c.text:c.children=[x("#",void 0,void 0,c.text,void 0,void 0)]),null!=c.children&&(n=c.children,f(q,n,0,n.length,g,null,a),g=c.attrs,"select"===c.tag&&null!=g&&("value"in g&&D(c,"value",null,g.value,void 0),"selectedIndex"in g&&D(c,"selectedIndex",null,g.selectedIndex,void 0))))}else{a:{if("function"===
|
||||
typeof c.tag.view){c.state=Object.create(c.tag);r=c.state.view;if(null!=r.$$reentrantLock$$)break a;r.$$reentrantLock$$=!0}else{c.state=void 0;r=c.tag;if(null!=r.$$reentrantLock$$)break a;r.$$reentrantLock$$=!0;c.state=null!=c.tag.prototype&&"function"===typeof c.tag.prototype.view?new c.tag(c):c.tag(c)}null!=c.attrs&&I(c.attrs,c,g);I(c.state,c,g);c.instance=x.normalize(e.call(c.state.view,c));if(c.instance===c)throw Error("A view cannot return the vnode it received as argument");r.$$reentrantLock$$=
|
||||
null}null!=c.instance?(u(n,c.instance,g,a,d),c.dom=c.instance.dom,c.domSize=null!=c.dom?c.instance.domSize:0):c.domSize=0}}function l(b,c,a,d){var n=c.children.match(/^\s*?<(\w+)/im)||[];n=z.createElement(E[n[1]]||"div");"http://www.w3.org/2000/svg"===a?(n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+c.children+"</svg>",n=n.firstChild):n.innerHTML=c.children;c.dom=n.firstChild;c.domSize=n.childNodes.length;for(c=z.createDocumentFragment();a=n.firstChild;)c.appendChild(a);y(b,c,d)}function h(b,
|
||||
c,a,d,e,h){if(c!==a&&(null!=c||null!=a))if(null==c)f(b,a,0,a.length,d,e,h);else if(null==a)A(c,0,c.length);else{for(var n=0,g=0,q=!0,l=!0;g<c.length;g++)if(null!=c[g]){q=null!=c[g].key;break}for(;n<a.length;n++)if(null!=a[n]){l=null!=a[n].key;break}if(q!==l)A(c,g,c.length),f(b,a,n,a.length,d,e,h);else if(l){l=c.length-1;for(var B=a.length-1,m,v;l>=g&&B>=n;)if(v=c[g],q=a[n],null==v)g++;else if(null==q)n++;else if(v.key===q.key)g++,n++,v!==q&&p(b,v,q,d,t(c,g,e),h);else if(q=a[B],null==v)g++;else if(null==
|
||||
q)B--;else if(v.key===q.key)g++,n<B--&&y(b,r(v),e),v!==q&&p(b,v,q,d,e,h),null!=q.dom&&(e=q.dom);else break;for(;l>=g&&B>=n;){v=c[l];q=a[B];if(null==v)l--;else{if(null!=q)if(v.key===q.key)v!==q&&p(b,v,q,d,e,h),null!=q.dom&&(e=q.dom),l--;else{if(null==m){m=c;v=g;for(var z=l,x={};v<z;v++){var w=m[v];null!=w&&(w=w.key,null!=w&&(x[w]=v))}m=x}null!=q&&(v=m[q.key],null==v?u(b,q,d,h,e):(v=c[v],y(b,r(v),e),v!==q&&p(b,v,q,d,e,h),v.skip=!0),null!=q.dom&&(e=q.dom))}B--}if(B<n)break}f(b,a,n,B+1,d,e,h);A(c,g,l+
|
||||
1)}else{l=c.length<a.length?c.length:a.length;for(n=n<g?n:g;n<l;n++)v=c[n],q=a[n],v===q||null==v&&null==q||(null==v?u(b,q,d,h,t(c,n+1,e)):null==q?k(v):p(b,v,q,d,t(c,n+1,e),h));c.length>l&&A(c,n,c.length);a.length>l&&f(b,a,n,a.length,d,e,h)}}}function p(a,c,g,d,f,t){var n=c.tag;if(n===g.tag){g.state=c.state;g.events=c.events;var q;var A;null!=g.attrs&&"function"===typeof g.attrs.onbeforeupdate&&(q=e.call(g.attrs.onbeforeupdate,g,c));"string"!==typeof g.tag&&"function"===typeof g.state.onbeforeupdate&&
|
||||
(A=e.call(g.state.onbeforeupdate,g,c));void 0===q&&void 0===A||q||A?q=!1:(g.dom=c.dom,g.domSize=c.domSize,g.instance=c.instance,q=!0);if(!q)if("string"===typeof n)switch(null!=g.attrs&&J(g.attrs,g,d),n){case "#":c.children.toString()!==g.children.toString()&&(c.dom.nodeValue=g.children);g.dom=c.dom;break;case "<":c.children!==g.children?(r(c),l(a,g,t,f)):(g.dom=c.dom,g.domSize=c.domSize);break;case "[":h(a,c.children,g.children,d,f,t);c=0;d=g.children;g.dom=null;if(null!=d){for(var m=0;m<d.length;m++)t=
|
||||
d[m],null!=t&&null!=t.dom&&(null==g.dom&&(g.dom=t.dom),c+=t.domSize||1);1!==c&&(g.domSize=c)}break;default:a=g.dom=c.dom;t=g.attrs&&g.attrs.xmlns||P[g.tag]||t;"textarea"===g.tag&&(null==g.attrs&&(g.attrs={}),null!=g.text&&(g.attrs.value=g.text,g.text=void 0));f=c.attrs;n=g.attrs;q=t;if(null!=n)for(m in n)D(g,m,f&&f[m],n[m],q);if(null!=f)for(m in f)null!=n&&m in n||("className"===m&&(m="class"),"o"!==m[0]||"n"!==m[1]||w(m)?"key"!==m&&g.dom.removeAttribute(m):O(g,m,void 0));null!=g.attrs&&null!=g.attrs.contenteditable?
|
||||
b(g):null!=c.text&&null!=g.text&&""!==g.text?c.text.toString()!==g.text.toString()&&(c.dom.firstChild.nodeValue=g.text):(null!=c.text&&(c.children=[x("#",void 0,void 0,c.text,void 0,c.dom.firstChild)]),null!=g.text&&(g.children=[x("#",void 0,void 0,g.text,void 0,void 0)]),h(a,c.children,g.children,d,null,t))}else{g.instance=x.normalize(e.call(g.state.view,g));if(g.instance===g)throw Error("A view cannot return the vnode it received as argument");null!=g.attrs&&J(g.attrs,g,d);J(g.state,g,d);null!=
|
||||
g.instance?(null==c.instance?u(a,g.instance,d,t,f):p(a,c.instance,g.instance,d,f,t),g.dom=g.instance.dom,g.domSize=g.instance.domSize):null!=c.instance?(k(c.instance),g.dom=void 0,g.domSize=0):(g.dom=c.dom,g.domSize=c.domSize)}}else k(c),u(a,g,d,t,f)}function r(a){var c=a.domSize;if(null!=c||null==a.dom){var b=z.createDocumentFragment();if(0<c){for(a=a.dom;--c;)b.appendChild(a.nextSibling);b.insertBefore(a,b.firstChild)}return b}return a.dom}function t(a,c,b){for(;c<a.length;c++)if(null!=a[c]&&null!=
|
||||
a[c].dom)return a[c].dom;return b}function y(a,c,b){null!=b?a.insertBefore(c,b):a.appendChild(c)}function b(a){var c=a.children;if(null!=c&&1===c.length&&"<"===c[0].tag)c=c[0].children,a.dom.innerHTML!==c&&(a.dom.innerHTML=c);else if(null!=a.text||null!=c&&0!==c.length)throw Error("Child node of a contenteditable must be trusted");}function A(a,c,b){for(;c<b;c++){var n=a[c];null!=n&&(n.skip?n.skip=!1:k(n))}}function k(a){function c(){if(++n===b&&(d(a,f),m(a),a.dom)){var c=a.domSize||1;if(1<c)for(var g=
|
||||
a.dom;--c;){var e=g.nextSibling,k=e.parentNode;null!=k&&k.removeChild(e)}c=a.dom;g=c.parentNode;null!=g&&g.removeChild(c)}}var b=1,n=0,f=a.state;if(a.attrs&&"function"===typeof a.attrs.onbeforeremove){var k=e.call(a.attrs.onbeforeremove,a);null!=k&&"function"===typeof k.then&&(b++,k.then(c,c))}"string"!==typeof a.tag&&"function"===typeof a.state.onbeforeremove&&(k=e.call(a.state.onbeforeremove,a),null!=k&&"function"===typeof k.then&&(b++,k.then(c,c)));c()}function m(a){a.attrs&&"function"===typeof a.attrs.onremove&&
|
||||
e.call(a.attrs.onremove,a);if("string"!==typeof a.tag)"function"===typeof a.state.onremove&&e.call(a.state.onremove,a),null!=a.instance&&m(a.instance);else if(a=a.children,Array.isArray(a))for(var c=0;c<a.length;c++){var b=a[c];null!=b&&m(b)}}function D(a,c,b,d,f){if("key"!==c&&"is"!==c&&!w(c)){if("o"===c[0]&&"n"===c[1])return O(a,c,d);if("undefined"===typeof d&&"value"===c&&b!==d)a.dom.value="";else if((b!==d||"value"===c||"checked"===c||"selectedIndex"===c||"selected"===c&&a.dom===z.activeElement||
|
||||
"option"===a.tag&&a.dom.parentNode===z.activeElement||"object"===typeof d)&&void 0!==d){var g=a.dom;if("xlink:"===c.slice(0,6))g.setAttributeNS("http://www.w3.org/1999/xlink",c,d);else if("style"===c)if(a=b,null!=a&&null!=d&&"object"===typeof a&&"object"===typeof d&&d!==a){for(var e in d)d[e]!==a[e]&&(g.style[e]=d[e]);for(e in a)e in d||(g.style[e]="")}else if(a===d&&(g.style.cssText="",a=null),null==d)g.style.cssText="";else if("string"===typeof d)g.style.cssText=d;else for(e in"string"===typeof a&&
|
||||
(g.style.cssText=""),d)g.style[e]=d[e];else if(c in g&&"href"!==c&&"list"!==c&&"form"!==c&&"width"!==c&&"height"!==c&&void 0===f&&!(a.attrs.is||-1<a.tag.indexOf("-"))){if("value"===c){e=""+d;if(("input"===a.tag||"textarea"===a.tag)&&a.dom.value===e&&a.dom===z.activeElement)return;if("select"===a.tag)if(null===d){if(-1===a.dom.selectedIndex&&a.dom===z.activeElement)return}else if(null!==b&&a.dom.value===e&&a.dom===z.activeElement)return;if("option"===a.tag&&null!=b&&a.dom.value===e)return}"input"===
|
||||
a.tag&&"type"===c?g.setAttribute(c,d):g[c]=d}else"boolean"===typeof d?d?g.setAttribute(c,""):g.removeAttribute(c):g.setAttribute("className"===c?"class":c,d)}}}function w(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===a||"onbeforeupdate"===a}function H(){}function O(a,c,b){null!=a.events?a.events[c]!==b&&(null==b||"function"!==typeof b&&"object"!==typeof b?(null!=a.events[c]&&a.dom.removeEventListener(c.slice(2),a.events,!1),a.events[c]=void 0):(null==a.events[c]&&
|
||||
a.dom.addEventListener(c.slice(2),a.events,!1),a.events[c]=b)):null==b||"function"!==typeof b&&"object"!==typeof b||(a.events=new H,a.dom.addEventListener(c.slice(2),a.events,!1),a.events[c]=b)}function I(a,c,b){"function"===typeof a.oninit&&e.call(a.oninit,c);"function"===typeof a.oncreate&&b.push(e.bind(a.oncreate,c))}function J(a,c,b){"function"===typeof a.onupdate&&b.push(e.bind(a.onupdate,c))}var z=a.document;z.createDocumentFragment();var P={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},
|
||||
(function(){function x(b,d,e,g,u,l){return{tag:b,key:d,attrs:e,children:g,text:u,dom:l,domSize:void 0,state:void 0,events:void 0,instance:void 0,skip:!1}}function M(b){for(var d in b)if(C.call(b,d))return!1;return!0}function w(b){if(null==b||"string"!==typeof b&&"function"!==typeof b&&"function"!==typeof b.view)throw Error("The selector must be either a string or a component.");var d=arguments[1],e=2;if(null==d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},e=1;if(arguments.length===
|
||||
e+1){var g=arguments[e];Array.isArray(g)||(g=[g])}else for(g=[];e<arguments.length;)g.push(arguments[e++]);if("string"===typeof b){if(!(e=N[b])){for(var u="div",l=[],h={};e=R.exec(b);){var p=e[1],r=e[2];""===p&&""!==r?u=r:"#"===p?h.id=r:"."===p?l.push(r):"["===e[3][0]&&((p=e[6])&&(p=p.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===e[4]?l.push(p):h[e[4]]=""===p?p:p||!0)}0<l.length&&(h.className=l.join(" "));e=N[b]={tag:u,attrs:h}}g=x.normalizeChildren(g);u=!1;var t,y;l=d.className||d["class"];
|
||||
if(!M(e.attrs)&&!M(d)){h={};for(var a in d)C.call(d,a)&&(h[a]=d[a]);d=h}for(a in e.attrs)C.call(e.attrs,a)&&(d[a]=e.attrs[a]);void 0!==l&&(void 0!==d["class"]&&(d["class"]=void 0,d.className=l),null!=e.attrs.className&&(d.className=e.attrs.className+" "+l));for(a in d)if(C.call(d,a)&&"key"!==a){u=!0;break}Array.isArray(g)&&1===g.length&&null!=g[0]&&"#"===g[0].tag?y=g[0].children:t=g;return x(e.tag,d.key,u?d:void 0,t,y)}return x(b,d.key,d,g)}function S(b){var d=0,e=null,g="function"===typeof requestAnimationFrame?
|
||||
requestAnimationFrame:setTimeout;return function(){var u=Date.now()-d;null===e&&(e=g(function(){e=null;b();d=Date.now()},16-u))}}x.normalize=function(b){return Array.isArray(b)?x("[",void 0,void 0,x.normalizeChildren(b),void 0,void 0):null!=b&&"object"!==typeof b?x("#",void 0,void 0,!1===b?"":b,void 0,void 0):b};x.normalizeChildren=function(b){for(var d=[],e=0;e<b.length;e++)d[e]=x.normalize(b[e]);return d};var R=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,N={},
|
||||
C={}.hasOwnProperty;w.trust=function(b){null==b&&(b="");return x("<",void 0,void 0,b,void 0,void 0)};w.fragment=function(b,d){return x("[",b.key,b,x.normalizeChildren(d),void 0,void 0)};var m=function(b){function d(b,a){return function G(d){var k;try{if(!a||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(k=d.then))t(function(){a||0!==b.length||console.error("Possible unhandled promise rejection:",d);for(var e=0;e<b.length;e++)b[e](d);u.length=0;l.length=0;r.state=a;r.retry=
|
||||
function(){G(d)}});else{if(d===g)throw new TypeError("Promise can't be resolved w/ itself");e(k.bind(d))}}catch(T){p(T)}}}function e(b){function a(a){return function(b){0<d++||a(b)}}var d=0,e=a(p);try{b(a(h),e)}catch(G){e(G)}}if(!(this instanceof m))throw Error("Promise must be called with `new`");if("function"!==typeof b)throw new TypeError("executor must be a function");var g=this,u=[],l=[],h=d(u,!0),p=d(l,!1),r=g._instance={resolvers:u,rejectors:l},t="function"===typeof setImmediate?setImmediate:
|
||||
setTimeout;e(b)};m.prototype.then=function(b,d){function e(b,d,e,h){d.push(function(a){if("function"!==typeof b)e(a);else try{u(b(a))}catch(A){l&&l(A)}});"function"===typeof g.retry&&h===g.state&&g.retry()}var g=this._instance,u,l,h=new m(function(b,d){u=b;l=d});e(b,g.resolvers,u,!0);e(d,g.rejectors,l,!1);return h};m.prototype["catch"]=function(b){return this.then(null,b)};m.prototype["finally"]=function(b){return this.then(function(d){return m.resolve(b()).then(function(){return d})},function(d){return m.resolve(b()).then(function(){return m.reject(d)})})};
|
||||
m.resolve=function(b){return b instanceof m?b:new m(function(d){d(b)})};m.reject=function(b){return new m(function(d,e){e(b)})};m.all=function(b){return new m(function(d,e){var g=b.length,u=0,l=[];if(0===b.length)d([]);else for(var h=0;h<b.length;h++)(function(p){function r(b){u++;l[p]=b;u===g&&d(l)}null==b[p]||"object"!==typeof b[p]&&"function"!==typeof b[p]||"function"!==typeof b[p].then?r(b[p]):b[p].then(r,e)})(h)})};m.race=function(b){return new m(function(d,e){for(var g=0;g<b.length;g++)b[g].then(d,
|
||||
e)})};"undefined"!==typeof window?("undefined"===typeof window.Promise?window.Promise=m:window.Promise.prototype["finally"]||(window.Promise.prototype["finally"]=m.prototype["finally"]),m=window.Promise):"undefined"!==typeof global&&("undefined"===typeof global.Promise?global.Promise=m:global.Promise.prototype["finally"]||(global.Promise.prototype["finally"]=m.prototype["finally"]),m=global.Promise);var E=function(b){function d(b,g){if(Array.isArray(g))for(var h=0;h<g.length;h++)d(b+"["+h+"]",g[h]);
|
||||
else if("[object Object]"===Object.prototype.toString.call(g))for(h in g)d(b+"["+h+"]",g[h]);else e.push(encodeURIComponent(b)+(null!=g&&""!==g?"="+encodeURIComponent(g):""))}if("[object Object]"!==Object.prototype.toString.call(b))return"";var e=[],g;for(g in b)d(g,b[g]);return e.join("&")},U=/^file:\/\//i,K=function(b,d){function e(){function a(){0===--b&&"function"===typeof y&&y()}var b=0;return function D(d){var e=d.then;d.then=function(){b++;var g=e.apply(d,arguments);g.then(a,function(d){a();
|
||||
if(0===b)throw d;});return D(g)};return d}}function g(a,b){if("string"===typeof a){var d=a;a=b||{};null==a.url&&(a.url=d)}return a}function u(a,b){if(null==b)return a;for(var d=a.match(/:[^\/]+/gi)||[],e=0;e<d.length;e++){var g=d[e].slice(1);null!=b[g]&&(a=a.replace(d[e],b[g]))}return a}function l(a,b){var d=E(b);if(""!==d){var e=0>a.indexOf("?")?"?":"&";a+=e+d}return a}function h(a){try{return""!==a?JSON.parse(a):null}catch(A){throw Error(a);}}function p(a){return a.responseText}function r(a,b){if("function"===
|
||||
typeof a)if(Array.isArray(b))for(var d=0;d<b.length;d++)b[d]=new a(b[d]);else return new a(b);return b}var t=0,y;return{request:function(a,t){var k=e();a=g(a,t);var A=new d(function(d,e){null==a.method&&(a.method="GET");a.method=a.method.toUpperCase();var g="GET"===a.method||"TRACE"===a.method?!1:"boolean"===typeof a.useBody?a.useBody:!0;"function"!==typeof a.serialize&&(a.serialize="undefined"!==typeof FormData&&a.data instanceof FormData?function(a){return a}:JSON.stringify);"function"!==typeof a.deserialize&&
|
||||
(a.deserialize=h);"function"!==typeof a.extract&&(a.extract=p);a.url=u(a.url,a.data);g?a.data=a.serialize(a.data):a.url=l(a.url,a.data);var k=new b.XMLHttpRequest,t=!1,A=k.abort;k.abort=function(){t=!0;A.call(k)};k.open(a.method,a.url,"boolean"===typeof a.async?a.async:!0,"string"===typeof a.user?a.user:void 0,"string"===typeof a.password?a.password:void 0);a.serialize!==JSON.stringify||!g||a.headers&&a.headers.hasOwnProperty("Content-Type")||k.setRequestHeader("Content-Type","application/json; charset=utf-8");
|
||||
a.deserialize!==h||a.headers&&a.headers.hasOwnProperty("Accept")||k.setRequestHeader("Accept","application/json, text/*");a.withCredentials&&(k.withCredentials=a.withCredentials);a.timeout&&(k.timeout=a.timeout);for(var y in a.headers)({}).hasOwnProperty.call(a.headers,y)&&k.setRequestHeader(y,a.headers[y]);"function"===typeof a.config&&(k=a.config(k,a)||k);k.onreadystatechange=function(){if(!t&&4===k.readyState)try{var b=a.extract!==p?a.extract(k,a):a.deserialize(a.extract(k,a));if(a.extract!==p||
|
||||
200<=k.status&&300>k.status||304===k.status||U.test(a.url))d(r(a.type,b));else{var g=Error(k.responseText);g.code=k.status;g.response=b;e(g)}}catch(V){e(V)}};g&&null!=a.data?k.send(a.data):k.send()});return!0===a.background?A:k(A)},jsonp:function(a,p){var k=e();a=g(a,p);var h=new d(function(d,e){var g=a.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+t++,k=b.document.createElement("script");b[g]=function(e){k.parentNode.removeChild(k);d(r(a.type,e));delete b[g]};k.onerror=function(){k.parentNode.removeChild(k);
|
||||
e(Error("JSONP request failed"));delete b[g]};null==a.data&&(a.data={});a.url=u(a.url,a.data);a.data[a.callbackKey||"callback"]=g;k.src=l(a.url,a.data);b.document.documentElement.appendChild(k)});return!0===a.background?h:k(h)},setCompletionCallback:function(a){y=a}}}(window,m),Q=function(b){function d(a,c){if(a.state!==c)throw Error("`vnode.state` must not be modified");}function e(a){var c=a.state;try{return this.apply(c,arguments)}finally{d(a,c)}}function g(a,c,f,b,d,e,g){for(;f<b;f++){var n=c[f];
|
||||
null!=n&&u(a,n,d,g,e)}}function u(n,c,f,b,d){var k=c.tag;if("string"===typeof k)switch(c.state={},null!=c.attrs&&I(c.attrs,c,f),k){case "#":c.dom=z.createTextNode(c.children);y(n,c.dom,d);break;case "<":l(n,c,b,d);break;case "[":var r=z.createDocumentFragment();null!=c.children&&(k=c.children,g(r,k,0,k.length,f,null,b));c.dom=r.firstChild;c.domSize=r.childNodes.length;y(n,r,d);break;default:var q=c.tag,h=(k=c.attrs)&&k.is;q=(b=c.attrs&&c.attrs.xmlns||P[c.tag]||b)?h?z.createElementNS(b,q,{is:h}):z.createElementNS(b,
|
||||
q):h?z.createElement(q,{is:h}):z.createElement(q);c.dom=q;if(null!=k)for(r in h=b,k)D(c,r,null,k[r],h);y(n,q,d);null!=c.attrs&&null!=c.attrs.contenteditable?a(c):(null!=c.text&&(""!==c.text?q.textContent=c.text:c.children=[x("#",void 0,void 0,c.text,void 0,void 0)]),null!=c.children&&(n=c.children,g(q,n,0,n.length,f,null,b),f=c.attrs,"select"===c.tag&&null!=f&&("value"in f&&D(c,"value",null,f.value,void 0),"selectedIndex"in f&&D(c,"selectedIndex",null,f.selectedIndex,void 0))))}else{a:{if("function"===
|
||||
typeof c.tag.view){c.state=Object.create(c.tag);r=c.state.view;if(null!=r.$$reentrantLock$$)break a;r.$$reentrantLock$$=!0}else{c.state=void 0;r=c.tag;if(null!=r.$$reentrantLock$$)break a;r.$$reentrantLock$$=!0;c.state=null!=c.tag.prototype&&"function"===typeof c.tag.prototype.view?new c.tag(c):c.tag(c)}null!=c.attrs&&I(c.attrs,c,f);I(c.state,c,f);c.instance=x.normalize(e.call(c.state.view,c));if(c.instance===c)throw Error("A view cannot return the vnode it received as argument");r.$$reentrantLock$$=
|
||||
null}null!=c.instance?(u(n,c.instance,f,b,d),c.dom=c.instance.dom,c.domSize=null!=c.dom?c.instance.domSize:0):c.domSize=0}}function l(a,c,f,b){var n=c.children.match(/^\s*?<(\w+)/im)||[];n=z.createElement(E[n[1]]||"div");"http://www.w3.org/2000/svg"===f?(n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+c.children+"</svg>",n=n.firstChild):n.innerHTML=c.children;c.dom=n.firstChild;c.domSize=n.childNodes.length;for(c=z.createDocumentFragment();f=n.firstChild;)c.appendChild(f);y(a,c,b)}function h(a,
|
||||
c,b,d,e,h){if(c!==b&&(null!=c||null!=b))if(null==c)g(a,b,0,b.length,d,e,h);else if(null==b)A(c,0,c.length);else{for(var n=0,f=0,q=!0,l=!0;f<c.length;f++)if(null!=c[f]){q=null!=c[f].key;break}for(;n<b.length;n++)if(null!=b[n]){l=null!=b[n].key;break}if(q!==l)A(c,f,c.length),g(a,b,n,b.length,d,e,h);else if(l){l=c.length-1;for(var B=b.length-1,m,v;l>=f&&B>=n;)if(v=c[f],q=b[n],null==v)f++;else if(null==q)n++;else if(v.key===q.key)f++,n++,v!==q&&p(a,v,q,d,t(c,f,e),h);else if(q=b[B],null==v)f++;else if(null==
|
||||
q)B--;else if(v.key===q.key)f++,n<B--&&y(a,r(v),e),v!==q&&p(a,v,q,d,e,h),null!=q.dom&&(e=q.dom);else break;for(;l>=f&&B>=n;){v=c[l];q=b[B];if(null==v)l--;else{if(null!=q)if(v.key===q.key)v!==q&&p(a,v,q,d,e,h),null!=q.dom&&(e=q.dom),l--;else{if(null==m){m=c;v=f;for(var z=l,x={};v<z;v++){var w=m[v];null!=w&&(w=w.key,null!=w&&(x[w]=v))}m=x}null!=q&&(v=m[q.key],null==v?u(a,q,d,h,e):(v=c[v],y(a,r(v),e),v!==q&&p(a,v,q,d,e,h),v.skip=!0),null!=q.dom&&(e=q.dom))}B--}if(B<n)break}g(a,b,n,B+1,d,e,h);A(c,f,l+
|
||||
1)}else{l=c.length<b.length?c.length:b.length;for(n=n<f?n:f;n<l;n++)v=c[n],q=b[n],v===q||null==v&&null==q||(null==v?u(a,q,d,h,t(c,n+1,e)):null==q?k(v):p(a,v,q,d,t(c,n+1,e),h));c.length>l&&A(c,n,c.length);b.length>l&&g(a,b,n,b.length,d,e,h)}}}function p(b,c,f,d,g,t){var n=c.tag;if(n===f.tag){f.state=c.state;f.events=c.events;var q;var A;null!=f.attrs&&"function"===typeof f.attrs.onbeforeupdate&&(q=e.call(f.attrs.onbeforeupdate,f,c));"string"!==typeof f.tag&&"function"===typeof f.state.onbeforeupdate&&
|
||||
(A=e.call(f.state.onbeforeupdate,f,c));void 0===q&&void 0===A||q||A?q=!1:(f.dom=c.dom,f.domSize=c.domSize,f.instance=c.instance,q=!0);if(!q)if("string"===typeof n)switch(null!=f.attrs&&J(f.attrs,f,d),n){case "#":c.children.toString()!==f.children.toString()&&(c.dom.nodeValue=f.children);f.dom=c.dom;break;case "<":c.children!==f.children?(r(c),l(b,f,t,g)):(f.dom=c.dom,f.domSize=c.domSize);break;case "[":h(b,c.children,f.children,d,g,t);c=0;d=f.children;f.dom=null;if(null!=d){for(var m=0;m<d.length;m++)t=
|
||||
d[m],null!=t&&null!=t.dom&&(null==f.dom&&(f.dom=t.dom),c+=t.domSize||1);1!==c&&(f.domSize=c)}break;default:b=f.dom=c.dom;t=f.attrs&&f.attrs.xmlns||P[f.tag]||t;"textarea"===f.tag&&(null==f.attrs&&(f.attrs={}),null!=f.text&&(f.attrs.value=f.text,f.text=void 0));g=c.attrs;n=f.attrs;q=t;if(null!=n)for(m in n)D(f,m,g&&g[m],n[m],q);if(null!=g)for(m in g)null!=n&&m in n||("className"===m&&(m="class"),"o"!==m[0]||"n"!==m[1]||w(m)?"key"!==m&&f.dom.removeAttribute(m):O(f,m,void 0));null!=f.attrs&&null!=f.attrs.contenteditable?
|
||||
a(f):null!=c.text&&null!=f.text&&""!==f.text?c.text.toString()!==f.text.toString()&&(c.dom.firstChild.nodeValue=f.text):(null!=c.text&&(c.children=[x("#",void 0,void 0,c.text,void 0,c.dom.firstChild)]),null!=f.text&&(f.children=[x("#",void 0,void 0,f.text,void 0,void 0)]),h(b,c.children,f.children,d,null,t))}else{f.instance=x.normalize(e.call(f.state.view,f));if(f.instance===f)throw Error("A view cannot return the vnode it received as argument");null!=f.attrs&&J(f.attrs,f,d);J(f.state,f,d);null!=
|
||||
f.instance?(null==c.instance?u(b,f.instance,d,t,g):p(b,c.instance,f.instance,d,g,t),f.dom=f.instance.dom,f.domSize=f.instance.domSize):null!=c.instance?(k(c.instance),f.dom=void 0,f.domSize=0):(f.dom=c.dom,f.domSize=c.domSize)}}else k(c),u(b,f,d,t,g)}function r(a){var c=a.domSize;if(null!=c||null==a.dom){var b=z.createDocumentFragment();if(0<c){for(a=a.dom;--c;)b.appendChild(a.nextSibling);b.insertBefore(a,b.firstChild)}return b}return a.dom}function t(a,c,b){for(;c<a.length;c++)if(null!=a[c]&&null!=
|
||||
a[c].dom)return a[c].dom;return b}function y(a,c,b){null!=b?a.insertBefore(c,b):a.appendChild(c)}function a(a){var c=a.children;if(null!=c&&1===c.length&&"<"===c[0].tag)c=c[0].children,a.dom.innerHTML!==c&&(a.dom.innerHTML=c);else if(null!=a.text||null!=c&&0!==c.length)throw Error("Child node of a contenteditable must be trusted");}function A(a,c,b){for(;c<b;c++){var n=a[c];null!=n&&(n.skip?n.skip=!1:k(n))}}function k(a){function c(){if(++n===b&&(d(a,g),m(a),a.dom)){var c=a.domSize||1;if(1<c)for(var f=
|
||||
a.dom;--c;){var e=f.nextSibling,k=e.parentNode;null!=k&&k.removeChild(e)}c=a.dom;f=c.parentNode;null!=f&&f.removeChild(c)}}var b=1,n=0,g=a.state;if(a.attrs&&"function"===typeof a.attrs.onbeforeremove){var k=e.call(a.attrs.onbeforeremove,a);null!=k&&"function"===typeof k.then&&(b++,k.then(c,c))}"string"!==typeof a.tag&&"function"===typeof a.state.onbeforeremove&&(k=e.call(a.state.onbeforeremove,a),null!=k&&"function"===typeof k.then&&(b++,k.then(c,c)));c()}function m(a){a.attrs&&"function"===typeof a.attrs.onremove&&
|
||||
e.call(a.attrs.onremove,a);if("string"!==typeof a.tag)"function"===typeof a.state.onremove&&e.call(a.state.onremove,a),null!=a.instance&&m(a.instance);else if(a=a.children,Array.isArray(a))for(var c=0;c<a.length;c++){var b=a[c];null!=b&&m(b)}}function D(a,c,b,d,e){if("key"!==c&&"is"!==c&&!w(c)){if("o"===c[0]&&"n"===c[1])return O(a,c,d);if("undefined"===typeof d&&"value"===c&&b!==d)a.dom.value="";else if((b!==d||"value"===c||"checked"===c||"selectedIndex"===c||"selected"===c&&a.dom===z.activeElement||
|
||||
"option"===a.tag&&a.dom.parentNode===z.activeElement||"object"===typeof d)&&void 0!==d){var f=a.dom;if("xlink:"===c.slice(0,6))f.setAttributeNS("http://www.w3.org/1999/xlink",c,d);else if("style"===c)if(a=b,null!=a&&null!=d&&"object"===typeof a&&"object"===typeof d&&d!==a){for(var g in d)d[g]!==a[g]&&(f.style[g]=d[g]);for(g in a)g in d||(f.style[g]="")}else if(a===d&&(f.style.cssText="",a=null),null==d)f.style.cssText="";else if("string"===typeof d)f.style.cssText=d;else for(g in"string"===typeof a&&
|
||||
(f.style.cssText=""),d)f.style[g]=d[g];else if(c in f&&"href"!==c&&"list"!==c&&"form"!==c&&"width"!==c&&"height"!==c&&void 0===e&&!(a.attrs.is||-1<a.tag.indexOf("-"))){if("value"===c){g=""+d;if(("input"===a.tag||"textarea"===a.tag)&&a.dom.value===g&&a.dom===z.activeElement)return;if("select"===a.tag)if(null===d){if(-1===a.dom.selectedIndex&&a.dom===z.activeElement)return}else if(null!==b&&a.dom.value===g&&a.dom===z.activeElement)return;if("option"===a.tag&&null!=b&&a.dom.value===g)return}"input"===
|
||||
a.tag&&"type"===c?f.setAttribute(c,d):f[c]=d}else"boolean"===typeof d?d?f.setAttribute(c,""):f.removeAttribute(c):f.setAttribute("className"===c?"class":c,d)}}}function w(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===a||"onbeforeupdate"===a}function H(){}function O(a,c,b){null!=a.events?a.events[c]!==b&&(null==b||"function"!==typeof b&&"object"!==typeof b?(null!=a.events[c]&&a.dom.removeEventListener(c.slice(2),a.events,!1),a.events[c]=void 0):(null==a.events[c]&&
|
||||
a.dom.addEventListener(c.slice(2),a.events,!1),a.events[c]=b)):null==b||"function"!==typeof b&&"object"!==typeof b||(a.events=new H,a.dom.addEventListener(c.slice(2),a.events,!1),a.events[c]=b)}function I(a,c,b){"function"===typeof a.oninit&&e.call(a.oninit,c);"function"===typeof a.oncreate&&b.push(e.bind(a.oncreate,c))}function J(a,c,b){"function"===typeof a.onupdate&&b.push(e.bind(a.onupdate,c))}var z=b.document;z.createDocumentFragment();var P={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},
|
||||
C,E={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};H.prototype=Object.create(null);H.prototype.handleEvent=function(a){var c=this["on"+a.type];"function"===typeof c?c.call(a.target,a):"function"===typeof c.handleEvent&&c.handleEvent(a);"function"===typeof C&&C.call(a.target,a)};return{render:function(a,c){if(!a)throw Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var b=[],d=z.activeElement,
|
||||
e=a.namespaceURI;null==a.vnodes&&(a.textContent="");Array.isArray(c)||(c=[c]);h(a,a.vnodes,x.normalizeChildren(c),b,null,"http://www.w3.org/1999/xhtml"===e?void 0:e);a.vnodes=c;null!=d&&z.activeElement!==d&&d.focus();for(d=0;d<b.length;d++)b[d]()},setEventCallback:function(a){return C=a}}},F=function(a,d){function e(a){a=l.indexOf(a);-1<a&&l.splice(a,2)}function f(){if(h)throw Error("Nested m.redraw.sync() call");h=!0;for(var a=1;a<l.length;a+=2)try{l[a]()}catch(t){"undefined"!==typeof console&&console.error(t)}h=
|
||||
!1}var m=Q(a);m.setEventCallback(function(a){!1===a.redraw?a.redraw=void 0:p()});var l=[],h=!1,p=(d||S)(f);p.sync=f;return{subscribe:function(a,d){e(a);l.push(a,d)},unsubscribe:e,redraw:p,render:m.render}}(window);K.setCompletionCallback(F.redraw);w.mount=function(a){return function(d,e){if(null===e)a.render(d,[]),a.unsubscribe(d);else{if(null==e.view&&"function"!==typeof e)throw Error("m.mount(element, component) expects a component, not a vnode");var f=function(){a.render(d,x(e))};a.subscribe(d,
|
||||
f);f()}}}(F);var W=m,L=function(a){if(""===a||null==a)return{};"?"===a.charAt(0)&&(a=a.slice(1));a=a.split("&");for(var d={},e={},f=0;f<a.length;f++){var m=a[f].split("="),l=decodeURIComponent(m[0]);m=2===m.length?decodeURIComponent(m[1]):"";"true"===m?m=!0:"false"===m&&(m=!1);var h=l.split(/\]\[?|\[/),p=d;-1<l.indexOf("[")&&h.pop();for(var r=0;r<h.length;r++){l=h[r];var t=h[r+1];t=""==t||!isNaN(parseInt(t,10));var y=r===h.length-1;""===l&&(l=h.slice(0,r).join(),null==e[l]&&(e[l]=0),l=e[l]++);null==
|
||||
p[l]&&(p[l]=y?m:t?[]:{});p=p[l]}}return d},X=function(a){function d(d){var e=a.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==e[0]&&(e="/"+e);return e}function e(a){return function(){null==h&&(h=l(function(){h=null;a()}))}}function f(a,d,e){var b=a.indexOf("?"),f=a.indexOf("#"),k=-1<b?b:-1<f?f:a.length;if(-1<b){b=L(a.slice(b+1,-1<f?f:a.length));for(var h in b)d[h]=b[h]}if(-1<f)for(h in d=L(a.slice(f+1)),d)e[h]=d[h];return a.slice(0,k)}var m="function"===typeof a.history.pushState,
|
||||
l="function"===typeof setImmediate?setImmediate:setTimeout,h,p={prefix:"#!",getPath:function(){switch(p.prefix.charAt(0)){case "#":return d("hash").slice(p.prefix.length);case "?":return d("search").slice(p.prefix.length)+d("hash");default:return d("pathname").slice(p.prefix.length)+d("search")+d("hash")}},setPath:function(d,e,h){var b={},l={};d=f(d,b,l);if(null!=e){for(var k in e)b[k]=e[k];d=d.replace(/:([^\/]+)/g,function(a,d){delete b[d];return e[d]})}(k=E(b))&&(d+="?"+k);(l=E(l))&&(d+="#"+l);
|
||||
m?(l=h?h.state:null,k=h?h.title:null,a.onpopstate(),h&&h.replace?a.history.replaceState(l,k,p.prefix+d):a.history.pushState(l,k,p.prefix+d)):a.location.href=p.prefix+d},defineRoutes:function(d,h,l){function b(){var b=p.getPath(),e={},m=f(b,e,e),r=a.history.state;if(null!=r)for(var t in r)e[t]=r[t];for(var u in d)if(r=new RegExp("^"+u.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),r.test(m)){m.replace(r,function(){for(var a=u.match(/:[^\/]+/g)||[],f=[].slice.call(arguments,
|
||||
1,-2),k=0;k<a.length;k++)e[a[k].replace(/:|\./g,"")]=decodeURIComponent(f[k]);h(d[u],e,b,u)});return}l(b,e)}m?a.onpopstate=e(b):"#"===p.prefix.charAt(0)&&(a.onhashchange=b);b()}};return p};w.route=function(a,d){var e=X(a),f=function(a){return a},m,l,h,p,r,t=function(a,t,k){function b(){null!=m&&d.render(a,m(x(l,h.key,h)))}if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var u=function(){b();u=d.redraw};d.subscribe(a,b);var w=function(a){if(a!==t)e.setPath(t,
|
||||
null,{replace:!0});else throw Error("Could not resolve default route "+t);};e.defineRoutes(k,function(a,b,d){var e=r=function(a,k){e===r&&(l=null==k||"function"!==typeof k.view&&"function"!==typeof k?"div":k,h=b,p=d,r=null,m=(a.render||f).bind(a),u())};a.view||"function"===typeof a?e({},a):a.onmatch?W.resolve(a.onmatch(b,d)).then(function(b){e(a,b)},w):e(a,"div")},w)};t.set=function(a,d,f){null!=r&&(f=f||{},f.replace=!0);r=null;e.setPath(a,d,f)};t.get=function(){return p};t.prefix=function(a){e.prefix=
|
||||
a};var w=function(a,d){d.dom.setAttribute("href",e.prefix+d.attrs.href);d.dom.onclick=function(b){b.ctrlKey||b.metaKey||b.shiftKey||2===b.which||(b.preventDefault(),b.redraw=!1,b=this.getAttribute("href"),0===b.indexOf(e.prefix)&&(b=b.slice(e.prefix.length)),t.set(b,void 0,a))}};t.link=function(a){return null==a.tag?w.bind(w,a):w({},a)};t.param=function(a){return"undefined"!==typeof h&&"undefined"!==typeof a?h[a]:h};return t}(window,F);w.withAttr=function(a,d,e){return function(f){d.call(e||this,
|
||||
a in f.currentTarget?f.currentTarget[a]:f.currentTarget.getAttribute(a))}};var Y=Q(window);w.render=Y.render;w.redraw=F.redraw;w.request=K.request;w.jsonp=K.jsonp;w.parseQueryString=L;w.buildQueryString=E;w.version="1.1.3";w.vnode=x;w.PromisePolyfill=m;"undefined"!==typeof module?module.exports=w:window.m=w})();
|
||||
e=a.namespaceURI;null==a.vnodes&&(a.textContent="");Array.isArray(c)||(c=[c]);h(a,a.vnodes,x.normalizeChildren(c),b,null,"http://www.w3.org/1999/xhtml"===e?void 0:e);a.vnodes=c;null!=d&&z.activeElement!==d&&d.focus();for(d=0;d<b.length;d++)b[d]()},setEventCallback:function(a){return C=a}}},F=function(b,d){function e(b){b=l.indexOf(b);-1<b&&l.splice(b,2)}function g(){if(h)throw Error("Nested m.redraw.sync() call");h=!0;for(var b=1;b<l.length;b+=2)try{l[b]()}catch(t){"undefined"!==typeof console&&console.error(t)}h=
|
||||
!1}var m=Q(b);m.setEventCallback(function(b){!1===b.redraw?b.redraw=void 0:p()});var l=[],h=!1,p=(d||S)(g);p.sync=g;return{subscribe:function(b,d){e(b);l.push(b,d)},unsubscribe:e,redraw:p,render:m.render}}(window);K.setCompletionCallback(F.redraw);w.mount=function(b){return function(d,e){if(null===e)b.render(d,[]),b.unsubscribe(d);else{if(null==e.view&&"function"!==typeof e)throw Error("m.mount(element, component) expects a component, not a vnode");var g=function(){b.render(d,x(e))};b.subscribe(d,
|
||||
g);g()}}}(F);var W=m,L=function(b){if(""===b||null==b)return{};"?"===b.charAt(0)&&(b=b.slice(1));b=b.split("&");for(var d={},e={},g=0;g<b.length;g++){var m=b[g].split("="),l=decodeURIComponent(m[0]);m=2===m.length?decodeURIComponent(m[1]):"";"true"===m?m=!0:"false"===m&&(m=!1);var h=l.split(/\]\[?|\[/),p=d;-1<l.indexOf("[")&&h.pop();for(var r=0;r<h.length;r++){l=h[r];var t=h[r+1];t=""==t||!isNaN(parseInt(t,10));var y=r===h.length-1;""===l&&(l=h.slice(0,r).join(),null==e[l]&&(e[l]=0),l=e[l]++);null==
|
||||
p[l]&&(p[l]=y?m:t?[]:{});p=p[l]}}return d},X=function(b){function d(d){var e=b.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==e[0]&&(e="/"+e);return e}function e(b){return function(){null==h&&(h=l(function(){h=null;b()}))}}function g(b,d,e){var a=b.indexOf("?"),g=b.indexOf("#"),k=-1<a?a:-1<g?g:b.length;if(-1<a){a=L(b.slice(a+1,-1<g?g:b.length));for(var h in a)d[h]=a[h]}if(-1<g)for(h in d=L(b.slice(g+1)),d)e[h]=d[h];return b.slice(0,k)}var m="function"===typeof b.history.pushState,
|
||||
l="function"===typeof setImmediate?setImmediate:setTimeout,h,p={prefix:"#!",getPath:function(){switch(p.prefix.charAt(0)){case "#":return d("hash").slice(p.prefix.length);case "?":return d("search").slice(p.prefix.length)+d("hash");default:return d("pathname").slice(p.prefix.length)+d("search")+d("hash")}},setPath:function(d,e,h){var a={},l={};d=g(d,a,l);if(null!=e){for(var k in e)a[k]=e[k];d=d.replace(/:([^\/]+)/g,function(b,d){delete a[d];return e[d]})}(k=E(a))&&(d+="?"+k);(l=E(l))&&(d+="#"+l);
|
||||
m?(l=h?h.state:null,k=h?h.title:null,b.onpopstate(),h&&h.replace?b.history.replaceState(l,k,p.prefix+d):b.history.pushState(l,k,p.prefix+d)):b.location.href=p.prefix+d},defineRoutes:function(d,h,l){function a(){var a=p.getPath(),e={},m=g(a,e,e),r=b.history.state;if(null!=r)for(var t in r)e[t]=r[t];for(var u in d)if(r=new RegExp("^"+u.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),r.test(m)){m.replace(r,function(){for(var b=u.match(/:[^\/]+/g)||[],g=[].slice.call(arguments,
|
||||
1,-2),k=0;k<b.length;k++)e[b[k].replace(/:|\./g,"")]=decodeURIComponent(g[k]);h(d[u],e,a,u)});return}l(a,e)}m?b.onpopstate=e(a):"#"===p.prefix.charAt(0)&&(b.onhashchange=a);a()}};return p};w.route=function(b,d){var e=X(b),g=function(a){return a},m,l,h,p,r,t=function(a,b,k){function t(){null!=m&&d.render(a,m(x(l,h.key,h)))}if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var u=function(){t();u=d.redraw};d.subscribe(a,t);var w=function(a){if(a!==b)e.setPath(b,
|
||||
null,{replace:!0});else throw Error("Could not resolve default route "+b);};e.defineRoutes(k,function(a,b,d){var e=r=function(a,k){e===r&&(l=null==k||"function"!==typeof k.view&&"function"!==typeof k?"div":k,h=b,p=d,r=null,m=(a.render||g).bind(a),u())};a.view||"function"===typeof a?e({},a):a.onmatch?W.resolve(a.onmatch(b,d)).then(function(b){e(a,b)},w):e(a,"div")},w)};t.set=function(a,b,d){null!=r&&(d=d||{},d.replace=!0);r=null;e.setPath(a,b,d)};t.get=function(){return p};t.prefix=function(a){e.prefix=
|
||||
a};var w=function(a,b){b.dom.setAttribute("href",e.prefix+b.attrs.href);b.dom.onclick=function(b){b.ctrlKey||b.metaKey||b.shiftKey||2===b.which||(b.preventDefault(),b.redraw=!1,b=this.getAttribute("href"),0===b.indexOf(e.prefix)&&(b=b.slice(e.prefix.length)),t.set(b,void 0,a))}};t.link=function(a){return null==a.tag?w.bind(w,a):w({},a)};t.param=function(a){return"undefined"!==typeof h&&"undefined"!==typeof a?h[a]:h};return t}(window,F);w.withAttr=function(b,d,e){return function(g){d.call(e||this,
|
||||
b in g.currentTarget?g.currentTarget[b]:g.currentTarget.getAttribute(b))}};var Y=Q(window);w.render=Y.render;w.redraw=F.redraw;w.request=K.request;w.jsonp=K.jsonp;w.parseQueryString=L;w.buildQueryString=E;w.version="1.1.3";w.vnode=x;w.PromisePolyfill=m;"undefined"!==typeof module?module.exports=w:window.m=w})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue