More Knockout code to ES6

This commit is contained in:
djmaze 2021-07-29 11:43:47 +02:00
parent b7cb990b00
commit cbecdd93a0
22 changed files with 733 additions and 865 deletions

View file

@ -103,7 +103,7 @@ The result is faster and smaller download code (good for mobile networks).
* Replaced bootstrap.js with native drop-in replacement
* Replaced dev/Common/ClientStorageDriver/* with Web Storage Objects polyfill
* Replaced *Ajax with *Fetch classes because we use the Fetch API, not jQuery.ajax
* Replaced knockoutjs 3.4 with a modified 3.5.1
* Replaced [knockoutjs](https://github.com/knockout/knockout) 3.4 with a modified 3.5.1
* Replaced knockout-sortable with native HTML5 drag&drop
* Replaced simplestatemanager with CSS @media
* Replaced inputosaurus with own code
@ -131,20 +131,20 @@ RainLoop 1.15 vs SnappyMail
|admin.js |2.158.025 | 91.598 |
|app.js |4.215.733 | 454.046 |
|boot.js | 672.433 | 2.861 |
|libs.js | 647.679 | 217.881 |
|libs.js | 647.679 | 217.209 |
|polyfills.js | 325.908 | 0 |
|serviceworker.js | 0 | 285 |
|TOTAL |8.019.778 | 766.671 |
|TOTAL |8.019.778 | 765.999 |
|js/min/* |RainLoop |Snappy |RL gzip |SM gzip |RL brotli |SM brotli |
|--------------- |--------: |--------: |------: |------: |--------: |--------: |
|admin.min.js | 255.514 | 47.631 | 73.899 | 14.320 | 60.674 | 12.796 |
|app.min.js | 516.000 | 233.722 |140.430 | 68.676 |110.657 | 58.037 |
|boot.min.js | 66.456 | 1.621 | 22.553 | 968 | 20.043 | 810 |
|libs.min.js | 574.626 | 106.182 |177.280 | 38.479 |151.855 | 34.497 |
|libs.min.js | 574.626 | 105.538 |177.280 | 38.261 |151.855 | 34.284 |
|polyfills.min.js | 32.608 | 0 | 11.315 | 0 | 10.072 | 0 |
|TOTAL |1.445.204 | 389.156 |425.477 |122.443 |353.301 |106.140 |
|TOTAL (no admin) |1.189.690 | 341.525 |351.061 |108.123 |292.627 | 93.344 |
|TOTAL |1.445.204 | 388.512 |425.477 |122.225 |353.301 |105.927 |
|TOTAL (no admin) |1.189.690 | 340.881 |351.061 |107.905 |292.627 | 93.131 |
For a user its around 68% smaller and faster than traditional RainLoop.
@ -159,7 +159,7 @@ For a user its around 68% smaller and faster than traditional RainLoop.
* Themes work in mobile mode
* Bugfix invalid/conflicting css rules
* Use flexbox
* Split app.css to have seperate admin.css
* Split app.css to have separate admin.css
* Remove oldschool 'float'
* Remove unused css
* Removed html.no-css

View file

@ -97,10 +97,7 @@ module.exports = function(grunt) {
function buildDebug(output) {
var source = [];
source.push(grunt.config('banner'));
source.push('(()=>{\n');
source.push('var DEBUG=true;\n');
source.push(getCombinedSources());
source.push('})();\n');
grunt.file.write(output, source.join('').replace(/\r\n/g, '\n'));
}
@ -138,10 +135,12 @@ module.exports = function(grunt) {
});
grunt.registerMultiTask('test', 'Run tests', function () {
/*
var done = this.async();
grunt.util.spawn({ cmd: this.target, args: [this.data] },
function (error, result, code) {
if (code === 127 /*not found*/) {
if (code === 127) {
// not found
grunt.verbose.error(result.stderr);
// ignore this error
done(true);
@ -153,6 +152,7 @@ module.exports = function(grunt) {
}
}
);
*/
});
grunt.registerMultiTask('testtypes', 'Run types tests', function () {

File diff suppressed because it is too large Load diff

View file

@ -4,80 +4,79 @@
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
(C=>{function F(b,c){return null===b||da[typeof b]?b===c:!1}function E(b,c){var e;return()=>{e||(e=a.a.setTimeout(()=>{e=0;b()},c))}}function J(b,c){var e;return()=>{clearTimeout(e);e=a.a.setTimeout(b,c)}}function S(b,c){null!==c&&c.o&&c.o()}function V(b,c){var e=this.hc,g=e[D];g.$||(this.Ua&&this.ya[c]?(e.wb(c,b,this.ya[c]),this.ya[c]=null,--this.Ua):g.u[c]||e.wb(c,b,g.v?{V:b}:e.Yb(b)),b.ja&&b.bc())}var T=C.document,W={},a="undefined"!==typeof W?W:{};a.m=(b,c)=>{b=b.split(".");for(var e=a,g=0;g<
b.length-1;g++)e=e[b[g]];e[b[b.length-1]]=c};a.Z=(b,c,e)=>{b[c]=e};a.version="3.5.1-sm";a.m("version",a.version);a.a={va:(b,c)=>{c=b.indexOf(c);0<c?b.splice(c,1):0===c&&b.shift()},extend:(b,c)=>{c&&Object.entries(c).forEach(e=>b[e[0]]=e[1]);return b},N:(b,c)=>b&&Object.entries(b).forEach(e=>c(e[0],e[1])),eb:(b,c,e)=>{if(!b)return b;var g={};Object.entries(b).forEach(k=>g[k[0]]=c.call(e,k[1],k[0],b));return g},Ya:b=>{for(;b.firstChild;)a.removeNode(b.firstChild)},Rb:b=>{var c=[...b],e=(c[0]&&c[0].ownerDocument||
T).createElement("div");b.forEach(g=>e.append(a.ea(g)));return e},xa:(b,c)=>Array.prototype.map.call(b,c?e=>a.ea(e.cloneNode(!0)):e=>e.cloneNode(!0)),sa:(b,c)=>{a.a.Ya(b);c&&b.append(...c)},za:(b,c)=>{if(b.length){for(c=8===c.nodeType&&c.parentNode||c;b.length&&b[0].parentNode!==c;)b.splice(0,1);for(;1<b.length&&b[b.length-1].parentNode!==c;)b.length--;if(1<b.length){c=b[0];var e=b[b.length-1];for(b.length=0;c!==e;)b.push(c),c=c.nextSibling;b.push(e)}}return b},Xb:b=>null==b?"":b.trim?b.trim():b.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,
""),Dc:(b,c)=>{b=b||"";return c.length>b.length?!1:b.substring(0,c.length)===c},kc:(b,c)=>c.contains(1!==b.nodeType?b.parentNode:b),Xa:b=>a.a.kc(b,b.ownerDocument.documentElement),Eb:b=>a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b,setTimeout:(b,c)=>setTimeout(a.a.Eb(b),c),Ib:b=>setTimeout(()=>{a.onError&&a.onError(b);throw b;},0),H:(b,c,e)=>{b.addEventListener(c,a.a.Eb(e),!1)},Zb:(b,c)=>{if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");
b.dispatchEvent(new Event(c))},g:b=>a.K(b)?b():b,ib:(b,c)=>b.textContent=a.a.g(c)||""};a.m("utils",a.a);a.m("unwrap",a.a.g);a.a.f=new function(){let b=0,c="__ko__"+Date.now(),e=new WeakMap;return{get:(g,k)=>(e.get(g)||{})[k],set:(g,k,t)=>{if(e.has(g))e.get(g)[k]=t;else{let d={};d[k]=t;e.set(g,d)}return t},$a:function(g,k,t){return this.get(g,k)||this.set(g,k,t)},clear:g=>e.delete(g),X:()=>b++ +c}};a.a.J=(()=>{var b=a.a.f.X(),c={1:!0,8:!0,9:!0},e={1:!0,9:!0};const g=(d,f)=>{var h=a.a.f.get(d,b);void 0===
h&&f&&(h=[],a.a.f.set(d,b,h));return h},k=d=>{var f=g(d,!1);if(f){f=f.slice(0);for(var h=0;h<f.length;h++)f[h](d)}a.a.f.clear(d);e[d.nodeType]&&t(d.childNodes,!0)},t=(d,f)=>{for(var h=[],n,p=0;p<d.length;p++)if(!f||8===d[p].nodeType)if(k(h[h.length]=n=d[p]),d[p]!==n)for(;p--&&!h.includes(d[p]););};return{ma:(d,f)=>{if("function"!=typeof f)throw Error("Callback must be a function");g(d,!0).push(f)},hb:(d,f)=>{var h=g(d,!1);h&&(a.a.va(h,f),h.length||a.a.f.set(d,b,void 0))},ea:d=>{a.i.D(()=>{c[d.nodeType]&&
(k(d),e[d.nodeType]&&t(d.getElementsByTagName("*")))});return d},removeNode:d=>{a.ea(d);d.parentNode&&d.parentNode.removeChild(d)}}})();a.ea=a.a.J.ea;a.removeNode=a.a.J.removeNode;a.m("utils.domNodeDisposal",a.a.J);a.m("utils.domNodeDisposal.addDisposeCallback",a.a.J.ma);a.lb=(()=>{function b(){if(e)for(var d=e,f=0,h;k<e;)if(h=c[k++]){if(k>d){if(5E3<=++f){k=e;a.a.Ib(Error("'Too much recursion' after processing "+f+" task groups."));break}d=e}try{h()}catch(n){a.a.Ib(n)}}k=e=c.length=0}var c=[],e=0,
g=1,k=0,t=(d=>{var f=T.createElement("div");(new MutationObserver(d)).observe(f,{attributes:!0});return()=>f.classList.toggle("foo")})(b);return{Vb:d=>{e||t(b);c[e++]=d;return g++},cancel:d=>{d-=g-e;d>=k&&d<e&&(c[d]=null)}}})();a.m("tasks",a.lb);a.Za={debounce:(b,c)=>b.Ga(e=>J(e,c)),rateLimit:(b,c)=>{if("number"==typeof c)var e=c;else{e=c.timeout;var g=c.method}var k="function"==typeof g?g:E;b.Ga(t=>k(t,e,c))},notify:(b,c)=>{b.equalityComparer="always"==c?null:F}};var da={undefined:1,"boolean":1,
number:1,string:1};a.m("extenders",a.Za);class ea{constructor(b,c,e){this.V=b;this.pb=c;this.Cb=e;this.Ma=!1;this.P=this.Qa=null;a.Z(this,"dispose",this.o);a.Z(this,"disposeWhenNodeIsRemoved",this.j)}o(){this.Ma||(this.P&&a.a.J.hb(this.Qa,this.P),this.Ma=!0,this.Cb(),this.V=this.pb=this.Cb=this.Qa=this.P=null)}j(b){this.Qa=b;a.a.J.ma(b,this.P=this.o.bind(this))}}a.T=function(){Object.setPrototypeOf(this,P);P.Da(this)};var P={Da:b=>{b.U={change:[]};b.vb=1},subscribe:function(b,c,e){var g=this;e=e||
"change";var k=new ea(g,c?b.bind(c):b,()=>{a.a.va(g.U[e],k);g.ua&&g.ua(e)});g.na&&g.na(e);g.U[e]||(g.U[e]=[]);g.U[e].push(k);return k},notifySubscribers:function(b,c){c=c||"change";"change"===c&&this.Ja();if(this.qa(c)){c="change"===c&&this.$b||this.U[c].slice(0);try{a.i.zb();for(var e=0,g;g=c[e++];)g.Ma||g.pb(b)}finally{a.i.end()}}},Ba:function(){return this.vb},pc:function(b){return this.Ba()!==b},Ja:function(){++this.vb},Ga:function(b){var c=this,e=a.K(c),g,k,t,d,f;c.ta||(c.ta=c.notifySubscribers,
c.notifySubscribers=function(n,p){p&&"change"!==p?"beforeChange"===p?this.sb(n):this.ta(n,p):this.tb(n)});var h=b(()=>{c.ja=!1;e&&d===c&&(d=c.qb?c.qb():c());var n=k||f&&c.Fa(t,d);f=k=g=!1;n&&c.ta(t=d)});c.tb=(n,p)=>{p&&c.ja||(f=!p);c.$b=c.U.change.slice(0);c.ja=g=!0;d=n;h()};c.sb=n=>{g||(t=n,c.ta(n,"beforeChange"))};c.ub=()=>{f=!0};c.bc=()=>{c.Fa(t,c.G(!0))&&(k=!0)}},qa:function(b){return this.U[b]&&this.U[b].length},Fa:function(b,c){return!this.equalityComparer||!this.equalityComparer(b,c)},toString:()=>
"[object Object]",extend:function(b){var c=this;b&&a.a.N(b,(e,g)=>{e=a.Za[e];"function"==typeof e&&(c=e(c,g)||c)});return c}};a.Z(P,"init",P.Da);a.Z(P,"subscribe",P.subscribe);a.Z(P,"extend",P.extend);Object.setPrototypeOf(P,Function.prototype);a.T.fn=P;a.sc=b=>null!=b&&"function"==typeof b.subscribe&&"function"==typeof b.notifySubscribers;a.i=(()=>{var b=[],c,e=0;return{zb:g=>{b.push(c);c=g},end:()=>c=b.pop(),Ub:g=>{if(c){if(!a.sc(g))throw Error("Only subscribable things can act as dependencies");
c.dc.call(c.ec,g,g.ac||(g.ac=++e))}},D:(g,k,t)=>{try{return b.push(c),c=void 0,g.apply(k,t||[])}finally{c=b.pop()}},Aa:()=>c&&c.l.Aa(),bb:()=>c&&c.bb,l:()=>c&&c.l}})();const O=Symbol("_latestValue");a.ba=b=>{function c(){if(0<arguments.length)return c.Fa(c[O],arguments[0])&&(c.nb(),c[O]=arguments[0],c.Ka()),this;a.i.Ub(c);return c[O]}c[O]=b;Object.defineProperty(c,"length",{get:()=>null==c[O]?void 0:c[O].length});a.T.fn.Da(c);Object.setPrototypeOf(c,Q);return c};var Q={toJSON:function(){let b=this[O];
return b&&b.toJSON?b.toJSON():b},equalityComparer:F,G:function(){return this[O]},Ka:function(){this.notifySubscribers(this[O],"spectate");this.notifySubscribers(this[O])},nb:function(){this.notifySubscribers(this[O],"beforeChange")}};Object.setPrototypeOf(Q,a.T.fn);var R=a.ba.P="__ko_proto__";Q[R]=a.ba;a.K=b=>{if((b="function"==typeof b&&b[R])&&b!==Q[R]&&b!==a.l.fn[R])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!b};a.uc=b=>"function"==
typeof b&&(b[R]===Q[R]||b[R]===a.l.fn[R]&&b.qc);a.m("observable",a.ba);a.m("isObservable",a.K);a.m("observable.fn",Q);a.Z(Q,"valueHasMutated",Q.Ka);a.ha=b=>{b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");b=a.ba(b);Object.setPrototypeOf(b,a.ha.fn);return b.extend({trackArrayChanges:!0})};a.ha.fn={remove:function(b){for(var c=this.G(),e=[],g="function"!=typeof b||a.K(b)?function(d){return d===
b}:b,k=c.length;k--;){var t=c[k];if(g(t)){0===e.length&&this.nb();if(c[k]!==t)throw Error("Array modified during remove; cannot remove item");e.push(t);c.splice(k,1)}}e.length&&this.Ka();return e}};Object.setPrototypeOf(a.ha.fn,a.ba.fn);Object.getOwnPropertyNames(Array.prototype).forEach(b=>{"function"===typeof Array.prototype[b]&&"constructor"!=b&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(b)?a.ha.fn[b]=function(...c){var e=this.G();this.nb();this.Db(e,b,c);
c=e[b](...c);this.Ka();return c===e?this:c}:a.ha.fn[b]=function(...c){return this()[b](...c)})});a.Ob=b=>a.K(b)&&"function"==typeof b.remove&&"function"==typeof b.push;a.m("observableArray",a.ha);a.m("isObservableArray",a.Ob);a.Za.trackArrayChanges=(b,c)=>{function e(){function q(){if(f){var u=[].concat(b.G()||[]);if(b.qa("arrayChange")){if(!k||1<f)k=a.a.Fb(h,u,b.Sa);var x=k}h=u;k=null;f=0;x&&x.length&&b.notifySubscribers(x,"arrayChange")}}g?q():(g=!0,d=b.subscribe(()=>++f,null,"spectate"),h=[].concat(b.G()||
[]),k=null,t=b.subscribe(q))}b.Sa={};c&&"object"==typeof c&&a.a.extend(b.Sa,c);b.Sa.sparse=!0;if(!b.Db){var g=!1,k=null,t,d,f=0,h,n=b.na,p=b.ua;b.na=q=>{n&&n.call(b,q);"arrayChange"===q&&e()};b.ua=q=>{p&&p.call(b,q);"arrayChange"!==q||b.qa("arrayChange")||(t&&t.o(),d&&d.o(),d=t=null,g=!1,h=void 0)};b.Db=(q,u,x)=>{function l(G,z,M){return m[m.length]={status:G,value:z,index:M}}if(g&&!f){var m=[],r=q.length,v=x.length,y=0;switch(u){case "push":y=r;case "unshift":for(u=0;u<v;u++)l("added",x[u],y+u);
break;case "pop":y=r-1;case "shift":r&&l("deleted",q[y],y);break;case "splice":u=Math.min(Math.max(0,0>x[0]?r+x[0]:x[0]),r);r=1===v?r:Math.min(u+(x[1]||0),r);v=u+v-2;y=Math.max(r,v);for(var w=[],A=[],I=2;u<y;++u,++I)u<r&&A.push(l("deleted",q[u],u)),u<v&&w.push(l("added",x[I],u));a.a.Lb(A,w);break;default:return}k=m}}}};var D=Symbol("_state");a.l=(b,c)=>{function e(){if(0<arguments.length){if("function"===typeof g)g(...arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
return this}k.$||a.i.Ub(e);(k.W||k.v&&e.ra())&&e.S();return k.L}"object"===typeof b?c=b:(c=c||{},b&&(c.read=b));if("function"!=typeof c.read)throw Error("Pass a function that returns the value of the ko.computed");var g=c.write,k={L:void 0,aa:!0,W:!0,Ea:!1,kb:!1,$:!1,gb:!1,v:!1,Tb:c.read,j:c.disposeWhenNodeIsRemoved||c.j||null,oa:c.disposeWhen||c.oa,Wa:null,u:{},I:0,Kb:null};e[D]=k;e.qc="function"===typeof g;a.T.fn.Da(e);Object.setPrototypeOf(e,U);c.pure?(k.gb=!0,k.v=!0,a.a.extend(e,fa)):c.deferEvaluation&&
a.a.extend(e,ha);k.j&&(k.kb=!0,k.j.nodeType||(k.j=null));k.v||c.deferEvaluation||e.S();k.j&&e.ga()&&a.a.J.ma(k.j,k.Wa=()=>{e.o()});return e};var U={equalityComparer:F,Aa:function(){return this[D].I},nc:function(){var b=[];a.a.N(this[D].u,(c,e)=>b[e.ka]=e.V);return b},ab:function(b){if(!this[D].I)return!1;var c=this.nc();return c.includes(b)?!0:!!c.find(e=>e.ab&&e.ab(b))},wb:function(b,c,e){if(this[D].gb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[D].u[b]=e;e.ka=
this[D].I++;e.la=c.Ba()},ra:function(){var b,c=this[D].u;for(b in c)if(Object.prototype.hasOwnProperty.call(c,b)){var e=c[b];if(this.ia&&e.V.ja||e.V.pc(e.la))return!0}},Gc:function(){this.ia&&!this[D].Ea&&this.ia(!1)},ga:function(){var b=this[D];return b.W||0<b.I},Hc:function(){this.ja?this[D].W&&(this[D].aa=!0):this.Jb()},Yb:function(b){return b.subscribe(this.Jb,this)},Jb:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[D].Kb),this[D].Kb=a.a.setTimeout(()=>b.S(!0),c)):b.ia?
b.ia(!0):b.S(!0)},S:function(b){var c=this[D],e=c.oa,g=!1;if(!c.Ea&&!c.$){if(c.j&&!a.a.Xa(c.j)||e&&e()){if(!c.kb){this.o();return}}else c.kb=!1;c.Ea=!0;try{g=this.lc(b)}finally{c.Ea=!1}return g}},lc:function(b){var c=this[D],e=c.gb?void 0:!c.I;var g={hc:this,ya:c.u,Ua:c.I};a.i.zb({ec:g,dc:V,l:this,bb:e});c.u={};c.I=0;a:{try{var k=c.Tb();break a}finally{a.i.end(),g.Ua&&!c.v&&a.a.N(g.ya,S),c.aa=c.W=!1}k=void 0}c.I?g=this.Fa(c.L,k):(this.o(),g=!0);g&&(c.v?this.Ja():this.notifySubscribers(c.L,"beforeChange"),
c.L=k,this.notifySubscribers(c.L,"spectate"),!c.v&&b&&this.notifySubscribers(c.L),this.ub&&this.ub());e&&this.notifySubscribers(c.L,"awake");return g},G:function(b){var c=this[D];(c.W&&(b||!c.I)||c.v&&this.ra())&&this.S();return c.L},Ga:function(b){a.T.fn.Ga.call(this,b);this.qb=function(){this[D].v||(this[D].aa?this.S():this[D].W=!1);return this[D].L};this.ia=function(c){this.sb(this[D].L);this[D].W=!0;c&&(this[D].aa=!0);this.tb(this,!c)}},o:function(){var b=this[D];!b.v&&b.u&&a.a.N(b.u,(c,e)=>e.o&&
e.o());b.j&&b.Wa&&a.a.J.hb(b.j,b.Wa);b.u=void 0;b.I=0;b.$=!0;b.aa=!1;b.W=!1;b.v=!1;b.j=void 0;b.oa=void 0;b.Tb=void 0}},fa={na:function(b){var c=this,e=c[D];if(!e.$&&e.v&&"change"==b){e.v=!1;if(e.aa||c.ra())e.u=null,e.I=0,c.S()&&c.Ja();else{var g=[];a.a.N(e.u,(k,t)=>g[t.ka]=k);g.forEach((k,t)=>{var d=e.u[k],f=c.Yb(d.V);f.ka=t;f.la=d.la;e.u[k]=f});c.ra()&&c.S()&&c.Ja()}e.$||c.notifySubscribers(e.L,"awake")}},ua:function(b){var c=this[D];c.$||"change"!=b||this.qa("change")||(a.a.N(c.u,(e,g)=>{g.o&&
(c.u[e]={V:g.V,ka:g.ka,la:g.la},g.o())}),c.v=!0,this.notifySubscribers(void 0,"asleep"))},Ba:function(){var b=this[D];b.v&&(b.aa||this.ra())&&this.S();return a.T.fn.Ba.call(this)}},ha={na:function(b){"change"!=b&&"beforeChange"!=b||this.G()}};Object.setPrototypeOf(U,a.T.fn);U[a.ba.P]=a.l;a.m("computed",a.l);a.m("computed.fn",U);a.Z(U,"dispose",U.o);a.zc=b=>{if("function"===typeof b)return a.l(b,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.l(b)};(()=>{a.A={O:b=>{switch(b.nodeName){case "OPTION":return!0===
b.__ko__hasDomDataOptionValue__?a.a.f.get(b,a.b.options.fb):b.value;case "SELECT":return 0<=b.selectedIndex?a.A.O(b.options[b.selectedIndex]):void 0;default:return b.value}},La:(b,c,e)=>{switch(b.nodeName){case "OPTION":"string"===typeof c?(a.a.f.set(b,a.b.options.fb,void 0),delete b.__ko__hasDomDataOptionValue__,b.value=c):(a.a.f.set(b,a.b.options.fb,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:"");break;case "SELECT":for(var g=-1,k=""===c||null==c,t=0,d=b.options.length,f;t<
d;++t)if(f=a.A.O(b.options[t]),f==c||""===f&&k){g=t;break}if(e||0<=g||k&&1<b.size)b.selectedIndex=g;break;default:b.value=null==c?"":c}}}})();a.F=(()=>{function b(f){f=a.a.Xb(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],n=f.match(g),p=[],q=0;if(1<n.length){for(var u=0,x;x=n[u];++u){var l=x.charCodeAt(0);if(44===l){if(0>=q){h.push(m&&p.length?{key:m,value:p.join("")}:{unknown:m||p.join("")});var m=q=0;p=[];continue}}else if(58===l){if(!q&&!m&&1===p.length){m=p.pop();continue}}else if(47===
l&&1<x.length&&(47===x.charCodeAt(1)||42===x.charCodeAt(1)))continue;else 47===l&&u&&1<x.length?(l=n[u-1].match(k))&&!t[l[0]]&&(f=f.substr(f.indexOf(x)+1),n=f.match(g),u=-1,x="/"):40===l||123===l||91===l?++q:41===l||125===l||93===l?--q:m||p.length||34!==l&&39!==l||(x=x.slice(1,-1));p.push(x)}if(0<q)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true","false","null","undefined"],e=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,g=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,
k=/[\])"'A-Za-z0-9_$]+$/,t={"in":1,"return":1,"typeof":1},d={};return{Ra:[],mb:d,xc:b,yc:function(f,h){function n(l,m){if(!x){var r=a.getBindingHandler(l);if(r&&r.preprocess&&!(m=r.preprocess(m,l,n)))return;if(r=d[l]){var v=m;c.includes(v)?v=!1:(r=v.match(e),v=null===r?!1:r[1]?"Object("+r[1]+")"+r[2]:v);r=v}r&&q.push("'"+("string"==typeof d[l]?d[l]:l)+"':function(_z){"+v+"=_z}")}u&&(m="function(){return "+m+" }");p.push("'"+l+"':"+m)}h=h||{};var p=[],q=[],u=h.valueAccessors,x=h.bindingParams;("string"===
typeof f?b(f):f).forEach(l=>n(l.key||l.unknown,l.value));q.length&&n("_ko_property_writers","{"+q.join(",")+" }");return p.join(",")},vc:(f,h)=>-1<f.findIndex(n=>n.key==h),ob:(f,h,n,p,q)=>{if(f&&a.K(f))!a.uc(f)||q&&f.G()===p||f(p);else if((f=h.get("_ko_property_writers"))&&f[n])f[n](p)}}})();(()=>{function b(d){return 8==d.nodeType&&g.test(d.nodeValue)}function c(d){return 8==d.nodeType&&k.test(d.nodeValue)}function e(d,f){for(var h=d,n=1,p=[];h=h.nextSibling;){if(c(h)&&(a.a.f.set(h,t,!0),n--,0===
n))return p;p.push(h);b(h)&&n++}if(!f)throw Error("Cannot find closing comment tag to match: "+d.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,t="__ko_matchedEndComment__";a.h={ca:{},childNodes:d=>b(d)?e(d):d.childNodes,pa:d=>{if(b(d)){d=e(d);for(var f=0,h=d.length;f<h;f++)a.removeNode(d[f])}else a.a.Ya(d)},sa:(d,f)=>{if(b(d)){a.h.pa(d);d=d.nextSibling;for(var h=0,n=f.length;h<n;h++)d.parentNode.insertBefore(f[h],d)}else a.a.sa(d,f)},prepend:(d,f)=>{if(b(d)){var h=d.nextSibling;
d=d.parentNode}else h=d.firstChild;d.insertBefore(f,h)},Nb:(d,f,h)=>{h?(h=h.nextSibling,b(d)&&(d=d.parentNode),d.insertBefore(f,h)):a.h.prepend(d,f)},firstChild:d=>{if(b(d))return!d.nextSibling||c(d.nextSibling)?null:d.nextSibling;if(d.firstChild&&c(d.firstChild))throw Error("Found invalid end comment, as the first child of "+d);return d.firstChild},nextSibling:d=>{if(b(d)){var f=e(d,void 0);d=f?0<f.length?f[f.length-1].nextSibling:d.nextSibling:null}if(d.nextSibling&&c(d.nextSibling)){f=d.nextSibling;
if(c(f)&&!a.a.f.get(f,t))throw Error("Found end comment without a matching opening comment, as child of "+d);return null}return d.nextSibling},oc:b,Ec:d=>(d=d.nodeValue.match(g))?d[1]:null}})();(()=>{const b={};a.Bb=new class{wc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return a.h.oc(c);default:return!1}}mc(c,e){a:{switch(c.nodeType){case 1:var g=c.getAttribute("data-bind");break a;case 8:g=a.h.Ec(c);break a}g=null}if(g){var k={valueAccessors:!0};try{var t=g+(k&&
k.valueAccessors||""),d;if(!(d=b[t])){var f="with($context){with($data||{}){return{"+a.F.yc(g,k)+"}}}";var h=new Function("$context","$element",f);d=b[t]=h}var n=d(e,c)}catch(p){throw p.message="Unable to parse bindings.\nBindings value: "+g+"\nMessage: "+p.message,p;}}else n=null;return n}}})();(()=>{function b(l){var m=(l=a.a.f.get(l,x))&&l.C;m&&(l.C=null,m.Sb())}function c(l,m,r){this.node=l;this.Ab=m;this.wa=[];this.B=!1;m.C||a.a.J.ma(l,b);r&&r.C&&(r.C.wa.push(l),this.Na=r)}function e(l){return a.a.eb(a.i.D(l),
(m,r)=>()=>l()[r])}function g(l,m,r){return"function"===typeof l?e(l.bind(null,m,r)):a.a.eb(l,v=>()=>v)}function k(l,m){var r=a.h.firstChild(m);if(r)for(var v;v=r;)r=a.h.nextSibling(v),t(l,v);a.c.notify(m,a.c.B)}function t(l,m){var r=l;if(1===m.nodeType||a.Bb.wc(m))r=f(m,null,l).bindingContextForDescendants;r&&m.matches&&!m.matches("SCRIPT,TEXTAREA,TEMPLATE")&&k(r,m)}function d(l){var m=[],r={},v=[];a.a.N(l,function A(w){if(!r[w]){var I=a.getBindingHandler(w);I&&(I.after&&(v.push(w),I.after.forEach(G=>
{if(l[G]){if(v.includes(G))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+v.join(", "));A(G)}}),v.length--),m.push({key:w,Mb:I}));r[w]=!0}});return m}function f(l,m,r){var v=a.a.f.$a(l,x,{}),y=v.cc;if(!m){if(y)throw Error("You cannot apply bindings multiple times to the same element.");v.cc=!0}y||(v.context=r);v.cb||(v.cb={});if(m&&"function"!==typeof m)var w=m;else{var A=a.l(()=>{if(w=m?m(r,l):a.Bb.mc(l,r)){if(r[n])r[n]();if(r[q])r[q]()}return w},{j:l});
w&&A.ga()||(A=null)}var I=r,G;if(w){var z=A?B=>()=>A()[B]():B=>w[B];function M(){return a.a.eb(A?A():w,B=>B())}M.get=B=>w[B]&&z(B)();M.has=B=>B in w;a.c.B in w&&a.c.subscribe(l,a.c.B,()=>{var B=w[a.c.B]();if(B){var H=a.h.childNodes(l);H.length&&B(H,a.Hb(H[0]))}});a.c.Y in w&&(I=a.c.jb(l,r),a.c.subscribe(l,a.c.Y,()=>{var B=w[a.c.Y]();B&&a.h.firstChild(l)&&B(l)}));d(w).forEach(B=>{var H=B.Mb.init,L=B.Mb.update,K=B.key;if(8===l.nodeType&&!a.h.ca[K])throw Error("The binding '"+K+"' cannot be used with virtual elements");
try{"function"==typeof H&&a.i.D(()=>{var N=H(l,z(K),M,I.$data,I);if(N&&N.controlsDescendantBindings){if(void 0!==G)throw Error("Multiple bindings ("+G+" and "+K+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");G=K}}),"function"==typeof L&&a.l(()=>L(l,z(K),M,I.$data,I),{j:l})}catch(N){throw N.message='Unable to process binding "'+K+": "+w[K]+'"\nMessage: '+N.message,N;}})}v=void 0===G;return{shouldBindDescendants:v,bindingContextForDescendants:v&&
I}}function h(l,m){return l&&l instanceof a.R?l:new a.R(l,void 0,void 0,m)}var n=Symbol("_subscribable"),p=Symbol("_ancestorBindingInfo"),q=Symbol("_dataDependency");a.b={};a.getBindingHandler=l=>a.b[l];var u={};a.R=function(l,m,r,v,y){function w(){var H=z?G():G,L=a.a.g(H);m?(a.a.extend(A,m),p in m&&(A[p]=m[p])):(A.$parents=[],A.$root=L,A.ko=a);A[n]=B;I?L=A.$data:(A.$rawData=H,A.$data=L);r&&(A[r]=L);v&&v(A,m,L);if(m&&m[n]&&!a.i.l().ab(m[n]))m[n]();M&&(A[q]=M);return A.$data}var A=this,I=l===u,G=I?
void 0:l,z="function"==typeof G&&!a.K(G),M=y&&y.dataDependency;if(y&&y.exportDependencies)w();else{var B=a.zc(w);B.G();B.ga()?B.equalityComparer=null:A[n]=void 0}};a.R.prototype.createChildContext=function(l,m,r,v){!v&&m&&"object"==typeof m&&(v=m,m=v.as,r=v.extend);if(m&&v&&v.noChildContext){var y="function"==typeof l&&!a.K(l);return new a.R(u,this,null,w=>{r&&r(w);w[m]=y?l():l},v)}return new a.R(l,this,m,(w,A)=>{w.$parentContext=A;w.$parent=A.$data;w.$parents=(A.$parents||[]).slice(0);w.$parents.unshift(w.$parent);
r&&r(w)},v)};a.R.prototype.extend=function(l,m){return new a.R(u,this,null,r=>a.a.extend(r,"function"==typeof l?l(r):l),m)};var x=a.a.f.X();c.prototype.Sb=function(){this.Na&&this.Na.C&&this.Na.C.jc(this.node)};c.prototype.jc=function(l){a.a.va(this.wa,l);!this.wa.length&&this.B&&this.Gb()};c.prototype.Gb=function(){this.B=!0;this.Ab.C&&!this.wa.length&&(this.Ab.C=null,a.a.J.hb(this.node,b),a.c.notify(this.node,a.c.Y),this.Sb())};a.c={B:"childrenComplete",Y:"descendantsComplete",subscribe:(l,m,r,
v,y)=>{var w=a.a.f.$a(l,x,{});w.fa||(w.fa=new a.T);y&&y.notifyImmediately&&w.cb[m]&&a.i.D(r,v,[l]);return w.fa.subscribe(r,v,m)},notify:(l,m)=>{var r=a.a.f.get(l,x);if(r&&(r.cb[m]=!0,r.fa&&r.fa.notifySubscribers(l,m),m==a.c.B))if(r.C)r.C.Gb();else if(void 0===r.C&&r.fa&&r.fa.qa(a.c.Y))throw Error("descendantsComplete event not supported for bindings on this node");},jb:(l,m)=>{var r=a.a.f.$a(l,x,{});r.C||(r.C=new c(l,r,m[p]));return m[p]==r?m:m.extend(v=>{v[p]=r})}};a.Cc=l=>(l=a.a.f.get(l,x))&&l.context;
a.Pa=(l,m,r)=>f(l,m,h(r));a.Fc=(l,m,r)=>{r=h(r);return a.Pa(l,g(m,r,l),r)};a.yb=(l,m)=>{1!==m.nodeType&&8!==m.nodeType||k(h(l),m)};a.xb=function(l,m,r){if(2>arguments.length){if(m=T.body,!m)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!m||1!==m.nodeType&&8!==m.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");t(h(l,r),m)};a.Hb=l=>(l=l&&[1,8].includes(l.nodeType)&&a.Cc(l))?
l.$data:void 0;a.m("bindingHandlers",a.b);a.m("applyBindings",a.xb);a.m("applyBindingAccessorsToNode",a.Pa);a.m("dataFor",a.Hb)})();(()=>{function b(d,f){return Object.prototype.hasOwnProperty.call(d,f)?d[f]:void 0}function c(d,f){var h=b(k,d);if(h)h.subscribe(f);else{h=k[d]=new a.T;h.subscribe(f);e(d,(p,q)=>{q=!(!q||!q.synchronous);t[d]={definition:p,tc:q};delete k[d];n||q?h.notifySubscribers(p):a.lb.Vb(()=>h.notifySubscribers(p))});var n=!0}}function e(d,f){g("getConfig",[d],h=>{h?g("loadComponent",
[d,h],n=>f(n,h)):f(null,null)})}function g(d,f,h,n){n||(n=a.s.loaders.slice(0));var p=n.shift();if(p){var q=p[d];if(q){var u=!1;if(void 0!==q.apply(p,f.concat(function(x){u?h(null):null!==x?h(x):g(d,f,h,n)}))&&(u=!0,!p.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else g(d,f,h,n)}else h(null)}var k={},t={};a.s={get:(d,f)=>{var h=b(t,d);h?h.tc?a.i.D(()=>f(h.definition)):a.lb.Vb(()=>f(h.definition)):c(d,
f)},fc:d=>delete t[d],rb:g};a.s.loaders=[];a.m("components",a.s)})();(()=>{function b(d,f,h,n){var p={},q=2;f=h.template;h=h.viewModel;f?a.s.rb("loadTemplate",[d,f],u=>{p.template=u;0===--q&&n(p)}):0===--q&&n(p);h?a.s.rb("loadViewModel",[d,h],u=>{p[t]=u;0===--q&&n(p)}):0===--q&&n(p)}function c(d,f,h){if("function"===typeof f)h(p=>new f(p));else if("function"===typeof f[t])h(f[t]);else if("instance"in f){var n=f.instance;h(()=>n)}else"viewModel"in f?c(d,f.viewModel,h):d("Unknown viewModel value: "+
f)}function e(d){if(d.matches("TEMPLATE")&&d.content instanceof DocumentFragment)return a.a.xa(d.content.childNodes);throw"Template Source Element not a <template>";}function g(d){return f=>{throw Error("Component '"+d+"': "+f);}}var k={};a.s.register=(d,f)=>{if(!f)throw Error("Invalid configuration for "+d);if(a.s.Pb(d))throw Error("Component "+d+" is already registered");k[d]=f};a.s.Pb=d=>Object.prototype.hasOwnProperty.call(k,d);a.s.unregister=d=>{delete k[d];a.s.fc(d)};a.s.ic={getConfig:(d,f)=>
{d=a.s.Pb(d)?k[d]:null;f(d)},loadComponent:(d,f,h)=>{var n=g(d);b(d,n,f,h)},loadTemplate:(d,f,h)=>{d=g(d);if(f instanceof Array)h(f);else if(f instanceof DocumentFragment)h([...f.childNodes]);else if(f.element)if(f=f.element,f instanceof HTMLElement)h(e(f));else if("string"===typeof f){var n=T.getElementById(f);n?h(e(n)):d("Cannot find element with ID "+f)}else d("Unknown element type: "+f);else d("Unknown template value: "+f)},loadViewModel:(d,f,h)=>c(g(d),f,h)};var t="createViewModel";a.m("components.register",
a.s.register);a.s.loaders.push(a.s.ic)})();(()=>{function b(g,k,t){k=k.template;if(!k)throw Error("Component '"+g+"' has no template");g=a.a.xa(k);a.h.sa(t,g)}function c(g,k,t){var d=g.createViewModel;return d?d.call(g,k,t):k}var e=0;a.b.component={init:(g,k,t,d,f)=>{var h,n,p,q=()=>{var x=h&&h.dispose;"function"===typeof x&&x.call(h);p&&p.o();n=h=p=null},u=[...a.h.childNodes(g)];a.h.pa(g);a.a.J.ma(g,q);a.l(()=>{var x=a.a.g(k());if("string"===typeof x)var l=x;else{l=a.a.g(x.name);var m=a.a.g(x.params)}if(!l)throw Error("No component name specified");
var r=a.c.jb(g,f),v=n=++e;a.s.get(l,y=>{if(n===v){q();if(!y)throw Error("Unknown component '"+l+"'");b(l,y,g);var w=c(y,m,{element:g,templateNodes:u});y=r.createChildContext(w,{extend:A=>{A.$component=w;A.$componentTemplateNodes=u}});w&&w.koDescendantsComplete&&(p=a.c.subscribe(g,a.c.Y,w.koDescendantsComplete,w));h=w;a.yb(y,g)}})},{j:g});return{controlsDescendantBindings:!0}}};a.h.ca.component=!0})();a.b.attr={update:(b,c)=>{c=a.a.g(c())||{};a.a.N(c,function(e,g){g=a.a.g(g);var k=e.indexOf(":");k=
"lookupNamespaceURI"in b&&0<k&&b.lookupNamespaceURI(e.substr(0,k));var t=!1===g||null===g||void 0===g;t?k?b.removeAttributeNS(k,e):b.removeAttribute(e):g=g.toString();t||(k?b.setAttributeNS(k,e,g):b.setAttribute(e,g));"name"===e&&(b.name=t?"":g)})}};var X=(b,c,e)=>{c&&c.split(/\s+/).forEach(g=>b.classList.toggle(g,e))};a.b.css={update:(b,c)=>{c=a.a.g(c());null!==c&&"object"==typeof c?a.a.N(c,(e,g)=>{g=a.a.g(g);X(b,e,!!g)}):(c=a.a.Xb(c),X(b,b.__ko__cssValue,!1),b.__ko__cssValue=c,X(b,c,!0))}};a.b.enable=
{update:(b,c)=>{(c=a.a.g(c()))&&b.disabled?b.removeAttribute("disabled"):c||b.disabled||(b.disabled=!0)}};a.b.disable={update:(b,c)=>a.b.enable.update(b,()=>!a.a.g(c()))};a.b.event={init:(b,c,e,g,k)=>{var t=c()||{};a.a.N(t,d=>{"string"==typeof d&&a.a.H(b,d,function(f){var h=c()[d];if(h){try{g=k.$data;var n=h.apply(g,[g,...arguments])}finally{!0!==n&&f.preventDefault()}!1===e.get(d+"Bubble")&&(f.cancelBubble=!0,f.stopPropagation())}})})}};a.b.foreach={Qb:b=>()=>{var c=b(),e=a.K(c)?c.G():c;if(!e||"number"==
typeof e.length)return{foreach:c};a.a.g(c);return{foreach:e.data,as:e.as,noChildContext:e.noChildContext,includeDestroyed:e.includeDestroyed,afterAdd:e.afterAdd,beforeRemove:e.beforeRemove,afterRender:e.afterRender,beforeMove:e.beforeMove,afterMove:e.afterMove}},init:(b,c)=>a.b.template.init(b,a.b.foreach.Qb(c)),update:(b,c,e,g,k)=>a.b.template.update(b,a.b.foreach.Qb(c),e,g,k)};a.F.Ra.foreach=!1;a.h.ca.foreach=!0;a.b.hasfocus={init:(b,c,e)=>{var g=t=>{b.__ko_hasfocusUpdating=!0;t=b.ownerDocument.activeElement===
b;var d=c();a.F.ob(d,e,"hasfocus",t,!0);b.__ko_hasfocusLastValue=t;b.__ko_hasfocusUpdating=!1},k=g.bind(null,!0);g=g.bind(null,!1);a.a.H(b,"focus",k);a.a.H(b,"focusin",k);a.a.H(b,"blur",g);a.a.H(b,"focusout",g);b.__ko_hasfocusLastValue=!1},update:(b,c)=>{c=!!a.a.g(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===c||(c?b.focus():b.blur())}};a.F.mb.hasfocus=!0;a.b.html={init:()=>({controlsDescendantBindings:!0}),update:(b,c)=>{a.a.Ya(b);c=a.a.g(c());if(null!=c){const e=T.createElement("template");
e.innerHTML="string"!=typeof c?c.toString():c;b.appendChild(e.content)}}};(function(){function b(c,e,g){a.b[c]={init:(k,t,d,f,h)=>{var n,p,q={},u;if(e){f=d.get("as");var x=d.get("noChildContext");var l=!(f&&x);q={as:f,noChildContext:x,exportDependencies:l}}var m=(u="render"==d.get("completeOn"))||d.has(a.c.Y);a.l(()=>{var r=a.a.g(t()),v=!g!==!r,y=!p;if(l||v!==n){m&&(h=a.c.jb(k,h));if(v){if(!e||l)q.dataDependency=a.i.l();var w=e?h.createChildContext("function"==typeof r?r:t,q):a.i.Aa()?h.extend(null,
q):h}y&&a.i.Aa()&&(p=a.a.xa(a.h.childNodes(k),!0));v?(y||a.h.sa(k,a.a.xa(p)),a.yb(w,k)):(a.h.pa(k),u||a.c.notify(k,a.c.B));n=v}},{j:k});return{controlsDescendantBindings:!0}}};a.F.Ra[c]=!1;a.h.ca[c]=!0}b("if");b("ifnot",!1,!0);b("with",!0)})();var Y={};a.b.options={init:b=>{if(!b.matches("SELECT"))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:(b,c,e)=>{function g(){return Array.from(b.options).filter(l=>l.selected)}
function k(l,m,r){var v=typeof m;return"function"==v?m(l):"string"==v?l[m]:r}function t(l,m){u&&n?a.c.notify(b,a.c.B):p.length&&(l=p.includes(a.A.O(m[0])),m[0].selected=l,u&&!l&&a.i.D(a.a.Zb,null,[b,"change"]))}var d=b.multiple,f=0!=b.length&&d?b.scrollTop:null,h=a.a.g(c()),n=e.get("valueAllowUnset")&&e.has("value");c={};var p=[];n||(d?p=g().map(a.A.O):0<=b.selectedIndex&&p.push(a.A.O(b.options[b.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var q=h.filter(l=>l||null==l);e.has("optionsCaption")&&
(h=a.a.g(e.get("optionsCaption")),null!==h&&void 0!==h&&q.unshift(Y))}var u=!1;c.beforeRemove=l=>b.removeChild(l);h=t;e.has("optionsAfterRender")&&"function"==typeof e.get("optionsAfterRender")&&(h=(l,m)=>{t(l,m);a.i.D(e.get("optionsAfterRender"),null,[m[0],l!==Y?l:void 0])});a.a.Wb(b,q,function(l,m,r){r.length&&(p=!n&&r[0].selected?[a.A.O(r[0])]:[],u=!0);m=b.ownerDocument.createElement("option");l===Y?(a.a.ib(m,e.get("optionsCaption")),a.A.La(m,void 0)):(r=k(l,e.get("optionsValue"),l),a.A.La(m,a.a.g(r)),
l=k(l,e.get("optionsText"),r),a.a.ib(m,l));return[m]},c,h);if(!n){var x;d?x=p.length&&g().length<p.length:x=p.length&&0<=b.selectedIndex?a.A.O(b.options[b.selectedIndex])!==p[0]:p.length||0<=b.selectedIndex;x&&a.i.D(a.a.Zb,null,[b,"change"])}(n||a.i.bb())&&a.c.notify(b,a.c.B);f&&20<Math.abs(f-b.scrollTop)&&(b.scrollTop=f)}};a.b.options.fb=a.a.f.X();a.b.style={update:(b,c)=>{c=a.a.g(c()||{});a.a.N(c,(e,g)=>{g=a.a.g(g);if(null===g||void 0===g||!1===g)g="";if(/^--/.test(e))b.style.setProperty(e,g);else{e=
e.replace(/-(\w)/g,(t,d)=>d.toUpperCase());var k=b.style[e];b.style[e]=g;g===k||b.style[e]!=k||isNaN(g)||(b.style[e]=g+"px")}})}};a.b.submit={init:(b,c,e,g,k)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.H(b,"submit",t=>{var d=c();try{var f=d.call(k.$data,b)}finally{!0!==f&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}})}};a.b.text={init:()=>({controlsDescendantBindings:!0}),update:(b,c)=>a.a.ib(b,c())};a.h.ca.text=!0;a.b.textInput={init:(b,
c,e)=>{var g=b.value,k,t,d=()=>{clearTimeout(k);t=k=void 0;var h=b.value;g!==h&&(g=h,a.F.ob(c(),e,"textInput",h))},f=()=>{var h=a.a.g(c());if(null===h||void 0===h)h="";void 0!==t&&h===t?a.a.setTimeout(f,4):b.value!==h&&(b.value=h,g=b.value)};a.a.H(b,"input",d);a.a.H(b,"change",d);a.a.H(b,"blur",d);a.l(f,{j:b})}};a.F.mb.textInput=!0;a.b.textinput={preprocess:(b,c,e)=>e("textInput",b)};a.b.value={init:(b,c,e)=>{var g=b.matches("SELECT"),k=b.matches("INPUT");if(!k||"checkbox"!=b.type&&"radio"!=b.type){var t=
[],d=e.get("valueUpdate"),f=null;d&&("string"==typeof d?t=[d]:t=d?d.filter((q,u)=>d.indexOf(q)===u):[],a.a.va(t,"change"));var h=()=>{f=null;var q=c(),u=a.A.O(b);a.F.ob(q,e,"value",u)};t.forEach(q=>{var u=h;a.a.Dc(q,"after")&&(u=()=>{f=a.A.O(b);a.a.setTimeout(h,0)},q=q.substring(5));a.a.H(b,q,u)});var n=k&&"file"==b.type?()=>{var q=a.a.g(c());null===q||void 0===q||""===q?b.value="":a.i.D(h)}:()=>{var q=a.a.g(c()),u=a.A.O(b);if(null!==f&&q===f)a.a.setTimeout(n,0);else if(q!==u||void 0===u)g?(u=e.get("valueAllowUnset"),
a.A.La(b,q,u),u||q===a.A.O(b)||a.i.D(h)):a.A.La(b,q)};if(g){var p;a.c.subscribe(b,a.c.B,()=>{p?e.get("valueAllowUnset")?n():h():(a.a.H(b,"change",h),p=a.l(n,{j:b}))},null,{notifyImmediately:!0})}else a.a.H(b,"change",h),a.l(n,{j:b})}else a.Pa(b,{checkedValue:c})},update:()=>{}};a.F.mb.value=!0;a.b.visible={update:(b,c)=>{c=a.a.g(c());var e="none"!=b.style.display;c&&!e?b.style.display="":e&&!c&&(b.style.display="none")}};a.b.hidden={update:(b,c)=>b.hidden=!!a.a.g(c())};(function(b){a.b[b]={init:function(c,
e,g,k,t){return a.b.event.init.call(this,c,()=>({[b]:e()}),g,k,t)}}})("click");(()=>{let b=a.a.f.X();class c{constructor(g){this.Va=g}Ha(...g){let k=this.Va;if(!g.length)return a.a.f.get(k,b)||(11===this.P?k.content:1===this.P?k:void 0);a.a.f.set(k,b,g[0])}}class e extends c{constructor(g){super(g);g&&(this.P=g.matches("TEMPLATE")&&g.content?g.content.nodeType:1)}}a.Ia={Va:e,Oa:c}})();(()=>{function b(d,f){if(d.length){var h=d[0],n=h.parentNode;g(h,d[d.length-1],p=>{1!==p.nodeType&&8!==p.nodeType||
a.xb(f,p)});a.a.za(d,n)}}function c(d,f,h,n,p){p=p||{};var q=(d&&(d.nodeType?d:0<d.length?d[0]:null)||h||{}).ownerDocument;if("string"==typeof h){q=q||T;q=q.getElementById(h);if(!q)throw Error("Cannot find template with ID "+h);h=new a.Ia.Va(q)}else if([1,8].includes(h.nodeType))h=new a.Ia.Oa(h);else throw Error("Unknown template type: "+h);h=(h=h.Ha?h.Ha():null)?[...h.cloneNode(!0).childNodes]:null;if("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)throw Error("Template engine must return an array of DOM nodes");
q=!1;switch(f){case "replaceChildren":a.h.sa(d,h);q=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+f);}q&&(b(h,n),p.afterRender&&a.i.D(p.afterRender,null,[h,n[p.as||"$data"]]),"replaceChildren"==f&&a.c.notify(d,a.c.B));return h}function e(d,f,h){return a.K(d)?d():"function"===typeof d?d(f,h):d}var g=(d,f,h)=>{var n;for(f=a.h.nextSibling(f);d&&(n=d)!==f;)d=a.h.nextSibling(n),h(n,d)};a.Ac=function(d,f,h,n){h=h||{};var p=p||"replaceChildren";if(n){var q=n.nodeType?
n:0<n.length?n[0]:null;return a.l(()=>{var u=f&&f instanceof a.R?f:new a.R(f,null,null,null,{exportDependencies:!0}),x=e(d,u.$data,u);c(n,p,x,u,h)},{oa:()=>!q||!a.a.Xa(q),j:q})}console.log("no targetNodeOrNodeArray")};a.Bc=(d,f,h,n,p)=>{function q(y,w){a.i.D(a.a.Wb,null,[n,y,l,h,m,w]);a.c.notify(n,a.c.B)}var u,x=h.as,l=(y,w)=>{u=p.createChildContext(y,{as:x,noChildContext:h.noChildContext,extend:A=>{A.$index=w;x&&(A[x+"Index"]=w)}});y=e(d,y,u);return c(n,"ignoreTargetNode",y,u,h)},m=(y,w)=>{b(w,u);
h.afterRender&&h.afterRender(w,y);u=null},r=!1===h.includeDestroyed;if(r||h.beforeRemove||!a.Ob(f))return a.l(()=>{var y=a.a.g(f)||[];"undefined"==typeof y.length&&(y=[y]);r&&(y=y.filter(w=>w||null==w));q(y)},{j:n});q(f.G());var v=f.subscribe(y=>{q(f(),y)},null,"arrayChange");v.j(n);return v};var k=a.a.f.X(),t=a.a.f.X();a.b.template={init:(d,f)=>{f=a.a.g(f());if("string"==typeof f||"name"in f)a.h.pa(d);else if("nodes"in f){f=f.nodes||[];if(a.K(f))throw Error('The "nodes" option must be a plain, non-observable array.');
let h=f[0]&&f[0].parentNode;h&&a.a.f.get(h,t)||(h=a.a.Rb(f),a.a.f.set(h,t,!0));(new a.Ia.Oa(d)).Ha(h)}else if(f=a.h.childNodes(d),0<f.length)f=a.a.Rb(f),(new a.Ia.Oa(d)).Ha(f);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:(d,f,h,n,p)=>{var q=f();f=a.a.g(q);h=!0;n=null;"string"==typeof f?f={}:(q="name"in f?f.name:d,"if"in f&&(h=a.a.g(f["if"])),h&&"ifnot"in f&&(h=!a.a.g(f.ifnot)),h&&!q&&(h=!1));"foreach"in f?n=a.Bc(q,
h&&f.foreach||[],f,d,p):h?(h=p,"data"in f&&(h=p.createChildContext(f.data,{as:f.as,noChildContext:f.noChildContext,exportDependencies:!0})),n=a.Ac(q,h,f,d)):a.h.pa(d);p=n;(f=a.a.f.get(d,k))&&"function"==typeof f.o&&f.o();a.a.f.set(d,k,!p||p.ga&&!p.ga()?void 0:p)}};a.F.Ra.template=d=>{d=a.F.xc(d);return 1==d.length&&d[0].unknown||a.F.vc(d,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.h.ca.template=!0})();a.a.Lb=(b,c,e)=>{if(b.length&&c.length){var g,
k,t,d,f;for(g=k=0;(!e||g<e)&&(d=b[k]);++k){for(t=0;f=c[t];++t)if(d.value===f.value){d.moved=f.index;f.moved=d.index;c.splice(t,1);g=t=0;break}g+=t}}};a.a.Fb=(()=>{function b(c,e,g,k,t){var d=Math.min,f=Math.max,h=[],n,p=c.length,q,u=e.length,x=u-p||1,l=p+u+1,m;for(n=0;n<=p;n++){var r=m;h.push(m=[]);var v=d(u,n+x);for(q=f(0,n-1);q<=v;q++)m[q]=q?n?c[n-1]===e[q-1]?r[q-1]:d(r[q]||l,m[q-1]||l)+1:q+1:n+1}d=[];f=[];x=[];n=p;for(q=u;n||q;)u=h[n][q]-1,q&&u===h[n][q-1]?f.push(d[d.length]={status:g,value:e[--q],
index:q}):n&&u===h[n-1][q]?x.push(d[d.length]={status:k,value:c[--n],index:n}):(--q,--n,t.sparse||d.push({status:"retained",value:e[q]}));a.a.Lb(x,f,!t.dontLimitMoves&&10*p);return d.reverse()}return function(c,e,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];e=e||[];return c.length<e.length?b(c,e,"added","deleted",g):b(e,c,"deleted","added",g)}})();(()=>{function b(g,k,t,d,f){var h=[],n=a.l(()=>{var p=k(t,f,a.a.za(h,g))||[];if(0<h.length){var q=h.nodeType?[h]:h;if(0<q.length){var u=q[0],
x=u.parentNode,l;var m=0;for(l=p.length;m<l;m++)x.insertBefore(p[m],u);m=0;for(l=q.length;m<l;m++)a.removeNode(q[m])}d&&a.i.D(d,null,[t,p,f])}h.length=0;h.push(...p)},{j:g,oa:()=>!!h.find(a.a.Xa)});return{M:h,Ta:n.ga()?n:void 0}}var c=a.a.f.X(),e=a.a.f.X();a.a.Wb=(g,k,t,d,f,h)=>{function n(H){z={da:H,Ca:a.ba(r++)};l.push(z);x||I.push(z)}function p(H){z=u[H];r!==z.Ca.G()&&A.push(z);z.Ca(r++);a.a.za(z.M,g);l.push(z)}function q(H,L){if(H)for(var K=0,N=L.length;K<N;K++)L[K].M.forEach(ia=>H(ia,K,L[K].da))}
k=k||[];"undefined"==typeof k.length&&(k=[k]);d=d||{};var u=a.a.f.get(g,c),x=!u,l=[],m=0,r=0,v=[],y=[],w=[],A=[],I=[],G=0;if(x)k.forEach(n);else{if(!h||u&&u._countWaitingForRemove)h=Array.prototype.map.call(u,H=>H.da),h=a.a.Fb(h,k,{dontLimitMoves:d.dontLimitMoves,sparse:!0});for(let H=0,L,K,N;L=h[H];H++)switch(K=L.moved,N=L.index,L.status){case "deleted":for(;m<N;)p(m++);if(void 0===K){var z=u[m];z.Ta&&(z.Ta.o(),z.Ta=void 0);a.a.za(z.M,g).length&&(d.beforeRemove&&(l.push(z),G++,z.da===e?z=null:w.push(z)),
z&&v.push.apply(v,z.M))}m++;break;case "added":for(;r<N;)p(m++);void 0!==K?(y.push(l.length),p(K)):n(L.value)}for(;r<k.length;)p(m++);l._countWaitingForRemove=G}a.a.f.set(g,c,l);q(d.beforeMove,A);v.forEach(d.beforeRemove?a.ea:a.removeNode);var M,B;G=g.ownerDocument.activeElement;if(y.length)for(;void 0!=(k=y.shift());){z=l[k];for(M=void 0;k;)if((B=l[--k].M)&&B.length){M=B[B.length-1];break}for(m=0;v=z.M[m];M=v,m++)a.h.Nb(g,v,M)}for(k=0;z=l[k];k++){z.M||a.a.extend(z,b(g,t,z.da,f,z.Ca));for(m=0;v=z.M[m];M=
v,m++)a.h.Nb(g,v,M);!z.rc&&f&&(f(z.da,z.M,z.Ca),z.rc=!0,M=z.M[z.M.length-1])}G&&g.ownerDocument.activeElement!=G&&G.focus();q(d.beforeRemove,w);for(k=0;k<w.length;++k)w[k].da=e;q(d.afterMove,A);q(d.afterAdd,I)}})();C.ko=W})(this);
(C=>{function F(a,c){return null===a||da[typeof a]?a===c:!1}function E(a,c){var e;return()=>{e||(e=b.a.setTimeout(()=>{e=0;a()},c))}}function J(a,c){var e;return()=>{clearTimeout(e);e=b.a.setTimeout(a,c)}}function S(a,c){null!==c&&c.m&&c.m()}function V(a,c){var e=this.dc,g=e[D];g.aa||(this.Ta&&this.za[c]?(e.ub(c,a,this.za[c]),this.za[c]=null,--this.Ta):g.u[c]||e.ub(c,a,g.v?{U:a}:e.Ub(a)),a.ka&&a.Zb())}var T=C.document,W={},b="undefined"!==typeof W?W:{};b.o=(a,c)=>{a=a.split(".");for(var e=b,g=0;g<
a.length-1;g++)e=e[a[g]];e[a[a.length-1]]=c};b.$=(a,c,e)=>{a[c]=e};b.o("version","3.5.1-sm");b.a={extend:(a,c)=>{c&&Object.entries(c).forEach(e=>a[e[0]]=e[1]);return a},O:(a,c)=>a&&Object.entries(a).forEach(e=>c(e[0],e[1])),cb:(a,c,e)=>{if(!a)return a;var g={};Object.entries(a).forEach(k=>g[k[0]]=c.call(e,k[1],k[0],a));return g},Xa:a=>[...a.childNodes].forEach(c=>b.removeNode(c)),Nb:a=>{var c=[...a],e=(c[0]&&c[0].ownerDocument||T).createElement("div");a.forEach(g=>e.append(b.fa(g)));return e},ya:(a,
c)=>Array.prototype.map.call(a,c?e=>b.fa(e.cloneNode(!0)):e=>e.cloneNode(!0)),ua:(a,c)=>{b.a.Xa(a);c&&a.append(...c)},Aa:(a,c)=>{if(a.length){for(c=8===c.nodeType&&c.parentNode||c;a.length&&a[0].parentNode!==c;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==c;)a.length--;if(1<a.length){c=a[0];var e=a[a.length-1];for(a.length=0;c!==e;)a.push(c),c=c.nextSibling;a.push(e)}}return a},Tb:a=>null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Ac:(a,c)=>{a=a||"";return c.length>
a.length?!1:a.substring(0,c.length)===c},hc:(a,c)=>c.contains(1!==a.nodeType?a.parentNode:a),Wa:a=>b.a.hc(a,a.ownerDocument.documentElement),Ab:a=>b.onError?function(){try{return a.apply(this,arguments)}catch(c){throw b.onError&&b.onError(c),c;}}:a,setTimeout:(a,c)=>setTimeout(b.a.Ab(a),c),Eb:a=>setTimeout(()=>{b.onError&&b.onError(a);throw a;},0),I:(a,c,e)=>a.addEventListener(c,b.a.Ab(e),!1),Wb:(a,c)=>{if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(c))},
g:a=>b.L(a)?a():a,hb:(a,c)=>a.textContent=b.a.g(c)||""};b.o("utils",b.a);b.o("unwrap",b.a.g);(()=>{let a=0,c="__ko__"+Date.now(),e=new WeakMap;b.a.f={get:(g,k)=>(e.get(g)||{})[k],set:(g,k,t)=>{if(e.has(g))e.get(g)[k]=t;else{let d={};d[k]=t;e.set(g,d)}return t},Za:function(g,k,t){return this.get(g,k)||this.set(g,k,t)},clear:g=>e.delete(g),W:()=>a++ +c}})();b.a.K=(()=>{var a=b.a.f.W(),c={1:1,8:1,9:1},e={1:1,9:1};const g=(d,f)=>{var h=b.a.f.get(d,a);f&&!h&&(h=new Set,b.a.f.set(d,a,h));return h},k=d=>
{var f=g(d);f&&(new Set(f)).forEach(h=>h(d));b.a.f.clear(d);e[d.nodeType]&&t(d.childNodes,!0)},t=(d,f)=>{for(var h=[],n,q=0;q<d.length;q++)if(!f||8===d[q].nodeType)if(k(h[h.length]=n=d[q]),d[q]!==n)for(;q--&&!h.includes(d[q]););};return{na:(d,f)=>{if("function"!=typeof f)throw Error("Callback must be a function");g(d,1).add(f)},gb:(d,f)=>{var h=g(d);h&&(h.delete(f),h.size||b.a.f.set(d,a,null))},fa:d=>{b.i.F(()=>{c[d.nodeType]&&(k(d),e[d.nodeType]&&t(d.getElementsByTagName("*")))});return d},removeNode:d=>
{b.fa(d);d.parentNode&&d.parentNode.removeChild(d)}}})();b.fa=b.a.K.fa;b.removeNode=b.a.K.removeNode;b.o("utils.domNodeDisposal",b.a.K);b.o("utils.domNodeDisposal.addDisposeCallback",b.a.K.na);b.Vb=(()=>{function a(){if(e)for(var d=e,f=0,h;k<e;)if(h=c[k++]){if(k>d){if(5E3<=++f){k=e;b.a.Eb(Error("'Too much recursion' after processing "+f+" task groups."));break}d=e}try{h()}catch(n){b.a.Eb(n)}}k=e=c.length=0}var c=[],e=0,g=1,k=0,t=(d=>{var f=T.createElement("div");(new MutationObserver(d)).observe(f,
{attributes:!0});return()=>f.classList.toggle("foo")})(a);return{Rb:d=>{e||t(a);c[e++]=d;return g++},cancel:d=>{d-=g-e;d>=k&&d<e&&(c[d]=null)}}})();b.Ya={debounce:(a,c)=>a.Ha(e=>J(e,c)),rateLimit:(a,c)=>{if("number"==typeof c)var e=c;else{e=c.timeout;var g=c.method}var k="function"==typeof g?g:E;a.Ha(t=>k(t,e,c))},notify:(a,c)=>{a.equalityComparer="always"==c?null:F}};var da={undefined:1,"boolean":1,number:1,string:1};b.o("extenders",b.Ya);class ea{constructor(a,c,e){this.U=a;this.nb=c;this.pa=e;
this.Na=!1;this.C=this.X=null;b.$(this,"dispose",this.m);b.$(this,"disposeWhenNodeIsRemoved",this.j)}m(){this.Na||(this.C&&b.a.K.gb(this.X,this.C),this.Na=!0,this.pa(),this.U=this.nb=this.pa=this.X=this.C=null)}j(a){this.X=a;b.a.K.na(a,this.C=this.m.bind(this))}}b.S=function(){Object.setPrototypeOf(this,P);P.Ea(this)};var P={Ea:a=>{a.T=new Map;a.T.set("change",new Set);a.tb=1},subscribe:function(a,c,e){var g=this;e=e||"change";var k=new ea(g,c?a.bind(c):a,()=>{g.T.get(e).delete(k);g.wa&&g.wa(e)});
g.oa&&g.oa(e);g.T.has(e)||g.T.set(e,new Set);g.T.get(e).add(k);return k},notifySubscribers:function(a,c){c=c||"change";"change"===c&&this.Ka();if(this.sa(c)){c="change"===c&&this.Xb||new Set(this.T.get(c));try{b.i.xb(),c.forEach(e=>{e.Na||e.nb(a)})}finally{b.i.end()}}},Ca:function(){return this.tb},mc:function(a){return this.Ca()!==a},Ka:function(){++this.tb},Ha:function(a){var c=this,e=b.L(c),g,k,t,d,f;c.va||(c.va=c.notifySubscribers,c.notifySubscribers=function(n,q){q&&"change"!==q?"beforeChange"===
q?this.qb(n):this.va(n,q):this.rb(n)});var h=a(()=>{c.ka=!1;e&&d===c&&(d=c.ob?c.ob():c());var n=k||f&&c.Ga(t,d);f=k=g=!1;n&&c.va(t=d)});c.rb=(n,q)=>{q&&c.ka||(f=!q);c.Xb=new Set(c.T.get("change"));c.ka=g=!0;d=n;h()};c.qb=n=>{g||(t=n,c.va(n,"beforeChange"))};c.sb=()=>{f=!0};c.Zb=()=>{c.Ga(t,c.H(!0))&&(k=!0)}},sa:function(a){return(this.T.get(a)||[]).size},Ga:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:()=>"[object Object]",extend:function(a){var c=this;a&&b.a.O(a,
(e,g)=>{e=b.Ya[e];"function"==typeof e&&(c=e(c,g)||c)});return c}};b.$(P,"init",P.Ea);b.$(P,"subscribe",P.subscribe);b.$(P,"extend",P.extend);Object.setPrototypeOf(P,Function.prototype);b.S.fn=P;b.pc=a=>null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers;(()=>{var a=[],c,e=0;b.i={xb:g=>{a.push(c);c=g},end:()=>c=a.pop(),Qb:g=>{if(c){if(!b.pc(g))throw Error("Only subscribable things can act as dependencies");c.ac.call(c.bc,g,g.Yb||(g.Yb=++e))}},F:(g,k,t)=>{try{return a.push(c),
c=void 0,g.apply(k,t||[])}finally{c=a.pop()}},Ba:()=>c&&c.l.Ba(),ab:()=>c&&c.ab,l:()=>c&&c.l}})();const O=Symbol("_latestValue");b.ca=a=>{function c(){if(0<arguments.length)return c.Ga(c[O],arguments[0])&&(c.lb(),c[O]=arguments[0],c.La()),this;b.i.Qb(c);return c[O]}c[O]=a;Object.defineProperty(c,"length",{get:()=>null==c[O]?void 0:c[O].length});b.S.fn.Ea(c);Object.setPrototypeOf(c,Q);return c};var Q={toJSON:function(){let a=this[O];return a&&a.toJSON?a.toJSON():a},equalityComparer:F,H:function(){return this[O]},
La:function(){this.notifySubscribers(this[O],"spectate");this.notifySubscribers(this[O])},lb:function(){this.notifySubscribers(this[O],"beforeChange")}};Object.setPrototypeOf(Q,b.S.fn);var R=b.ca.C="__ko_proto__";Q[R]=b.ca;b.L=a=>{if((a="function"==typeof a&&a[R])&&a!==Q[R]&&a!==b.l.fn[R])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!a};b.rc=a=>"function"==typeof a&&(a[R]===Q[R]||a[R]===b.l.fn[R]&&a.nc);b.o("observable",b.ca);b.o("isObservable",
b.L);b.o("observable.fn",Q);b.$(Q,"valueHasMutated",Q.La);b.ia=a=>{a=a||[];if("object"!=typeof a||!("length"in a))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");a=b.ca(a);Object.setPrototypeOf(a,b.ia.fn);return a.extend({trackArrayChanges:!0})};b.ia.fn={remove:function(a){for(var c=this.H(),e=!1,g="function"!=typeof a||b.L(a)?d=>d===a:a,k=c.length;k--;){var t=c[k];if(g(t)){if(c[k]!==t)throw Error("Array modified during remove; cannot remove item");
e||this.lb();e=!0;c.splice(k,1)}}e&&this.La()}};Object.setPrototypeOf(b.ia.fn,b.ca.fn);Object.getOwnPropertyNames(Array.prototype).forEach(a=>{"function"===typeof Array.prototype[a]&&"constructor"!=a&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(a)?b.ia.fn[a]=function(...c){var e=this.H();this.lb();this.zb(e,a,c);c=e[a](...c);this.La();return c===e?this:c}:b.ia.fn[a]=function(...c){return this()[a](...c)})});b.Kb=a=>b.L(a)&&"function"==typeof a.remove&&"function"==
typeof a.push;b.o("observableArray",b.ia);b.o("isObservableArray",b.Kb);b.Ya.trackArrayChanges=(a,c)=>{function e(){function p(){if(f){var u=[].concat(a.H()||[]);if(a.sa("arrayChange")){if(!k||1<f)k=b.a.Bb(h,u,a.Ra);var x=k}h=u;k=null;f=0;x&&x.length&&a.notifySubscribers(x,"arrayChange")}}g?p():(g=!0,d=a.subscribe(()=>++f,null,"spectate"),h=[].concat(a.H()||[]),k=null,t=a.subscribe(p))}a.Ra={};c&&"object"==typeof c&&b.a.extend(a.Ra,c);a.Ra.sparse=!0;if(!a.zb){var g=!1,k=null,t,d,f=0,h,n=a.oa,q=a.wa;
a.oa=p=>{n&&n.call(a,p);"arrayChange"===p&&e()};a.wa=p=>{q&&q.call(a,p);"arrayChange"!==p||a.sa("arrayChange")||(t&&t.m(),d&&d.m(),d=t=null,g=!1,h=void 0)};a.zb=(p,u,x)=>{function l(G,z,M){return m[m.length]={status:G,value:z,index:M}}if(g&&!f){var m=[],r=p.length,v=x.length,y=0;switch(u){case "push":y=r;case "unshift":for(u=0;u<v;u++)l("added",x[u],y+u);break;case "pop":y=r-1;case "shift":r&&l("deleted",p[y],y);break;case "splice":u=Math.min(Math.max(0,0>x[0]?r+x[0]:x[0]),r);r=1===v?r:Math.min(u+
(x[1]||0),r);v=u+v-2;y=Math.max(r,v);for(var w=[],A=[],I=2;u<y;++u,++I)u<r&&A.push(l("deleted",p[u],u)),u<v&&w.push(l("added",x[I],u));b.a.Hb(A,w);break;default:return}k=m}}}};var D=Symbol("_state");b.l=(a,c)=>{function e(){if(0<arguments.length){if("function"!==typeof g)throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");g(...arguments);return this}k.aa||b.i.Qb(e);(k.V||k.v&&e.ta())&&e.R();return k.M}
"object"===typeof a?c=a:(c=c||{},a&&(c.read=a));if("function"!=typeof c.read)throw Error("Pass a function that returns the value of the ko.computed");var g=c.write,k={M:void 0,ba:!0,V:!0,Fa:!1,jb:!1,aa:!1,fb:!1,v:!1,Pb:c.read,j:c.disposeWhenNodeIsRemoved||c.j||null,qa:c.disposeWhen||c.qa,Va:null,u:{},J:0,Gb:null};e[D]=k;e.nc="function"===typeof g;b.S.fn.Ea(e);Object.setPrototypeOf(e,U);c.pure?(k.fb=!0,k.v=!0,b.a.extend(e,fa)):c.deferEvaluation&&b.a.extend(e,ha);k.j&&(k.jb=!0,k.j.nodeType||(k.j=null));
k.v||c.deferEvaluation||e.R();k.j&&e.ha()&&b.a.K.na(k.j,k.Va=()=>{e.m()});return e};var U={equalityComparer:F,Ba:function(){return this[D].J},kc:function(){var a=[];b.a.O(this[D].u,(c,e)=>a[e.la]=e.U);return a},$a:function(a){if(!this[D].J)return!1;var c=this.kc();return c.includes(a)||!!c.find(e=>e.$a&&e.$a(a))},ub:function(a,c,e){if(this[D].fb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[D].u[a]=e;e.la=this[D].J++;e.ma=c.Ca()},ta:function(){var a,c=this[D].u;for(a in c)if(Object.prototype.hasOwnProperty.call(c,
a)){var e=c[a];if(this.ja&&e.U.ka||e.U.mc(e.ma))return!0}},Dc:function(){this.ja&&!this[D].Fa&&this.ja(!1)},ha:function(){var a=this[D];return a.V||0<a.J},Ec:function(){this.ka?this[D].V&&(this[D].ba=!0):this.Fb()},Ub:function(a){return a.subscribe(this.Fb,this)},Fb:function(){var a=this,c=a.throttleEvaluation;c&&0<=c?(clearTimeout(this[D].Gb),this[D].Gb=b.a.setTimeout(()=>a.R(!0),c)):a.ja?a.ja(!0):a.R(!0)},R:function(a){var c=this[D],e=c.qa,g=!1;if(!c.Fa&&!c.aa){if(c.j&&!b.a.Wa(c.j)||e&&e()){if(!c.jb){this.m();
return}}else c.jb=!1;c.Fa=!0;try{g=this.ic(a)}finally{c.Fa=!1}return g}},ic:function(a){var c=this[D],e=c.fb?void 0:!c.J;var g={dc:this,za:c.u,Ta:c.J};b.i.xb({bc:g,ac:V,l:this,ab:e});c.u={};c.J=0;a:{try{var k=c.Pb();break a}finally{b.i.end(),g.Ta&&!c.v&&b.a.O(g.za,S),c.ba=c.V=!1}k=void 0}c.J?g=this.Ga(c.M,k):(this.m(),g=!0);g&&(c.v?this.Ka():this.notifySubscribers(c.M,"beforeChange"),c.M=k,this.notifySubscribers(c.M,"spectate"),!c.v&&a&&this.notifySubscribers(c.M),this.sb&&this.sb());e&&this.notifySubscribers(c.M,
"awake");return g},H:function(a){var c=this[D];(c.V&&(a||!c.J)||c.v&&this.ta())&&this.R();return c.M},Ha:function(a){b.S.fn.Ha.call(this,a);this.ob=function(){this[D].v||(this[D].ba?this.R():this[D].V=!1);return this[D].M};this.ja=function(c){this.qb(this[D].M);this[D].V=!0;c&&(this[D].ba=!0);this.rb(this,!c)}},m:function(){var a=this[D];!a.v&&a.u&&b.a.O(a.u,(c,e)=>e.m&&e.m());a.j&&a.Va&&b.a.K.gb(a.j,a.Va);a.u=void 0;a.J=0;a.aa=!0;a.ba=!1;a.V=!1;a.v=!1;a.j=void 0;a.qa=void 0;a.Pb=void 0}},fa={oa:function(a){var c=
this,e=c[D];if(!e.aa&&e.v&&"change"==a){e.v=!1;if(e.ba||c.ta())e.u=null,e.J=0,c.R()&&c.Ka();else{var g=[];b.a.O(e.u,(k,t)=>g[t.la]=k);g.forEach((k,t)=>{var d=e.u[k],f=c.Ub(d.U);f.la=t;f.ma=d.ma;e.u[k]=f});c.ta()&&c.R()&&c.Ka()}e.aa||c.notifySubscribers(e.M,"awake")}},wa:function(a){var c=this[D];c.aa||"change"!=a||this.sa("change")||(b.a.O(c.u,(e,g)=>{g.m&&(c.u[e]={U:g.U,la:g.la,ma:g.ma},g.m())}),c.v=!0,this.notifySubscribers(void 0,"asleep"))},Ca:function(){var a=this[D];a.v&&(a.ba||this.ta())&&
this.R();return b.S.fn.Ca.call(this)}},ha={oa:function(a){"change"!=a&&"beforeChange"!=a||this.H()}};Object.setPrototypeOf(U,b.S.fn);U[b.ca.C]=b.l;b.o("computed",b.l);b.o("computed.fn",U);b.$(U,"dispose",U.m);b.wc=a=>{if("function"===typeof a)return b.l(a,{pure:!0});a=b.a.extend({},a);a.pure=!0;return b.l(a)};(()=>{b.A={P:a=>{switch(a.nodeName){case "OPTION":return!0===a.__ko__hasDomDataOptionValue__?b.a.f.get(a,b.b.options.eb):a.value;case "SELECT":return 0<=a.selectedIndex?b.A.P(a.options[a.selectedIndex]):
void 0;default:return a.value}},Ma:(a,c,e)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.f.set(a,b.b.options.eb,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.f.set(a,b.b.options.eb,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var g=-1,k=""===c||null==c,t=0,d=a.options.length,f;t<d;++t)if(f=b.A.P(a.options[t]),f==c||""===f&&k){g=t;break}if(e||0<=g||k&&1<a.size)a.selectedIndex=g;break;default:a.value=null==c?"":c}}}})();
b.G=(()=>{function a(f){f=b.a.Tb(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],n=f.match(g),q=[],p=0;if(1<n.length){for(var u=0,x;x=n[u++];){var l=x.charCodeAt(0);if(44===l){if(0>=p){h.push(m&&q.length?{key:m,value:q.join("")}:{unknown:m||q.join("")});var m=p=0;q=[];continue}}else if(58===l){if(!p&&!m&&1===q.length){m=q.pop();continue}}else if(47===l&&1<x.length&&(47===x.charCodeAt(1)||42===x.charCodeAt(1)))continue;else 47===l&&u&&1<x.length?(l=n[u-1].match(k))&&!t[l[0]]&&(f=f.substr(f.indexOf(x)+
1),n=f.match(g),u=-1,x="/"):40===l||123===l||91===l?++p:41===l||125===l||93===l?--p:m||q.length||34!==l&&39!==l||(x=x.slice(1,-1));q.push(x)}if(0<p)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true","false","null","undefined"],e=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,g=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,k=/[\])"'A-Za-z0-9_$]+$/,
t={"in":1,"return":1,"typeof":1},d=new Set;return{Qa:[],kb:d,uc:a,vc:function(f,h){function n(l,m){if(!x){var r=b.b[l];if(r&&r.preprocess&&!(m=r.preprocess(m,l,n)))return;if(r=d.has(l)){var v=m;c.includes(v)?v=!1:(r=v.match(e),v=null===r?!1:r[1]?"Object("+r[1]+")"+r[2]:v);r=v}r&&p.push("'"+l+"':function(_z){"+v+"=_z}")}u&&(m="function(){return "+m+" }");q.push("'"+l+"':"+m)}h=h||{};var q=[],p=[],u=h.valueAccessors,x=h.bindingParams;("string"===typeof f?a(f):f).forEach(l=>n(l.key||l.unknown,l.value));
p.length&&n("_ko_property_writers","{"+p.join(",")+" }");return q.join(",")},sc:(f,h)=>-1<f.findIndex(n=>n.key==h),mb:(f,h,n,q,p)=>{if(f&&b.L(f))!b.rc(f)||p&&f.H()===q||f(q);else if((f=h.get("_ko_property_writers"))&&f[n])f[n](q)}}})();(()=>{function a(d){return 8==d.nodeType&&g.test(d.nodeValue)}function c(d){return 8==d.nodeType&&k.test(d.nodeValue)}function e(d,f){for(var h=d,n=1,q=[];h=h.nextSibling;){if(c(h)&&(b.a.f.set(h,t,!0),!--n))return q;q.push(h);a(h)&&++n}if(!f)throw Error("Cannot find closing comment tag to match: "+
d.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,t="__ko_matchedEndComment__";b.h={da:{},childNodes:d=>a(d)?e(d):d.childNodes,ra:d=>{a(d)?(d=e(d))&&[...d].forEach(f=>b.removeNode(f)):b.a.Xa(d)},ua:(d,f)=>{a(d)?(b.h.ra(d),d.after(...f)):b.a.ua(d,f)},prepend:(d,f)=>{a(d)?d.nextSibling.before(f):d.prepend(f)},Jb:(d,f,h)=>{h?h.after(f):b.h.prepend(d,f)},firstChild:d=>{if(a(d))return d=d.nextSibling,!d||c(d)?null:d;let f=d.firstChild;if(f&&c(f))throw Error("Found invalid end comment, as the first child of "+
d);return f},nextSibling:d=>{if(a(d)){var f=e(d,void 0);d=f?(f.length?f[f.length-1]:d).nextSibling:null}if((f=d.nextSibling)&&c(f)){if(c(f)&&!b.a.f.get(f,t))throw Error("Found end comment without a matching opening comment, as child of "+d);return null}return f},lc:a,Bc:d=>(d=d.nodeValue.match(g))?d[1]:null}})();(()=>{const a=new Map;b.yb=new class{tc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return b.h.lc(c);default:return!1}}jc(c,e){a:{switch(c.nodeType){case 1:var g=
c.getAttribute("data-bind");break a;case 8:g=b.h.Bc(c);break a}g=null}if(g)try{let t={valueAccessors:!0},d=a.get(g);if(!d){var k="with($context){with($data||{}){return{"+b.G.vc(g,t)+"}}}";d=new Function("$context","$element",k);a.set(g,d)}return d(e,c)}catch(t){throw t.message="Unable to parse bindings.\nBindings value: "+g+"\nMessage: "+t.message,t;}return null}}})();(()=>{function a(l){var m=(l=b.a.f.get(l,u))&&l.D;m&&(l.D=null,m.Ob())}function c(l){return b.a.cb(b.i.F(l),(m,r)=>()=>l()[r])}function e(l,
m,r){return"function"===typeof l?c(l.bind(null,m,r)):b.a.cb(l,v=>()=>v)}function g(l,m){var r=b.h.firstChild(m);if(r)for(var v;v=r;)r=b.h.nextSibling(v),k(l,v);b.c.notify(m,b.c.B)}function k(l,m){var r=l;if(1===m.nodeType||b.yb.tc(m))r=d(m,null,l).bindingContextForDescendants;r&&m.matches&&!m.matches("SCRIPT,TEXTAREA,TEMPLATE")&&g(r,m)}function t(l){var m=[],r={},v=[];b.a.O(l,function A(w){if(!r[w]){var I=b.b[w];I&&(I.after&&(v.push(w),I.after.forEach(G=>{if(l[G]){if(v.includes(G))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+
v.join(", "));A(G)}}),v.length--),m.push({key:w,Ib:I}));r[w]=!0}});return m}function d(l,m,r){var v=b.a.f.Za(l,u,{}),y=v.$b;if(!m){if(y)throw Error("You cannot apply bindings multiple times to the same element.");v.$b=!0}y||(v.context=r);v.bb||(v.bb={});if(m&&"function"!==typeof m)var w=m;else{var A=b.l(()=>{if(w=m?m(r,l):b.yb.jc(l,r)){if(r[h])r[h]();if(r[q])r[q]()}return w},{j:l});w&&A.ha()||(A=null)}var I=r,G;if(w){var z=A?B=>()=>A()[B]():B=>w[B];function M(){return b.a.cb(A?A():w,B=>B())}M.get=
B=>w[B]&&z(B)();M.has=B=>B in w;b.c.B in w&&b.c.subscribe(l,b.c.B,()=>{var B=w[b.c.B]();if(B){var H=b.h.childNodes(l);H.length&&B(H,b.Db(H[0]))}});b.c.Z in w&&(I=b.c.ib(l,r),b.c.subscribe(l,b.c.Z,()=>{var B=w[b.c.Z]();B&&b.h.firstChild(l)&&B(l)}));t(w).forEach(B=>{var H=B.Ib.init,L=B.Ib.update,K=B.key;if(8===l.nodeType&&!b.h.da[K])throw Error("The binding '"+K+"' cannot be used with virtual elements");try{"function"==typeof H&&b.i.F(()=>{var N=H(l,z(K),M,I.$data,I);if(N&&N.controlsDescendantBindings){if(void 0!==
G)throw Error("Multiple bindings ("+G+" and "+K+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");G=K}}),"function"==typeof L&&b.l(()=>L(l,z(K),M,I.$data,I),{j:l})}catch(N){throw N.message='Unable to process binding "'+K+": "+w[K]+'"\nMessage: '+N.message,N;}})}v=void 0===G;return{shouldBindDescendants:v,bindingContextForDescendants:v&&I}}function f(l,m){return l&&l instanceof b.Y?l:new b.Y(l,void 0,void 0,m)}var h=Symbol("_subscribable"),
n=Symbol("_ancestorBindingInfo"),q=Symbol("_dataDependency");b.b={};var p={};b.Y=class{constructor(l,m,r,v,y){function w(){var H=z?G():G,L=b.a.g(H);m?(b.a.extend(A,m),n in m&&(A[n]=m[n])):(A.$parents=[],A.$root=L,A.ko=b);A[h]=B;I?L=A.$data:(A.$rawData=H,A.$data=L);r&&(A[r]=L);v&&v(A,m,L);if(m&&m[h]&&!b.i.l().$a(m[h]))m[h]();M&&(A[q]=M);return A.$data}var A=this,I=l===p,G=I?void 0:l,z="function"==typeof G&&!b.L(G),M=y&&y.dataDependency;if(y&&y.exportDependencies)w();else{var B=b.wc(w);B.H();B.ha()?
B.equalityComparer=null:A[h]=void 0}}["createChildContext"](l,m,r,v){!v&&m&&"object"==typeof m&&(v=m,m=v.as,r=v.extend);if(m&&v&&v.noChildContext){var y="function"==typeof l&&!b.L(l);return new b.Y(p,this,null,w=>{r&&r(w);w[m]=y?l():l},v)}return new b.Y(l,this,m,(w,A)=>{w.$parentContext=A;w.$parent=A.$data;w.$parents=(A.$parents||[]).slice(0);w.$parents.unshift(w.$parent);r&&r(w)},v)}["extend"](l,m){return new b.Y(p,this,null,r=>b.a.extend(r,"function"==typeof l?l(r):l),m)}};var u=b.a.f.W();class x{constructor(l,
m,r){this.C=l;this.pa=m;this.xa=new Set;this.B=!1;m.D||b.a.K.na(l,a);r&&r.D&&(r.D.xa.add(l),this.X=r)}Ob(){this.X&&this.X.D&&this.X.D.fc(this.C)}fc(l){this.xa.delete(l);!this.xa.size&&this.B&&this.Cb()}Cb(){this.B=!0;this.pa.D&&!this.xa.size&&(this.pa.D=null,b.a.K.gb(this.C,a),b.c.notify(this.C,b.c.Z),this.Ob())}}b.c={B:"childrenComplete",Z:"descendantsComplete",subscribe:(l,m,r,v,y)=>{var w=b.a.f.Za(l,u,{});w.ga||(w.ga=new b.S);y&&y.notifyImmediately&&w.bb[m]&&b.i.F(r,v,[l]);return w.ga.subscribe(r,
v,m)},notify:(l,m)=>{var r=b.a.f.get(l,u);if(r&&(r.bb[m]=!0,r.ga&&r.ga.notifySubscribers(l,m),m==b.c.B))if(r.D)r.D.Cb();else if(void 0===r.D&&r.ga&&r.ga.sa(b.c.Z))throw Error("descendantsComplete event not supported for bindings on this node");},ib:(l,m)=>{var r=b.a.f.Za(l,u,{});r.D||(r.D=new x(l,r,m[n]));return m[n]==r?m:m.extend(v=>{v[n]=r})}};b.zc=l=>(l=b.a.f.get(l,u))&&l.context;b.Pa=(l,m,r)=>d(l,m,f(r));b.Cc=(l,m,r)=>{r=f(r);return b.Pa(l,e(m,r,l),r)};b.wb=(l,m)=>{1!==m.nodeType&&8!==m.nodeType||
g(f(l),m)};b.vb=function(l,m,r){if(2>arguments.length){if(m=T.body,!m)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!m||1!==m.nodeType&&8!==m.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");k(f(l,r),m)};b.Db=l=>(l=l&&[1,8].includes(l.nodeType)&&b.zc(l))?l.$data:void 0;b.o("bindingHandlers",b.b);b.o("applyBindings",b.vb);b.o("applyBindingAccessorsToNode",b.Pa);b.o("dataFor",
b.Db)})();(()=>{function a(d,f){return Object.prototype.hasOwnProperty.call(d,f)?d[f]:void 0}function c(d,f){var h=a(k,d);if(h)h.subscribe(f);else{h=k[d]=new b.S;h.subscribe(f);e(d,(q,p)=>{p=!(!p||!p.synchronous);t[d]={definition:q,qc:p};delete k[d];n||p?h.notifySubscribers(q):b.Vb.Rb(()=>h.notifySubscribers(q))});var n=!0}}function e(d,f){g("getConfig",[d],h=>{h?g("loadComponent",[d,h],n=>f(n,h)):f(null,null)})}function g(d,f,h,n){n||(n=b.s.loaders.slice(0));var q=n.shift();if(q){var p=q[d];if(p){var u=
!1;if(void 0!==p.apply(q,f.concat(function(x){u?h(null):null!==x?h(x):g(d,f,h,n)}))&&(u=!0,!q.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else g(d,f,h,n)}else h(null)}var k={},t={};b.s={get:(d,f)=>{var h=a(t,d);h?h.qc?b.i.F(()=>f(h.definition)):b.Vb.Rb(()=>f(h.definition)):c(d,f)},cc:d=>delete t[d],pb:g};b.s.loaders=[];b.o("components",b.s)})();(()=>{function a(d,f,h,n){var q={},p=2;f=h.template;h=
h.viewModel;f?b.s.pb("loadTemplate",[d,f],u=>{q.template=u;0===--p&&n(q)}):0===--p&&n(q);h?b.s.pb("loadViewModel",[d,h],u=>{q[t]=u;0===--p&&n(q)}):0===--p&&n(q)}function c(d,f,h){if("function"===typeof f)h(q=>new f(q));else if("function"===typeof f[t])h(f[t]);else if("instance"in f){var n=f.instance;h(()=>n)}else"viewModel"in f?c(d,f.viewModel,h):d("Unknown viewModel value: "+f)}function e(d){if(d.matches("TEMPLATE")&&d.content instanceof DocumentFragment)return b.a.ya(d.content.childNodes);throw"Template Source Element not a <template>";
}function g(d){return f=>{throw Error("Component '"+d+"': "+f);}}var k={};b.s.register=(d,f)=>{if(!f)throw Error("Invalid configuration for "+d);if(b.s.Lb(d))throw Error("Component "+d+" is already registered");k[d]=f};b.s.Lb=d=>Object.prototype.hasOwnProperty.call(k,d);b.s.unregister=d=>{delete k[d];b.s.cc(d)};b.s.ec={getConfig:(d,f)=>{d=b.s.Lb(d)?k[d]:null;f(d)},loadComponent:(d,f,h)=>{var n=g(d);a(d,n,f,h)},loadTemplate:(d,f,h)=>{d=g(d);if(f instanceof Array)h(f);else if(f instanceof DocumentFragment)h([...f.childNodes]);
else if(f.element)if(f=f.element,f instanceof HTMLElement)h(e(f));else if("string"===typeof f){var n=T.getElementById(f);n?h(e(n)):d("Cannot find element with ID "+f)}else d("Unknown element type: "+f);else d("Unknown template value: "+f)},loadViewModel:(d,f,h)=>c(g(d),f,h)};var t="createViewModel";b.o("components.register",b.s.register);b.s.loaders.push(b.s.ec)})();(()=>{function a(g,k,t){k=k.template;if(!k)throw Error("Component '"+g+"' has no template");g=b.a.ya(k);b.h.ua(t,g)}function c(g,k,t){var d=
g.createViewModel;return d?d.call(g,k,t):k}var e=0;b.b.component={init:(g,k,t,d,f)=>{var h,n,q,p=()=>{var x=h&&h.dispose;"function"===typeof x&&x.call(h);q&&q.m();n=h=q=null},u=[...b.h.childNodes(g)];b.h.ra(g);b.a.K.na(g,p);b.l(()=>{var x=b.a.g(k());if("string"===typeof x)var l=x;else{l=b.a.g(x.name);var m=b.a.g(x.params)}if(!l)throw Error("No component name specified");var r=b.c.ib(g,f),v=n=++e;b.s.get(l,y=>{if(n===v){p();if(!y)throw Error("Unknown component '"+l+"'");a(l,y,g);var w=c(y,m,{element:g,
templateNodes:u});y=r.createChildContext(w,{extend:A=>{A.$component=w;A.$componentTemplateNodes=u}});w&&w.koDescendantsComplete&&(q=b.c.subscribe(g,b.c.Z,w.koDescendantsComplete,w));h=w;b.wb(y,g)}})},{j:g});return{controlsDescendantBindings:!0}}};b.h.da.component=!0})();b.b.attr={update:(a,c)=>{c=b.a.g(c())||{};b.a.O(c,function(e,g){g=b.a.g(g);var k=e.indexOf(":");k="lookupNamespaceURI"in a&&0<k&&a.lookupNamespaceURI(e.substr(0,k));var t=!1===g||null===g||void 0===g;t?k?a.removeAttributeNS(k,e):a.removeAttribute(e):
g=g.toString();t||(k?a.setAttributeNS(k,e,g):a.setAttribute(e,g));"name"===e&&(a.name=t?"":g)})}};var X=(a,c,e)=>{c&&c.split(/\s+/).forEach(g=>a.classList.toggle(g,e))};b.b.css={update:(a,c)=>{c=b.a.g(c());null!==c&&"object"==typeof c?b.a.O(c,(e,g)=>{g=b.a.g(g);X(a,e,!!g)}):(c=b.a.Tb(c),X(a,a.__ko__cssValue,!1),a.__ko__cssValue=c,X(a,c,!0))}};b.b.enable={update:(a,c)=>{(c=b.a.g(c()))&&a.disabled?a.removeAttribute("disabled"):c||a.disabled||(a.disabled=!0)}};b.b.disable={update:(a,c)=>b.b.enable.update(a,
()=>!b.a.g(c()))};b.b.event={init:(a,c,e,g,k)=>{var t=c()||{};b.a.O(t,d=>{"string"==typeof d&&b.a.I(a,d,function(f){var h=c()[d];if(h){try{g=k.$data;var n=h.apply(g,[g,...arguments])}finally{!0!==n&&f.preventDefault()}!1===e.get(d+"Bubble")&&(f.cancelBubble=!0,f.stopPropagation())}})})}};b.b.foreach={Mb:a=>()=>{var c=a(),e=b.L(c)?c.H():c;if(!e||"number"==typeof e.length)return{foreach:c};b.a.g(c);return{foreach:e.data,as:e.as,noChildContext:e.noChildContext,includeDestroyed:e.includeDestroyed,afterAdd:e.afterAdd,
beforeRemove:e.beforeRemove,afterRender:e.afterRender,beforeMove:e.beforeMove,afterMove:e.afterMove}},init:(a,c)=>b.b.template.init(a,b.b.foreach.Mb(c)),update:(a,c,e,g,k)=>b.b.template.update(a,b.b.foreach.Mb(c),e,g,k)};b.G.Qa.foreach=!1;b.h.da.foreach=!0;b.b.hasfocus={init:(a,c,e)=>{var g=t=>{a.__ko_hasfocusUpdating=!0;t=a.ownerDocument.activeElement===a;var d=c();b.G.mb(d,e,"hasfocus",t,!0);a.__ko_hasfocusLastValue=t;a.__ko_hasfocusUpdating=!1},k=g.bind(null,!0);g=g.bind(null,!1);b.a.I(a,"focus",
k);b.a.I(a,"focusin",k);b.a.I(a,"blur",g);b.a.I(a,"focusout",g);a.__ko_hasfocusLastValue=!1},update:(a,c)=>{c=!!b.a.g(c());a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===c||(c?a.focus():a.blur())}};b.G.kb.add("hasfocus");b.b.html={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{b.a.Xa(a);c=b.a.g(c());if(null!=c){const e=T.createElement("template");e.innerHTML="string"!=typeof c?c.toString():c;a.appendChild(e.content)}}};(function(){function a(c,e,g){b.b[c]={init:(k,t,d,f,h)=>{var n,
q,p={},u;if(e){f=d.get("as");var x=d.get("noChildContext");var l=!(f&&x);p={as:f,noChildContext:x,exportDependencies:l}}var m=(u="render"==d.get("completeOn"))||d.has(b.c.Z);b.l(()=>{var r=b.a.g(t()),v=!g!==!r,y=!q;if(l||v!==n){m&&(h=b.c.ib(k,h));if(v){if(!e||l)p.dataDependency=b.i.l();var w=e?h.createChildContext("function"==typeof r?r:t,p):b.i.Ba()?h.extend(null,p):h}y&&b.i.Ba()&&(q=b.a.ya(b.h.childNodes(k),!0));v?(y||b.h.ua(k,b.a.ya(q)),b.wb(w,k)):(b.h.ra(k),u||b.c.notify(k,b.c.B));n=v}},{j:k});
return{controlsDescendantBindings:!0}}};b.G.Qa[c]=!1;b.h.da[c]=!0}a("if");a("ifnot",!1,!0);a("with",!0)})();var Y={};b.b.options={init:a=>{if(!a.matches("SELECT"))throw Error("options binding applies only to SELECT elements");for(;0<a.length;)a.remove(0);return{controlsDescendantBindings:!0}},update:(a,c,e)=>{function g(){return Array.from(a.options).filter(l=>l.selected)}function k(l,m,r){var v=typeof m;return"function"==v?m(l):"string"==v?l[m]:r}function t(l,m){u&&n?b.c.notify(a,b.c.B):q.length&&
(l=q.includes(b.A.P(m[0])),m[0].selected=l,u&&!l&&b.i.F(b.a.Wb,null,[a,"change"]))}var d=a.multiple,f=0!=a.length&&d?a.scrollTop:null,h=b.a.g(c()),n=e.get("valueAllowUnset")&&e.has("value");c={};var q=[];n||(d?q=g().map(b.A.P):0<=a.selectedIndex&&q.push(b.A.P(a.options[a.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var p=h.filter(l=>l||null==l);e.has("optionsCaption")&&(h=b.a.g(e.get("optionsCaption")),null!==h&&void 0!==h&&p.unshift(Y))}var u=!1;c.beforeRemove=l=>a.removeChild(l);
h=t;e.has("optionsAfterRender")&&"function"==typeof e.get("optionsAfterRender")&&(h=(l,m)=>{t(l,m);b.i.F(e.get("optionsAfterRender"),null,[m[0],l!==Y?l:void 0])});b.a.Sb(a,p,function(l,m,r){r.length&&(q=!n&&r[0].selected?[b.A.P(r[0])]:[],u=!0);m=a.ownerDocument.createElement("option");l===Y?(b.a.hb(m,e.get("optionsCaption")),b.A.Ma(m,void 0)):(r=k(l,e.get("optionsValue"),l),b.A.Ma(m,b.a.g(r)),l=k(l,e.get("optionsText"),r),b.a.hb(m,l));return[m]},c,h);if(!n){var x;d?x=q.length&&g().length<q.length:
x=q.length&&0<=a.selectedIndex?b.A.P(a.options[a.selectedIndex])!==q[0]:q.length||0<=a.selectedIndex;x&&b.i.F(b.a.Wb,null,[a,"change"])}(n||b.i.ab())&&b.c.notify(a,b.c.B);f&&20<Math.abs(f-a.scrollTop)&&(a.scrollTop=f)}};b.b.options.eb=b.a.f.W();b.b.style={update:(a,c)=>{c=b.a.g(c()||{});b.a.O(c,(e,g)=>{g=b.a.g(g);if(null===g||void 0===g||!1===g)g="";if(/^--/.test(e))a.style.setProperty(e,g);else{e=e.replace(/-(\w)/g,(t,d)=>d.toUpperCase());var k=a.style[e];a.style[e]=g;g===k||a.style[e]!=k||isNaN(g)||
(a.style[e]=g+"px")}})}};b.b.submit={init:(a,c,e,g,k)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");b.a.I(a,"submit",t=>{var d=c();try{var f=d.call(k.$data,a)}finally{!0!==f&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}})}};b.b.text={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>b.a.hb(a,c())};b.h.da.text=!0;b.b.textInput={init:(a,c,e)=>{var g=a.value,k,t,d=()=>{clearTimeout(k);t=k=void 0;var h=a.value;g!==h&&(g=h,b.G.mb(c(),e,"textInput",
h))},f=()=>{var h=b.a.g(c());if(null===h||void 0===h)h="";void 0!==t&&h===t?b.a.setTimeout(f,4):a.value!==h&&(a.value=h,g=a.value)};b.a.I(a,"input",d);b.a.I(a,"change",d);b.a.I(a,"blur",d);b.l(f,{j:a})}};b.G.kb.add("textInput");b.b.textinput={preprocess:(a,c,e)=>e("textInput",a)};b.b.value={init:(a,c,e)=>{var g=a.matches("SELECT"),k=a.matches("INPUT");if(!k||"checkbox"!=a.type&&"radio"!=a.type){var t=new Set,d=e.get("valueUpdate"),f=null;d&&("string"==typeof d?t.add(d):d.forEach(p=>t.add(p)),t.delete("change"));
var h=()=>{f=null;var p=c(),u=b.A.P(a);b.G.mb(p,e,"value",u)};t.forEach(p=>{var u=h;b.a.Ac(p,"after")&&(u=()=>{f=b.A.P(a);b.a.setTimeout(h,0)},p=p.substring(5));b.a.I(a,p,u)});var n=k&&"file"==a.type?()=>{var p=b.a.g(c());null===p||void 0===p||""===p?a.value="":b.i.F(h)}:()=>{var p=b.a.g(c()),u=b.A.P(a);if(null!==f&&p===f)b.a.setTimeout(n,0);else if(p!==u||void 0===u)g?(u=e.get("valueAllowUnset"),b.A.Ma(a,p,u),u||p===b.A.P(a)||b.i.F(h)):b.A.Ma(a,p)};if(g){var q;b.c.subscribe(a,b.c.B,()=>{q?e.get("valueAllowUnset")?
n():h():(b.a.I(a,"change",h),q=b.l(n,{j:a}))},null,{notifyImmediately:!0})}else b.a.I(a,"change",h),b.l(n,{j:a})}else b.Pa(a,{checkedValue:c})},update:()=>{}};b.G.kb.add("value");b.b.visible={update:(a,c)=>{c=b.a.g(c());var e="none"!=a.style.display;c&&!e?a.style.display="":e&&!c&&(a.style.display="none")}};b.b.hidden={update:(a,c)=>a.hidden=!!b.a.g(c())};(function(a){b.b[a]={init:function(c,e,g,k,t){return b.b.event.init.call(this,c,()=>({[a]:e()}),g,k,t)}}})("click");(()=>{let a=b.a.f.W();class c{constructor(g){this.Ua=
g}Ia(...g){let k=this.Ua;if(!g.length)return b.a.f.get(k,a)||(11===this.C?k.content:1===this.C?k:void 0);b.a.f.set(k,a,g[0])}}class e extends c{constructor(g){super(g);g&&(this.C=g.matches("TEMPLATE")&&g.content?g.content.nodeType:1)}}b.Ja={Ua:e,Oa:c}})();(()=>{function a(d,f){if(d.length){var h=d[0],n=h.parentNode;g(h,d[d.length-1],q=>{1!==q.nodeType&&8!==q.nodeType||b.vb(f,q)});b.a.Aa(d,n)}}function c(d,f,h,n,q){q=q||{};var p=(d&&(d.nodeType?d:0<d.length?d[0]:null)||h||{}).ownerDocument;if("string"==
typeof h){p=p||T;p=p.getElementById(h);if(!p)throw Error("Cannot find template with ID "+h);h=new b.Ja.Ua(p)}else if([1,8].includes(h.nodeType))h=new b.Ja.Oa(h);else throw Error("Unknown template type: "+h);h=(h=h.Ia?h.Ia():null)?[...h.cloneNode(!0).childNodes]:null;if("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(f){case "replaceChildren":b.h.ua(d,h);p=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+
f);}p&&(a(h,n),q.afterRender&&b.i.F(q.afterRender,null,[h,n[q.as||"$data"]]),"replaceChildren"==f&&b.c.notify(d,b.c.B));return h}function e(d,f,h){return b.L(d)?d():"function"===typeof d?d(f,h):d}var g=(d,f,h)=>{var n;for(f=b.h.nextSibling(f);d&&(n=d)!==f;)d=b.h.nextSibling(n),h(n,d)};b.xc=function(d,f,h,n){h=h||{};var q=q||"replaceChildren";if(n){var p=n.nodeType?n:0<n.length?n[0]:null;return b.l(()=>{var u=f&&f instanceof b.Y?f:new b.Y(f,null,null,null,{exportDependencies:!0}),x=e(d,u.$data,u);
c(n,q,x,u,h)},{qa:()=>!p||!b.a.Wa(p),j:p})}console.log("no targetNodeOrNodeArray")};b.yc=(d,f,h,n,q)=>{function p(y,w){b.i.F(b.a.Sb,null,[n,y,l,h,m,w]);b.c.notify(n,b.c.B)}var u,x=h.as,l=(y,w)=>{u=q.createChildContext(y,{as:x,noChildContext:h.noChildContext,extend:A=>{A.$index=w;x&&(A[x+"Index"]=w)}});y=e(d,y,u);return c(n,"ignoreTargetNode",y,u,h)},m=(y,w)=>{a(w,u);h.afterRender&&h.afterRender(w,y);u=null},r=!1===h.includeDestroyed;if(r||h.beforeRemove||!b.Kb(f))return b.l(()=>{var y=b.a.g(f)||[];
"undefined"==typeof y.length&&(y=[y]);r&&(y=y.filter(w=>w||null==w));p(y)},{j:n});p(f.H());var v=f.subscribe(y=>{p(f(),y)},null,"arrayChange");v.j(n);return v};var k=b.a.f.W(),t=b.a.f.W();b.b.template={init:(d,f)=>{f=b.a.g(f());if("string"==typeof f||"name"in f)b.h.ra(d);else if("nodes"in f){f=f.nodes||[];if(b.L(f))throw Error('The "nodes" option must be a plain, non-observable array.');let h=f[0]&&f[0].parentNode;h&&b.a.f.get(h,t)||(h=b.a.Nb(f),b.a.f.set(h,t,!0));(new b.Ja.Oa(d)).Ia(h)}else if(f=
b.h.childNodes(d),0<f.length)f=b.a.Nb(f),(new b.Ja.Oa(d)).Ia(f);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:(d,f,h,n,q)=>{var p=f();f=b.a.g(p);h=!0;n=null;"string"==typeof f?f={}:(p="name"in f?f.name:d,"if"in f&&(h=b.a.g(f["if"])),h&&"ifnot"in f&&(h=!b.a.g(f.ifnot)),h&&!p&&(h=!1));"foreach"in f?n=b.yc(p,h&&f.foreach||[],f,d,q):h?(h=q,"data"in f&&(h=q.createChildContext(f.data,{as:f.as,noChildContext:f.noChildContext,
exportDependencies:!0})),n=b.xc(p,h,f,d)):b.h.ra(d);q=n;(f=b.a.f.get(d,k))&&"function"==typeof f.m&&f.m();b.a.f.set(d,k,!q||q.ha&&!q.ha()?void 0:q)}};b.G.Qa.template=d=>{d=b.G.uc(d);return 1==d.length&&d[0].unknown||b.G.sc(d,"name")?null:"This template engine does not support anonymous templates nested within its templates"};b.h.da.template=!0})();b.a.Hb=(a,c,e)=>{if(a.length&&c.length){var g,k,t,d,f;for(g=k=0;(!e||g<e)&&(d=a[k]);++k){for(t=0;f=c[t];++t)if(d.value===f.value){d.moved=f.index;f.moved=
d.index;c.splice(t,1);g=t=0;break}g+=t}}};b.a.Bb=(()=>{function a(c,e,g,k,t){var d=Math.min,f=Math.max,h=[],n,q=c.length,p,u=e.length,x=u-q||1,l=q+u+1,m;for(n=0;n<=q;n++){var r=m;h.push(m=[]);var v=d(u,n+x);for(p=f(0,n-1);p<=v;p++)m[p]=p?n?c[n-1]===e[p-1]?r[p-1]:d(r[p]||l,m[p-1]||l)+1:p+1:n+1}d=[];f=[];x=[];n=q;for(p=u;n||p;)u=h[n][p]-1,p&&u===h[n][p-1]?f.push(d[d.length]={status:g,value:e[--p],index:p}):n&&u===h[n-1][p]?x.push(d[d.length]={status:k,value:c[--n],index:n}):(--p,--n,t.sparse||d.push({status:"retained",
value:e[p]}));b.a.Hb(x,f,!t.dontLimitMoves&&10*q);return d.reverse()}return function(c,e,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];e=e||[];return c.length<e.length?a(c,e,"added","deleted",g):a(e,c,"deleted","added",g)}})();(()=>{function a(g,k,t,d,f){var h=[],n=b.l(()=>{var q=k(t,f,b.a.Aa(h,g))||[];if(0<h.length){var p=h.nodeType?[h]:h;if(0<p.length){var u=p[0],x=u.parentNode,l;var m=0;for(l=q.length;m<l;m++)x.insertBefore(q[m],u);m=0;for(l=p.length;m<l;m++)b.removeNode(p[m])}d&&
b.i.F(d,null,[t,q,f])}h.length=0;h.push(...q)},{j:g,qa:()=>!!h.find(b.a.Wa)});return{N:h,Sa:n.ha()?n:void 0}}var c=b.a.f.W(),e=b.a.f.W();b.a.Sb=(g,k,t,d,f,h)=>{function n(H){z={ea:H,Da:b.ca(r++)};l.push(z);x||I.push(z)}function q(H){z=u[H];r!==z.Da.H()&&A.push(z);z.Da(r++);b.a.Aa(z.N,g);l.push(z)}function p(H,L){if(H)for(var K=0,N=L.length;K<N;K++)L[K].N.forEach(ia=>H(ia,K,L[K].ea))}k=k||[];"undefined"==typeof k.length&&(k=[k]);d=d||{};var u=b.a.f.get(g,c),x=!u,l=[],m=0,r=0,v=[],y=[],w=[],A=[],I=
[],G=0;if(x)k.forEach(n);else{if(!h||u&&u._countWaitingForRemove)h=Array.prototype.map.call(u,H=>H.ea),h=b.a.Bb(h,k,{dontLimitMoves:d.dontLimitMoves,sparse:!0});for(let H=0,L,K,N;L=h[H];H++)switch(K=L.moved,N=L.index,L.status){case "deleted":for(;m<N;)q(m++);if(void 0===K){var z=u[m];z.Sa&&(z.Sa.m(),z.Sa=void 0);b.a.Aa(z.N,g).length&&(d.beforeRemove&&(l.push(z),G++,z.ea===e?z=null:w.push(z)),z&&v.push.apply(v,z.N))}m++;break;case "added":for(;r<N;)q(m++);void 0!==K?(y.push(l.length),q(K)):n(L.value)}for(;r<
k.length;)q(m++);l._countWaitingForRemove=G}b.a.f.set(g,c,l);p(d.beforeMove,A);v.forEach(d.beforeRemove?b.fa:b.removeNode);var M,B;G=g.ownerDocument.activeElement;if(y.length)for(;void 0!=(k=y.shift());){z=l[k];for(M=void 0;k;)if((B=l[--k].N)&&B.length){M=B[B.length-1];break}for(m=0;v=z.N[m];M=v,m++)b.h.Jb(g,v,M)}for(k=0;z=l[k];k++){z.N||b.a.extend(z,a(g,t,z.ea,f,z.Da));for(m=0;v=z.N[m];M=v,m++)b.h.Jb(g,v,M);!z.oc&&f&&(f(z.ea,z.N,z.Da),z.oc=!0,M=z.N[z.N.length-1])}G&&g.ownerDocument.activeElement!=
G&&G.focus();p(d.beforeRemove,w);for(k=0;k<w.length;++k)w[k].ea=e;p(d.afterMove,A);p(d.afterAdd,I)}})();C.ko=W})(this);

View file

@ -20,12 +20,10 @@
"preprocess": "build/build.sh",
"html": "spec/runner.html?src=build/output/knockout-latest.js&testling=true",
"browsers": [
"chrome/68..latest",
"firefox/56..latest",
"safari/10..latest",
"opera/11.0..latest",
"iphone/6..latest",
"ipad/6..latest"
"chrome/69..latest",
"firefox/69..latest",
"safari/12..latest",
"opera/56..latest"
]
},
"licenses": [

View file

@ -6,142 +6,141 @@
ko.bindingHandlers = {};
// Use an overridable method for retrieving binding handlers so that plugins may support dynamically created handlers
ko['getBindingHandler'] = bindingKey => ko.bindingHandlers[bindingKey];
var inheritParentVm = {};
// The ko.bindingContext constructor is only called directly to create the root context. For child
// contexts, use bindingContext.createChildContext or bindingContext.extend.
ko.bindingContext = function(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback, options) {
ko.bindingContext = class {
constructor(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback, options)
{
// The binding context object includes static properties for the current, parent, and root view models.
// If a view model is actually stored in an observable, the corresponding binding context object, and
// any child contexts, must be updated when the view model is changed.
function updateContext() {
// Most of the time, the context will directly get a view model object, but if a function is given,
// we call the function to retrieve the view model. If the function accesses any observables or returns
// an observable, the dependency is tracked, and those observables can later cause the binding
// context to be updated.
var dataItemOrObservable = isFunc ? realDataItemOrAccessor() : realDataItemOrAccessor,
dataItem = ko.utils.unwrapObservable(dataItemOrObservable);
// The binding context object includes static properties for the current, parent, and root view models.
// If a view model is actually stored in an observable, the corresponding binding context object, and
// any child contexts, must be updated when the view model is changed.
function updateContext() {
// Most of the time, the context will directly get a view model object, but if a function is given,
// we call the function to retrieve the view model. If the function accesses any observables or returns
// an observable, the dependency is tracked, and those observables can later cause the binding
// context to be updated.
var dataItemOrObservable = isFunc ? realDataItemOrAccessor() : realDataItemOrAccessor,
dataItem = ko.utils.unwrapObservable(dataItemOrObservable);
if (parentContext) {
// Copy $root and any custom properties from the parent context
ko.utils.extend(self, parentContext);
if (parentContext) {
// Copy $root and any custom properties from the parent context
ko.utils.extend(self, parentContext);
// Copy Symbol properties
if (contextAncestorBindingInfo in parentContext) {
self[contextAncestorBindingInfo] = parentContext[contextAncestorBindingInfo];
}
} else {
self['$parents'] = [];
self['$root'] = dataItem;
// Copy Symbol properties
if (contextAncestorBindingInfo in parentContext) {
self[contextAncestorBindingInfo] = parentContext[contextAncestorBindingInfo];
// Export 'ko' in the binding context so it will be available in bindings and templates
// even if 'ko' isn't exported as a global, such as when using an AMD loader.
// See https://github.com/SteveSanderson/knockout/issues/490
self['ko'] = ko;
}
self[contextSubscribable] = subscribable;
if (shouldInheritData) {
dataItem = self['$data'];
} else {
self['$rawData'] = dataItemOrObservable;
self['$data'] = dataItem;
}
if (dataItemAlias)
self[dataItemAlias] = dataItem;
// The extendCallback function is provided when creating a child context or extending a context.
// It handles the specific actions needed to finish setting up the binding context. Actions in this
// function could also add dependencies to this binding context.
if (extendCallback)
extendCallback(self, parentContext, dataItem);
// When a "parent" context is given and we don't already have a dependency on its context, register a dependency on it.
// Thus whenever the parent context is updated, this context will also be updated.
if (parentContext && parentContext[contextSubscribable] && !ko.dependencyDetection.computed().hasAncestorDependency(parentContext[contextSubscribable])) {
parentContext[contextSubscribable]();
}
if (dataDependency) {
self[contextDataDependency] = dataDependency;
}
return self['$data'];
}
var self = this,
shouldInheritData = dataItemOrAccessor === inheritParentVm,
realDataItemOrAccessor = shouldInheritData ? undefined : dataItemOrAccessor,
isFunc = typeof(realDataItemOrAccessor) == "function" && !ko.isObservable(realDataItemOrAccessor),
subscribable,
dataDependency = options && options['dataDependency'];
if (options && options['exportDependencies']) {
// The "exportDependencies" option means that the calling code will track any dependencies and re-create
// the binding context when they change.
updateContext();
} else {
self['$parents'] = [];
self['$root'] = dataItem;
subscribable = ko.pureComputed(updateContext);
subscribable.peek();
// Export 'ko' in the binding context so it will be available in bindings and templates
// even if 'ko' isn't exported as a global, such as when using an AMD loader.
// See https://github.com/SteveSanderson/knockout/issues/490
self['ko'] = ko;
// At this point, the binding context has been initialized, and the "subscribable" computed observable is
// subscribed to any observables that were accessed in the process. If there is nothing to track, the
// computed will be inactive, and we can safely throw it away. If it's active, the computed is stored in
// the context object.
if (subscribable.isActive()) {
// Always notify because even if the model ($data) hasn't changed, other context properties might have changed
subscribable['equalityComparer'] = null;
} else {
self[contextSubscribable] = undefined;
}
}
self[contextSubscribable] = subscribable;
if (shouldInheritData) {
dataItem = self['$data'];
} else {
self['$rawData'] = dataItemOrObservable;
self['$data'] = dataItem;
}
if (dataItemAlias)
self[dataItemAlias] = dataItem;
// The extendCallback function is provided when creating a child context or extending a context.
// It handles the specific actions needed to finish setting up the binding context. Actions in this
// function could also add dependencies to this binding context.
if (extendCallback)
extendCallback(self, parentContext, dataItem);
// When a "parent" context is given and we don't already have a dependency on its context, register a dependency on it.
// Thus whenever the parent context is updated, this context will also be updated.
if (parentContext && parentContext[contextSubscribable] && !ko.dependencyDetection.computed().hasAncestorDependency(parentContext[contextSubscribable])) {
parentContext[contextSubscribable]();
}
if (dataDependency) {
self[contextDataDependency] = dataDependency;
}
return self['$data'];
}
var self = this,
shouldInheritData = dataItemOrAccessor === inheritParentVm,
realDataItemOrAccessor = shouldInheritData ? undefined : dataItemOrAccessor,
isFunc = typeof(realDataItemOrAccessor) == "function" && !ko.isObservable(realDataItemOrAccessor),
subscribable,
dataDependency = options && options['dataDependency'];
if (options && options['exportDependencies']) {
// The "exportDependencies" option means that the calling code will track any dependencies and re-create
// the binding context when they change.
updateContext();
} else {
subscribable = ko.pureComputed(updateContext);
subscribable.peek();
// At this point, the binding context has been initialized, and the "subscribable" computed observable is
// subscribed to any observables that were accessed in the process. If there is nothing to track, the
// computed will be inactive, and we can safely throw it away. If it's active, the computed is stored in
// the context object.
if (subscribable.isActive()) {
// Always notify because even if the model ($data) hasn't changed, other context properties might have changed
subscribable['equalityComparer'] = null;
} else {
self[contextSubscribable] = undefined;
// Extend the binding context hierarchy with a new view model object. If the parent context is watching
// any observables, the new child context will automatically get a dependency on the parent context.
// But this does not mean that the $data value of the child context will also get updated. If the child
// view model also depends on the parent view model, you must provide a function that returns the correct
// view model on each update.
'createChildContext'(dataItemOrAccessor, dataItemAlias, extendCallback, options) {
if (!options && dataItemAlias && typeof dataItemAlias == "object") {
options = dataItemAlias;
dataItemAlias = options['as'];
extendCallback = options['extend'];
}
}
}
// Extend the binding context hierarchy with a new view model object. If the parent context is watching
// any observables, the new child context will automatically get a dependency on the parent context.
// But this does not mean that the $data value of the child context will also get updated. If the child
// view model also depends on the parent view model, you must provide a function that returns the correct
// view model on each update.
ko.bindingContext.prototype['createChildContext'] = function (dataItemOrAccessor, dataItemAlias, extendCallback, options) {
if (!options && dataItemAlias && typeof dataItemAlias == "object") {
options = dataItemAlias;
dataItemAlias = options['as'];
extendCallback = options['extend'];
}
if (dataItemAlias && options && options['noChildContext']) {
var isFunc = typeof(dataItemOrAccessor) == "function" && !ko.isObservable(dataItemOrAccessor);
return new ko.bindingContext(inheritParentVm, this, null, self => {
if (extendCallback)
extendCallback(self);
self[dataItemAlias] = isFunc ? dataItemOrAccessor() : dataItemOrAccessor;
}, options);
}
if (dataItemAlias && options && options['noChildContext']) {
var isFunc = typeof(dataItemOrAccessor) == "function" && !ko.isObservable(dataItemOrAccessor);
return new ko.bindingContext(inheritParentVm, this, null, self => {
return new ko.bindingContext(dataItemOrAccessor, this, dataItemAlias, (self, parentContext) => {
// Extend the context hierarchy by setting the appropriate pointers
self['$parentContext'] = parentContext;
self['$parent'] = parentContext['$data'];
self['$parents'] = (parentContext['$parents'] || []).slice(0);
self['$parents'].unshift(self['$parent']);
if (extendCallback)
extendCallback(self);
self[dataItemAlias] = isFunc ? dataItemOrAccessor() : dataItemOrAccessor;
}, options);
}
return new ko.bindingContext(dataItemOrAccessor, this, dataItemAlias, (self, parentContext) => {
// Extend the context hierarchy by setting the appropriate pointers
self['$parentContext'] = parentContext;
self['$parent'] = parentContext['$data'];
self['$parents'] = (parentContext['$parents'] || []).slice(0);
self['$parents'].unshift(self['$parent']);
if (extendCallback)
extendCallback(self);
}, options);
};
// Extend the binding context with new custom properties. This doesn't change the context hierarchy.
// Similarly to "child" contexts, provide a function here to make sure that the correct values are set
// when an observable view model is updated.
ko.bindingContext.prototype['extend'] = function(properties, options) {
return new ko.bindingContext(inheritParentVm, this, null, self =>
ko.utils.extend(self, typeof(properties) == "function" ? properties(self) : properties)
, options);
// Extend the binding context with new custom properties. This doesn't change the context hierarchy.
// Similarly to "child" contexts, provide a function here to make sure that the correct values are set
// when an observable view model is updated.
'extend'(properties, options) {
return new ko.bindingContext(inheritParentVm, this, null, self =>
ko.utils.extend(self, typeof(properties) == "function" ? properties(self) : properties)
, options);
}
};
var boundElementDomDataKey = ko.utils.domData.nextKey();
@ -154,41 +153,44 @@
asyncContext.notifyAncestor();
}
}
function AsyncCompleteContext(node, bindingInfo, ancestorBindingInfo) {
this.node = node;
this.bindingInfo = bindingInfo;
this.asyncDescendants = [];
this.childrenComplete = false;
if (!bindingInfo.asyncContext) {
ko.utils.domNodeDisposal.addDisposeCallback(node, asyncContextDispose);
class AsyncCompleteContext {
constructor(node, bindingInfo, ancestorBindingInfo) {
this.node = node;
this.bindingInfo = bindingInfo;
this.asyncDescendants = new Set;
this.childrenComplete = false;
if (!bindingInfo.asyncContext) {
ko.utils.domNodeDisposal.addDisposeCallback(node, asyncContextDispose);
}
if (ancestorBindingInfo && ancestorBindingInfo.asyncContext) {
ancestorBindingInfo.asyncContext.asyncDescendants.add(node);
this.ancestorBindingInfo = ancestorBindingInfo;
}
}
if (ancestorBindingInfo && ancestorBindingInfo.asyncContext) {
ancestorBindingInfo.asyncContext.asyncDescendants.push(node);
this.ancestorBindingInfo = ancestorBindingInfo;
notifyAncestor() {
if (this.ancestorBindingInfo && this.ancestorBindingInfo.asyncContext) {
this.ancestorBindingInfo.asyncContext.descendantComplete(this.node);
}
}
descendantComplete(node) {
this.asyncDescendants.delete(node);
if (!this.asyncDescendants.size && this.childrenComplete) {
this.completeChildren();
}
}
completeChildren() {
this.childrenComplete = true;
if (this.bindingInfo.asyncContext && !this.asyncDescendants.size) {
this.bindingInfo.asyncContext = null;
ko.utils.domNodeDisposal.removeDisposeCallback(this.node, asyncContextDispose);
ko.bindingEvent.notify(this.node, ko.bindingEvent.descendantsComplete);
this.notifyAncestor();
}
}
}
AsyncCompleteContext.prototype.notifyAncestor = function () {
if (this.ancestorBindingInfo && this.ancestorBindingInfo.asyncContext) {
this.ancestorBindingInfo.asyncContext.descendantComplete(this.node);
}
};
AsyncCompleteContext.prototype.descendantComplete = function (node) {
ko.utils.arrayRemoveItem(this.asyncDescendants, node);
if (!this.asyncDescendants.length && this.childrenComplete) {
this.completeChildren();
}
};
AsyncCompleteContext.prototype.completeChildren = function () {
this.childrenComplete = true;
if (this.bindingInfo.asyncContext && !this.asyncDescendants.length) {
this.bindingInfo.asyncContext = null;
ko.utils.domNodeDisposal.removeDisposeCallback(this.node, asyncContextDispose);
ko.bindingEvent.notify(this.node, ko.bindingEvent.descendantsComplete);
this.notifyAncestor();
}
};
ko.bindingEvent = {
childrenComplete: "childrenComplete",
@ -310,7 +312,7 @@
cyclicDependencyStack = []; // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it
ko.utils.objectForEach(bindings, function pushBinding(bindingKey) {
if (!bindingsConsidered[bindingKey]) {
var binding = ko['getBindingHandler'](bindingKey);
var binding = ko.bindingHandlers[bindingKey];
if (binding) {
// First add dependencies (if any) of the current binding
if (binding['after']) {

View file

@ -1,22 +1,7 @@
(() => {
const defaultBindingAttributeName = "data-bind",
bindingCache = {},
createBindingsStringEvaluatorViaCache = (bindingsString, cache, options) => {
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
return cache[cacheKey]
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
},
createBindingsStringEvaluator = (bindingsString, options) => {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
return new Function("$context", "$element", functionBody);
},
bindingCache = new Map,
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
@ -26,18 +11,6 @@
case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
}
return null;
},
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
parseBindingsString = (bindingsString, bindingContext, node, options) => {
try {
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, bindingCache, options);
return bindingFunction(bindingContext, node);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message;
throw ex;
}
};
ko.bindingProvider = new class
@ -53,8 +26,29 @@
}
getBindingAccessors(node, bindingContext) {
var bindingsString = getBindingsString(node, bindingContext);
return bindingsString ? parseBindingsString(bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
var bindingsString = getBindingsString(node);
if (bindingsString) {
try {
let options = { 'valueAccessors': true },
cacheKey = bindingsString,
bindingFunction = bindingCache.get(cacheKey);
if (!bindingFunction) {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
bindingFunction = new Function("$context", "$element", functionBody);
bindingCache.set(cacheKey, bindingFunction);
}
return bindingFunction(bindingContext, node);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString
+ "\nMessage: " + ex.message;
throw ex;
}
}
return null;
}
};

View file

@ -37,4 +37,4 @@ ko.bindingHandlers['hasfocus'] = {
}
}
};
ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
ko.expressionRewriting.twoWayBindings.add('hasfocus');

View file

@ -62,7 +62,7 @@ ko.bindingHandlers['textInput'] = {
ko.computed(updateView, { disposeWhenNodeIsRemoved: element });
}
};
ko.expressionRewriting.twoWayBindings['textInput'] = true;
ko.expressionRewriting.twoWayBindings.add('textInput');
// textinput is an alias for textInput
ko.bindingHandlers['textinput'] = {

View file

@ -9,20 +9,18 @@ ko.bindingHandlers['value'] = {
return;
}
var eventsToCatch = [];
var eventsToCatch = new Set;
var requestedEventsToCatch = allBindings.get("valueUpdate");
var elementValueBeforeEvent = null;
if (requestedEventsToCatch) {
// Allow both individual event names, and arrays of event names
if (typeof requestedEventsToCatch == "string") {
eventsToCatch = [requestedEventsToCatch];
eventsToCatch.add(requestedEventsToCatch);
} else {
eventsToCatch = requestedEventsToCatch ? requestedEventsToCatch.filter((item, index) =>
requestedEventsToCatch.indexOf(item) === index
) : [];
requestedEventsToCatch.forEach(item => eventsToCatch.add(item));
}
ko.utils.arrayRemoveItem(eventsToCatch, "change"); // We'll subscribe to "change" events later
eventsToCatch.delete("change"); // We'll subscribe to "change" events later
}
var valueUpdateHandler = () => {
@ -113,4 +111,4 @@ ko.bindingHandlers['value'] = {
},
'update': () => {} // Keep for backwards compatibility with code that may have wrapped value binding
};
ko.expressionRewriting.twoWayBindings['value'] = true;
ko.expressionRewriting.twoWayBindings.add('value');

View file

@ -58,7 +58,8 @@ ko.expressionRewriting = (() => {
var result = [], toks = str.match(bindingToken), key, values = [], depth = 0;
if (toks.length > 1) {
for (var i = 0, tok; tok = toks[i]; ++i) {
var i = 0, tok;
while ((tok = toks[i++])) {
var c = tok.charCodeAt(0);
// A comma signals the end of a key/value pair if depth is zero
if (c === 44) { // ","
@ -108,7 +109,7 @@ ko.expressionRewriting = (() => {
}
// Two-way bindings include a write function that allow the handler to update the value even if it's not an observable.
var twoWayBindings = {};
var twoWayBindings = new Set;
function preProcessBindings(bindingsStringOrKeyValueArray, bindingOptions) {
bindingOptions = bindingOptions || {};
@ -119,14 +120,13 @@ ko.expressionRewriting = (() => {
return (obj && obj['preprocess']) ? (val = obj['preprocess'](val, key, processKeyValue)) : true;
}
if (!bindingParams) {
if (!callPreprocessHook(ko['getBindingHandler'](key)))
if (!callPreprocessHook(ko.bindingHandlers[key]))
return;
if (twoWayBindings[key] && (writableVal = getWriteableValue(val))) {
if (twoWayBindings.has(key) && (writableVal = getWriteableValue(val))) {
// For two-way bindings, provide a write method in case the value
// isn't a writable observable.
var writeKey = typeof twoWayBindings[key] == 'string' ? twoWayBindings[key] : key;
propertyAccessorResultStrings.push("'" + writeKey + "':function(_z){" + writableVal + "=_z}");
propertyAccessorResultStrings.push("'" + key + "':function(_z){" + writableVal + "=_z}");
}
}
// Values are wrapped in a function so that each value can be accessed independently

View file

@ -1,49 +1,44 @@
(() => {
ko.dependencyDetection = (() => {
var outerFrames = [],
currentFrame,
lastId = 0,
var outerFrames = [],
currentFrame,
lastId = 0,
begin = options => {
outerFrames.push(currentFrame);
currentFrame = options;
},
begin = options => {
outerFrames.push(currentFrame);
currentFrame = options;
},
end = () => currentFrame = outerFrames.pop();
end = () => currentFrame = outerFrames.pop();
return {
begin: begin,
ko.dependencyDetection = {
begin: begin,
end: end,
end: end,
registerDependency: subscribable => {
if (currentFrame) {
if (!ko.isSubscribable(subscribable))
throw new Error("Only subscribable things can act as dependencies");
currentFrame.callback.call(currentFrame.callbackTarget, subscribable,
subscribable._id || (subscribable._id = ++lastId));
}
},
ignore: (callback, callbackTarget, callbackArgs) => {
try {
begin();
return callback.apply(callbackTarget, callbackArgs || []);
} finally {
end();
}
},
getDependenciesCount: () => {
return currentFrame && currentFrame.computed.getDependenciesCount();
},
isInitial: () => {
return currentFrame && currentFrame.isInitial;
},
computed: () => {
return currentFrame && currentFrame.computed;
registerDependency: subscribable => {
if (currentFrame) {
if (!ko.isSubscribable(subscribable))
throw new Error("Only subscribable things can act as dependencies");
currentFrame.callback.call(currentFrame.callbackTarget, subscribable,
subscribable._id || (subscribable._id = ++lastId));
}
};
},
ignore: (callback, callbackTarget, callbackArgs) => {
try {
begin();
return callback.apply(callbackTarget, callbackArgs || []);
} finally {
end();
}
},
getDependenciesCount: () => currentFrame && currentFrame.computed.getDependenciesCount(),
isInitial: () => currentFrame && currentFrame.isInitial,
computed: () => currentFrame && currentFrame.computed
};
})();

View file

@ -35,18 +35,15 @@ ko.computed = (evaluatorFunctionOrOptions, options) => {
function computedObservable() {
if (arguments.length > 0) {
if (typeof writeFunction === "function") {
// Writing a value
writeFunction(...arguments);
} else {
if (typeof writeFunction !== "function") {
throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
}
// Writing a value
writeFunction(...arguments);
return this; // Permits chained assignments
} else {
// Reading the value
if (!state.isDisposed) {
ko.dependencyDetection.registerDependency(computedObservable);
}
state.isDisposed || ko.dependencyDetection.registerDependency(computedObservable);
if (state.isDirty || (state.isSleeping && computedObservable.haveDependenciesChanged())) {
computedObservable.evaluateImmediate();
}
@ -132,23 +129,23 @@ function computedBeginDependencyDetectionCallback(subscribable, id) {
}
function evaluateImmediate_CallReadThenEndDependencyDetection(state, dependencyDetectionContext) {
// This function is really part of the evaluateImmediate_CallReadWithDependencyDetection logic.
// You'd never call it from anywhere else. Factoring it out means that evaluateImmediate_CallReadWithDependencyDetection
// can be independent of try/finally blocks, which contributes to saving about 40% off the CPU
// overhead of computed evaluation (on V8 at least).
// This function is really part of the evaluateImmediate_CallReadWithDependencyDetection logic.
// You'd never call it from anywhere else. Factoring it out means that evaluateImmediate_CallReadWithDependencyDetection
// can be independent of try/finally blocks, which contributes to saving about 40% off the CPU
// overhead of computed evaluation (on V8 at least).
try {
return state.readFunction();
} finally {
ko.dependencyDetection.end();
try {
return state.readFunction();
} finally {
ko.dependencyDetection.end();
// For each subscription no longer being used, remove it from the active subscriptions list and dispose it
if (dependencyDetectionContext.disposalCount && !state.isSleeping) {
ko.utils.objectForEach(dependencyDetectionContext.disposalCandidates, computedDisposeDependencyCallback);
}
// For each subscription no longer being used, remove it from the active subscriptions list and dispose it
if (dependencyDetectionContext.disposalCount && !state.isSleeping) {
ko.utils.objectForEach(dependencyDetectionContext.disposalCandidates, computedDisposeDependencyCallback);
}
state.isStale = state.isDirty = false;
}
state.isStale = state.isDirty = false;
}
}
var computedFn = {
@ -170,12 +167,8 @@ var computedFn = {
return false;
}
var dependencies = this.getDependencies();
if (dependencies.includes(obs)) {
return true;
}
return !!dependencies.find(dep =>
dep.hasAncestorDependency && dep.hasAncestorDependency(obs)
);
return dependencies.includes(obs)
|| !!dependencies.find(dep => dep.hasAncestorDependency && dep.hasAncestorDependency(obs));
},
addDependencyTracking: function (id, target, trackingObj) {
if (this[computedState].pure && target === this) {

View file

@ -1,5 +1,5 @@
const observableLatestValue = Symbol('_latestValue'),
length = 'length';
length = 'length';
ko.observable = initialValue => {
function observable() {

View file

@ -12,26 +12,22 @@ ko.observableArray = initialValues => {
ko.observableArray['fn'] = {
'remove': function (valueOrPredicate) {
var underlyingArray = this.peek();
var removedValues = [];
var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
var removed = false;
var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate)
? valueOrPredicate : value => value === valueOrPredicate;
var i = underlyingArray.length;
while (i--) {
var value = underlyingArray[i];
if (predicate(value)) {
if (removedValues.length === 0) {
this.valueWillMutate();
}
if (underlyingArray[i] !== value) {
throw Error("Array modified during remove; cannot remove item");
}
removedValues.push(value);
removed || this.valueWillMutate();
removed = true;
underlyingArray.splice(i, 1);
}
}
if (removedValues.length) {
this.valueHasMutated();
}
return removedValues;
removed && this.valueHasMutated();
}
};

View file

@ -41,7 +41,8 @@ var defaultEvent = "change";
var ko_subscribable_fn = {
init: instance => {
instance._subscriptions = { "change": [] };
instance._subscriptions = new Map();
instance._subscriptions.set("change", new Set);
instance._versionNumber = 1;
},
@ -52,7 +53,7 @@ var ko_subscribable_fn = {
var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback;
var subscription = new koSubscription(self, boundCallback, () => {
ko.utils.arrayRemoveItem(self._subscriptions[event], subscription);
self._subscriptions.get(event).delete(subscription);
if (self.afterSubscriptionRemove)
self.afterSubscriptionRemove(event);
});
@ -60,9 +61,9 @@ var ko_subscribable_fn = {
if (self.beforeSubscriptionAdd)
self.beforeSubscriptionAdd(event);
if (!self._subscriptions[event])
self._subscriptions[event] = [];
self._subscriptions[event].push(subscription);
if (!self._subscriptions.has(event))
self._subscriptions.set(event, new Set);
self._subscriptions.get(event).add(subscription);
return subscription;
},
@ -73,16 +74,14 @@ var ko_subscribable_fn = {
this.updateVersion();
}
if (this.hasSubscriptionsForEvent(event)) {
var subs = event === defaultEvent && this._changeSubscriptions || this._subscriptions[event].slice(0);
var subs = event === defaultEvent && this._changeSubscriptions || new Set(this._subscriptions.get(event));
try {
ko.dependencyDetection.begin(); // Begin suppressing dependency detection (by setting the top frame to undefined)
var i = 0, subscription;
while ((subscription = subs[i++])) {
subs.forEach(subscription => {
// In case a subscription was disposed during the arrayForEach cycle, check
// for isDisposed on each subscription before invoking its callback
if (!subscription._isDisposed)
subscription._callback(valueToNotify);
}
subscription._isDisposed || subscription._callback(valueToNotify);
});
} finally {
ko.dependencyDetection.end(); // End suppressing dependency detection
}
@ -141,7 +140,7 @@ var ko_subscribable_fn = {
if (!isDirty || !self._notificationIsPending) {
didUpdate = !isDirty;
}
self._changeSubscriptions = self._subscriptions[defaultEvent].slice(0);
self._changeSubscriptions = new Set(self._subscriptions.get(defaultEvent));
self._notificationIsPending = ignoreBeforeChange = true;
pendingValue = value;
finish();
@ -163,7 +162,7 @@ var ko_subscribable_fn = {
},
hasSubscriptionsForEvent: function(event) {
return this._subscriptions[event] && this._subscriptions[event].length;
return (this._subscriptions.get(event) || []).size;
},
isDifferent: function(oldValue, newValue) {

View file

@ -66,5 +66,3 @@ ko.tasks = (() => {
return tasks;
})();
ko.exportSymbol('tasks', ko.tasks);

View file

@ -1,26 +1,27 @@
(() => {
ko.utils.domData = new (function () {
let uniqueId = 0,
dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now()),
dataStore = new WeakMap();
let uniqueId = 0,
dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now()),
dataStore = new WeakMap();
return {
get: (node, key) => (dataStore.get(node) || {})[key],
set: (node, key, value) => {
if (dataStore.has(node)) {
dataStore.get(node)[key] = value;
} else {
let dataForNode = {};
dataForNode[key] = value;
dataStore.set(node, dataForNode);
}
return value;
},
getOrSet: function(node, key, value) {
return this.get(node, key) || this.set(node, key, value);
},
clear: node => dataStore.delete(node),
ko.utils.domData = {
get: (node, key) => (dataStore.get(node) || {})[key],
set: (node, key, value) => {
if (dataStore.has(node)) {
dataStore.get(node)[key] = value;
} else {
let dataForNode = {};
dataForNode[key] = value;
dataStore.set(node, dataForNode);
}
return value;
},
getOrSet: function(node, key, value) {
return this.get(node, key) || this.set(node, key, value);
},
clear: node => dataStore.delete(node),
nextKey: () => (uniqueId++) + dataStoreKeyExpandoPropertyName
};
nextKey: () => (uniqueId++) + dataStoreKeyExpandoPropertyName
};
})();

View file

@ -6,22 +6,21 @@ ko.utils.domNodeDisposal = (() => {
const getDisposeCallbacksCollection = (node, createIfNotFound) => {
var allDisposeCallbacks = ko.utils.domData.get(node, domDataKey);
if ((allDisposeCallbacks === undefined) && createIfNotFound) {
allDisposeCallbacks = [];
if (createIfNotFound && !allDisposeCallbacks) {
allDisposeCallbacks = new Set;
ko.utils.domData.set(node, domDataKey, allDisposeCallbacks);
}
return allDisposeCallbacks;
},
destroyCallbacksCollection = node => ko.utils.domData.set(node, domDataKey, undefined),
destroyCallbacksCollection = node => ko.utils.domData.set(node, domDataKey, null),
cleanSingleNode = node => {
// Run all the dispose callbacks
var callbacks = getDisposeCallbacksCollection(node);
if (callbacks) {
callbacks = callbacks.slice(0); // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)
for (var i = 0; i < callbacks.length; i++)
callbacks[i](node);
// Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)
(new Set(callbacks)).forEach(callback => callback(node));
}
// Erase the DOM data
@ -49,14 +48,14 @@ ko.utils.domNodeDisposal = (() => {
addDisposeCallback : (node, callback) => {
if (typeof callback != "function")
throw new Error("Callback must be a function");
getDisposeCallbacksCollection(node, 1).push(callback);
getDisposeCallbacksCollection(node, 1).add(callback);
},
removeDisposeCallback : (node, callback) => {
var callbacksCollection = getDisposeCallbacksCollection(node);
if (callbacksCollection) {
ko.utils.arrayRemoveItem(callbacksCollection, callback);
callbacksCollection.length || destroyCallbacksCollection(node);
callbacksCollection.delete(callback);
callbacksCollection.size || destroyCallbacksCollection(node);
}
},

View file

@ -1,14 +1,4 @@
ko.utils = {
arrayRemoveItem: (array, itemToRemove) => {
var index = array.indexOf(itemToRemove);
if (index > 0) {
array.splice(index, 1);
}
else if (index === 0) {
array.shift();
}
},
extend: (target, source) => {
source && Object.entries(source).forEach(prop => target[prop[0]] = prop[1]);
return target;
@ -26,11 +16,7 @@ ko.utils = {
return target;
},
emptyDomNode: domNode => {
while (domNode.firstChild) {
ko.removeNode(domNode.firstChild);
}
},
emptyDomNode: domNode => [...domNode.childNodes].forEach(child => ko.removeNode(child)),
moveCleanedNodesToContainerElement: nodes => {
// Ensure it's a real array, as we're about to reparent the nodes and
@ -133,11 +119,8 @@ ko.utils = {
throw error;
}, 0),
registerEventHandler: (element, eventType, handler) => {
var wrappedHandler = ko.utils.catchFunctionErrors(handler);
element.addEventListener(eventType, wrappedHandler, false);
},
registerEventHandler: (element, eventType, handler) =>
element.addEventListener(eventType, ko.utils.catchFunctionErrors(handler), false),
triggerEvent: (element, eventType) => {
if (!(element && element.nodeType))

View file

@ -1,3 +1 @@
ko.version = "##VERSION##";
ko.exportSymbol('version', ko.version);
ko.exportSymbol('version', "##VERSION##");

View file

@ -31,15 +31,14 @@
while (currentNode = currentNode.nextSibling) {
if (isEndComment(currentNode)) {
ko.utils.domData.set(currentNode, matchedEndCommentDataKey, true);
depth--;
if (depth === 0)
if (!--depth)
return children;
}
children.push(currentNode);
if (isStartComment(currentNode))
depth++;
++depth;
}
if (!allowUnbalanced)
throw new Error("Cannot find closing comment tag to match: " + startComment.nodeValue);
@ -49,9 +48,9 @@
function getMatchingEndComment(startComment, allowUnbalanced) {
var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced);
if (allVirtualChildren) {
if (allVirtualChildren.length > 0)
return allVirtualChildren[allVirtualChildren.length - 1].nextSibling;
return startComment.nextSibling;
return (allVirtualChildren.length
? allVirtualChildren[allVirtualChildren.length - 1]
: startComment).nextSibling;
}
return null; // Must have no matching end comment, and allowUnbalanced is true
}
@ -64,8 +63,7 @@
emptyNode: node => {
if (isStartComment(node)) {
var virtualChildren = getVirtualChildren(node);
for (var i = 0, j = virtualChildren.length; i < j; i++)
ko.removeNode(virtualChildren[i]);
virtualChildren && [...virtualChildren].forEach(child => ko.removeNode(child));
} else
ko.utils.emptyDomNode(node);
},
@ -73,64 +71,48 @@
setDomNodeChildren: (node, childNodes) => {
if (isStartComment(node)) {
ko.virtualElements.emptyNode(node);
var endCommentNode = node.nextSibling; // Must be the next sibling, as we just emptied the children
for (var i = 0, j = childNodes.length; i < j; i++)
endCommentNode.parentNode.insertBefore(childNodes[i], endCommentNode);
node.after(...childNodes);
} else
ko.utils.setDomNodeChildren(node, childNodes);
},
prepend: (containerNode, nodeToPrepend) => {
var insertBeforeNode;
if (isStartComment(containerNode)) {
// Start comments must always have a parent and at least one following sibling (the end comment)
insertBeforeNode = containerNode.nextSibling;
containerNode = containerNode.parentNode;
} else {
insertBeforeNode = containerNode.firstChild;
}
containerNode.insertBefore(nodeToPrepend, insertBeforeNode);
// Start comments must always have a parent and at least one following sibling (the end comment)
isStartComment(containerNode)
? containerNode.nextSibling.before(nodeToPrepend)
: containerNode.prepend(nodeToPrepend);
},
insertAfter: (containerNode, nodeToInsert, insertAfterNode) => {
if (insertAfterNode) {
// Children of start comments must always have a parent and at least one following sibling (the end comment)
var insertBeforeNode = insertAfterNode.nextSibling;
if (isStartComment(containerNode)) {
containerNode = containerNode.parentNode;
}
containerNode.insertBefore(nodeToInsert, insertBeforeNode);
} else {
ko.virtualElements.prepend(containerNode, nodeToInsert);
}
insertAfterNode
? insertAfterNode.after(nodeToInsert)
: ko.virtualElements.prepend(containerNode, nodeToInsert);
},
firstChild: node => {
if (isStartComment(node)) {
return (!node.nextSibling || isEndComment(node.nextSibling)) ? null : node.nextSibling;
let next = node.nextSibling;
return (!next || isEndComment(next)) ? null : next;
}
if (node.firstChild && isEndComment(node.firstChild)) {
let first = node.firstChild;
if (first && isEndComment(first)) {
throw new Error("Found invalid end comment, as the first child of " + node);
}
return node.firstChild;
return first;
},
nextSibling: node => {
if (isStartComment(node)) {
node = getMatchingEndComment(node);
}
if (node.nextSibling && isEndComment(node.nextSibling)) {
if (isUnmatchedEndComment(node.nextSibling)) {
let next = node.nextSibling;
if (next && isEndComment(next)) {
if (isUnmatchedEndComment(next)) {
throw Error("Found end comment without a matching opening comment, as child of " + node);
}
return null;
}
return node.nextSibling;
return next;
},
hasBindingValue: isStartComment,