<commit_before>/*
Mag.JS v0.23.9
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
!function(e,t,n){function i(e,t){if(a[e]&&!t)return a[e];var n=mag.doc.getElementById(e);return n&&(a[e]=n),a[e]}e.mag={},mag.doc=t;var r={values:[],attributes:[],elementMatcher:[]},a=[];mag.create=function(e,t,n){return function(i,r){return"string"!=typeof i&&(r=i,i=0),mag.module(i||e,t,mag.utils.merge(n||{},r||{}))}},mag.module=function(e,t,n){n=n||{},e instanceof HTMLElement&&(e.id||(e.id=performance.now()),a[e.id]=e,e=e.id);var r;if(!(r=!mag.utils.items.isItem(e))){r=mag.utils.items.getItem(e);var o=i(e);r=!mag.utils.callLCEvent("onreload",mag.mod.getState(r),o,r)}return r&&(r=n.key&&mag.utils.items.isItem(e+"."+n.key)?mag.utils.items.getItem(e+"."+n.key):mag.utils.getItemInstanceId(n.key?e+"."+n.key:e),n.retain||mag.mod.clear(r),mag.mod.submodule(e,r,t,n),o=i(e),v(r,e),!mag.utils.callLCEvent("willload",mag.mod.getState(r),o,r,1))?(mag.redraw(o,r,1),mag.utils.callLCEvent("didload",mag.mod.getState(r),o,r,1),m(r,o,t,mag.utils.copy(n))):void 0};var o=function(e,t){return 0>t||t!=mag.utils.items.getItem(e)?e==mag.mod.getId(t)?!0:!1:!0},d=[];mag.begin=function(e){n===d[e]?d[e]=1:d[e]++},mag.end=function(e){if(1<d[e])d[e]--;else{d[e]=0;var t=mag.utils.items.getItemVal(e);mag.redraw(i(t),e)}};var l=[];mag.redraw=function(e,t,i){if(!d[t]){if(!e||n===t)throw Error("Mag.JS - Id or node invalid: "+mag.utils.items.getItemVal(t));o(e.id,t)&&(i&&mag.fill.configs.splice(0,mag.fill.configs.length),i&&mag.mod.clear(t),e=p(e,t,i),cancelAnimationFrame(l[t]),l[t]=requestAnimationFrame(e))}},mag.hookin=function(e,t,n){r[e].push({context:{},handler:n,key:t})},mag.hook=function(e,t,n){for(var i=0,a=r[e].length;a>i;i++)mag.utils.callHook(r,t,e,i,n)};var u={},c=[],f=function(e,t){mag.utils.onLCEvent("didupdate",e,function(n,r){var a=mag.utils.merge(mag.utils.copy(r),mag.utils.copy(n));JSON.stringify(a)!==JSON.stringify(c[e])&&(t(n,r,i(mag.mod.getId(e)),c[e]),c[e]=a)})},g=[],s=function(e,t,n,i,r){t=mag.utils.items.getItem(t),mag.mod.submodule(e.id,t,i,n),mag.utils.callLCEvent("willgetprops",mag.mod.getState(t),e,t,0,n)||(v(t,e.id),mag.redraw(e,t,r))},m=function(e,t,n,i){g[e]=g[e]||[];var r=function(e,t,n,i,r){if("object"==typeof r&&(i=mag.utils.merge(mag.utils.copy(i)||{},r),r=0),r=t.id+(i.key?"."+i.key:"")+"."+(r||0),t=u[r]=u[r]||t.cloneNode(1),t.id=r,mag.utils.items.isItem(r))return s(t,r,i,n,1),t;var a=mag.utils.getItemInstanceId(t.id);return g[e].push({instanceId:a,subscribe:f.bind({},a)}),s(t,r,i,n,1),t}.bind({},e,t,n,i);return r.clones=function(e){return g[e]}.bind({},e),r.destroy=function(e,t){var n=mag.getNode(mag.mod.getId(e));if(!mag.utils.callLCEvent("onunload",mag.mod.getState(e),n,e)){mag.clear(e);var i,a=0;i=n.id;var o,d=[];for(o in mag.fill.cached)-1<o.indexOf('id("'+i+'")/')&&-1<o.indexOf("-config")&&mag.fill.cached[o].configContext&&d.push({path:o.split("-config")[0],controller:mag.fill.cached[o].configContext,handler:mag.fill.cached[o].configContext.onunload});for(;i=d&&d[a];a++)i.controller.onunload&&(i.handler.call(i.controller,n,i.path),i.controller.onunload=0);r.clones(e).length=0,t&&mag.fill.removeNode(n)}}.bind({},e),r.getId=function(e){return e}.bind({},e),r.draw=function(e,t,n){mag.redraw(e,t,n)}.bind({},t,e),r.getState=function(e,t){return mag.mod.getState(t||e)}.bind({},e),r.getProps=function(e,t){return mag.mod.getProps(t||e)}.bind({},e),r.subscribe=f.bind({},e),r},v=function(e,t){var n=function(e,t){i(t)?mag.redraw(i(t),e):mag.utils.items.isItem(t)&&mag.clear(e)}.bind({},e,t);mag.mod.setFrameId(e,n)};mag.clear=function(e){cancelAnimationFrame(l[e]),mag.utils.items.removeItem(e),mag.mod.clear(e),mag.fill.clearCache(mag.mod.getId(e))};var p=function(e,t,r){return function(e,t,r){if(i(e.id,1),o(e.id,t)&&e){var a=mag.mod.getState(t);if(!mag.utils.callLCEvent("isupdate",a,e,t)){if(mag.mod.iscached(t)&&!r)e=0;else{if(!mag.utils.callLCEvent("willupdate",a,e,t)){mag.mod.callView(e,t),mag.fill.setId(e.id),mag.fill.run(e,a);var d,l=e.id,u=mag.fill.configs;for(d in u)-1<d.indexOf('id("'+l+'")/')&&u[d]();mag.utils.callLCEvent("didupdate",a,e,t),r||mag.mod.iscached(t)}e=n}return e}}}.bind({},e,t,r)};mag.getNode=i}(window||global||this,document),function(e){function t(t,n){var i=t.name;if(void 0===t.object[t.name]){var r,a=e.fill.find(n,i),i="$"===i[0],o=[];return a.reverse().forEach(function(e){e&&(e.value&&0<e.value.length?(r=e.value,!e.type||"checkbox"!=e.type&&"radio"!=e.type||(r={_value:r},e.checked&&(r._checked=!0),o.push(r))):e.innerText&&0<e.innerText.length?r=e.innerText:e.innerHTML&&0<e.innerHTML.length?r=e.innerHTML:e.value||"INPUT"!=e.tagName||(r=""))}),0<o.length&&i?o:r}}function n(n,i){var l;if("undefined"!=typeof Proxy){l=function(n,i,l){var u=JSON.stringify(l.object),c=String(l.name);if(u!==o[i+c]){if(o[i+c]=u,"get"!=l.type||"props"==n||~e.fill.ignorekeys.indexOf(String(l.name))||void 0!==l.oldValue||0!==Object.keys(l.object).length)"set"==l.type&&"props"!=n&&l.object[l.name]&&l.object[l.name].draw&&"function"==typeof l.object[l.name].draw&&(r.innerMods[r.getId(i)]=[l.name,l.object[l.name]]);else if(n=t(l,e.doc.getElementById(r.getId(i))),void 0!==n)return d[i]=0,n;n=r.getFrameId(i),"function"==typeof n&&"set"==l.type&&(cancelAnimationFrame(a[i]),a[i]=requestAnimationFrame(n))}};var u=r.getProps(i),u=e.proxy(u,l.bind({},"props",i));r.setProps(i,u),l=e.proxy({},l.bind({},"state",i)),l=new n(l)}else l=new n({});return l}var i=[],r={innerMods:[],cache:[],getState:function(e){return i[e][1]},setState:function(e,t){i[e][1]=t},getView:function(e){return i[e][0]},getProps:function(e){return i[e][2]},setProps:function(e,t){return i[e][2]=t},remove:function(e){i.splice(e,1)},getId:function(e){return i[e]&&i[e][3]},exists:function(e){return void 0!==i[e]?!0:!1},setFrameId:function(e,t){i[e][4]=t},getFrameId:function(e){return i[e][4]},submodule:function(t,a,o,d){return i[a]?(d.key&&d.key===r.getProps(a).key?r.setProps(a,e.utils.copy(e.utils.merge(r.getProps(a),d))):r.setProps(a,d),i[a]):(i[a]=[0,0,0,0,0],r.setProps(a,d),d=function(e,t,n){o.view.call(o,t,r.getProps(e),n)}.bind({},a),i[a][0]=d,i[a][3]=t,i[a][1]=n(function(e){return(o.controller||function(){}).call(e,r.getProps(a))||e},a,t),i[a])}},a=[],o=[];r.iscached=function(t){var n=e.utils.merge(e.utils.copy(r.getProps(t)),r.getState(t));return r.cache[t]&&r.cache[t]===JSON.stringify(n)?!0:void(r.cache[t]=JSON.stringify(n))},r.clear=function(e){e>-1&&r.cache[e]&&r.cache.splice(e,1)};var d=[];r.callView=function(t,n){var i=r.getView(n);d[n]||(e.props.attachToArgs(n,r.getState(n),t),d[n]=1),i(r.getState(n),t)},e.mod=r}(mag),function(e){function t(e){for(var t in e)if(e[t]&&-1!==["INPUT","SELECT","TEXTAREA"].indexOf(e[t].tagName))return e[t];return!1}var n={},i=function(t,n){for(var i=1;i<t.length;i+=2){var r=t[i+1];n=e.fill.find(n,t[i]),n=n[r]}return n},r=function(n,r,a,o){return a=(""+a).split("."),3>a.length?(a=parseInt(a.pop()),a=isNaN(a)?0:a,r=e.fill.find(o[a]?o[a]:o,r)):(o=i(a,o),r=e.fill.find(o,r)),(r=t(r))&&!r.eventOnFocus&&(a=-1<["radio","checkbox"].indexOf(r.type),o=function(t,i){this.__magnum__=this.__magnum__||{},this.__magnum__.dirty||(this.__magnum__.dirty=1),i&&(n._checked=this.checked,e.redraw(t,e.utils.items.getItem(t.id),1))}.bind(r,o,a),a?r.addEventListener("click",o,!1):r.addEventListener("focus",o,!1),r.eventOnFocus=1),r},a=function(n,i,a,o){var d=a[i];"_value"===i&&(i=n.split(".").pop());var l=e.fill.find(o,i),l=t(l);if("function"!=typeof d&&l){var u=r.bind({},a,i,n,o);u(),Object.defineProperty(a,i,{configurable:!0,get:function(){var t=u();return t&&"undefined"!==t.value&&t.__magnum__&&t.__magnum__.dirty&&t.value!==d?(d=t.value,e.redraw(o,n,1),t.value):d},set:function(e){var t=u();t&&"undefined"!==t.value&&t.value!==e&&e!==d&&(t.value=e,d=e)}})}},o=function(e,t,n){for(var i in t){var r=t[i];"object"==typeof r?o(e+"."+i,r,n):a.bind({},e,i,t,n)()}};n.attachToArgs=o,e.props=n}(mag),function(e){var t={callHook:function(e,t,n,i,r,a){e[n][i].key==t&&(a={v:r.value,k:r.key},r.change=!1,e[n][i].handler.call(e[n][i].context,r),a!=={v:r.value,k:r.key}&&(r.change=!0))}},n=[];t.onLCEvent=function(e,t,i){n[e+"-"+t]=i},t.callLCEvent=function(t,i,r,a,o,d){var l=!1,u={preventDefault:function(){l=!0}};return i&&i[t]&&(i[t].call(i,u,r,e.mod.getProps(a),a,d),o&&(i[t]=0)),n[t+"-"+a]&&n[t+"-"+a](e.mod.getState(a),e.mod.getProps(a)),l},t.copy=function(e){return Object.assign({},e)},t.merge=function(){return Object.assign.apply({},arguments)};var i={i:[],isItem:function(e){return-1<i.i.indexOf(e)},setItem:function(e){i.i[i.i.length]=e},getItem:function(e){return i.i.indexOf(e)},getItemVal:function(e){return i.i[e]},removeItem:function(e){i.i.splice(i.i.indexOf(e),1)}};t.items=i,t.getItemInstanceIdAll=function(){return i.i},t.getItemInstanceId=function(e){return i.isItem(e)?i.getItem(e):(i.setItem(e),i.getItem(e))},e.utils=t}(mag),function(e,t,n){function i(e){return Array.isArray&&Array.isArray(e)||"[object Array]"==={}.toString.call(e)}function r(e,t){return e[C]=e[C]||{},(!e[C].uid||t)&&(e[C].uid=performance.now()),e[C].uid}function a(e,t){var n=r(e,t);if(O[n])n=O[n];else{var i,a=O,o="";i=d(e);var l=e.parentNode&&[].indexOf.call(e.parentNode.children,e);i&&(o+='id("'+i.id+'")'),i=o+("/"+e.tagName+"["+(l+1)+"]"),n=a[n]=i}return n}function o(e,t,i){return e=r(e,i),S[N.id]=S[N.id]||[],S[N.id][e]&&S[N.id][e]==t?1:(S[N.id][e]=t,n)}function d(e){return e.id?e:e.parentNode?d(e.parentNode):n}function l(t){if(t.id)return'id("'+t.id+'")';if(t===e.doc.body)return t.tagName;var n=0;if(t.parentNode)for(var i=t.parentNode.childNodes,r=0;r<i.length;r++){var a=i[r];if(a===t)return l(t.parentNode)+(t.tagName?"/"+t.tagName+"["+(n+1)+"]":"");1===a.nodeType&&a.tagName===t.tagName&&n++}}function u(t){var n=l(t);t.parentNode.removeChild(t),t&&_[n+"-config"]&&_[n+"-config"].configContext&&typeof _[n+"-config"].configContext.onunload===w&&(_[n+"-config"].configContext.onunload(_[n+"-config"].configContext,t,n),delete _[n+"-config"],delete e.fill.configs[n])}function c(e){return(e=e&&parseInt(e.split("[").pop().slice(0,-1)))?parseInt(e)-1:0}function f(e){return e&&e[C]&&e[C].isChildOfArray?e:e.parentNode?f(e.parentNode):n}function g(t,n,i){if(!o(t,n.outerHTML,i)&&!e.doc.getElementById(n.id)){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(n)}}function s(t,r,a){var d,l=c(a);if(r&&r.nodeType==x)return g(t,r),n;if("function"==typeof r){var u=(d=f(t.parentNode))&&d.getAttribute("key");return d&&u&&(l=+u.split(C)[1]),(u=r(l))&&u.nodeType&&u.nodeType==x?(g(t,u),t[C]=t[C]||{},t[C].isChildOfArray=!0,t[C].dataPass={index:l},r.draw(),n):(r=/<[a-z][\s\S]*>/i.test(u)?"_html":"_text",l={},l[r]=u,s(t,l,a))}if("object"!=typeof r)return s(t,{_text:r},a);e.mod.innerMods[N.id]&&r[e.mod.innerMods[N.id][0]]&&!r[e.mod.innerMods[N.id][0]].draw&&e.mod.innerMods[N.id][1].destroy();for(u in r)l=r[u],l===n?l="":null===l&&-1===["onunload"].indexOf(u)?(t[C].detached=t[C].detached||[],t[C].detached[u]=1,v(t,u)):t[C].detached&&t[C].detached[u]&&(m(t,u),t[C].detached[u]=0),"_"===u[0]&&(d=d||{},d[u.substr(1)]=l);!o(t,JSON.stringify(r))&&d&&y(t,d,a);for(u in r)if(l=r[u],!~N.ignorekeys.indexOf(u)&&"_"!==u[0]){d=k(t,u);var p={key:u,value:l,node:t};e.hook("values","*",p),p.change&&(l=p.value),i(l)&&(d=k(t,"$"+u)),N.run(d,l,a+"/"+u)}}function m(e,t){k(e,t).forEach(function(e){var t=r(e);if(j[t]){for(var n in j[t])e.appendChild(j[t][n]);delete j[t]}})}function v(e,t){k(e,t).forEach(function(e){var t=r(e);for(e.children.length&&(j[t]=p(e.children));e.lastChild;)u(e.lastChild)})}function p(e){var t;if(null==e.length&&(e=[e]),!i(e)){t=[];for(var n=0;n<e.length;n+=1)e[n]&&t.push(e[n]);e=t}return e}function h(t,n,i){return function(t,n,i){var r=f(n),o=r&&l(r),d=c(o),u=a(n),g=c(u),r={path:o,data:((r||{})[C]||[]).dataPass,node:r,index:d},u=u&&-1<u.indexOf("id(")&&u.split('id("')[1].split('")')[0],o=e.doc.getElementById(u);return t=t.call(n,i,g,n,r),e.redraw(o,e.utils.items.getItem(u)),t}.bind({},n[i],t)}function y(n,i,r){var a,o=c(r);for(a in i)if("text"!==a&&"html"!==a)if(0==a.indexOf("on"))n[a.toLowerCase()]=h(n,i,a);else if("config"==a){r=l(n),o=c(r),_[r+"-config"]||(_[r+"-config"]={isNew:!0});var d=_[r+"-config"].configContext=_[r+"-config"].configContext||{};t[r]=function(e,t){return function(){var n=e.apply(e,t);return t[1]&&(_[r+"-config"].isNew=t[1]=0),n}}(i[a],[n,!0,d,o])}else o={key:a,value:i[a],node:n},e.hook("attributes",a,o),o.change&&(a=o.key,i[a]=o.value),null===i[a]?n.removeAttribute(a):(a in n&&(n[a]=i[a]),n.setAttribute(a,""+i[a]));b(n,i.text),I(n,i.html)}function b(e,t){var n,i;if(e&&null!=t){if(!i){i=[];for(var r=0;r<e.childNodes.length;r+=1)n=e.childNodes[r],n.nodeType===x&&i.push(n)}for(;e.lastChild;)e.removeChild(e.lastChild);for("INPUT"===e.nodeName?e.value=""+t:e.appendChild(e.ownerDocument.createTextNode(""+t)),r=0;r<i.length;r+=1)e.appendChild(i[r]);"SELECT"===e.nodeName&&(e.value=""+t)}}function I(e,t){e&&null!=t&&(e.innerHTML=t)}function k(t,n,i){var r=[];if(t){var a=t.childNodes;if(a)for(var o=0;o<a.length;o+=1)a[o].nodeType===x&&r.push(a[o])}var a=[],o=n,d="$"===n[0];"$"===o[0]&&(o=o.substr(1));for(var l=0;l<r.length;l+=1){var u=r[l],c=o,f=" "+u.className+" ";(u.id===c||-1<f.indexOf(" "+c+" ")||u.name===c||u.nodeName.toLowerCase()===c.toLowerCase()||u.getAttribute("data-bind")===c)&&a.push(r[l])}if(!a.length||d)for(l=0;l<r.length&&(a=a.concat(k(r[l],n,!0)),!a.length||d);l++);return i||a.length||(t={key:n,value:a,node:t},e.hook("elementMatcher",n,t),t.change&&(a=t.value)),a}var N={cached:[],ignorekeys:"willgetprops Symbol(Symbol.toStringTag) nodeType toJSON onunload onreload willupdate didupdate didload willload isupdate".split(" ")},x=1,_=N.cached,C="__magnum__",w="function",O=[],S=[],T={};N.run=function(e,t,r){var o,d,l;if(e){null==t&&(t={_text:""});var c=p(e);if(l=i(t)){if(T[r]&&0===c.length&&(T[r].parent.insertAdjacentHTML("beforeend",T[r].node),c=p(T[r].parent.children)),0===c.length)return;for(d=c[0].parentNode,T[r]||(T[r]={node:c[0].cloneNode(1).outerHTML,parent:d});c.length<t.length;)T[r]?(d.insertAdjacentHTML("beforeend",T[r].node),o=d.lastChild):o=c[0].cloneNode(1),c.push(o),d&&d.appendChild(o);if(c.map(function(e){return e.__key}),r=t.map(function(e){return e&&e._key}),(c.length==t.length||-1!==r.indexOf(n))&&(t=t.map(function(e,t){if("object"==typeof e){if(c[t].__key&&void 0===e._key)return e._key=c[t].__key,e;void 0===e._key&&(e._key=C+t),c[t].__key=e._key}return e})),c.length>t.length)if(0===t.length||"object"!=typeof t[0])for(;c.length>t.length;)o=c.pop(),(d=o.parentNode)&&u(o);else var f=[],g=t.map(function(e){return e._key}),c=(c.map(function(e){return e.__key}),c.filter(function(e){return-1===g.indexOf(e.__key)||-1!==f.indexOf(e.__key)?(f.push(e.__key),u(e),!1):(f.push(e.__key),!0)}))}for(r=0;r<c.length;r++)l?c[r]&&N.run(c[r],t[r]):(t&&"object"==typeof t&&-1!==Object.keys(t).indexOf("_key")&&(c[r][C]=c[r][C]||{},c[r][C].isChildOfArray=!0,c[r][C].dataPass=t),o=a(c[r]),s(c[r],t,o));return e}};var j=[];N.removeNode=u,N.configs=t,N.find=k,N.setId=function(e){N.id=e},N.clearCache=function(e){S[e]&&delete S[e]},e.fill=N}(mag,[]),function(e,t){function n(t,n){var i=[];return new Proxy(t,{get:function(t,r){var a=t[r],o=n({type:"get",object:e.utils.copy(t[r]),name:r,oldValue:i[r]});return void 0!==o&&(a=t[r]=o),a},deleteProperty:function(e,t){return n({type:"delete",name:t,object:e,oldValue:i[t]}),delete e[t]},set:function(t,r,a){return i[r]===a?!0:(JSON.stringify(a)!==JSON.stringify(t[r])&&(i[r]=e.utils.copy(t[r])),n({type:"set",name:r,object:t,oldValue:i[r]}),t[r]=a,!0)}})}function i(e,t){for(var i in e)Array.isArray(e[i])&&101>e[i].length&&(e[i]=n(e[i],t));return n(e,t)}e.proxy=function(n,r){return n&&t.Proxy?i(n,function(t){return"object"==typeof t.object[t.name]&&(t.object[t.name]=e.proxy(t.object[t.name],r)),r(t)}):void 0}}(mag,window||global||this);
<commit_msg>Update mag.0.23.9.min.js<commit_after>/*
Mag.JS v0.23.9
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
!function(e,t,n){function i(e,t){if(a[e]&&!t)return a[e];var n=mag.doc.getElementById(e);return n&&(a[e]=n),a[e]}e.mag={},mag.doc=t;var r={values:[],attributes:[],elementMatcher:[]},a=[];mag.create=function(e,t,n){return function(i,r){return"string"!=typeof i&&(r=i,i=0),mag.module(i||e,t,mag.utils.merge(n||{},r||{}))}},mag.module=function(e,t,n){n=n||{},e instanceof HTMLElement&&(e.id||(e.id=performance.now()),a[e.id]=e,e=e.id);var r;if(!(r=!mag.utils.items.isItem(e))){r=mag.utils.items.getItem(e);var o=i(e);r=!mag.utils.callLCEvent("onreload",mag.mod.getState(r),o,r)}return r&&(r=n.key&&mag.utils.items.isItem(e+"."+n.key)?mag.utils.items.getItem(e+"."+n.key):mag.utils.getItemInstanceId(n.key?e+"."+n.key:e),n.retain||mag.mod.clear(r),mag.mod.submodule(e,r,t,n),o=i(e),v(r,e),!mag.utils.callLCEvent("willload",mag.mod.getState(r),o,r,1))?(mag.redraw(o,r,1),mag.utils.callLCEvent("didload",mag.mod.getState(r),o,r,1),m(r,o,t,mag.utils.copy(n))):void 0};var o=function(e,t){return 0>t||t!=mag.utils.items.getItem(e)?e==mag.mod.getId(t)?!0:!1:!0},d=[];mag.begin=function(e){n===d[e]?d[e]=1:d[e]++},mag.end=function(e){if(1<d[e])d[e]--;else{d[e]=0;var t=mag.utils.items.getItemVal(e);mag.redraw(i(t),e)}};var u=[];mag.redraw=function(e,t,i){if(!d[t]){if(!e||n===t)throw Error("Mag.JS - Id or node invalid: "+mag.utils.items.getItemVal(t));o(e.id,t)&&(i&&mag.fill.configs.splice(0,mag.fill.configs.length),i&&mag.mod.clear(t),e=p(e,t,i),cancelAnimationFrame(u[t]),u[t]=requestAnimationFrame(e))}},mag.hookin=function(e,t,n){r[e].push({context:{},handler:n,key:t})},mag.hook=function(e,t,n){for(var i=0,a=r[e].length;a>i;i++)mag.utils.callHook(r,t,e,i,n)};var l={},c=[],f=function(e,t){mag.utils.onLCEvent("didupdate",e,function(n,r){var a=mag.utils.merge(mag.utils.copy(r),mag.utils.copy(n));JSON.stringify(a)!==JSON.stringify(c[e])&&(t(n,r,i(mag.mod.getId(e)),c[e]),c[e]=a)})},g=[],s=function(e,t,n,i,r){t=mag.utils.items.getItem(t),mag.mod.submodule(e.id,t,i,n),mag.utils.callLCEvent("willgetprops",mag.mod.getState(t),e,t,0,n)||(v(t,e.id),mag.redraw(e,t,r))},m=function(e,t,n,i){g[e]=g[e]||[];var r=function(e,t,n,i,r){if("object"==typeof r&&(i=mag.utils.merge(mag.utils.copy(i)||{},r),r=0),r=t.id+(i.key?"."+i.key:"")+"."+(r||0),t=l[r]=l[r]||t.cloneNode(1),t.id=r,mag.utils.items.isItem(r))return s(t,r,i,n,1),t;var a=mag.utils.getItemInstanceId(t.id);return g[e].push({instanceId:a,subscribe:f.bind({},a)}),s(t,r,i,n,1),t}.bind({},e,t,n,i);return r.clones=function(e){return g[e]}.bind({},e),r.destroy=function(e,t){var n=mag.getNode(mag.mod.getId(e));if(!mag.utils.callLCEvent("onunload",mag.mod.getState(e),n,e)){mag.clear(e);var i,a=0;i=n.id;var o,d=[];for(o in mag.fill.cached)-1<o.indexOf('id("'+i+'")/')&&-1<o.indexOf("-config")&&mag.fill.cached[o].configContext&&d.push({path:o.split("-config")[0],controller:mag.fill.cached[o].configContext,handler:mag.fill.cached[o].configContext.onunload});for(;i=d&&d[a];a++)i.controller.onunload&&(i.handler.call(i.controller,n,i.path),i.controller.onunload=0);r.clones(e).length=0,t&&mag.fill.removeNode(n)}}.bind({},e),r.getId=function(e){return e}.bind({},e),r.draw=function(e,t,n){mag.redraw(e,t,n)}.bind({},t,e),r.getState=function(e,t){return mag.mod.getState(t||e)}.bind({},e),r.getProps=function(e,t){return mag.mod.getProps(t||e)}.bind({},e),r.subscribe=f.bind({},e),r},v=function(e,t){var n=function(e,t){i(t)?mag.redraw(i(t),e):mag.utils.items.isItem(t)&&mag.clear(e)}.bind({},e,t);mag.mod.setFrameId(e,n)};mag.clear=function(e){cancelAnimationFrame(u[e]),mag.utils.items.removeItem(e),mag.mod.clear(e),mag.fill.clearCache(mag.mod.getId(e))};var p=function(e,t,r){return function(e,t,r){if(i(e.id,1),o(e.id,t)&&e){var a=mag.mod.getState(t);if(!mag.utils.callLCEvent("isupdate",a,e,t)){if(mag.mod.iscached(t)&&!r)e=0;else{if(!mag.utils.callLCEvent("willupdate",a,e,t)){mag.mod.callView(e,t),mag.fill.setId(e.id),mag.fill.run(e,a);var d,u=e.id,l=mag.fill.configs;for(d in l)-1<d.indexOf('id("'+u+'")/')&&l[d]();mag.utils.callLCEvent("didupdate",a,e,t),r||mag.mod.iscached(t)}e=n}return e}}}.bind({},e,t,r)};mag.getNode=i}(window||global||this,document),function(e){function t(t,n){var i=t.name;if(void 0===t.object[t.name]){var r,a=e.fill.find(n,i),i="$"===i[0],o=[];return a.reverse().forEach(function(e){e&&(e.value&&0<e.value.length?(r=e.value,!e.type||"checkbox"!=e.type&&"radio"!=e.type||(r={_value:r},e.checked&&(r._checked=!0),o.push(r))):e.innerText&&0<e.innerText.length?r=e.innerText:e.innerHTML&&0<e.innerHTML.length?r=e.innerHTML:e.value||"INPUT"!=e.tagName||(r=""))}),0<o.length&&i?o:r}}function n(n,i){var u;if("undefined"!=typeof Proxy){u=function(n,i,u){var l=JSON.stringify(u.object),c=String(u.name);if(l!==o[i+c]){if(o[i+c]=l,"get"!=u.type||"props"==n||~e.fill.ignorekeys.indexOf(String(u.name))||void 0!==u.oldValue||0!==Object.keys(u.object).length)"set"==u.type&&"props"!=n&&u.object[u.name]&&u.object[u.name].draw&&"function"==typeof u.object[u.name].draw&&(r.innerMods[r.getId(i)]=[u.name,u.object[u.name]]);else if(n=t(u,e.doc.getElementById(r.getId(i))),void 0!==n)return d[i]=0,n;n=r.getFrameId(i),"function"==typeof n&&"set"==u.type&&(cancelAnimationFrame(a[i]),a[i]=requestAnimationFrame(n))}};var l=r.getProps(i),l=e.proxy(l,u.bind({},"props",i));r.setProps(i,l),u=e.proxy({},u.bind({},"state",i)),u=new n(u)}else u=new n({});return u}var i=[],r={innerMods:[],cache:[],getState:function(e){return i[e][1]},setState:function(e,t){i[e][1]=t},getView:function(e){return i[e][0]},getProps:function(e){return i[e][2]},setProps:function(e,t){return i[e][2]=t},remove:function(e){i.splice(e,1)},getId:function(e){return i[e]&&i[e][3]},exists:function(e){return void 0!==i[e]?!0:!1},setFrameId:function(e,t){i[e][4]=t},getFrameId:function(e){return i[e][4]},submodule:function(t,a,o,d){return i[a]?(d.key&&d.key===r.getProps(a).key?r.setProps(a,e.utils.merge(r.getProps(a),d)):r.setProps(a,d),i[a]):(i[a]=[0,0,0,0,0],r.setProps(a,d),d=function(e,t,n){o.view.call(o,t,r.getProps(e),n)}.bind({},a),i[a][0]=d,i[a][3]=t,i[a][1]=n(function(e){return(o.controller||function(){}).call(e,r.getProps(a))||e},a,t),i[a])}},a=[],o=[];r.iscached=function(t){var n=e.utils.merge(e.utils.copy(r.getProps(t)),r.getState(t));return r.cache[t]&&r.cache[t]===JSON.stringify(n)?!0:void(r.cache[t]=JSON.stringify(n))},r.clear=function(e){e>-1&&r.cache[e]&&r.cache.splice(e,1)};var d=[];r.callView=function(t,n){var i=r.getView(n);d[n]||(e.props.attachToArgs(n,r.getState(n),t),d[n]=1),i(r.getState(n),t)},e.mod=r}(mag),function(e){function t(e){for(var t in e)if(e[t]&&-1!==["INPUT","SELECT","TEXTAREA"].indexOf(e[t].tagName))return e[t];return!1}var n={},i=function(t,n){for(var i=1;i<t.length;i+=2){var r=t[i+1];n=e.fill.find(n,t[i]),n=n[r]}return n},r=function(n,r,a,o){return a=(""+a).split("."),3>a.length?(a=parseInt(a.pop()),a=isNaN(a)?0:a,r=e.fill.find(o[a]?o[a]:o,r)):(o=i(a,o),r=e.fill.find(o,r)),(r=t(r))&&!r.eventOnFocus&&(a=-1<["radio","checkbox"].indexOf(r.type),o=function(t,i){this.__magnum__=this.__magnum__||{},this.__magnum__.dirty||(this.__magnum__.dirty=1),i&&(n._checked=this.checked,e.redraw(t,e.utils.items.getItem(t.id),1))}.bind(r,o,a),a?r.addEventListener("click",o,!1):r.addEventListener("focus",o,!1),r.eventOnFocus=1),r},a=function(n,i,a,o){var d=a[i];"_value"===i&&(i=n.split(".").pop());var u=e.fill.find(o,i),u=t(u);if("function"!=typeof d&&u){var l=r.bind({},a,i,n,o);l(),Object.defineProperty(a,i,{configurable:!0,get:function(){var t=l();return t&&"undefined"!==t.value&&t.__magnum__&&t.__magnum__.dirty&&t.value!==d?(d=t.value,e.redraw(o,n,1),t.value):d},set:function(e){var t=l();t&&"undefined"!==t.value&&t.value!==e&&e!==d&&(t.value=e,d=e)}})}},o=function(e,t,n){for(var i in t){var r=t[i];"object"==typeof r?o(e+"."+i,r,n):a.bind({},e,i,t,n)()}};n.attachToArgs=o,e.props=n}(mag),function(e){var t={callHook:function(e,t,n,i,r,a){e[n][i].key==t&&(a={v:r.value,k:r.key},r.change=!1,e[n][i].handler.call(e[n][i].context,r),a!=={v:r.value,k:r.key}&&(r.change=!0))}},n=[];t.onLCEvent=function(e,t,i){n[e+"-"+t]=i},t.callLCEvent=function(t,i,r,a,o,d){var u=!1,l={preventDefault:function(){u=!0}};return i&&i[t]&&(i[t].call(i,l,r,e.mod.getProps(a),a,d),o&&(i[t]=0)),n[t+"-"+a]&&n[t+"-"+a](e.mod.getState(a),e.mod.getProps(a)),u},t.copy=function(e){return Object.assign({},e)},t.merge=function(){return Object.assign.apply({},arguments)};var i={i:[],isItem:function(e){return-1<i.i.indexOf(e)},setItem:function(e){i.i[i.i.length]=e},getItem:function(e){return i.i.indexOf(e)},getItemVal:function(e){return i.i[e]},removeItem:function(e){i.i.splice(i.i.indexOf(e),1)}};t.items=i,t.getItemInstanceIdAll=function(){return i.i},t.getItemInstanceId=function(e){return i.isItem(e)?i.getItem(e):(i.setItem(e),i.getItem(e))},e.utils=t}(mag),function(e,t,n){function i(e){return Array.isArray&&Array.isArray(e)||"[object Array]"==={}.toString.call(e)}function r(e,t){return e[C]=e[C]||{},(!e[C].uid||t)&&(e[C].uid=performance.now()),e[C].uid}function a(e,t){var n=r(e,t);if(O[n])n=O[n];else{var i,a=O,o="";i=d(e);var u=e.parentNode&&[].indexOf.call(e.parentNode.children,e);i&&(o+='id("'+i.id+'")'),i=o+("/"+e.tagName+"["+(u+1)+"]"),n=a[n]=i}return n}function o(e,t,i){return e=r(e,i),S[k.id]=S[k.id]||[],S[k.id][e]&&S[k.id][e]==t?1:(S[k.id][e]=t,n)}function d(e){return e.id?e:e.parentNode?d(e.parentNode):n}function u(t){if(t.id)return'id("'+t.id+'")';if(t===e.doc.body)return t.tagName;var n=0;if(t.parentNode)for(var i=t.parentNode.childNodes,r=0;r<i.length;r++){var a=i[r];if(a===t)return u(t.parentNode)+(t.tagName?"/"+t.tagName+"["+(n+1)+"]":"");1===a.nodeType&&a.tagName===t.tagName&&n++}}function l(t){var n=u(t);t.parentNode.removeChild(t),t&&_[n+"-config"]&&_[n+"-config"].configContext&&typeof _[n+"-config"].configContext.onunload===w&&(_[n+"-config"].configContext.onunload(_[n+"-config"].configContext,t,n),delete _[n+"-config"],delete e.fill.configs[n])}function c(e){return(e=e&&parseInt(e.split("[").pop().slice(0,-1)))?parseInt(e)-1:0}function f(e){return e&&e[C]&&e[C].isChildOfArray?e:e.parentNode?f(e.parentNode):n}function g(t,n,i){if(!o(t,n.outerHTML,i)&&!e.doc.getElementById(n.id)){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(n)}}function s(t,r,a){var d,u=c(a);if(r&&r.nodeType==x)return g(t,r),n;if("function"==typeof r){var l=(d=f(t.parentNode))&&d.getAttribute("key");return d&&l&&(u=+l.split(C)[1]),(l=r(u))&&l.nodeType&&l.nodeType==x?(g(t,l),t[C]=t[C]||{},t[C].isChildOfArray=!0,t[C].dataPass={index:u},r.draw(),n):(r=/<[a-z][\s\S]*>/i.test(l)?"_html":"_text",u={},u[r]=l,s(t,u,a))}if("object"!=typeof r)return s(t,{_text:r},a);e.mod.innerMods[k.id]&&r[e.mod.innerMods[k.id][0]]&&!r[e.mod.innerMods[k.id][0]].draw&&e.mod.innerMods[k.id][1].destroy();for(l in r)u=r[l],u===n?u="":null===u&&-1===["onunload"].indexOf(l)?(t[C].detached=t[C].detached||[],t[C].detached[l]=1,v(t,l)):t[C].detached&&t[C].detached[l]&&(m(t,l),t[C].detached[l]=0),"_"===l[0]&&(d=d||{},d[l.substr(1)]=u);!o(t,JSON.stringify(r))&&d&&y(t,d,a);for(l in r)if(u=r[l],!~k.ignorekeys.indexOf(l)&&"_"!==l[0]){d=N(t,l);var p={key:l,value:u,node:t};e.hook("values","*",p),p.change&&(u=p.value),i(u)&&(d=N(t,"$"+l)),k.run(d,u,a+"/"+l)}}function m(e,t){N(e,t).forEach(function(e){var t=r(e);if(j[t]){for(var n in j[t])e.appendChild(j[t][n]);delete j[t]}})}function v(e,t){N(e,t).forEach(function(e){var t=r(e);for(e.children.length&&(j[t]=p(e.children));e.lastChild;)l(e.lastChild)})}function p(e){var t;if(null==e.length&&(e=[e]),!i(e)){t=[];for(var n=0;n<e.length;n+=1)e[n]&&t.push(e[n]);e=t}return e}function h(t,n,i){return function(t,n,i){var r=f(n),o=r&&u(r),d=c(o),l=a(n),g=c(l),r={path:o,data:((r||{})[C]||[]).dataPass,node:r,index:d},l=l&&-1<l.indexOf("id(")&&l.split('id("')[1].split('")')[0],o=e.doc.getElementById(l);return t=t.call(n,i,g,n,r),e.redraw(o,e.utils.items.getItem(l)),t}.bind({},n[i],t)}function y(n,i,r){var a,o=c(r);for(a in i)if("text"!==a&&"html"!==a)if(0==a.indexOf("on"))n[a.toLowerCase()]=h(n,i,a);else if("config"==a){r=u(n),o=c(r),_[r+"-config"]||(_[r+"-config"]={isNew:!0});var d=_[r+"-config"].configContext=_[r+"-config"].configContext||{};t[r]=function(e,t){return function(){var n=e.apply(e,t);return t[1]&&(_[r+"-config"].isNew=t[1]=0),n}}(i[a],[n,!0,d,o])}else o={key:a,value:i[a],node:n},e.hook("attributes",a,o),o.change&&(a=o.key,i[a]=o.value),null===i[a]?n.removeAttribute(a):(a in n&&(n[a]=i[a]),n.setAttribute(a,""+i[a]));b(n,i.text),I(n,i.html)}function b(e,t){var n,i;if(e&&null!=t){if(!i){i=[];for(var r=0;r<e.childNodes.length;r+=1)n=e.childNodes[r],n.nodeType===x&&i.push(n)}for(;e.lastChild;)e.removeChild(e.lastChild);for("INPUT"===e.nodeName?e.value=""+t:e.appendChild(e.ownerDocument.createTextNode(""+t)),r=0;r<i.length;r+=1)e.appendChild(i[r]);"SELECT"===e.nodeName&&(e.value=""+t)}}function I(e,t){e&&null!=t&&(e.innerHTML=t)}function N(t,n,i){var r=[];if(t){var a=t.childNodes;if(a)for(var o=0;o<a.length;o+=1)a[o].nodeType===x&&r.push(a[o])}var a=[],o=n,d="$"===n[0];"$"===o[0]&&(o=o.substr(1));for(var u=0;u<r.length;u+=1){var l=r[u],c=o,f=" "+l.className+" ";(l.id===c||-1<f.indexOf(" "+c+" ")||l.name===c||l.nodeName.toLowerCase()===c.toLowerCase()||l.getAttribute("data-bind")===c)&&a.push(r[u])}if(!a.length||d)for(u=0;u<r.length&&(a=a.concat(N(r[u],n,!0)),!a.length||d);u++);return i||a.length||(t={key:n,value:a,node:t},e.hook("elementMatcher",n,t),t.change&&(a=t.value)),a}var k={cached:[],ignorekeys:"willgetprops Symbol(Symbol.toStringTag) nodeType toJSON onunload onreload willupdate didupdate didload willload isupdate".split(" ")},x=1,_=k.cached,C="__magnum__",w="function",O=[],S=[],T={};k.run=function(e,t,r){var o,d,u;if(e){null==t&&(t={_text:""});var c=p(e);if(u=i(t)){if(T[r]&&0===c.length&&(T[r].parent.insertAdjacentHTML("beforeend",T[r].node),c=p(T[r].parent.children)),0===c.length)return;for(d=c[0].parentNode,T[r]||(T[r]={node:c[0].cloneNode(1).outerHTML,parent:d});c.length<t.length;)T[r]?(d.insertAdjacentHTML("beforeend",T[r].node),o=d.lastChild):o=c[0].cloneNode(1),c.push(o),d&&d.appendChild(o);if(c.map(function(e){return e.__key}),r=t.map(function(e){return e&&e._key}),(c.length==t.length||-1!==r.indexOf(n))&&(t=t.map(function(e,t){if("object"==typeof e){if(c[t].__key&&void 0===e._key)return e._key=c[t].__key,e;void 0===e._key&&(e._key=C+t),c[t].__key=e._key}return e})),c.length>t.length)if(0===t.length||"object"!=typeof t[0])for(;c.length>t.length;)o=c.pop(),(d=o.parentNode)&&l(o);else var f=[],g=t.map(function(e){return e._key}),c=(c.map(function(e){return e.__key}),c.filter(function(e){return-1===g.indexOf(e.__key)||-1!==f.indexOf(e.__key)?(f.push(e.__key),l(e),!1):(f.push(e.__key),!0)}))}for(r=0;r<c.length;r++)u?c[r]&&k.run(c[r],t[r]):(t&&"object"==typeof t&&-1!==Object.keys(t).indexOf("_key")&&(c[r][C]=c[r][C]||{},c[r][C].isChildOfArray=!0,c[r][C].dataPass=t),o=a(c[r]),s(c[r],t,o));return e}};var j=[];k.removeNode=l,k.configs=t,k.find=N,k.setId=function(e){k.id=e},k.clearCache=function(e){S[e]&&delete S[e]},e.fill=k}(mag,[]),function(e,t){function n(t,n){var i=[];return new Proxy(t,{get:function(t,r){var a=t[r],o=n({type:"get",object:e.utils.copy(t[r]),name:r,oldValue:i[r]});return void 0!==o&&(a=t[r]=o),a},deleteProperty:function(e,t){return n({type:"delete",name:t,object:e,oldValue:i[t]}),delete e[t]},set:function(t,r,a){return i[r]===a?!0:(JSON.stringify(a)!==JSON.stringify(t[r])&&(i[r]=e.utils.copy(t[r])),n({type:"set",name:r,object:t,oldValue:i[r]}),t[r]=a,!0)}})}function i(e,t){for(var i in e)Array.isArray(e[i])&&101>e[i].length&&(e[i]=n(e[i],t));return n(e,t)}e.proxy=function(n,r){return n&&t.Proxy?i(n,function(t){return"object"==typeof t.object[t.name]&&(t.object[t.name]=e.proxy(t.object[t.name],r)),r(t)}):void 0}}(mag,window||global||this);

{'fraction_non_alphanumeric': 0.3416695685206876, 'fraction_numerical': 0.010446674475292033, 'mean_word_length': 14.387238188017536, 'pattern_counts': {'":': 6, '<': 51, '<?xml version=': 0, '>': 21, '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': '2721114', 'n_tokens_mistral': 15274, 'n_tokens_neox': 15360, 'n_words': 517}