<commit_before>/*
Mag.JS v0.28.9
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
(function(b,f){'use strict';function h(S,T){if(y[S]&&!T)return y[S];var U=mag.doc.getElementById(S);return U&&(y[S]=U),y[S]}var j='KEY',l=0,n=['#'+j,'.'+j,j],o=function(S,T){var U;for(var V in n){var W=n[V].replace(j,T);if(U=S.querySelector(W),U)break}return U},q=function(S){var T=mag.utils.items.getItemVal(S),U=mag.getNode(T);return U},r=function(S){if('string'==typeof S){var T=q(~mag.mod.runningViewInstance||mag.utils.runningEventInstance),U=o(T||mag.doc,S);if(U)return U}return S},t=function(S,T,U){var Z,V=[],W=S.cloneNode(1),Y=[],$=[],_=function(aa){var ba=S;aa=aa||{};var ca;aa.key&&(ca=aa.key+'-'+_.id);var da=aa.key?aa.key+'-'+_.id:_.id;if($[da]||($[da]='object'==typeof U?mag.utils.copy(U):U),'object'==typeof aa&&(aa=mag.utils.extend($[da],aa)),ca&&!V[ca]?ba=V[ca]=W.cloneNode(1):ca&&V[ca]&&(ba=V[ca]),Z&&Z==ba[u].scid)throw Error('MagJS Error - recursive call:'+Z);ba[u]=ba[u]||{},mag._cprops[da]&&'object'==typeof aa&&(aa.children=mag._cprops[da]);var ea;if(Y[da]!=mag.utils.toJsonString(aa))try{ea=T(aa),Z=ba[u].scid=da,Y[da]=mag.utils.toJsonString(aa);var fa=mag.fill.id;fa&&fa[u]&&fa[u].scid&&(ba[u].pscid=fa[u].scid),mag.fill.setId(ba),mag.fill.run(ba,ea)}finally{mag.fill.setId(fa),Z=0}return ba};return _.id=++l,_.clone=W,_};b.mag=function(S,T,U){if(S=r(S),T=r(T),U=U||{},mag.utils.isHTMLEle(T)&&mag.utils.isHTMLEle(S))T[u]||mag.fill.run(T,S);else{if('function'==typeof T&&mag.utils.isHTMLEle(S)){try{t(S.cloneNode(1),T,U)()}catch(V){}return t(S,T,U)}return K(-1,h(mag._isNode(S)),T,U)}};var u='__magnum__';mag.MAGNUM=u,mag.rafBounceIds=[],mag._cprops=[],mag.doc=f;var w={values:[],attributes:[],elementMatcher:[]},y=[],l=0;mag._isNode=function(S){return mag.utils.isHTMLEle(S)&&(!S.id&&(S.id=++l),y[S.id]=S,S=S.id),S};var z=function(S,T){var U,V=T?S+'-'+T:S;return U=mag.utils.items.isItem(V)?mag.utils.items.getItem(V):mag.utils.getItemInstanceId(V),U};mag.module=function(S,T,U){U=U||{},S=mag._isNode(S);var V=z(S,U.key),W=A(U,V,T,S);return W?K(V,W,T,mag.utils.copy(U)):void 0};var A=function(S,T,U,V){S.retain||mag.mod.clear(T);var W=h(V);if(mag.mod.submodule(V,T,U,S),L(T,V),!Q(T,W))return mag.redraw(W,T,1).then(function(){R(T,W)}),W},B=function(S,T){return 0>T||T!=mag.utils.items.getItem(S)?S==mag.mod.getId(T):!0},C=[];mag.begin=function(S){'undefined'==typeof C[S]?C[S]=1:C[S]++},mag.end=function(S){if(1<C[S])C[S]--;else{C[S]=0;var T=mag.utils.items.getItemVal(S);mag.redraw(h(T),S)}},mag.redraw=function(S,T,U){if(!C[T]){if(!S||'undefined'==typeof T)throw Error('Mag.JS - Id or node invalid: '+mag.utils.items.getItemVal(T));if(!B(S.id,T))return{then:V=>V()};if(U&&mag.fill.configs.splice(0,mag.fill.configs.length),U&&mag.mod.clear(T),mag.mod.runningViewInstance==T)throw Error('Mag.JS - recursive call:'+T);return mag.utils.scheduleFlush(T,M(S,T,U))}},mag.hookin=function(S,T,U){w[S].push({context:{},handler:U,key:T})},mag.hook=function(S,T,U){for(var V=0,W=w[S].length;V<W;V++)mag.utils.callHook(w,T,S,V,U)};var D={},E=[],F=[],G=function(S,T,U){var V=mag.getNode(mag.mod.getId(S)),W=function(){mag.utils.callLCEvent('onunload',mag.mod.getState(S),V,S)||(mag.clear(S),P(S,V),T[S]&&(T[S].length=0),U&&(mag.fill.removeNode(V),mag.mod.remove(S)))};mag.mod.getState(S).onbeforeunload?mag.utils.callLCEvent('onbeforeunload',mag.mod.getState(S),V,S,0,function(){W()}):W()},H=function(S,T){F[S]=F[S]||[];var U=F[S].push(T);return mag.utils.onLCEvent('didupdate',S,function(V,W){var X=mag.utils.merge(mag.utils.copy(W),mag.utils.copy(V));if(mag.utils.toJsonString(X)!=mag.utils.toJsonString(E[S])){for(var Y of F[S])Y(V,W,h(mag.mod.getId(S)),E[S]);E[S]=X}}),function(){return F[S].splice(U-1,1)}},I=[],J=function(S,T,U,V,W){var X=mag.utils.items.getItem(T);(T=mag._isNode(S),R(X,S),!(mag.mod.exists(X)&&mag.utils.callLCEvent('willgetprops',mag.mod.getState(X),S,X,0,U)))&&(mag.mod.submodule(S.id,X,V,U),L(X,S.id),Q(X,S)||mag.redraw(S,X,W).then(function(){R(X,S)}))},K=function(S,T,U,V){I[S]=I[S]||[];var W=function(X,Y,Z,$,_){'object'==typeof _&&($=mag.utils.merge(mag.utils.copy($),_),_=0),0>X&&!_&&(_=1);var aa=Y.id+($.key?'.'+$.key+'.':'')+(_||'');!D[aa]||$.key||~W._id||(aa+=++l);var ba=D[aa]=D[aa]||Y.cloneNode(1);if(ba.id=aa,mag.utils.items.isItem(aa))return J(ba,aa,$,Z,1),ba;var ca=mag.utils.getItemInstanceId(ba.id);return 0>X?X=W._id=ca:I[X].push({instanceId:ca,subscribe:H.bind({},ca)}),J(ba,aa,$,Z,1),ba}.bind({},S,T,U,V);return W._id=S,W.clones=function(){return I[W._id]},W.destroy=function(X){G(W._id,W.clones,X)},W.getId=function(){return W._id},W.rafBounce=function(X){return X?mag.rafBounceIds[W._id]=1:!1===X&&(mag.rafBounceIds[W._id]=0),!!mag.rafBounceIds[W._id]},W.draw=function(X){return mag.redraw(T,W._id,X)},W.getState=function(){return mag.mod.getState(W._id)},W.getProps=function(){return mag.mod.getProps(W._id)},W.subscribe=function(X){return H(W._id,X)},W},L=function(S,T){var U=function(V,W){h(W)?mag.redraw(h(W),V):mag.utils.items.isItem(W)&&mag.clear(V)}.bind({},S,T);mag.mod.setFrameId(S,U)};mag.clear=function(S){mag.utils.items.removeItem(S),mag.mod.clear(S),mag.fill.clearCache(mag.mod.getId(S))};var M=function(S,T,U){return function(V,W,X){if(h(V.id,1),B(V.id,W)&&V){var Y=mag.mod.getState(W);if(!mag.utils.callLCEvent('isupdate',Y,V,W)){if(mag.mod.iscached(W)&&!X)return 0;if(!mag.utils.callLCEvent('willupdate',Y,V,W)){mag.mod.callView(V,W);var Z=mag.fill.id;mag.fill.setId(V.id),mag.fill.run(V,Y),mag.fill.setId(Z),N(V.id,mag.fill.configs),mag.utils.callLCEvent('didupdate',Y,V,W),X||mag.mod.iscached(W)}}}}.bind({},S,T,U)},N=function(S,T){for(var U in T)U.startsWith('id("'+S+'")/')&&T[U]()},O=function(S){var U=[];for(var V in mag.fill.cached)-1<V.indexOf('id("'+S+'")/')&&-1<V.indexOf('-config')&&mag.fill.cached[V].configContext&&U.push({path:V.split('-config')[0],controller:mag.fill.cached[V].configContext,handler:mag.fill.cached[V].configContext.onunload});return U},P=function(S,T){for(var W,U=O(T.id,S),V=0,X=U;W=X&&X[V];V++)W.controller.onunload&&(W.handler.call(W.controller,T,W.path),W.controller.onunload=0)},Q=function(S,T){return mag.utils.callLCEvent('willload',mag.mod.getState(S),T,S,1)},R=function(S,T){var U=mag.utils.items.getItemVal(S);if(h(U)&&mag.mod.exists(S))return mag.utils.callLCEvent('didload',mag.mod.getState(S),T,S,1)};mag.getNode=h})(window||global||this,document),function(b){'use strict';function f(u,w){var y=u.name;if('undefined'==typeof u.object[u.name]&&'_'!=y[0]){var z=b.fill.find(w,y),A='$'===y[0],B=[];return z.length?(z.forEach(function(G){var H;if(!(G&&G.type&&!~['submit','button'].indexOf(G.type)))'undefined'==typeof u.oldValue&&'undefined'==typeof u.object[u.name]&&G&&!~['submit','button'].indexOf(G.type)&&1==G.childNodes.length&&G.childNodes[0].textContent.trim()&&(H={_text:G.childNodes[0].textContent.trim()});else if(G.value&&0<G.value.length)if('checkbox'!=G.type&&'radio'!=G.type){var K=G.multiple&&[].map.call(G.selectedOptions,L=>L.value);H={_value:K||G.value}}else if(G.checked&&(H={},H._checked=!0),!A){var I=w.querySelectorAll('[name='+G.name+']');if(I.length)for(var J of I)J.checked&&(H?H._value=J.value:H={_value:J.value})}else H?H._value=G.value:H={_value:G.value};H?B.push(H):G&&!G.hasChildNodes()&&B.push(j)}),0===B.length?void 0:A?B:B[0]&&'undefined'!=typeof B[0]._value?B[0]._value:B[0]&&B[0]._text?B[0]._text:B[0]):j}if('_'==y[0]){var C=y.substr(1);if(w.length){var B=[];for(var D in w){var E=w[D],F=E[C];'undefined'==typeof F&&(F=E.getAttribute(C)),B.push(F)}return B}var F=w[C];return'undefined'==typeof F&&(F=w.getAttribute(C)),F}}function g(u,w){n.setProps(w,b.proxy(n.getProps(w),t.bind({},'props',w),'prop'));var z=new u(b.proxy({},t.bind({},'state',w)));return z}var h=[],j=b.MAGNUM,n={runningViewInstance:-1,innerMods:[],cache:[]};n.getState=function(u){return h[u][1]},n.setState=function(u,w){h[u][1]=w},n.getView=function(u){return h[u][0]},n.getProps=function(u){return h[u][2]},n.setProps=function(u,w){return h[u][2]=w},n.remove=function(u){h[u]&&(h[u]=0)},n.getId=function(u){return h[u]&&h[u][3]},n.exists=function(u){return'undefined'!=typeof h[u]},n.setFrameId=function(u,w){h[u][4]=w},n.getFrameId=function(u){return h[u][4]},n.getMod=function(u){return h[u][5]};var o=(u,w)=>{for(var y in w=w||u,u){var z=u[y];'function'!=typeof z||~['controller','view'].indexOf(y)||(u[y]=z.bind(w))}return u};n.submodule=function(u,w,y,z){if(h[w])return z.key&&z.key==n.getProps(w).key?n.setProps(w,b.utils.copy(b.utils.merge(n.getProps(w),z))):n.setProps(w,z),h[w];y=b.utils.copy(y),o(y,y),h[w]=[0,0,0,0,0,0],n.setProps(w,z);var B=function(D,E,F){y.element=F,y.state=E,y.props=n.getProps(D),y.view&&y.view.call(y,E,y.props,F)}.bind({},w),C={controller:function(D){return y.props=n.getProps(w),y.state=D,y.element=b.getNode(u),(y.controller||function(){}).call(D,y.props)||D},view:B};return h[w][0]=C.view,h[w][3]=u,h[w][1]=g(C.controller,w,u),h[w][5]=y,h[w]};var q=[],r=function(u,w){var y=u,z=w.split('/');for(var A of z)if(A){var B=b.fill.find(y,A);B.length&&(y=B)}return y},t=function(u,w,y){if('get'==y.type&&'props'!=u&&!~b.fill.ignorekeys.indexOf(y.name.toString())&&'undefined'==typeof y.oldValue){var z=b.getNode(n.getId(w));if(y.path&&'/'==y.path[0])var A=r(z,y.path);A&&'$'!=y.path.split('/').pop()[0]&&(A=A[0]);var B=f(y,A?A:z);if(null!==B&&'object'==typeof B&&y.object&&b.utils.merge(B,y.object[y.name]),B)return n.cached[w]=0,B}else'set'==y.type&&'props'!=u&&y.object[y.name]&&y.object[y.name].draw&&'function'==typeof y.object[y.name].draw&&(n.innerMods[n.getId(w)]=[y.name,y.object[y.name]]);var C=n.getFrameId(w);'function'==typeof C&&'set'==y.type&&(cancelAnimationFrame(q[w]),q[w]=requestAnimationFrame(C))};n.iscached=function(u){var w=b.utils.toJsonString(b.utils.merge(b.utils.copy(n.getProps(u)),n.getState(u)));return u in n.cache&&n.cache[u]==w||void(n.cache[u]=w)},n.clear=function(u){~u&&n.cache[u]&&n.cache.splice(u,1)},n.cached=[],n.callView=function(u,w){n.runningViewInstance=w,n.cached[w]||(b.props.attachToArgs(w,n.getState(w),u),n.cached[w]=1);try{n.getView(w)(n.getState(w),u)}finally{n.runningViewInstance=-1}},b.mod=n}(mag),function(b){'use strict';function g(y,z,A,B){var C=[];for(var D in y){var E=y[D];j(E)&&(C.push(E),h(E,z,A,B))}return!!C.length&&(1==C.length?C[0]:C)}function h(y,z,A,B){if(y[q]=y[q]||{},!y[q].eventOnFocus){var C=function(D,E,F){var H=~['radio','checkbox'].indexOf(y.type);if(this[q].dirty||(this[q].dirty=1),y.selectedOptions)var I=[].map.call(y.selectedOptions,J=>J.value);H?'_checked'in E||o in E?E._checked=this.checked:this.checked&&(E[F]=this.value):void 0===E[o]?void 0!==E._text&&(E._text=I||this.value):E[o]=I||this.value,b.redraw(D,b.utils.items.getItem(D.id))}.bind(y,B,z,A);y.addEventListener('click',C),'INPUT'==y.nodeName?y.addEventListener('input',C):y.addEventListener('change',C),y.addEventListener('focus',C),y[q].eventOnFocus=1}}function j(y){return y&&~['INPUT','SELECT','TEXTAREA'].indexOf(y.tagName)}function l(y){for(var z in y)if(j(y[z]))return y[z];return!1}var n={},o='_value',q=b.MAGNUM,r=function(y,z){for(var A=1;A<y.length;A++){var B=y[A],C=y[A+1],D=b.fill.find(Array.isArray(z)?z[0]:z,B);if(C&&!isNaN(+C))z=D[C];else if(D&&D.length&&C&&A+2<y.length)z=b.fill.find(D[0],C);else if(D&&D.length&&(z=D,A+2==y.length))break}return Array.isArray(z)?z[0]:z},t=function(y,z,A,B){var D,C=A.toString().split('.');if(3<=C.length)B=r(C,B),D=b.fill.find(B,z);else{var E=parseInt(C.pop()),F=isNaN(E)?0:E;D=b.fill.find(B[F]?B[F]:B,z)}return g(D,y,z,B)},u=function(y,z,A,B){var C=A[z];~[o,'_checked','_text'].indexOf(z)&&'string'==typeof y&&(z=y.split('.').pop());var D=b.fill.find(B,z),E=l(D);if('function'!=typeof C&&E){var F=t.bind({},A,z,y,B);F(),Object.defineProperty(A,z,{configurable:!0,get:function(){var G=F();return G&&'undefined'!==G.value&&G[q]&&G[q].dirty&&G.value!==C?(C=G.value,b.redraw(B,y,1),G.value):C},set:function(G){var H=F();H&&'undefined'!==H.value&&H.value!==G&&G!==C&&(H.value=G,C=G)}})}},w=function(y,z,A){for(var B in z)if(z.hasOwnProperty(B)){var C=z[B];B==o||'object'!=typeof C||b.utils.isHTMLEle(C)?u.bind({},y,B,z,A)():(b.utils.isObject(C)&&b.utils.isEmpty(C)&&(C[o]=''),w(y+'.'+B,C,A))}};n.attachToArgs=w,b.props=n}(mag),function(b){'use strict';var f={};f.copy=o=>Object.assign({},o),f.merge=function(){return Object.assign.apply({},arguments)},f.extend=function(o,q,r){for(var t in q)if(q[t]===void 0)delete q[t];else if(r&&f.isObject(q[t]))return f.extend(o[t],q[t]);return f.merge(o,q)},f.isObject=o=>'Object]'==Object.prototype.toString.call(o).substr(-7);var g=(o,q)=>'function'==typeof q?''+q:q;f.toJsonString=o=>JSON.stringify(o,g),f.isEmpty=o=>{for(var q in o)if(o.hasOwnProperty(q))return 0;return 1},f.isHTMLEle=o=>o&&1===o.nodeType,f.callHook=function(o,q,r,t,u,w){o[r][t].key==q&&(w={v:u.value,k:u.key},u.change=!1,o[r][t].handler.call(o[r][t].context,u),{v:u.value,k:u.key}!==w&&(u.change=!0))};var h=[],j=[];f.scheduleFlush=function(o,q){return new Promise(function(r){b.rafBounce||b.rafBounceIds[o]?(cancelAnimationFrame(j[o]),j[o]=requestAnimationFrame(function(){q(),r(),j[o]=0})):(h.push(q),j[o]?r():j[o]=requestAnimationFrame(function(){j[o]=0;for(var t;t=h.shift();)t();r()}))})};var l=[];f.onLCEvent=function(o,q,r){var t=o+'-'+q;l[t]=l[t]||[];var u=l[t].push(r);return function(){return l[t].splice(u-1,1)}},f.callLCEvent=function(o,q,r,t,u,w){var y;f.runningEventInstance=t;var z=b.mod.getProps(t),A=b.mod.getMod(t),B=A[o]?A:q[o]&&q;B&&(y=B[o].call(A,r,z,t,w),u&&(B[o]=0));var C=o+'-'+t;if(l[C]){for(var D of l[C])D(q,z);u&&(l[C]=0)}return(f.runningEventInstance=-1,!1===y)||void 0};var n={i:[],isItem:o=>~n.i.indexOf(o),setItem:o=>n.i[n.i.length]=o,getItem:o=>n.i.indexOf(o),getItemVal:o=>n.i[o],removeItem:o=>n.i.splice(n.i.indexOf(o),1)};f.items=n,f.getItemInstanceIdAll=()=>n.i,f.getItemInstanceId=o=>{return n.isItem(o)?n.getItem(o):(n.setItem(o),n.getItem(o))},b.utils=f}(mag),function(b,f,g){'use strict';function h(da){return Array.isArray(da)}function j(da,ea){return da[V]=da[V]||{},(!da[V].uid||ea)&&(da[V].uid=++aa),da[V].uid}function l(da,ea){var fa=j(da,ea);return Z[fa]?Z[fa]:Z[fa]=r(da)}function n(da,ea,fa){var ga=j(da,fa);return $[T.id]=$[T.id]||[],$[T.id][ga]&&$[T.id][ga]==ea?1:void($[T.id][ga]=ea)}function o(da){return da.id&&b.utils.items.isItem(da.id)?da:da.parentNode?o(da.parentNode):void 0}function q(da,ea){if(da[V]&&da[V].scid&&!da[V].pscid)ea=da;else if(ea)return ea;return da.parentNode?q(da.parentNode,ea):void 0}function r(da){var ea='',fa=o(da),ga=da.parentNode&&[].indexOf.call(da.parentNode.children,da);return fa&&(ea+='id("'+(fa.id||fa.tagName)+'")'),ea+='/'+da.tagName+'['+(ga+1)+']',ea}function t(da){if(da.id&&T.id===da.id||T.id===da)return'id("'+(da.id||da.tagName)+'")';if(da===b.doc.body)return da.tagName;var ea=0;if(da.parentNode)for(var ha,fa=da.parentNode.childNodes,ga=0;ga<fa.length;ga++){if(ha=fa[ga],ha===da)return t(da.parentNode)+(da.tagName?'/'+da.tagName+'['+(ea+1)+']':'');1===ha.nodeType&&ha.tagName===da.tagName&&ea++}}function u(da){var ea=t(da);da&&U[ea+'-config']&&U[ea+'-config'].configContext&&typeof U[ea+'-config'].configContext.onunload==='function'&&(U[ea+'-config'].configContext.onunload(U[ea+'-config'].configContext,da,ea),delete U[ea+'-config'],delete T.configs[ea]),da.parentNode&&da.parentNode.removeChild(da),b.mod.cached[b.utils.items.getItem(T.id)]=0}function w(da){var ea=da&&parseInt(da.split('[').pop().slice(0,-1));return ea?parseInt(ea)-1:0}function y(da){var ea=[];return da.replace(/\[(.+?)\]/g,function(fa,ga){ea.push(ga)}),ea}function z(da){return da&&~da.indexOf('id(')&&da.split('id("')[1].split('")')[0]}function A(da){if(da&&da[V]&&da[V].isChildOfArray)return da;return da.parentNode?A(da.parentNode):void 0}function B(da,ea,fa){if(!n(da,ea.outerHTML,fa)&&(!ea.id&&!da.childNodes[0]||ea.id&&!b.doc.getElementById(ea.id)||da.firstChild&&!da.firstChild.isEqualNode(ea))){var ga=b.utils.items.getItem(ea.id);if(~ga&&da.hasChildNodes()){var ha=b.utils.items.getItem(T.id),ia=da.cloneNode(1);ia[V]={childof:ha},b.mod.getProps(ga).children=ia}else ea[V]&&ea[V].scid&&(ia=da.cloneNode(1),ia[V]={childof:ea[V].scid},b._cprops[ea[V].scid]=ia);for(;da.lastChild;)da.removeChild(da.lastChild);if(ea[V]&&ea[V].childof!==g){da.innerHTML=ea.innerHTML;var ja=ea[V].childof;b._cprops[ja]||(C(da,ja),b.utils.onLCEvent('willupdate',ja,()=>{C(da,ja)}))}else da.appendChild(ea)}}function C(da,ea){var fa=T.id;T.setId(b.mod.getId(ea)),T.run(da,b.mod.getState(ea)),T.setId(fa)}function D(da,ea){var fa;for(var ga in ea){var ha=ea[ga];ha===g?ha='':null===ha&&-1===['onunload'].indexOf(ga)?(da[V].detached=da[V].detached||[],da[V].detached[ga]=1,H(da,ga)):da[V].detached&&da[V].detached[ga]&&(G(da,ga),da[V].detached[ga]=0),'_'===ga[0]&&'_'!==ga[1]&&(fa=fa||{},fa[ga.substr(1)]=ha)}return fa}function E(da,ea,fa){var ga;for(var ha in ea){var ia=ea[ha];if(!~T.ignorekeys.indexOf(ha)&&'_'!==ha[0]){ga=P(da,ha);var ja={key:ha,value:ia,node:da};b.hook('values','*',ja),ja.change&&(ia=ja.value),T.run(ga,ia,fa+'/'+ha)}}}function F(da,ea,fa,ga){var ha,la=w(fa);return ea&&b.utils.isHTMLEle(ea)?void B(da,ea):'function'==typeof ea?ba(ea,da,la,fa):'object'==typeof ea?void(b.mod.innerMods[T.id]&&ea[b.mod.innerMods[T.id][0]]&&!ea[b.mod.innerMods[T.id][0]].draw&&b.mod.innerMods[T.id][1].destroy(),ha=D(da,ea),ha&&M(da,ha,fa,ga),E(da,ea,fa)):F(da,{_text:ea},fa)}function G(da,ea){var fa=P(da,ea);fa.forEach(function(ga){var ha=j(ga);if(ha in ca){for(var ia in ca[ha])ga.appendChild(ca[ha][ia]);delete ca[ha]}})}function H(da,ea){var fa=0,ga=1,ha=function(ka){if(++fa==ga)for(;ka.lastChild;)u(ka.lastChild)},ia=function(ka,la){var ma;ka.id&&b.utils.items.isItem(ka.id)&&(ma=b.utils.items.getItem(ka.id)),ma&&b.mod.getState(ma).onbeforeunload?(ga++,b.utils.callLCEvent('onbeforeunload',b.mod.getState(ma),ka,ma,0,function(){ma&&b.utils.callLCEvent('onunload',b.mod.getState(ma),ka,ma),la()})):(ma&&b.utils.callLCEvent('onunload',b.mod.getState(ma),ka,ma),la())},ja=P(da,ea);ja.forEach(function(ka){var la=j(ka);ka.children.length&&(ca[la]=I(ka.children));for(var na in ca[la]){var oa=ca[la][na];ia(oa,function(){ha(ka)})}ha(ka)})}function I(da){var ea;if(null==da.length&&(da=[da]),!h(da)){ea=[];for(var fa=0;fa<da.length;fa+=1)da[fa]&&ea.push(da[fa]);da=ea}return da}function J(da,ea){var fa=function(ga,ha,ia){var ja=r(ha),ka=z(ja);ka||(ka=q(ha));var la=T.id;T.setId(ka);var ma=A(ha),na=ma&&t(ma),oa=w(na),ja=ja,pa=w(ja),qa={path:na,node:ma,data:((ma||{})[V]||[]).dataPass,index:oa};T.setId(la);var ra=b.doc.getElementById(ka),sa=b.utils.items.getItem(ka),ta=ga.call(~sa?b.mod.getMod(sa):ra,ia,pa,ha,qa);if(ka&&ra){var ua=function(){b.redraw(ra,sa,1)};ta&&ta.then?ta.then(function(va){return ua(),va}):ua()}return ta}.bind({},ea,da);return fa}function K(da,ea){function fa(ga){var ha=da[V].eventHandlers[ea];for(var ia in ha){var ja=ha[ia],ka=J(da,ja),la=ka(ga);!1===la&&ga.preventDefault()}}da.removeEventListener(ea,fa),da.addEventListener(ea,fa)}function L(da,ea,fa,ga){var ha=ea.substr(2).toLowerCase(),ia=(ga?ga.split(')').pop():'')+'-'+fa[V].uid,ja=fa[V].events=fa[V].events||[],ka=fa[V].eventHandlers=fa[V].eventHandlers||[];ka[ha]=ka[ha]||[],ka[ha][ia]=da,ja[ha]||(ja[ha]=1,K(fa,ha))}function M(da,ea,fa,ga){var ha=w(fa);for(var ia in U[j(da)]=U[j(da)]||[],ea)if('text'!==ia&&'html'!==ia)if(0==ia.indexOf('on'))L(ea[ia],ia,da,ga);else{if('config'==ia){var fa=t(da),ha=w(fa),ja=!0;U[fa+'-config']?ja=!1:U[fa+'-config']={};var ka=U[fa+'-config'].configContext=U[fa+'-config'].configContext||{},la=function(pa,qa){return function(){return pa.apply(pa,qa)}};f[fa]=la(ea[ia],[da,ja,ka,ha]);continue}var ma={key:ia,value:ea[ia],node:da};if(b.hook('attributes',ia,ma),ma.change&&(ia=ma.key,ea[ia]=ma.value),U[j(da)]&&U[j(da)][ia]==ea[ia])continue;null===ea[ia]?da.removeAttribute(ia):'value'==ia&&da.multiple&&da.selectedOptions&&Array.isArray(ea[ia])?(da.value=ea[ia],ea[ia].forEach(function(pa){Array.from(da.options).find(qa=>qa.value==pa).selected=!0})):ia in da?'style'==ia?da[ia].cssText=ea[ia]:da[ia]=ea[ia]:da.setAttribute(ia,ea[ia]+''),U[j(da)][ia]=ea[ia]}N(da,ea.text),O(da,ea.html)}function N(da,ea){if(da&&null!=ea&&!n(da,ea)){var fa=ea+'';if('INPUT'!==da.nodeName)'SELECT'!==da.nodeName&&(da.firstChild?da.firstChild.textContent=fa:da.appendChild(da.ownerDocument.createTextNode(fa)));else if(!~['radio','checkbox'].indexOf(da.type))fa!=da.value&&(da.value=fa);else if(da.name){var ga=b.getNode(T.id).querySelectorAll('[name='+da.name+']');if(1<ga.length)for(var ha of ga)if(ha.value==fa){ha.checked=!0;break}}'SELECT'===da.nodeName&&fa&&(da.value=fa)}}function O(da,ea){!da||null==ea||n(da,ea)||(da.innerHTML=b.utils.isHTMLEle(ea)?ea.innerHTML:ea)}function P(da,ea,fa){var ga=R(da),ha=[],ia=ea,ja='$'===ea[0];'$'===ia[0]&&(ia=ia.substr(1));for(var ka=0;ka<ga.length;ka+=1)S(ga[ka],ia)&&ha.push(ga[ka]);if(!ha.length||ja)for(var ka=0;ka<ga.length&&(ha=ha.concat(P(ga[ka],ea,!0)),!ha.length||ja);ka++);if(!fa&&!ha.length){var la={key:ea,value:ha,node:da};b.hook('elementMatcher',ea,la),la.change&&(ha=la.value)}return ha}function Q(da){return T.id&&(b.utils.isHTMLEle(T.id)&&da[V]&&da[V].scid||da.id&&da.id!=T.id&&b.utils.items.isItem(da.id))?0:1}function R(da){var ea=[];if(da){var fa=da.childNodes;if(fa)for(var ga=0;ga<fa.length;ga+=1)1===fa[ga].nodeType&&Q(fa[ga])&&ea.push(fa[ga])}return ea}function S(da,ea){var fa=' '+da.className+' ';return da.id===ea||~fa.indexOf(' '+ea+' ')||da.name===ea||da.nodeName.toLowerCase()===ea.toLowerCase()||da.getAttribute('data-bind')===ea}var T={cached:[],ignorekeys:['toString','draw','then','hasOwnProperty','willgetprops','onbeforeunload','Symbol(Symbol.toStringTag)','nodeType','toJSON','onunload','willupdate','didupdate','didload','willload','isupdate']},U=T.cached,V=b.MAGNUM,X='undefined',Y='_key',Z=[],$=[],_={},aa=0;T.run=function(da,ea,fa){var ga,ha;if(da){null==ea&&(ea={_text:''});var ia=I(da);if(ha=h(ea),ha){if(_[fa]&&0===ia.length&&(_[fa].parent.insertAdjacentHTML('beforeend',_[fa].node),ia=I(_[fa].parent.children)),!ia.length)return;var ja=ia[0].parentNode;for(_[fa]||(_[fa]={node:ia[0].cloneNode(1).outerHTML,parent:ja});ia.length<ea.length;)_[fa]?(ja.insertAdjacentHTML('beforeend',_[fa].node),ga=ja.lastChild):ga=ia[0].cloneNode(1),ia.push(ga),ja&&ja.appendChild(ga);var ka=ea.map(function(pa){return pa&&pa[Y]});if((ia.length==ea.length||-1!==ka.indexOf(g))&&(ea=ea.map(function(pa,qa){if('object'==typeof pa){if(ia[qa][V]=ia[qa][V]||{},ia[qa][V].__key&&typeof pa[Y]==X)return pa[Y]=ia[qa][V].__key,pa;typeof pa[Y]==X&&(pa[Y]=V+qa),ia[qa][V].__key=pa[Y]}return pa})),ia.length>ea.length)if(0===ea.length||'object'!=typeof ea[0])for(;ia.length>ea.length;)ga=ia.pop(),ja=ga.parentNode,ja&&u(ga);else{var la=[],ma=ea.map(function(pa){return pa[Y]});ia=ia.filter(function(pa){var ra;return(typeof pa[V]==X?ra=1:(!~ma.indexOf(pa[V].__key)||~la.indexOf(pa[V].__key))&&(la.push(pa[V].__key),ra=1),ra)?(u(pa),!1):(la.push(pa[V].__key),!0)})}}for(var na=0;na<ia.length;na++)if(ha)ia[na]&&T.run(ia[na],ea[na]);else{var oa=l(ia[na]);ea&&'object'==typeof ea&&ea.hasOwnProperty(Y)&&(ia[na][V].isChildOfArray=!0,!b.utils.isHTMLEle(ea)&&(ia[na][V].dataPass=ea)),ia[na][V].xpath=oa,F(ia[na],ea,oa,fa)}}};var ba=function(da,ea,fa,ga){'string'==typeof T.id||T.id.id||(ga=t(ea.parentNode)+ga),fa=y(ga);var ha=da(fa.join('.'),ga);return ha&&b.utils.isHTMLEle(ha)?void(B(ea,ha),ea[V]=ea[V]||{},ea[V].isChildOfArray=!0,ea[V].dataPass={index:fa},da.draw&&da.draw()):F(ea,ha,ga)},ca=[];T.removeNode=u,T.configs=f,T.find=P,T.setId=da=>{T.id=da},T.clearCache=da=>{$[da]&&delete $[da]},b.fill=T}(mag,[]),function(b){function g(j,l,n,o){function q(t){return r.has(t)}var r=new WeakSet;return new Proxy(j,{get:function(t,u,w){var y=t[u];if('symbol'==typeof u)return y;if('object'!=typeof y||'symbol'==typeof y||null===y||'function'==typeof y||Array.isArray(y)||!b.utils.isObject(y)||y.then||y.draw)u in t||~b.fill.ignorekeys.indexOf(u.toString())||n||'_'==u[0]||(y=b.proxy({},l,n,o+h+u));else if(!q(y))return r.add(y),b.proxy(y,l,n,o+h+u);var z=l({type:'get',object:t,name:u,path:o,oldValue:Reflect.get(t,u,w)});return'undefined'!=typeof z&&(y=z==b.MAGNUM?void 0:z),y},deleteProperty:function(t,u){return l({type:'delete',name:u,object:t,oldValue:Reflect.get(t,u)}),Reflect.deleteProperty(t,u)},set:function(t,u,w,y){var z=Reflect.get(t,u,y);return z===w&&'length'!==u||(l({type:'set',name:u,object:t,oldValue:z}),Reflect.set(t,u,w,y))}})}var h='/';b.proxy=function(j,l,n,o){for(var q in j){var r=typeof j[q];Array.isArray(j[q])&&101>j[q].length?j[q]=g(j[q],l):'object'==r&&null!==j[q]&&'symbol'!=typeof q&&'symbol'!=r&&'function'!=r&&b.utils.isObject(j[q])&&(j[q]=b.proxy(j[q],l,n,o+h+q))}return g(j,l,n,o||h)}}(mag,window||global||this);<commit_msg>Update mag.0.28.9.min.js<commit_after>/*
Mag.JS v0.28.9
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
(function(b,f){'use strict';function h(S,T){if(y[S]&&!T)return y[S];var U=mag.doc.getElementById(S);return U&&(y[S]=U),y[S]}var j='KEY',l=0,n=['#'+j,'.'+j,j],o=function(S,T){var U;for(var V in n){var W=n[V].replace(j,T);if(U=S.querySelector(W),U)break}return U},q=function(S){var T=mag.utils.items.getItemVal(S),U=mag.getNode(T);return U},r=function(S){if('string'==typeof S){var T=q(~mag.mod.runningViewInstance||mag.utils.runningEventInstance),U=o(T||mag.doc,S);if(U)return U}return S},t=function(S,T,U){var Z,V=[],W=S.cloneNode(1),Y=[],$=[],_=function(aa){var ba=S;aa=aa||{};var ca;aa.key&&(ca=aa.key+'-'+_.id);var da=aa.key?aa.key+'-'+_.id:_.id;if($[da]||($[da]='object'==typeof U?mag.utils.copy(U):U),'object'==typeof aa&&(aa=mag.utils.extend($[da],aa)),ca&&!V[ca]?ba=V[ca]=W.cloneNode(1):ca&&V[ca]&&(ba=V[ca]),Z&&Z==ba[u].scid)throw Error('MagJS Error - recursive call:'+Z);ba[u]=ba[u]||{},mag._cprops[da]&&'object'==typeof aa&&(aa.children=mag._cprops[da]);var ea;if(Y[da]!=mag.utils.toJsonString(aa))try{ea=T(aa),Z=ba[u].scid=da,Y[da]=mag.utils.toJsonString(aa);var fa=mag.fill.id;fa&&fa[u]&&fa[u].scid&&(ba[u].pscid=fa[u].scid),mag.fill.setId(ba),mag.fill.run(ba,ea)}finally{mag.fill.setId(fa),Z=0}return ba};return _.id=++l,_.clone=W,_};b.mag=function(S,T,U){if(S=r(S),T=r(T),U=U||{},mag.utils.isHTMLEle(T)&&mag.utils.isHTMLEle(S))T[u]||mag.fill.run(T,S);else{if('function'==typeof T&&mag.utils.isHTMLEle(S)){try{t(S.cloneNode(1),T,U)()}catch(V){}return t(S,T,U)}return K(-1,h(mag._isNode(S)),T,U)}};var u='__magnum__';mag.MAGNUM=u,mag.rafBounceIds=[],mag._cprops=[],mag.doc=f;var w={values:[],attributes:[],elementMatcher:[]},y=[],l=0;mag._isNode=function(S){return mag.utils.isHTMLEle(S)&&(!S.id&&(S.id=++l),y[S.id]=S,S=S.id),S};var z=function(S,T){var U,V=T?S+'-'+T:S;return U=mag.utils.items.isItem(V)?mag.utils.items.getItem(V):mag.utils.getItemInstanceId(V),U};mag.module=function(S,T,U){U=U||{},S=mag._isNode(S);var V=z(S,U.key),W=A(U,V,T,S);return W?K(V,W,T,mag.utils.copy(U)):void 0};var A=function(S,T,U,V){S.retain||mag.mod.clear(T);var W=h(V);if(mag.mod.submodule(V,T,U,S),L(T,V),!Q(T,W))return mag.redraw(W,T,1).then(function(){R(T,W)}),W},B=function(S,T){return 0>T||T!=mag.utils.items.getItem(S)?S==mag.mod.getId(T):!0},C=[];mag.begin=function(S){'undefined'==typeof C[S]?C[S]=1:C[S]++},mag.end=function(S){if(1<C[S])C[S]--;else{C[S]=0;var T=mag.utils.items.getItemVal(S);mag.redraw(h(T),S)}},mag.redraw=function(S,T,U){if(!C[T]){if(!S||'undefined'==typeof T)throw Error('Mag.JS - Id or node invalid: '+mag.utils.items.getItemVal(T));if(!B(S.id,T))return{then:V=>V()};if(U&&mag.fill.configs.splice(0,mag.fill.configs.length),U&&mag.mod.clear(T),mag.mod.runningViewInstance==T)throw Error('Mag.JS - recursive call:'+T);return mag.utils.scheduleFlush(T,M(S,T,U))}},mag.hookin=function(S,T,U){w[S].push({context:{},handler:U,key:T})},mag.hook=function(S,T,U){for(var V=0,W=w[S].length;V<W;V++)mag.utils.callHook(w,T,S,V,U)};var D={},E=[],F=[],G=function(S,T,U){var V=mag.getNode(mag.mod.getId(S)),W=function(){mag.utils.callLCEvent('onunload',mag.mod.getState(S),V,S)||(mag.clear(S),P(S,V),T[S]&&(T[S].length=0),U&&(mag.fill.removeNode(V),mag.mod.remove(S)))};mag.mod.getState(S).onbeforeunload?mag.utils.callLCEvent('onbeforeunload',mag.mod.getState(S),V,S,0,function(){W()}):W()},H=function(S,T){F[S]=F[S]||[];var U=F[S].push(T);return mag.utils.onLCEvent('didupdate',S,function(V,W){var X=mag.utils.merge(mag.utils.copy(W),mag.utils.copy(V));if(mag.utils.toJsonString(X)!=mag.utils.toJsonString(E[S])){for(var Y of F[S])Y(V,W,h(mag.mod.getId(S)),E[S]);E[S]=X}}),function(){return F[S].splice(U-1,1)}},I=[],J=function(S,T,U,V,W){var X=mag.utils.items.getItem(T);(T=mag._isNode(S),R(X,S),!(mag.mod.exists(X)&&mag.utils.callLCEvent('willgetprops',mag.mod.getState(X),S,X,0,U)))&&(mag.mod.submodule(S.id,X,V,U),L(X,S.id),Q(X,S)||mag.redraw(S,X,W).then(function(){R(X,S)}))},K=function(S,T,U,V){I[S]=I[S]||[];var W=function(X,Y,Z,$,_){'object'==typeof _&&($=mag.utils.merge(mag.utils.copy($),_),_=0),0>X&&!_&&(_=1);var aa=Y.id+($.key?'.'+$.key+'.':'')+(_||'');!D[aa]||$.key||~W._id||(aa+=++l);var ba=D[aa]=D[aa]||Y.cloneNode(1);if(ba.id=aa,mag.utils.items.isItem(aa))return J(ba,aa,$,Z,1),ba;var ca=mag.utils.getItemInstanceId(ba.id);return 0>X?X=W._id=ca:I[X].push({instanceId:ca,subscribe:H.bind({},ca)}),J(ba,aa,$,Z,1),ba}.bind({},S,T,U,V);return W._id=S,W.clones=function(){return I[W._id]},W.destroy=function(X){G(W._id,W.clones,X)},W.getId=function(){return W._id},W.rafBounce=function(X){return X?mag.rafBounceIds[W._id]=1:!1===X&&(mag.rafBounceIds[W._id]=0),!!mag.rafBounceIds[W._id]},W.draw=function(X){return mag.redraw(T,W._id,X)},W.getState=function(){return mag.mod.getState(W._id)},W.getProps=function(){return mag.mod.getProps(W._id)},W.subscribe=function(X){return H(W._id,X)},W},L=function(S,T){var U=function(V,W){h(W)?mag.redraw(h(W),V):mag.utils.items.isItem(W)&&mag.clear(V)}.bind({},S,T);mag.mod.setFrameId(S,U)};mag.clear=function(S){mag.utils.items.removeItem(S),mag.mod.clear(S),mag.fill.clearCache(mag.mod.getId(S))};var M=function(S,T,U){return function(V,W,X){if(h(V.id,1),B(V.id,W)&&V){var Y=mag.mod.getState(W);if(!mag.utils.callLCEvent('isupdate',Y,V,W)){if(mag.mod.iscached(W)&&!X)return 0;if(!mag.utils.callLCEvent('willupdate',Y,V,W)){mag.mod.callView(V,W);var Z=mag.fill.id;mag.fill.setId(V.id),mag.fill.run(V,Y),mag.fill.setId(Z),N(V.id,mag.fill.configs),mag.utils.callLCEvent('didupdate',Y,V,W),X||mag.mod.iscached(W)}}}}.bind({},S,T,U)},N=function(S,T){for(var U in T)U.startsWith('id("'+S+'")/')&&T[U]()},O=function(S){var U=[];for(var V in mag.fill.cached)-1<V.indexOf('id("'+S+'")/')&&-1<V.indexOf('-config')&&mag.fill.cached[V].configContext&&U.push({path:V.split('-config')[0],controller:mag.fill.cached[V].configContext,handler:mag.fill.cached[V].configContext.onunload});return U},P=function(S,T){for(var W,U=O(T.id,S),V=0,X=U;W=X&&X[V];V++)W.controller.onunload&&(W.handler.call(W.controller,T,W.path),W.controller.onunload=0)},Q=function(S,T){return mag.utils.callLCEvent('willload',mag.mod.getState(S),T,S,1)},R=function(S,T){var U=mag.utils.items.getItemVal(S);if(h(U)&&mag.mod.exists(S))return mag.utils.callLCEvent('didload',mag.mod.getState(S),T,S,1)};mag.getNode=h})(window||global||this,document),function(b){'use strict';function f(u,w){var y=u.name;if('undefined'==typeof u.object[u.name]&&'_'!=y[0]){var z=b.fill.find(w,y),A='$'===y[0],B=[];return z.length?(z.forEach(function(G){var H;if(!(G&&G.type&&!~['submit','button'].indexOf(G.type)))'undefined'==typeof u.oldValue&&'undefined'==typeof u.object[u.name]&&G&&!~['submit','button'].indexOf(G.type)&&1==G.childNodes.length&&G.childNodes[0].textContent.trim()&&(H={_text:G.childNodes[0].textContent.trim()});else if(G.value&&0<G.value.length)if('checkbox'!=G.type&&'radio'!=G.type){var K=G.multiple&&[].map.call(G.selectedOptions,L=>L.value);H={_value:K||G.value}}else if(G.checked&&(H={},H._checked=!0),!A){var I=w.querySelectorAll('[name='+G.name+']');if(I.length)for(var J of I)J.checked&&(H?H._value=J.value:H={_value:J.value})}else H?H._value=G.value:H={_value:G.value};H?B.push(H):G&&!G.hasChildNodes()&&B.push(j)}),0===B.length?void 0:A?B:B[0]&&'undefined'!=typeof B[0]._value?B[0]._value:B[0]&&B[0]._text?B[0]._text:B[0]):j}if('_'==y[0]){var C=y.substr(1);if(w.length){var B=[];for(var D in w){var E=w[D],F=E[C];'undefined'==typeof F&&(F=E.getAttribute(C)),B.push(F)}return B}var F=w[C];return'undefined'==typeof F&&(F=w.getAttribute(C)),F}}function g(u,w){n.setProps(w,b.proxy(n.getProps(w),t.bind({},'props',w),'prop'));var z=new u(b.proxy({},t.bind({},'state',w)));return z}var h=[],j=b.MAGNUM,n={runningViewInstance:-1,innerMods:[],cache:[]};n.getState=function(u){return h[u][1]},n.setState=function(u,w){h[u][1]=w},n.getView=function(u){return h[u][0]},n.getProps=function(u){return h[u][2]},n.setProps=function(u,w){return h[u][2]=w},n.remove=function(u){h[u]&&(h[u]=0)},n.getId=function(u){return h[u]&&h[u][3]},n.exists=function(u){return'undefined'!=typeof h[u]},n.setFrameId=function(u,w){h[u][4]=w},n.getFrameId=function(u){return h[u][4]},n.getMod=function(u){return h[u][5]};var o=(u,w)=>{for(var y in w=w||u,u){var z=u[y];'function'!=typeof z||~['controller','view'].indexOf(y)||(u[y]=z.bind(w))}return u};n.submodule=function(u,w,y,z){if(h[w])return z.key&&z.key==n.getProps(w).key?n.setProps(w,b.utils.copy(b.utils.merge(n.getProps(w),z))):n.setProps(w,z),h[w];y=b.utils.copy(y),o(y,y),h[w]=[0,0,0,0,0,0],n.setProps(w,z);var B=function(D,E,F){y.element=F,y.state=E,y.props=n.getProps(D),y.view&&y.view.call(y,E,y.props,F)}.bind({},w),C={controller:function(D){return y.props=n.getProps(w),y.state=D,y.element=b.getNode(u),(y.controller||function(){}).call(D,y.props)||D},view:B};return h[w][0]=C.view,h[w][3]=u,h[w][1]=g(C.controller,w,u),h[w][5]=y,h[w]};var q=[],r=function(u,w){var y=u,z=w.split('/');for(var A of z)if(A){var B=b.fill.find(y,A);B.length&&(y=B)}return y},t=function(u,w,y){if('get'==y.type&&'props'!=u&&!~b.fill.ignorekeys.indexOf(y.name.toString())&&'undefined'==typeof y.oldValue){var z=b.getNode(n.getId(w));if(y.path&&'/'==y.path[0])var A=r(z,y.path);A&&'$'!=y.path.split('/').pop()[0]&&(A=A[0]);var B=f(y,A?A:z);if(null!==B&&'object'==typeof B&&y.object&&b.utils.merge(B,y.object[y.name]),B)return n.cached[w]=0,B}else'set'==y.type&&'props'!=u&&y.object[y.name]&&y.object[y.name].draw&&'function'==typeof y.object[y.name].draw&&(n.innerMods[n.getId(w)]=[y.name,y.object[y.name]]);var C=n.getFrameId(w);'function'==typeof C&&'set'==y.type&&(cancelAnimationFrame(q[w]),q[w]=requestAnimationFrame(C))};n.iscached=function(u){var w=b.utils.toJsonString(b.utils.merge(b.utils.copy(n.getProps(u)),n.getState(u)));return u in n.cache&&n.cache[u]==w||void(n.cache[u]=w)},n.clear=function(u){~u&&n.cache[u]&&n.cache.splice(u,1)},n.cached=[],n.callView=function(u,w){n.runningViewInstance=w,n.cached[w]||(b.props.attachToArgs(w,n.getState(w),u),n.cached[w]=1);try{n.getView(w)(n.getState(w),u)}finally{n.runningViewInstance=-1}},b.mod=n}(mag),function(b){'use strict';function g(y,z,A,B){var C=[];for(var D in y){var E=y[D];j(E)&&(C.push(E),h(E,z,A,B))}return!!C.length&&(1==C.length?C[0]:C)}function h(y,z,A,B){if(y[q]=y[q]||{},!y[q].eventOnFocus){var C=function(D,E,F){var H=~['radio','checkbox'].indexOf(y.type);if(this[q].dirty||(this[q].dirty=1),y.selectedOptions)var I=[].map.call(y.selectedOptions,J=>J.value);H?'_checked'in E||o in E?E._checked=this.checked:this.checked&&(E[F]=this.value):void 0===E[o]?void 0!==E._text&&(E._text=I||this.value):E[o]=I||this.value,b.redraw(D,b.utils.items.getItem(D.id))}.bind(y,B,z,A);y.addEventListener('click',C),y.addEventListener('input',C),y.addEventListener('change',C),y.addEventListener('focus',C),y[q].eventOnFocus=1}}function j(y){return y&&~['INPUT','SELECT','TEXTAREA'].indexOf(y.tagName)}function l(y){for(var z in y)if(j(y[z]))return y[z];return!1}var n={},o='_value',q=b.MAGNUM,r=function(y,z){for(var A=1;A<y.length;A++){var B=y[A],C=y[A+1],D=b.fill.find(Array.isArray(z)?z[0]:z,B);if(C&&!isNaN(+C))z=D[C];else if(D&&D.length&&C&&A+2<y.length)z=b.fill.find(D[0],C);else if(D&&D.length&&(z=D,A+2==y.length))break}return Array.isArray(z)?z[0]:z},t=function(y,z,A,B){var D,C=A.toString().split('.');if(3<=C.length)B=r(C,B),D=b.fill.find(B,z);else{var E=parseInt(C.pop()),F=isNaN(E)?0:E;D=b.fill.find(B[F]?B[F]:B,z)}return g(D,y,z,B)},u=function(y,z,A,B){var C=A[z];~[o,'_checked','_text'].indexOf(z)&&'string'==typeof y&&(z=y.split('.').pop());var D=b.fill.find(B,z),E=l(D);if('function'!=typeof C&&E){var F=t.bind({},A,z,y,B);F(),Object.defineProperty(A,z,{configurable:!0,get:function(){var G=F();return G&&'undefined'!==G.value&&G[q]&&G[q].dirty&&G.value!==C?(C=G.value,b.redraw(B,y,1),G.value):C},set:function(G){var H=F();H&&'undefined'!==H.value&&H.value!==G&&G!==C&&(H.value=G,C=G)}})}},w=function(y,z,A){for(var B in z)if(z.hasOwnProperty(B)){var C=z[B];B==o||'object'!=typeof C||b.utils.isHTMLEle(C)?u.bind({},y,B,z,A)():(b.utils.isObject(C)&&b.utils.isEmpty(C)&&(C[o]=''),w(y+'.'+B,C,A))}};n.attachToArgs=w,b.props=n}(mag),function(b){'use strict';var f={};f.copy=o=>Object.assign({},o),f.merge=function(){return Object.assign.apply({},arguments)},f.extend=function(o,q,r){for(var t in q)if(q[t]===void 0)delete q[t];else if(r&&f.isObject(q[t]))return f.extend(o[t],q[t]);return f.merge(o,q)},f.isObject=o=>'Object]'==Object.prototype.toString.call(o).substr(-7);var g=(o,q)=>'function'==typeof q?''+q:q;f.toJsonString=o=>JSON.stringify(o,g),f.isEmpty=o=>{for(var q in o)if(o.hasOwnProperty(q))return 0;return 1},f.isHTMLEle=o=>o&&1===o.nodeType,f.callHook=function(o,q,r,t,u,w){o[r][t].key==q&&(w={v:u.value,k:u.key},u.change=!1,o[r][t].handler.call(o[r][t].context,u),{v:u.value,k:u.key}!==w&&(u.change=!0))};var h=[],j=[];f.scheduleFlush=function(o,q){return new Promise(function(r){b.rafBounce||b.rafBounceIds[o]?(cancelAnimationFrame(j[o]),j[o]=requestAnimationFrame(function(){q(),r(),j[o]=0})):(h.push(q),j[o]?r():j[o]=requestAnimationFrame(function(){j[o]=0;for(var t;t=h.shift();)t();r()}))})};var l=[];f.onLCEvent=function(o,q,r){var t=o+'-'+q;l[t]=l[t]||[];var u=l[t].push(r);return function(){return l[t].splice(u-1,1)}},f.callLCEvent=function(o,q,r,t,u,w){var y;f.runningEventInstance=t;var z=b.mod.getProps(t),A=b.mod.getMod(t),B=A[o]?A:q[o]&&q;B&&(y=B[o].call(A,r,z,t,w),u&&(B[o]=0));var C=o+'-'+t;if(l[C]){for(var D of l[C])D(q,z);u&&(l[C]=0)}return(f.runningEventInstance=-1,!1===y)||void 0};var n={i:[],isItem:o=>~n.i.indexOf(o),setItem:o=>n.i[n.i.length]=o,getItem:o=>n.i.indexOf(o),getItemVal:o=>n.i[o],removeItem:o=>n.i.splice(n.i.indexOf(o),1)};f.items=n,f.getItemInstanceIdAll=()=>n.i,f.getItemInstanceId=o=>{return n.isItem(o)?n.getItem(o):(n.setItem(o),n.getItem(o))},b.utils=f}(mag),function(b,f,g){'use strict';function h(da){return Array.isArray(da)}function j(da,ea){return da[V]=da[V]||{},(!da[V].uid||ea)&&(da[V].uid=++aa),da[V].uid}function l(da,ea){var fa=j(da,ea);return Z[fa]?Z[fa]:Z[fa]=r(da)}function n(da,ea,fa){var ga=j(da,fa);return $[T.id]=$[T.id]||[],$[T.id][ga]&&$[T.id][ga]==ea?1:void($[T.id][ga]=ea)}function o(da){return da.id&&b.utils.items.isItem(da.id)?da:da.parentNode?o(da.parentNode):void 0}function q(da,ea){if(da[V]&&da[V].scid&&!da[V].pscid)ea=da;else if(ea)return ea;return da.parentNode?q(da.parentNode,ea):void 0}function r(da){var ea='',fa=o(da),ga=da.parentNode&&[].indexOf.call(da.parentNode.children,da);return fa&&(ea+='id("'+(fa.id||fa.tagName)+'")'),ea+='/'+da.tagName+'['+(ga+1)+']',ea}function t(da){if(da.id&&T.id===da.id||T.id===da)return'id("'+(da.id||da.tagName)+'")';if(da===b.doc.body)return da.tagName;var ea=0;if(da.parentNode)for(var ha,fa=da.parentNode.childNodes,ga=0;ga<fa.length;ga++){if(ha=fa[ga],ha===da)return t(da.parentNode)+(da.tagName?'/'+da.tagName+'['+(ea+1)+']':'');1===ha.nodeType&&ha.tagName===da.tagName&&ea++}}function u(da){var ea=t(da);da&&U[ea+'-config']&&U[ea+'-config'].configContext&&typeof U[ea+'-config'].configContext.onunload==='function'&&(U[ea+'-config'].configContext.onunload(U[ea+'-config'].configContext,da,ea),delete U[ea+'-config'],delete T.configs[ea]),da.parentNode&&da.parentNode.removeChild(da),b.mod.cached[b.utils.items.getItem(T.id)]=0}function w(da){var ea=da&&parseInt(da.split('[').pop().slice(0,-1));return ea?parseInt(ea)-1:0}function y(da){var ea=[];return da.replace(/\[(.+?)\]/g,function(fa,ga){ea.push(ga)}),ea}function z(da){return da&&~da.indexOf('id(')&&da.split('id("')[1].split('")')[0]}function A(da){if(da&&da[V]&&da[V].isChildOfArray)return da;return da.parentNode?A(da.parentNode):void 0}function B(da,ea,fa){if(!n(da,ea.outerHTML,fa)&&(!ea.id&&!da.childNodes[0]||ea.id&&!b.doc.getElementById(ea.id)||da.firstChild&&!da.firstChild.isEqualNode(ea))){var ga=b.utils.items.getItem(ea.id);if(~ga&&da.hasChildNodes()){var ha=b.utils.items.getItem(T.id),ia=da.cloneNode(1);ia[V]={childof:ha},b.mod.getProps(ga).children=ia}else ea[V]&&ea[V].scid&&(ia=da.cloneNode(1),ia[V]={childof:ea[V].scid},b._cprops[ea[V].scid]=ia);for(;da.lastChild;)da.removeChild(da.lastChild);if(ea[V]&&ea[V].childof!==g){da.innerHTML=ea.innerHTML;var ja=ea[V].childof;b._cprops[ja]||(C(da,ja),b.utils.onLCEvent('willupdate',ja,()=>{C(da,ja)}))}else da.appendChild(ea)}}function C(da,ea){var fa=T.id;T.setId(b.mod.getId(ea)),T.run(da,b.mod.getState(ea)),T.setId(fa)}function D(da,ea){var fa;for(var ga in ea){var ha=ea[ga];ha===g?ha='':null===ha&&-1===['onunload'].indexOf(ga)?(da[V].detached=da[V].detached||[],da[V].detached[ga]=1,H(da,ga)):da[V].detached&&da[V].detached[ga]&&(G(da,ga),da[V].detached[ga]=0),'_'===ga[0]&&'_'!==ga[1]&&(fa=fa||{},fa[ga.substr(1)]=ha)}return fa}function E(da,ea,fa){var ga;for(var ha in ea){var ia=ea[ha];if(!~T.ignorekeys.indexOf(ha)&&'_'!==ha[0]){ga=P(da,ha);var ja={key:ha,value:ia,node:da};b.hook('values','*',ja),ja.change&&(ia=ja.value),T.run(ga,ia,fa+'/'+ha)}}}function F(da,ea,fa,ga){var ha,la=w(fa);return ea&&b.utils.isHTMLEle(ea)?void B(da,ea):'function'==typeof ea?ba(ea,da,la,fa):'object'==typeof ea?void(b.mod.innerMods[T.id]&&ea[b.mod.innerMods[T.id][0]]&&!ea[b.mod.innerMods[T.id][0]].draw&&b.mod.innerMods[T.id][1].destroy(),ha=D(da,ea),ha&&M(da,ha,fa,ga),E(da,ea,fa)):F(da,{_text:ea},fa)}function G(da,ea){var fa=P(da,ea);fa.forEach(function(ga){var ha=j(ga);if(ha in ca){for(var ia in ca[ha])ga.appendChild(ca[ha][ia]);delete ca[ha]}})}function H(da,ea){var fa=0,ga=1,ha=function(ka){if(++fa==ga)for(;ka.lastChild;)u(ka.lastChild)},ia=function(ka,la){var ma;ka.id&&b.utils.items.isItem(ka.id)&&(ma=b.utils.items.getItem(ka.id)),ma&&b.mod.getState(ma).onbeforeunload?(ga++,b.utils.callLCEvent('onbeforeunload',b.mod.getState(ma),ka,ma,0,function(){ma&&b.utils.callLCEvent('onunload',b.mod.getState(ma),ka,ma),la()})):(ma&&b.utils.callLCEvent('onunload',b.mod.getState(ma),ka,ma),la())},ja=P(da,ea);ja.forEach(function(ka){var la=j(ka);ka.children.length&&(ca[la]=I(ka.children));for(var na in ca[la]){var oa=ca[la][na];ia(oa,function(){ha(ka)})}ha(ka)})}function I(da){var ea;if(null==da.length&&(da=[da]),!h(da)){ea=[];for(var fa=0;fa<da.length;fa+=1)da[fa]&&ea.push(da[fa]);da=ea}return da}function J(da,ea){var fa=function(ga,ha,ia){var ja=r(ha),ka=z(ja);ka||(ka=q(ha));var la=T.id;T.setId(ka);var ma=A(ha),na=ma&&t(ma),oa=w(na),ja=ja,pa=w(ja),qa={path:na,node:ma,data:((ma||{})[V]||[]).dataPass,index:oa};T.setId(la);var ra=b.doc.getElementById(ka),sa=b.utils.items.getItem(ka),ta=ga.call(~sa?b.mod.getMod(sa):ra,ia,pa,ha,qa);if(ka&&ra){var ua=function(){b.redraw(ra,sa,1)};ta&&ta.then?ta.then(function(va){return ua(),va}):ua()}return ta}.bind({},ea,da);return fa}function K(da,ea){function fa(ga){var ha=da[V].eventHandlers[ea];for(var ia in ha){var ja=ha[ia],ka=J(da,ja),la=ka(ga);!1===la&&ga.preventDefault()}}da.removeEventListener(ea,fa),da.addEventListener(ea,fa)}function L(da,ea,fa,ga){var ha=ea.substr(2).toLowerCase(),ia=(ga?ga.split(')').pop():'')+'-'+fa[V].uid,ja=fa[V].events=fa[V].events||[],ka=fa[V].eventHandlers=fa[V].eventHandlers||[];ka[ha]=ka[ha]||[],ka[ha][ia]=da,ja[ha]||(ja[ha]=1,K(fa,ha))}function M(da,ea,fa,ga){var ha=w(fa);for(var ia in U[j(da)]=U[j(da)]||[],ea)if('text'!==ia&&'html'!==ia)if(0==ia.indexOf('on'))L(ea[ia],ia,da,ga);else{if('config'==ia){var fa=t(da),ha=w(fa),ja=!0;U[fa+'-config']?ja=!1:U[fa+'-config']={};var ka=U[fa+'-config'].configContext=U[fa+'-config'].configContext||{},la=function(pa,qa){return function(){return pa.apply(pa,qa)}};f[fa]=la(ea[ia],[da,ja,ka,ha]);continue}var ma={key:ia,value:ea[ia],node:da};if(b.hook('attributes',ia,ma),ma.change&&(ia=ma.key,ea[ia]=ma.value),U[j(da)]&&U[j(da)][ia]==ea[ia])continue;null===ea[ia]?da.removeAttribute(ia):'value'==ia&&da.multiple&&da.selectedOptions&&Array.isArray(ea[ia])?(da.value=ea[ia],ea[ia].forEach(function(pa){Array.from(da.options).find(qa=>qa.value==pa).selected=!0})):ia in da?'style'==ia?da[ia].cssText=ea[ia]:da[ia]=ea[ia]:da.setAttribute(ia,ea[ia]+''),U[j(da)][ia]=ea[ia]}N(da,ea.text),O(da,ea.html)}function N(da,ea){if(da&&null!=ea&&!n(da,ea)){var fa=ea+'';if('INPUT'!==da.nodeName)'SELECT'!==da.nodeName&&(da.firstChild?da.firstChild.textContent=fa:da.appendChild(da.ownerDocument.createTextNode(fa)));else if(!~['radio','checkbox'].indexOf(da.type))fa!=da.value&&(da.value=fa);else if(da.name){var ga=b.getNode(T.id).querySelectorAll('[name='+da.name+']');if(1<ga.length)for(var ha of ga)if(ha.value==fa){ha.checked=!0;break}}'SELECT'===da.nodeName&&fa&&(da.value=fa)}}function O(da,ea){!da||null==ea||n(da,ea)||(da.innerHTML=b.utils.isHTMLEle(ea)?ea.innerHTML:ea)}function P(da,ea,fa){var ga=R(da),ha=[],ia=ea,ja='$'===ea[0];'$'===ia[0]&&(ia=ia.substr(1));for(var ka=0;ka<ga.length;ka+=1)S(ga[ka],ia)&&ha.push(ga[ka]);if(!ha.length||ja)for(var ka=0;ka<ga.length&&(ha=ha.concat(P(ga[ka],ea,!0)),!ha.length||ja);ka++);if(!fa&&!ha.length){var la={key:ea,value:ha,node:da};b.hook('elementMatcher',ea,la),la.change&&(ha=la.value)}return ha}function Q(da){return T.id&&(b.utils.isHTMLEle(T.id)&&da[V]&&da[V].scid||da.id&&da.id!=T.id&&b.utils.items.isItem(da.id))?0:1}function R(da){var ea=[];if(da){var fa=da.childNodes;if(fa)for(var ga=0;ga<fa.length;ga+=1)1===fa[ga].nodeType&&Q(fa[ga])&&ea.push(fa[ga])}return ea}function S(da,ea){var fa=' '+da.className+' ';return da.id===ea||~fa.indexOf(' '+ea+' ')||da.name===ea||da.nodeName.toLowerCase()===ea.toLowerCase()||da.getAttribute('data-bind')===ea}var T={cached:[],ignorekeys:['toString','draw','then','hasOwnProperty','willgetprops','onbeforeunload','Symbol(Symbol.toStringTag)','nodeType','toJSON','onunload','willupdate','didupdate','didload','willload','isupdate']},U=T.cached,V=b.MAGNUM,X='undefined',Y='_key',Z=[],$=[],_={},aa=0;T.run=function(da,ea,fa){var ga,ha;if(da){null==ea&&(ea={_text:''});var ia=I(da);if(ha=h(ea),ha){if(_[fa]&&0===ia.length&&(_[fa].parent.insertAdjacentHTML('beforeend',_[fa].node),ia=I(_[fa].parent.children)),!ia.length)return;var ja=ia[0].parentNode;for(_[fa]||(_[fa]={node:ia[0].cloneNode(1).outerHTML,parent:ja});ia.length<ea.length;)_[fa]?(ja.insertAdjacentHTML('beforeend',_[fa].node),ga=ja.lastChild):ga=ia[0].cloneNode(1),ia.push(ga),ja&&ja.appendChild(ga);var ka=ea.map(function(pa){return pa&&pa[Y]});if((ia.length==ea.length||-1!==ka.indexOf(g))&&(ea=ea.map(function(pa,qa){if('object'==typeof pa){if(ia[qa][V]=ia[qa][V]||{},ia[qa][V].__key&&typeof pa[Y]==X)return pa[Y]=ia[qa][V].__key,pa;typeof pa[Y]==X&&(pa[Y]=V+qa),ia[qa][V].__key=pa[Y]}return pa})),ia.length>ea.length)if(0===ea.length||'object'!=typeof ea[0])for(;ia.length>ea.length;)ga=ia.pop(),ja=ga.parentNode,ja&&u(ga);else{var la=[],ma=ea.map(function(pa){return pa[Y]});ia=ia.filter(function(pa){var ra;return(typeof pa[V]==X?ra=1:(!~ma.indexOf(pa[V].__key)||~la.indexOf(pa[V].__key))&&(la.push(pa[V].__key),ra=1),ra)?(u(pa),!1):(la.push(pa[V].__key),!0)})}}for(var na=0;na<ia.length;na++)if(ha)ia[na]&&T.run(ia[na],ea[na]);else{var oa=l(ia[na]);ea&&'object'==typeof ea&&ea.hasOwnProperty(Y)&&(ia[na][V].isChildOfArray=!0,!b.utils.isHTMLEle(ea)&&(ia[na][V].dataPass=ea)),ia[na][V].xpath=oa,F(ia[na],ea,oa,fa)}}};var ba=function(da,ea,fa,ga){'string'==typeof T.id||T.id.id||(ga=t(ea.parentNode)+ga),fa=y(ga);var ha=da(fa.join('.'),ga);return ha&&b.utils.isHTMLEle(ha)?void(B(ea,ha),ea[V]=ea[V]||{},ea[V].isChildOfArray=!0,ea[V].dataPass={index:fa},da.draw&&da.draw()):F(ea,ha,ga)},ca=[];T.removeNode=u,T.configs=f,T.find=P,T.setId=da=>{T.id=da},T.clearCache=da=>{$[da]&&delete $[da]},b.fill=T}(mag,[]),function(b){function g(j,l,n,o){function q(t){return r.has(t)}var r=new WeakSet;return new Proxy(j,{get:function(t,u,w){var y=t[u];if('symbol'==typeof u)return y;if('object'!=typeof y||'symbol'==typeof y||null===y||'function'==typeof y||Array.isArray(y)||!b.utils.isObject(y)||y.then||y.draw)u in t||~b.fill.ignorekeys.indexOf(u.toString())||n||'_'==u[0]||(y=b.proxy({},l,n,o+h+u));else if(!q(y))return r.add(y),b.proxy(y,l,n,o+h+u);var z=l({type:'get',object:t,name:u,path:o,oldValue:Reflect.get(t,u,w)});return'undefined'!=typeof z&&(y=z==b.MAGNUM?void 0:z),y},deleteProperty:function(t,u){return l({type:'delete',name:u,object:t,oldValue:Reflect.get(t,u)}),Reflect.deleteProperty(t,u)},set:function(t,u,w,y){var z=Reflect.get(t,u,y);return z===w&&'length'!==u||(l({type:'set',name:u,object:t,oldValue:z}),Reflect.set(t,u,w,y))}})}var h='/';b.proxy=function(j,l,n,o){for(var q in j){var r=typeof j[q];Array.isArray(j[q])&&101>j[q].length?j[q]=g(j[q],l):'object'==r&&null!==j[q]&&'symbol'!=typeof q&&'symbol'!=r&&'function'!=r&&b.utils.isObject(j[q])&&(j[q]=b.proxy(j[q],l,n,o+h+q))}return g(j,l,n,o||h)}}(mag,window||global||this);
{'fraction_non_alphanumeric': 0.3229782136403322, 'fraction_numerical': 0.0083247040669225, 'mean_word_length': 14.449184441656211, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5411032', 'n_tokens_mistral': 23006, 'n_tokens_neox': 23176, 'n_words': 954}