mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
KnockoutJS to ES2015/ES6
TODO: use the new Proxy for ko.observable
This commit is contained in:
parent
a0f8ac0dad
commit
72ed2b08b2
56 changed files with 941 additions and 1873 deletions
18
README.md
18
README.md
|
|
@ -106,22 +106,22 @@ RainLoop 1.14 vs SnappyMail
|
|||
|
||||
|js/* |RainLoop |Snappy |
|
||||
|----------- |--------: |--------: |
|
||||
|admin.js |2.130.942 | 776.615 |
|
||||
|app.js |4.184.455 |2.430.639 |
|
||||
|admin.js |2.130.942 | 774.301 |
|
||||
|app.js |4.184.455 |2.424.578 |
|
||||
|boot.js | 671.522 | 5.285 |
|
||||
|libs.js | 647.614 | 255.041 |
|
||||
|libs.js | 647.614 | 249.953 |
|
||||
|polyfills.js | 325.834 | 0 |
|
||||
|TOTAL |7.960.367 |3.467.580 |
|
||||
|TOTAL |7.960.367 |3.454.117 |
|
||||
|
||||
|js/min/* |RainLoop |Snappy |Rain gzip |gzip |brotli |
|
||||
|--------------- |--------: |--------: |--------: |--------: |--------: |
|
||||
|admin.min.js | 252.147 | 104.046 | 73.657 | 27.739 | 24.058 |
|
||||
|app.min.js | 511.202 | 329.887 |140.462 | 84.844 | 68.843 |
|
||||
|admin.min.js | 252.147 | 103.761 | 73.657 | 27.632 | 24.004 |
|
||||
|app.min.js | 511.202 | 328.005 |140.462 | 84.451 | 68.571 |
|
||||
|boot.min.js | 66.007 | 2.935 | 22.567 | 1.510 | 1.285 |
|
||||
|libs.min.js | 572.545 | 149.712 |176.720 | 52.703 | 46.853 |
|
||||
|libs.min.js | 572.545 | 144.650 |176.720 | 51.765 | 46.049 |
|
||||
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 | 0 |
|
||||
|TOTAL |1.434.353 | 586.580 |424.718 |166.796 |141.039 |
|
||||
|TOTAL (no admin) |1.182.206 | 482.534 |351.061 |139.057 |116.981 |
|
||||
|TOTAL |1.434.353 | 579.351 |424.718 |165.358 |139.909 |
|
||||
|TOTAL (no admin) |1.182.206 | 475.590 |351.061 |137.726 |115.905 |
|
||||
|
||||
For a user its around 60% smaller and faster than traditional RainLoop.
|
||||
|
||||
|
|
|
|||
4
vendors/knockout/Gruntfile.js
vendored
4
vendors/knockout/Gruntfile.js
vendored
|
|
@ -109,8 +109,8 @@ module.exports = function(grunt) {
|
|||
function buildMin(output, done) {
|
||||
var cc = require('closure-compiler');
|
||||
var options = {
|
||||
// language_in:'ECMASCRIPT6', // BROKEN!!
|
||||
// language_out:'ECMASCRIPT6',
|
||||
language_in:'ECMASCRIPT6', // BROKEN!!
|
||||
language_out:'ECMASCRIPT6',
|
||||
compilation_level: 'ADVANCED_OPTIMIZATIONS',
|
||||
output_wrapper: '(function() {%output%})();'
|
||||
};
|
||||
|
|
|
|||
7
vendors/knockout/README.md
vendored
7
vendors/knockout/README.md
vendored
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
**Knockout** is a JavaScript [MVVM](http://en.wikipedia.org/wiki/Model_View_ViewModel) (a modern variant of MVC) library that makes it easier to create rich, desktop-like user interfaces with JavaScript and HTML. It uses *observers* to make your UI automatically stay in sync with an underlying data model, along with a powerful and extensible set of *declarative bindings* to enable productive development.
|
||||
|
||||
## SnappyMail Modifications
|
||||
|
||||
Knockout has a high level of backward compatibility. We don't use it, so a lot of IE code is stripped.
|
||||
|
||||
npm closure-compiler is old and broken for ES2015/ES6, so we use the new google-closure-compiler.
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
[](https://gitter.im/knockout/knockout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
|
|
|||
|
|
@ -27,23 +27,23 @@ knockoutDebugCallback([
|
|||
'src/components/customElements.js',
|
||||
'src/components/componentBinding.js',
|
||||
'src/binding/defaultBindings/attr.js',
|
||||
'src/binding/defaultBindings/checked.js',
|
||||
// 'src/binding/defaultBindings/checked.js',
|
||||
'src/binding/defaultBindings/css.js',
|
||||
'src/binding/defaultBindings/enableDisable.js',
|
||||
'src/binding/defaultBindings/event.js',
|
||||
'src/binding/defaultBindings/foreach.js',
|
||||
'src/binding/defaultBindings/hasfocus.js',
|
||||
'src/binding/defaultBindings/html.js',
|
||||
'src/binding/defaultBindings/ifIfnotWith.js',
|
||||
'src/binding/defaultBindings/let.js',
|
||||
// 'src/binding/defaultBindings/ifIfnotWith.js',
|
||||
// 'src/binding/defaultBindings/let.js',
|
||||
'src/binding/defaultBindings/options.js',
|
||||
'src/binding/defaultBindings/selectedOptions.js',
|
||||
// 'src/binding/defaultBindings/selectedOptions.js',
|
||||
'src/binding/defaultBindings/style.js',
|
||||
'src/binding/defaultBindings/submit.js',
|
||||
'src/binding/defaultBindings/text.js',
|
||||
'src/binding/defaultBindings/textInput.js',
|
||||
'src/binding/defaultBindings/uniqueName.js',
|
||||
'src/binding/defaultBindings/using.js',
|
||||
// 'src/binding/defaultBindings/uniqueName.js',
|
||||
// 'src/binding/defaultBindings/using.js',
|
||||
'src/binding/defaultBindings/value.js',
|
||||
'src/binding/defaultBindings/visibleHidden.js',
|
||||
// click depends on event - The order matters for specs, which includes each file individually
|
||||
|
|
|
|||
1233
vendors/knockout/build/output/knockout-latest.debug.js
vendored
1233
vendors/knockout/build/output/knockout-latest.debug.js
vendored
File diff suppressed because it is too large
Load diff
214
vendors/knockout/build/output/knockout-latest.js
vendored
214
vendors/knockout/build/output/knockout-latest.js
vendored
|
|
@ -4,114 +4,106 @@
|
|||
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
(function() {(function(p){var D=this||(0,eval)("this"),E=D.document,H=D.jQuery;H||"undefined"===typeof jQuery||(H=jQuery);(function(p){"function"===typeof define&&define.amd?define(["exports","require"],p):"object"===typeof exports&&"object"===typeof module?p(module.exports||exports):p(D.ko={})})(function(H,O){function J(a,c){return null===a||typeof a in R?a===c:!1}function S(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=p;b()},c))}}function T(b,c){var d;return function(){clearTimeout(d);d=a.a.setTimeout(b,
|
||||
c)}}function U(a,c){c&&"change"!==c?"beforeChange"===c?this.ic(a):this.bb(a,c):this.jc(a)}function V(a,c){null!==c&&c.s&&c.s()}function W(a,c){var d=this.ad,e=d[r];e.pa||(this.Kb&&this.ib[c]?(d.nc(c,a,this.ib[c]),this.ib[c]=null,--this.Kb):e.F[c]||d.nc(c,a,e.G?{$:a}:d.Nc(a)),a.Ca&&a.Sc())}var a="undefined"!==typeof H?H:{};a.b=function(b,c){for(var d=b.split("."),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.I=function(a,c,d){a[c]=d};a.version="3.5.1-pre";a.b("version",a.version);a.options=
|
||||
{deferUpdates:!1,foreachHidesDestroyed:!1};a.a=function(){function b(a,b,c,d){return Array.prototype[a].call(b,c,d)}function c(a,b){b&&Object.entries(b).forEach(function(b){a[b[0]]=b[1]});return a}function d(a,b){a.__proto__=b;return a}var e={__proto__:[]}instanceof Array;return{K:function(a,c,d){b("forEach",a,c,d)},N:function(a,c){return b("indexOf",a,c)},Gb:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d,a))return a[d];return p},Ia:function(b,c){var d=a.a.N(b,c);0<d?b.splice(d,
|
||||
1):0===d&&b.shift()},fb:function(a,c,d){return a?b("filter",a,c,d):[]},Hb:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,d=b.length;c<d;c++)a.push(b[c]);return a},va:e,extend:c,setPrototypeOf:d,wb:e?d:c,M:function(a,b){a&&Object.entries(a).forEach(function(a){b(a[0],a[1])})},za:function(a,b,c){if(!a)return a;var d={};Object.entries(a).forEach(function(e){d[e[0]]=b.call(c,e[1],e[0],a)});return d},Nb:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},Sb:function(b){var c=
|
||||
a.a.ya(b),d=(c[0]&&c[0].ownerDocument||E).createElement("div");b.forEach(function(b){d.append(a.ma(b))});return d},La:function(c,d){return b("map",c,d?function(b){return a.ma(b.cloneNode(!0))}:function(a){return a.cloneNode(!0)})},sa:function(b,c){a.a.Nb(b);c&&b.append.apply(b,c)},Lc:function(b,c){var d=b.nodeType?[b]:b;if(0<d.length){var e=d[0],h=e.parentNode,m,n;m=0;for(n=c.length;m<n;m++)h.insertBefore(c[m],e);m=0;for(n=d.length;m<n;m++)a.removeNode(d[m])}},Oa:function(a,b){if(a.length){for(b=
|
||||
8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)a.length--;if(1<a.length){var c=a[0],d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),c=c.nextSibling;a.push(d)}}return a},ac:function(a){return null===a||a===p?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Bd:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},fd:function(a,b){return b.contains(1!==a.nodeType?a.parentNode:a)},
|
||||
Mb:function(b){return a.a.fd(b,b.ownerDocument.documentElement)},Vc:function(b){return!!a.a.Gb(b,a.a.Mb)},fa:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},sc:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.sc(b),c)},xc:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0)},H:function(b,c,d){b.addEventListener(c,a.a.sc(d),!1)},Ab:function(a,b){if(!a||
|
||||
!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(b))},f:function(b){return a.U(b)?b():b},Wb:function(b){return a.U(b)?b.w():b},zb:function(a,b,c){if(b){var d=c?"add":"remove";b.split(/\s+/).forEach(function(b){a.classList[d](b)})}},xb:function(b,c){var d=a.a.f(c);if(null===d||d===p)d="";var e=a.g.firstChild(b);!e||3!=e.nodeType||a.g.nextSibling(e)?a.g.sa(b,[b.ownerDocument.createTextNode(d)]):e.data=d},ya:function(a){return Array.from(a)}}}();
|
||||
a.b("utils",a.a);a.b("utils.arrayForEach",a.a.K);a.b("utils.arrayFirst",a.a.Gb);a.b("utils.arrayFilter",a.a.fb);a.b("utils.arrayIndexOf",a.a.N);a.b("utils.arrayPushAll",a.a.Hb);a.b("utils.arrayRemoveItem",a.a.Ia);a.b("utils.cloneNodes",a.a.La);a.b("utils.extend",a.a.extend);a.b("utils.objectMap",a.a.za);a.b("utils.peekObservable",a.a.Wb);a.b("utils.registerEventHandler",a.a.H);a.b("utils.stringifyJson",a.a.Gd);a.b("utils.toggleDomNodeCssClass",a.a.zb);a.b("utils.triggerEvent",a.a.Ab);a.b("utils.unwrapObservable",
|
||||
a.a.f);a.b("utils.objectForEach",a.a.M);a.b("utils.setTextContent",a.a.xb);a.b("unwrap",a.a.f);a.a.h=new function(){var a=0,c="__ko__"+Date.now(),d;d=function(a,b){var d=a[c];!d&&b&&(d=a[c]={});return d};return{get:function(a,b){var c=d(a,!1);return c&&c[b]},set:function(a,b,c){(a=d(a,c!==p))&&(a[b]=c)},Ob:function(a,b,c){a=d(a,!0);return a[b]||(a[b]=c)},clear:function(a){return a[c]?(delete a[c],!0):!1},ea:function(){return a++ +c}}};a.b("utils.domData",a.a.h);a.b("utils.domData.clear",a.a.h.clear);
|
||||
a.a.P=new function(){function b(b,c){var d=a.a.h.get(b,e);d===p&&c&&(d=[],a.a.h.set(b,e,d));return d}function c(c){var e=b(c,!1);if(e)for(var e=e.slice(0),h=0;h<e.length;h++)e[h](c);a.a.h.clear(c);g[c.nodeType]&&d(c.childNodes,!0)}function d(b,d){for(var e=[],f,n=0;n<b.length;n++)if(!d||8===b[n].nodeType)if(c(e[e.length]=f=b[n]),b[n]!==f)for(;n--&&-1==a.a.N(e,b[n]););}var e=a.a.h.ea(),f={1:!0,8:!0,9:!0},g={1:!0,9:!0};return{Ga:function(a,c){if("function"!=typeof c)throw Error("Callback must be a function");
|
||||
b(a,!0).push(c)},ub:function(c,d){var h=b(c,!1);h&&(a.a.Ia(h,d),0==h.length&&a.a.h.set(c,e,p))},ma:function(b){a.u.C(function(){f[b.nodeType]&&(c(b),g[b.nodeType]&&d(b.getElementsByTagName("*")))});return b},removeNode:function(b){a.ma(b);b.parentNode&&b.parentNode.removeChild(b)}}};a.ma=a.a.P.ma;a.removeNode=a.a.P.removeNode;a.b("cleanNode",a.ma);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.P);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.P.Ga);a.b("utils.domNodeDisposal.removeDisposeCallback",
|
||||
a.a.P.ub);(function(){var b=[0,"",""],c=[1,"<table>","</table>"],d=[3,"<table><tbody><tr>","</tr></tbody></table>"],e=[1,"<select multiple='multiple'>","</select>"],f={thead:c,tbody:c,tfoot:c,tr:[2,"<table><tbody>","</tbody></table>"],td:d,th:d,option:e,optgroup:e};a.a.Ua=function(c,d){var e=d;e||(e=E);var h=e.parentWindow||e.defaultView||D,m=a.a.ac(c).toLowerCase(),e=e.createElement("div"),n;n=(m=m.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&f[m[1]]||b;m=n[0];n="ignored<div>"+n[1]+c+n[2]+
|
||||
"</div>";for("function"==typeof h.innerShiv?e.append(h.innerShiv(n)):e.innerHTML=n;m--;)e=e.lastChild;return a.a.ya(e.lastChild.childNodes)};a.a.wd=function(b,c){var d=a.a.Ua(b,c);return d.length&&d[0].parentElement||a.a.Sb(d)};a.a.$b=function(b,c){a.a.Nb(b);c=a.a.f(c);if(null!==c&&c!==p){"string"!=typeof c&&(c=c.toString());for(var d=a.a.Ua(c,b.ownerDocument),e=0;e<d.length;e++)b.appendChild(d[e])}}})();a.b("utils.parseHtmlFragment",a.a.Ua);a.b("utils.setHtml",a.a.$b);a.Y=function(){function b(c,
|
||||
e){if(c)if(8==c.nodeType){var f=a.Y.Ic(c.nodeValue);null!=f&&e.push({ed:c,sd:f})}else if(1==c.nodeType)for(var f=0,g=c.childNodes,k=g.length;f<k;f++)b(g[f],e)}var c={};return{Rb:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},Oc:function(a,b){var f=c[a];if(f===p)throw Error("Couldn't find any memo with ID "+
|
||||
a+". Perhaps it's already been unmemoized.");try{return f.apply(null,b||[]),!0}finally{delete c[a]}},Pc:function(c,e){var f=[];b(c,f);for(var g=0,k=f.length;g<k;g++){var l=f[g].ed,h=[l];e&&a.a.Hb(h,e);a.Y.Oc(f[g].sd,h);l.nodeValue="";l.parentNode&&l.parentNode.removeChild(l)}},Ic:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:null}}}();a.b("memoization",a.Y);a.b("memoization.memoize",a.Y.Rb);a.b("memoization.unmemoize",a.Y.Oc);a.b("memoization.parseMemoText",a.Y.Ic);a.b("memoization.unmemoizeDomNodeAndDescendants",
|
||||
a.Y.Pc);a.la=function(){function b(){if(e)for(var b=e,c=0,h;g<e;)if(h=d[g++]){if(g>b){if(5E3<=++c){g=e;a.a.xc(Error("'Too much recursion' after processing "+c+" task groups."));break}b=e}try{h()}catch(f){a.a.xc(f)}}}function c(){b();g=e=d.length=0}var d=[],e=0,f=1,g=0;return{scheduler:function(a){var b=E.createElement("div");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle("foo")}}(c),vb:function(b){e||a.la.scheduler(c);d[e++]=b;return f++},cancel:function(a){a=
|
||||
a-(f-e);a>=g&&a<e&&(d[a]=null)},resetForTesting:function(){var a=e-g;g=e=d.length=0;return a},zd:b}}();a.b("tasks",a.la);a.b("tasks.schedule",a.la.vb);a.b("tasks.runEarly",a.la.zd);a.Na={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.X({read:b,write:function(e){clearTimeout(d);d=a.a.setTimeout(function(){b(e)},c)}})},rateLimit:function(a,c){var d,e,f;"number"==typeof c?d=c:(d=c.timeout,e=c.method);a.Cb=!1;f="function"==typeof e?e:"notifyWhenChangesStop"==e?T:S;a.qb(function(a){return f(a,
|
||||
d,c)})},deferred:function(b,c){if(!0!==c)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");b.Cb||(b.Cb=!0,b.qb(function(c){var e,f=!1;return function(){if(!f){a.la.cancel(e);e=a.la.vb(c);try{f=!0,b.notifySubscribers(p,"dirty")}finally{f=!1}}}}))},notify:function(a,c){a.equalityComparer="always"==c?null:J}};var R={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.Na);a.bc=function(b,c,d){this.$=b;this.ec=
|
||||
c;this.fc=d;this.Db=!1;this.ab=this.Eb=null;a.I(this,"dispose",this.s);a.I(this,"disposeWhenNodeIsRemoved",this.j)};a.bc.prototype.s=function(){this.Db||(this.ab&&a.a.P.ub(this.Eb,this.ab),this.Db=!0,this.fc(),this.$=this.ec=this.fc=this.Eb=this.ab=null)};a.bc.prototype.j=function(b){this.Eb=b;a.a.P.Ga(b,this.ab=this.s.bind(this))};a.R=function(){a.a.wb(this,A);A.mb(this)};var A={mb:function(a){a.S={change:[]};a.lc=1},subscribe:function(b,c,d){var e=this;d=d||"change";var f=new a.bc(e,c?b.bind(c):
|
||||
b,function(){a.a.Ia(e.S[d],f);e.cb&&e.cb(d)});e.Ja&&e.Ja(d);e.S[d]||(e.S[d]=[]);e.S[d].push(f);return f},notifySubscribers:function(b,c){c=c||"change";"change"===c&&this.Bb();if(this.Qa(c)){var d="change"===c&&this.Qc||this.S[c].slice(0);try{a.u.pc();for(var e=0,f;f=d[e];++e)f.Db||f.ec(b)}finally{a.u.end()}}},kb:function(){return this.lc},md:function(a){return this.kb()!==a},Bb:function(){++this.lc},qb:function(b){var c=this,d=a.U(c),e,f,g,k,l;c.bb||(c.bb=c.notifySubscribers,c.notifySubscribers=U);
|
||||
var h=b(function(){c.Ca=!1;d&&k===c&&(k=c.gc?c.gc():c());var a=f||l&&c.ob(g,k);l=f=e=!1;a&&c.bb(g=k)});c.jc=function(a,b){b&&c.Ca||(l=!b);c.Qc=c.S.change.slice(0);c.Ca=e=!0;k=a;h()};c.ic=function(a){e||(g=a,c.bb(a,"beforeChange"))};c.kc=function(){l=!0};c.Sc=function(){c.ob(g,c.w(!0))&&(f=!0)}},Qa:function(a){return this.S[a]&&this.S[a].length},kd:function(b){if(b)return this.S[b]&&this.S[b].length||0;var c=0;a.a.M(this.S,function(a,b){"dirty"!==a&&(c+=b.length)});return c},ob:function(a,c){return!this.equalityComparer||
|
||||
!this.equalityComparer(a,c)},toString:function(){return"[object Object]"},extend:function(b){var c=this;b&&a.a.M(b,function(b,e){var f=a.Na[b];"function"==typeof f&&(c=f(c,e)||c)});return c}};a.I(A,"init",A.mb);a.I(A,"subscribe",A.subscribe);a.I(A,"extend",A.extend);a.I(A,"getSubscriptionsCount",A.kd);a.a.va&&a.a.setPrototypeOf(A,Function.prototype);a.R.fn=A;a.Fc=function(a){return null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.R);a.b("isSubscribable",
|
||||
a.Fc);a.O=a.u=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{pc:b,end:c,Xb:function(b){if(e){if(!a.Fc(b))throw Error("Only subscribable things can act as dependencies");e.Zc.call(e.$c,b,b.Rc||(b.Rc=++f))}},C:function(a,d,e){try{return b(),a.apply(d,e||[])}finally{c()}},oa:function(){if(e)return e.o.oa()},Pa:function(){if(e)return e.o.Pa()},Sa:function(){if(e)return e.Sa},o:function(){if(e)return e.o}}}();a.b("computedContext",a.O);a.b("computedContext.getDependenciesCount",
|
||||
a.O.oa);a.b("computedContext.getDependencies",a.O.Pa);a.b("computedContext.isInitial",a.O.Sa);a.b("computedContext.registerDependency",a.O.Xb);a.b("ignoreDependencies",a.Fd=a.u.C);var F=Symbol("_latestValue");a.ra=function(b){function c(){if(0<arguments.length)return c.ob(c[F],arguments[0])&&(c.Ya(),c[F]=arguments[0],c.Xa()),this;a.u.Xb(c);return c[F]}c[F]=b;a.a.va||a.a.extend(c,a.R.fn);a.R.fn.mb(c);a.a.wb(c,B);a.options.deferUpdates&&a.Na.deferred(c,!0);return c};var B={equalityComparer:J,w:function(){return this[F]},
|
||||
Xa:function(){this.notifySubscribers(this[F],"spectate");this.notifySubscribers(this[F])},Ya:function(){this.notifySubscribers(this[F],"beforeChange")}};a.a.va&&a.a.setPrototypeOf(B,a.R.fn);var G=a.ra.Fa="__ko_proto__";B[G]=a.ra;a.U=function(b){if((b="function"==typeof b&&b[G])&&b!==B[G]&&b!==a.o.fn[G])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!b};a.Ta=function(b){return"function"==typeof b&&(b[G]===B[G]||b[G]===a.o.fn[G]&&b.Cc)};a.b("observable",
|
||||
a.ra);a.b("isObservable",a.U);a.b("isWriteableObservable",a.Ta);a.b("isWritableObservable",a.Ta);a.b("observable.fn",B);a.I(B,"peek",B.w);a.I(B,"valueHasMutated",B.Xa);a.I(B,"valueWillMutate",B.Ya);a.Aa=function(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.ra(b);a.a.wb(b,a.Aa.fn);return b.extend({trackArrayChanges:!0})};a.Aa.fn={remove:function(b){for(var c=this.w(),d=[],e="function"!=
|
||||
typeof b||a.U(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var g=c[f];if(e(g)){0===d.length&&this.Ya();if(c[f]!==g)throw Error("Array modified during remove; cannot remove item");d.push(g);c.splice(f,1);f--}}d.length&&this.Xa();return d},removeAll:function(b){if(b===p){var c=this.w(),d=c.slice(0);this.Ya();c.splice(0,c.length);this.Xa();return d}return b?this.remove(function(c){return 0<=a.a.N(b,c)}):[]},indexOf:function(b){return a.a.N(this(),b)}};a.a.va&&a.a.setPrototypeOf(a.Aa.fn,a.ra.fn);
|
||||
a.a.K("pop push reverse shift sort splice unshift".split(" "),function(b){a.Aa.fn[b]=function(){var a=this.w();this.Ya();this.rc(a,b,arguments);var d=a[b].apply(a,arguments);this.Xa();return d===a?this:d}});a.a.K(["slice"],function(b){a.Aa.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.Ec=function(b){return a.U(b)&&"function"==typeof b.remove&&"function"==typeof b.push};a.b("observableArray",a.Aa);a.b("isObservableArray",a.Ec);a.Na.trackArrayChanges=function(b,c){function d(){function c(){if(l){var d=
|
||||
[].concat(b.w()||[]),e;if(b.Qa("arrayChange")){if(!f||1<l)f=a.a.Jb(h,d,b.Ib);e=f}h=d;f=null;l=0;e&&e.length&&b.notifySubscribers(e,"arrayChange")}}e?c():(e=!0,k=b.subscribe(function(){++l},null,"spectate"),h=[].concat(b.w()||[]),f=null,g=b.subscribe(c))}b.Ib={};c&&"object"==typeof c&&a.a.extend(b.Ib,c);b.Ib.sparse=!0;if(!b.rc){var e=!1,f=null,g,k,l=0,h,m=b.Ja,n=b.cb;b.Ja=function(a){m&&m.call(b,a);"arrayChange"===a&&d()};b.cb=function(a){n&&n.call(b,a);"arrayChange"!==a||b.Qa("arrayChange")||(g&&
|
||||
g.s(),k&&k.s(),k=g=null,e=!1,h=p)};b.rc=function(b,c,d){function h(a,b,c){return k[k.length]={status:a,value:b,index:c}}if(e&&!l){var k=[],m=b.length,n=d.length,g=0;switch(c){case "push":g=m;case "unshift":for(c=0;c<n;c++)h("added",d[c],g+c);break;case "pop":g=m-1;case "shift":m&&h("deleted",b[g],g);break;case "splice":c=Math.min(Math.max(0,0>d[0]?m+d[0]:d[0]),m);for(var m=1===n?m:Math.min(c+(d[1]||0),m),n=c+n-2,g=Math.max(m,n),P=[],Q=[],p=2;c<g;++c,++p)c<m&&Q.push(h("deleted",b[c],c)),c<n&&P.push(h("added",
|
||||
d[p],c));a.a.Ac(Q,P);break;default:return}f=k}}}};var r=Symbol("_state");a.o=a.X=function(b,c,d){function e(){if(0<arguments.length){if("function"===typeof f)f.apply(g.jb,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}g.pa||a.u.Xb(e);(g.ja||g.G&&e.Ra())&&e.da();return g.V}"object"===typeof b?d=b:(d=d||{},b&&(d.read=b));if("function"!=typeof d.read)throw Error("Pass a function that returns the value of the ko.computed");
|
||||
var f=d.write,g={V:p,qa:!0,ja:!0,nb:!1,cc:!1,pa:!1,sb:!1,G:!1,Kc:d.read,jb:c||d.owner,j:d.disposeWhenNodeIsRemoved||d.j||null,Ma:d.disposeWhen||d.Ma,Lb:null,F:{},T:0,zc:null};e[r]=g;e.Cc="function"===typeof f;a.a.va||a.a.extend(e,a.R.fn);a.R.fn.mb(e);a.a.wb(e,y);d.pure?(g.sb=!0,g.G=!0,a.a.extend(e,Y)):d.deferEvaluation&&a.a.extend(e,Z);a.options.deferUpdates&&a.Na.deferred(e,!0);g.j&&(g.cc=!0,g.j.nodeType||(g.j=null));g.G||d.deferEvaluation||e.da();g.j&&e.ia()&&a.a.P.Ga(g.j,g.Lb=function(){e.s()});
|
||||
return e};var y={equalityComparer:J,oa:function(){return this[r].T},Pa:function(){var b=[];a.a.M(this[r].F,function(a,d){b[d.Da]=d.$});return b},Pb:function(b){if(!this[r].T)return!1;var c=this.Pa();return-1!==a.a.N(c,b)?!0:!!a.a.Gb(c,function(a){return a.Pb&&a.Pb(b)})},nc:function(a,c,d){if(this[r].sb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[r].F[a]=d;d.Da=this[r].T++;d.Ea=c.kb()},Ra:function(){var a,c,d=this[r].F;for(a in d)if(Object.prototype.hasOwnProperty.call(d,
|
||||
a)&&(c=d[a],this.Ba&&c.$.Ca||c.$.md(c.Ea)))return!0},rd:function(){this.Ba&&!this[r].nb&&this.Ba(!1)},ia:function(){var a=this[r];return a.ja||0<a.T},yd:function(){this.Ca?this[r].ja&&(this[r].qa=!0):this.yc()},Nc:function(a){if(a.Cb){var c=a.subscribe(this.rd,this,"dirty"),d=a.subscribe(this.yd,this);return{$:a,s:function(){c.s();d.s()}}}return a.subscribe(this.yc,this)},yc:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[r].zc),this[r].zc=a.a.setTimeout(function(){b.da(!0)},
|
||||
c)):b.Ba?b.Ba(!0):b.da(!0)},da:function(b){var c=this[r],d=c.Ma,e=!1;if(!c.nb&&!c.pa){if(c.j&&!a.a.Mb(c.j)||d&&d()){if(!c.cc){this.s();return}}else c.cc=!1;c.nb=!0;try{e=this.jd(b)}finally{c.nb=!1}return e}},jd:function(b){var c=this[r],d=!1,e=c.sb?p:!c.T,d={ad:this,ib:c.F,Kb:c.T};a.u.pc({$c:d,Zc:W,o:this,Sa:e});c.F={};c.T=0;var f=this.hd(c,d);c.T?d=this.ob(c.V,f):(this.s(),d=!0);d&&(c.G?this.Bb():this.notifySubscribers(c.V,"beforeChange"),c.V=f,this.notifySubscribers(c.V,"spectate"),!c.G&&b&&this.notifySubscribers(c.V),
|
||||
this.kc&&this.kc());e&&this.notifySubscribers(c.V,"awake");return d},hd:function(b,c){try{var d=b.Kc;return b.jb?d.call(b.jb):d()}finally{a.u.end(),c.Kb&&!b.G&&a.a.M(c.ib,V),b.qa=b.ja=!1}},w:function(a){var c=this[r];(c.ja&&(a||!c.T)||c.G&&this.Ra())&&this.da();return c.V},qb:function(b){a.R.fn.qb.call(this,b);this.gc=function(){this[r].G||(this[r].qa?this.da():this[r].ja=!1);return this[r].V};this.Ba=function(a){this.ic(this[r].V);this[r].ja=!0;a&&(this[r].qa=!0);this.jc(this,!a)}},s:function(){var b=
|
||||
this[r];!b.G&&b.F&&a.a.M(b.F,function(a,b){b.s&&b.s()});b.j&&b.Lb&&a.a.P.ub(b.j,b.Lb);b.F=p;b.T=0;b.pa=!0;b.qa=!1;b.ja=!1;b.G=!1;b.j=p;b.Ma=p;b.Kc=p;this.Cc||(b.jb=p)}},Y={Ja:function(b){var c=this,d=c[r];if(!d.pa&&d.G&&"change"==b){d.G=!1;if(d.qa||c.Ra())d.F=null,d.T=0,c.da()&&c.Bb();else{var e=[];a.a.M(d.F,function(a,b){e[b.Da]=a});a.a.K(e,function(a,b){var e=d.F[a],l=c.Nc(e.$);l.Da=b;l.Ea=e.Ea;d.F[a]=l});c.Ra()&&c.da()&&c.Bb()}d.pa||c.notifySubscribers(d.V,"awake")}},cb:function(b){var c=this[r];
|
||||
c.pa||"change"!=b||this.Qa("change")||(a.a.M(c.F,function(a,b){b.s&&(c.F[a]={$:b.$,Da:b.Da,Ea:b.Ea},b.s())}),c.G=!0,this.notifySubscribers(p,"asleep"))},kb:function(){var b=this[r];b.G&&(b.qa||this.Ra())&&this.da();return a.R.fn.kb.call(this)}},Z={Ja:function(a){"change"!=a&&"beforeChange"!=a||this.w()}};a.a.va&&a.a.setPrototypeOf(y,a.R.fn);var M=a.ra.Fa;y[M]=a.o;a.Dc=function(a){return"function"==typeof a&&a[M]===y[M]};a.od=function(b){return a.Dc(b)&&b[r]&&b[r].sb};a.b("computed",a.o);a.b("dependentObservable",
|
||||
a.o);a.b("isComputed",a.Dc);a.b("isPureComputed",a.od);a.b("computed.fn",y);a.I(y,"peek",y.w);a.I(y,"dispose",y.s);a.I(y,"isActive",y.ia);a.I(y,"getDependenciesCount",y.oa);a.I(y,"getDependencies",y.Pa);a.tb=function(b,c){if("function"===typeof b)return a.o(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.o(b,c)};a.b("pureComputed",a.tb);a.Dd=function(b,c,d){function e(c){var e=a.tb(b,d).extend({ka:"always"}),k=e.subscribe(function(a){a&&(k.s(),c(a))});e.notifySubscribers(e.w());return k}return c?
|
||||
e(c.bind(d)):new Promise(e)};a.b("when",a.Dd);(function(){a.v={J:function(b){switch(a.a.fa(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?a.a.h.get(b,a.c.options.Ub):b.value;case "select":return 0<=b.selectedIndex?a.v.J(b.options[b.selectedIndex]):p;default:return b.value}},Za:function(b,c,d){switch(a.a.fa(b)){case "option":"string"===typeof c?(a.a.h.set(b,a.c.options.Ub,p),delete b.__ko__hasDomDataOptionValue__,b.value=c):(a.a.h.set(b,a.c.options.Ub,c),b.__ko__hasDomDataOptionValue__=
|
||||
!0,b.value="number"===typeof c?c:"");break;case "select":if(""===c||null===c)c=p;for(var e=-1,f=0,g=b.options.length,k;f<g;++f)if(k=a.v.J(b.options[f]),k==c||""===k&&c===p){e=f;break}if(d||0<=e||c===p&&1<b.size)b.selectedIndex=e;break;default:if(null===c||c===p)c="";b.value=c}}}})();a.b("selectExtensions",a.v);a.b("selectExtensions.readValue",a.v.J);a.b("selectExtensions.writeValue",a.v.Za);a.m=function(){function b(b){b=a.a.ac(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));b+="\n,";var c=[],d=b.match(e),
|
||||
k,w=[],q=0;if(1<d.length){for(var v=0,u;u=d[v];++v){var t=u.charCodeAt(0);if(44===t){if(0>=q){c.push(k&&w.length?{key:k,value:w.join("")}:{unknown:k||w.join("")});k=q=0;w=[];continue}}else if(58===t){if(!q&&!k&&1===w.length){k=w.pop();continue}}else if(47===t&&1<u.length&&(47===u.charCodeAt(1)||42===u.charCodeAt(1)))continue;else 47===t&&v&&1<u.length?(t=d[v-1].match(f))&&!g[t[0]]&&(b=b.substr(b.indexOf(u)+1),d=b.match(e),v=-1,u="/"):40===t||123===t||91===t?++q:41===t||125===t||93===t?--q:k||w.length||
|
||||
34!==t&&39!==t||(u=u.slice(1,-1));w.push(u)}if(0<q)throw Error("Unbalanced parentheses, braces, or brackets");}return c}var c=["true","false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,e=RegExp("\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|`(?:\\\\.|[^`])*`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*\n|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,\"'`{}()/:[\\]]*[^\\s,\"'`{}()/:[\\]]|[^\\s]","g"),f=/[\])"'A-Za-z0-9_$]+$/,g={"in":1,"return":1,"typeof":1},k={};return{Ka:[],ta:k,Vb:b,rb:function(e,
|
||||
h){function f(b,e){var h;if(!v){var l=a.getBindingHandler(b);if(l&&l.preprocess&&!(e=l.preprocess(e,b,f)))return;if(l=k[b])h=e,0<=a.a.N(c,h)?h=!1:(l=h.match(d),h=null===l?!1:l[1]?"Object("+l[1]+")"+l[2]:h),l=h;l&&g.push("'"+("string"==typeof k[b]?k[b]:b)+"':function(_z){"+h+"=_z}")}q&&(e="function(){return "+e+" }");n.push("'"+b+"':"+e)}h=h||{};var n=[],g=[],q=h.valueAccessors,v=h.bindingParams,u="string"===typeof e?b(e):e;a.a.K(u,function(a){f(a.key||a.unknown,a.value)});g.length&&f("_ko_property_writers",
|
||||
"{"+g.join(",")+" }");return n.join(",")},qd:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},$a:function(b,c,d,e,k){if(b&&a.U(b))!a.Ta(b)||k&&b.w()===e||b(e);else if((b=c.get("_ko_property_writers"))&&b[d])b[d](e)}}}();a.b("expressionRewriting",a.m);a.b("expressionRewriting.bindingRewriteValidators",a.m.Ka);a.b("expressionRewriting.parseObjectLiteral",a.m.Vb);a.b("expressionRewriting.preProcessBindings",a.m.rb);a.b("expressionRewriting._twoWayBindings",a.m.ta);a.b("jsonExpressionRewriting",
|
||||
a.m);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.m.rb);(function(){function b(a){return 8==a.nodeType&&e.test(a.nodeValue)}function c(a){return 8==a.nodeType&&f.test(a.nodeValue)}function d(d,e){for(var h=d,f=1,n=[];h=h.nextSibling;){if(c(h)&&(a.a.h.set(h,g,!0),f--,0===f))return n;n.push(h);b(h)&&f++}if(!e)throw Error("Cannot find closing comment tag to match: "+d.nodeValue);return null}var e=/^\s*ko(?:\s+([\s\S]+))?\s*$/,f=/^\s*\/ko\s*$/,g="__ko_matchedEndComment__";a.g={aa:{},
|
||||
childNodes:function(a){return b(a)?d(a):a.childNodes},wa:function(c){if(b(c)){c=a.g.childNodes(c);for(var d=0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.Nb(c)},sa:function(c,d){if(b(c)){a.g.wa(c);for(var e=c.nextSibling,f=0,n=d.length;f<n;f++)e.parentNode.insertBefore(d[f],e)}else a.a.sa(c,d)},Jc:function(a,c){var d;b(a)?(d=a.nextSibling,a=a.parentNode):d=a.firstChild;a.insertBefore(c,d)},Qb:function(c,d,e){e?(e=e.nextSibling,b(c)&&(c=c.parentNode),c.insertBefore(d,e)):a.g.Jc(c,d)},firstChild:function(a){if(b(a))return!a.nextSibling||
|
||||
c(a.nextSibling)?null:a.nextSibling;if(a.firstChild&&c(a.firstChild))throw Error("Found invalid end comment, as the first child of "+a);return a.firstChild},nextSibling:function(e){if(b(e)){var f=d(e,void 0);e=f?0<f.length?f[f.length-1].nextSibling:e.nextSibling:null}if(e.nextSibling&&c(e.nextSibling)){f=e.nextSibling;if(c(f)&&!a.a.h.get(f,g))throw Error("Found end comment without a matching opening comment, as child of "+e);return null}return e.nextSibling},ld:b,Cd:function(a){return(a=a.nodeValue.match(e))?
|
||||
a[1]:null}}})();a.b("virtualElements",a.g);a.b("virtualElements.allowedBindings",a.g.aa);a.b("virtualElements.emptyNode",a.g.wa);a.b("virtualElements.insertAfter",a.g.Qb);a.b("virtualElements.prepend",a.g.Jc);a.b("virtualElements.setDomNodeChildren",a.g.sa);(function(){a.ca=function(){this.Yc={}};a.a.extend(a.ca.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind")||a.l.getComponentNameForNode(b);case 8:return a.g.ld(b);default:return!1}},getBindings:function(b,
|
||||
c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.l.mc(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.l.mc(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.g.Cd(b);default:return null}},parseBindingsString:function(b,c,d,e){try{var f=this.Yc,g=b+(e&&e.valueAccessors||""),k;if(!(k=f[g])){var l,
|
||||
h="with($context){with($data||{}){return{"+a.m.rb(b,e)+"}}}";l=new Function("$context","$element",h);k=f[g]=l}return k(c,d)}catch(m){throw m.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+m.message,m;}}});a.ca.instance=new a.ca})();a.b("bindingProvider",a.ca);(function(){function b(b){var c=(b=a.a.h.get(b,z))&&b.L;c&&(b.L=null,c.Hc())}function c(c,d,e){this.node=c;this.qc=d;this.gb=[];this.D=!1;d.L||a.a.P.Ga(c,b);e&&e.L&&(e.L.gb.push(c),this.Fb=e)}function d(a){return function(){return a}}
|
||||
function e(a){return a()}function f(b){return a.a.za(a.u.C(b),function(a,c){return function(){return b()[c]}})}function g(b,c,e){return"function"===typeof b?f(b.bind(null,c,e)):a.a.za(b,d)}function k(a,b){return f(this.getBindings.bind(this,a,b))}function l(b,c){var d=a.g.firstChild(c);if(d){var e,f=a.ca.instance,m=f.preprocessNode;if(m){for(;e=d;)d=a.g.nextSibling(e),m.call(f,e);d=a.g.firstChild(c)}for(;e=d;)d=a.g.nextSibling(e),h(b,e)}a.i.ka(c,a.i.D)}function h(b,c){var d=b;if(1===c.nodeType||a.ca.instance.nodeHasBindings(c))d=
|
||||
n(c,null,b).bindingContextForDescendants;d&&!t[a.a.fa(c)]&&l(d,c)}function m(b){var c=[],d={},e=[];a.a.M(b,function X(h){if(!d[h]){var f=a.getBindingHandler(h);f&&(f.after&&(e.push(h),a.a.K(f.after,function(c){if(b[c]){if(-1!==a.a.N(e,c))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+e.join(", "));X(c)}}),e.length--),c.push({key:h,Bc:f}));d[h]=!0}});return c}function n(b,c,d){var h=a.a.h.Ob(b,z,{}),f=h.Tc;if(!c){if(f)throw Error("You cannot apply bindings multiple times to the same element.");
|
||||
h.Tc=!0}f||(h.context=d);h.Tb||(h.Tb={});var n;if(c&&"function"!==typeof c)n=c;else{var g=a.ca.instance,w=g.getBindingAccessors||k,l=a.X(function(){if(n=c?c(d,b):w.call(g,b,d)){if(d[q])d[q]();if(d[u])d[u]()}return n},null,{j:b});n&&l.ia()||(l=null)}var t=d,v;if(n){var I=function(){return a.a.za(l?l():n,e)},r=l?function(a){return function(){return e(l()[a])}}:function(a){return n[a]};I.get=function(a){return n[a]&&e(r(a))};I.has=function(a){return a in n};a.i.D in n&&a.i.subscribe(b,a.i.D,function(){var c=
|
||||
(0,n[a.i.D])();if(c){var d=a.g.childNodes(b);d.length&&c(d,a.vc(d[0]))}});a.i.na in n&&(t=a.i.yb(b,d),a.i.subscribe(b,a.i.na,function(){var c=(0,n[a.i.na])();c&&a.g.firstChild(b)&&c(b)}));h=m(n);a.a.K(h,function(c){var d=c.Bc.init,e=c.Bc.update,h=c.key;if(8===b.nodeType&&!a.g.aa[h])throw Error("The binding '"+h+"' cannot be used with virtual elements");try{"function"==typeof d&&a.u.C(function(){var a=d(b,r(h),I,t.$data,t);if(a&&a.controlsDescendantBindings){if(v!==p)throw Error("Multiple bindings ("+
|
||||
v+" and "+h+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");v=h}}),"function"==typeof e&&a.X(function(){e(b,r(h),I,t.$data,t)},null,{j:b})}catch(f){throw f.message='Unable to process binding "'+h+": "+n[h]+'"\nMessage: '+f.message,f;}})}h=v===p;return{shouldBindDescendants:h,bindingContextForDescendants:h&&t}}function w(b,c){return b&&b instanceof a.ba?b:new a.ba(b,p,p,c)}var q=Symbol("_subscribable"),v=Symbol("_ancestorBindingInfo"),
|
||||
u=Symbol("_dataDependency");a.c={};var t={script:!0,textarea:!0,template:!0};a.getBindingHandler=function(b){return a.c[b]};var I={};a.ba=function(b,c,d,e,h){function f(){var b=k?g():g,h=a.a.f(b);c?(a.a.extend(m,c),v in c&&(m[v]=c[v])):(m.$parents=[],m.$root=h,m.ko=a);m[q]=w;n?h=m.$data:(m.$rawData=b,m.$data=h);d&&(m[d]=h);e&&e(m,c,h);if(c&&c[q]&&!a.O.o().Pb(c[q]))c[q]();l&&(m[u]=l);return m.$data}var m=this,n=b===I,g=n?p:b,k="function"==typeof g&&!a.U(g),w,l=h&&h.dataDependency;h&&h.exportDependencies?
|
||||
f():(w=a.tb(f),w.w(),w.ia()?w.equalityComparer=null:m[q]=p)};a.ba.prototype.createChildContext=function(b,c,d,e){!e&&c&&"object"==typeof c&&(e=c,c=e.as,d=e.extend);if(c&&e&&e.noChildContext){var h="function"==typeof b&&!a.U(b);return new a.ba(I,this,null,function(a){d&&d(a);a[c]=h?b():b},e)}return new a.ba(b,this,c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);d&&d(a)},e)};a.ba.prototype.extend=function(b,c){return new a.ba(I,
|
||||
this,null,function(c){a.a.extend(c,"function"==typeof b?b(c):b)},c)};var z=a.a.h.ea();c.prototype.Hc=function(){this.Fb&&this.Fb.L&&this.Fb.L.dd(this.node)};c.prototype.dd=function(b){a.a.Ia(this.gb,b);!this.gb.length&&this.D&&this.uc()};c.prototype.uc=function(){this.D=!0;this.qc.L&&!this.gb.length&&(this.qc.L=null,a.a.P.ub(this.node,b),a.i.ka(this.node,a.i.na),this.Hc())};a.i={D:"childrenComplete",na:"descendantsComplete",subscribe:function(b,c,d,e,h){var f=a.a.h.Ob(b,z,{});f.xa||(f.xa=new a.R);
|
||||
h&&h.notifyImmediately&&f.Tb[c]&&a.u.C(d,e,[b]);return f.xa.subscribe(d,e,c)},ka:function(b,c){var d=a.a.h.get(b,z);if(d&&(d.Tb[c]=!0,d.xa&&d.xa.notifySubscribers(b,c),c==a.i.D))if(d.L)d.L.uc();else if(d.L===p&&d.xa&&d.xa.Qa(a.i.na))throw Error("descendantsComplete event not supported for bindings on this node");},yb:function(b,d){var e=a.a.h.Ob(b,z,{});e.L||(e.L=new c(b,e,d[v]));return d[v]==e?d:d.extend(function(a){a[v]=e})}};a.Ad=function(b){return(b=a.a.h.get(b,z))&&b.context};a.eb=function(a,
|
||||
b,c){return n(a,b,w(c))};a.Wc=function(b,c,d){d=w(d);return a.eb(b,g(c,d,b),d)};a.Ha=function(a,b){1!==b.nodeType&&8!==b.nodeType||l(w(a),b)};a.oc=function(a,b,c){if(2>arguments.length){if(b=E.body,!b)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!b||1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");h(w(a,c),b)};a.bd=function(b){if(b&&(1===b.nodeType||
|
||||
8===b.nodeType))return a.Ad(b)};a.vc=function(b){return(b=a.bd(b))?b.$data:p};a.b("bindingHandlers",a.c);a.b("bindingEvent",a.i);a.b("bindingEvent.subscribe",a.i.subscribe);a.b("bindingEvent.startPossiblyAsyncContentBinding",a.i.yb);a.b("applyBindings",a.oc);a.b("applyBindingsToDescendants",a.Ha);a.b("applyBindingAccessorsToNode",a.eb);a.b("applyBindingsToNode",a.Wc);a.b("dataFor",a.vc)})();(function(b){function c(c,e){var h=Object.prototype.hasOwnProperty.call(f,c)?f[c]:b,m;h?h.subscribe(e):(h=f[c]=
|
||||
new a.R,h.subscribe(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,pd:e};delete f[c];m||e?h.notifySubscribers(b):a.la.vb(function(){h.notifySubscribers(b)})}),m=!0)}function d(a,b){e("getConfig",[a],function(c){c?e("loadComponent",[a,c],function(a){b(a,c)}):b(null,null)})}function e(c,d,h,f){f||(f=a.l.loaders.slice(0));var n=f.shift();if(n){var g=n[c];if(g){var q=!1;if(g.apply(n,d.concat(function(a){q?h(null):null!==a?h(a):e(c,d,h,f)}))!==b&&(q=!0,!n.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");
|
||||
}else e(c,d,h,f)}else h(null)}var f={},g={};a.l={get:function(d,e){var h=Object.prototype.hasOwnProperty.call(g,d)?g[d]:b;h?h.pd?a.u.C(function(){e(h.definition)}):a.la.vb(function(){e(h.definition)}):c(d,e)},tc:function(a){delete g[a]},hc:e};a.l.loaders=[];a.b("components",a.l);a.b("components.get",a.l.get);a.b("components.clearCachedDefinition",a.l.tc)})();(function(){function b(b,c,d,e){function g(){0===--u&&e(k)}var k={},u=2,t=d.template;d=d.viewModel;t?f(c,t,function(c){a.l.hc("loadTemplate",
|
||||
[b,c],function(a){k.template=a;g()})}):g();d?f(c,d,function(c){a.l.hc("loadViewModel",[b,c],function(a){k[l]=a;g()})}):g()}function c(a,b,d){if("function"===typeof b)d(function(a){return new b(a)});else if("function"===typeof b[l])d(b[l]);else if("instance"in b){var e=b.instance;d(function(){return e})}else"viewModel"in b?c(a,b.viewModel,d):a("Unknown viewModel value: "+b)}function d(b){if("template"==a.a.fa(b)&&e(b.content))return a.a.La(b.content.childNodes);throw"Template Source Element not a <template>";
|
||||
}function e(a){return D.DocumentFragment?a instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){"string"===typeof b.require?O||D.require?(O||D.require)([b.require],function(a){a&&"object"===typeof a&&a.Ed&&a["default"]&&(a=a["default"]);c(a)}):a("Uses require, but no AMD loader is present"):c(b)}function g(a){return function(b){throw Error("Component '"+a+"': "+b);}}var k={};a.l.register=function(b,c){if(!c)throw Error("Invalid configuration for "+b);if(a.l.pb(b))throw Error("Component "+
|
||||
b+" is already registered");k[b]=c};a.l.pb=function(a){return Object.prototype.hasOwnProperty.call(k,a)};a.l.unregister=function(b){delete k[b];a.l.tc(b)};a.l.wc={getConfig:function(b,c){c(a.l.pb(b)?k[b]:null)},loadComponent:function(a,c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,c,f){b=g(b);if("string"===typeof c)f(a.a.Ua(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.ya(c.childNodes));else if(c.element)if(c=c.element,D.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&
|
||||
1===c.nodeType)f(d(c));else if("string"===typeof c){var k=E.getElementById(c);k?f(d(k)):b("Cannot find element with ID "+c)}else b("Unknown element type: "+c);else b("Unknown template value: "+c)},loadViewModel:function(a,b,d){c(g(a),b,d)}};var l="createViewModel";a.b("components.register",a.l.register);a.b("components.isRegistered",a.l.pb);a.b("components.unregister",a.l.unregister);a.b("components.defaultLoader",a.l.wc);a.l.loaders.push(a.l.wc)})();(function(){function b(b,e){var f=b.getAttribute("params");
|
||||
if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.za(f,function(c){return a.o(c,null,{j:b})}),g=a.a.za(f,function(c){var e=c.w();return c.ia()?a.o({read:function(){return a.a.f(c())},write:a.Ta(e)&&function(a){c()(a)},j:b}):e});Object.prototype.hasOwnProperty.call(g,"$raw")||(g.$raw=f);return g}return{$raw:{}}}a.l.getComponentNameForNode=function(b){var c=a.a.fa(b);if(a.l.pb(c)&&(-1!=c.indexOf("-")||"[object HTMLUnknownElement]"==""+b))return c};a.l.mc=function(c,
|
||||
e,f,g){if(1===e.nodeType){var k=a.l.getComponentNameForNode(e);if(k){c=c||{};if(c.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var l={name:k,params:b(e,f)};c.component=g?function(){return l}:l}}return c};var c=new a.ca})();(function(){function b(b,c,d){c=c.template;if(!c)throw Error("Component '"+b+"' has no template");b=a.a.La(c);a.g.sa(d,b)}function c(a,b,c){var d=a.createViewModel;return d?d.call(a,b,c):b}var d=0;a.c.component={init:function(e,
|
||||
f,g,k,l){function h(){var a=m&&m.dispose;"function"===typeof a&&a.call(m);w&&w.s();n=m=w=null}var m,n,w,q=a.a.ya(a.g.childNodes(e));a.g.wa(e);a.a.P.Ga(e,h);a.o(function(){var g=a.a.f(f()),k,t;"string"===typeof g?k=g:(k=a.a.f(g.name),t=a.a.f(g.params));if(!k)throw Error("No component name specified");var p=a.i.yb(e,l),z=n=++d;a.l.get(k,function(d){if(n===z){h();if(!d)throw Error("Unknown component '"+k+"'");b(k,d,e);var f=c(d,t,{element:e,templateNodes:q});d=p.createChildContext(f,{extend:function(a){a.$component=
|
||||
f;a.$componentTemplateNodes=q}});f&&f.koDescendantsComplete&&(w=a.i.subscribe(e,a.i.na,f.koDescendantsComplete,f));m=f;a.Ha(d,e)}})},null,{j:e});return{controlsDescendantBindings:!0}}};a.g.aa.component=!0})();a.c.attr={update:function(b,c){var d=a.a.f(c())||{};a.a.M(d,function(c,d){d=a.a.f(d);var g=c.indexOf(":"),g="lookupNamespaceURI"in b&&0<g&&b.lookupNamespaceURI(c.substr(0,g)),k=!1===d||null===d||d===p;k?g?b.removeAttributeNS(g,c):b.removeAttribute(c):d=d.toString();k||(g?b.setAttributeNS(g,c,
|
||||
d):b.setAttribute(c,d));"name"===c&&(b.name=k?"":d)})}};(function(){function b(b,d,e){var f=a.a.N(a.a.Wb(b),d);0>f?e&&b.push(d):e||b.splice(f,1)}a.c.checked={after:["value","attr"],init:function(c,d,e){function f(){var f=c.checked,g=k();if(!a.O.Sa()&&(f||!h&&!a.O.oa())){var m=a.u.C(d);if(n){var q=w?m.w():m,r=v;v=g;r!==g?f&&(b(q,g,!0),b(q,r,!1)):b(q,g,f);w&&a.Ta(m)&&m(q)}else l&&(g===p?g=f:f||(g=p)),a.m.$a(m,e,"checked",g,!0)}}function g(){var b=a.a.f(d()),e=k();n?(c.checked=0<=a.a.N(b,e),v=e):c.checked=
|
||||
l&&e===p?!!b:k()===b}var k=a.tb(function(){if(e.has("checkedValue"))return a.a.f(e.get("checkedValue"));if(q)return e.has("value")?a.a.f(e.get("value")):c.value}),l="checkbox"==c.type,h="radio"==c.type;if(l||h){var m=d(),n=l&&a.a.f(m)instanceof Array,w=!(n&&m.push&&m.splice),q=h||n,v=n?k():p;a.o(f,null,{j:c});a.a.H(c,"click",f);a.o(g,null,{j:c});m=p}}};a.m.ta.checked=!0;a.c.checkedValue={update:function(b,d){b.value=a.a.f(d())}}})();a.c["class"]={update:function(b,c){var d=a.a.ac(a.a.f(c()));a.a.zb(b,
|
||||
b.__ko__cssValue,!1);b.__ko__cssValue=d;a.a.zb(b,d,!0)}};a.c.css={update:function(b,c){var d=a.a.f(c());null!==d&&"object"==typeof d?a.a.M(d,function(c,d){d=a.a.f(d);a.a.zb(b,c,d)}):a.c["class"].update(b,c)}};a.c.enable={update:function(b,c){var d=a.a.f(c());d&&b.disabled?b.removeAttribute("disabled"):d||b.disabled||(b.disabled=!0)}};a.c.disable={update:function(b,c){a.c.enable.update(b,function(){return!a.a.f(c())})}};a.c.event={init:function(b,c,d,e,f){var g=c()||{};a.a.M(g,function(g){"string"==
|
||||
typeof g&&a.a.H(b,g,function(b){var h,m=c()[g];if(m){try{var n=a.a.ya(arguments);e=f.$data;n.unshift(e);h=m.apply(e,n)}finally{!0!==h&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}!1===d.get(g+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.c.foreach={Gc:function(b){return function(){var c=b(),d=a.a.Wb(c);if(!d||"number"==typeof d.length)return{foreach:c,templateEngine:a.Z.Fa};a.a.f(c);return{foreach:d.data,as:d.as,noChildContext:d.noChildContext,includeDestroyed:d.includeDestroyed,
|
||||
afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.Z.Fa}}},init:function(b,c){return a.c.template.init(b,a.c.foreach.Gc(c))},update:function(b,c,d,e,f){return a.c.template.update(b,a.c.foreach.Gc(c),d,e,f)}};a.m.Ka.foreach=!1;a.g.aa.foreach=!0;a.c.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;e=b.ownerDocument.activeElement===b;var f=c();a.m.$a(f,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=
|
||||
e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.H(b,"focus",f);a.a.H(b,"focusin",f);a.a.H(b,"blur",g);a.a.H(b,"focusout",g);b.__ko_hasfocusLastValue=!1},update:function(b,c){var d=!!a.a.f(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.u.C(a.a.Ab,null,[b,d?"focusin":"focusout"]))}};a.m.ta.hasfocus=!0;a.c.hasFocus=a.c.hasfocus;a.m.ta.hasFocus="hasfocus";a.c.html={init:function(){return{controlsDescendantBindings:!0}},
|
||||
update:function(b,c){a.a.$b(b,c())}};(function(){function b(b,d,e){a.c[b]={init:function(b,c,k,l,h){var m,n,w={},q,p,u;if(d){l=k.get("as");var t=k.get("noChildContext");u=!(l&&t);w={as:l,noChildContext:t,exportDependencies:u}}p=(q="render"==k.get("completeOn"))||k.has(a.i.na);a.o(function(){var k=a.a.f(c()),l=!e!==!k,t=!n,r;if(u||l!==m){p&&(h=a.i.yb(b,h));if(l){if(!d||u)w.dataDependency=a.O.o();r=d?h.createChildContext("function"==typeof k?k:c,w):a.O.oa()?h.extend(null,w):h}t&&a.O.oa()&&(n=a.a.La(a.g.childNodes(b),
|
||||
!0));l?(t||a.g.sa(b,a.a.La(n)),a.Ha(r,b)):(a.g.wa(b),q||a.i.ka(b,a.i.D));m=l}},null,{j:b});return{controlsDescendantBindings:!0}}};a.m.Ka[b]=!1;a.g.aa[b]=!0}b("if");b("ifnot",!1,!0);b("with",!0)})();a.c.let={init:function(b,c,d,e,f){c=f.extend(c);a.Ha(c,b);return{controlsDescendantBindings:!0}}};a.g.aa.let=!0;var N={};a.c.options={init:function(b){if("select"!==a.a.fa(b))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},
|
||||
update:function(b,c,d){function e(){return a.a.fb(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c}function g(c,d){if(v&&m)a.i.ka(b,a.i.D);else if(q.length){var e=0<=a.a.N(q,a.v.J(d[0]));d[0].selected=e;v&&!e&&a.u.C(a.a.Ab,null,[b,"change"])}}var k=b.multiple,l=0!=b.length&&k?b.scrollTop:null,h=a.a.f(c()),m=d.get("valueAllowUnset")&&d.has("value"),n=d.get("optionsIncludeDestroyed");c={};var w,q=[];m||(k?q=e().map(a.v.J):0<=b.selectedIndex&&
|
||||
q.push(a.v.J(b.options[b.selectedIndex])));h&&("undefined"==typeof h.length&&(h=[h]),w=a.a.fb(h,function(b){return n||b===p||null===b||!a.a.f(b._destroy)}),d.has("optionsCaption")&&(h=a.a.f(d.get("optionsCaption")),null!==h&&h!==p&&w.unshift(N)));var v=!1;c.beforeRemove=function(a){b.removeChild(a)};h=g;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(h=function(b,c){g(0,c);a.u.C(d.get("optionsAfterRender"),null,[c[0],b!==N?b:p])});a.a.Zb(b,w,function(c,e,h){h.length&&
|
||||
(q=!m&&h[0].selected?[a.v.J(h[0])]:[],v=!0);e=b.ownerDocument.createElement("option");c===N?(a.a.xb(e,d.get("optionsCaption")),a.v.Za(e,p)):(h=f(c,d.get("optionsValue"),c),a.v.Za(e,a.a.f(h)),c=f(c,d.get("optionsText"),h),a.a.xb(e,c));return[e]},c,h);if(!m){var u;k?u=q.length&&e().length<q.length:u=q.length&&0<=b.selectedIndex?a.v.J(b.options[b.selectedIndex])!==q[0]:q.length||0<=b.selectedIndex;u&&a.u.C(a.a.Ab,null,[b,"change"])}(m||a.O.Sa())&&a.i.ka(b,a.i.D);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=
|
||||
l)}};a.c.options.Ub=a.a.h.ea();a.c.selectedOptions={init:function(b,c,d){function e(){var e=c(),f=[];a.a.K(b.getElementsByTagName("option"),function(b){b.selected&&f.push(a.v.J(b))});a.m.$a(e,d,"selectedOptions",f)}function f(){var d=a.a.f(c()),e=b.scrollTop;d&&"number"==typeof d.length&&a.a.K(b.getElementsByTagName("option"),function(b){b.selected=0<=a.a.N(d,a.v.J(b))});b.scrollTop=e}if("select"!=a.a.fa(b))throw Error("selectedOptions binding applies only to SELECT elements");var g;a.i.subscribe(b,
|
||||
a.i.D,function(){g?e():(a.a.H(b,"change",e),g=a.o(f,null,{j:b}))},null,{notifyImmediately:!0})},update:function(){}};a.m.ta.selectedOptions=!0;a.c.style={update:function(b,c){var d=a.a.f(c()||{});a.a.M(d,function(c,d){d=a.a.f(d);if(null===d||d===p||!1===d)d="";if(/^--/.test(c))b.style.setProperty(c,d);else{c=c.replace(/-(\w)/g,function(a,b){return b.toUpperCase()});var g=b.style[c];b.style[c]=d;d===g||b.style[c]!=g||isNaN(d)||(b.style[c]=d+"px")}})}};a.c.submit={init:function(b,c,d,e,f){if("function"!=
|
||||
typeof c())throw Error("The value for a submit binding must be a function");a.a.H(b,"submit",function(a){var d,e=c();try{d=e.call(f.$data,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.xb(b,c())}};a.g.aa.text=!0;(function(){a.c.textInput={init:function(b,c,d){function e(){var d=a.a.f(c());if(null===d||d===p)d="";l!==p&&d===l?a.a.setTimeout(e,4):b.value!==d&&(b.value=d,g=b.value)}
|
||||
function f(){clearTimeout(k);l=k=p;var e=b.value;g!==e&&(g=e,a.m.$a(c(),d,"textInput",e))}var g=b.value,k,l;a.a.H(b,"input",f);a.a.H(b,"change",f);a.a.H(b,"blur",f);a.o(e,null,{j:b})}};a.m.ta.textInput=!0;a.c.textinput={preprocess:function(a,c,d){d("textInput",a)}}})();a.c.uniqueName={init:function(b,c){c()&&(b.name="ko_unique_"+ ++a.c.uniqueName.cd)}};a.c.uniqueName.cd=0;a.c.using={init:function(b,c,d,e,f){var g;d.has("as")&&(g={as:d.get("as"),noChildContext:d.get("noChildContext")});c=f.createChildContext(c,
|
||||
g);a.Ha(c,b);return{controlsDescendantBindings:!0}}};a.g.aa.using=!0;a.c.value={init:function(b,c,d){var e=a.a.fa(b),f="input"==e;if(!f||"checkbox"!=b.type&&"radio"!=b.type){var g=[],k=d.get("valueUpdate"),l=null;k&&("string"==typeof k?g=[k]:g=k?k.filter(function(a,b){return k.indexOf(a)===b}):[],a.a.Ia(g,"change"));var h=function(){l=null;var e=c(),f=a.v.J(b);a.m.$a(e,d,"value",f)};a.a.K(g,function(c){var d=h;a.a.Bd(c,"after")&&(d=function(){l=a.v.J(b);a.a.setTimeout(h,0)},c=c.substring(5));a.a.H(b,
|
||||
c,d)});var m;m=f&&"file"==b.type?function(){var d=a.a.f(c());null===d||d===p||""===d?b.value="":a.u.C(h)}:function(){var f=a.a.f(c()),g=a.v.J(b);if(null!==l&&f===l)a.a.setTimeout(m,0);else if(f!==g||g===p)"select"===e?(g=d.get("valueAllowUnset"),a.v.Za(b,f,g),g||f===a.v.J(b)||a.u.C(h)):a.v.Za(b,f)};if("select"===e){var n;a.i.subscribe(b,a.i.D,function(){n?d.get("valueAllowUnset")?m():h():(a.a.H(b,"change",h),n=a.o(m,null,{j:b}))},null,{notifyImmediately:!0})}else a.a.H(b,"change",h),a.o(m,null,{j:b})}else a.eb(b,
|
||||
{checkedValue:c})},update:function(){}};a.m.ta.value=!0;a.c.visible={update:function(b,c){var d=a.a.f(c()),e="none"!=b.style.display;d&&!e?b.style.display="":!d&&e&&(b.style.display="none")}};a.c.hidden={update:function(b,c){a.c.visible.update(b,function(){return!a.a.f(c())})}};(function(b){a.c[b]={init:function(c,d,e,f,g){return a.c.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}}})("click");a.ga=function(){};a.ga.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");
|
||||
};a.ga.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.ga.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||E;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.A.B(d)}if(1==b.nodeType||8==b.nodeType)return new a.A.ha(b);throw Error("Unknown template type: "+b);};a.ga.prototype.renderTemplate=function(a,c,d,e){a=this.makeTemplateSource(a,e);return this.renderTemplateSource(a,
|
||||
c,d,e)};a.ga.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.ga.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0)};a.b("templateEngine",a.ga);a.dc=function(){function b(b,c,d,k){b=a.m.Vb(b);for(var l=a.m.Ka,h=0;h<b.length;h++){var m=b[h].key;if(Object.prototype.hasOwnProperty.call(l,m)){var n=l[m];if("function"===typeof n){if(m=n(b[h].value))throw Error(m);
|
||||
}else if(!n)throw Error("This template engine does not support the '"+m+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.m.rb(b,{valueAccessors:!0})+" } })()},'"+d.toLowerCase()+"')";return k.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{gd:function(b,c,d){c.isTemplateRewritten(b,
|
||||
d)||c.rewriteTemplate(b,function(b){return a.dc.ud(b,c)},d)},ud:function(a,f){return a.replace(c,function(a,c,d,e,m){return b(m,c,d,f)}).replace(d,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",f)})},Xc:function(b,c){return a.Y.Rb(function(d,k){var l=d.nextSibling;l&&l.nodeName.toLowerCase()===c&&a.eb(l,b,k)})}}}();a.b("__tr_ambtns",a.dc.Xc);(function(){a.A={};a.A.B=function(b){if(this.B=b){var c=a.a.fa(b);this.Va="script"===c?1:"textarea"===c?2:"template"==c&&b.content&&11===b.content.nodeType?
|
||||
3:4}};a.A.B.prototype.text=function(){var b=1===this.Va?"text":2===this.Va?"value":"innerHTML";if(0==arguments.length)return this.B[b];var c=arguments[0];"innerHTML"===b?a.a.$b(this.B,c):this.B[b]=c};var b=a.a.h.ea()+"_";a.A.B.prototype.data=function(c){if(1===arguments.length)return a.a.h.get(this.B,b+c);a.a.h.set(this.B,b+c,arguments[1])};var c=a.a.h.ea();a.A.B.prototype.nodes=function(){var b=this.B;if(0==arguments.length){var e=a.a.h.get(b,c)||{},f=e.hb||(3===this.Va?b.content:4===this.Va?b:p);
|
||||
if(!f||e.Uc){var g=this.text();g&&g!==e.Wa&&(f=a.a.wd(g,b.ownerDocument),a.a.h.set(b,c,{hb:f,Wa:g,Uc:!0}))}return f}e=arguments[0];this.Va!==p&&this.text("");a.a.h.set(b,c,{hb:e})};a.A.ha=function(a){this.B=a};a.A.ha.prototype=new a.A.B;a.A.ha.prototype.constructor=a.A.ha;a.A.ha.prototype.text=function(){if(0==arguments.length){var b=a.a.h.get(this.B,c)||{};b.Wa===p&&b.hb&&(b.Wa=b.hb.innerHTML);return b.Wa}a.a.h.set(this.B,c,{Wa:arguments[0]})};a.b("templateSources",a.A);a.b("templateSources.domElement",
|
||||
a.A.B);a.b("templateSources.anonymousTemplate",a.A.ha)})();(function(){function b(b,c,d){var e;for(c=a.g.nextSibling(c);b&&(e=b)!==c;)b=a.g.nextSibling(e),d(e,b)}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,k=a.ca.instance,l=k.preprocessNode;if(l){b(e,f,function(a,b){var c=a.previousSibling,d=l.call(k,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):(c.push(e,f),a.a.Oa(c,g))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||
|
||||
a.oc(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.Y.Pc(b,[d])});a.a.Oa(c,g)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,e,f,k,l){l=l||{};var p=(b&&d(b)||f||{}).ownerDocument,u=l.templateEngine||g;a.dc.gd(f,u,p);f=u.renderTemplate(f,k,l,p);if("number"!=typeof f.length||0<f.length&&"number"!=typeof f[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(e){case "replaceChildren":a.g.sa(b,f);p=!0;break;case "replaceNode":a.a.Lc(b,
|
||||
f);p=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+e);}p&&(c(f,k),l.afterRender&&a.u.C(l.afterRender,null,[f,k[l.as||"$data"]]),"replaceChildren"==e&&a.i.ka(b,a.i.D));return f}function f(b,c,d){return a.U(b)?b():"function"===typeof b?b(c,d):b}var g;a.Mc=function(b){if(b!=p&&!(b instanceof a.ga))throw Error("templateEngine must inherit from ko.templateEngine");g=b};a.Yb=function(b,c,n,k,l){n=n||{};if((n.templateEngine||g)==p)throw Error("Set a template engine before calling renderTemplate");
|
||||
l=l||"replaceChildren";if(k){var v=d(k);return a.X(function(){var g=c&&c instanceof a.ba?c:new a.ba(c,null,null,null,{exportDependencies:!0}),p=f(b,g.$data,g),g=e(k,l,p,g,n);"replaceNode"==l&&(k=g,v=d(k))},null,{Ma:function(){return!v||!a.a.Mb(v)},j:v&&"replaceNode"==l?v.parentNode:v})}return a.Y.Rb(function(d){a.Yb(b,c,n,d,"replaceNode")})};a.xd=function(b,d,g,k,l){function v(b,c){a.u.C(a.a.Zb,null,[k,b,t,g,u,c]);a.i.ka(k,a.i.D)}function u(a,b){c(b,r);g.afterRender&&g.afterRender(b,a);r=null}function t(a,
|
||||
c){r=l.createChildContext(a,{as:z,noChildContext:g.noChildContext,extend:function(a){a.$index=c;z&&(a[z+"Index"]=c)}});var d=f(b,a,r);return e(k,"ignoreTargetNode",d,r,g)}var r,z=g.as,y=!1===g.includeDestroyed||a.options.foreachHidesDestroyed&&!g.includeDestroyed;if(y||g.beforeRemove||!a.Ec(d))return a.X(function(){var b=a.a.f(d)||[];"undefined"==typeof b.length&&(b=[b]);y&&(b=a.a.fb(b,function(b){return b===p||null===b||!a.a.f(b._destroy)}));v(b)},null,{j:k});v(d.w());var A=d.subscribe(function(a){v(d(),
|
||||
a)},null,"arrayChange");A.j(k);return A};var k=a.a.h.ea(),l=a.a.h.ea();a.c.template={init:function(b,c){var d=a.a.f(c());if("string"==typeof d||"name"in d)a.g.wa(b);else if("nodes"in d){d=d.nodes||[];if(a.U(d))throw Error('The "nodes" option must be a plain, non-observable array.');var e=d[0]&&d[0].parentNode;e&&a.a.h.get(e,l)||(e=a.a.Sb(d),a.a.h.set(e,l,!0));(new a.A.ha(b)).nodes(e)}else if(d=a.g.childNodes(b),0<d.length)e=a.a.Sb(d),(new a.A.ha(b)).nodes(e);else throw Error("Anonymous template defined, but no template content was provided");
|
||||
return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var g=c();c=a.a.f(g);d=!0;e=null;"string"==typeof c?c={}:(g="name"in c?c.name:b,"if"in c&&(d=a.a.f(c["if"])),d&&"ifnot"in c&&(d=!a.a.f(c.ifnot)),d&&!g&&(d=!1));"foreach"in c?e=a.xd(g,d&&c.foreach||[],c,b,f):d?(d=f,"data"in c&&(d=f.createChildContext(c.data,{as:c.as,noChildContext:c.noChildContext,exportDependencies:!0})),e=a.Yb(g,d,c,b)):a.g.wa(b);f=e;(c=a.a.h.get(b,k))&&"function"==typeof c.s&&c.s();a.a.h.set(b,k,!f||f.ia&&!f.ia()?
|
||||
p:f)}};a.m.Ka.template=function(b){b=a.m.Vb(b);return 1==b.length&&b[0].unknown||a.m.qd(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.g.aa.template=!0})();a.b("setTemplateEngine",a.Mc);a.b("renderTemplate",a.Yb);a.a.Ac=function(a,c,d){if(a.length&&c.length){var e,f,g,k,l;for(e=f=0;(!d||e<d)&&(k=a[f]);++f){for(g=0;l=c[g];++g)if(k.value===l.value){k.moved=l.index;l.moved=k.index;c.splice(g,1);e=g=0;break}e+=g}}};a.a.Jb=function(){function b(b,
|
||||
d,e,f,g){var k=Math.min,l=Math.max,h=[],m,n=b.length,p,q=d.length,r=q-n||1,u=n+q+1,t,y,z;for(m=0;m<=n;m++)for(y=t,h.push(t=[]),z=k(q,m+r),p=l(0,m-1);p<=z;p++)t[p]=p?m?b[m-1]===d[p-1]?y[p-1]:k(y[p]||u,t[p-1]||u)+1:p+1:m+1;k=[];l=[];r=[];m=n;for(p=q;m||p;)q=h[m][p]-1,p&&q===h[m][p-1]?l.push(k[k.length]={status:e,value:d[--p],index:p}):m&&q===h[m-1][p]?r.push(k[k.length]={status:f,value:b[--m],index:m}):(--p,--m,g.sparse||k.push({status:"retained",value:d[p]}));a.a.Ac(r,l,!g.dontLimitMoves&&10*n);return k.reverse()}
|
||||
return function(a,d,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<d.length?b(a,d,"added","deleted",e):b(d,a,"deleted","added",e)}}();a.b("utils.compareArrays",a.a.Jb);(function(){function b(b,c,d,k,l){var h=[],m=a.X(function(){var m=c(d,l,a.a.Oa(h,b))||[];0<h.length&&(a.a.Lc(h,m),k&&a.u.C(k,null,[d,m,l]));h.length=0;a.a.Hb(h,m)},null,{j:b,Ma:function(){return!a.a.Vc(h)}});return{W:h,X:m.ia()?m:p}}var c=a.a.h.ea(),d=a.a.h.ea();a.a.Zb=function(e,f,g,k,l,h){function m(b){x=
|
||||
{ua:b,lb:a.ra(y++)};u.push(x);v||F.push(x)}function n(b){x=q[b];y!==x.lb.w()&&D.push(x);x.lb(y++);a.a.Oa(x.W,e);u.push(x)}function r(b,c){if(b)for(var d=0,e=c.length;d<e;d++)a.a.K(c[d].W,function(a){b(a,d,c[d].ua)})}f=f||[];"undefined"==typeof f.length&&(f=[f]);k=k||{};var q=a.a.h.get(e,c),v=!q,u=[],t=0,y=0,z=[],A=[],B=[],D=[],F=[],x,G=0;if(v)a.a.K(f,m);else{if(!h||q&&q._countWaitingForRemove){var C=Array.prototype.map.call(q,function(a){return a.ua});h=a.a.Jb(C,f,{dontLimitMoves:k.dontLimitMoves,
|
||||
sparse:!0})}for(var C=0,E,H,J;E=h[C];C++)switch(H=E.moved,J=E.index,E.status){case "deleted":for(;t<J;)n(t++);H===p&&(x=q[t],x.X&&(x.X.s(),x.X=p),a.a.Oa(x.W,e).length&&(k.beforeRemove&&(u.push(x),G++,x.ua===d?x=null:B.push(x)),x&&z.push.apply(z,x.W)));t++;break;case "added":for(;y<J;)n(t++);H!==p?(A.push(u.length),n(H)):m(E.value)}for(;y<f.length;)n(t++);u._countWaitingForRemove=G}a.a.h.set(e,c,u);r(k.beforeMove,D);a.a.K(z,k.beforeRemove?a.ma:a.removeNode);var K,L,z=e.ownerDocument.activeElement;
|
||||
if(A.length)for(;(C=A.shift())!=p;){x=u[C];for(K=p;C;)if((L=u[--C].W)&&L.length){K=L[L.length-1];break}for(f=0;t=x.W[f];K=t,f++)a.g.Qb(e,t,K)}for(C=0;x=u[C];C++){x.W||a.a.extend(x,b(e,g,x.ua,l,x.lb));for(f=0;t=x.W[f];K=t,f++)a.g.Qb(e,t,K);!x.nd&&l&&(l(x.ua,x.W,x.lb),x.nd=!0,K=x.W[x.W.length-1])}z&&e.ownerDocument.activeElement!=z&&z.focus();r(k.beforeRemove,B);for(C=0;C<B.length;++C)B[C].ua=d;r(k.afterMove,D);r(k.afterAdd,F)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.Zb);a.Z=function(){this.allowTemplateRewriting=
|
||||
!1};a.Z.prototype=new a.ga;a.Z.prototype.constructor=a.Z;a.Z.prototype.renderTemplateSource=function(b,c,d,e){if(c=b.vd?b.vd():null)return a.a.ya(c.cloneNode(!0).childNodes);b=b.text();return a.a.Ua(b,e)};a.Z.Fa=new a.Z;a.Mc(a.Z.Fa);a.b("nativeTemplateEngine",a.Z)})})();})();
|
||||
(function() {'use strict';var ea="function"==typeof Object.defineProperties?Object.defineProperty:function(x,I,J){if(x==Array.prototype||x==Object.prototype)return x;x[I]=J.value;return x};function fa(x){x=["object"==typeof globalThis&&globalThis,x,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var I=0;I<x.length;++I){var J=x[I];if(J&&J.Math==Math)return J}throw Error("Cannot find global object");}var ha=fa(this);
|
||||
function ia(x,I){if(I)a:{var J=ha;x=x.split(".");for(var N=0;N<x.length-1;N++){var S=x[N];if(!(S in J))break a;J=J[S]}x=x[x.length-1];N=J[x];I=I(N);I!=N&&null!=I&&ea(J,x,{configurable:!0,writable:!0,value:I})}}ia("Object.entries",function(x){return x?x:function(I){var J=[],N;for(N in I)Object.prototype.hasOwnProperty.call(I,N)&&J.push([N,I[N]]);return J}});
|
||||
(function(x){var I=this||(0,eval)("this"),J=I.document,N=I.jQuery;N||"undefined"===typeof jQuery||(N=jQuery);(function(S){"function"===typeof define&&define.amd?define(["exports","require"],S):"object"===typeof exports&&"object"===typeof module?S(module.exports||exports):S(I.ko={})})(function(S,ca){function Z(b,c){return null===b||typeof b in ja?b===c:!1}function ka(b,c){var d;return()=>{d||(d=a.a.setTimeout(()=>{d=x;b()},c))}}function la(b,c){var d;return()=>{clearTimeout(d);d=a.a.setTimeout(b,c)}}
|
||||
function ma(b,c){c&&"change"!==c?"beforeChange"===c?this.fc(b):this.Ta(b,c):this.hc(b)}function na(b,c){null!==c&&c.m&&c.m()}function oa(b,c){var d=this.ad,f=d[E];f.la||(this.Eb&&this.$a[c]?(d.lc(c,b,this.$a[c]),this.$a[c]=null,--this.Eb):f.D[c]||d.lc(c,b,f.G?{Z:b}:d.Mc(b)),b.za&&b.Rc())}var a="undefined"!==typeof S?S:{};a.b=function(b,c){b=b.split(".");for(var d=a,f=0;f<b.length-1;f++)d=d[b[f]];d[b[b.length-1]]=c};a.H=function(b,c,d){b[c]=d};a.version="3.5.1-pre";a.b("version",a.version);a.options=
|
||||
{deferUpdates:!1,foreachHidesDestroyed:!1};a.a=(()=>{function b(e,k,g,l){return Array.prototype[e].call(k,g,l)}function c(e,k){k&&Object.entries(k).forEach(g=>e[g[0]]=g[1]);return e}function d(e,k){e.__proto__=k;return e}var f={__proto__:[]}instanceof Array;return{R:(e,k,g)=>b("forEach",e,k,g),$:(e,k)=>b("indexOf",e,k),zb:(e,k,g)=>{for(var l=0,h=e.length;l<h;l++)if(k.call(g,e[l],l,e))return e[l];return x},Da:(e,k)=>{k=a.a.$(e,k);0<k?e.splice(k,1):0===k&&e.shift()},Wa:(e,k,g)=>e?b("filter",e,k,g):
|
||||
[],Ab:(e,k)=>{if(k instanceof Array)e.push.apply(e,k);else for(var g=0,l=k.length;g<l;g++)e.push(k[g]);return e},qa:f,extend:c,setPrototypeOf:d,pb:f?d:c,K:function(e,k){e&&Object.entries(e).forEach(g=>k(g[0],g[1]))},ua:(e,k,g)=>{if(!e)return e;var l={};Object.entries(e).forEach(h=>l[h[0]]=k.call(g,h[1],h[0],e));return l},Hb:e=>{for(;e.firstChild;)a.removeNode(e.firstChild)},Mb:e=>{var k=a.a.ta(e),g=(k[0]&&k[0].ownerDocument||J).createElement("div");e.forEach(l=>g.append(a.ja(l)));return g},Bb:(e,
|
||||
k)=>b("map",e,k?g=>a.ja(g.cloneNode(!0)):g=>g.cloneNode(!0)),wa:(e,k)=>{a.a.Hb(e);k&&e.append.apply(e,k)},Kc:(e,k)=>{e=e.nodeType?[e]:e;if(0<e.length){var g=e[0],l=g.parentNode,h;var m=0;for(h=k.length;m<h;m++)l.insertBefore(k[m],g);m=0;for(h=e.length;m<h;m++)a.removeNode(e[m])}},Ia:(e,k)=>{if(e.length){for(k=8===k.nodeType&&k.parentNode||k;e.length&&e[0].parentNode!==k;)e.splice(0,1);for(;1<e.length&&e[e.length-1].parentNode!==k;)e.length--;if(1<e.length){k=e[0];var g=e[e.length-1];for(e.length=
|
||||
0;k!==g;)e.push(k),k=k.nextSibling;e.push(g)}}return e},Xb:e=>null===e||e===x?"":e.trim?e.trim():e.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),zd:(e,k)=>{e=e||"";return k.length>e.length?!1:e.substring(0,k.length)===k},ed:(e,k)=>k.contains(1!==e.nodeType?e.parentNode:e),Gb:e=>a.a.ed(e,e.ownerDocument.documentElement),Vc:e=>!!a.a.zb(e,a.a.Gb),ia:e=>e&&e.tagName&&e.tagName.toLowerCase(),rc:e=>a.onError?function(){try{return e.apply(this,arguments)}catch(k){throw a.onError&&a.onError(k),k;}}:e,setTimeout:(e,
|
||||
k)=>setTimeout(a.a.rc(e),k),wc:e=>setTimeout(()=>{a.onError&&a.onError(e);throw e;},0),L:(e,k,g)=>{e.addEventListener(k,a.a.rc(g),!1)},sb:(e,k)=>{if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");e.dispatchEvent(new Event(k))},h:e=>a.T(e)?e():e,Ic:e=>a.T(e)?e.A():e,rb:function(e,k,g){if(k){var l=g?"add":"remove";k.split(/\s+/).forEach(h=>e.classList[l](h))}},qb:(e,k)=>{k=a.a.h(k);if(null===k||k===x)k="";var g=a.g.firstChild(e);!g||3!=g.nodeType||a.g.nextSibling(g)?
|
||||
a.g.wa(e,[e.ownerDocument.createTextNode(k)]):g.data=k},ta:e=>Array.from(e)}})();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.R);a.b("utils.arrayFirst",a.a.zb);a.b("utils.arrayFilter",a.a.Wa);a.b("utils.arrayIndexOf",a.a.$);a.b("utils.arrayPushAll",a.a.Ab);a.b("utils.arrayRemoveItem",a.a.Da);a.b("utils.cloneNodes",a.a.Bb);a.b("utils.extend",a.a.extend);a.b("utils.objectMap",a.a.ua);a.b("utils.peekObservable",a.a.Ic);a.b("utils.registerEventHandler",a.a.L);a.b("utils.stringifyJson",a.a.Ed);a.b("utils.toggleDomNodeCssClass",
|
||||
a.a.rb);a.b("utils.triggerEvent",a.a.sb);a.b("utils.unwrapObservable",a.a.h);a.b("utils.objectForEach",a.a.K);a.b("utils.setTextContent",a.a.qb);a.b("unwrap",a.a.h);a.a.c=new function(){var b=0,c="__ko__"+Date.now(),d=(f,e)=>{var k=f[c];!k&&e&&(k=f[c]={});return k};return{get:(f,e)=>(f=d(f,!1))&&f[e],set:(f,e,k)=>{(f=d(f,k!==x))&&(f[e]=k)},Ib:(f,e,k)=>{f=d(f,!0);return f[e]||(f[e]=k)},clear:f=>f[c]?(delete f[c],!0):!1,da:()=>b++ +c}};a.b("utils.domData",a.a.c);a.b("utils.domData.clear",a.a.c.clear);
|
||||
a.a.M=new function(){function b(g,l){var h=a.a.c.get(g,f);h===x&&l&&(h=[],a.a.c.set(g,f,h));return h}function c(g){var l=b(g,!1);if(l){l=l.slice(0);for(var h=0;h<l.length;h++)l[h](g)}a.a.c.clear(g);k[g.nodeType]&&d(g.childNodes,!0)}function d(g,l){for(var h=[],m,n=0;n<g.length;n++)if(!l||8===g[n].nodeType)if(c(h[h.length]=m=g[n]),g[n]!==m)for(;n--&&-1==a.a.$(h,g[n]););}var f=a.a.c.da(),e={1:!0,8:!0,9:!0},k={1:!0,9:!0};return{Ca:(g,l)=>{if("function"!=typeof l)throw Error("Callback must be a function");
|
||||
b(g,!0).push(l)},nb:(g,l)=>{var h=b(g,!1);h&&(a.a.Da(h,l),0==h.length&&a.a.c.set(g,f,x))},ja:g=>{a.o.F(()=>{e[g.nodeType]&&(c(g),k[g.nodeType]&&d(g.getElementsByTagName("*")))});return g},removeNode:g=>{a.ja(g);g.parentNode&&g.parentNode.removeChild(g)}}};a.ja=a.a.M.ja;a.removeNode=a.a.M.removeNode;a.b("cleanNode",a.ja);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.M);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.M.Ca);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.M.nb);
|
||||
(()=>{var b=[0,"",""],c=[1,"<table>","</table>"],d=[3,"<table><tbody><tr>","</tr></tbody></table>"],f=[1,"<select multiple='multiple'>","</select>"],e={thead:c,tbody:c,tfoot:c,tr:[2,"<table><tbody>","</tbody></table>"],td:d,th:d,option:f,optgroup:f};a.a.Ma=(k,g)=>{var l=g;l||(l=J);g=l.parentWindow||l.defaultView||I;var h=a.a.Xb(k).toLowerCase();l=l.createElement("div");var m=(h=h.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&e[h[1]]||b;h=m[0];k="ignored<div>"+m[1]+k+m[2]+"</div>";for("function"==
|
||||
typeof g.innerShiv?l.append(g.innerShiv(k)):l.innerHTML=k;h--;)l=l.lastChild;return a.a.ta(l.lastChild.childNodes)};a.a.vd=(k,g)=>{k=a.a.Ma(k,g);return k.length&&k[0].parentElement||a.a.Mb(k)};a.a.Vb=(k,g)=>{a.a.Hb(k);g=a.a.h(g);if(null!==g&&g!==x){"string"!=typeof g&&(g=g.toString());g=a.a.Ma(g,k.ownerDocument);for(var l=0;l<g.length;l++)k.appendChild(g[l])}}})();a.b("utils.parseHtmlFragment",a.a.Ma);a.b("utils.setHtml",a.a.Vb);a.X=function(){function b(d,f){if(d)if(8==d.nodeType){var e=a.X.Hc(d.nodeValue);
|
||||
null!=e&&f.push({dd:d,rd:e})}else if(1==d.nodeType){e=0;d=d.childNodes;for(var k=d.length;e<k;e++)b(d[e],f)}}var c={};return{Lb:d=>{if("function"!=typeof d)throw Error("You can only pass a function to ko.memoization.memoize()");var f=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[f]=d;return"\x3c!--[ko_memo:"+f+"]--\x3e"},Nc:(d,f)=>{var e=c[d];if(e===x)throw Error("Couldn't find any memo with ID "+d+". Perhaps it's already been unmemoized.");
|
||||
try{return e.apply(null,f||[]),!0}finally{delete c[d]}},Oc:(d,f)=>{var e=[];b(d,e);d=0;for(var k=e.length;d<k;d++){var g=e[d].dd,l=[g];f&&a.a.Ab(l,f);a.X.Nc(e[d].rd,l);g.nodeValue="";g.parentNode&&g.parentNode.removeChild(g)}},Hc:d=>(d=d.match(/^\[ko_memo:(.*?)\]$/))?d[1]:null}}();a.b("memoization",a.X);a.b("memoization.memoize",a.X.Lb);a.b("memoization.unmemoize",a.X.Nc);a.b("memoization.parseMemoText",a.X.Hc);a.b("memoization.unmemoizeDomNodeAndDescendants",a.X.Oc);a.xa=(()=>{function b(){if(d)for(var g=
|
||||
d,l=0,h;e<d;)if(h=c[e++]){if(e>g){if(5E3<=++l){e=d;a.a.wc(Error("'Too much recursion' after processing "+l+" task groups."));break}g=d}try{h()}catch(m){a.a.wc(m)}}e=d=c.length=0}var c=[],d=0,f=1,e=0,k=(g=>{var l=J.createElement("div");(new MutationObserver(g)).observe(l,{attributes:!0});return()=>l.classList.toggle("foo")})(b);return{ob:g=>{d||k(b);c[d++]=g;return f++},cancel:g=>{g-=f-d;g>=e&&g<d&&(c[g]=null)}}})();a.b("tasks",a.xa);a.b("tasks.schedule",a.xa.ob);a.Ha={throttle:(b,c)=>{b.throttleEvaluation=
|
||||
c;var d=null;return a.W({read:b,write:f=>{clearTimeout(d);d=a.a.setTimeout(()=>b(f),c)}})},rateLimit:(b,c)=>{if("number"==typeof c)var d=c;else{d=c.timeout;var f=c.method}b.vb=!1;var e="function"==typeof f?f:"notifyWhenChangesStop"==f?la:ka;b.lb(k=>e(k,d,c))},deferred:(b,c)=>{if(!0!==c)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");b.vb||(b.vb=!0,b.lb(d=>{var f,e=!1;return()=>{if(!e){a.xa.cancel(f);f=a.xa.ob(d);
|
||||
try{e=!0,b.notifySubscribers(x,"dirty")}finally{e=!1}}}}))},notify:(b,c)=>{b.equalityComparer="always"==c?null:Z}};var ja={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.Ha);a.Yb=function(b,c,d){this.Z=b;this.bc=c;this.cc=d;this.wb=!1;this.Sa=this.xb=null;a.H(this,"dispose",this.m);a.H(this,"disposeWhenNodeIsRemoved",this.l)};a.Yb.prototype.m=function(){this.wb||(this.Sa&&a.a.M.nb(this.xb,this.Sa),this.wb=!0,this.cc(),this.Z=this.bc=this.cc=this.xb=this.Sa=null)};a.Yb.prototype.l=function(b){this.xb=
|
||||
b;a.a.M.Ca(b,this.Sa=this.m.bind(this))};a.O=function(){a.a.pb(this,Q);Q.fb(this)};var Q={fb:b=>{b.P={change:[]};b.jc=1},subscribe:function(b,c,d){var f=this;d=d||"change";var e=new a.Yb(f,c?b.bind(c):b,()=>{a.a.Da(f.P[d],e);f.Ua&&f.Ua(d)});f.Ea&&f.Ea(d);f.P[d]||(f.P[d]=[]);f.P[d].push(e);return e},notifySubscribers:function(b,c){c=c||"change";"change"===c&&this.ub();if(this.Ka(c)){c="change"===c&&this.Pc||this.P[c].slice(0);try{a.o.oc();for(var d=0,f;f=c[d];++d)f.wb||f.bc(b)}finally{a.o.end()}}},
|
||||
cb:function(){return this.jc},ld:function(b){return this.cb()!==b},ub:function(){++this.jc},lb:function(b){var c=this,d=a.T(c),f,e,k,g,l;c.Ta||(c.Ta=c.notifySubscribers,c.notifySubscribers=ma);var h=b(()=>{c.za=!1;d&&g===c&&(g=c.dc?c.dc():c());var m=e||l&&c.hb(k,g);l=e=f=!1;m&&c.Ta(k=g)});c.hc=(m,n)=>{n&&c.za||(l=!n);c.Pc=c.P.change.slice(0);c.za=f=!0;g=m;h()};c.fc=m=>{f||(k=m,c.Ta(m,"beforeChange"))};c.ic=()=>{l=!0};c.Rc=()=>{c.hb(k,c.A(!0))&&(e=!0)}},Ka:function(b){return this.P[b]&&this.P[b].length},
|
||||
jd:function(b){if(b)return this.P[b]&&this.P[b].length||0;var c=0;a.a.K(this.P,(d,f)=>{"dirty"!==d&&(c+=f.length)});return c},hb:function(b,c){return!this.equalityComparer||!this.equalityComparer(b,c)},toString:()=>"[object Object]",extend:function(b){var c=this;b&&a.a.K(b,(d,f)=>{d=a.Ha[d];"function"==typeof d&&(c=d(c,f)||c)});return c}};a.H(Q,"init",Q.fb);a.H(Q,"subscribe",Q.subscribe);a.H(Q,"extend",Q.extend);a.H(Q,"getSubscriptionsCount",Q.jd);a.a.qa&&a.a.setPrototypeOf(Q,Function.prototype);
|
||||
a.O.fn=Q;a.Ec=b=>null!=b&&"function"==typeof b.subscribe&&"function"==typeof b.notifySubscribers;a.b("subscribable",a.O);a.b("isSubscribable",a.Ec);a.ka=a.o=(()=>{function b(k){d.push(f);f=k}function c(){f=d.pop()}var d=[],f,e=0;return{oc:b,end:c,Sb:k=>{if(f){if(!a.Ec(k))throw Error("Only subscribable things can act as dependencies");f.Zc.call(f.$c,k,k.Qc||(k.Qc=++e))}},F:(k,g,l)=>{try{return b(),k.apply(g,l||[])}finally{c()}},bb:()=>{if(f)return f.s.bb()},Ja:()=>{if(f)return f.s.Ja()},ib:()=>{if(f)return f.ib},
|
||||
s:()=>{if(f)return f.s}}})();a.b("computedContext",a.ka);a.b("computedContext.getDependenciesCount",a.ka.bb);a.b("computedContext.getDependencies",a.ka.Ja);a.b("computedContext.isInitial",a.ka.ib);a.b("computedContext.registerDependency",a.ka.Sb);a.b("ignoreDependencies",a.Dd=a.o.F);var U=Symbol("_latestValue");a.na=b=>{function c(){if(0<arguments.length)return c.hb(c[U],arguments[0])&&(c.Qa(),c[U]=arguments[0],c.Pa()),this;a.o.Sb(c);return c[U]}c[U]=b;a.a.qa||a.a.extend(c,a.O.fn);a.O.fn.fb(c);a.a.pb(c,
|
||||
R);a.options.deferUpdates&&a.Ha.deferred(c,!0);return c};var R={equalityComparer:Z,A:function(){return this[U]},Pa:function(){this.notifySubscribers(this[U],"spectate");this.notifySubscribers(this[U])},Qa:function(){this.notifySubscribers(this[U],"beforeChange")}};a.a.qa&&a.a.setPrototypeOf(R,a.O.fn);var V=a.na.Sc="__ko_proto__";R[V]=a.na;a.T=b=>{if((b="function"==typeof b&&b[V])&&b!==R[V]&&b!==a.s.fn[V])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
|
||||
return!!b};a.kb=b=>"function"==typeof b&&(b[V]===R[V]||b[V]===a.s.fn[V]&&b.Bc);a.b("observable",a.na);a.b("isObservable",a.T);a.b("isWriteableObservable",a.kb);a.b("isWritableObservable",a.kb);a.b("observable.fn",R);a.H(R,"peek",R.A);a.H(R,"valueHasMutated",R.Pa);a.H(R,"valueWillMutate",R.Qa);a.va=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.na(b);a.a.pb(b,a.va.fn);return b.extend({trackArrayChanges:!0})};
|
||||
a.va.fn={remove:function(b){for(var c=this.A(),d=[],f="function"!=typeof b||a.T(b)?function(g){return g===b}:b,e=0;e<c.length;e++){var k=c[e];if(f(k)){0===d.length&&this.Qa();if(c[e]!==k)throw Error("Array modified during remove; cannot remove item");d.push(k);c.splice(e,1);e--}}d.length&&this.Pa();return d},removeAll:function(b){if(b===x){var c=this.A(),d=c.slice(0);this.Qa();c.splice(0,c.length);this.Pa();return d}return b?this.remove(function(f){return 0<=a.a.$(b,f)}):[]},indexOf:function(b){return a.a.$(this(),
|
||||
b)}};a.a.qa&&a.a.setPrototypeOf(a.va.fn,a.na.fn);a.a.R("pop push reverse shift sort splice unshift".split(" "),b=>{a.va.fn[b]=function(){var c=this.A();this.Qa();this.qc(c,b,arguments);var d=c[b].apply(c,arguments);this.Pa();return d===c?this:d}});a.a.R(["slice"],b=>{a.va.fn[b]=function(){var c=this();return c[b].apply(c,arguments)}});a.Dc=b=>a.T(b)&&"function"==typeof b.remove&&"function"==typeof b.push;a.b("observableArray",a.va);a.b("isObservableArray",a.Dc);a.Ha.trackArrayChanges=(b,c)=>{function d(){function p(){if(l){var r=
|
||||
[].concat(b.A()||[]);if(b.Ka("arrayChange")){if(!e||1<l)e=a.a.Db(h,r,b.Cb);var w=e}h=r;e=null;l=0;w&&w.length&&b.notifySubscribers(w,"arrayChange")}}f?p():(f=!0,g=b.subscribe(()=>++l,null,"spectate"),h=[].concat(b.A()||[]),e=null,k=b.subscribe(p))}b.Cb={};c&&"object"==typeof c&&a.a.extend(b.Cb,c);b.Cb.sparse=!0;if(!b.qc){var f=!1,e=null,k,g,l=0,h,m=b.Ea,n=b.Ua;b.Ea=p=>{m&&m.call(b,p);"arrayChange"===p&&d()};b.Ua=p=>{n&&n.call(b,p);"arrayChange"!==p||b.Ka("arrayChange")||(k&&k.m(),g&&g.m(),g=k=null,
|
||||
f=!1,h=x)};b.qc=(p,r,w)=>{function y(F,z,D){return v[v.length]={status:F,value:z,index:D}}if(f&&!l){var v=[],A=p.length,C=w.length,q=0;switch(r){case "push":q=A;case "unshift":for(r=0;r<C;r++)y("added",w[r],q+r);break;case "pop":q=A-1;case "shift":A&&y("deleted",p[q],q);break;case "splice":r=Math.min(Math.max(0,0>w[0]?A+w[0]:w[0]),A);A=1===C?A:Math.min(r+(w[1]||0),A);C=r+C-2;q=Math.max(A,C);for(var u=[],t=[],B=2;r<q;++r,++B)r<A&&t.push(y("deleted",p[r],r)),r<C&&u.push(y("added",w[B],r));a.a.zc(t,
|
||||
u);break;default:return}e=v}}}};var E=Symbol("_state");a.s=a.W=function(b,c,d){function f(){if(0<arguments.length){if("function"===typeof e)e.apply(k.ab,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.la||a.o.Sb(f);(k.ha||k.G&&f.La())&&f.ca();return k.U}"object"===typeof b?d=b:(d=d||{},b&&(d.read=b));if("function"!=typeof d.read)throw Error("Pass a function that returns the value of the ko.computed");
|
||||
var e=d.write,k={U:x,ma:!0,ha:!0,gb:!1,Zb:!1,la:!1,mb:!1,G:!1,Jc:d.read,ab:c||d.owner,l:d.disposeWhenNodeIsRemoved||d.l||null,Fa:d.disposeWhen||d.Fa,Fb:null,D:{},S:0,yc:null};f[E]=k;f.Bc="function"===typeof e;a.a.qa||a.a.extend(f,a.O.fn);a.O.fn.fb(f);a.a.pb(f,M);d.pure?(k.mb=!0,k.G=!0,a.a.extend(f,pa)):d.deferEvaluation&&a.a.extend(f,qa);a.options.deferUpdates&&a.Ha.deferred(f,!0);k.l&&(k.Zb=!0,k.l.nodeType||(k.l=null));k.G||d.deferEvaluation||f.ca();k.l&&f.ga()&&a.a.M.Ca(k.l,k.Fb=function(){f.m()});
|
||||
return f};var M={equalityComparer:Z,bb:function(){return this[E].S},Ja:function(){var b=[];a.a.K(this[E].D,(c,d)=>b[d.Aa]=d.Z);return b},Jb:function(b){if(!this[E].S)return!1;var c=this.Ja();return-1!==a.a.$(c,b)?!0:!!a.a.zb(c,d=>d.Jb&&d.Jb(b))},lc:function(b,c,d){if(this[E].mb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[E].D[b]=d;d.Aa=this[E].S++;d.Ba=c.cb()},La:function(){var b,c=this[E].D;for(b in c)if(Object.prototype.hasOwnProperty.call(c,b)){var d=c[b];if(this.ya&&
|
||||
d.Z.za||d.Z.ld(d.Ba))return!0}},qd:function(){this.ya&&!this[E].gb&&this.ya(!1)},ga:function(){var b=this[E];return b.ha||0<b.S},xd:function(){this.za?this[E].ha&&(this[E].ma=!0):this.xc()},Mc:function(b){if(b.vb){var c=b.subscribe(this.qd,this,"dirty"),d=b.subscribe(this.xd,this);return{Z:b,m:()=>{c.m();d.m()}}}return b.subscribe(this.xc,this)},xc:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[E].yc),this[E].yc=a.a.setTimeout(()=>b.ca(!0),c)):b.ya?b.ya(!0):b.ca(!0)},ca:function(b){var c=
|
||||
this[E],d=c.Fa,f=!1;if(!c.gb&&!c.la){if(c.l&&!a.a.Gb(c.l)||d&&d()){if(!c.Zb){this.m();return}}else c.Zb=!1;c.gb=!0;try{f=this.hd(b)}finally{c.gb=!1}return f}},hd:function(b){var c=this[E],d=c.mb?x:!c.S;var f={ad:this,$a:c.D,Eb:c.S};a.o.oc({$c:f,Zc:oa,s:this,ib:d});c.D={};c.S=0;var e=this.gd(c,f);c.S?f=this.hb(c.U,e):(this.m(),f=!0);f&&(c.G?this.ub():this.notifySubscribers(c.U,"beforeChange"),c.U=e,this.notifySubscribers(c.U,"spectate"),!c.G&&b&&this.notifySubscribers(c.U),this.ic&&this.ic());d&&this.notifySubscribers(c.U,
|
||||
"awake");return f},gd:(b,c)=>{try{var d=b.Jc;return b.ab?d.call(b.ab):d()}finally{a.o.end(),c.Eb&&!b.G&&a.a.K(c.$a,na),b.ma=b.ha=!1}},A:function(b){var c=this[E];(c.ha&&(b||!c.S)||c.G&&this.La())&&this.ca();return c.U},lb:function(b){a.O.fn.lb.call(this,b);this.dc=function(){this[E].G||(this[E].ma?this.ca():this[E].ha=!1);return this[E].U};this.ya=function(c){this.fc(this[E].U);this[E].ha=!0;c&&(this[E].ma=!0);this.hc(this,!c)}},m:function(){var b=this[E];!b.G&&b.D&&a.a.K(b.D,(c,d)=>d.m&&d.m());b.l&&
|
||||
b.Fb&&a.a.M.nb(b.l,b.Fb);b.D=x;b.S=0;b.la=!0;b.ma=!1;b.ha=!1;b.G=!1;b.l=x;b.Fa=x;b.Jc=x;this.Bc||(b.ab=x)}},pa={Ea:function(b){var c=this,d=c[E];if(!d.la&&d.G&&"change"==b){d.G=!1;if(d.ma||c.La())d.D=null,d.S=0,c.ca()&&c.ub();else{var f=[];a.a.K(d.D,(e,k)=>f[k.Aa]=e);a.a.R(f,(e,k)=>{var g=d.D[e],l=c.Mc(g.Z);l.Aa=k;l.Ba=g.Ba;d.D[e]=l});c.La()&&c.ca()&&c.ub()}d.la||c.notifySubscribers(d.U,"awake")}},Ua:function(b){var c=this[E];c.la||"change"!=b||this.Ka("change")||(a.a.K(c.D,(d,f)=>{f.m&&(c.D[d]={Z:f.Z,
|
||||
Aa:f.Aa,Ba:f.Ba},f.m())}),c.G=!0,this.notifySubscribers(x,"asleep"))},cb:function(){var b=this[E];b.G&&(b.ma||this.La())&&this.ca();return a.O.fn.cb.call(this)}},qa={Ea:function(b){"change"!=b&&"beforeChange"!=b||this.A()}};a.a.qa&&a.a.setPrototypeOf(M,a.O.fn);var aa=a.na.Sc;M[aa]=a.s;a.Cc=b=>"function"==typeof b&&b[aa]===M[aa];a.nd=b=>a.Cc(b)&&b[E]&&b[E].mb;a.b("computed",a.s);a.b("dependentObservable",a.s);a.b("isComputed",a.Cc);a.b("isPureComputed",a.nd);a.b("computed.fn",M);a.H(M,"peek",M.A);
|
||||
a.H(M,"dispose",M.m);a.H(M,"isActive",M.ga);a.H(M,"getDependenciesCount",M.bb);a.H(M,"getDependencies",M.Ja);a.Rb=(b,c)=>{if("function"===typeof b)return a.s(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.s(b,c)};a.b("pureComputed",a.Rb);a.Bd=(b,c,d)=>{function f(e){var k=a.Rb(b,d).extend({notify:"always"}),g=k.subscribe(l=>{l&&(g.m(),e(l))});k.notifySubscribers(k.A());return g}return c?f(c.bind(d)):new Promise(f)};a.b("when",a.Bd);(()=>{a.v={N:b=>{switch(a.a.ia(b)){case "option":return!0===
|
||||
b.__ko__hasDomDataOptionValue__?a.a.c.get(b,a.f.options.Ob):b.value;case "select":return 0<=b.selectedIndex?a.v.N(b.options[b.selectedIndex]):x;default:return b.value}},Ra:(b,c,d)=>{switch(a.a.ia(b)){case "option":"string"===typeof c?(a.a.c.set(b,a.f.options.Ob,x),delete b.__ko__hasDomDataOptionValue__,b.value=c):(a.a.c.set(b,a.f.options.Ob,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:"");break;case "select":if(""===c||null===c)c=x;for(var f=-1,e=0,k=b.options.length,g;e<k;++e)if(g=
|
||||
a.v.N(b.options[e]),g==c||""===g&&c===x){f=e;break}if(d||0<=f||c===x&&1<b.size)b.selectedIndex=f;break;default:if(null===c||c===x)c="";b.value=c}}}})();a.b("selectExtensions",a.v);a.b("selectExtensions.readValue",a.v.N);a.b("selectExtensions.writeValue",a.v.Ra);a.u=(()=>{function b(l){l=a.a.Xb(l);123===l.charCodeAt(0)&&(l=l.slice(1,-1));l+="\n,";var h=[],m=l.match(f),n=[],p=0;if(1<m.length){for(var r=0,w;w=m[r];++r){var y=w.charCodeAt(0);if(44===y){if(0>=p){h.push(v&&n.length?{key:v,value:n.join("")}:
|
||||
{unknown:v||n.join("")});var v=p=0;n=[];continue}}else if(58===y){if(!p&&!v&&1===n.length){v=n.pop();continue}}else if(47===y&&1<w.length&&(47===w.charCodeAt(1)||42===w.charCodeAt(1)))continue;else 47===y&&r&&1<w.length?(y=m[r-1].match(e))&&!k[y[0]]&&(l=l.substr(l.indexOf(w)+1),m=l.match(f),r=-1,w="/"):40===y||123===y||91===y?++p:41===y||125===y||93===y?--p:v||n.length||34!==y&&39!==y||(w=w.slice(1,-1));n.push(w)}if(0<p)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true",
|
||||
"false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,f=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,e=/[\])"'A-Za-z0-9_$]+$/,k={"in":1,"return":1,"typeof":1},g={};return{Ya:[],tb:g,Pb:b,Qb:function(l,h){function m(y,v){if(!w){var A=a.getBindingHandler(y);if(A&&A.preprocess&&!(v=A.preprocess(v,y,m)))return;if(A=g[y]){var C=v;0<=a.a.$(c,C)?C=!1:(A=C.match(d),
|
||||
C=null===A?!1:A[1]?"Object("+A[1]+")"+A[2]:C);A=C}A&&p.push("'"+("string"==typeof g[y]?g[y]:y)+"':function(_z){"+C+"=_z}")}r&&(v="function(){return "+v+" }");n.push("'"+y+"':"+v)}h=h||{};var n=[],p=[],r=h.valueAccessors,w=h.bindingParams;l="string"===typeof l?b(l):l;a.a.R(l,y=>m(y.key||y.unknown,y.value));p.length&&m("_ko_property_writers","{"+p.join(",")+" }");return n.join(",")},pd:(l,h)=>{for(var m=0;m<l.length;m++)if(l[m].key==h)return!0;return!1},ac:(l,h,m,n,p)=>{if(l&&a.T(l))!a.kb(l)||p&&l.A()===
|
||||
n||l(n);else if((l=h.get("_ko_property_writers"))&&l[m])l[m](n)}}})();a.b("expressionRewriting",a.u);a.b("expressionRewriting.bindingRewriteValidators",a.u.Ya);a.b("expressionRewriting.parseObjectLiteral",a.u.Pb);a.b("expressionRewriting.preProcessBindings",a.u.Qb);(()=>{function b(g){return 8==g.nodeType&&f.test(g.nodeValue)}function c(g){return 8==g.nodeType&&e.test(g.nodeValue)}function d(g,l){for(var h=g,m=1,n=[];h=h.nextSibling;){if(c(h)&&(a.a.c.set(h,k,!0),m--,0===m))return n;n.push(h);b(h)&&
|
||||
m++}if(!l)throw Error("Cannot find closing comment tag to match: "+g.nodeValue);return null}var f=/^\s*ko(?:\s+([\s\S]+))?\s*$/,e=/^\s*\/ko\s*$/,k="__ko_matchedEndComment__";a.g={oa:{},childNodes:g=>b(g)?d(g):g.childNodes,Ga:g=>{if(b(g)){g=a.g.childNodes(g);for(var l=0,h=g.length;l<h;l++)a.removeNode(g[l])}else a.a.Hb(g)},wa:(g,l)=>{if(b(g)){a.g.Ga(g);g=g.nextSibling;for(var h=0,m=l.length;h<m;h++)g.parentNode.insertBefore(l[h],g)}else a.a.wa(g,l)},prepend:(g,l)=>{if(b(g)){var h=g.nextSibling;g=g.parentNode}else h=
|
||||
g.firstChild;g.insertBefore(l,h)},Kb:(g,l,h)=>{h?(h=h.nextSibling,b(g)&&(g=g.parentNode),g.insertBefore(l,h)):a.g.prepend(g,l)},firstChild:g=>{if(!b(g)){if(g.firstChild&&c(g.firstChild))throw Error("Found invalid end comment, as the first child of "+g);return g.firstChild}return!g.nextSibling||c(g.nextSibling)?null:g.nextSibling},nextSibling:g=>{if(b(g)){var l=d(g,void 0);g=l?0<l.length?l[l.length-1].nextSibling:g.nextSibling:null}if(g.nextSibling&&c(g.nextSibling)){l=g.nextSibling;if(c(l)&&!a.a.c.get(l,
|
||||
k))throw Error("Found end comment without a matching opening comment, as child of "+g);return null}return g.nextSibling},kd:b,Ad:g=>(g=g.nodeValue.match(f))?g[1]:null}})();a.b("virtualElements",a.g);a.b("virtualElements.allowedBindings",a.g.oa);a.b("virtualElements.emptyNode",a.g.Ga);a.b("virtualElements.insertAfter",a.g.Kb);a.b("virtualElements.prepend",a.g.prepend);a.b("virtualElements.setDomNodeChildren",a.g.wa);(function(){a.ba=function(){this.Yc={}};a.a.extend(a.ba.prototype,{nodeHasBindings:b=>
|
||||
{switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind")||a.j.getComponentNameForNode(b);case 8:return a.g.kd(b);default:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c);d=d?this.parseBindingsString(d,c,b):null;return a.j.kc(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,c);d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.j.kc(d,b,c,!0)},getBindingsString:b=>{switch(b.nodeType){case 1:return b.getAttribute("data-bind");
|
||||
case 8:return a.g.Ad(b)}return null},parseBindingsString:function(b,c,d,f){try{var e=this.Yc,k=b+(f&&f.valueAccessors||""),g;if(!(g=e[k])){var l="with($context){with($data||{}){return{"+a.u.Qb(b,f)+"}}}";var h=new Function("$context","$element",l);g=e[k]=h}return g(c,d)}catch(m){throw m.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+m.message,m;}}});a.ba.instance=new a.ba})();a.b("bindingProvider",a.ba);(()=>{function b(q){var u=(q=a.a.c.get(q,C))&&q.I;u&&(q.I=null,u.Gc())}
|
||||
function c(q,u,t){this.node=q;this.pc=u;this.Xa=[];this.J=!1;u.I||a.a.M.Ca(q,b);t&&t.I&&(t.I.Xa.push(q),this.yb=t)}function d(q){return function(){return q}}function f(q){return q()}function e(q){return a.a.ua(a.o.F(q),function(u,t){return function(){return q()[t]}})}function k(q,u,t){return"function"===typeof q?e(q.bind(null,u,t)):a.a.ua(q,d)}function g(q,u){return e(this.getBindings.bind(this,q,u))}function l(q,u){var t=a.g.firstChild(u);if(t){var B,F=a.ba.instance,z=F.preprocessNode;if(z){for(;B=
|
||||
t;)t=a.g.nextSibling(B),z.call(F,B);t=a.g.firstChild(u)}for(;B=t;)t=a.g.nextSibling(B),h(q,B)}a.i.notify(u,a.i.J)}function h(q,u){var t=q;if(1===u.nodeType||a.ba.instance.nodeHasBindings(u))t=n(u,null,q).bindingContextForDescendants;t&&!v[a.a.ia(u)]&&l(t,u)}function m(q){var u=[],t={},B=[];a.a.K(q,function D(z){if(!t[z]){var O=a.getBindingHandler(z);O&&(O.after&&(B.push(z),a.a.R(O.after,function(G){if(q[G]){if(-1!==a.a.$(B,G))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+
|
||||
B.join(", "));D(G)}}),B.length--),u.push({key:z,Ac:O}));t[z]=!0}});return u}function n(q,u,t){var B=a.a.c.Ib(q,C,{}),F=B.Tc;if(!u){if(F)throw Error("You cannot apply bindings multiple times to the same element.");B.Tc=!0}F||(B.context=t);B.Nb||(B.Nb={});if(u&&"function"!==typeof u)var z=u;else{var D=a.ba.instance,O=D.getBindingAccessors||g,G=a.W(function(){if(z=u?u(t,q):O.call(D,q,t)){if(t[r])t[r]();if(t[y])t[y]()}return z},null,{l:q});z&&G.ga()||(G=null)}var K=t,L;if(z){var P=G?H=>()=>(0,G()[H])():
|
||||
H=>z[H];function T(){return a.a.ua(G?G():z,f)}T.get=H=>z[H]&&P(H)();T.has=H=>H in z;a.i.J in z&&a.i.subscribe(q,a.i.J,()=>{var H=(0,z[a.i.J])();if(H){var X=a.g.childNodes(q);X.length&&H(X,a.uc(X[0]))}});a.i.ra in z&&(K=a.i.Wb(q,t),a.i.subscribe(q,a.i.ra,function(){var H=(0,z[a.i.ra])();H&&a.g.firstChild(q)&&H(q)}));B=m(z);a.a.R(B,function(H){var X=H.Ac.init,da=H.Ac.update,W=H.key;if(8===q.nodeType&&!a.g.oa[W])throw Error("The binding '"+W+"' cannot be used with virtual elements");try{"function"==
|
||||
typeof X&&a.o.F(()=>{var Y=X(q,P(W),T,K.$data,K);if(Y&&Y.controlsDescendantBindings){if(L!==x)throw Error("Multiple bindings ("+L+" and "+W+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");L=W}}),"function"==typeof da&&a.W(()=>da(q,P(W),T,K.$data,K),null,{l:q})}catch(Y){throw Y.message='Unable to process binding "'+W+": "+z[W]+'"\nMessage: '+Y.message,Y;}})}B=L===x;return{shouldBindDescendants:B,bindingContextForDescendants:B&&
|
||||
K}}function p(q,u){return q&&q instanceof a.aa?q:new a.aa(q,x,x,u)}var r=Symbol("_subscribable"),w=Symbol("_ancestorBindingInfo"),y=Symbol("_dataDependency");a.f={};var v={script:!0,textarea:!0,template:!0};a.getBindingHandler=q=>a.f[q];var A={};a.aa=function(q,u,t,B,F){function z(){var T=K?G():G,H=a.a.h(T);u?(a.a.extend(D,u),w in u&&(D[w]=u[w])):(D.$parents=[],D.$root=H,D.ko=a);D[r]=P;O?H=D.$data:(D.$rawData=T,D.$data=H);t&&(D[t]=H);B&&B(D,u,H);if(u&&u[r]&&!a.ka.s().Jb(u[r]))u[r]();L&&(D[y]=L);return D.$data}
|
||||
var D=this,O=q===A,G=O?x:q,K="function"==typeof G&&!a.T(G),L=F&&F.dataDependency;if(F&&F.exportDependencies)z();else{var P=a.Rb(z);P.A();P.ga()?P.equalityComparer=null:D[r]=x}};a.aa.prototype.createChildContext=function(q,u,t,B){!B&&u&&"object"==typeof u&&(B=u,u=B.as,t=B.extend);if(u&&B&&B.noChildContext){var F="function"==typeof q&&!a.T(q);return new a.aa(A,this,null,z=>{t&&t(z);z[u]=F?q():q},B)}return new a.aa(q,this,u,(z,D)=>{z.$parentContext=D;z.$parent=D.$data;z.$parents=(D.$parents||[]).slice(0);
|
||||
z.$parents.unshift(z.$parent);t&&t(z)},B)};a.aa.prototype.extend=function(q,u){return new a.aa(A,this,null,t=>a.a.extend(t,"function"==typeof q?q(t):q),u)};var C=a.a.c.da();c.prototype.Gc=function(){this.yb&&this.yb.I&&this.yb.I.cd(this.node)};c.prototype.cd=function(q){a.a.Da(this.Xa,q);!this.Xa.length&&this.J&&this.tc()};c.prototype.tc=function(){this.J=!0;this.pc.I&&!this.Xa.length&&(this.pc.I=null,a.a.M.nb(this.node,b),a.i.notify(this.node,a.i.ra),this.Gc())};a.i={J:"childrenComplete",ra:"descendantsComplete",
|
||||
subscribe:(q,u,t,B,F)=>{var z=a.a.c.Ib(q,C,{});z.sa||(z.sa=new a.O);F&&F.notifyImmediately&&z.Nb[u]&&a.o.F(t,B,[q]);return z.sa.subscribe(t,B,u)},notify:(q,u)=>{var t=a.a.c.get(q,C);if(t&&(t.Nb[u]=!0,t.sa&&t.sa.notifySubscribers(q,u),u==a.i.J))if(t.I)t.I.tc();else if(t.I===x&&t.sa&&t.sa.Ka(a.i.ra))throw Error("descendantsComplete event not supported for bindings on this node");},Wb:(q,u)=>{var t=a.a.c.Ib(q,C,{});t.I||(t.I=new c(q,t,u[w]));return u[w]==t?u:u.extend(B=>{B[w]=t})}};a.yd=q=>(q=a.a.c.get(q,
|
||||
C))&&q.context;a.Va=(q,u,t)=>n(q,u,p(t));a.Wc=(q,u,t)=>{t=p(t);return a.Va(q,k(u,t,q),t)};a.nc=(q,u)=>{1!==u.nodeType&&8!==u.nodeType||l(p(q),u)};a.mc=function(q,u,t){if(2>arguments.length){if(u=J.body,!u)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!u||1!==u.nodeType&&8!==u.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");h(p(q,t),u)};a.bd=q=>{if(q&&(1===q.nodeType||
|
||||
8===q.nodeType))return a.yd(q)};a.uc=q=>(q=a.bd(q))?q.$data:x;a.b("bindingHandlers",a.f);a.b("bindingEvent",a.i);a.b("bindingEvent.subscribe",a.i.subscribe);a.b("bindingEvent.startPossiblyAsyncContentBinding",a.i.Wb);a.b("applyBindings",a.mc);a.b("applyBindingsToDescendants",a.nc);a.b("applyBindingAccessorsToNode",a.Va);a.b("applyBindingsToNode",a.Wc);a.b("dataFor",a.uc)})();(()=>{function b(g,l){return Object.prototype.hasOwnProperty.call(g,l)?g[l]:x}function c(g,l){var h=b(e,g);if(h)h.subscribe(l);
|
||||
else{h=e[g]=new a.O;h.subscribe(l);d(g,(n,p)=>{p=!(!p||!p.synchronous);k[g]={definition:n,od:p};delete e[g];m||p?h.notifySubscribers(n):a.xa.ob(()=>h.notifySubscribers(n))});var m=!0}}function d(g,l){f("getConfig",[g],h=>{h?f("loadComponent",[g,h],m=>l(m,h)):l(null,null)})}function f(g,l,h,m){m||(m=a.j.loaders.slice(0));var n=m.shift();if(n){var p=n[g];if(p){var r=!1;if(p.apply(n,l.concat(function(w){r?h(null):null!==w?h(w):f(g,l,h,m)}))!==x&&(r=!0,!n.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");
|
||||
}else f(g,l,h,m)}else h(null)}var e={},k={};a.j={get:(g,l)=>{var h=b(k,g);h?h.od?a.o.F(()=>l(h.definition)):a.xa.ob(()=>l(h.definition)):c(g,l)},sc:g=>delete k[g],ec:f};a.j.loaders=[];a.b("components",a.j);a.b("components.get",a.j.get);a.b("components.clearCachedDefinition",a.j.sc)})();(()=>{function b(l,h,m,n){var p={},r=2,w=m.template;m=m.viewModel;w?f(h,w,y=>a.j.ec("loadTemplate",[l,y],v=>{p.template=v;0===--r&&n(p)})):0===--r&&n(p);m?f(h,m,y=>a.j.ec("loadViewModel",[l,y],v=>{p[g]=v;0===--r&&n(p)})):
|
||||
0===--r&&n(p)}function c(l,h,m){if("function"===typeof h)m(p=>new h(p));else if("function"===typeof h[g])m(h[g]);else if("instance"in h){var n=h.instance;m(()=>n)}else"viewModel"in h?c(l,h.viewModel,m):l("Unknown viewModel value: "+h)}function d(l){if("template"==a.a.ia(l)&&l.content instanceof DocumentFragment)return a.a.Bb(l.content.childNodes);throw"Template Source Element not a <template>";}function f(l,h,m){"string"===typeof h.require?ca||I.require?(ca||I.require)([h.require],n=>{n&&"object"===
|
||||
typeof n&&n.Cd&&n["default"]&&(n=n["default"]);m(n)}):l("Uses require, but no AMD loader is present"):m(h)}function e(l){return h=>{throw Error("Component '"+l+"': "+h);}}var k={};a.j.register=(l,h)=>{if(!h)throw Error("Invalid configuration for "+l);if(a.j.jb(l))throw Error("Component "+l+" is already registered");k[l]=h};a.j.jb=l=>Object.prototype.hasOwnProperty.call(k,l);a.j.unregister=l=>{delete k[l];a.j.sc(l)};a.j.vc={getConfig:(l,h)=>{l=a.j.jb(l)?k[l]:null;h(l)},loadComponent:(l,h,m)=>{var n=
|
||||
e(l);f(n,h,p=>b(l,n,p,m))},loadTemplate:(l,h,m)=>{l=e(l);if("string"===typeof h)m(a.a.Ma(h));else if(h instanceof Array)m(h);else if(h instanceof DocumentFragment)m(a.a.ta(h.childNodes));else if(h.element)if(h=h.element,h instanceof HTMLElement)m(d(h));else if("string"===typeof h){var n=J.getElementById(h);n?m(d(n)):l("Cannot find element with ID "+h)}else l("Unknown element type: "+h);else l("Unknown template value: "+h)},loadViewModel:(l,h,m)=>c(e(l),h,m)};var g="createViewModel";a.b("components.register",
|
||||
a.j.register);a.b("components.isRegistered",a.j.jb);a.b("components.unregister",a.j.unregister);a.b("components.defaultLoader",a.j.vc);a.j.loaders.push(a.j.vc)})();(()=>{function b(d,f){var e=d.getAttribute("params");return e?(f=c.parseBindingsString(e,f,d,{valueAccessors:!0,bindingParams:!0}),f=a.a.ua(f,k=>a.s(k,null,{l:d})),e=a.a.ua(f,k=>{var g=k.A();return k.ga()?a.s({read:()=>a.a.h(k()),write:a.kb(g)&&(l=>k()(l)),l:d}):g}),Object.prototype.hasOwnProperty.call(e,"$raw")||(e.$raw=f),e):{$raw:{}}}
|
||||
a.j.getComponentNameForNode=d=>{var f=a.a.ia(d);if(a.j.jb(f)&&(-1!=f.indexOf("-")||"[object HTMLUnknownElement]"==""+d))return f};a.j.kc=(d,f,e,k)=>{if(1===f.nodeType){var g=a.j.getComponentNameForNode(f);if(g){d=d||{};if(d.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var l={name:g,params:b(f,e)};d.component=k?()=>l:l}}return d};var c=new a.ba})();(()=>{function b(f,e,k){e=e.template;if(!e)throw Error("Component '"+f+"' has no template");f=a.a.Bb(e);
|
||||
a.g.wa(k,f)}function c(f,e,k){var g=f.createViewModel;return g?g.call(f,e,k):e}var d=0;a.f.component={init:(f,e,k,g,l)=>{var h,m,n,p=()=>{var w=h&&h.dispose;"function"===typeof w&&w.call(h);n&&n.m();m=h=n=null},r=a.a.ta(a.g.childNodes(f));a.g.Ga(f);a.a.M.Ca(f,p);a.s(()=>{var w=a.a.h(e());if("string"===typeof w)var y=w;else{y=a.a.h(w.name);var v=a.a.h(w.params)}if(!y)throw Error("No component name specified");var A=a.i.Wb(f,l),C=m=++d;a.j.get(y,q=>{if(m===C){p();if(!q)throw Error("Unknown component '"+
|
||||
y+"'");b(y,q,f);var u=c(q,v,{element:f,templateNodes:r});q=A.createChildContext(u,{extend:t=>{t.$component=u;t.$componentTemplateNodes=r}});u&&u.koDescendantsComplete&&(n=a.i.subscribe(f,a.i.ra,u.koDescendantsComplete,u));h=u;a.nc(q,f)}})},null,{l:f});return{controlsDescendantBindings:!0}}};a.g.oa.component=!0})();a.f.attr={update:(b,c)=>{c=a.a.h(c())||{};a.a.K(c,function(d,f){f=a.a.h(f);var e=d.indexOf(":");e="lookupNamespaceURI"in b&&0<e&&b.lookupNamespaceURI(d.substr(0,e));var k=!1===f||null===
|
||||
f||f===x;k?e?b.removeAttributeNS(e,d):b.removeAttribute(d):f=f.toString();k||(e?b.setAttributeNS(e,d,f):b.setAttribute(d,f));"name"===d&&(b.name=k?"":f)})}};a.f["class"]={update:(b,c)=>{c=a.a.Xb(a.a.h(c()));a.a.rb(b,b.__ko__cssValue,!1);b.__ko__cssValue=c;a.a.rb(b,c,!0)}};a.f.css={update:(b,c)=>{var d=a.a.h(c());null!==d&&"object"==typeof d?a.a.K(d,(f,e)=>{e=a.a.h(e);a.a.rb(b,f,e)}):a.f["class"].update(b,c)}};a.f.enable={update:(b,c)=>{(c=a.a.h(c()))&&b.disabled?b.removeAttribute("disabled"):c||b.disabled||
|
||||
(b.disabled=!0)}};a.f.disable={update:(b,c)=>a.f.enable.update(b,()=>!a.a.h(c()))};a.f.event={init:(b,c,d,f,e)=>{var k=c()||{};a.a.K(k,g=>{"string"==typeof g&&a.a.L(b,g,function(l){var h=c()[g];if(h){try{var m=a.a.ta(arguments);f=e.$data;m.unshift(f);var n=h.apply(f,m)}finally{!0!==n&&(l.preventDefault?l.preventDefault():l.returnValue=!1)}!1===d.get(g+"Bubble")&&(l.cancelBubble=!0,l.stopPropagation&&l.stopPropagation())}})})}};a.f.foreach={Fc:b=>()=>{var c=b(),d=a.a.Ic(c);if(!d||"number"==typeof d.length)return{foreach:c,
|
||||
templateEngine:a.Y.instance};a.a.h(c);return{foreach:d.data,as:d.as,noChildContext:d.noChildContext,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.Y.instance}},init:(b,c)=>a.f.template.init(b,a.f.foreach.Fc(c)),update:(b,c,d,f,e)=>a.f.template.update(b,a.f.foreach.Fc(c),d,f,e)};a.u.Ya.foreach=!1;a.g.oa.foreach=!0;a.f.hasfocus={init:(b,c,d)=>{var f=k=>{b.__ko_hasfocusUpdating=
|
||||
!0;k=b.ownerDocument.activeElement===b;var g=c();a.u.ac(g,d,"hasfocus",k,!0);b.__ko_hasfocusLastValue=k;b.__ko_hasfocusUpdating=!1},e=f.bind(null,!0);f=f.bind(null,!1);a.a.L(b,"focus",e);a.a.L(b,"focusin",e);a.a.L(b,"blur",f);a.a.L(b,"focusout",f);b.__ko_hasfocusLastValue=!1},update:(b,c)=>{c=!!a.a.h(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===c||(c?b.focus():b.blur(),!c&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.o.F(a.a.sb,null,[b,c?"focusin":"focusout"]))}};a.u.tb.hasfocus=
|
||||
!0;a.f.hasFocus=a.f.hasfocus;a.u.tb.hasFocus="hasfocus";a.f.html={init:()=>({controlsDescendantBindings:!0}),update:(b,c)=>a.a.Vb(b,c())};var ba={};a.f.options={init:b=>{if("select"!==a.a.ia(b))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:(b,c,d)=>{function f(){return a.a.Wa(b.options,v=>v.selected)}function e(v,A,C){var q=typeof A;return"function"==q?A(v):"string"==q?v[A]:C}function k(v,A){w&&m?a.i.notify(b,
|
||||
a.i.J):p.length&&(v=0<=a.a.$(p,a.v.N(A[0])),A[0].selected=v,w&&!v&&a.o.F(a.a.sb,null,[b,"change"]))}var g=b.multiple,l=0!=b.length&&g?b.scrollTop:null,h=a.a.h(c()),m=d.get("valueAllowUnset")&&d.has("value"),n=d.get("optionsIncludeDestroyed");c={};var p=[];m||(g?p=f().map(a.v.N):0<=b.selectedIndex&&p.push(a.v.N(b.options[b.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var r=a.a.Wa(h,v=>n||v===x||null===v||!a.a.h(v._destroy));d.has("optionsCaption")&&(h=a.a.h(d.get("optionsCaption")),
|
||||
null!==h&&h!==x&&r.unshift(ba))}var w=!1;c.beforeRemove=v=>b.removeChild(v);h=k;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(h=(v,A)=>{k(v,A);a.o.F(d.get("optionsAfterRender"),null,[A[0],v!==ba?v:x])});a.a.Ub(b,r,function(v,A,C){C.length&&(p=!m&&C[0].selected?[a.v.N(C[0])]:[],w=!0);A=b.ownerDocument.createElement("option");v===ba?(a.a.qb(A,d.get("optionsCaption")),a.v.Ra(A,x)):(C=e(v,d.get("optionsValue"),v),a.v.Ra(A,a.a.h(C)),v=e(v,d.get("optionsText"),C),a.a.qb(A,
|
||||
v));return[A]},c,h);if(!m){var y;g?y=p.length&&f().length<p.length:y=p.length&&0<=b.selectedIndex?a.v.N(b.options[b.selectedIndex])!==p[0]:p.length||0<=b.selectedIndex;y&&a.o.F(a.a.sb,null,[b,"change"])}(m||a.ka.ib())&&a.i.notify(b,a.i.J);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=l)}};a.f.options.Ob=a.a.c.da();a.f.style={update:(b,c)=>{c=a.a.h(c()||{});a.a.K(c,(d,f)=>{f=a.a.h(f);if(null===f||f===x||!1===f)f="";if(/^--/.test(d))b.style.setProperty(d,f);else{d=d.replace(/-(\w)/g,(k,g)=>g.toUpperCase());
|
||||
var e=b.style[d];b.style[d]=f;f===e||b.style[d]!=e||isNaN(f)||(b.style[d]=f+"px")}})}};a.f.submit={init:(b,c,d,f,e)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.L(b,"submit",k=>{var g=c();try{var l=g.call(e.$data,b)}finally{!0!==l&&(k.preventDefault?k.preventDefault():k.returnValue=!1)}})}};a.f.text={init:()=>({controlsDescendantBindings:!0}),update:(b,c)=>a.a.qb(b,c())};a.g.oa.text=!0;a.f.textInput={init:(b,c,d)=>{var f=b.value,e,k,g=()=>{clearTimeout(e);
|
||||
k=e=x;var h=b.value;f!==h&&(f=h,a.u.ac(c(),d,"textInput",h))},l=()=>{var h=a.a.h(c());if(null===h||h===x)h="";k!==x&&h===k?a.a.setTimeout(l,4):b.value!==h&&(b.value=h,f=b.value)};a.a.L(b,"input",g);a.a.L(b,"change",g);a.a.L(b,"blur",g);a.s(l,null,{l:b})}};a.u.tb.textInput=!0;a.f.textinput={preprocess:(b,c,d)=>d("textInput",b)};a.f.value={init:(b,c,d)=>{var f=a.a.ia(b),e="input"==f;if(!e||"checkbox"!=b.type&&"radio"!=b.type){var k=[],g=d.get("valueUpdate"),l=null;g&&("string"==typeof g?k=[g]:k=g?g.filter((p,
|
||||
r)=>g.indexOf(p)===r):[],a.a.Da(k,"change"));var h=()=>{l=null;var p=c(),r=a.v.N(b);a.u.ac(p,d,"value",r)};a.a.R(k,p=>{var r=h;a.a.zd(p,"after")&&(r=()=>{l=a.v.N(b);a.a.setTimeout(h,0)},p=p.substring(5));a.a.L(b,p,r)});var m=e&&"file"==b.type?()=>{var p=a.a.h(c());null===p||p===x||""===p?b.value="":a.o.F(h)}:()=>{var p=a.a.h(c()),r=a.v.N(b);if(null!==l&&p===l)a.a.setTimeout(m,0);else if(p!==r||r===x)"select"===f?(r=d.get("valueAllowUnset"),a.v.Ra(b,p,r),r||p===a.v.N(b)||a.o.F(h)):a.v.Ra(b,p)};if("select"===
|
||||
f){var n;a.i.subscribe(b,a.i.J,()=>{n?d.get("valueAllowUnset")?m():h():(a.a.L(b,"change",h),n=a.s(m,null,{l:b}))},null,{notifyImmediately:!0})}else a.a.L(b,"change",h),a.s(m,null,{l:b})}else a.Va(b,{checkedValue:c})},update:()=>{}};a.u.tb.value=!0;a.f.visible={update:(b,c)=>{c=a.a.h(c());var d="none"!=b.style.display;c&&!d?b.style.display="":!c&&d&&(b.style.display="none")}};a.f.hidden={update:(b,c)=>a.f.visible.update(b,()=>!a.a.h(c()))};(function(b){a.f[b]={init:function(c,d,f,e,k){return a.f.event.init.call(this,
|
||||
c,()=>{var g={};g[b]=d();return g},f,e,k)}}})("click");a.ea=function(){};a.ea.prototype.renderTemplateSource=()=>{throw Error("Override renderTemplateSource");};a.ea.prototype.createJavaScriptEvaluatorBlock=()=>{throw Error("Override createJavaScriptEvaluatorBlock");};a.ea.prototype.makeTemplateSource=(b,c)=>{if("string"==typeof b){c=c||J;c=c.getElementById(b);if(!c)throw Error("Cannot find template with ID "+b);return new a.B.C(c)}if(1==b.nodeType||8==b.nodeType)return new a.B.fa(b);throw Error("Unknown template type: "+
|
||||
b);};a.ea.prototype.renderTemplate=function(b,c,d,f){b=this.makeTemplateSource(b,f);return this.renderTemplateSource(b,c,d,f)};a.ea.prototype.isTemplateRewritten=function(b,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(b,c).data("isRewritten")};a.ea.prototype.rewriteTemplate=function(b,c,d){b=this.makeTemplateSource(b,d);c=c(b.text());b.text(c);b.data("isRewritten",!0)};a.b("templateEngine",a.ea);a.$b=(()=>{function b(f,e,k,g){f=a.u.Pb(f);for(var l=a.u.Ya,h=0;h<f.length;h++){var m=
|
||||
f[h].key;if(Object.prototype.hasOwnProperty.call(l,m)){var n=l[m];if("function"===typeof n){if(m=n(f[h].value))throw Error(m);}else if(!n)throw Error("This template engine does not support the '"+m+"' binding within its templates");}}k="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.u.Qb(f,{valueAccessors:!0})+" } })()},'"+k.toLowerCase()+"')";return g.createJavaScriptEvaluatorBlock(k)+e}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:"[^"]*"|'[^']*'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,
|
||||
d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{fd:(f,e,k)=>{e.isTemplateRewritten(f,k)||e.rewriteTemplate(f,g=>a.$b.sd(g,e),k)},sd:(f,e)=>f.replace(c,(...k)=>b(k[4],k[1],k[2],e)).replace(d,(...k)=>b(k[1],"\x3c!-- ko --\x3e","#comment",e)),Xc:(f,e)=>a.X.Lb((k,g)=>{(k=k.nextSibling)&&k.nodeName.toLowerCase()===e&&a.Va(k,f,g)})}})();a.b("__tr_ambtns",a.$b.Xc);(()=>{a.B={};a.B.C=function(d){if(this.C=d){var f=a.a.ia(d);this.Na="script"===f?1:"textarea"===f?2:"template"==f&&d.content&&11===d.content.nodeType?
|
||||
3:4}};a.B.C.prototype.text=function(){var d=1===this.Na?"text":2===this.Na?"value":"innerHTML";if(0==arguments.length)return this.C[d];var f=arguments[0];"innerHTML"===d?a.a.Vb(this.C,f):this.C[d]=f};var b=a.a.c.da()+"_";a.B.C.prototype.data=function(d){if(1===arguments.length)return a.a.c.get(this.C,b+d);a.a.c.set(this.C,b+d,arguments[1])};var c=a.a.c.da();a.B.C.prototype.nodes=function(){var d=this.C;if(0==arguments.length){var f=a.a.c.get(d,c)||{},e=f.Za||(3===this.Na?d.content:4===this.Na?d:x);
|
||||
if(!e||f.Uc){var k=this.text();k&&k!==f.Oa&&(e=a.a.vd(k,d.ownerDocument),a.a.c.set(d,c,{Za:e,Oa:k,Uc:!0}))}return e}f=arguments[0];this.Na!==x&&this.text("");a.a.c.set(d,c,{Za:f})};a.B.fa=function(d){this.C=d};a.B.fa.prototype=new a.B.C;a.B.fa.prototype.constructor=a.B.fa;a.B.fa.prototype.text=function(){if(0==arguments.length){var d=a.a.c.get(this.C,c)||{};d.Oa===x&&d.Za&&(d.Oa=d.Za.innerHTML);return d.Oa}a.a.c.set(this.C,c,{Oa:arguments[0]})};a.b("templateSources",a.B);a.b("templateSources.domElement",
|
||||
a.B.C);a.b("templateSources.anonymousTemplate",a.B.fa)})();(function(){function b(h,m,n){var p;for(m=a.g.nextSibling(m);h&&(p=h)!==m;)h=a.g.nextSibling(p),n(p,h)}function c(h,m){if(h.length){var n=h[0],p=h[h.length-1],r=n.parentNode,w=a.ba.instance,y=w.preprocessNode;if(y){b(n,p,(v,A)=>{var C=v.previousSibling,q=y.call(w,v);q&&(v===n&&(n=q[0]||A),v===p&&(p=q[q.length-1]||C))});h.length=0;if(!n)return;n===p?h.push(n):(h.push(n,p),a.a.Ia(h,r))}b(n,p,v=>{1!==v.nodeType&&8!==v.nodeType||a.mc(m,v)});b(n,
|
||||
p,v=>{1!==v.nodeType&&8!==v.nodeType||a.X.Oc(v,[m])});a.a.Ia(h,r)}}function d(h){return h.nodeType?h:0<h.length?h[0]:null}function f(h,m,n,p,r){r=r||{};var w=(h&&d(h)||n||{}).ownerDocument,y=r.templateEngine||k;a.$b.fd(n,y,w);n=y.renderTemplate(n,p,r,w);if("number"!=typeof n.length||0<n.length&&"number"!=typeof n[0].nodeType)throw Error("Template engine must return an array of DOM nodes");w=!1;switch(m){case "replaceChildren":a.g.wa(h,n);w=!0;break;case "replaceNode":a.a.Kc(h,n);w=!0;break;case "ignoreTargetNode":break;
|
||||
default:throw Error("Unknown renderMode: "+m);}w&&(c(n,p),r.afterRender&&a.o.F(r.afterRender,null,[n,p[r.as||"$data"]]),"replaceChildren"==m&&a.i.notify(h,a.i.J));return n}function e(h,m,n){return a.T(h)?h():"function"===typeof h?h(m,n):h}var k;a.Lc=h=>{if(h!=x&&!(h instanceof a.ea))throw Error("templateEngine must inherit from ko.templateEngine");k=h};a.Tb=function(h,m,n,p,r){n=n||{};if((n.templateEngine||k)==x)throw Error("Set a template engine before calling renderTemplate");r=r||"replaceChildren";
|
||||
if(p){var w=d(p);return a.W(()=>{var y=m&&m instanceof a.aa?m:new a.aa(m,null,null,null,{exportDependencies:!0}),v=e(h,y.$data,y);y=f(p,r,v,y,n);"replaceNode"==r&&(p=y,w=d(p))},null,{Fa:()=>!w||!a.a.Gb(w),l:w&&"replaceNode"==r?w.parentNode:w})}return a.X.Lb(y=>a.Tb(h,m,n,y,"replaceNode"))};a.wd=(h,m,n,p,r)=>{function w(t,B){a.o.F(a.a.Ub,null,[p,t,A,n,C,B]);a.i.notify(p,a.i.J)}var y,v=n.as,A=(t,B)=>{y=r.createChildContext(t,{as:v,noChildContext:n.noChildContext,extend:F=>{F.$index=B;v&&(F[v+"Index"]=
|
||||
B)}});t=e(h,t,y);return f(p,"ignoreTargetNode",t,y,n)},C=(t,B)=>{c(B,y);n.afterRender&&n.afterRender(B,t);y=null},q=!1===n.includeDestroyed||a.options.foreachHidesDestroyed&&!n.includeDestroyed;if(q||n.beforeRemove||!a.Dc(m))return a.W(()=>{var t=a.a.h(m)||[];"undefined"==typeof t.length&&(t=[t]);q&&(t=a.a.Wa(t,B=>B===x||null===B||!a.a.h(B._destroy)));w(t)},null,{l:p});w(m.A());var u=m.subscribe(t=>{w(m(),t)},null,"arrayChange");u.l(p);return u};var g=a.a.c.da(),l=a.a.c.da();a.f.template={init:(h,
|
||||
m)=>{m=a.a.h(m());if("string"==typeof m||"name"in m)a.g.Ga(h);else if("nodes"in m){m=m.nodes||[];if(a.T(m))throw Error('The "nodes" option must be a plain, non-observable array.');let n=m[0]&&m[0].parentNode;n&&a.a.c.get(n,l)||(n=a.a.Mb(m),a.a.c.set(n,l,!0));(new a.B.fa(h)).nodes(n)}else if(m=a.g.childNodes(h),0<m.length)m=a.a.Mb(m),(new a.B.fa(h)).nodes(m);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:(h,m,n,p,r)=>
|
||||
{var w=m();m=a.a.h(w);n=!0;p=null;"string"==typeof m?m={}:(w="name"in m?m.name:h,"if"in m&&(n=a.a.h(m["if"])),n&&"ifnot"in m&&(n=!a.a.h(m.ifnot)),n&&!w&&(n=!1));"foreach"in m?p=a.wd(w,n&&m.foreach||[],m,h,r):n?(n=r,"data"in m&&(n=r.createChildContext(m.data,{as:m.as,noChildContext:m.noChildContext,exportDependencies:!0})),p=a.Tb(w,n,m,h)):a.g.Ga(h);r=p;(m=a.a.c.get(h,g))&&"function"==typeof m.m&&m.m();a.a.c.set(h,g,!r||r.ga&&!r.ga()?x:r)}};a.u.Ya.template=h=>{h=a.u.Pb(h);return 1==h.length&&h[0].unknown||
|
||||
a.u.pd(h,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.g.oa.template=!0})();a.b("setTemplateEngine",a.Lc);a.b("renderTemplate",a.Tb);a.a.zc=(b,c,d)=>{if(b.length&&c.length){var f,e,k,g,l;for(f=e=0;(!d||f<d)&&(g=b[e]);++e){for(k=0;l=c[k];++k)if(g.value===l.value){g.moved=l.index;l.moved=g.index;c.splice(k,1);f=k=0;break}f+=k}}};a.a.Db=(()=>{function b(c,d,f,e,k){var g=Math.min,l=Math.max,h=[],m,n=c.length,p,r=d.length,w=r-n||1,y=n+r+1,v;for(m=
|
||||
0;m<=n;m++){var A=v;h.push(v=[]);var C=g(r,m+w);for(p=l(0,m-1);p<=C;p++)v[p]=p?m?c[m-1]===d[p-1]?A[p-1]:g(A[p]||y,v[p-1]||y)+1:p+1:m+1}g=[];l=[];w=[];m=n;for(p=r;m||p;)r=h[m][p]-1,p&&r===h[m][p-1]?l.push(g[g.length]={status:f,value:d[--p],index:p}):m&&r===h[m-1][p]?w.push(g[g.length]={status:e,value:c[--m],index:m}):(--p,--m,k.sparse||g.push({status:"retained",value:d[p]}));a.a.zc(w,l,!k.dontLimitMoves&&10*n);return g.reverse()}return function(c,d,f){f="boolean"===typeof f?{dontLimitMoves:f}:f||{};
|
||||
c=c||[];d=d||[];return c.length<d.length?b(c,d,"added","deleted",f):b(d,c,"deleted","added",f)}})();a.b("utils.compareArrays",a.a.Db);(()=>{function b(f,e,k,g,l){var h=[],m=a.W(()=>{var n=e(k,l,a.a.Ia(h,f))||[];0<h.length&&(a.a.Kc(h,n),g&&a.o.F(g,null,[k,n,l]));h.length=0;a.a.Ab(h,n)},null,{l:f,Fa:function(){return!a.a.Vc(h)}});return{V:h,W:m.ga()?m:x}}var c=a.a.c.da(),d=a.a.c.da();a.a.Ub=(f,e,k,g,l,h)=>{function m(G){z={pa:G,eb:a.na(A++)};y.push(z);w||B.push(z)}function n(G){z=r[G];A!==z.eb.A()&&
|
||||
t.push(z);z.eb(A++);a.a.Ia(z.V,f);y.push(z)}function p(G,K){if(G)for(var L=0,P=K.length;L<P;L++)a.a.R(K[L].V,function(T){G(T,L,K[L].pa)})}e=e||[];"undefined"==typeof e.length&&(e=[e]);g=g||{};var r=a.a.c.get(f,c),w=!r,y=[],v=0,A=0,C=[],q=[],u=[],t=[],B=[],F=0;if(w)a.a.R(e,m);else{if(!h||r&&r._countWaitingForRemove)h=Array.prototype.map.call(r,G=>G.pa),h=a.a.Db(h,e,{dontLimitMoves:g.dontLimitMoves,sparse:!0});for(let G=0,K,L,P;K=h[G];G++)switch(L=K.moved,P=K.index,K.status){case "deleted":for(;v<P;)n(v++);
|
||||
if(L===x){var z=r[v];z.W&&(z.W.m(),z.W=x);a.a.Ia(z.V,f).length&&(g.beforeRemove&&(y.push(z),F++,z.pa===d?z=null:u.push(z)),z&&C.push.apply(C,z.V))}v++;break;case "added":for(;A<P;)n(v++);L!==x?(q.push(y.length),n(L)):m(K.value)}for(;A<e.length;)n(v++);y._countWaitingForRemove=F}a.a.c.set(f,c,y);p(g.beforeMove,t);a.a.R(C,g.beforeRemove?a.ja:a.removeNode);var D,O;F=f.ownerDocument.activeElement;if(q.length)for(;(e=q.shift())!=x;){z=y[e];for(D=x;e;)if((O=y[--e].V)&&O.length){D=O[O.length-1];break}for(v=
|
||||
0;C=z.V[v];D=C,v++)a.g.Kb(f,C,D)}for(e=0;z=y[e];e++){z.V||a.a.extend(z,b(f,k,z.pa,l,z.eb));for(v=0;C=z.V[v];D=C,v++)a.g.Kb(f,C,D);!z.md&&l&&(l(z.pa,z.V,z.eb),z.md=!0,D=z.V[z.V.length-1])}F&&f.ownerDocument.activeElement!=F&&F.focus();p(g.beforeRemove,u);for(e=0;e<u.length;++e)u[e].pa=d;p(g.afterMove,t);p(g.afterAdd,B)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.Ub);a.Y=function(){this.allowTemplateRewriting=!1};a.Y.prototype=new a.ea;a.Y.prototype.constructor=a.Y;a.Y.prototype.renderTemplateSource=
|
||||
(b,c,d,f)=>{if(c=b.ud?b.ud():null)return a.a.ta(c.cloneNode(!0).childNodes);b=b.text();return a.a.Ma(b,f)};a.Y.instance=new a.Y;a.Lc(a.Y.instance);a.b("nativeTemplateEngine",a.Y)})})();})();
|
||||
|
|
|
|||
67
vendors/knockout/src/binding/bindingAttributeSyntax.js
vendored
Executable file → Normal file
67
vendors/knockout/src/binding/bindingAttributeSyntax.js
vendored
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
(function () {
|
||||
(() => {
|
||||
// Hide or don't minify context properties, see https://github.com/knockout/knockout/issues/2294
|
||||
var contextSubscribable = Symbol('_subscribable');
|
||||
var contextAncestorBindingInfo = Symbol('_ancestorBindingInfo');
|
||||
|
|
@ -19,9 +19,7 @@
|
|||
};
|
||||
|
||||
// Use an overridable method for retrieving binding handlers so that plugins may support dynamically created handlers
|
||||
ko['getBindingHandler'] = function(bindingKey) {
|
||||
return ko.bindingHandlers[bindingKey];
|
||||
};
|
||||
ko['getBindingHandler'] = bindingKey => ko.bindingHandlers[bindingKey];
|
||||
|
||||
var inheritParentVm = {};
|
||||
|
||||
|
|
@ -93,7 +91,6 @@
|
|||
shouldInheritData = dataItemOrAccessor === inheritParentVm,
|
||||
realDataItemOrAccessor = shouldInheritData ? undefined : dataItemOrAccessor,
|
||||
isFunc = typeof(realDataItemOrAccessor) == "function" && !ko.isObservable(realDataItemOrAccessor),
|
||||
nodes,
|
||||
subscribable,
|
||||
dataDependency = options && options['dataDependency'];
|
||||
|
||||
|
|
@ -132,14 +129,14 @@
|
|||
|
||||
if (dataItemAlias && options && options['noChildContext']) {
|
||||
var isFunc = typeof(dataItemOrAccessor) == "function" && !ko.isObservable(dataItemOrAccessor);
|
||||
return new ko.bindingContext(inheritParentVm, this, null, function (self) {
|
||||
return new ko.bindingContext(inheritParentVm, this, null, self => {
|
||||
if (extendCallback)
|
||||
extendCallback(self);
|
||||
self[dataItemAlias] = isFunc ? dataItemOrAccessor() : dataItemOrAccessor;
|
||||
}, options);
|
||||
}
|
||||
|
||||
return new ko.bindingContext(dataItemOrAccessor, this, dataItemAlias, function (self, parentContext) {
|
||||
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'];
|
||||
|
|
@ -154,9 +151,9 @@
|
|||
// 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, function(self, parentContext) {
|
||||
ko.utils.extend(self, typeof(properties) == "function" ? properties(self) : 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();
|
||||
|
|
@ -209,7 +206,7 @@
|
|||
childrenComplete: "childrenComplete",
|
||||
descendantsComplete : "descendantsComplete",
|
||||
|
||||
subscribe: function (node, event, callback, context, options) {
|
||||
subscribe: (node, event, callback, context, options) => {
|
||||
var bindingInfo = ko.utils.domData.getOrSet(node, boundElementDomDataKey, {});
|
||||
if (!bindingInfo.eventSubscribable) {
|
||||
bindingInfo.eventSubscribable = new ko.subscribable;
|
||||
|
|
@ -220,7 +217,7 @@
|
|||
return bindingInfo.eventSubscribable.subscribe(callback, context, event);
|
||||
},
|
||||
|
||||
notify: function (node, event) {
|
||||
notify: (node, event) => {
|
||||
var bindingInfo = ko.utils.domData.get(node, boundElementDomDataKey);
|
||||
if (bindingInfo) {
|
||||
bindingInfo.notifiedEvents[event] = true;
|
||||
|
|
@ -239,7 +236,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
startPossiblyAsyncContentBinding: function (node, bindingContext) {
|
||||
startPossiblyAsyncContentBinding: (node, bindingContext) => {
|
||||
var bindingInfo = ko.utils.domData.getOrSet(node, boundElementDomDataKey, {});
|
||||
|
||||
if (!bindingInfo.asyncContext) {
|
||||
|
|
@ -251,7 +248,7 @@
|
|||
return bindingContext;
|
||||
}
|
||||
|
||||
return bindingContext['extend'](function (ctx) {
|
||||
return bindingContext['extend'](ctx => {
|
||||
ctx[contextAncestorBindingInfo] = bindingInfo;
|
||||
});
|
||||
}
|
||||
|
|
@ -439,28 +436,19 @@
|
|||
// context update), just return the value accessor from the binding. Otherwise, return a function that always gets
|
||||
// the latest binding value and registers a dependency on the binding updater.
|
||||
var getValueAccessor = bindingsUpdater
|
||||
? function(bindingKey) {
|
||||
return function() {
|
||||
return evaluateValueAccessor(bindingsUpdater()[bindingKey]);
|
||||
};
|
||||
} : function(bindingKey) {
|
||||
return bindings[bindingKey];
|
||||
};
|
||||
? bindingKey => () => evaluateValueAccessor(bindingsUpdater()[bindingKey])
|
||||
: bindingKey => bindings[bindingKey];
|
||||
|
||||
// Use of allBindings as a function is maintained for backwards compatibility, but its use is deprecated
|
||||
function allBindings() {
|
||||
return ko.utils.objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor);
|
||||
}
|
||||
// The following is the 3.x allBindings API
|
||||
allBindings['get'] = function(key) {
|
||||
return bindings[key] && evaluateValueAccessor(getValueAccessor(key));
|
||||
};
|
||||
allBindings['has'] = function(key) {
|
||||
return key in bindings;
|
||||
};
|
||||
allBindings['get'] = key => bindings[key] && evaluateValueAccessor(getValueAccessor(key));
|
||||
allBindings['has'] = key => key in bindings;
|
||||
|
||||
if (ko.bindingEvent.childrenComplete in bindings) {
|
||||
ko.bindingEvent.subscribe(node, ko.bindingEvent.childrenComplete, function () {
|
||||
ko.bindingEvent.subscribe(node, ko.bindingEvent.childrenComplete, () => {
|
||||
var callback = evaluateValueAccessor(bindings[ko.bindingEvent.childrenComplete]);
|
||||
if (callback) {
|
||||
var nodes = ko.virtualElements.childNodes(node);
|
||||
|
|
@ -499,7 +487,7 @@
|
|||
try {
|
||||
// Run init, ignoring any dependencies
|
||||
if (typeof handlerInitFn == "function") {
|
||||
ko.dependencyDetection.ignore(function() {
|
||||
ko.dependencyDetection.ignore(() => {
|
||||
var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend);
|
||||
|
||||
// If this binding handler claims to control descendant bindings, make a note of this
|
||||
|
|
@ -514,9 +502,7 @@
|
|||
// Run update in its own computed wrapper
|
||||
if (typeof handlerUpdateFn == "function") {
|
||||
ko.dependentObservable(
|
||||
function() {
|
||||
handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend);
|
||||
},
|
||||
() => handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend),
|
||||
null,
|
||||
{ disposeWhenNodeIsRemoved: node }
|
||||
);
|
||||
|
|
@ -533,9 +519,9 @@
|
|||
'shouldBindDescendants': shouldBindDescendants,
|
||||
'bindingContextForDescendants': shouldBindDescendants && contextToExtend
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
ko.storedBindingContextForNode = function (node) {
|
||||
ko.storedBindingContextForNode = node => {
|
||||
var bindingInfo = ko.utils.domData.get(node, boundElementDomDataKey);
|
||||
return bindingInfo && bindingInfo.context;
|
||||
}
|
||||
|
|
@ -546,16 +532,15 @@
|
|||
: new ko.bindingContext(viewModelOrBindingContext, undefined, undefined, extendContextCallback);
|
||||
}
|
||||
|
||||
ko.applyBindingAccessorsToNode = function (node, bindings, viewModelOrBindingContext) {
|
||||
return applyBindingsToNodeInternal(node, bindings, getBindingContext(viewModelOrBindingContext));
|
||||
};
|
||||
ko.applyBindingAccessorsToNode = (node, bindings, viewModelOrBindingContext) =>
|
||||
applyBindingsToNodeInternal(node, bindings, getBindingContext(viewModelOrBindingContext));
|
||||
|
||||
ko.applyBindingsToNode = function (node, bindings, viewModelOrBindingContext) {
|
||||
ko.applyBindingsToNode = (node, bindings, viewModelOrBindingContext) => {
|
||||
var context = getBindingContext(viewModelOrBindingContext);
|
||||
return ko.applyBindingAccessorsToNode(node, makeBindingAccessors(bindings, context, node), context);
|
||||
};
|
||||
|
||||
ko.applyBindingsToDescendants = function(viewModelOrBindingContext, rootNode) {
|
||||
ko.applyBindingsToDescendants = (viewModelOrBindingContext, rootNode) => {
|
||||
if (rootNode.nodeType === 1 || rootNode.nodeType === 8)
|
||||
applyBindingsToDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode);
|
||||
};
|
||||
|
|
@ -574,13 +559,13 @@
|
|||
};
|
||||
|
||||
// Retrieving binding context from arbitrary nodes
|
||||
ko.contextFor = function(node) {
|
||||
ko.contextFor = node => {
|
||||
// We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them)
|
||||
if (node && (node.nodeType === 1 || node.nodeType === 8)) {
|
||||
return ko.storedBindingContextForNode(node);
|
||||
}
|
||||
};
|
||||
ko.dataFor = function(node) {
|
||||
ko.dataFor = node => {
|
||||
var context = ko.contextFor(node);
|
||||
return context ? context['$data'] : undefined;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
};
|
||||
|
||||
ko.utils.extend(ko.bindingProvider.prototype, {
|
||||
'nodeHasBindings': function(node) {
|
||||
'nodeHasBindings': node => {
|
||||
switch (node.nodeType) {
|
||||
case 1: // Element
|
||||
return node.getAttribute(defaultBindingAttributeName) != null
|
||||
|
|
@ -31,12 +31,12 @@
|
|||
|
||||
// The following function is only used internally by this default provider.
|
||||
// It's not part of the interface definition for a general binding provider.
|
||||
'getBindingsString': function(node, bindingContext) {
|
||||
'getBindingsString': (node, bindingContext) => {
|
||||
switch (node.nodeType) {
|
||||
case 1: return node.getAttribute(defaultBindingAttributeName); // Element
|
||||
case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
|
||||
default: return null;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
// The following function is only used internally by this default provider.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
var attrHtmlToJavaScriptMap = { 'class': 'className', 'for': 'htmlFor' };
|
||||
ko.bindingHandlers['attr'] = {
|
||||
'update': function(element, valueAccessor, allBindings) {
|
||||
'update': (element, valueAccessor, allBindings) => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor()) || {};
|
||||
ko.utils.objectForEach(value, function(attrName, attrValue) {
|
||||
attrValue = ko.utils.unwrapObservable(attrValue);
|
||||
|
|
|
|||
|
|
@ -1,137 +0,0 @@
|
|||
(function() {
|
||||
|
||||
function addOrRemoveItem(array, value, included) {
|
||||
var existingEntryIndex = ko.utils.arrayIndexOf(ko.utils.peekObservable(array), value);
|
||||
if (existingEntryIndex < 0) {
|
||||
if (included)
|
||||
array.push(value);
|
||||
} else {
|
||||
if (!included)
|
||||
array.splice(existingEntryIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
ko.bindingHandlers['checked'] = {
|
||||
'after': ['value', 'attr'],
|
||||
'init': function (element, valueAccessor, allBindings) {
|
||||
var checkedValue = ko.pureComputed(function() {
|
||||
// Treat "value" like "checkedValue" when it is included with "checked" binding
|
||||
if (allBindings['has']('checkedValue')) {
|
||||
return ko.utils.unwrapObservable(allBindings.get('checkedValue'));
|
||||
} else if (useElementValue) {
|
||||
if (allBindings['has']('value')) {
|
||||
return ko.utils.unwrapObservable(allBindings.get('value'));
|
||||
} else {
|
||||
return element.value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function updateModel() {
|
||||
// This updates the model value from the view value.
|
||||
// It runs in response to DOM events (click) and changes in checkedValue.
|
||||
var isChecked = element.checked,
|
||||
elemValue = checkedValue();
|
||||
|
||||
// When we're first setting up this computed, don't change any model state.
|
||||
if (ko.computedContext.isInitial()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We can ignore unchecked radio buttons, because some other radio
|
||||
// button will be checked, and that one can take care of updating state.
|
||||
// Also ignore value changes to an already unchecked checkbox.
|
||||
if (!isChecked && (isRadio || ko.computedContext.getDependenciesCount())) {
|
||||
return;
|
||||
}
|
||||
|
||||
var modelValue = ko.dependencyDetection.ignore(valueAccessor);
|
||||
if (valueIsArray) {
|
||||
var writableValue = rawValueIsNonArrayObservable ? modelValue.peek() : modelValue,
|
||||
saveOldValue = oldElemValue;
|
||||
oldElemValue = elemValue;
|
||||
|
||||
if (saveOldValue !== elemValue) {
|
||||
// When we're responding to the checkedValue changing, and the element is
|
||||
// currently checked, replace the old elem value with the new elem value
|
||||
// in the model array.
|
||||
if (isChecked) {
|
||||
addOrRemoveItem(writableValue, elemValue, true);
|
||||
addOrRemoveItem(writableValue, saveOldValue, false);
|
||||
}
|
||||
} else {
|
||||
// When we're responding to the user having checked/unchecked a checkbox,
|
||||
// add/remove the element value to the model array.
|
||||
addOrRemoveItem(writableValue, elemValue, isChecked);
|
||||
}
|
||||
|
||||
if (rawValueIsNonArrayObservable && ko.isWriteableObservable(modelValue)) {
|
||||
modelValue(writableValue);
|
||||
}
|
||||
} else {
|
||||
if (isCheckbox) {
|
||||
if (elemValue === undefined) {
|
||||
elemValue = isChecked;
|
||||
} else if (!isChecked) {
|
||||
elemValue = undefined;
|
||||
}
|
||||
}
|
||||
ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'checked', elemValue, true);
|
||||
}
|
||||
};
|
||||
|
||||
function updateView() {
|
||||
// This updates the view value from the model value.
|
||||
// It runs in response to changes in the bound (checked) value.
|
||||
var modelValue = ko.utils.unwrapObservable(valueAccessor()),
|
||||
elemValue = checkedValue();
|
||||
|
||||
if (valueIsArray) {
|
||||
// When a checkbox is bound to an array, being checked represents its value being present in that array
|
||||
element.checked = ko.utils.arrayIndexOf(modelValue, elemValue) >= 0;
|
||||
oldElemValue = elemValue;
|
||||
} else if (isCheckbox && elemValue === undefined) {
|
||||
// When a checkbox is bound to any other value (not an array) and "checkedValue" is not defined,
|
||||
// being checked represents the value being trueish
|
||||
element.checked = !!modelValue;
|
||||
} else {
|
||||
// Otherwise, being checked means that the checkbox or radio button's value corresponds to the model value
|
||||
element.checked = (checkedValue() === modelValue);
|
||||
}
|
||||
};
|
||||
|
||||
var isCheckbox = element.type == "checkbox",
|
||||
isRadio = element.type == "radio";
|
||||
|
||||
// Only bind to check boxes and radio buttons
|
||||
if (!isCheckbox && !isRadio) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rawValue = valueAccessor(),
|
||||
valueIsArray = isCheckbox && (ko.utils.unwrapObservable(rawValue) instanceof Array),
|
||||
rawValueIsNonArrayObservable = !(valueIsArray && rawValue.push && rawValue.splice),
|
||||
useElementValue = isRadio || valueIsArray,
|
||||
oldElemValue = valueIsArray ? checkedValue() : undefined;
|
||||
|
||||
// Set up two computeds to update the binding:
|
||||
|
||||
// The first responds to changes in the checkedValue value and to element clicks
|
||||
ko.computed(updateModel, null, { disposeWhenNodeIsRemoved: element });
|
||||
ko.utils.registerEventHandler(element, "click", updateModel);
|
||||
|
||||
// The second responds to changes in the model value (the one associated with the checked binding)
|
||||
ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element });
|
||||
|
||||
rawValue = undefined;
|
||||
}
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['checked'] = true;
|
||||
|
||||
ko.bindingHandlers['checkedValue'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
element.value = ko.utils.unwrapObservable(valueAccessor());
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
var classesWrittenByBindingKey = '__ko__cssValue';
|
||||
|
||||
ko.bindingHandlers['class'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = ko.utils.stringTrim(ko.utils.unwrapObservable(valueAccessor()));
|
||||
ko.utils.toggleDomNodeCssClass(element, element[classesWrittenByBindingKey], false);
|
||||
element[classesWrittenByBindingKey] = value;
|
||||
|
|
@ -10,10 +10,10 @@ ko.bindingHandlers['class'] = {
|
|||
};
|
||||
|
||||
ko.bindingHandlers['css'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor());
|
||||
if (value !== null && typeof value == "object") {
|
||||
ko.utils.objectForEach(value, function(className, shouldHaveClass) {
|
||||
ko.utils.objectForEach(value, (className, shouldHaveClass) => {
|
||||
shouldHaveClass = ko.utils.unwrapObservable(shouldHaveClass);
|
||||
ko.utils.toggleDomNodeCssClass(element, className, shouldHaveClass);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
ko.bindingHandlers['enable'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor());
|
||||
if (value && element.disabled)
|
||||
element.removeAttribute("disabled");
|
||||
|
|
@ -9,7 +9,6 @@ ko.bindingHandlers['enable'] = {
|
|||
};
|
||||
|
||||
ko.bindingHandlers['disable'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
ko.bindingHandlers['enable']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) });
|
||||
}
|
||||
'update': (element, valueAccessor) =>
|
||||
ko.bindingHandlers['enable']['update'](element, () => !ko.utils.unwrapObservable(valueAccessor()))
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
function makeEventHandlerShortcut(eventName) {
|
||||
ko.bindingHandlers[eventName] = {
|
||||
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
var newValueAccessor = function () {
|
||||
var newValueAccessor = () => {
|
||||
var result = {};
|
||||
result[eventName] = valueAccessor();
|
||||
return result;
|
||||
|
|
@ -14,9 +14,9 @@ function makeEventHandlerShortcut(eventName) {
|
|||
}
|
||||
|
||||
ko.bindingHandlers['event'] = {
|
||||
'init' : function (element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
'init' : (element, valueAccessor, allBindings, viewModel, bindingContext) => {
|
||||
var eventsToHandle = valueAccessor() || {};
|
||||
ko.utils.objectForEach(eventsToHandle, function(eventName) {
|
||||
ko.utils.objectForEach(eventsToHandle, eventName => {
|
||||
if (typeof eventName == "string") {
|
||||
ko.utils.registerEventHandler(element, eventName, function (event) {
|
||||
var handlerReturnValue;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// "foreach: someExpression" is equivalent to "template: { foreach: someExpression }"
|
||||
// "foreach: { data: someExpression, afterAdd: myfn }" is equivalent to "template: { foreach: someExpression, afterAdd: myfn }"
|
||||
ko.bindingHandlers['foreach'] = {
|
||||
makeTemplateValueAccessor: function(valueAccessor) {
|
||||
return function() {
|
||||
makeTemplateValueAccessor: valueAccessor => {
|
||||
return () => {
|
||||
var modelValue = valueAccessor(),
|
||||
unwrappedValue = ko.utils.peekObservable(modelValue); // Unwrap without setting a dependency here
|
||||
|
||||
|
|
@ -28,12 +28,11 @@ ko.bindingHandlers['foreach'] = {
|
|||
};
|
||||
};
|
||||
},
|
||||
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));
|
||||
},
|
||||
'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext);
|
||||
}
|
||||
'init': (element, valueAccessor) =>
|
||||
ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor))
|
||||
,
|
||||
'update': (element, valueAccessor, allBindings, viewModel, bindingContext) =>
|
||||
ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext)
|
||||
};
|
||||
ko.expressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings
|
||||
ko.virtualElements.allowedBindings['foreach'] = true;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
var hasfocusUpdatingProperty = '__ko_hasfocusUpdating';
|
||||
var hasfocusLastValue = '__ko_hasfocusLastValue';
|
||||
ko.bindingHandlers['hasfocus'] = {
|
||||
'init': function(element, valueAccessor, allBindings) {
|
||||
var handleElementFocusChange = function(isFocused) {
|
||||
'init': (element, valueAccessor, allBindings) => {
|
||||
var handleElementFocusChange = isFocused => {
|
||||
// Where possible, ignore which event was raised and determine focus state using activeElement,
|
||||
// as this avoids phantom focus/blur events raised when changing tabs in modern browsers.
|
||||
// However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers,
|
||||
|
|
@ -29,7 +29,7 @@ ko.bindingHandlers['hasfocus'] = {
|
|||
// Assume element is not focused (prevents "blur" being called initially)
|
||||
element[hasfocusLastValue] = false;
|
||||
},
|
||||
'update': function(element, valueAccessor) {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = !!ko.utils.unwrapObservable(valueAccessor());
|
||||
|
||||
if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
ko.bindingHandlers['html'] = {
|
||||
'init': function() {
|
||||
'init': () => {
|
||||
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
|
||||
return { 'controlsDescendantBindings': true };
|
||||
},
|
||||
'update': function (element, valueAccessor) {
|
||||
'update': (element, valueAccessor) =>
|
||||
// setHtml will unwrap the value if needed
|
||||
ko.utils.setHtml(element, valueAccessor());
|
||||
}
|
||||
ko.utils.setHtml(element, valueAccessor())
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
(function () {
|
||||
|
||||
// Makes a binding like with or if
|
||||
function makeWithIfBinding(bindingKey, isWith, isNot) {
|
||||
ko.bindingHandlers[bindingKey] = {
|
||||
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
var didDisplayOnLastUpdate, savedNodes, contextOptions = {}, completeOnRender, needAsyncContext, renderOnEveryChange;
|
||||
|
||||
if (isWith) {
|
||||
var as = allBindings.get('as'), noChildContext = allBindings.get('noChildContext');
|
||||
renderOnEveryChange = !(as && noChildContext);
|
||||
contextOptions = { 'as': as, 'noChildContext': noChildContext, 'exportDependencies': renderOnEveryChange };
|
||||
}
|
||||
|
||||
completeOnRender = allBindings.get("completeOn") == "render";
|
||||
needAsyncContext = completeOnRender || allBindings['has'](ko.bindingEvent.descendantsComplete);
|
||||
|
||||
ko.computed(function() {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor()),
|
||||
shouldDisplay = !isNot !== !value, // equivalent to isNot ? !value : !!value,
|
||||
isInitial = !savedNodes,
|
||||
childContext;
|
||||
|
||||
if (!renderOnEveryChange && shouldDisplay === didDisplayOnLastUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (needAsyncContext) {
|
||||
bindingContext = ko.bindingEvent.startPossiblyAsyncContentBinding(element, bindingContext);
|
||||
}
|
||||
|
||||
if (shouldDisplay) {
|
||||
if (!isWith || renderOnEveryChange) {
|
||||
contextOptions['dataDependency'] = ko.computedContext.computed();
|
||||
}
|
||||
|
||||
if (isWith) {
|
||||
childContext = bindingContext['createChildContext'](typeof value == "function" ? value : valueAccessor, contextOptions);
|
||||
} else if (ko.computedContext.getDependenciesCount()) {
|
||||
childContext = bindingContext['extend'](null, contextOptions);
|
||||
} else {
|
||||
childContext = bindingContext;
|
||||
}
|
||||
}
|
||||
|
||||
// Save a copy of the inner nodes on the initial update, but only if we have dependencies.
|
||||
if (isInitial && ko.computedContext.getDependenciesCount()) {
|
||||
savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */);
|
||||
}
|
||||
|
||||
if (shouldDisplay) {
|
||||
if (!isInitial) {
|
||||
ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(savedNodes));
|
||||
}
|
||||
|
||||
ko.applyBindingsToDescendants(childContext, element);
|
||||
} else {
|
||||
ko.virtualElements.emptyNode(element);
|
||||
|
||||
if (!completeOnRender) {
|
||||
ko.bindingEvent.notify(element, ko.bindingEvent.childrenComplete);
|
||||
}
|
||||
}
|
||||
|
||||
didDisplayOnLastUpdate = shouldDisplay;
|
||||
|
||||
}, null, { disposeWhenNodeIsRemoved: element });
|
||||
|
||||
return { 'controlsDescendantBindings': true };
|
||||
}
|
||||
};
|
||||
ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings
|
||||
ko.virtualElements.allowedBindings[bindingKey] = true;
|
||||
}
|
||||
|
||||
// Construct the actual binding handlers
|
||||
makeWithIfBinding('if');
|
||||
makeWithIfBinding('ifnot', false /* isWith */, true /* isNot */);
|
||||
makeWithIfBinding('with', true /* isWith */);
|
||||
|
||||
})();
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
ko.bindingHandlers['let'] = {
|
||||
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
// Make a modified binding context, with extra properties, and apply it to descendant elements
|
||||
var innerContext = bindingContext['extend'](valueAccessor);
|
||||
ko.applyBindingsToDescendants(innerContext, element);
|
||||
|
||||
return { 'controlsDescendantBindings': true };
|
||||
}
|
||||
};
|
||||
ko.virtualElements.allowedBindings['let'] = true;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
var captionPlaceholder = {};
|
||||
ko.bindingHandlers['options'] = {
|
||||
'init': function(element) {
|
||||
'init': element => {
|
||||
if (ko.utils.tagNameLower(element) !== "select")
|
||||
throw new Error("options binding applies only to SELECT elements");
|
||||
|
||||
|
|
@ -12,9 +12,9 @@ ko.bindingHandlers['options'] = {
|
|||
// Ensures that the binding processor doesn't try to bind the options
|
||||
return { 'controlsDescendantBindings': true };
|
||||
},
|
||||
'update': function (element, valueAccessor, allBindings) {
|
||||
'update': (element, valueAccessor, allBindings) => {
|
||||
function selectedOptions() {
|
||||
return ko.utils.arrayFilter(element.options, function (node) { return node.selected; });
|
||||
return ko.utils.arrayFilter(element.options, node => node.selected);
|
||||
}
|
||||
|
||||
var selectWasPreviouslyEmpty = element.length == 0,
|
||||
|
|
@ -41,9 +41,9 @@ ko.bindingHandlers['options'] = {
|
|||
unwrappedArray = [unwrappedArray];
|
||||
|
||||
// Filter out any entries marked as destroyed
|
||||
filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
|
||||
return includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
|
||||
});
|
||||
filteredArray = ko.utils.arrayFilter(unwrappedArray, item =>
|
||||
includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy'])
|
||||
);
|
||||
|
||||
// If caption is included, add it to the array
|
||||
if (allBindings['has']('optionsCaption')) {
|
||||
|
|
@ -95,10 +95,7 @@ ko.bindingHandlers['options'] = {
|
|||
|
||||
// By using a beforeRemove callback, we delay the removal until after new items are added. This fixes a selection
|
||||
// problem in IE<=8 and Firefox. See https://github.com/knockout/knockout/issues/1208
|
||||
arrayToDomNodeChildrenOptions['beforeRemove'] =
|
||||
function (option) {
|
||||
element.removeChild(option);
|
||||
};
|
||||
arrayToDomNodeChildrenOptions['beforeRemove'] = option => element.removeChild(option);
|
||||
|
||||
function setSelectionCallback(arrayEntry, newOptions) {
|
||||
if (itemUpdate && valueAllowUnset) {
|
||||
|
|
@ -119,7 +116,7 @@ ko.bindingHandlers['options'] = {
|
|||
|
||||
var callback = setSelectionCallback;
|
||||
if (allBindings['has']('optionsAfterRender') && typeof allBindings.get('optionsAfterRender') == "function") {
|
||||
callback = function(arrayEntry, newOptions) {
|
||||
callback = (arrayEntry, newOptions) => {
|
||||
setSelectionCallback(arrayEntry, newOptions);
|
||||
ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
ko.bindingHandlers['selectedOptions'] = {
|
||||
'init': function (element, valueAccessor, allBindings) {
|
||||
function updateFromView() {
|
||||
var value = valueAccessor(), valueToWrite = [];
|
||||
ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) {
|
||||
if (node.selected)
|
||||
valueToWrite.push(ko.selectExtensions.readValue(node));
|
||||
});
|
||||
ko.expressionRewriting.writeValueToProperty(value, allBindings, 'selectedOptions', valueToWrite);
|
||||
}
|
||||
|
||||
function updateFromModel() {
|
||||
var newValue = ko.utils.unwrapObservable(valueAccessor()),
|
||||
previousScrollTop = element.scrollTop;
|
||||
|
||||
if (newValue && typeof newValue.length == "number") {
|
||||
ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) {
|
||||
node.selected = ko.utils.arrayIndexOf(newValue, ko.selectExtensions.readValue(node)) >= 0;
|
||||
});
|
||||
}
|
||||
|
||||
element.scrollTop = previousScrollTop;
|
||||
}
|
||||
|
||||
if (ko.utils.tagNameLower(element) != "select") {
|
||||
throw new Error("selectedOptions binding applies only to SELECT elements");
|
||||
}
|
||||
|
||||
var updateFromModelComputed;
|
||||
ko.bindingEvent.subscribe(element, ko.bindingEvent.childrenComplete, function () {
|
||||
if (!updateFromModelComputed) {
|
||||
ko.utils.registerEventHandler(element, "change", updateFromView);
|
||||
updateFromModelComputed = ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
|
||||
} else {
|
||||
updateFromView();
|
||||
}
|
||||
}, null, { 'notifyImmediately': true });
|
||||
},
|
||||
'update': function() {} // Keep for backwards compatibility with code that may have wrapped binding
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['selectedOptions'] = true;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
ko.bindingHandlers['style'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor() || {});
|
||||
ko.utils.objectForEach(value, function(styleName, styleValue) {
|
||||
ko.utils.objectForEach(value, (styleName, styleValue) => {
|
||||
styleValue = ko.utils.unwrapObservable(styleValue);
|
||||
|
||||
if (styleValue === null || styleValue === undefined || styleValue === false) {
|
||||
|
|
@ -13,9 +13,7 @@ ko.bindingHandlers['style'] = {
|
|||
// Is styleName a custom CSS property?
|
||||
element.style.setProperty(styleName, styleValue);
|
||||
} else {
|
||||
styleName = styleName.replace(/-(\w)/g, function (all, letter) {
|
||||
return letter.toUpperCase();
|
||||
});
|
||||
styleName = styleName.replace(/-(\w)/g, (all, letter) => letter.toUpperCase());
|
||||
|
||||
var previousStyle = element.style[styleName];
|
||||
element.style[styleName] = styleValue;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
ko.bindingHandlers['submit'] = {
|
||||
'init': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
'init': (element, valueAccessor, allBindings, viewModel, bindingContext) => {
|
||||
if (typeof valueAccessor() != "function")
|
||||
throw new Error("The value for a submit binding must be a function");
|
||||
ko.utils.registerEventHandler(element, "submit", function (event) {
|
||||
ko.utils.registerEventHandler(element, "submit", event => {
|
||||
var handlerReturnValue;
|
||||
var value = valueAccessor();
|
||||
try { handlerReturnValue = value.call(bindingContext['$data'], element); }
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
ko.bindingHandlers['text'] = {
|
||||
'init': function() {
|
||||
'init': () => {
|
||||
// Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications).
|
||||
// It should also make things faster, as we no longer have to consider whether the text node might be bindable.
|
||||
return { 'controlsDescendantBindings': true };
|
||||
},
|
||||
'update': function (element, valueAccessor) {
|
||||
ko.utils.setTextContent(element, valueAccessor());
|
||||
}
|
||||
'update': (element, valueAccessor) =>
|
||||
ko.utils.setTextContent(element, valueAccessor())
|
||||
};
|
||||
ko.virtualElements.allowedBindings['text'] = true;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
(function () {
|
||||
|
||||
ko.bindingHandlers['textInput'] = {
|
||||
'init': function (element, valueAccessor, allBindings) {
|
||||
'init': (element, valueAccessor, allBindings) => {
|
||||
|
||||
var previousElementValue = element.value,
|
||||
timeoutHandle,
|
||||
elementValueBeforeEvent;
|
||||
|
||||
var updateModel = function (event) {
|
||||
var updateModel = event => {
|
||||
clearTimeout(timeoutHandle);
|
||||
elementValueBeforeEvent = timeoutHandle = undefined;
|
||||
|
||||
|
|
@ -20,7 +18,7 @@ ko.bindingHandlers['textInput'] = {
|
|||
}
|
||||
};
|
||||
|
||||
var deferUpdateModel = function (event) {
|
||||
var deferUpdateModel = event => {
|
||||
if (!timeoutHandle) {
|
||||
// The elementValueBeforeEvent variable is set *only* during the brief gap between an
|
||||
// event firing and the updateModel function running. This allows us to ignore model
|
||||
|
|
@ -32,11 +30,7 @@ ko.bindingHandlers['textInput'] = {
|
|||
}
|
||||
};
|
||||
|
||||
// IE9 will mess up the DOM if you handle events synchronously which results in DOM changes (such as other bindings);
|
||||
// so we'll make sure all updates are asynchronous
|
||||
var ourUpdate = false;
|
||||
|
||||
var updateView = function () {
|
||||
var updateView = () => {
|
||||
var modelValue = ko.utils.unwrapObservable(valueAccessor());
|
||||
|
||||
if (modelValue === null || modelValue === undefined) {
|
||||
|
|
@ -51,20 +45,17 @@ ko.bindingHandlers['textInput'] = {
|
|||
// Update the element only if the element and model are different. On some browsers, updating the value
|
||||
// will move the cursor to the end of the input, which would be bad while the user is typing.
|
||||
if (element.value !== modelValue) {
|
||||
ourUpdate = true; // Make sure we ignore events (propertychange) that result from updating the value
|
||||
element.value = modelValue;
|
||||
ourUpdate = false;
|
||||
previousElementValue = element.value; // In case the browser changes the value (see #2281)
|
||||
}
|
||||
};
|
||||
|
||||
var onEvent = function (event, handler) {
|
||||
var onEvent = (event, handler) =>
|
||||
ko.utils.registerEventHandler(element, event, handler);
|
||||
};
|
||||
|
||||
if (DEBUG && ko.bindingHandlers['textInput']['_forceUpdateOn']) {
|
||||
// Provide a way for tests to specify exactly which events are bound
|
||||
ko.utils.arrayForEach(ko.bindingHandlers['textInput']['_forceUpdateOn'], function(eventName) {
|
||||
ko.utils.arrayForEach(ko.bindingHandlers['textInput']['_forceUpdateOn'], eventName => {
|
||||
if (eventName.slice(0,5) == 'after') {
|
||||
onEvent(eventName.slice(5), deferUpdateModel);
|
||||
} else {
|
||||
|
|
@ -89,9 +80,5 @@ ko.expressionRewriting.twoWayBindings['textInput'] = true;
|
|||
// textinput is an alias for textInput
|
||||
ko.bindingHandlers['textinput'] = {
|
||||
// preprocess is the only way to set up a full alias
|
||||
'preprocess': function (value, name, addBinding) {
|
||||
addBinding('textInput', value);
|
||||
}
|
||||
'preprocess': (value, name, addBinding) => addBinding('textInput', value)
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
ko.bindingHandlers['uniqueName'] = {
|
||||
'init': function (element, valueAccessor) {
|
||||
if (valueAccessor()) {
|
||||
element.name = "ko_unique_" + (++ko.bindingHandlers['uniqueName'].currentIndex);
|
||||
}
|
||||
}
|
||||
};
|
||||
ko.bindingHandlers['uniqueName'].currentIndex = 0;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
ko.bindingHandlers['using'] = {
|
||||
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
var options;
|
||||
|
||||
if (allBindings['has']('as')) {
|
||||
options = { 'as': allBindings.get('as'), 'noChildContext': allBindings.get('noChildContext') };
|
||||
}
|
||||
|
||||
var innerContext = bindingContext['createChildContext'](valueAccessor, options);
|
||||
ko.applyBindingsToDescendants(innerContext, element);
|
||||
|
||||
return { 'controlsDescendantBindings': true };
|
||||
}
|
||||
};
|
||||
ko.virtualElements.allowedBindings['using'] = true;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
ko.bindingHandlers['value'] = {
|
||||
'init': function (element, valueAccessor, allBindings) {
|
||||
'init': (element, valueAccessor, allBindings) => {
|
||||
var tagName = ko.utils.tagNameLower(element),
|
||||
isInputElement = tagName == "input";
|
||||
|
||||
|
|
@ -18,27 +18,27 @@ ko.bindingHandlers['value'] = {
|
|||
if (typeof requestedEventsToCatch == "string") {
|
||||
eventsToCatch = [requestedEventsToCatch];
|
||||
} else {
|
||||
eventsToCatch = requestedEventsToCatch ? requestedEventsToCatch.filter(function(item, index) {
|
||||
return requestedEventsToCatch.indexOf(item) === index;
|
||||
}) : [];
|
||||
eventsToCatch = requestedEventsToCatch ? requestedEventsToCatch.filter((item, index) =>
|
||||
requestedEventsToCatch.indexOf(item) === index
|
||||
) : [];
|
||||
}
|
||||
ko.utils.arrayRemoveItem(eventsToCatch, "change"); // We'll subscribe to "change" events later
|
||||
}
|
||||
|
||||
var valueUpdateHandler = function() {
|
||||
var valueUpdateHandler = () => {
|
||||
elementValueBeforeEvent = null;
|
||||
var modelValue = valueAccessor();
|
||||
var elementValue = ko.selectExtensions.readValue(element);
|
||||
ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'value', elementValue);
|
||||
}
|
||||
|
||||
ko.utils.arrayForEach(eventsToCatch, function(eventName) {
|
||||
ko.utils.arrayForEach(eventsToCatch, eventName => {
|
||||
// The syntax "after<eventname>" means "run the handler asynchronously after the event"
|
||||
// This is useful, for example, to catch "keydown" events after the browser has updated the control
|
||||
// (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event)
|
||||
var handler = valueUpdateHandler;
|
||||
if (ko.utils.stringStartsWith(eventName, "after")) {
|
||||
handler = function() {
|
||||
handler = () => {
|
||||
// The elementValueBeforeEvent variable is non-null *only* during the brief gap between
|
||||
// a keyX event firing and the valueUpdateHandler running, which is scheduled to happen
|
||||
// at the earliest asynchronous opportunity. We store this temporary information so that
|
||||
|
|
@ -58,7 +58,7 @@ ko.bindingHandlers['value'] = {
|
|||
|
||||
if (isInputElement && element.type == "file") {
|
||||
// For file input elements, can only write the empty string
|
||||
updateFromModel = function () {
|
||||
updateFromModel = () => {
|
||||
var newValue = ko.utils.unwrapObservable(valueAccessor());
|
||||
if (newValue === null || newValue === undefined || newValue === "") {
|
||||
element.value = "";
|
||||
|
|
@ -67,7 +67,7 @@ ko.bindingHandlers['value'] = {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
updateFromModel = function () {
|
||||
updateFromModel = () => {
|
||||
var newValue = ko.utils.unwrapObservable(valueAccessor());
|
||||
var elementValue = ko.selectExtensions.readValue(element);
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ ko.bindingHandlers['value'] = {
|
|||
|
||||
if (tagName === "select") {
|
||||
var updateFromModelComputed;
|
||||
ko.bindingEvent.subscribe(element, ko.bindingEvent.childrenComplete, function () {
|
||||
ko.bindingEvent.subscribe(element, ko.bindingEvent.childrenComplete, () => {
|
||||
if (!updateFromModelComputed) {
|
||||
ko.utils.registerEventHandler(element, "change", valueUpdateHandler);
|
||||
updateFromModelComputed = ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
|
||||
|
|
@ -111,6 +111,6 @@ ko.bindingHandlers['value'] = {
|
|||
ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
|
||||
}
|
||||
},
|
||||
'update': function() {} // Keep for backwards compatibility with code that may have wrapped value binding
|
||||
'update': () => {} // Keep for backwards compatibility with code that may have wrapped value binding
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['value'] = true;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
ko.bindingHandlers['visible'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor());
|
||||
var isCurrentlyVisible = !(element.style.display == "none");
|
||||
if (value && !isCurrentlyVisible)
|
||||
|
|
@ -10,7 +10,6 @@ ko.bindingHandlers['visible'] = {
|
|||
};
|
||||
|
||||
ko.bindingHandlers['hidden'] = {
|
||||
'update': function (element, valueAccessor) {
|
||||
ko.bindingHandlers['visible']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) });
|
||||
}
|
||||
'update': (element, valueAccessor) =>
|
||||
ko.bindingHandlers['visible']['update'](element, () => !ko.utils.unwrapObservable(valueAccessor()) )
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(function () {
|
||||
(() => {
|
||||
// Objective:
|
||||
// * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes,
|
||||
// map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {
|
||||
// Map this array value inside a dependentObservable so we re-map when any dependency changes
|
||||
var mappedNodes = [];
|
||||
var dependentObservable = ko.dependentObservable(function() {
|
||||
var dependentObservable = ko.dependentObservable(() => {
|
||||
var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || [];
|
||||
|
||||
// On subsequent evaluations, just replace the previously-inserted DOM nodes
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
var lastMappingResultDomDataKey = ko.utils.domData.nextKey(),
|
||||
deletedItemDummyValue = ko.utils.domData.nextKey();
|
||||
|
||||
ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes, editScript) {
|
||||
ko.utils.setDomNodeChildrenFromArrayMapping = (domNode, array, mapping, options, callbackAfterAddingNodes, editScript) => {
|
||||
array = array || [];
|
||||
if (typeof array.length == "undefined") // Coerce single value into array
|
||||
array = [array];
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
} else {
|
||||
if (!editScript || (lastMappingResult && lastMappingResult['_countWaitingForRemove'])) {
|
||||
// Compare the provided array against the previous one
|
||||
var lastArray = Array.prototype.map.call(lastMappingResult, function (x) { return x.arrayEntry; }),
|
||||
var lastArray = Array.prototype.map.call(lastMappingResult, x => x.arrayEntry),
|
||||
compareOptions = {
|
||||
'dontLimitMoves': options['dontLimitMoves'],
|
||||
'sparse': true
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
editScript = ko.utils.compareArrays(lastArray, array, compareOptions);
|
||||
}
|
||||
|
||||
for (var i = 0, editScriptItem, movedIndex, itemIndex; editScriptItem = editScript[i]; i++) {
|
||||
for (let i = 0, editScriptItem, movedIndex, itemIndex; editScriptItem = editScript[i]; i++) {
|
||||
movedIndex = editScriptItem['moved'];
|
||||
itemIndex = editScriptItem['index'];
|
||||
switch (editScriptItem['status']) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Go through the items that have been added and deleted and try to find matches between them.
|
||||
ko.utils.findMovesInArrayComparison = function (left, right, limitFailedCompares) {
|
||||
ko.utils.findMovesInArrayComparison = (left, right, limitFailedCompares) => {
|
||||
if (left.length && right.length) {
|
||||
var failedCompares, l, r, leftItem, rightItem;
|
||||
for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) {
|
||||
|
|
@ -17,7 +17,7 @@ ko.utils.findMovesInArrayComparison = function (left, right, limitFailedCompares
|
|||
}
|
||||
};
|
||||
|
||||
ko.utils.compareArrays = (function () {
|
||||
ko.utils.compareArrays = (() => {
|
||||
var statusNotInOld = 'added', statusNotInNew = 'deleted';
|
||||
|
||||
// Simple calculation based on Levenshtein distance.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ko.expressionRewriting = (function () {
|
||||
ko.expressionRewriting = (() => {
|
||||
var javaScriptReservedWords = ["true", "false", "null", "undefined"];
|
||||
|
||||
// Matches something that can be assigned to--either an isolated identifier or something ending with a property accessor
|
||||
|
|
@ -28,7 +28,7 @@ ko.expressionRewriting = (function () {
|
|||
"//.*\n",
|
||||
// Match a regular expression (text enclosed by slashes), but will also match sets of divisions
|
||||
// as a regular expression (this is handled by the parsing loop below).
|
||||
'/(?:\\\\.|[^/])+/\w*',
|
||||
'/(?:\\\\.|[^/])+/w*',
|
||||
// Match text (at least two characters) that does not contain any of the above special characters,
|
||||
// although some of the special characters are allowed to start it (all but the colon and comma).
|
||||
// The text can contain spaces, but leading or trailing spaces are skipped.
|
||||
|
|
@ -143,9 +143,9 @@ ko.expressionRewriting = (function () {
|
|||
keyValueArray = typeof bindingsStringOrKeyValueArray === "string" ?
|
||||
parseObjectLiteral(bindingsStringOrKeyValueArray) : bindingsStringOrKeyValueArray;
|
||||
|
||||
ko.utils.arrayForEach(keyValueArray, function(keyValue) {
|
||||
processKeyValue(keyValue.key || keyValue['unknown'], keyValue.value);
|
||||
});
|
||||
ko.utils.arrayForEach(keyValueArray, keyValue =>
|
||||
processKeyValue(keyValue.key || keyValue['unknown'], keyValue.value)
|
||||
);
|
||||
|
||||
if (propertyAccessorResultStrings.length)
|
||||
processKeyValue('_ko_property_writers', "{" + propertyAccessorResultStrings.join(",") + " }");
|
||||
|
|
@ -162,7 +162,7 @@ ko.expressionRewriting = (function () {
|
|||
|
||||
preProcessBindings: preProcessBindings,
|
||||
|
||||
keyValueArrayContainsKey: function(keyValueArray, key) {
|
||||
keyValueArrayContainsKey: (keyValueArray, key) => {
|
||||
for (var i = 0; i < keyValueArray.length; i++)
|
||||
if (keyValueArray[i]['key'] == key)
|
||||
return true;
|
||||
|
|
@ -178,7 +178,7 @@ ko.expressionRewriting = (function () {
|
|||
// value: The value to be written
|
||||
// checkIfDifferent: If true, and if the property being written is a writable observable, the value will only be written if
|
||||
// it is !== existing value on that writable observable
|
||||
writeValueToProperty: function(property, allBindings, key, value, checkIfDifferent) {
|
||||
writeValueToProperty: (property, allBindings, key, value, checkIfDifferent) => {
|
||||
if (!property || !ko.isObservable(property)) {
|
||||
var propWriters = allBindings.get('_ko_property_writers');
|
||||
if (propWriters && propWriters[key])
|
||||
|
|
@ -194,17 +194,3 @@ ko.exportSymbol('expressionRewriting', ko.expressionRewriting);
|
|||
ko.exportSymbol('expressionRewriting.bindingRewriteValidators', ko.expressionRewriting.bindingRewriteValidators);
|
||||
ko.exportSymbol('expressionRewriting.parseObjectLiteral', ko.expressionRewriting.parseObjectLiteral);
|
||||
ko.exportSymbol('expressionRewriting.preProcessBindings', ko.expressionRewriting.preProcessBindings);
|
||||
|
||||
// Making bindings explicitly declare themselves as "two way" isn't ideal in the long term (it would be better if
|
||||
// all bindings could use an official 'property writer' API without needing to declare that they might). However,
|
||||
// since this is not, and has never been, a public API (_ko_property_writers was never documented), it's acceptable
|
||||
// as an internal implementation detail in the short term.
|
||||
// For those developers who rely on _ko_property_writers in their custom bindings, we expose _twoWayBindings as an
|
||||
// undocumented feature that makes it relatively easy to upgrade to KO 3.0. However, this is still not an official
|
||||
// public API, and we reserve the right to remove it at any time if we create a real public property writers API.
|
||||
ko.exportSymbol('expressionRewriting._twoWayBindings', ko.expressionRewriting.twoWayBindings);
|
||||
|
||||
// For backward compatibility, define the following aliases. (Previously, these function names were misleading because
|
||||
// they referred to JSON specifically, even though they actually work with arbitrary JavaScript object literal expressions.)
|
||||
ko.exportSymbol('jsonExpressionRewriting', ko.expressionRewriting);
|
||||
ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.expressionRewriting.preProcessBindings);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
(function () {
|
||||
(() => {
|
||||
var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__';
|
||||
|
||||
// Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values
|
||||
// are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values
|
||||
// that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.
|
||||
ko.selectExtensions = {
|
||||
readValue : function(element) {
|
||||
readValue : element => {
|
||||
switch (ko.utils.tagNameLower(element)) {
|
||||
case 'option':
|
||||
if (element[hasDomDataExpandoProperty] === true)
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
writeValue: function(element, value, allowUnset) {
|
||||
writeValue: (element, value, allowUnset) => {
|
||||
switch (ko.utils.tagNameLower(element)) {
|
||||
case 'option':
|
||||
if (typeof value === "string") {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
(function(undefined) {
|
||||
(() => {
|
||||
var componentLoadingOperationUniqueId = 0;
|
||||
|
||||
ko.bindingHandlers['component'] = {
|
||||
'init': function(element, valueAccessor, ignored1, ignored2, bindingContext) {
|
||||
'init': (element, valueAccessor, ignored1, ignored2, bindingContext) => {
|
||||
var currentViewModel,
|
||||
currentLoadingOperationId,
|
||||
afterRenderSub,
|
||||
disposeAssociatedComponentViewModel = function () {
|
||||
disposeAssociatedComponentViewModel = () => {
|
||||
var currentViewModelDispose = currentViewModel && currentViewModel['dispose'];
|
||||
if (typeof currentViewModelDispose === 'function') {
|
||||
currentViewModelDispose.call(currentViewModel);
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
ko.virtualElements.emptyNode(element);
|
||||
ko.utils.domNodeDisposal.addDisposeCallback(element, disposeAssociatedComponentViewModel);
|
||||
|
||||
ko.computed(function () {
|
||||
ko.computed(() => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor()),
|
||||
componentName, componentParams;
|
||||
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
var asyncContext = ko.bindingEvent.startPossiblyAsyncContentBinding(element, bindingContext);
|
||||
|
||||
var loadingOperationId = currentLoadingOperationId = ++componentLoadingOperationUniqueId;
|
||||
ko.components.get(componentName, function(componentDefinition) {
|
||||
ko.components.get(componentName, componentDefinition => {
|
||||
// If this is not the current load operation for this element, ignore it.
|
||||
if (currentLoadingOperationId !== loadingOperationId) {
|
||||
return;
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
var componentViewModel = createViewModel(componentDefinition, componentParams, componentInfo),
|
||||
childBindingContext = asyncContext['createChildContext'](componentViewModel, {
|
||||
'extend': function(ctx) {
|
||||
'extend': ctx => {
|
||||
ctx['$component'] = componentViewModel;
|
||||
ctx['$componentTemplateNodes'] = originalChildNodes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
(function (undefined) {
|
||||
(() => {
|
||||
// Overridable API for determining which component name applies to a given node. By overriding this,
|
||||
// you can for example map specific tagNames to components that are not preregistered.
|
||||
ko.components['getComponentNameForNode'] = function(node) {
|
||||
ko.components['getComponentNameForNode'] = node => {
|
||||
var tagNameLower = ko.utils.tagNameLower(node);
|
||||
if (ko.components.isRegistered(tagNameLower)) {
|
||||
// Try to determine that this node can be considered a *custom* element; see https://github.com/knockout/knockout/issues/1603
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
ko.components.addBindingsForCustomElement = function(allBindings, node, bindingContext, valueAccessors) {
|
||||
ko.components.addBindingsForCustomElement = (allBindings, node, bindingContext, valueAccessors) => {
|
||||
// Determine if it's really a custom element matching a component
|
||||
if (node.nodeType === 1) {
|
||||
var componentName = ko.components['getComponentNameForNode'](node);
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
var componentBindingValue = { 'name': componentName, 'params': getComponentParamsFromCustomElement(node, bindingContext) };
|
||||
|
||||
allBindings['component'] = valueAccessors
|
||||
? function() { return componentBindingValue; }
|
||||
? () => componentBindingValue
|
||||
: componentBindingValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -42,10 +42,10 @@
|
|||
|
||||
if (paramsAttribute) {
|
||||
var params = nativeBindingProviderInstance['parseBindingsString'](paramsAttribute, bindingContext, elem, { 'valueAccessors': true, 'bindingParams': true }),
|
||||
rawParamComputedValues = ko.utils.objectMap(params, function(paramValue, paramName) {
|
||||
return ko.computed(paramValue, null, { disposeWhenNodeIsRemoved: elem });
|
||||
}),
|
||||
result = ko.utils.objectMap(rawParamComputedValues, function(paramValueComputed, paramName) {
|
||||
rawParamComputedValues = ko.utils.objectMap(params, paramValue =>
|
||||
ko.computed(paramValue, null, { disposeWhenNodeIsRemoved: elem })
|
||||
),
|
||||
result = ko.utils.objectMap(rawParamComputedValues, paramValueComputed => {
|
||||
var paramValue = paramValueComputed.peek();
|
||||
// Does the evaluation of the parameter value unwrap any observables?
|
||||
if (!paramValueComputed.isActive()) {
|
||||
|
|
@ -58,12 +58,8 @@
|
|||
// This means the component doesn't have to worry about multiple unwrapping. If the value is a
|
||||
// writable observable, the computed will also be writable and pass the value on to the observable.
|
||||
return ko.computed({
|
||||
'read': function() {
|
||||
return ko.utils.unwrapObservable(paramValueComputed());
|
||||
},
|
||||
'write': ko.isWriteableObservable(paramValue) && function(value) {
|
||||
paramValueComputed()(value);
|
||||
},
|
||||
'read': () => ko.utils.unwrapObservable(paramValueComputed()),
|
||||
'write': ko.isWriteableObservable(paramValue) && (value => paramValueComputed()(value)),
|
||||
disposeWhenNodeIsRemoved: elem
|
||||
});
|
||||
}
|
||||
|
|
@ -77,11 +73,10 @@
|
|||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
}
|
||||
// For consistency, absence of a "params" attribute is treated the same as the presence of
|
||||
// any empty one. Otherwise component viewmodels need special code to check whether or not
|
||||
// 'params' or 'params.$raw' is null/undefined before reading subproperties, which is annoying.
|
||||
return { '$raw': {} };
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
86
vendors/knockout/src/components/defaultLoader.js
vendored
86
vendors/knockout/src/components/defaultLoader.js
vendored
|
|
@ -1,4 +1,4 @@
|
|||
(function(undefined) {
|
||||
(() => {
|
||||
|
||||
// The default loader is responsible for two things:
|
||||
// 1. Maintaining the default in-memory registry of component configuration objects
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
var defaultConfigRegistry = {};
|
||||
|
||||
ko.components.register = function(componentName, config) {
|
||||
ko.components.register = (componentName, config) => {
|
||||
if (!config) {
|
||||
throw new Error('Invalid configuration for ' + componentName);
|
||||
}
|
||||
|
|
@ -24,37 +24,35 @@
|
|||
defaultConfigRegistry[componentName] = config;
|
||||
};
|
||||
|
||||
ko.components.isRegistered = function(componentName) {
|
||||
return Object.prototype.hasOwnProperty.call(defaultConfigRegistry, componentName);
|
||||
};
|
||||
ko.components.isRegistered = componentName =>
|
||||
Object.prototype.hasOwnProperty.call(defaultConfigRegistry, componentName);
|
||||
|
||||
ko.components.unregister = function(componentName) {
|
||||
ko.components.unregister = componentName => {
|
||||
delete defaultConfigRegistry[componentName];
|
||||
ko.components.clearCachedDefinition(componentName);
|
||||
};
|
||||
|
||||
ko.components.defaultLoader = {
|
||||
'getConfig': function(componentName, callback) {
|
||||
'getConfig': (componentName, callback) => {
|
||||
var result = ko.components.isRegistered(componentName)
|
||||
? defaultConfigRegistry[componentName]
|
||||
: null;
|
||||
callback(result);
|
||||
},
|
||||
|
||||
'loadComponent': function(componentName, config, callback) {
|
||||
'loadComponent': (componentName, config, callback) => {
|
||||
var errorCallback = makeErrorCallback(componentName);
|
||||
possiblyGetConfigFromAmd(errorCallback, config, function(loadedConfig) {
|
||||
resolveConfig(componentName, errorCallback, loadedConfig, callback);
|
||||
});
|
||||
possiblyGetConfigFromAmd(errorCallback, config, loadedConfig =>
|
||||
resolveConfig(componentName, errorCallback, loadedConfig, callback)
|
||||
);
|
||||
},
|
||||
|
||||
'loadTemplate': function(componentName, templateConfig, callback) {
|
||||
resolveTemplate(makeErrorCallback(componentName), templateConfig, callback);
|
||||
},
|
||||
'loadTemplate': (componentName, templateConfig, callback) =>
|
||||
resolveTemplate(makeErrorCallback(componentName), templateConfig, callback)
|
||||
,
|
||||
|
||||
'loadViewModel': function(componentName, viewModelConfig, callback) {
|
||||
resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback);
|
||||
}
|
||||
'loadViewModel': (componentName, viewModelConfig, callback) =>
|
||||
resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback)
|
||||
};
|
||||
|
||||
var createViewModelKey = 'createViewModel';
|
||||
|
|
@ -68,7 +66,7 @@
|
|||
function resolveConfig(componentName, errorCallback, config, callback) {
|
||||
var result = {},
|
||||
makeCallBackWhenZero = 2,
|
||||
tryIssueCallback = function() {
|
||||
tryIssueCallback = () => {
|
||||
if (--makeCallBackWhenZero === 0) {
|
||||
callback(result);
|
||||
}
|
||||
|
|
@ -77,23 +75,23 @@
|
|||
viewModelConfig = config['viewModel'];
|
||||
|
||||
if (templateConfig) {
|
||||
possiblyGetConfigFromAmd(errorCallback, templateConfig, function(loadedConfig) {
|
||||
ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, loadedConfig], function(resolvedTemplate) {
|
||||
possiblyGetConfigFromAmd(errorCallback, templateConfig, loadedConfig =>
|
||||
ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, loadedConfig], resolvedTemplate => {
|
||||
result['template'] = resolvedTemplate;
|
||||
tryIssueCallback();
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
} else {
|
||||
tryIssueCallback();
|
||||
}
|
||||
|
||||
if (viewModelConfig) {
|
||||
possiblyGetConfigFromAmd(errorCallback, viewModelConfig, function(loadedConfig) {
|
||||
ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, loadedConfig], function(resolvedViewModel) {
|
||||
possiblyGetConfigFromAmd(errorCallback, viewModelConfig, loadedConfig =>
|
||||
ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, loadedConfig], resolvedViewModel => {
|
||||
result[createViewModelKey] = resolvedViewModel;
|
||||
tryIssueCallback();
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
} else {
|
||||
tryIssueCallback();
|
||||
}
|
||||
|
|
@ -106,12 +104,12 @@
|
|||
} else if (templateConfig instanceof Array) {
|
||||
// Assume already an array of DOM nodes - pass through unchanged
|
||||
callback(templateConfig);
|
||||
} else if (isDocumentFragment(templateConfig)) {
|
||||
} else if (templateConfig instanceof DocumentFragment) {
|
||||
// Document fragment - use its child nodes
|
||||
callback(ko.utils.makeArray(templateConfig.childNodes));
|
||||
} else if (templateConfig['element']) {
|
||||
var element = templateConfig['element'];
|
||||
if (isDomElement(element)) {
|
||||
if (element instanceof HTMLElement) {
|
||||
// Element instance - copy its child nodes
|
||||
callback(cloneNodesFromTemplateSourceElement(element));
|
||||
} else if (typeof element === 'string') {
|
||||
|
|
@ -136,18 +134,14 @@
|
|||
// By design, this does *not* supply componentInfo to the constructor, as the intent is that
|
||||
// componentInfo contains non-viewmodel data (e.g., the component's element) that should only
|
||||
// be used in factory functions, not viewmodel constructors.
|
||||
callback(function (params /*, componentInfo */) {
|
||||
return new viewModelConfig(params);
|
||||
});
|
||||
callback(params => new viewModelConfig(params));
|
||||
} else if (typeof viewModelConfig[createViewModelKey] === 'function') {
|
||||
// Already a factory function - use it as-is
|
||||
callback(viewModelConfig[createViewModelKey]);
|
||||
} else if ('instance' in viewModelConfig) {
|
||||
// Fixed object instance - promote to createViewModel format for API consistency
|
||||
var fixedInstance = viewModelConfig['instance'];
|
||||
callback(function (params, componentInfo) {
|
||||
return fixedInstance;
|
||||
});
|
||||
callback(() => fixedInstance);
|
||||
} else if ('viewModel' in viewModelConfig) {
|
||||
// Resolved AMD module whose value is of the form { viewModel: ... }
|
||||
resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback);
|
||||
|
|
@ -160,34 +154,18 @@
|
|||
if ('template' == ko.utils.tagNameLower(elemInstance)) {
|
||||
// For browsers with proper <template> element support (i.e., where the .content property
|
||||
// gives a document fragment), use that document fragment.
|
||||
if (isDocumentFragment(elemInstance.content)) {
|
||||
if (elemInstance.content instanceof DocumentFragment) {
|
||||
return ko.utils.cloneNodes(elemInstance.content.childNodes);
|
||||
}
|
||||
}
|
||||
throw 'Template Source Element not a <template>';
|
||||
}
|
||||
|
||||
function isDomElement(obj) {
|
||||
if (window['HTMLElement']) {
|
||||
return obj instanceof HTMLElement;
|
||||
} else {
|
||||
return obj && obj.tagName && obj.nodeType === 1;
|
||||
}
|
||||
}
|
||||
|
||||
function isDocumentFragment(obj) {
|
||||
if (window['DocumentFragment']) {
|
||||
return obj instanceof DocumentFragment;
|
||||
} else {
|
||||
return obj && obj.nodeType === 11;
|
||||
}
|
||||
}
|
||||
|
||||
function possiblyGetConfigFromAmd(errorCallback, config, callback) {
|
||||
if (typeof config['require'] === 'string') {
|
||||
// The config is the value of an AMD module
|
||||
if (amdRequire || window['require']) {
|
||||
(amdRequire || window['require'])([config['require']], function (module) {
|
||||
(amdRequire || window['require'])([config['require']], module => {
|
||||
if (module && typeof module === 'object' && module.__esModule && module['default']) {
|
||||
module = module['default'];
|
||||
}
|
||||
|
|
@ -202,8 +180,8 @@
|
|||
}
|
||||
|
||||
function makeErrorCallback(componentName) {
|
||||
return function (message) {
|
||||
throw new Error('Component \'' + componentName + '\': ' + message);
|
||||
return message => {
|
||||
throw new Error('Component \'' + componentName + '\': ' + message)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
(function(undefined) {
|
||||
(() => {
|
||||
var loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight
|
||||
loadedDefinitionsCache = {}; // Tracks component loads that have already completed
|
||||
|
||||
ko.components = {
|
||||
get: function(componentName, callback) {
|
||||
get: (componentName, callback) => {
|
||||
var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName);
|
||||
if (cachedDefinition) {
|
||||
// It's already loaded and cached. Reuse the same definition object.
|
||||
// Note that for API consistency, even cache hits complete asynchronously by default.
|
||||
// You can bypass this by putting synchronous:true on your component config.
|
||||
if (cachedDefinition.isSynchronousComponent) {
|
||||
ko.dependencyDetection.ignore(function() { // See comment in loaderRegistryBehaviors.js for reasoning
|
||||
callback(cachedDefinition.definition);
|
||||
});
|
||||
ko.dependencyDetection.ignore(() => // See comment in loaderRegistryBehaviors.js for reasoning
|
||||
callback(cachedDefinition.definition)
|
||||
);
|
||||
} else {
|
||||
ko.tasks.schedule(function() { callback(cachedDefinition.definition); });
|
||||
ko.tasks.schedule(() => callback(cachedDefinition.definition) );
|
||||
}
|
||||
} else {
|
||||
// Join the loading process that is already underway, or start a new one.
|
||||
|
|
@ -22,9 +22,9 @@
|
|||
}
|
||||
},
|
||||
|
||||
clearCachedDefinition: function(componentName) {
|
||||
delete loadedDefinitionsCache[componentName];
|
||||
},
|
||||
clearCachedDefinition: componentName =>
|
||||
delete loadedDefinitionsCache[componentName]
|
||||
,
|
||||
|
||||
_getFirstResultFromLoaders: getFirstResultFromLoaders
|
||||
};
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
|
||||
subscribable.subscribe(callback);
|
||||
|
||||
beginLoadingComponent(componentName, function(definition, config) {
|
||||
beginLoadingComponent(componentName, (definition, config) => {
|
||||
var isSynchronousComponent = !!(config && config['synchronous']);
|
||||
loadedDefinitionsCache[componentName] = { definition: definition, isSynchronousComponent: isSynchronousComponent };
|
||||
delete loadingSubscribablesCache[componentName];
|
||||
|
|
@ -57,9 +57,7 @@
|
|||
// See comment in loaderRegistryBehaviors.js for reasoning
|
||||
subscribable['notifySubscribers'](definition);
|
||||
} else {
|
||||
ko.tasks.schedule(function() {
|
||||
subscribable['notifySubscribers'](definition);
|
||||
});
|
||||
ko.tasks.schedule(() => subscribable['notifySubscribers'](definition));
|
||||
}
|
||||
});
|
||||
completedAsync = true;
|
||||
|
|
@ -69,12 +67,12 @@
|
|||
}
|
||||
|
||||
function beginLoadingComponent(componentName, callback) {
|
||||
getFirstResultFromLoaders('getConfig', [componentName], function(config) {
|
||||
getFirstResultFromLoaders('getConfig', [componentName], config => {
|
||||
if (config) {
|
||||
// We have a config, so now load its definition
|
||||
getFirstResultFromLoaders('loadComponent', [componentName, config], function(definition) {
|
||||
callback(definition, config);
|
||||
});
|
||||
getFirstResultFromLoaders('loadComponent', [componentName, config], definition =>
|
||||
callback(definition, config)
|
||||
);
|
||||
} else {
|
||||
// The component has no config - it's unknown to all the loaders.
|
||||
// Note that this is not an error (e.g., a module loading error) - that would abort the
|
||||
|
|
|
|||
10
vendors/knockout/src/memoization.js
vendored
10
vendors/knockout/src/memoization.js
vendored
|
|
@ -22,7 +22,7 @@ ko.memoization = (function () {
|
|||
}
|
||||
|
||||
return {
|
||||
memoize: function (callback) {
|
||||
memoize: callback => {
|
||||
if (typeof callback != "function")
|
||||
throw new Error("You can only pass a function to ko.memoization.memoize()");
|
||||
var memoId = generateRandomId();
|
||||
|
|
@ -30,7 +30,7 @@ ko.memoization = (function () {
|
|||
return "<!--[ko_memo:" + memoId + "]-->";
|
||||
},
|
||||
|
||||
unmemoize: function (memoId, callbackParams) {
|
||||
unmemoize: (memoId, callbackParams) => {
|
||||
var callback = memos[memoId];
|
||||
if (callback === undefined)
|
||||
throw new Error("Couldn't find any memo with ID " + memoId + ". Perhaps it's already been unmemoized.");
|
||||
|
|
@ -41,7 +41,7 @@ ko.memoization = (function () {
|
|||
finally { delete memos[memoId]; }
|
||||
},
|
||||
|
||||
unmemoizeDomNodeAndDescendants: function (domNode, extraCallbackParamsArray) {
|
||||
unmemoizeDomNodeAndDescendants: (domNode, extraCallbackParamsArray) => {
|
||||
var memos = [];
|
||||
findMemoNodes(domNode, memos);
|
||||
for (var i = 0, j = memos.length; i < j; i++) {
|
||||
|
|
@ -56,8 +56,8 @@ ko.memoization = (function () {
|
|||
}
|
||||
},
|
||||
|
||||
parseMemoText: function (memoText) {
|
||||
var match = memoText.match(/^\[ko_memo\:(.*?)\]$/);
|
||||
parseMemoText: memoText => {
|
||||
var match = memoText.match(/^\[ko_memo:(.*?)\]$/);
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,19 +1,9 @@
|
|||
|
||||
ko.computedContext = ko.dependencyDetection = (function () {
|
||||
ko.computedContext = ko.dependencyDetection = (() => {
|
||||
var outerFrames = [],
|
||||
currentFrame,
|
||||
lastId = 0;
|
||||
|
||||
// Return a unique ID that can be assigned to an observable for dependency tracking.
|
||||
// Theoretically, you could eventually overflow the number storage size, resulting
|
||||
// in duplicate IDs. But in JavaScript, the largest exact integral value is 2^53
|
||||
// or 9,007,199,254,740,992. If you created 1,000,000 IDs per second, it would
|
||||
// take over 285 years to reach that number.
|
||||
// Reference http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html
|
||||
function getId() {
|
||||
return ++lastId;
|
||||
}
|
||||
|
||||
function begin(options) {
|
||||
outerFrames.push(currentFrame);
|
||||
currentFrame = options;
|
||||
|
|
@ -28,15 +18,15 @@ ko.computedContext = ko.dependencyDetection = (function () {
|
|||
|
||||
end: end,
|
||||
|
||||
registerDependency: function (subscribable) {
|
||||
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 = getId()));
|
||||
currentFrame.callback.call(currentFrame.callbackTarget, subscribable, subscribable._id || (subscribable._id = ++lastId));
|
||||
}
|
||||
},
|
||||
|
||||
ignore: function (callback, callbackTarget, callbackArgs) {
|
||||
ignore: (callback, callbackTarget, callbackArgs) => {
|
||||
try {
|
||||
begin();
|
||||
return callback.apply(callbackTarget, callbackArgs || []);
|
||||
|
|
@ -45,22 +35,22 @@ ko.computedContext = ko.dependencyDetection = (function () {
|
|||
}
|
||||
},
|
||||
|
||||
getDependenciesCount: function () {
|
||||
getDependenciesCount: () => {
|
||||
if (currentFrame)
|
||||
return currentFrame.computed.getDependenciesCount();
|
||||
},
|
||||
|
||||
getDependencies: function () {
|
||||
getDependencies: () => {
|
||||
if (currentFrame)
|
||||
return currentFrame.computed.getDependencies();
|
||||
},
|
||||
|
||||
isInitial: function() {
|
||||
isInitial: () => {
|
||||
if (currentFrame)
|
||||
return currentFrame.isInitial;
|
||||
},
|
||||
|
||||
computed: function() {
|
||||
computed: () => {
|
||||
if (currentFrame)
|
||||
return currentFrame.computed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,9 +153,9 @@ var computedFn = {
|
|||
getDependencies: function () {
|
||||
var dependencyTracking = this[computedState].dependencyTracking, dependentObservables = [];
|
||||
|
||||
ko.utils.objectForEach(dependencyTracking, function (id, dependency) {
|
||||
dependentObservables[dependency._order] = dependency._target;
|
||||
});
|
||||
ko.utils.objectForEach(dependencyTracking, (id, dependency) =>
|
||||
dependentObservables[dependency._order] = dependency._target
|
||||
);
|
||||
|
||||
return dependentObservables;
|
||||
},
|
||||
|
|
@ -167,9 +167,9 @@ var computedFn = {
|
|||
if (ko.utils.arrayIndexOf(dependencies, obs) !== -1) {
|
||||
return true;
|
||||
}
|
||||
return !!ko.utils.arrayFirst(dependencies, function (dep) {
|
||||
return dep.hasAncestorDependency && dep.hasAncestorDependency(obs);
|
||||
});
|
||||
return !!ko.utils.arrayFirst(dependencies, dep =>
|
||||
dep.hasAncestorDependency && dep.hasAncestorDependency(obs)
|
||||
);
|
||||
},
|
||||
addDependencyTracking: function (id, target, trackingObj) {
|
||||
if (this[computedState].pure && target === this) {
|
||||
|
|
@ -215,7 +215,7 @@ var computedFn = {
|
|||
changeSub = target.subscribe(this.respondToChange, this);
|
||||
return {
|
||||
_target: target,
|
||||
dispose: function () {
|
||||
dispose: () => {
|
||||
dirtySub.dispose();
|
||||
changeSub.dispose();
|
||||
}
|
||||
|
|
@ -229,9 +229,9 @@ var computedFn = {
|
|||
throttleEvaluationTimeout = computedObservable['throttleEvaluation'];
|
||||
if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) {
|
||||
clearTimeout(this[computedState].evaluationTimeoutInstance);
|
||||
this[computedState].evaluationTimeoutInstance = ko.utils.setTimeout(function () {
|
||||
computedObservable.evaluateImmediate(true /*notifyChange*/);
|
||||
}, throttleEvaluationTimeout);
|
||||
this[computedState].evaluationTimeoutInstance = ko.utils.setTimeout(() =>
|
||||
computedObservable.evaluateImmediate(true /*notifyChange*/)
|
||||
, throttleEvaluationTimeout);
|
||||
} else if (computedObservable._evalDelayed) {
|
||||
computedObservable._evalDelayed(true /*isChange*/);
|
||||
} else {
|
||||
|
|
@ -340,7 +340,7 @@ var computedFn = {
|
|||
|
||||
return changed;
|
||||
},
|
||||
evaluateImmediate_CallReadThenEndDependencyDetection: function (state, dependencyDetectionContext) {
|
||||
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
|
||||
|
|
@ -399,10 +399,9 @@ var computedFn = {
|
|||
dispose: function () {
|
||||
var state = this[computedState];
|
||||
if (!state.isSleeping && state.dependencyTracking) {
|
||||
ko.utils.objectForEach(state.dependencyTracking, function (id, dependency) {
|
||||
if (dependency.dispose)
|
||||
dependency.dispose();
|
||||
});
|
||||
ko.utils.objectForEach(state.dependencyTracking, (id, dependency) =>
|
||||
dependency.dispose && dependency.dispose()
|
||||
);
|
||||
}
|
||||
if (state.disposeWhenNodeIsRemoved && state.domNodeDisposalCallback) {
|
||||
ko.utils.domNodeDisposal.removeDisposeCallback(state.disposeWhenNodeIsRemoved, state.domNodeDisposalCallback);
|
||||
|
|
@ -438,11 +437,11 @@ var pureComputedOverrides = {
|
|||
} else {
|
||||
// First put the dependencies in order
|
||||
var dependenciesOrder = [];
|
||||
ko.utils.objectForEach(state.dependencyTracking, function (id, dependency) {
|
||||
dependenciesOrder[dependency._order] = id;
|
||||
});
|
||||
ko.utils.objectForEach(state.dependencyTracking, (id, dependency) =>
|
||||
dependenciesOrder[dependency._order] = id
|
||||
);
|
||||
// Next, subscribe to each one
|
||||
ko.utils.arrayForEach(dependenciesOrder, function (id, order) {
|
||||
ko.utils.arrayForEach(dependenciesOrder, (id, order) => {
|
||||
var dependency = state.dependencyTracking[id],
|
||||
subscription = computedObservable.subscribeToDependency(dependency._target);
|
||||
subscription._order = order;
|
||||
|
|
@ -465,7 +464,7 @@ var pureComputedOverrides = {
|
|||
afterSubscriptionRemove: function (event) {
|
||||
var state = this[computedState];
|
||||
if (!state.isDisposed && event == 'change' && !this.hasSubscriptionsForEvent('change')) {
|
||||
ko.utils.objectForEach(state.dependencyTracking, function (id, dependency) {
|
||||
ko.utils.objectForEach(state.dependencyTracking, (id, dependency) => {
|
||||
if (dependency.dispose) {
|
||||
state.dependencyTracking[id] = {
|
||||
_target: dependency._target,
|
||||
|
|
@ -510,13 +509,9 @@ if (ko.utils.canSetPrototype) {
|
|||
var protoProp = ko.observable.protoProperty; // == "__ko_proto__"
|
||||
computedFn[protoProp] = ko.computed;
|
||||
|
||||
ko.isComputed = function (instance) {
|
||||
return (typeof instance == 'function' && instance[protoProp] === computedFn[protoProp]);
|
||||
};
|
||||
ko.isComputed = instance => (typeof instance == 'function' && instance[protoProp] === computedFn[protoProp]);
|
||||
|
||||
ko.isPureComputed = function (instance) {
|
||||
return ko.isComputed(instance) && instance[computedState] && instance[computedState].pure;
|
||||
};
|
||||
ko.isPureComputed = instance => ko.isComputed(instance) && instance[computedState] && instance[computedState].pure;
|
||||
|
||||
ko.exportSymbol('computed', ko.computed);
|
||||
ko.exportSymbol('dependentObservable', ko.computed); // export ko.dependentObservable for backwards compatibility (1.x)
|
||||
|
|
@ -529,13 +524,12 @@ ko.exportProperty(computedFn, 'isActive', computedFn.isActive);
|
|||
ko.exportProperty(computedFn, 'getDependenciesCount', computedFn.getDependenciesCount);
|
||||
ko.exportProperty(computedFn, 'getDependencies', computedFn.getDependencies);
|
||||
|
||||
ko.pureComputed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget) {
|
||||
ko.pureComputed = (evaluatorFunctionOrOptions, evaluatorFunctionTarget) => {
|
||||
if (typeof evaluatorFunctionOrOptions === 'function') {
|
||||
return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, {'pure':true});
|
||||
} else {
|
||||
}
|
||||
evaluatorFunctionOrOptions = ko.utils.extend({}, evaluatorFunctionOrOptions); // make a copy of the parameter object
|
||||
evaluatorFunctionOrOptions['pure'] = true;
|
||||
return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget);
|
||||
}
|
||||
}
|
||||
};
|
||||
ko.exportSymbol('pureComputed', ko.pureComputed);
|
||||
|
|
|
|||
30
vendors/knockout/src/subscribables/extenders.js
vendored
30
vendors/knockout/src/subscribables/extenders.js
vendored
|
|
@ -1,5 +1,5 @@
|
|||
ko.extenders = {
|
||||
'throttle': function(target, timeout) {
|
||||
'throttle': (target, timeout) => {
|
||||
// Throttling means two things:
|
||||
|
||||
// (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies
|
||||
|
|
@ -11,16 +11,14 @@ ko.extenders = {
|
|||
var writeTimeoutInstance = null;
|
||||
return ko.dependentObservable({
|
||||
'read': target,
|
||||
'write': function(value) {
|
||||
'write': value => {
|
||||
clearTimeout(writeTimeoutInstance);
|
||||
writeTimeoutInstance = ko.utils.setTimeout(function() {
|
||||
target(value);
|
||||
}, timeout);
|
||||
writeTimeoutInstance = ko.utils.setTimeout(() => target(value), timeout);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'rateLimit': function(target, options) {
|
||||
'rateLimit': (target, options) => {
|
||||
var timeout, method, limitFunction;
|
||||
|
||||
if (typeof options == 'number') {
|
||||
|
|
@ -34,22 +32,20 @@ ko.extenders = {
|
|||
target._deferUpdates = false;
|
||||
|
||||
limitFunction = typeof method == 'function' ? method : method == 'notifyWhenChangesStop' ? debounce : throttle;
|
||||
target.limit(function(callback) {
|
||||
return limitFunction(callback, timeout, options);
|
||||
});
|
||||
target.limit(callback => limitFunction(callback, timeout, options));
|
||||
},
|
||||
|
||||
'deferred': function(target, options) {
|
||||
'deferred': (target, options) => {
|
||||
if (options !== true) {
|
||||
throw new Error('The \'deferred\' extender only accepts the value \'true\', because it is not supported to turn deferral off once enabled.')
|
||||
}
|
||||
|
||||
if (!target._deferUpdates) {
|
||||
target._deferUpdates = true;
|
||||
target.limit(function (callback) {
|
||||
target.limit(callback => {
|
||||
var handle,
|
||||
ignoreUpdates = false;
|
||||
return function () {
|
||||
return () => {
|
||||
if (!ignoreUpdates) {
|
||||
ko.tasks.cancel(handle);
|
||||
handle = ko.tasks.schedule(callback);
|
||||
|
|
@ -66,7 +62,7 @@ ko.extenders = {
|
|||
}
|
||||
},
|
||||
|
||||
'notify': function(target, notifyWhen) {
|
||||
'notify': (target, notifyWhen) => {
|
||||
target["equalityComparer"] = notifyWhen == "always" ?
|
||||
null : // null equalityComparer means to always notify
|
||||
valuesArePrimitiveAndEqual;
|
||||
|
|
@ -81,9 +77,9 @@ function valuesArePrimitiveAndEqual(a, b) {
|
|||
|
||||
function throttle(callback, timeout) {
|
||||
var timeoutInstance;
|
||||
return function () {
|
||||
return () => {
|
||||
if (!timeoutInstance) {
|
||||
timeoutInstance = ko.utils.setTimeout(function () {
|
||||
timeoutInstance = ko.utils.setTimeout(() => {
|
||||
timeoutInstance = undefined;
|
||||
callback();
|
||||
}, timeout);
|
||||
|
|
@ -93,7 +89,7 @@ function throttle(callback, timeout) {
|
|||
|
||||
function debounce(callback, timeout) {
|
||||
var timeoutInstance;
|
||||
return function () {
|
||||
return () => {
|
||||
clearTimeout(timeoutInstance);
|
||||
timeoutInstance = ko.utils.setTimeout(callback, timeout);
|
||||
};
|
||||
|
|
@ -102,7 +98,7 @@ function debounce(callback, timeout) {
|
|||
function applyExtenders(requestedExtenders) {
|
||||
var target = this;
|
||||
if (requestedExtenders) {
|
||||
ko.utils.objectForEach(requestedExtenders, function(key, value) {
|
||||
ko.utils.objectForEach(requestedExtenders, (key, value) => {
|
||||
var extenderHandler = ko.extenders[key];
|
||||
if (typeof extenderHandler == 'function') {
|
||||
target = extenderHandler(target, value) || target;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
var observableLatestValue = Symbol('_latestValue');
|
||||
|
||||
ko.observable = function (initialValue) {
|
||||
ko.observable = initialValue => {
|
||||
function observable() {
|
||||
if (arguments.length > 0) {
|
||||
// Write
|
||||
|
|
@ -59,7 +59,7 @@ if (ko.utils.canSetPrototype) {
|
|||
var protoProperty = ko.observable.protoProperty = '__ko_proto__';
|
||||
observableFn[protoProperty] = ko.observable;
|
||||
|
||||
ko.isObservable = function (instance) {
|
||||
ko.isObservable = instance => {
|
||||
var proto = typeof instance == 'function' && instance[protoProperty];
|
||||
if (proto && proto !== observableFn[protoProperty] && proto !== ko.computed['fn'][protoProperty]) {
|
||||
throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
|
||||
|
|
@ -67,7 +67,7 @@ ko.isObservable = function (instance) {
|
|||
return !!proto;
|
||||
};
|
||||
|
||||
ko.isWriteableObservable = function (instance) {
|
||||
ko.isWriteableObservable = instance => {
|
||||
return (typeof instance == 'function' && (
|
||||
(instance[protoProperty] === observableFn[protoProperty]) || // Observable
|
||||
(instance[protoProperty] === ko.computed['fn'][protoProperty] && instance.hasWriteFunction))); // Writable computed observable
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
var arrayChangeEventName = 'arrayChange';
|
||||
ko.extenders['trackArrayChanges'] = function(target, options) {
|
||||
ko.extenders['trackArrayChanges'] = (target, options) => {
|
||||
// Use the provided options--each call to trackArrayChanges overwrites the previously set options
|
||||
target.compareArrayOptions = {};
|
||||
if (options && typeof options == "object") {
|
||||
|
|
@ -21,7 +21,7 @@ ko.extenders['trackArrayChanges'] = function(target, options) {
|
|||
underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove;
|
||||
|
||||
// Watch "subscribe" calls, and for array change events, ensure change tracking is enabled
|
||||
target.beforeSubscriptionAdd = function (event) {
|
||||
target.beforeSubscriptionAdd = event => {
|
||||
if (underlyingBeforeSubscriptionAddFunction) {
|
||||
underlyingBeforeSubscriptionAddFunction.call(target, event);
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ ko.extenders['trackArrayChanges'] = function(target, options) {
|
|||
}
|
||||
};
|
||||
// Watch "dispose" calls, and for array change events, ensure change tracking is disabled when all are disposed
|
||||
target.afterSubscriptionRemove = function (event) {
|
||||
target.afterSubscriptionRemove = event => {
|
||||
if (underlyingAfterSubscriptionRemoveFunction) {
|
||||
underlyingAfterSubscriptionRemoveFunction.call(target, event);
|
||||
}
|
||||
|
|
@ -58,9 +58,7 @@ ko.extenders['trackArrayChanges'] = function(target, options) {
|
|||
trackingChanges = true;
|
||||
|
||||
// Track how many times the array actually changed value
|
||||
spectateSubscription = target.subscribe(function () {
|
||||
++pendingChanges;
|
||||
}, null, "spectate");
|
||||
spectateSubscription = target.subscribe(() => ++pendingChanges, null, "spectate");
|
||||
|
||||
// Each time the array changes value, capture a clone so that on the next
|
||||
// change it's possible to produce a diff
|
||||
|
|
@ -102,7 +100,7 @@ ko.extenders['trackArrayChanges'] = function(target, options) {
|
|||
return cachedDiff;
|
||||
}
|
||||
|
||||
target.cacheDiffForKnownOperation = function(rawArray, operationName, args) {
|
||||
target.cacheDiffForKnownOperation = (rawArray, operationName, args) => {
|
||||
// Only run if we're currently tracking changes for this observable array
|
||||
// and there aren't any pending deferred notifications.
|
||||
if (!trackingChanges || pendingChanges) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ko.observableArray = function (initialValues) {
|
||||
ko.observableArray = initialValues => {
|
||||
initialValues = initialValues || [];
|
||||
|
||||
if (typeof initialValues != 'object' || !('length' in initialValues))
|
||||
|
|
@ -66,7 +66,7 @@ if (ko.utils.canSetPrototype) {
|
|||
// Populate ko.observableArray.fn with read/write functions from native arrays
|
||||
// Important: Do not add any additional functions here that may reasonably be used to *read* data from the array
|
||||
// because we'll eval them without causing subscriptions, so ko.computed output could end up getting stale
|
||||
ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) {
|
||||
ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], methodName => {
|
||||
ko.observableArray['fn'][methodName] = function () {
|
||||
// Use "peek" to avoid creating a subscription in any computed that we're executing in the context of
|
||||
// (for consistency with mutating regular observables)
|
||||
|
|
@ -81,14 +81,14 @@ ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "uns
|
|||
});
|
||||
|
||||
// Populate ko.observableArray.fn with read-only functions from native arrays
|
||||
ko.utils.arrayForEach(["slice"], function (methodName) {
|
||||
ko.utils.arrayForEach(["slice"], methodName => {
|
||||
ko.observableArray['fn'][methodName] = function () {
|
||||
var underlyingArray = this();
|
||||
return underlyingArray[methodName].apply(underlyingArray, arguments);
|
||||
};
|
||||
});
|
||||
|
||||
ko.isObservableArray = function (instance) {
|
||||
ko.isObservableArray = instance => {
|
||||
return ko.isObservable(instance)
|
||||
&& typeof instance["remove"] == "function"
|
||||
&& typeof instance["push"] == "function";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ko.when = function(predicate, callback, context) {
|
||||
ko.when = (predicate, callback, context) => {
|
||||
function kowhen (resolve) {
|
||||
var observable = ko.pureComputed(predicate, context).extend({notify:'always'});
|
||||
var subscription = observable.subscribe(function(value) {
|
||||
var subscription = observable.subscribe(value => {
|
||||
if (value) {
|
||||
subscription.dispose();
|
||||
resolve(value);
|
||||
|
|
@ -12,10 +12,7 @@ ko.when = function(predicate, callback, context) {
|
|||
|
||||
return subscription;
|
||||
}
|
||||
if (callback) {
|
||||
return kowhen(callback.bind(context));
|
||||
}
|
||||
return new Promise(kowhen);
|
||||
return callback ? kowhen(callback.bind(context)) : new Promise(kowhen);
|
||||
};
|
||||
|
||||
ko.exportSymbol('when', ko.when);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ function limitNotifySubscribers(value, event) {
|
|||
}
|
||||
|
||||
var ko_subscribable_fn = {
|
||||
init: function(instance) {
|
||||
init: instance => {
|
||||
instance._subscriptions = { "change": [] };
|
||||
instance._versionNumber = 1;
|
||||
},
|
||||
|
|
@ -56,7 +56,7 @@ var ko_subscribable_fn = {
|
|||
event = event || defaultEvent;
|
||||
var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback;
|
||||
|
||||
var subscription = new ko.subscription(self, boundCallback, function () {
|
||||
var subscription = new ko.subscription(self, boundCallback, () => {
|
||||
ko.utils.arrayRemoveItem(self._subscriptions[event], subscription);
|
||||
if (self.afterSubscriptionRemove)
|
||||
self.afterSubscriptionRemove(event);
|
||||
|
|
@ -115,7 +115,7 @@ var ko_subscribable_fn = {
|
|||
self["notifySubscribers"] = limitNotifySubscribers;
|
||||
}
|
||||
|
||||
var finish = limitFunction(function() {
|
||||
var finish = limitFunction(() => {
|
||||
self._notificationIsPending = false;
|
||||
|
||||
// If an observable provided a reference to itself, access it to get the latest value.
|
||||
|
|
@ -132,7 +132,7 @@ var ko_subscribable_fn = {
|
|||
}
|
||||
});
|
||||
|
||||
self._limitChange = function(value, isDirty) {
|
||||
self._limitChange = (value, isDirty) => {
|
||||
if (!isDirty || !self._notificationIsPending) {
|
||||
didUpdate = !isDirty;
|
||||
}
|
||||
|
|
@ -141,16 +141,16 @@ var ko_subscribable_fn = {
|
|||
pendingValue = value;
|
||||
finish();
|
||||
};
|
||||
self._limitBeforeChange = function(value) {
|
||||
self._limitBeforeChange = value => {
|
||||
if (!ignoreBeforeChange) {
|
||||
previousValue = value;
|
||||
self._origNotifySubscribers(value, beforeChange);
|
||||
}
|
||||
};
|
||||
self._recordUpdate = function() {
|
||||
self._recordUpdate = () => {
|
||||
didUpdate = true;
|
||||
};
|
||||
self._notifyNextChangeIfValueIsDifferent = function() {
|
||||
self._notifyNextChangeIfValueIsDifferent = () => {
|
||||
if (self.isDifferent(previousValue, self.peek(true /*evaluate*/))) {
|
||||
notifyNextChange = true;
|
||||
}
|
||||
|
|
@ -164,23 +164,20 @@ var ko_subscribable_fn = {
|
|||
getSubscriptionsCount: function (event) {
|
||||
if (event) {
|
||||
return this._subscriptions[event] && this._subscriptions[event].length || 0;
|
||||
} else {
|
||||
}
|
||||
var total = 0;
|
||||
ko.utils.objectForEach(this._subscriptions, function(eventName, subscriptions) {
|
||||
ko.utils.objectForEach(this._subscriptions, (eventName, subscriptions) => {
|
||||
if (eventName !== 'dirty')
|
||||
total += subscriptions.length;
|
||||
});
|
||||
return total;
|
||||
}
|
||||
},
|
||||
|
||||
isDifferent: function(oldValue, newValue) {
|
||||
return !this['equalityComparer'] || !this['equalityComparer'](oldValue, newValue);
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
return '[object Object]'
|
||||
},
|
||||
toString: () => '[object Object]',
|
||||
|
||||
extend: applyExtenders
|
||||
};
|
||||
|
|
@ -200,9 +197,8 @@ if (ko.utils.canSetPrototype) {
|
|||
ko.subscribable['fn'] = ko_subscribable_fn;
|
||||
|
||||
|
||||
ko.isSubscribable = function (instance) {
|
||||
return instance != null && typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function";
|
||||
};
|
||||
ko.isSubscribable = instance =>
|
||||
instance != null && typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function";
|
||||
|
||||
ko.exportSymbol('subscribable', ko.subscribable);
|
||||
ko.exportSymbol('isSubscribable', ko.isSubscribable);
|
||||
|
|
|
|||
35
vendors/knockout/src/tasks.js
vendored
35
vendors/knockout/src/tasks.js
vendored
|
|
@ -1,16 +1,15 @@
|
|||
ko.tasks = (function () {
|
||||
var scheduler,
|
||||
taskQueue = [],
|
||||
ko.tasks = (() => {
|
||||
var taskQueue = [],
|
||||
taskQueueLength = 0,
|
||||
nextHandle = 1,
|
||||
nextIndexToProcess = 0;
|
||||
nextIndexToProcess = 0,
|
||||
|
||||
// Chrome 27+, Firefox 14+, IE 11+, Opera 15+, Safari 6.1+
|
||||
// From https://github.com/petkaantonov/bluebird * Copyright (c) 2014 Petka Antonov * License: MIT
|
||||
scheduler = (function (callback) {
|
||||
scheduler = (callback => {
|
||||
var div = document.createElement("div");
|
||||
new MutationObserver(callback).observe(div, {attributes: true});
|
||||
return function () { div.classList.toggle("foo"); };
|
||||
return () => div.classList.toggle("foo");
|
||||
})(scheduledProcess);
|
||||
|
||||
function processTasks() {
|
||||
|
|
@ -47,37 +46,22 @@ ko.tasks = (function () {
|
|||
nextIndexToProcess = taskQueueLength = taskQueue.length = 0;
|
||||
}
|
||||
|
||||
function scheduleTaskProcessing() {
|
||||
ko.tasks['scheduler'](scheduledProcess);
|
||||
}
|
||||
|
||||
var tasks = {
|
||||
'scheduler': scheduler, // Allow overriding the scheduler
|
||||
|
||||
schedule: function (func) {
|
||||
schedule: func => {
|
||||
if (!taskQueueLength) {
|
||||
scheduleTaskProcessing();
|
||||
scheduler(scheduledProcess);
|
||||
}
|
||||
|
||||
taskQueue[taskQueueLength++] = func;
|
||||
return nextHandle++;
|
||||
},
|
||||
|
||||
cancel: function (handle) {
|
||||
cancel: handle => {
|
||||
var index = handle - (nextHandle - taskQueueLength);
|
||||
if (index >= nextIndexToProcess && index < taskQueueLength) {
|
||||
taskQueue[index] = null;
|
||||
}
|
||||
},
|
||||
|
||||
// For testing only: reset the queue and return the previous queue length
|
||||
'resetForTesting': function () {
|
||||
var length = taskQueueLength - nextIndexToProcess;
|
||||
nextIndexToProcess = taskQueueLength = taskQueue.length = 0;
|
||||
return length;
|
||||
},
|
||||
|
||||
runEarly: processTasks
|
||||
}
|
||||
};
|
||||
|
||||
return tasks;
|
||||
|
|
@ -86,4 +70,3 @@ ko.tasks = (function () {
|
|||
ko.exportSymbol('tasks', ko.tasks);
|
||||
ko.exportSymbol('tasks.schedule', ko.tasks.schedule);
|
||||
//ko.exportSymbol('tasks.cancel', ko.tasks.cancel); "cancel" isn't minified
|
||||
ko.exportSymbol('tasks.runEarly', ko.tasks.runEarly);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ ko.nativeTemplateEngine = function () {
|
|||
|
||||
ko.nativeTemplateEngine.prototype = new ko.templateEngine();
|
||||
ko.nativeTemplateEngine.prototype.constructor = ko.nativeTemplateEngine;
|
||||
ko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options, templateDocument) {
|
||||
ko.nativeTemplateEngine.prototype['renderTemplateSource'] = (templateSource, bindingContext, options, templateDocument) => {
|
||||
var templateNodesFunc = templateSource.nodes,
|
||||
templateNodes = templateNodesFunc ? templateSource.nodes() : null;
|
||||
if (templateNodes) {
|
||||
|
|
|
|||
|
|
@ -27,15 +27,15 @@
|
|||
|
||||
ko.templateEngine = function () { };
|
||||
|
||||
ko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options, templateDocument) {
|
||||
ko.templateEngine.prototype['renderTemplateSource'] = (templateSource, bindingContext, options, templateDocument) => {
|
||||
throw new Error("Override renderTemplateSource");
|
||||
};
|
||||
|
||||
ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) {
|
||||
ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = script => {
|
||||
throw new Error("Override createJavaScriptEvaluatorBlock");
|
||||
};
|
||||
|
||||
ko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) {
|
||||
ko.templateEngine.prototype['makeTemplateSource'] = (template, templateDocument) => {
|
||||
// Named template
|
||||
if (typeof template == "string") {
|
||||
templateDocument = templateDocument || document;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
ko.templateRewriting = (function () {
|
||||
ko.templateRewriting = (() => {
|
||||
var memoizeDataBindingAttributeSyntaxRegex = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi;
|
||||
var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g;
|
||||
|
||||
|
|
@ -35,23 +35,23 @@ ko.templateRewriting = (function () {
|
|||
}
|
||||
|
||||
return {
|
||||
ensureTemplateIsRewritten: function (template, templateEngine, templateDocument) {
|
||||
ensureTemplateIsRewritten: (template, templateEngine, templateDocument) => {
|
||||
if (!templateEngine['isTemplateRewritten'](template, templateDocument))
|
||||
templateEngine['rewriteTemplate'](template, function (htmlString) {
|
||||
return ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine);
|
||||
}, templateDocument);
|
||||
templateEngine['rewriteTemplate'](template, htmlString =>
|
||||
ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine)
|
||||
, templateDocument);
|
||||
},
|
||||
|
||||
memoizeBindingAttributeSyntax: function (htmlString, templateEngine) {
|
||||
return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, function () {
|
||||
return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[4], /* tagToRetain: */ arguments[1], /* nodeName: */ arguments[2], templateEngine);
|
||||
}).replace(memoizeVirtualContainerBindingSyntaxRegex, function() {
|
||||
return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[1], /* tagToRetain: */ "<!-- ko -->", /* nodeName: */ "#comment", templateEngine);
|
||||
});
|
||||
memoizeBindingAttributeSyntax: (htmlString, templateEngine) => {
|
||||
return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, (...args) =>
|
||||
constructMemoizedTagReplacement(/* dataBindAttributeValue: */ args[4], /* tagToRetain: */ args[1], /* nodeName: */ args[2], templateEngine)
|
||||
).replace(memoizeVirtualContainerBindingSyntaxRegex, (...args) =>
|
||||
constructMemoizedTagReplacement(/* dataBindAttributeValue: */ args[1], /* tagToRetain: */ "<!-- ko -->", /* nodeName: */ "#comment", templateEngine)
|
||||
);
|
||||
},
|
||||
|
||||
applyMemoizedBindingsToNextSibling: function (bindings, nodeName) {
|
||||
return ko.memoization.memoize(function (domNode, bindingContext) {
|
||||
applyMemoizedBindingsToNextSibling: (bindings, nodeName) => {
|
||||
return ko.memoization.memoize((domNode, bindingContext) => {
|
||||
var nodeToBind = domNode.nextSibling;
|
||||
if (nodeToBind && nodeToBind.nodeName.toLowerCase() === nodeName) {
|
||||
ko.applyBindingAccessorsToNode(nodeToBind, bindings, bindingContext);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(() => {
|
||||
// A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving
|
||||
// logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)
|
||||
//
|
||||
|
|
@ -54,22 +54,20 @@
|
|||
|
||||
if (arguments.length == 0) {
|
||||
return this.domElement[elemContentsProperty];
|
||||
} else {
|
||||
}
|
||||
var valueToWrite = arguments[0];
|
||||
if (elemContentsProperty === "innerHTML")
|
||||
ko.utils.setHtml(this.domElement, valueToWrite);
|
||||
else
|
||||
this.domElement[elemContentsProperty] = valueToWrite;
|
||||
}
|
||||
};
|
||||
|
||||
var dataDomDataPrefix = ko.utils.domData.nextKey() + "_";
|
||||
ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {
|
||||
if (arguments.length === 1) {
|
||||
return ko.utils.domData.get(this.domElement, dataDomDataPrefix + key);
|
||||
} else {
|
||||
ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
|
||||
}
|
||||
ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
|
||||
};
|
||||
|
||||
var templatesDomDataKey = ko.utils.domData.nextKey();
|
||||
|
|
@ -99,13 +97,12 @@
|
|||
}
|
||||
}
|
||||
return nodes;
|
||||
} else {
|
||||
}
|
||||
var valueToWrite = arguments[0];
|
||||
if (this.templateType !== undefined) {
|
||||
this['text'](""); // clear the text from the node
|
||||
}
|
||||
setTemplateDomData(element, {containerData: valueToWrite});
|
||||
}
|
||||
};
|
||||
|
||||
// ---- ko.templateSources.anonymousTemplate -----
|
||||
|
|
@ -115,7 +112,7 @@
|
|||
|
||||
ko.templateSources.anonymousTemplate = function(element) {
|
||||
this.domElement = element;
|
||||
}
|
||||
};
|
||||
ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();
|
||||
ko.templateSources.anonymousTemplate.prototype.constructor = ko.templateSources.anonymousTemplate;
|
||||
ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {
|
||||
|
|
@ -124,10 +121,9 @@
|
|||
if (templateData.textData === undefined && templateData.containerData)
|
||||
templateData.textData = templateData.containerData.innerHTML;
|
||||
return templateData.textData;
|
||||
} else {
|
||||
}
|
||||
var valueToWrite = arguments[0];
|
||||
setTemplateDomData(this.domElement, {textData: valueToWrite});
|
||||
}
|
||||
};
|
||||
|
||||
ko.exportSymbol('templateSources', ko.templateSources);
|
||||
|
|
|
|||
52
vendors/knockout/src/templating/templating.js
vendored
52
vendors/knockout/src/templating/templating.js
vendored
|
|
@ -1,10 +1,10 @@
|
|||
(function () {
|
||||
var _templateEngine;
|
||||
ko.setTemplateEngine = function (templateEngine) {
|
||||
ko.setTemplateEngine = templateEngine => {
|
||||
if ((templateEngine != undefined) && !(templateEngine instanceof ko.templateEngine))
|
||||
throw new Error("templateEngine must inherit from ko.templateEngine");
|
||||
_templateEngine = templateEngine;
|
||||
}
|
||||
};
|
||||
|
||||
function invokeForEachNodeInContinuousRange(firstNode, lastNode, action) {
|
||||
var node, nextInQueue = firstNode, firstOutOfRangeNode = ko.virtualElements.nextSibling(lastNode);
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
preprocessNode = provider['preprocessNode'];
|
||||
|
||||
if (preprocessNode) {
|
||||
invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node, nextNodeInRange) {
|
||||
invokeForEachNodeInContinuousRange(firstNode, lastNode, (node, nextNodeInRange) => {
|
||||
var nodePreviousSibling = node.previousSibling;
|
||||
var newNodes = preprocessNode.call(provider, node);
|
||||
if (newNodes) {
|
||||
|
|
@ -57,11 +57,11 @@
|
|||
|
||||
// Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
|
||||
// whereas a regular applyBindings won't introduce new memoized nodes
|
||||
invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) {
|
||||
invokeForEachNodeInContinuousRange(firstNode, lastNode, node => {
|
||||
if (node.nodeType === 1 || node.nodeType === 8)
|
||||
ko.applyBindings(bindingContext, node);
|
||||
});
|
||||
invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) {
|
||||
invokeForEachNodeInContinuousRange(firstNode, lastNode, node => {
|
||||
if (node.nodeType === 1 || node.nodeType === 8)
|
||||
ko.memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]);
|
||||
});
|
||||
|
|
@ -122,13 +122,9 @@
|
|||
if (ko.isObservable(template)) {
|
||||
// 1. An observable, with string value
|
||||
return template();
|
||||
} else if (typeof template === 'function') {
|
||||
// 2. A function of (data, context) returning a string
|
||||
return template(data, context);
|
||||
} else {
|
||||
// 3. A string
|
||||
return template;
|
||||
}
|
||||
// 2. A function of (data, context) returning a string ELSE 3. A string
|
||||
return (typeof template === 'function') ? template(data, context) : template;
|
||||
}
|
||||
|
||||
ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {
|
||||
|
|
@ -140,11 +136,11 @@
|
|||
if (targetNodeOrNodeArray) {
|
||||
var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
|
||||
|
||||
var whenToDispose = function () { return (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation)
|
||||
var whenToDispose = () => (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); // Passive disposal (on next evaluation)
|
||||
var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == "replaceNode") ? firstTargetNode.parentNode : firstTargetNode;
|
||||
|
||||
return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes
|
||||
function () {
|
||||
() => {
|
||||
// Ensure we've got a proper binding context to work with
|
||||
var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))
|
||||
? dataOrBindingContext
|
||||
|
|
@ -163,24 +159,24 @@
|
|||
);
|
||||
} else {
|
||||
// We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node
|
||||
return ko.memoization.memoize(function (domNode) {
|
||||
ko.renderTemplate(template, dataOrBindingContext, options, domNode, "replaceNode");
|
||||
});
|
||||
return ko.memoization.memoize(domNode =>
|
||||
ko.renderTemplate(template, dataOrBindingContext, options, domNode, "replaceNode")
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) {
|
||||
ko.renderTemplateForEach = (template, arrayOrObservableArray, options, targetNode, parentBindingContext) => {
|
||||
// Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then
|
||||
// activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.
|
||||
var arrayItemContext, asName = options['as'];
|
||||
|
||||
// This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode
|
||||
var executeTemplateForArrayItem = function (arrayValue, index) {
|
||||
var executeTemplateForArrayItem = (arrayValue, index) => {
|
||||
// Support selecting template as a function of the data being rendered
|
||||
arrayItemContext = parentBindingContext['createChildContext'](arrayValue, {
|
||||
'as': asName,
|
||||
'noChildContext': options['noChildContext'],
|
||||
'extend': function(context) {
|
||||
'extend': context => {
|
||||
context['$index'] = index;
|
||||
if (asName) {
|
||||
context[asName + "Index"] = index;
|
||||
|
|
@ -193,7 +189,7 @@
|
|||
};
|
||||
|
||||
// This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode
|
||||
var activateBindingsCallback = function(arrayValue, addedNodesArray, index) {
|
||||
var activateBindingsCallback = (arrayValue, addedNodesArray) => {
|
||||
activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext);
|
||||
if (options['afterRender'])
|
||||
options['afterRender'](addedNodesArray, arrayValue);
|
||||
|
|
@ -215,21 +211,21 @@
|
|||
if (!shouldHideDestroyed && !options['beforeRemove'] && ko.isObservableArray(arrayOrObservableArray)) {
|
||||
setDomNodeChildrenFromArrayMapping(arrayOrObservableArray.peek());
|
||||
|
||||
var subscription = arrayOrObservableArray.subscribe(function (changeList) {
|
||||
var subscription = arrayOrObservableArray.subscribe(changeList => {
|
||||
setDomNodeChildrenFromArrayMapping(arrayOrObservableArray(), changeList);
|
||||
}, null, "arrayChange");
|
||||
subscription.disposeWhenNodeIsRemoved(targetNode);
|
||||
|
||||
return subscription;
|
||||
} else {
|
||||
return ko.dependentObservable(function () {
|
||||
return ko.dependentObservable(() => {
|
||||
var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || [];
|
||||
if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
|
||||
unwrappedArray = [unwrappedArray];
|
||||
|
||||
if (shouldHideDestroyed) {
|
||||
// Filter out any entries marked as destroyed
|
||||
unwrappedArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
|
||||
unwrappedArray = ko.utils.arrayFilter(unwrappedArray, item => {
|
||||
return item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
|
||||
});
|
||||
}
|
||||
|
|
@ -249,7 +245,7 @@
|
|||
|
||||
var cleanContainerDomDataKey = ko.utils.domData.nextKey();
|
||||
ko.bindingHandlers['template'] = {
|
||||
'init': function(element, valueAccessor) {
|
||||
'init': (element, valueAccessor) => {
|
||||
// Support anonymous templates
|
||||
var bindingValue = ko.utils.unwrapObservable(valueAccessor());
|
||||
if (typeof bindingValue == "string" || 'name' in bindingValue) {
|
||||
|
|
@ -267,7 +263,7 @@
|
|||
|
||||
// If the nodes are already attached to a KO-generated container, we reuse that container without moving the
|
||||
// elements to a new one (we check only the first node, as the nodes are always moved together)
|
||||
var container = nodes[0] && nodes[0].parentNode;
|
||||
let container = nodes[0] && nodes[0].parentNode;
|
||||
if (!container || !ko.utils.domData.get(container, cleanContainerDomDataKey)) {
|
||||
container = ko.utils.moveCleanedNodesToContainerElement(nodes);
|
||||
ko.utils.domData.set(container, cleanContainerDomDataKey, true);
|
||||
|
|
@ -278,7 +274,7 @@
|
|||
// It's an anonymous template - store the element contents, then clear the element
|
||||
var templateNodes = ko.virtualElements.childNodes(element);
|
||||
if (templateNodes.length > 0) {
|
||||
var container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
|
||||
let container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
|
||||
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
|
||||
} else {
|
||||
throw new Error("Anonymous template defined, but no template content was provided");
|
||||
|
|
@ -286,7 +282,7 @@
|
|||
}
|
||||
return { 'controlsDescendantBindings': true };
|
||||
},
|
||||
'update': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
'update': (element, valueAccessor, allBindings, viewModel, bindingContext) => {
|
||||
var value = valueAccessor(),
|
||||
options = ko.utils.unwrapObservable(value),
|
||||
shouldDisplay = true,
|
||||
|
|
@ -336,7 +332,7 @@
|
|||
};
|
||||
|
||||
// Anonymous templates can't be rewritten. Give a nice error message if you try to do it.
|
||||
ko.expressionRewriting.bindingRewriteValidators['template'] = function(bindingValue) {
|
||||
ko.expressionRewriting.bindingRewriteValidators['template'] = bindingValue => {
|
||||
var parsedBindingValue = ko.expressionRewriting.parseObjectLiteral(bindingValue);
|
||||
|
||||
if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown'])
|
||||
|
|
|
|||
18
vendors/knockout/src/utils.domData.js
vendored
18
vendors/knockout/src/utils.domData.js
vendored
|
|
@ -3,18 +3,18 @@ ko.utils.domData = new (function () {
|
|||
var uniqueId = 0;
|
||||
var dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now());
|
||||
|
||||
var getDataForNode, clear;
|
||||
var
|
||||
// We considered using WeakMap, but it has a problem in IE 11 and Edge that prevents using
|
||||
// it cross-window, so instead we just store the data directly on the node.
|
||||
// See https://github.com/knockout/knockout/issues/2141
|
||||
getDataForNode = function (node, createIfNotFound) {
|
||||
getDataForNode = (node, createIfNotFound) => {
|
||||
var dataForNode = node[dataStoreKeyExpandoPropertyName];
|
||||
if (!dataForNode && createIfNotFound) {
|
||||
dataForNode = node[dataStoreKeyExpandoPropertyName] = {};
|
||||
}
|
||||
return dataForNode;
|
||||
};
|
||||
clear = function (node) {
|
||||
},
|
||||
clear = node => {
|
||||
if (node[dataStoreKeyExpandoPropertyName]) {
|
||||
delete node[dataStoreKeyExpandoPropertyName];
|
||||
return true; // Exposing "did clean" flag purely so specs can infer whether things have been cleaned up as intended
|
||||
|
|
@ -23,24 +23,22 @@ ko.utils.domData = new (function () {
|
|||
};
|
||||
|
||||
return {
|
||||
get: function (node, key) {
|
||||
get: (node, key) => {
|
||||
var dataForNode = getDataForNode(node, false);
|
||||
return dataForNode && dataForNode[key];
|
||||
},
|
||||
set: function (node, key, value) {
|
||||
set: (node, key, value) => {
|
||||
// Make sure we don't actually create a new domData key if we are actually deleting a value
|
||||
var dataForNode = getDataForNode(node, value !== undefined /* createIfNotFound */);
|
||||
dataForNode && (dataForNode[key] = value);
|
||||
},
|
||||
getOrSet: function (node, key, value) {
|
||||
getOrSet: (node, key, value) => {
|
||||
var dataForNode = getDataForNode(node, true /* createIfNotFound */);
|
||||
return dataForNode[key] || (dataForNode[key] = value);
|
||||
},
|
||||
clear: clear,
|
||||
|
||||
nextKey: function () {
|
||||
return (uniqueId++) + dataStoreKeyExpandoPropertyName;
|
||||
}
|
||||
nextKey: () => (uniqueId++) + dataStoreKeyExpandoPropertyName
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
11
vendors/knockout/src/utils.domManipulation.js
vendored
11
vendors/knockout/src/utils.domManipulation.js
vendored
|
|
@ -1,4 +1,4 @@
|
|||
(function () {
|
||||
(() => {
|
||||
var none = [0, "", ""],
|
||||
table = [1, "<table>", "</table>"],
|
||||
tbody = [2, "<table><tbody>", "</tbody></table>"],
|
||||
|
|
@ -50,16 +50,15 @@
|
|||
return ko.utils.makeArray(div.lastChild.childNodes);
|
||||
}
|
||||
|
||||
ko.utils.parseHtmlFragment = function(html, documentContext) {
|
||||
return simpleHtmlParse(html, documentContext); // ... otherwise, this simple logic will do in most common cases.
|
||||
};
|
||||
ko.utils.parseHtmlFragment = (html, documentContext) =>
|
||||
simpleHtmlParse(html, documentContext); // ... otherwise, this simple logic will do in most common cases.
|
||||
|
||||
ko.utils.parseHtmlForTemplateNodes = function(html, documentContext) {
|
||||
ko.utils.parseHtmlForTemplateNodes = (html, documentContext) => {
|
||||
var nodes = ko.utils.parseHtmlFragment(html, documentContext);
|
||||
return (nodes.length && nodes[0].parentElement) || ko.utils.moveCleanedNodesToContainerElement(nodes);
|
||||
};
|
||||
|
||||
ko.utils.setHtml = function(node, html) {
|
||||
ko.utils.setHtml = (node, html) => {
|
||||
ko.utils.emptyDomNode(node);
|
||||
|
||||
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
|
||||
|
|
|
|||
12
vendors/knockout/src/utils.domNodeDisposal.js
vendored
12
vendors/knockout/src/utils.domNodeDisposal.js
vendored
|
|
@ -41,20 +41,20 @@ ko.utils.domNodeDisposal = new (function () {
|
|||
if (!onlyComments || nodeList[i].nodeType === 8) {
|
||||
cleanSingleNode(cleanedNodes[cleanedNodes.length] = lastCleanedNode = nodeList[i]);
|
||||
if (nodeList[i] !== lastCleanedNode) {
|
||||
while (i-- && ko.utils.arrayIndexOf(cleanedNodes, nodeList[i]) == -1) {}
|
||||
while (i-- && ko.utils.arrayIndexOf(cleanedNodes, nodeList[i]) == -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
addDisposeCallback : function(node, callback) {
|
||||
addDisposeCallback : (node, callback) => {
|
||||
if (typeof callback != "function")
|
||||
throw new Error("Callback must be a function");
|
||||
getDisposeCallbacksCollection(node, true).push(callback);
|
||||
},
|
||||
|
||||
removeDisposeCallback : function(node, callback) {
|
||||
removeDisposeCallback : (node, callback) => {
|
||||
var callbacksCollection = getDisposeCallbacksCollection(node, false);
|
||||
if (callbacksCollection) {
|
||||
ko.utils.arrayRemoveItem(callbacksCollection, callback);
|
||||
|
|
@ -63,8 +63,8 @@ ko.utils.domNodeDisposal = new (function () {
|
|||
}
|
||||
},
|
||||
|
||||
cleanNode : function(node) {
|
||||
ko.dependencyDetection.ignore(function () {
|
||||
cleanNode : node => {
|
||||
ko.dependencyDetection.ignore(() => {
|
||||
// First clean this node, where applicable
|
||||
if (cleanableNodeTypes[node.nodeType]) {
|
||||
cleanSingleNode(node);
|
||||
|
|
@ -79,7 +79,7 @@ ko.utils.domNodeDisposal = new (function () {
|
|||
return node;
|
||||
},
|
||||
|
||||
removeNode : function(node) {
|
||||
removeNode : node => {
|
||||
ko.cleanNode(node);
|
||||
if (node.parentNode)
|
||||
node.parentNode.removeChild(node);
|
||||
|
|
|
|||
129
vendors/knockout/src/utils.js
vendored
129
vendors/knockout/src/utils.js
vendored
|
|
@ -1,20 +1,16 @@
|
|||
ko.utils = (function () {
|
||||
ko.utils = (() => {
|
||||
|
||||
function arrayCall(name, arr, p1, p2) {
|
||||
return Array.prototype[name].call(arr, p1, p2);
|
||||
}
|
||||
|
||||
function objectForEach(obj, action) {
|
||||
obj && Object.entries(obj).forEach(function(prop) {
|
||||
action(prop[0], prop[1]);
|
||||
});
|
||||
obj && Object.entries(obj).forEach(prop => action(prop[0], prop[1]));
|
||||
}
|
||||
|
||||
function extend(target, source) {
|
||||
if (source) {
|
||||
Object.entries(source).forEach(function(prop) {
|
||||
target[prop[0]] = prop[1];
|
||||
});
|
||||
Object.entries(source).forEach(prop => target[prop[0]] = prop[1]);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
|
@ -31,22 +27,20 @@ ko.utils = (function () {
|
|||
function toggleDomNodeCssClass(node, classNames, shouldHaveClass) {
|
||||
if (classNames) {
|
||||
var addOrRemoveFn = shouldHaveClass ? 'add' : 'remove';
|
||||
classNames.split(/\s+/).forEach(function(className) {
|
||||
node.classList[addOrRemoveFn](className);
|
||||
});
|
||||
classNames.split(/\s+/).forEach(className =>
|
||||
node.classList[addOrRemoveFn](className)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
arrayForEach: function (array, action, actionOwner) {
|
||||
arrayCall('forEach', array, action, actionOwner);
|
||||
},
|
||||
arrayForEach: (array, action, actionOwner) =>
|
||||
arrayCall('forEach', array, action, actionOwner),
|
||||
|
||||
arrayIndexOf: function (array, item) {
|
||||
return arrayCall('indexOf', array, item);
|
||||
},
|
||||
arrayIndexOf: (array, item) =>
|
||||
arrayCall('indexOf', array, item),
|
||||
|
||||
arrayFirst: function (array, predicate, predicateOwner) {
|
||||
arrayFirst: (array, predicate, predicateOwner) => {
|
||||
for (var i = 0, j = array.length; i < j; i++) {
|
||||
if (predicate.call(predicateOwner, array[i], i, array))
|
||||
return array[i];
|
||||
|
|
@ -54,7 +48,7 @@ ko.utils = (function () {
|
|||
return undefined;
|
||||
},
|
||||
|
||||
arrayRemoveItem: function (array, itemToRemove) {
|
||||
arrayRemoveItem: (array, itemToRemove) => {
|
||||
var index = ko.utils.arrayIndexOf(array, itemToRemove);
|
||||
if (index > 0) {
|
||||
array.splice(index, 1);
|
||||
|
|
@ -64,11 +58,10 @@ ko.utils = (function () {
|
|||
}
|
||||
},
|
||||
|
||||
arrayFilter: function (array, predicate, predicateOwner) {
|
||||
return array ? arrayCall('filter', array, predicate, predicateOwner) : [];
|
||||
},
|
||||
arrayFilter: (array, predicate, predicateOwner) =>
|
||||
array ? arrayCall('filter', array, predicate, predicateOwner) : [],
|
||||
|
||||
arrayPushAll: function (array, valuesToPush) {
|
||||
arrayPushAll: (array, valuesToPush) => {
|
||||
if (valuesToPush instanceof Array)
|
||||
array.push.apply(array, valuesToPush);
|
||||
else
|
||||
|
|
@ -87,48 +80,45 @@ ko.utils = (function () {
|
|||
|
||||
objectForEach: objectForEach,
|
||||
|
||||
objectMap: function(source, mapping, mappingOwner) {
|
||||
objectMap: (source, mapping, mappingOwner) => {
|
||||
if (!source)
|
||||
return source;
|
||||
var target = {};
|
||||
Object.entries(source).forEach(function(prop) {
|
||||
target[prop[0]] = mapping.call(mappingOwner, prop[1], prop[0], source);
|
||||
});
|
||||
Object.entries(source).forEach(prop =>
|
||||
target[prop[0]] = mapping.call(mappingOwner, prop[1], prop[0], source)
|
||||
);
|
||||
return target;
|
||||
},
|
||||
|
||||
emptyDomNode: function (domNode) {
|
||||
emptyDomNode: domNode => {
|
||||
while (domNode.firstChild) {
|
||||
ko.removeNode(domNode.firstChild);
|
||||
}
|
||||
},
|
||||
|
||||
moveCleanedNodesToContainerElement: function(nodes) {
|
||||
moveCleanedNodesToContainerElement: nodes => {
|
||||
// Ensure it's a real array, as we're about to reparent the nodes and
|
||||
// we don't want the underlying collection to change while we're doing that.
|
||||
var nodesArray = ko.utils.makeArray(nodes);
|
||||
var templateDocument = (nodesArray[0] && nodesArray[0].ownerDocument) || document;
|
||||
|
||||
var container = templateDocument.createElement('div');
|
||||
nodes.forEach(function(node){container.append(ko.cleanNode(node));});
|
||||
nodes.forEach(node => container.append(ko.cleanNode(node)));
|
||||
return container;
|
||||
},
|
||||
|
||||
cloneNodes: function (nodesArray, shouldCleanNodes) {
|
||||
return arrayCall('map', nodesArray, shouldCleanNodes
|
||||
? function(node){return ko.cleanNode(node.cloneNode(true));}
|
||||
: function(node){return node.cloneNode(true);}
|
||||
);
|
||||
},
|
||||
cloneNodes: (nodesArray, shouldCleanNodes) =>
|
||||
arrayCall('map', nodesArray, shouldCleanNodes
|
||||
? node => ko.cleanNode(node.cloneNode(true))
|
||||
: node => node.cloneNode(true)
|
||||
),
|
||||
|
||||
setDomNodeChildren: function (domNode, childNodes) {
|
||||
setDomNodeChildren: (domNode, childNodes) => {
|
||||
ko.utils.emptyDomNode(domNode);
|
||||
if (childNodes) {
|
||||
domNode.append.apply(domNode, childNodes);
|
||||
}
|
||||
childNodes && domNode.append.apply(domNode, childNodes);
|
||||
},
|
||||
|
||||
replaceDomNodes: function (nodeToReplaceOrNodeArray, newNodesArray) {
|
||||
replaceDomNodes: (nodeToReplaceOrNodeArray, newNodesArray) => {
|
||||
var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType
|
||||
? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray;
|
||||
if (nodesToReplaceArray.length > 0) {
|
||||
|
|
@ -143,7 +133,7 @@ ko.utils = (function () {
|
|||
}
|
||||
},
|
||||
|
||||
fixUpContinuousNodeArray: function(continuousNodeArray, parentNode) {
|
||||
fixUpContinuousNodeArray: (continuousNodeArray, parentNode) => {
|
||||
// Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile
|
||||
// them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that
|
||||
// new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been
|
||||
|
|
@ -188,40 +178,31 @@ ko.utils = (function () {
|
|||
return continuousNodeArray;
|
||||
},
|
||||
|
||||
stringTrim: function (string) {
|
||||
return string === null || string === undefined ? '' :
|
||||
stringTrim: string => string === null || string === undefined ? '' :
|
||||
string.trim ?
|
||||
string.trim() :
|
||||
string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
|
||||
},
|
||||
string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, ''),
|
||||
|
||||
stringStartsWith: function (string, startsWith) {
|
||||
stringStartsWith: (string, startsWith) => {
|
||||
string = string || "";
|
||||
if (startsWith.length > string.length)
|
||||
return false;
|
||||
return string.substring(0, startsWith.length) === startsWith;
|
||||
},
|
||||
|
||||
domNodeIsContainedBy: function (node, containedByNode) {
|
||||
return containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node);
|
||||
},
|
||||
domNodeIsContainedBy: (node, containedByNode) =>
|
||||
containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node),
|
||||
|
||||
domNodeIsAttachedToDocument: function (node) {
|
||||
return ko.utils.domNodeIsContainedBy(node, node.ownerDocument.documentElement);
|
||||
},
|
||||
domNodeIsAttachedToDocument: node => ko.utils.domNodeIsContainedBy(node, node.ownerDocument.documentElement),
|
||||
|
||||
anyDomNodeIsAttachedToDocument: function(nodes) {
|
||||
return !!ko.utils.arrayFirst(nodes, ko.utils.domNodeIsAttachedToDocument);
|
||||
},
|
||||
anyDomNodeIsAttachedToDocument: nodes => !!ko.utils.arrayFirst(nodes, ko.utils.domNodeIsAttachedToDocument),
|
||||
|
||||
tagNameLower: function(element) {
|
||||
// For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.
|
||||
// Possible future optimization: If we know it's an element from an XHTML document (not HTML),
|
||||
// we don't need to do the .toLowerCase() as it will always be lower case anyway.
|
||||
return element && element.tagName && element.tagName.toLowerCase();
|
||||
},
|
||||
tagNameLower: element => element && element.tagName && element.tagName.toLowerCase(),
|
||||
|
||||
catchFunctionErrors: function (delegate) {
|
||||
catchFunctionErrors: delegate => {
|
||||
return ko['onError'] ? function () {
|
||||
try {
|
||||
return delegate.apply(this, arguments);
|
||||
|
|
@ -232,41 +213,33 @@ ko.utils = (function () {
|
|||
} : delegate;
|
||||
},
|
||||
|
||||
setTimeout: function (handler, timeout) {
|
||||
return setTimeout(ko.utils.catchFunctionErrors(handler), timeout);
|
||||
},
|
||||
setTimeout: (handler, timeout) => setTimeout(ko.utils.catchFunctionErrors(handler), timeout),
|
||||
|
||||
deferError: function (error) {
|
||||
setTimeout(function () {
|
||||
deferError: error => setTimeout(() => {
|
||||
ko['onError'] && ko['onError'](error);
|
||||
throw error;
|
||||
}, 0);
|
||||
},
|
||||
}, 0),
|
||||
|
||||
registerEventHandler: function (element, eventType, handler) {
|
||||
registerEventHandler: (element, eventType, handler) => {
|
||||
var wrappedHandler = ko.utils.catchFunctionErrors(handler);
|
||||
|
||||
element.addEventListener(eventType, wrappedHandler, false);
|
||||
},
|
||||
|
||||
triggerEvent: function (element, eventType) {
|
||||
triggerEvent: (element, eventType) => {
|
||||
if (!(element && element.nodeType))
|
||||
throw new Error("element must be a DOM node when calling triggerEvent");
|
||||
|
||||
element.dispatchEvent(new Event(eventType));
|
||||
},
|
||||
|
||||
unwrapObservable: function (value) {
|
||||
return ko.isObservable(value) ? value() : value;
|
||||
},
|
||||
unwrapObservable: value => ko.isObservable(value) ? value() : value,
|
||||
|
||||
peekObservable: function (value) {
|
||||
return ko.isObservable(value) ? value.peek() : value;
|
||||
},
|
||||
peekObservable: value => ko.isObservable(value) ? value.peek() : value,
|
||||
|
||||
toggleDomNodeCssClass: toggleDomNodeCssClass,
|
||||
|
||||
setTextContent: function(element, textContent) {
|
||||
setTextContent: (element, textContent) => {
|
||||
var value = ko.utils.unwrapObservable(textContent);
|
||||
if ((value === null) || (value === undefined))
|
||||
value = "";
|
||||
|
|
@ -282,11 +255,9 @@ ko.utils = (function () {
|
|||
}
|
||||
},
|
||||
|
||||
makeArray: function(arrayLikeObject) {
|
||||
return Array['from'](arrayLikeObject);
|
||||
makeArray: arrayLikeObject => Array['from'](arrayLikeObject)
|
||||
}
|
||||
}
|
||||
}());
|
||||
})();
|
||||
|
||||
ko.exportSymbol('utils', ko.utils);
|
||||
ko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach);
|
||||
|
|
|
|||
31
vendors/knockout/src/virtualElements.js
vendored
31
vendors/knockout/src/virtualElements.js
vendored
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(() => {
|
||||
// "Virtual elements" is an abstraction on top of the usual DOM API which understands the notion that comment nodes
|
||||
// may be used to represent hierarchy (in addition to the DOM's natural hierarchy).
|
||||
// If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state
|
||||
|
|
@ -52,18 +52,16 @@
|
|||
if (allVirtualChildren.length > 0)
|
||||
return allVirtualChildren[allVirtualChildren.length - 1].nextSibling;
|
||||
return startComment.nextSibling;
|
||||
} else
|
||||
}
|
||||
return null; // Must have no matching end comment, and allowUnbalanced is true
|
||||
}
|
||||
|
||||
ko.virtualElements = {
|
||||
allowedBindings: {},
|
||||
|
||||
childNodes: function(node) {
|
||||
return isStartComment(node) ? getVirtualChildren(node) : node.childNodes;
|
||||
},
|
||||
childNodes: node => isStartComment(node) ? getVirtualChildren(node) : node.childNodes,
|
||||
|
||||
emptyNode: function(node) {
|
||||
emptyNode: node => {
|
||||
if (!isStartComment(node))
|
||||
ko.utils.emptyDomNode(node);
|
||||
else {
|
||||
|
|
@ -73,7 +71,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
setDomNodeChildren: function(node, childNodes) {
|
||||
setDomNodeChildren: (node, childNodes) => {
|
||||
if (!isStartComment(node))
|
||||
ko.utils.setDomNodeChildren(node, childNodes);
|
||||
else {
|
||||
|
|
@ -84,7 +82,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
prepend: function(containerNode, nodeToPrepend) {
|
||||
prepend: (containerNode, nodeToPrepend) => {
|
||||
var insertBeforeNode;
|
||||
|
||||
if (isStartComment(containerNode)) {
|
||||
|
|
@ -98,7 +96,7 @@
|
|||
containerNode.insertBefore(nodeToPrepend, insertBeforeNode);
|
||||
},
|
||||
|
||||
insertAfter: function(containerNode, nodeToInsert, insertAfterNode) {
|
||||
insertAfter: (containerNode, nodeToInsert, insertAfterNode) => {
|
||||
if (!insertAfterNode) {
|
||||
ko.virtualElements.prepend(containerNode, nodeToInsert);
|
||||
} else {
|
||||
|
|
@ -113,20 +111,17 @@
|
|||
}
|
||||
},
|
||||
|
||||
firstChild: function(node) {
|
||||
firstChild: node => {
|
||||
if (!isStartComment(node)) {
|
||||
if (node.firstChild && isEndComment(node.firstChild)) {
|
||||
throw new Error("Found invalid end comment, as the first child of " + node);
|
||||
}
|
||||
return node.firstChild;
|
||||
} else if (!node.nextSibling || isEndComment(node.nextSibling)) {
|
||||
return null;
|
||||
} else {
|
||||
return node.nextSibling;
|
||||
}
|
||||
return (!node.nextSibling || isEndComment(node.nextSibling)) ? null : node.nextSibling;
|
||||
},
|
||||
|
||||
nextSibling: function(node) {
|
||||
nextSibling: node => {
|
||||
if (isStartComment(node)) {
|
||||
node = getMatchingEndComment(node);
|
||||
}
|
||||
|
|
@ -134,17 +129,15 @@
|
|||
if (node.nextSibling && isEndComment(node.nextSibling)) {
|
||||
if (isUnmatchedEndComment(node.nextSibling)) {
|
||||
throw Error("Found end comment without a matching opening comment, as child of " + node);
|
||||
} else {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return node.nextSibling;
|
||||
}
|
||||
},
|
||||
|
||||
hasBindingValue: isStartComment,
|
||||
|
||||
virtualNodeBindingValue: function(node) {
|
||||
virtualNodeBindingValue: node => {
|
||||
var regexMatch = (node.nodeValue).match(startCommentRegex);
|
||||
return regexMatch ? regexMatch[1] : null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue