mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 06:58:27 +03:00
Speedup KnockoutJS by simplifying components loader system.
Custom loaders are not used, so it is removed
This commit is contained in:
parent
4142526ba6
commit
bcc3dc51ef
5 changed files with 286 additions and 620 deletions
|
|
@ -23,7 +23,7 @@ knockoutDebugCallback([
|
|||
'src/binding/bindingProvider.js',
|
||||
'src/binding/bindingAttributeSyntax.js',
|
||||
'src/components/loaderRegistry.js',
|
||||
'src/components/defaultLoader.js',
|
||||
// 'src/components/defaultLoader.js',
|
||||
// 'src/components/customElements.js',
|
||||
'src/components/componentBinding.js',
|
||||
'src/binding/defaultBindings/attr.js',
|
||||
|
|
|
|||
|
|
@ -2320,145 +2320,64 @@ ko.expressionRewriting = (() => {
|
|||
ko.exportSymbol('dataFor', ko.dataFor);
|
||||
})();
|
||||
(() => {
|
||||
var loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight
|
||||
loadedDefinitionsCache = {}; // Tracks component loads that have already completed
|
||||
var loadingSubscribablesCache = Object.create(null), // Tracks component loads that are currently in flight
|
||||
loadedDefinitionsCache = Object.create(null); // Tracks component loads that have already completed
|
||||
|
||||
ko.components = {
|
||||
get: (componentName, callback) => {
|
||||
var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName);
|
||||
var cachedDefinition = 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(() => // See comment in loaderRegistryBehaviors.js for reasoning
|
||||
callback(cachedDefinition.definition)
|
||||
);
|
||||
} else {
|
||||
ko.tasks.schedule(() => callback(cachedDefinition.definition) );
|
||||
}
|
||||
ko.tasks.schedule(() => callback(cachedDefinition.definition) );
|
||||
} else {
|
||||
// Join the loading process that is already underway, or start a new one.
|
||||
loadComponentAndNotify(componentName, callback);
|
||||
var subscribable = loadingSubscribablesCache[componentName],
|
||||
completedAsync;
|
||||
if (subscribable) {
|
||||
subscribable.subscribe(callback);
|
||||
} else {
|
||||
// It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.
|
||||
subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
|
||||
subscribable.subscribe(callback);
|
||||
|
||||
beginLoadingComponent(componentName, definition => {
|
||||
loadedDefinitionsCache[componentName] = { definition: definition };
|
||||
delete loadingSubscribablesCache[componentName];
|
||||
|
||||
// For API consistency, all loads complete asynchronously. However we want to avoid
|
||||
// adding an extra task schedule if it's unnecessary (i.e., the completion is already
|
||||
// async).
|
||||
//
|
||||
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
||||
// flag on your component configuration when you register it.
|
||||
if (completedAsync) {
|
||||
// Note that notifySubscribers ignores any dependencies read within the callback.
|
||||
// See comment in loaderRegistryBehaviors.js for reasoning
|
||||
subscribable['notifySubscribers'](definition);
|
||||
} else {
|
||||
ko.tasks.schedule(() => subscribable['notifySubscribers'](definition));
|
||||
}
|
||||
});
|
||||
completedAsync = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clearCachedDefinition: componentName =>
|
||||
delete loadedDefinitionsCache[componentName]
|
||||
,
|
||||
delete loadedDefinitionsCache[componentName],
|
||||
|
||||
_getFirstResultFromLoaders: getFirstResultFromLoaders
|
||||
register: (componentName, config) => {
|
||||
if (!config) {
|
||||
throw new Error('Invalid configuration for ' + componentName);
|
||||
}
|
||||
|
||||
if (defaultConfigRegistry[componentName]) {
|
||||
throw new Error('Component ' + componentName + ' is already registered');
|
||||
}
|
||||
|
||||
defaultConfigRegistry[componentName] = config;
|
||||
}
|
||||
};
|
||||
|
||||
function getObjectOwnProperty(obj, propName) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, propName) ? obj[propName] : undefined;
|
||||
}
|
||||
|
||||
function loadComponentAndNotify(componentName, callback) {
|
||||
var subscribable = getObjectOwnProperty(loadingSubscribablesCache, componentName),
|
||||
completedAsync;
|
||||
if (!subscribable) {
|
||||
// It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.
|
||||
subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
|
||||
subscribable.subscribe(callback);
|
||||
|
||||
beginLoadingComponent(componentName, (definition, config) => {
|
||||
var isSynchronousComponent = !!(config && config['synchronous']);
|
||||
loadedDefinitionsCache[componentName] = { definition: definition, isSynchronousComponent: isSynchronousComponent };
|
||||
delete loadingSubscribablesCache[componentName];
|
||||
|
||||
// For API consistency, all loads complete asynchronously. However we want to avoid
|
||||
// adding an extra task schedule if it's unnecessary (i.e., the completion is already
|
||||
// async).
|
||||
//
|
||||
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
||||
// flag on your component configuration when you register it.
|
||||
if (completedAsync || isSynchronousComponent) {
|
||||
// Note that notifySubscribers ignores any dependencies read within the callback.
|
||||
// See comment in loaderRegistryBehaviors.js for reasoning
|
||||
subscribable['notifySubscribers'](definition);
|
||||
} else {
|
||||
ko.tasks.schedule(() => subscribable['notifySubscribers'](definition));
|
||||
}
|
||||
});
|
||||
completedAsync = true;
|
||||
} else {
|
||||
subscribable.subscribe(callback);
|
||||
}
|
||||
}
|
||||
|
||||
function beginLoadingComponent(componentName, callback) {
|
||||
getFirstResultFromLoaders('getConfig', [componentName], config => {
|
||||
if (config) {
|
||||
// We have a config, so now load its definition
|
||||
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
|
||||
// process and this callback would not run. For this callback to run, all loaders must
|
||||
// have confirmed they don't know about this component.
|
||||
callback(null, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders) {
|
||||
// On the first call in the stack, start with the full set of loaders
|
||||
if (!candidateLoaders) {
|
||||
candidateLoaders = ko.components['loaders'].slice(0); // Use a copy, because we'll be mutating this array
|
||||
}
|
||||
|
||||
// Try the next candidate
|
||||
var currentCandidateLoader = candidateLoaders.shift();
|
||||
if (currentCandidateLoader) {
|
||||
var methodInstance = currentCandidateLoader[methodName];
|
||||
if (methodInstance) {
|
||||
var wasAborted = false,
|
||||
synchronousReturnValue = methodInstance.apply(currentCandidateLoader, argsExceptCallback.concat(function(result) {
|
||||
if (wasAborted) {
|
||||
callback(null);
|
||||
} else if (result !== null) {
|
||||
// This candidate returned a value. Use it.
|
||||
callback(result);
|
||||
} else {
|
||||
// Try the next candidate
|
||||
getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
|
||||
}
|
||||
}));
|
||||
|
||||
// Currently, loaders may not return anything synchronously. This leaves open the possibility
|
||||
// that we'll extend the API to support synchronous return values in the future. It won't be
|
||||
// a breaking change, because currently no loader is allowed to return anything except undefined.
|
||||
if (synchronousReturnValue !== undefined) {
|
||||
wasAborted = true;
|
||||
|
||||
// Method to suppress exceptions will remain undocumented. This is only to keep
|
||||
// KO's specs running tidily, since we can observe the loading got aborted without
|
||||
// having exceptions cluttering up the console too.
|
||||
if (!currentCandidateLoader['suppressLoaderExceptions']) {
|
||||
throw new Error('Component loaders must supply values by invoking the callback, not by returning values synchronously.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// This candidate doesn't have the relevant handler. Synchronously move on to the next one.
|
||||
getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
|
||||
}
|
||||
} else {
|
||||
// No candidates returned a value
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
// Reference the loaders via string name so it's possible for developers
|
||||
// to replace the whole array by assigning to ko.components.loaders
|
||||
ko.components['loaders'] = [];
|
||||
|
||||
ko.exportSymbol('components', ko.components);
|
||||
})();
|
||||
(() => {
|
||||
|
||||
// The default loader is responsible for two things:
|
||||
// 1. Maintaining the default in-memory registry of component configuration objects
|
||||
// (i.e., the thing you're writing to when you call ko.components.register(someName, ...))
|
||||
|
|
@ -2469,158 +2388,73 @@ ko.expressionRewriting = (() => {
|
|||
// 1. To supply configuration objects from some other source (e.g., conventions)
|
||||
// 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic.
|
||||
|
||||
var defaultConfigRegistry = {};
|
||||
|
||||
ko.components.register = (componentName, config) => {
|
||||
if (!config) {
|
||||
throw new Error('Invalid configuration for ' + componentName);
|
||||
}
|
||||
|
||||
if (ko.components.isRegistered(componentName)) {
|
||||
throw new Error('Component ' + componentName + ' is already registered');
|
||||
}
|
||||
|
||||
defaultConfigRegistry[componentName] = config;
|
||||
};
|
||||
|
||||
ko.components.isRegistered = componentName =>
|
||||
Object.prototype.hasOwnProperty.call(defaultConfigRegistry, componentName);
|
||||
|
||||
ko.components.unregister = componentName => {
|
||||
delete defaultConfigRegistry[componentName];
|
||||
ko.components.clearCachedDefinition(componentName);
|
||||
};
|
||||
|
||||
ko.components.defaultLoader = {
|
||||
'getConfig': (componentName, callback) => {
|
||||
var result = ko.components.isRegistered(componentName)
|
||||
? defaultConfigRegistry[componentName]
|
||||
: null;
|
||||
callback(result);
|
||||
},
|
||||
|
||||
'loadComponent': (componentName, config, callback) => {
|
||||
var errorCallback = makeErrorCallback(componentName);
|
||||
resolveConfig(componentName, errorCallback, config, callback);
|
||||
},
|
||||
|
||||
'loadTemplate': (componentName, templateConfig, callback) =>
|
||||
resolveTemplate(makeErrorCallback(componentName), templateConfig, callback)
|
||||
,
|
||||
|
||||
'loadViewModel': (componentName, viewModelConfig, callback) =>
|
||||
resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback)
|
||||
};
|
||||
|
||||
var defaultConfigRegistry = Object.create(null);
|
||||
var createViewModelKey = 'createViewModel';
|
||||
|
||||
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
|
||||
// into the standard component definition format:
|
||||
// { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.
|
||||
// Since both template and viewModel may need to be resolved asynchronously, both tasks are performed
|
||||
// in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,
|
||||
// so this is implemented manually below.
|
||||
function resolveConfig(componentName, errorCallback, config, callback) {
|
||||
var result = {},
|
||||
makeCallBackWhenZero = 2,
|
||||
tryIssueCallback = () => {
|
||||
if (--makeCallBackWhenZero === 0) {
|
||||
callback(result);
|
||||
}
|
||||
},
|
||||
templateConfig = config['template'],
|
||||
viewModelConfig = config['viewModel'];
|
||||
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
|
||||
// into the standard component definition format:
|
||||
// { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.
|
||||
// Since both template and viewModel may need to be resolved asynchronously, both tasks are performed
|
||||
// in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,
|
||||
// so this is implemented manually below.
|
||||
function loadComponent(componentName, callback) {
|
||||
var result = {},
|
||||
config = defaultConfigRegistry[componentName] || {},
|
||||
templateConfig = config['template'],
|
||||
viewModelConfig = config['viewModel'];
|
||||
|
||||
if (templateConfig) {
|
||||
ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, templateConfig], resolvedTemplate => {
|
||||
result['template'] = resolvedTemplate;
|
||||
tryIssueCallback();
|
||||
});
|
||||
} else {
|
||||
tryIssueCallback();
|
||||
}
|
||||
if (templateConfig) {
|
||||
if (!templateConfig['element']) {
|
||||
throwError(componentName, 'Unknown template value: ' + templateConfig);
|
||||
}
|
||||
// Element ID - find it, then copy its child nodes
|
||||
var element = templateConfig['element'];
|
||||
var elemInstance = document.getElementById(element);
|
||||
if (!elemInstance) {
|
||||
throwError(componentName, 'Cannot find element with ID ' + element);
|
||||
}
|
||||
if (!elemInstance.matches('TEMPLATE')) {
|
||||
throwError(componentName, 'Template Source Element not a <template>');
|
||||
}
|
||||
// For browsers with proper <template> element support (i.e., where the .content property
|
||||
// gives a document fragment), use that document fragment.
|
||||
result['template'] = ko.utils.cloneNodes(elemInstance.content.childNodes);
|
||||
}
|
||||
|
||||
if (viewModelConfig) {
|
||||
ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, viewModelConfig], resolvedViewModel => {
|
||||
result[createViewModelKey] = resolvedViewModel;
|
||||
tryIssueCallback();
|
||||
});
|
||||
} else {
|
||||
tryIssueCallback();
|
||||
if (viewModelConfig) {
|
||||
if (typeof viewModelConfig[createViewModelKey] !== 'function') {
|
||||
throwError(componentName, 'Unknown viewModel value: ' + viewModelConfig);
|
||||
}
|
||||
// Already a factory function - use it as-is
|
||||
result[createViewModelKey] = viewModelConfig[createViewModelKey];
|
||||
}
|
||||
|
||||
if (result['template'] && result[createViewModelKey]) {
|
||||
callback(result);
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
function throwError(componentName, message) {
|
||||
throw new Error(`Component '${componentName}': ${message}`)
|
||||
}
|
||||
|
||||
function beginLoadingComponent(componentName, callback) {
|
||||
// Try the candidates
|
||||
var found = false;
|
||||
loadComponent(componentName, result => {
|
||||
// This candidate returned a value. Use it.
|
||||
(found = result != null) && callback(result);
|
||||
});
|
||||
if (!found) {
|
||||
// No candidates returned a value
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveTemplate(errorCallback, templateConfig, callback) {
|
||||
if (templateConfig instanceof Array) {
|
||||
// Assume already an array of DOM nodes - pass through unchanged
|
||||
callback(templateConfig);
|
||||
} else if (templateConfig instanceof DocumentFragment) {
|
||||
// Document fragment - use its child nodes
|
||||
callback([...templateConfig.childNodes]);
|
||||
} else if (templateConfig['element']) {
|
||||
var element = templateConfig['element'];
|
||||
if (element instanceof HTMLElement) {
|
||||
// Element instance - copy its child nodes
|
||||
callback(cloneNodesFromTemplateSourceElement(element));
|
||||
} else if (typeof element === 'string') {
|
||||
// Element ID - find it, then copy its child nodes
|
||||
var elemInstance = document.getElementById(element);
|
||||
if (elemInstance) {
|
||||
callback(cloneNodesFromTemplateSourceElement(elemInstance));
|
||||
} else {
|
||||
errorCallback('Cannot find element with ID ' + element);
|
||||
}
|
||||
} else {
|
||||
errorCallback('Unknown element type: ' + element);
|
||||
}
|
||||
} else {
|
||||
errorCallback('Unknown template value: ' + templateConfig);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveViewModel(errorCallback, viewModelConfig, callback) {
|
||||
if (typeof viewModelConfig === 'function') {
|
||||
// Constructor - convert to standard factory function format
|
||||
// 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(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(() => fixedInstance);
|
||||
} else if ('viewModel' in viewModelConfig) {
|
||||
// Resolved AMD module whose value is of the form { viewModel: ... }
|
||||
resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback);
|
||||
} else {
|
||||
errorCallback('Unknown viewModel value: ' + viewModelConfig);
|
||||
}
|
||||
}
|
||||
|
||||
function cloneNodesFromTemplateSourceElement(elemInstance) {
|
||||
if (elemInstance.matches('TEMPLATE')) {
|
||||
// For browsers with proper <template> element support (i.e., where the .content property
|
||||
// gives a document fragment), use that document fragment.
|
||||
if (elemInstance.content instanceof DocumentFragment) {
|
||||
return ko.utils.cloneNodes(elemInstance.content.childNodes);
|
||||
}
|
||||
}
|
||||
throw 'Template Source Element not a <template>';
|
||||
}
|
||||
|
||||
function makeErrorCallback(componentName) {
|
||||
return message => {
|
||||
throw new Error('Component \'' + componentName + '\': ' + message)
|
||||
};
|
||||
}
|
||||
|
||||
ko.exportSymbol('components', ko.components);
|
||||
ko.exportSymbol('components.register', ko.components.register);
|
||||
|
||||
// By default, the default loader is the only registered component loader
|
||||
ko.components['loaders'].push(ko.components.defaultLoader);
|
||||
})();
|
||||
(() => {
|
||||
var componentLoadingOperationUniqueId = 0;
|
||||
|
|
|
|||
144
vendors/knockout/build/output/knockout-latest.js
vendored
144
vendors/knockout/build/output/knockout-latest.js
vendored
|
|
@ -4,76 +4,74 @@
|
|||
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
(A=>{function E(a,c){return null===a||ba[typeof a]?a===c:!1}function D(a,c){var f;return()=>{f||(f=setTimeout(()=>{f=0;a()},c))}}function I(a,c){var f;return()=>{clearTimeout(f);f=setTimeout(a,c)}}function P(a,c){null!==c&&c.m&&c.m()}function T(a,c){var f=this.$b,g=f[B];g.Z||(this.Ra&&this.ya[c]?(f.rb(c,a,this.ya[c]),this.ya[c]=null,--this.Ra):g.u[c]||f.rb(c,a,g.v?{T:a}:f.Qb(a)),a.ja&&a.Vb())}var Q=A.document,U={},b="undefined"!==typeof U?U:{};b.o=(a,c)=>{a=a.split(".");for(var f=b,g=0;g<a.length-
|
||||
1;g++)f=f[a[g]];f[a[a.length-1]]=c};b.Y=(a,c,f)=>{a[c]=f};b.o("version","3.5.1-sm");b.a={extend:(a,c)=>{c&&Object.entries(c).forEach(f=>a[f[0]]=f[1]);return a},M:(a,c)=>a&&Object.entries(a).forEach(f=>c(f[0],f[1])),yc:(a,c,f)=>{if(!a)return a;var g={};Object.entries(a).forEach(k=>g[k[0]]=c.call(f,k[1],k[0],a));return g},Va:a=>[...a.childNodes].forEach(c=>b.removeNode(c)),Jb:a=>{a=[...a];var c=(a[0]&&a[0].ownerDocument||Q).createElement("div");a.forEach(f=>c.append(b.ea(f)));return c},xa:(a,c)=>Array.prototype.map.call(a,
|
||||
c?f=>b.ea(f.cloneNode(!0)):f=>f.cloneNode(!0)),ta:(a,c)=>{b.a.Va(a);c&&a.append(...c)},za:(a,c)=>{if(a.length){for(c=8===c.nodeType&&c.parentNode||c;a.length&&a[0].parentNode!==c;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==c;)--a.length;if(1<a.length){c=a[0];var f=a[a.length-1];for(a.length=0;c!==f;)a.push(c),c=c.nextSibling;a.push(f)}}return a},Pb:a=>null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),cc:(a,c)=>c.contains(1!==a.nodeType?a.parentNode:a),Ua:a=>
|
||||
b.a.cc(a,a.ownerDocument.documentElement),Sb:(a,c)=>{if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(c))},g:a=>b.O(a)?a():a,eb:(a,c)=>a.textContent=b.a.g(c)||""};b.o("utils",b.a);b.o("unwrap",b.a.g);(()=>{let a=0,c="__ko__"+Date.now(),f=new WeakMap;b.a.f={get:(g,k)=>(f.get(g)||{})[k],set:(g,k,r)=>{if(f.has(g))f.get(g)[k]=r;else{let d={};d[k]=r;f.set(g,d)}return r},Xa:function(g,k,r){return this.get(g,k)||this.set(g,k,r)},clear:g=>f.delete(g),
|
||||
V:()=>a++ +c}})();b.a.I=(()=>{var a=b.a.f.V(),c={1:1,8:1,9:1},f={1:1,9:1};const g=(d,e)=>{var h=b.a.f.get(d,a);e&&!h&&(h=new Set,b.a.f.set(d,a,h));return h},k=d=>{var e=g(d);e&&(new Set(e)).forEach(h=>h(d));b.a.f.clear(d);f[d.nodeType]&&r(d.childNodes,!0)},r=(d,e)=>{for(var h=[],q,p=0;p<d.length;p++)if(!e||8===d[p].nodeType)if(k(h[h.length]=q=d[p]),d[p]!==q)for(;p--&&!h.includes(d[p]););};return{ma:(d,e)=>{if("function"!=typeof e)throw Error("Callback must be a function");g(d,1).add(e)},cb:(d,e)=>
|
||||
{var h=g(d);h&&(h.delete(e),h.size||b.a.f.set(d,a,null))},ea:d=>{b.l.J(()=>{c[d.nodeType]&&(k(d),f[d.nodeType]&&r(d.getElementsByTagName("*")))});return d},removeNode:d=>{b.ea(d);d.parentNode&&d.parentNode.removeChild(d)}}})();b.ea=b.a.I.ea;b.removeNode=b.a.I.removeNode;b.o("utils.domNodeDisposal",b.a.I);b.o("utils.domNodeDisposal.addDisposeCallback",b.a.I.ma);b.Rb=(()=>{function a(){if(g)for(var e=g,h=0,q;r<g;)if(q=f[r++]){if(r>e){if(5E3<=++h){r=g;setTimeout(()=>{throw Error(`'Too much recursion' after processing ${h} task groups.`);
|
||||
},0);break}e=g}try{q()}catch(p){setTimeout(()=>{throw p;},0)}}}function c(){a();r=g=f.length=0}var f=[],g=0,k=1,r=0,d=(e=>{var h=Q.createElement("div");(new MutationObserver(e)).observe(h,{attributes:!0});return()=>h.classList.toggle("foo")})(c);return{Nb:e=>{g||d(c);f[g++]=e;return k++},cancel:e=>{e-=k-g;e>=r&&e<g&&(f[e]=null)}}})();b.Wa={debounce:(a,c)=>a.Ga(f=>I(f,c)),rateLimit:(a,c)=>{if("number"==typeof c)var f=c;else{f=c.timeout;var g=c.method}var k="function"==typeof g?g:D;a.Ga(r=>k(r,f,c))},
|
||||
notify:(a,c)=>{a.equalityComparer="always"==c?null:E}};var ba={undefined:1,"boolean":1,number:1,string:1};b.o("extenders",b.Wa);class ca{constructor(a,c,f){this.T=a;this.kb=c;this.oa=f;this.Ma=!1;this.C=this.W=null;b.Y(this,"dispose",this.m);b.Y(this,"disposeWhenNodeIsRemoved",this.i)}m(){this.Ma||(this.C&&b.a.I.cb(this.W,this.C),this.Ma=!0,this.oa(),this.T=this.kb=this.oa=this.W=this.C=null)}i(a){this.W=a;b.a.I.ma(a,this.C=this.m.bind(this))}}b.R=function(){Object.setPrototypeOf(this,L);L.Da(this)};
|
||||
var L={Da:a=>{a.S=new Map;a.S.set("change",new Set);a.qb=1},subscribe:function(a,c,f){var g=this;f=f||"change";var k=new ca(g,c?a.bind(c):a,()=>{g.S.get(f).delete(k);g.va&&g.va(f)});g.na&&g.na(f);g.S.has(f)||g.S.set(f,new Set);g.S.get(f).add(k);return k},notifySubscribers:function(a,c){c=c||"change";"change"===c&&this.Ja();if(this.ra(c)){c="change"===c&&this.Tb||new Set(this.S.get(c));try{b.l.vb(),c.forEach(f=>{f.Ma||f.kb(a)})}finally{b.l.end()}}},Ba:function(){return this.qb},ic:function(a){return this.Ba()!==
|
||||
a},Ja:function(){++this.qb},Ga:function(a){var c=this,f=b.O(c),g,k,r,d,e;c.ua||(c.ua=c.notifySubscribers,c.notifySubscribers=function(q,p){p&&"change"!==p?"beforeChange"===p?this.nb(q):this.ua(q,p):this.ob(q)});var h=a(()=>{c.ja=!1;f&&d===c&&(d=c.lb?c.lb():c());var q=k||e&&c.Fa(r,d);e=k=g=!1;q&&c.ua(r=d)});c.ob=(q,p)=>{p&&c.ja||(e=!p);c.Tb=new Set(c.S.get("change"));c.ja=g=!0;d=q;h()};c.nb=q=>{g||(r=q,c.ua(q,"beforeChange"))};c.pb=()=>{e=!0};c.Vb=()=>{c.Fa(r,c.G(!0))&&(k=!0)}},ra:function(a){return(this.S.get(a)||
|
||||
[]).size},Fa:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:()=>"[object Object]",extend:function(a){var c=this;a&&b.a.M(a,(f,g)=>{f=b.Wa[f];"function"==typeof f&&(c=f(c,g)||c)});return c}};b.Y(L,"init",L.Da);b.Y(L,"subscribe",L.subscribe);b.Y(L,"extend",L.extend);Object.setPrototypeOf(L,Function.prototype);b.R.fn=L;b.lc=a=>null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers;(()=>{var a=[],c,f=0;b.l={vb:g=>{a.push(c);c=g},end:()=>c=a.pop(),
|
||||
Mb:g=>{if(c){if(!b.lc(g))throw Error("Only subscribable things can act as dependencies");c.Xb.call(c.Yb,g,g.Ub||(g.Ub=++f))}},J:(g,k,r)=>{try{return a.push(c),c=void 0,g.apply(k,r||[])}finally{c=a.pop()}},Aa:()=>c&&c.j.Aa(),Za:()=>c&&c.Za,j:()=>c&&c.j}})();const K=Symbol("_latestValue");b.aa=a=>{function c(){if(0<arguments.length)return c.Fa(c[K],arguments[0])&&(c.ib(),c[K]=arguments[0],c.Ka()),this;b.l.Mb(c);return c[K]}c[K]=a;Object.defineProperty(c,"length",{get:()=>null==c[K]?void 0:c[K].length});
|
||||
b.R.fn.Da(c);Object.setPrototypeOf(c,N);return c};var N={toJSON:function(){let a=this[K];return a&&a.toJSON?a.toJSON():a},equalityComparer:E,G:function(){return this[K]},Ka:function(){this.notifySubscribers(this[K],"spectate");this.notifySubscribers(this[K])},ib:function(){this.notifySubscribers(this[K],"beforeChange")}};Object.setPrototypeOf(N,b.R.fn);var O=b.aa.C="__ko_proto__";N[O]=b.aa;b.O=a=>{if((a="function"==typeof a&&a[O])&&a!==N[O]&&a!==b.j.fn[O])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
|
||||
return!!a};b.nc=a=>"function"==typeof a&&(a[O]===N[O]||a[O]===b.j.fn[O]&&a.jc);b.o("observable",b.aa);b.o("isObservable",b.O);b.o("observable.fn",N);b.Y(N,"valueHasMutated",N.Ka);b.ha=a=>{a=a||[];if("object"!=typeof a||!("length"in a))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");a=b.aa(a);Object.setPrototypeOf(a,b.ha.fn);return a.extend({trackArrayChanges:!0})};b.ha.fn={remove:function(a){for(var c=this.G(),f=!1,g="function"!=typeof a||
|
||||
b.O(a)?d=>d===a:a,k=c.length;k--;){var r=c[k];if(g(r)){if(c[k]!==r)throw Error("Array modified during remove; cannot remove item");f||this.ib();f=!0;c.splice(k,1)}}f&&this.Ka()}};Object.setPrototypeOf(b.ha.fn,b.aa.fn);Object.getOwnPropertyNames(Array.prototype).forEach(a=>{"function"===typeof Array.prototype[a]&&"constructor"!=a&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(a)?b.ha.fn[a]=function(...c){var f=this.G();this.ib();this.xb(f,a,c);c=f[a](...c);this.Ka();
|
||||
return c===f?this:c}:b.ha.fn[a]=function(...c){return this()[a](...c)})});b.Gb=a=>b.O(a)&&"function"==typeof a.remove&&"function"==typeof a.push;b.o("observableArray",b.ha);b.o("isObservableArray",b.Gb);b.Wa.trackArrayChanges=(a,c)=>{function f(){function t(){if(e){var l=[].concat(a.G()||[]);if(a.ra("arrayChange")){if(!k||1<e)k=b.a.yb(h,l,a.Pa);var m=k}h=l;k=null;e=0;m&&m.length&&a.notifySubscribers(m,"arrayChange")}}g?t():(g=!0,d=a.subscribe(()=>++e,null,"spectate"),h=[].concat(a.G()||[]),k=null,
|
||||
r=a.subscribe(t))}a.Pa={};c&&"object"==typeof c&&b.a.extend(a.Pa,c);a.Pa.sparse=!0;if(!a.xb){var g=!1,k=null,r,d,e=0,h,q=a.na,p=a.va;a.na=t=>{q&&q.call(a,t);"arrayChange"===t&&f()};a.va=t=>{p&&p.call(a,t);"arrayChange"!==t||a.ra("arrayChange")||(r&&r.m(),d&&d.m(),d=r=null,g=!1,h=void 0)};a.xb=(t,l,m)=>{function n(H,F,z){return u[u.length]={status:H,value:F,index:z}}if(g&&!e){var u=[],w=t.length,v=m.length,y=0;switch(l){case "push":y=w;case "unshift":for(t=0;t<v;t++)n("added",m[t],y+t);break;case "pop":y=
|
||||
w-1;case "shift":w&&n("deleted",t[y],y);break;case "splice":y=Math.min(Math.max(0,0>m[0]?w+m[0]:m[0]),w);w=1===v?w:Math.min(y+(m[1]||0),w);v=y+v-2;l=Math.max(w,v);var x=[],C=[];for(let H=y,F=2;H<l;++H,++F)H<w&&C.push(n("deleted",t[H],H)),H<v&&x.push(n("added",m[F],H));b.a.Db(C,x);break;default:return}k=u}}}};var B=Symbol("_state");b.j=(a,c)=>{function f(){if(0<arguments.length){if("function"!==typeof g)throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
|
||||
g(...arguments);return this}k.Z||b.l.Mb(f);(k.U||k.v&&f.sa())&&f.P();return k.K}"object"===typeof a?c=a:(c=c||{},a&&(c.read=a));if("function"!=typeof c.read)throw Error("Pass a function that returns the value of the ko.computed");var g=c.write,k={K:void 0,$:!0,U:!0,Ea:!1,gb:!1,Z:!1,bb:!1,v:!1,Lb:c.read,i:c.disposeWhenNodeIsRemoved||c.i||null,pa:c.disposeWhen||c.pa,Ta:null,u:{},H:0,Cb:null};f[B]=k;f.jc="function"===typeof g;b.R.fn.Da(f);Object.setPrototypeOf(f,R);c.pure?(k.bb=!0,k.v=!0,b.a.extend(f,
|
||||
da)):c.deferEvaluation&&b.a.extend(f,ea);k.i&&(k.gb=!0,k.i.nodeType||(k.i=null));k.v||c.deferEvaluation||f.P();k.i&&f.ga()&&b.a.I.ma(k.i,k.Ta=()=>{f.m()});return f};var R={equalityComparer:E,Aa:function(){return this[B].H},fc:function(){var a=[];b.a.M(this[B].u,(c,f)=>a[f.ka]=f.T);return a},Ya:function(a){if(!this[B].H)return!1;var c=this.fc();return c.includes(a)||!!c.find(f=>f.Ya&&f.Ya(a))},rb:function(a,c,f){if(this[B].bb&&c===this)throw Error("A 'pure' computed must not be called recursively");
|
||||
this[B].u[a]=f;f.ka=this[B].H++;f.la=c.Ba()},sa:function(){var a,c=this[B].u;for(a in c)if(Object.prototype.hasOwnProperty.call(c,a)){var f=c[a];if(this.ia&&f.T.ja||f.T.ic(f.la))return!0}},xc:function(){this.ia&&!this[B].Ea&&this.ia(!1)},ga:function(){var a=this[B];return a.U||0<a.H},zc:function(){this.ja?this[B].U&&(this[B].$=!0):this.Bb()},Qb:function(a){return a.subscribe(this.Bb,this)},Bb:function(){var a=this,c=a.throttleEvaluation;c&&0<=c?(clearTimeout(this[B].Cb),this[B].Cb=setTimeout(()=>
|
||||
a.P(!0),c)):a.ia?a.ia(!0):a.P(!0)},P:function(a){var c=this[B],f=c.pa,g=!1;if(!c.Ea&&!c.Z){if(c.i&&!b.a.Ua(c.i)||f&&f()){if(!c.gb){this.m();return}}else c.gb=!1;c.Ea=!0;try{g=this.dc(a)}finally{c.Ea=!1}return g}},dc:function(a){var c=this[B],f=c.bb?void 0:!c.H;var g={$b:this,ya:c.u,Ra:c.H};b.l.vb({Yb:g,Xb:T,j:this,Za:f});c.u={};c.H=0;a:{try{var k=c.Lb();break a}finally{b.l.end(),g.Ra&&!c.v&&b.a.M(g.ya,P),c.$=c.U=!1}k=void 0}c.H?g=this.Fa(c.K,k):(this.m(),g=!0);g&&(c.v?this.Ja():this.notifySubscribers(c.K,
|
||||
"beforeChange"),c.K=k,this.notifySubscribers(c.K,"spectate"),!c.v&&a&&this.notifySubscribers(c.K),this.pb&&this.pb());f&&this.notifySubscribers(c.K,"awake");return g},G:function(a){var c=this[B];(c.U&&(a||!c.H)||c.v&&this.sa())&&this.P();return c.K},Ga:function(a){b.R.fn.Ga.call(this,a);this.lb=function(){this[B].v||(this[B].$?this.P():this[B].U=!1);return this[B].K};this.ia=function(c){this.nb(this[B].K);this[B].U=!0;c&&(this[B].$=!0);this.ob(this,!c)}},m:function(){var a=this[B];!a.v&&a.u&&b.a.M(a.u,
|
||||
(c,f)=>f.m&&f.m());a.i&&a.Ta&&b.a.I.cb(a.i,a.Ta);a.u=void 0;a.H=0;a.Z=!0;a.$=!1;a.U=!1;a.v=!1;a.i=void 0;a.pa=void 0;a.Lb=void 0}},da={na:function(a){var c=this,f=c[B];if(!f.Z&&f.v&&"change"==a){f.v=!1;if(f.$||c.sa())f.u=null,f.H=0,c.P()&&c.Ja();else{var g=[];b.a.M(f.u,(k,r)=>g[r.ka]=k);g.forEach((k,r)=>{var d=f.u[k],e=c.Qb(d.T);e.ka=r;e.la=d.la;f.u[k]=e});c.sa()&&c.P()&&c.Ja()}f.Z||c.notifySubscribers(f.K,"awake")}},va:function(a){var c=this[B];c.Z||"change"!=a||this.ra("change")||(b.a.M(c.u,(f,
|
||||
g)=>{g.m&&(c.u[f]={T:g.T,ka:g.ka,la:g.la},g.m())}),c.v=!0,this.notifySubscribers(void 0,"asleep"))},Ba:function(){var a=this[B];a.v&&(a.$||this.sa())&&this.P();return b.R.fn.Ba.call(this)}},ea={na:function(a){"change"!=a&&"beforeChange"!=a||this.G()}};Object.setPrototypeOf(R,b.R.fn);R[b.aa.C]=b.j;b.o("computed",b.j);b.o("computed.fn",R);b.Y(R,"dispose",R.m);b.sc=a=>{if("function"===typeof a)return b.j(a,{pure:!0});a=b.a.extend({},a);a.pure=!0;return b.j(a)};(()=>{b.A={N:a=>{switch(a.nodeName){case "OPTION":return!0===
|
||||
a.__ko__hasDomDataOptionValue__?b.a.f.get(a,b.b.options.ab):a.value;case "SELECT":return 0<=a.selectedIndex?b.A.N(a.options[a.selectedIndex]):void 0;default:return a.value}},La:(a,c,f)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.f.set(a,b.b.options.ab,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.f.set(a,b.b.options.ab,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var g=-1,k=""===c||null==c,r=0,d=a.options.length,e;r<
|
||||
d;++r)if(e=b.A.N(a.options[r]),e==c||""===e&&k){g=r;break}if(f||0<=g||k&&1<a.size)a.selectedIndex=g;break;default:a.value=null==c?"":c}}}})();b.F=(()=>{function a(e){e=b.a.Pb(e);123===e.charCodeAt(0)&&(e=e.slice(1,-1));e+="\n,";var h=[],q=e.match(g),p=[],t=0;if(1<q.length){for(var l=0,m;m=q[l++];){var n=m.charCodeAt(0);if(44===n){if(0>=t){h.push(u&&p.length?{key:u,value:p.join("")}:{unknown:u||p.join("")});var u=t=0;p=[];continue}}else if(58===n){if(!t&&!u&&1===p.length){u=p.pop();continue}}else if(47===
|
||||
n&&1<m.length&&(47===m.charCodeAt(1)||42===m.charCodeAt(1)))continue;else 47===n&&l&&1<m.length?(n=q[l-1].match(k))&&!r[n[0]]&&(e=e.substr(e.indexOf(m)+1),q=e.match(g),l=-1,m="/"):40===n||123===n||91===n?++t:41===n||125===n||93===n?--t:u||p.length||34!==n&&39!==n||(m=m.slice(1,-1));p.push(m)}if(0<t)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true","false","null","undefined"],f=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,g=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,
|
||||
k=/[\])"'A-Za-z0-9_$]+$/,r={"in":1,"return":1,"typeof":1},d=new Set;return{Oa:[],hb:d,qc:a,rc:function(e,h){function q(n,u){if(!m){var w=b.b[n];if(w&&w.preprocess&&!(u=w.preprocess(u,n,q)))return;if(w=d.has(n)){var v=u;c.includes(v)?v=!1:(w=v.match(f),v=null===w?!1:w[1]?"Object("+w[1]+")"+w[2]:v);w=v}w&&t.push("'"+n+"':function(_z){"+v+"=_z}")}l&&(u="function(){return "+u+" }");p.push("'"+n+"':"+u)}h=h||{};var p=[],t=[],l=h.valueAccessors,m=h.bindingParams;("string"===typeof e?a(e):e).forEach(n=>
|
||||
q(n.key||n.unknown,n.value));t.length&&q("_ko_property_writers","{"+t.join(",")+" }");return p.join(",")},oc:(e,h)=>-1<e.findIndex(q=>q.key==h),jb:(e,h,q,p,t)=>{if(e&&b.O(e))!b.nc(e)||t&&e.G()===p||e(p);else if((e=h.get("_ko_property_writers"))&&e[q])e[q](p)}}})();(()=>{function a(d){return 8==d.nodeType&&g.test(d.nodeValue)}function c(d){return 8==d.nodeType&&k.test(d.nodeValue)}function f(d,e){for(var h=d,q=1,p=[];h=h.nextSibling;){if(c(h)&&(b.a.f.set(h,r,!0),!--q))return p;p.push(h);a(h)&&++q}if(!e)throw Error("Cannot find closing comment tag to match: "+
|
||||
d.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,r="__ko_matchedEndComment__";b.h={ba:{},childNodes:d=>a(d)?f(d):d.childNodes,qa:d=>{a(d)?(d=f(d))&&[...d].forEach(e=>b.removeNode(e)):b.a.Va(d)},ta:(d,e)=>{a(d)?(b.h.qa(d),d.after(...e)):b.a.ta(d,e)},prepend:(d,e)=>{a(d)?d.nextSibling.before(e):d.prepend(e)},Fb:(d,e,h)=>{h?h.after(e):b.h.prepend(d,e)},firstChild:d=>{if(a(d))return d=d.nextSibling,!d||c(d)?null:d;let e=d.firstChild;if(e&&c(e))throw Error("Found invalid end comment, as the first child of "+
|
||||
d);return e},nextSibling:d=>{if(a(d)){var e=f(d,void 0);d=e?(e.length?e[e.length-1]:d).nextSibling:null}if((e=d.nextSibling)&&c(e)){if(c(e)&&!b.a.f.get(e,r))throw Error("Found end comment without a matching opening comment, as child of "+d);return null}return e},hc:a,wc:d=>(d=d.nodeValue.match(g))?d[1]:null}})();(()=>{const a=new Map;b.wb=new class{pc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return b.h.hc(c);default:return!1}}ec(c,f){a:{switch(c.nodeType){case 1:var g=
|
||||
c.getAttribute("data-bind");break a;case 8:g=b.h.wc(c);break a}g=null}if(g)try{let r={valueAccessors:!0},d=a.get(g);if(!d){var k="with($context){with($data||{}){return{"+b.F.rc(g,r)+"}}}";d=new Function("$context","$element",k);a.set(g,d)}return d(f,c)}catch(r){throw r.message="Unable to parse bindings.\nBindings value: "+g+"\nMessage: "+r.message,r;}return null}}})();(()=>{function a(l){var m=(l=b.a.f.get(l,p))&&l.D;m&&(l.D=null,m.Kb())}function c(l,m){for(var n,u=b.h.firstChild(m);n=u;)u=b.h.nextSibling(n),
|
||||
f(l,n);b.c.notify(m,b.c.B)}function f(l,m){var n=l;if(1===m.nodeType||b.wb.pc(m))n=k(m,null,l).bindingContextForDescendants;n&&m.matches&&!m.matches("SCRIPT,TEXTAREA,TEMPLATE")&&c(n,m)}function g(l){var m=[],n={},u=[];b.a.M(l,function y(v){if(!n[v]){var x=b.b[v];x&&(x.after&&(u.push(v),x.after.forEach(C=>{if(l[C]){if(u.includes(C))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+u.join(", "));y(C)}}),u.length--),m.push({key:v,Eb:x}));n[v]=!0}});return m}
|
||||
function k(l,m,n){var u=b.a.f.Xa(l,p,{}),w=u.Wb;if(!m){if(w)throw Error("You cannot apply bindings multiple times to the same element.");u.Wb=!0}w||(u.context=n);u.$a||(u.$a={});if(m&&"function"!==typeof m)var v=m;else{var y=b.j(()=>{if(v=m?m(n,l):b.wb.ec(l,n)){if(n[d])n[d]();if(n[h])n[h]()}return v},{i:l});v&&y.ga()||(y=null)}var x=n,C;if(v){var H=y?z=>()=>y()[z]():z=>v[z],F={get:z=>v[z]&&H(z)(),has:z=>z in v};b.c.B in v&&b.c.subscribe(l,b.c.B,()=>{var z=v[b.c.B]();if(z){var G=b.h.childNodes(l);
|
||||
G.length&&z(G,b.Ab(G[0]))}});b.c.X in v&&(x=b.c.fb(l,n),b.c.subscribe(l,b.c.X,()=>{var z=v[b.c.X]();z&&b.h.firstChild(l)&&z(l)}));g(v).forEach(z=>{var G=z.Eb.init,J=z.Eb.update,M=z.key;if(8===l.nodeType&&!b.h.ba[M])throw Error("The binding '"+M+"' cannot be used with virtual elements");try{"function"==typeof G&&b.l.J(()=>{var S=G(l,H(M),F,x.$data,x);if(S&&S.controlsDescendantBindings){if(void 0!==C)throw Error("Multiple bindings ("+C+" and "+M+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
|
||||
C=M}}),"function"==typeof J&&b.j(()=>J(l,H(M),F,x.$data,x),{i:l})}catch(S){throw S.message='Unable to process binding "'+M+": "+v[M]+'"\nMessage: '+S.message,S;}})}u=void 0===C;return{shouldBindDescendants:u,bindingContextForDescendants:u&&x}}function r(l,m){return l&&l instanceof b.da?l:new b.da(l,void 0,void 0,m)}var d=Symbol("_subscribable"),e=Symbol("_ancestorBindingInfo"),h=Symbol("_dataDependency");b.b={};var q={};b.da=class{constructor(l,m,n,u,w){function v(){var G=H?C():C,J=b.a.g(G);m?(b.a.extend(y,
|
||||
m),e in m&&(y[e]=m[e])):(y.$parents=[],y.$root=J,y.ko=b);y[d]=z;x?J=y.$data:(y.$rawData=G,y.$data=J);n&&(y[n]=J);u&&u(y,m,J);if(m&&m[d]&&!b.l.j().Ya(m[d]))m[d]();F&&(y[h]=F);return y.$data}var y=this,x=l===q,C=x?void 0:l,H="function"==typeof C&&!b.O(C),F=w&&w.dataDependency;if(w&&w.exportDependencies)v();else{var z=b.sc(v);z.G();z.ga()?z.equalityComparer=null:y[d]=void 0}}["createChildContext"](l,m,n,u){!u&&m&&"object"==typeof m&&(u=m,m=u.as,n=u.extend);return new b.da(l,this,m,(w,v)=>{w.$parentContext=
|
||||
v;w.$parent=v.$data;w.$parents=(v.$parents||[]).slice(0);w.$parents.unshift(w.$parent);n&&n(w)},u)}["extend"](l,m){return new b.da(q,this,null,n=>b.a.extend(n,"function"==typeof l?l(n):l),m)}};var p=b.a.f.V();class t{constructor(l,m,n){this.C=l;this.oa=m;this.wa=new Set;this.B=!1;m.D||b.a.I.ma(l,a);n&&n.D&&(n.D.wa.add(l),this.W=n)}Kb(){this.W&&this.W.D&&this.W.D.bc(this.C)}bc(l){this.wa.delete(l);!this.wa.size&&this.B&&this.zb()}zb(){this.B=!0;this.oa.D&&!this.wa.size&&(this.oa.D=null,b.a.I.cb(this.C,
|
||||
a),b.c.notify(this.C,b.c.X),this.Kb())}}b.c={B:"childrenComplete",X:"descendantsComplete",subscribe:(l,m,n,u,w)=>{var v=b.a.f.Xa(l,p,{});v.fa||(v.fa=new b.R);w&&w.notifyImmediately&&v.$a[m]&&b.l.J(n,u,[l]);return v.fa.subscribe(n,u,m)},notify:(l,m)=>{var n=b.a.f.get(l,p);if(n&&(n.$a[m]=!0,n.fa&&n.fa.notifySubscribers(l,m),m==b.c.B))if(n.D)n.D.zb();else if(void 0===n.D&&n.fa&&n.fa.ra(b.c.X))throw Error("descendantsComplete event not supported for bindings on this node");},fb:(l,m)=>{var n=b.a.f.Xa(l,
|
||||
p,{});n.D||(n.D=new t(l,n,m[e]));return m[e]==n?m:m.extend(u=>{u[e]=n})}};b.vc=l=>(l=b.a.f.get(l,p))&&l.context;b.sb=(l,m,n)=>k(l,m,r(n));b.ub=(l,m)=>{1!==m.nodeType&&8!==m.nodeType||c(r(l),m)};b.tb=function(l,m,n){if(2>arguments.length){if(m=Q.body,!m)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!m||1!==m.nodeType&&8!==m.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
|
||||
f(r(l,n),m)};b.Ab=l=>(l=l&&[1,8].includes(l.nodeType)&&b.vc(l))?l.$data:void 0;b.o("bindingHandlers",b.b);b.o("applyBindings",b.tb);b.o("applyBindingAccessorsToNode",b.sb);b.o("dataFor",b.Ab)})();(()=>{function a(d,e){return Object.prototype.hasOwnProperty.call(d,e)?d[e]:void 0}function c(d,e){var h=a(k,d);if(h)h.subscribe(e);else{h=k[d]=new b.R;h.subscribe(e);f(d,(p,t)=>{t=!(!t||!t.synchronous);r[d]={definition:p,mc:t};delete k[d];q||t?h.notifySubscribers(p):b.Rb.Nb(()=>h.notifySubscribers(p))});
|
||||
var q=!0}}function f(d,e){g("getConfig",[d],h=>{h?g("loadComponent",[d,h],q=>e(q,h)):e(null,null)})}function g(d,e,h,q){q||(q=b.s.loaders.slice(0));var p=q.shift();if(p){var t=p[d];if(t){var l=!1;if(void 0!==t.apply(p,e.concat(function(m){l?h(null):null!==m?h(m):g(d,e,h,q)}))&&(l=!0,!p.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else g(d,e,h,q)}else h(null)}var k={},r={};b.s={get:(d,e)=>{var h=a(r,
|
||||
d);h?h.mc?b.l.J(()=>e(h.definition)):b.Rb.Nb(()=>e(h.definition)):c(d,e)},Zb:d=>delete r[d],mb:g};b.s.loaders=[];b.o("components",b.s)})();(()=>{function a(d,e,h,q){var p={},t=2;e=h.template;h=h.viewModel;e?b.s.mb("loadTemplate",[d,e],l=>{p.template=l;0===--t&&q(p)}):0===--t&&q(p);h?b.s.mb("loadViewModel",[d,h],l=>{p[r]=l;0===--t&&q(p)}):0===--t&&q(p)}function c(d,e,h){if("function"===typeof e)h(p=>new e(p));else if("function"===typeof e[r])h(e[r]);else if("instance"in e){var q=e.instance;h(()=>q)}else"viewModel"in
|
||||
e?c(d,e.viewModel,h):d("Unknown viewModel value: "+e)}function f(d){if(d.matches("TEMPLATE")&&d.content instanceof DocumentFragment)return b.a.xa(d.content.childNodes);throw"Template Source Element not a <template>";}function g(d){return e=>{throw Error("Component '"+d+"': "+e);}}var k={};b.s.register=(d,e)=>{if(!e)throw Error("Invalid configuration for "+d);if(b.s.Hb(d))throw Error("Component "+d+" is already registered");k[d]=e};b.s.Hb=d=>Object.prototype.hasOwnProperty.call(k,d);b.s.unregister=
|
||||
d=>{delete k[d];b.s.Zb(d)};b.s.ac={getConfig:(d,e)=>{d=b.s.Hb(d)?k[d]:null;e(d)},loadComponent:(d,e,h)=>{var q=g(d);a(d,q,e,h)},loadTemplate:(d,e,h)=>{d=g(d);if(e instanceof Array)h(e);else if(e instanceof DocumentFragment)h([...e.childNodes]);else if(e.element)if(e=e.element,e instanceof HTMLElement)h(f(e));else if("string"===typeof e){var q=Q.getElementById(e);q?h(f(q)):d("Cannot find element with ID "+e)}else d("Unknown element type: "+e);else d("Unknown template value: "+e)},loadViewModel:(d,
|
||||
e,h)=>c(g(d),e,h)};var r="createViewModel";b.o("components.register",b.s.register);b.s.loaders.push(b.s.ac)})();(()=>{function a(g,k,r){k=k.template;if(!k)throw Error("Component '"+g+"' has no template");g=b.a.xa(k);b.h.ta(r,g)}function c(g,k,r){var d=g.createViewModel;return d?d.call(g,k,r):k}var f=0;b.b.component={init:(g,k,r,d,e)=>{var h,q,p,t=()=>{var m=h&&h.dispose;"function"===typeof m&&m.call(h);p&&p.m();q=h=p=null},l=[...b.h.childNodes(g)];b.h.qa(g);b.a.I.ma(g,t);b.j(()=>{var m=b.a.g(k());
|
||||
if("string"===typeof m)var n=m;else{n=b.a.g(m.name);var u=b.a.g(m.params)}if(!n)throw Error("No component name specified");var w=b.c.fb(g,e),v=q=++f;b.s.get(n,y=>{if(q===v){t();if(!y)throw Error("Unknown component '"+n+"'");a(n,y,g);var x=c(y,u,{element:g,templateNodes:l});y=w.createChildContext(x,{extend:C=>{C.$component=x;C.$componentTemplateNodes=l}});x&&x.koDescendantsComplete&&(p=b.c.subscribe(g,b.c.X,x.koDescendantsComplete,x));h=x;b.ub(y,g)}})},{i:g});return{controlsDescendantBindings:!0}}};
|
||||
b.h.ba.component=!0})();b.b.attr={update:(a,c)=>{c=b.a.g(c())||{};b.a.M(c,function(f,g){g=b.a.g(g);var k=f.indexOf(":");k="lookupNamespaceURI"in a&&0<k&&a.lookupNamespaceURI(f.substr(0,k));var r=!1===g||null==g;r?k?a.removeAttributeNS(k,f):a.removeAttribute(f):g=g.toString();r||(k?a.setAttributeNS(k,f,g):a.setAttribute(f,g));"name"===f&&(a.name=r?"":g)})}};var V=(a,c,f)=>{c&&c.split(/\s+/).forEach(g=>a.classList.toggle(g,f))};b.b.css={update:(a,c)=>{c=b.a.g(c());null!==c&&"object"==typeof c?b.a.M(c,
|
||||
(f,g)=>{g=b.a.g(g);V(a,f,!!g)}):(c=b.a.Pb(c),V(a,a.__ko__cssValue,!1),a.__ko__cssValue=c,V(a,c,!0))}};b.b.enable={update:(a,c)=>{(c=b.a.g(c()))&&a.disabled?a.removeAttribute("disabled"):c||a.disabled||(a.disabled=!0)}};b.b.disable={update:(a,c)=>b.b.enable.update(a,()=>!b.a.g(c()))};b.b.event={init:(a,c,f,g,k)=>{f=c()||{};b.a.M(f,r=>{"string"==typeof r&&a.addEventListener(r,function(d){var e=c()[r];if(e)try{g=k.$data;var h=e.apply(g,[g,...arguments])}finally{!0!==h&&d.preventDefault()}})})}};b.b.foreach=
|
||||
{Ib:a=>()=>{var c=a(),f=b.O(c)?c.G():c;if(!f||"number"==typeof f.length)return{foreach:c};b.a.g(c);return{foreach:f.data,as:f.as,beforeRemove:f.beforeRemove}},init:(a,c)=>b.b.template.init(a,b.b.foreach.Ib(c)),update:(a,c,f,g,k)=>b.b.template.update(a,b.b.foreach.Ib(c),f,g,k)};b.F.Oa.foreach=!1;b.h.ba.foreach=!0;b.b.hasfocus={init:(a,c,f)=>{var g=r=>{a.__ko_hasfocusUpdating=!0;r=a.ownerDocument.activeElement===a;var d=c();b.F.jb(d,f,"hasfocus",r,!0);a.__ko_hasfocusLastValue=r;a.__ko_hasfocusUpdating=
|
||||
!1},k=g.bind(null,!0);g=g.bind(null,!1);a.addEventListener("focus",k);a.addEventListener("focusin",k);a.addEventListener("blur",g);a.addEventListener("focusout",g);a.__ko_hasfocusLastValue=!1},update:(a,c)=>{c=!!b.a.g(c());a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===c||(c?a.focus():a.blur())}};b.F.hb.add("hasfocus");b.b.html={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{b.a.Va(a);c=b.a.g(c());if(null!=c){const f=Q.createElement("template");f.innerHTML="string"!=typeof c?c.toString():
|
||||
c;a.appendChild(f.content)}}};(function(){function a(c,f,g){b.b[c]={init:(k,r,d,e,h)=>{var q,p={};f&&(p={as:d.get("as"),exportDependencies:!0});var t=d.has(b.c.X);b.j(()=>{var l=b.a.g(r()),m=!g!==!l,n=!q;t&&(h=b.c.fb(k,h));if(m){p.dataDependency=b.l.j();var u=f?h.createChildContext("function"==typeof l?l:r,p):b.l.Aa()?h.extend(null,p):h}n&&b.l.Aa()&&(q=b.a.xa(b.h.childNodes(k),!0));m?(n||b.h.ta(k,b.a.xa(q)),b.ub(u,k)):(b.h.qa(k),b.c.notify(k,b.c.B))},{i:k});return{controlsDescendantBindings:!0}}};
|
||||
b.F.Oa[c]=!1;b.h.ba[c]=!0}a("if");a("ifnot",!1,!0);a("with",!0)})();var W={};b.b.options={init:a=>{if(!a.matches("SELECT"))throw Error("options binding applies only to SELECT elements");for(;0<a.length;)a.remove(0);return{controlsDescendantBindings:!0}},update:(a,c,f)=>{function g(){return Array.from(a.options).filter(n=>n.selected)}function k(n,u,w){var v=typeof u;return"function"==v?u(n):"string"==v?n[u]:w}function r(n,u){l&&q?b.c.notify(a,b.c.B):p.length&&(n=p.includes(b.A.N(u[0])),u[0].selected=
|
||||
n,l&&!n&&b.l.J(b.a.Sb,null,[a,"change"]))}var d=a.multiple,e=0!=a.length&&d?a.scrollTop:null,h=b.a.g(c()),q=f.get("valueAllowUnset")&&f.has("value");c={};var p=[];q||(d?p=g().map(b.A.N):0<=a.selectedIndex&&p.push(b.A.N(a.options[a.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var t=h.filter(n=>n||null==n);f.has("optionsCaption")&&(h=b.a.g(f.get("optionsCaption")),null!==h&&void 0!==h&&t.unshift(W))}var l=!1;c.beforeRemove=n=>a.removeChild(n);h=r;f.has("optionsAfterRender")&&"function"==
|
||||
typeof f.get("optionsAfterRender")&&(h=(n,u)=>{r(n,u);b.l.J(f.get("optionsAfterRender"),null,[u[0],n!==W?n:void 0])});b.a.Ob(a,t,function(n,u,w){w.length&&(p=!q&&w[0].selected?[b.A.N(w[0])]:[],l=!0);u=a.ownerDocument.createElement("option");n===W?(b.a.eb(u,f.get("optionsCaption")),b.A.La(u,void 0)):(w=k(n,f.get("optionsValue"),n),b.A.La(u,b.a.g(w)),n=k(n,f.get("optionsText"),w),b.a.eb(u,n));return[u]},c,h);if(!q){var m;d?m=p.length&&g().length<p.length:m=p.length&&0<=a.selectedIndex?b.A.N(a.options[a.selectedIndex])!==
|
||||
p[0]:p.length||0<=a.selectedIndex;m&&b.l.J(b.a.Sb,null,[a,"change"])}(q||b.l.Za())&&b.c.notify(a,b.c.B);e&&20<Math.abs(e-a.scrollTop)&&(a.scrollTop=e)}};b.b.options.ab=b.a.f.V();b.b.style={update:(a,c)=>{c=b.a.g(c()||{});b.a.M(c,(f,g)=>{g=b.a.g(g);if(null==g||!1===g)g="";if(/^--/.test(f))a.style.setProperty(f,g);else{f=f.replace(/-(\w)/g,(r,d)=>d.toUpperCase());var k=a.style[f];a.style[f]=g;g===k||a.style[f]!=k||isNaN(g)||(a.style[f]=g+"px")}})}};b.b.submit={init:(a,c,f,g,k)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");
|
||||
a.addEventListener("submit",r=>{var d=c();try{var e=d.call(k.$data,a)}finally{!0!==e&&(r.preventDefault?r.preventDefault():r.returnValue=!1)}})}};b.b.text={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{8===a.nodeType&&(a.text||a.after(a.text=Q.createTextNode("")),a=a.text);b.a.eb(a,c())}};b.h.ba.text=!0;b.b.textInput={init:(a,c,f)=>{var g=a.value,k,r,d=()=>{clearTimeout(k);r=k=void 0;var h=a.value;g!==h&&(g=h,b.F.jb(c(),f,"textInput",h))},e=()=>{var h=b.a.g(c());null==h&&(h="");void 0!==
|
||||
r&&h===r?setTimeout(e,4):a.value!==h&&(a.value=h,g=a.value)};a.addEventListener("input",d);a.addEventListener("change",d);a.addEventListener("blur",d);b.j(e,{i:a})}};b.F.hb.add("textInput");b.b.textinput={preprocess:(a,c,f)=>f("textInput",a)};b.b.value={init:(a,c,f)=>{var g=a.matches("SELECT"),k=a.matches("INPUT");if(!k||"checkbox"!=a.type&&"radio"!=a.type){var r=new Set,d=f.get("valueUpdate"),e=null;d&&("string"==typeof d?r.add(d):d.forEach(t=>r.add(t)),r.delete("change"));var h=()=>{e=null;var t=
|
||||
c(),l=b.A.N(a);b.F.jb(t,f,"value",l)};r.forEach(t=>{var l=h;(t||"").startsWith("after")&&(l=()=>{e=b.A.N(a);setTimeout(h,0)},t=t.substring(5));a.addEventListener(t,l)});var q=k&&"file"==a.type?()=>{var t=b.a.g(c());null==t||""===t?a.value="":b.l.J(h)}:()=>{var t=b.a.g(c()),l=b.A.N(a);if(null!==e&&t===e)setTimeout(q,0);else if(t!==l||void 0===l)g?(l=f.get("valueAllowUnset"),b.A.La(a,t,l),l||t===b.A.N(a)||b.l.J(h)):b.A.La(a,t)};if(g){var p;b.c.subscribe(a,b.c.B,()=>{p?f.get("valueAllowUnset")?q():h():
|
||||
(a.addEventListener("change",h),p=b.j(q,{i:a}))},null,{notifyImmediately:!0})}else a.addEventListener("change",h),b.j(q,{i:a})}else b.sb(a,{checkedValue:c})},update:()=>{}};b.F.hb.add("value");b.b.visible={update:(a,c)=>{c=b.a.g(c());var f="none"!=a.style.display;c&&!f?a.style.display="":f&&!c&&(a.style.display="none")}};b.b.hidden={update:(a,c)=>a.hidden=!!b.a.g(c())};(function(a){b.b[a]={init:function(c,f,g,k,r){return b.b.event.init.call(this,c,()=>({[a]:f()}),g,k,r)}}})("click");(()=>{let a=b.a.f.V();
|
||||
class c{constructor(g){this.Sa=g}Ha(...g){let k=this.Sa;if(!g.length)return b.a.f.get(k,a)||(11===this.C?k.content:1===this.C?k:void 0);b.a.f.set(k,a,g[0])}}class f extends c{constructor(g){super(g);g&&(this.C=g.matches("TEMPLATE")&&g.content?g.content.nodeType:1)}}b.Ia={Sa:f,Na:c}})();(()=>{function a(d,e){if(d.length){var h=d[0],q=h.parentNode;g(h,d[d.length-1],p=>{1!==p.nodeType&&8!==p.nodeType||b.tb(e,p)});b.a.za(d,q)}}function c(d,e,h,q){var p=(d&&(d.nodeType?d:0<d.length?d[0]:null)||h||{}).ownerDocument;
|
||||
if("string"==typeof h){p=p||Q;p=p.getElementById(h);if(!p)throw Error("Cannot find template with ID "+h);h=new b.Ia.Sa(p)}else if([1,8].includes(h.nodeType))h=new b.Ia.Na(h);else throw Error("Unknown template type: "+h);h=(h=h.Ha?h.Ha():null)?[...h.cloneNode(!0).childNodes]:null;if("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(e){case "replaceChildren":b.h.ta(d,h);p=!0;break;case "ignoreTargetNode":break;
|
||||
default:throw Error("Unknown renderMode: "+e);}p&&(a(h,q),"replaceChildren"==e&&b.c.notify(d,b.c.B));return h}function f(d,e,h){return b.O(d)?d():"function"===typeof d?d(e,h):d}var g=(d,e,h)=>{var q;for(e=b.h.nextSibling(e);d&&(q=d)!==e;)d=b.h.nextSibling(q),h(q,d)};b.tc=function(d,e,h,q){h=h||{};var p=p||"replaceChildren";if(q){var t=q.nodeType?q:0<q.length?q[0]:null;return b.j(()=>{var l=e&&e instanceof b.da?e:new b.da(e,null,null,null,{exportDependencies:!0}),m=f(d,l.$data,l);c(q,p,m,l,h)},{pa:()=>
|
||||
!t||!b.a.Ua(t),i:t})}console.log("no targetNodeOrNodeArray")};b.uc=(d,e,h,q,p)=>{function t(v,y){b.l.J(b.a.Ob,null,[q,v,n,h,u,y]);b.c.notify(q,b.c.B)}var l,m=h.as,n=(v,y)=>{l=p.createChildContext(v,{as:m,extend:x=>{x.$index=y;m&&(x[m+"Index"]=y)}});v=f(d,v,l);return c(q,"ignoreTargetNode",v,l,h)},u=(v,y)=>{a(y,l);l=null};if(!h.beforeRemove&&b.Gb(e)){t(e.G());var w=e.subscribe(v=>{t(e(),v)},null,"arrayChange");w.i(q);return w}return b.j(()=>{var v=b.a.g(e)||[];"undefined"==typeof v.length&&(v=[v]);
|
||||
t(v)},{i:q})};var k=b.a.f.V(),r=b.a.f.V();b.b.template={init:(d,e)=>{e=b.a.g(e());if("string"==typeof e||"name"in e)b.h.qa(d);else if("nodes"in e){e=e.nodes||[];if(b.O(e))throw Error('The "nodes" option must be a plain, non-observable array.');let h=e[0]&&e[0].parentNode;h&&b.a.f.get(h,r)||(h=b.a.Jb(e),b.a.f.set(h,r,!0));(new b.Ia.Na(d)).Ha(h)}else if(e=b.h.childNodes(d),0<e.length)e=b.a.Jb(e),(new b.Ia.Na(d)).Ha(e);else throw Error("Anonymous template defined, but no template content was provided");
|
||||
return{controlsDescendantBindings:!0}},update:(d,e,h,q,p)=>{var t=e();e=b.a.g(t);h=!0;q=null;"string"==typeof e?e={}:(t="name"in e?e.name:d,"if"in e&&(h=b.a.g(e["if"])),h&&"ifnot"in e&&(h=!b.a.g(e.ifnot)),h&&!t&&(h=!1));"foreach"in e?q=b.uc(t,h&&e.foreach||[],e,d,p):h?(h=p,"data"in e&&(h=p.createChildContext(e.data,{as:e.as,exportDependencies:!0})),q=b.tc(t,h,e,d)):b.h.qa(d);p=q;(e=b.a.f.get(d,k))&&"function"==typeof e.m&&e.m();b.a.f.set(d,k,!p||p.ga&&!p.ga()?void 0:p)}};b.F.Oa.template=d=>{d=b.F.qc(d);
|
||||
return 1==d.length&&d[0].unknown||b.F.oc(d,"name")?null:"This template engine does not support anonymous templates nested within its templates"};b.h.ba.template=!0})();b.a.Db=(a,c,f)=>{if(a.length&&c.length){var g,k,r,d,e;for(g=k=0;(!f||g<f)&&(d=a[k]);++k){for(r=0;e=c[r];++r)if(d.value===e.value){d.moved=e.index;e.moved=d.index;c.splice(r,1);g=r=0;break}g+=r}}};b.a.yb=(()=>{function a(c,f,g,k,r){var d=Math.min,e=Math.max,h=[],q,p=c.length,t,l=f.length,m=l-p||1,n=p+l+1,u;for(q=0;q<=p;q++){var w=u;
|
||||
h.push(u=[]);var v=d(l,q+m);for(t=e(0,q-1);t<=v;t++)u[t]=t?q?c[q-1]===f[t-1]?w[t-1]:d(w[t]||n,u[t-1]||n)+1:t+1:q+1}d=[];e=[];m=[];q=p;for(t=l;q||t;)l=h[q][t]-1,t&&l===h[q][t-1]?e.push(d[d.length]={status:g,value:f[--t],index:t}):q&&l===h[q-1][t]?m.push(d[d.length]={status:k,value:c[--q],index:q}):(--t,--q,r.sparse||d.push({status:"retained",value:f[t]}));b.a.Db(m,e,!r.dontLimitMoves&&10*p);return d.reverse()}return function(c,f,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];f=f||[];return c.length<
|
||||
f.length?a(c,f,"added","deleted",g):a(f,c,"deleted","added",g)}})();(()=>{function a(g,k,r,d,e){var h=[],q=b.j(()=>{var p=k(r,e,b.a.za(h,g))||[];if(0<h.length){var t=h.nodeType?[h]:h;if(0<t.length){var l=t[0],m=l.parentNode,n;var u=0;for(n=p.length;u<n;u++)m.insertBefore(p[u],l);u=0;for(n=t.length;u<n;u++)b.removeNode(t[u])}d&&b.l.J(d,null,[r,p,e])}h.length=0;h.push(...p)},{i:g,pa:()=>!!h.find(b.a.Ua)});return{L:h,Qa:q.ga()?q:void 0}}var c=b.a.f.V(),f=b.a.f.V();b.a.Ob=(g,k,r,d,e,h)=>{function q(F){x=
|
||||
{ca:F,Ca:b.aa(n++)};l.push(x)}function p(F){x=t[F];x.Ca(n++);b.a.za(x.L,g);l.push(x)}k=k||[];"undefined"==typeof k.length&&(k=[k]);d=d||{};var t=b.a.f.get(g,c),l=[],m=0,n=0,u=[],w=[],v=[],y=0;if(t){if(!h||t&&t._countWaitingForRemove)h=Array.prototype.map.call(t,F=>F.ca),h=b.a.yb(h,k,{dontLimitMoves:d.dontLimitMoves,sparse:!0});for(let F=0,z,G,J;z=h[F];F++)switch(G=z.moved,J=z.index,z.status){case "deleted":for(;m<J;)p(m++);if(void 0===G){var x=t[m];x.Qa&&(x.Qa.m(),x.Qa=void 0);b.a.za(x.L,g).length&&
|
||||
(d.beforeRemove&&(l.push(x),y++,x.ca===f?x=null:v[x.Ca.G()]=x),x&&u.push.apply(u,x.L))}m++;break;case "added":for(;n<J;)p(m++);void 0!==G?(w.push(l.length),p(G)):q(z.value)}for(;n<k.length;)p(m++);l._countWaitingForRemove=y}else k.forEach(q);b.a.f.set(g,c,l);u.forEach(d.beforeRemove?b.ea:b.removeNode);var C,H;y=g.ownerDocument.activeElement;if(w.length)for(;void 0!=(k=w.shift());){x=l[k];for(C=void 0;k;)if((H=l[--k].L)&&H.length){C=H[H.length-1];break}for(m=0;u=x.L[m];C=u,m++)b.h.Fb(g,u,C)}for(k=
|
||||
0;x=l[k];k++){x.L||b.a.extend(x,a(g,r,x.ca,e,x.Ca));for(m=0;u=x.L[m];C=u,m++)b.h.Fb(g,u,C);!x.kc&&e&&(e(x.ca,x.L,x.Ca),x.kc=!0,C=x.L[x.L.length-1])}y&&g.ownerDocument.activeElement!=y&&y.focus();(function(F,z){if(F)for(var G=0,J=z.length;G<J;G++)z[G]&&z[G].L.forEach(M=>F(M,G,z[G].ca))})(d.beforeRemove,v);for(k=0;k<v.length;++k)v[k]&&(v[k].ca=f)}})();A.ko=U})(this);
|
||||
(A=>{function E(a,c){return null===a||ba[typeof a]?a===c:!1}function D(a,c){var d;return()=>{d||(d=setTimeout(()=>{d=0;a()},c))}}function I(a,c){var d;return()=>{clearTimeout(d);d=setTimeout(a,c)}}function P(a,c){null!==c&&c.m&&c.m()}function T(a,c){var d=this.Xb,e=d[B];e.Y||(this.Ra&&this.xa[c]?(d.qb(c,a,this.xa[c]),this.xa[c]=null,--this.Ra):e.s[c]||d.qb(c,a,e.u?{S:a}:d.Ob(a)),a.ia&&a.Tb())}var Q=A.document,U={},b="undefined"!==typeof U?U:{};b.o=(a,c)=>{a=a.split(".");for(var d=b,e=0;e<a.length-
|
||||
1;e++)d=d[a[e]];d[a[a.length-1]]=c};b.X=(a,c,d)=>{a[c]=d};b.o("version","3.5.1-sm");b.a={extend:(a,c)=>{c&&Object.entries(c).forEach(d=>a[d[0]]=d[1]);return a},K:(a,c)=>a&&Object.entries(a).forEach(d=>c(d[0],d[1])),uc:(a,c,d)=>{if(!a)return a;var e={};Object.entries(a).forEach(k=>e[k[0]]=c.call(d,k[1],k[0],a));return e},Va:a=>[...a.childNodes].forEach(c=>b.removeNode(c)),Hb:a=>{a=[...a];var c=(a[0]&&a[0].ownerDocument||Q).createElement("div");a.forEach(d=>c.append(b.da(d)));return c},wa:(a,c)=>Array.prototype.map.call(a,
|
||||
c?d=>b.da(d.cloneNode(!0)):d=>d.cloneNode(!0)),sa:(a,c)=>{b.a.Va(a);c&&a.append(...c)},ya:(a,c)=>{if(a.length){for(c=8===c.nodeType&&c.parentNode||c;a.length&&a[0].parentNode!==c;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==c;)--a.length;if(1<a.length){c=a[0];var d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),c=c.nextSibling;a.push(d)}}return a},Nb:a=>null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Zb:(a,c)=>c.contains(1!==a.nodeType?a.parentNode:a),Ua:a=>
|
||||
b.a.Zb(a,a.ownerDocument.documentElement),Qb:(a,c)=>{if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(c))},g:a=>b.N(a)?a():a,eb:(a,c)=>a.textContent=b.a.g(c)||""};b.o("utils",b.a);b.o("unwrap",b.a.g);(()=>{let a=0,c="__ko__"+Date.now(),d=new WeakMap;b.a.f={get:(e,k)=>(d.get(e)||{})[k],set:(e,k,r)=>{if(d.has(e))d.get(e)[k]=r;else{let g={};g[k]=r;d.set(e,g)}return r},Xa:function(e,k,r){return this.get(e,k)||this.set(e,k,r)},clear:e=>d.delete(e),
|
||||
U:()=>a++ +c}})();b.a.H=(()=>{var a=b.a.f.U(),c={1:1,8:1,9:1},d={1:1,9:1};const e=(g,f)=>{var h=b.a.f.get(g,a);f&&!h&&(h=new Set,b.a.f.set(g,a,h));return h},k=g=>{var f=e(g);f&&(new Set(f)).forEach(h=>h(g));b.a.f.clear(g);d[g.nodeType]&&r(g.childNodes,!0)},r=(g,f)=>{for(var h=[],q,p=0;p<g.length;p++)if(!f||8===g[p].nodeType)if(k(h[h.length]=q=g[p]),g[p]!==q)for(;p--&&!h.includes(g[p]););};return{la:(g,f)=>{if("function"!=typeof f)throw Error("Callback must be a function");e(g,1).add(f)},cb:(g,f)=>
|
||||
{var h=e(g);h&&(h.delete(f),h.size||b.a.f.set(g,a,null))},da:g=>{b.l.M(()=>{c[g.nodeType]&&(k(g),d[g.nodeType]&&r(g.getElementsByTagName("*")))});return g},removeNode:g=>{b.da(g);g.parentNode&&g.parentNode.removeChild(g)}}})();b.da=b.a.H.da;b.removeNode=b.a.H.removeNode;b.o("utils.domNodeDisposal",b.a.H);b.o("utils.domNodeDisposal.addDisposeCallback",b.a.H.la);b.Pb=(()=>{function a(){if(e)for(var f=e,h=0,q;r<e;)if(q=d[r++]){if(r>f){if(5E3<=++h){r=e;setTimeout(()=>{throw Error(`'Too much recursion' after processing ${h} task groups.`);
|
||||
},0);break}f=e}try{q()}catch(p){setTimeout(()=>{throw p;},0)}}}function c(){a();r=e=d.length=0}var d=[],e=0,k=1,r=0,g=(f=>{var h=Q.createElement("div");(new MutationObserver(f)).observe(h,{attributes:!0});return()=>h.classList.toggle("foo")})(c);return{Lb:f=>{e||g(c);d[e++]=f;return k++},cancel:f=>{f-=k-e;f>=r&&f<e&&(d[f]=null)}}})();b.Wa={debounce:(a,c)=>a.Fa(d=>I(d,c)),rateLimit:(a,c)=>{if("number"==typeof c)var d=c;else{d=c.timeout;var e=c.method}var k="function"==typeof e?e:D;a.Fa(r=>k(r,d,c))},
|
||||
notify:(a,c)=>{a.equalityComparer="always"==c?null:E}};var ba={undefined:1,"boolean":1,number:1,string:1};b.o("extenders",b.Wa);class ca{constructor(a,c,d){this.S=a;this.kb=c;this.na=d;this.La=!1;this.B=this.V=null;b.X(this,"dispose",this.m);b.X(this,"disposeWhenNodeIsRemoved",this.i)}m(){this.La||(this.B&&b.a.H.cb(this.V,this.B),this.La=!0,this.na(),this.S=this.kb=this.na=this.V=this.B=null)}i(a){this.V=a;b.a.H.la(a,this.B=this.m.bind(this))}}b.P=function(){Object.setPrototypeOf(this,L);L.Ca(this)};
|
||||
var L={Ca:a=>{a.R=new Map;a.R.set("change",new Set);a.pb=1},subscribe:function(a,c,d){var e=this;d=d||"change";var k=new ca(e,c?a.bind(c):a,()=>{e.R.get(d).delete(k);e.ua&&e.ua(d)});e.ma&&e.ma(d);e.R.has(d)||e.R.set(d,new Set);e.R.get(d).add(k);return k},notifySubscribers:function(a,c){c=c||"change";"change"===c&&this.Ia();if(this.qa(c)){c="change"===c&&this.Rb||new Set(this.R.get(c));try{b.l.ub(),c.forEach(d=>{d.La||d.kb(a)})}finally{b.l.end()}}},Aa:function(){return this.pb},dc:function(a){return this.Aa()!==
|
||||
a},Ia:function(){++this.pb},Fa:function(a){var c=this,d=b.N(c),e,k,r,g,f;c.ta||(c.ta=c.notifySubscribers,c.notifySubscribers=function(q,p){p&&"change"!==p?"beforeChange"===p?this.mb(q):this.ta(q,p):this.nb(q)});var h=a(()=>{c.ia=!1;d&&g===c&&(g=c.lb?c.lb():c());var q=k||f&&c.Ea(r,g);f=k=e=!1;q&&c.ta(r=g)});c.nb=(q,p)=>{p&&c.ia||(f=!p);c.Rb=new Set(c.R.get("change"));c.ia=e=!0;g=q;h()};c.mb=q=>{e||(r=q,c.ta(q,"beforeChange"))};c.ob=()=>{f=!0};c.Tb=()=>{c.Ea(r,c.F(!0))&&(k=!0)}},qa:function(a){return(this.R.get(a)||
|
||||
[]).size},Ea:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:()=>"[object Object]",extend:function(a){var c=this;a&&b.a.K(a,(d,e)=>{d=b.Wa[d];"function"==typeof d&&(c=d(c,e)||c)});return c}};b.X(L,"init",L.Ca);b.X(L,"subscribe",L.subscribe);b.X(L,"extend",L.extend);Object.setPrototypeOf(L,Function.prototype);b.P.fn=L;b.hc=a=>null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers;(()=>{var a=[],c,d=0;b.l={ub:e=>{a.push(c);c=e},end:()=>c=a.pop(),
|
||||
Kb:e=>{if(c){if(!b.hc(e))throw Error("Only subscribable things can act as dependencies");c.Vb.call(c.Wb,e,e.Sb||(e.Sb=++d))}},M:(e,k,r)=>{try{return a.push(c),c=void 0,e.apply(k,r||[])}finally{c=a.pop()}},za:()=>c&&c.j.za(),Za:()=>c&&c.Za,j:()=>c&&c.j}})();const K=Symbol("_latestValue");b.$=a=>{function c(){if(0<arguments.length)return c.Ea(c[K],arguments[0])&&(c.ib(),c[K]=arguments[0],c.Ja()),this;b.l.Kb(c);return c[K]}c[K]=a;Object.defineProperty(c,"length",{get:()=>null==c[K]?void 0:c[K].length});
|
||||
b.P.fn.Ca(c);Object.setPrototypeOf(c,N);return c};var N={toJSON:function(){let a=this[K];return a&&a.toJSON?a.toJSON():a},equalityComparer:E,F:function(){return this[K]},Ja:function(){this.notifySubscribers(this[K],"spectate");this.notifySubscribers(this[K])},ib:function(){this.notifySubscribers(this[K],"beforeChange")}};Object.setPrototypeOf(N,b.P.fn);var O=b.$.B="__ko_proto__";N[O]=b.$;b.N=a=>{if((a="function"==typeof a&&a[O])&&a!==N[O]&&a!==b.j.fn[O])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
|
||||
return!!a};b.ic=a=>"function"==typeof a&&(a[O]===N[O]||a[O]===b.j.fn[O]&&a.ec);b.o("observable",b.$);b.o("isObservable",b.N);b.o("observable.fn",N);b.X(N,"valueHasMutated",N.Ja);b.ga=a=>{a=a||[];if("object"!=typeof a||!("length"in a))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");a=b.$(a);Object.setPrototypeOf(a,b.ga.fn);return a.extend({trackArrayChanges:!0})};b.ga.fn={remove:function(a){for(var c=this.F(),d=!1,e="function"!=typeof a||
|
||||
b.N(a)?g=>g===a:a,k=c.length;k--;){var r=c[k];if(e(r)){if(c[k]!==r)throw Error("Array modified during remove; cannot remove item");d||this.ib();d=!0;c.splice(k,1)}}d&&this.Ja()}};Object.setPrototypeOf(b.ga.fn,b.$.fn);Object.getOwnPropertyNames(Array.prototype).forEach(a=>{"function"===typeof Array.prototype[a]&&"constructor"!=a&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(a)?b.ga.fn[a]=function(...c){var d=this.F();this.ib();this.wb(d,a,c);c=d[a](...c);this.Ja();
|
||||
return c===d?this:c}:b.ga.fn[a]=function(...c){return this()[a](...c)})});b.Fb=a=>b.N(a)&&"function"==typeof a.remove&&"function"==typeof a.push;b.o("observableArray",b.ga);b.o("isObservableArray",b.Fb);b.Wa.trackArrayChanges=(a,c)=>{function d(){function t(){if(f){var l=[].concat(a.F()||[]);if(a.qa("arrayChange")){if(!k||1<f)k=b.a.xb(h,l,a.Oa);var m=k}h=l;k=null;f=0;m&&m.length&&a.notifySubscribers(m,"arrayChange")}}e?t():(e=!0,g=a.subscribe(()=>++f,null,"spectate"),h=[].concat(a.F()||[]),k=null,
|
||||
r=a.subscribe(t))}a.Oa={};c&&"object"==typeof c&&b.a.extend(a.Oa,c);a.Oa.sparse=!0;if(!a.wb){var e=!1,k=null,r,g,f=0,h,q=a.ma,p=a.ua;a.ma=t=>{q&&q.call(a,t);"arrayChange"===t&&d()};a.ua=t=>{p&&p.call(a,t);"arrayChange"!==t||a.qa("arrayChange")||(r&&r.m(),g&&g.m(),g=r=null,e=!1,h=void 0)};a.wb=(t,l,m)=>{function n(H,F,z){return u[u.length]={status:H,value:F,index:z}}if(e&&!f){var u=[],w=t.length,v=m.length,y=0;switch(l){case "push":y=w;case "unshift":for(t=0;t<v;t++)n("added",m[t],y+t);break;case "pop":y=
|
||||
w-1;case "shift":w&&n("deleted",t[y],y);break;case "splice":y=Math.min(Math.max(0,0>m[0]?w+m[0]:m[0]),w);w=1===v?w:Math.min(y+(m[1]||0),w);v=y+v-2;l=Math.max(w,v);var x=[],C=[];for(let H=y,F=2;H<l;++H,++F)H<w&&C.push(n("deleted",t[H],H)),H<v&&x.push(n("added",m[F],H));b.a.Cb(C,x);break;default:return}k=u}}}};var B=Symbol("_state");b.j=(a,c)=>{function d(){if(0<arguments.length){if("function"!==typeof e)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.");
|
||||
e(...arguments);return this}k.Y||b.l.Kb(d);(k.T||k.u&&d.ra())&&d.O();return k.I}"object"===typeof a?c=a:(c=c||{},a&&(c.read=a));if("function"!=typeof c.read)throw Error("Pass a function that returns the value of the ko.computed");var e=c.write,k={I:void 0,Z:!0,T:!0,Da:!1,gb:!1,Y:!1,bb:!1,u:!1,Jb:c.read,i:c.disposeWhenNodeIsRemoved||c.i||null,oa:c.disposeWhen||c.oa,Ta:null,s:{},G:0,Bb:null};d[B]=k;d.ec="function"===typeof e;b.P.fn.Ca(d);Object.setPrototypeOf(d,R);c.pure?(k.bb=!0,k.u=!0,b.a.extend(d,
|
||||
da)):c.deferEvaluation&&b.a.extend(d,ea);k.i&&(k.gb=!0,k.i.nodeType||(k.i=null));k.u||c.deferEvaluation||d.O();k.i&&d.fa()&&b.a.H.la(k.i,k.Ta=()=>{d.m()});return d};var R={equalityComparer:E,za:function(){return this[B].G},bc:function(){var a=[];b.a.K(this[B].s,(c,d)=>a[d.ja]=d.S);return a},Ya:function(a){if(!this[B].G)return!1;var c=this.bc();return c.includes(a)||!!c.find(d=>d.Ya&&d.Ya(a))},qb:function(a,c,d){if(this[B].bb&&c===this)throw Error("A 'pure' computed must not be called recursively");
|
||||
this[B].s[a]=d;d.ja=this[B].G++;d.ka=c.Aa()},ra:function(){var a,c=this[B].s;for(a in c)if(Object.prototype.hasOwnProperty.call(c,a)){var d=c[a];if(this.ha&&d.S.ia||d.S.dc(d.ka))return!0}},tc:function(){this.ha&&!this[B].Da&&this.ha(!1)},fa:function(){var a=this[B];return a.T||0<a.G},vc:function(){this.ia?this[B].T&&(this[B].Z=!0):this.Ab()},Ob:function(a){return a.subscribe(this.Ab,this)},Ab:function(){var a=this,c=a.throttleEvaluation;c&&0<=c?(clearTimeout(this[B].Bb),this[B].Bb=setTimeout(()=>
|
||||
a.O(!0),c)):a.ha?a.ha(!0):a.O(!0)},O:function(a){var c=this[B],d=c.oa,e=!1;if(!c.Da&&!c.Y){if(c.i&&!b.a.Ua(c.i)||d&&d()){if(!c.gb){this.m();return}}else c.gb=!1;c.Da=!0;try{e=this.$b(a)}finally{c.Da=!1}return e}},$b:function(a){var c=this[B],d=c.bb?void 0:!c.G;var e={Xb:this,xa:c.s,Ra:c.G};b.l.ub({Wb:e,Vb:T,j:this,Za:d});c.s={};c.G=0;a:{try{var k=c.Jb();break a}finally{b.l.end(),e.Ra&&!c.u&&b.a.K(e.xa,P),c.Z=c.T=!1}k=void 0}c.G?e=this.Ea(c.I,k):(this.m(),e=!0);e&&(c.u?this.Ia():this.notifySubscribers(c.I,
|
||||
"beforeChange"),c.I=k,this.notifySubscribers(c.I,"spectate"),!c.u&&a&&this.notifySubscribers(c.I),this.ob&&this.ob());d&&this.notifySubscribers(c.I,"awake");return e},F:function(a){var c=this[B];(c.T&&(a||!c.G)||c.u&&this.ra())&&this.O();return c.I},Fa:function(a){b.P.fn.Fa.call(this,a);this.lb=function(){this[B].u||(this[B].Z?this.O():this[B].T=!1);return this[B].I};this.ha=function(c){this.mb(this[B].I);this[B].T=!0;c&&(this[B].Z=!0);this.nb(this,!c)}},m:function(){var a=this[B];!a.u&&a.s&&b.a.K(a.s,
|
||||
(c,d)=>d.m&&d.m());a.i&&a.Ta&&b.a.H.cb(a.i,a.Ta);a.s=void 0;a.G=0;a.Y=!0;a.Z=!1;a.T=!1;a.u=!1;a.i=void 0;a.oa=void 0;a.Jb=void 0}},da={ma:function(a){var c=this,d=c[B];if(!d.Y&&d.u&&"change"==a){d.u=!1;if(d.Z||c.ra())d.s=null,d.G=0,c.O()&&c.Ia();else{var e=[];b.a.K(d.s,(k,r)=>e[r.ja]=k);e.forEach((k,r)=>{var g=d.s[k],f=c.Ob(g.S);f.ja=r;f.ka=g.ka;d.s[k]=f});c.ra()&&c.O()&&c.Ia()}d.Y||c.notifySubscribers(d.I,"awake")}},ua:function(a){var c=this[B];c.Y||"change"!=a||this.qa("change")||(b.a.K(c.s,(d,
|
||||
e)=>{e.m&&(c.s[d]={S:e.S,ja:e.ja,ka:e.ka},e.m())}),c.u=!0,this.notifySubscribers(void 0,"asleep"))},Aa:function(){var a=this[B];a.u&&(a.Z||this.ra())&&this.O();return b.P.fn.Aa.call(this)}},ea={ma:function(a){"change"!=a&&"beforeChange"!=a||this.F()}};Object.setPrototypeOf(R,b.P.fn);R[b.$.B]=b.j;b.o("computed",b.j);b.o("computed.fn",R);b.X(R,"dispose",R.m);b.nc=a=>{if("function"===typeof a)return b.j(a,{pure:!0});a=b.a.extend({},a);a.pure=!0;return b.j(a)};(()=>{b.v={L:a=>{switch(a.nodeName){case "OPTION":return!0===
|
||||
a.__ko__hasDomDataOptionValue__?b.a.f.get(a,b.b.options.ab):a.value;case "SELECT":return 0<=a.selectedIndex?b.v.L(a.options[a.selectedIndex]):void 0;default:return a.value}},Ka:(a,c,d)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.f.set(a,b.b.options.ab,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.f.set(a,b.b.options.ab,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var e=-1,k=""===c||null==c,r=0,g=a.options.length,f;r<
|
||||
g;++r)if(f=b.v.L(a.options[r]),f==c||""===f&&k){e=r;break}if(d||0<=e||k&&1<a.size)a.selectedIndex=e;break;default:a.value=null==c?"":c}}}})();b.D=(()=>{function a(f){f=b.a.Nb(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],q=f.match(e),p=[],t=0;if(1<q.length){for(var l=0,m;m=q[l++];){var n=m.charCodeAt(0);if(44===n){if(0>=t){h.push(u&&p.length?{key:u,value:p.join("")}:{unknown:u||p.join("")});var u=t=0;p=[];continue}}else if(58===n){if(!t&&!u&&1===p.length){u=p.pop();continue}}else if(47===
|
||||
n&&1<m.length&&(47===m.charCodeAt(1)||42===m.charCodeAt(1)))continue;else 47===n&&l&&1<m.length?(n=q[l-1].match(k))&&!r[n[0]]&&(f=f.substr(f.indexOf(m)+1),q=f.match(e),l=-1,m="/"):40===n||123===n||91===n?++t:41===n||125===n||93===n?--t:u||p.length||34!==n&&39!==n||(m=m.slice(1,-1));p.push(m)}if(0<t)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true","false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,e=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,
|
||||
k=/[\])"'A-Za-z0-9_$]+$/,r={"in":1,"return":1,"typeof":1},g=new Set;return{Na:[],hb:g,lc:a,mc:function(f,h){function q(n,u){if(!m){var w=b.b[n];if(w&&w.preprocess&&!(u=w.preprocess(u,n,q)))return;if(w=g.has(n)){var v=u;c.includes(v)?v=!1:(w=v.match(d),v=null===w?!1:w[1]?"Object("+w[1]+")"+w[2]:v);w=v}w&&t.push("'"+n+"':function(_z){"+v+"=_z}")}l&&(u="function(){return "+u+" }");p.push("'"+n+"':"+u)}h=h||{};var p=[],t=[],l=h.valueAccessors,m=h.bindingParams;("string"===typeof f?a(f):f).forEach(n=>
|
||||
q(n.key||n.unknown,n.value));t.length&&q("_ko_property_writers","{"+t.join(",")+" }");return p.join(",")},jc:(f,h)=>-1<f.findIndex(q=>q.key==h),jb:(f,h,q,p,t)=>{if(f&&b.N(f))!b.ic(f)||t&&f.F()===p||f(p);else if((f=h.get("_ko_property_writers"))&&f[q])f[q](p)}}})();(()=>{function a(g){return 8==g.nodeType&&e.test(g.nodeValue)}function c(g){return 8==g.nodeType&&k.test(g.nodeValue)}function d(g,f){for(var h=g,q=1,p=[];h=h.nextSibling;){if(c(h)&&(b.a.f.set(h,r,!0),!--q))return p;p.push(h);a(h)&&++q}if(!f)throw Error("Cannot find closing comment tag to match: "+
|
||||
g.nodeValue);return null}var e=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,r="__ko_matchedEndComment__";b.h={aa:{},childNodes:g=>a(g)?d(g):g.childNodes,pa:g=>{a(g)?(g=d(g))&&[...g].forEach(f=>b.removeNode(f)):b.a.Va(g)},sa:(g,f)=>{a(g)?(b.h.pa(g),g.after(...f)):b.a.sa(g,f)},prepend:(g,f)=>{a(g)?g.nextSibling.before(f):g.prepend(f)},Eb:(g,f,h)=>{h?h.after(f):b.h.prepend(g,f)},firstChild:g=>{if(a(g))return g=g.nextSibling,!g||c(g)?null:g;let f=g.firstChild;if(f&&c(f))throw Error("Found invalid end comment, as the first child of "+
|
||||
g);return f},nextSibling:g=>{if(a(g)){var f=d(g,void 0);g=f?(f.length?f[f.length-1]:g).nextSibling:null}if((f=g.nextSibling)&&c(f)){if(c(f)&&!b.a.f.get(f,r))throw Error("Found end comment without a matching opening comment, as child of "+g);return null}return f},cc:a,rc:g=>(g=g.nodeValue.match(e))?g[1]:null}})();(()=>{const a=new Map;b.vb=new class{kc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return b.h.cc(c);default:return!1}}ac(c,d){a:{switch(c.nodeType){case 1:var e=
|
||||
c.getAttribute("data-bind");break a;case 8:e=b.h.rc(c);break a}e=null}if(e)try{let r={valueAccessors:!0},g=a.get(e);if(!g){var k="with($context){with($data||{}){return{"+b.D.mc(e,r)+"}}}";g=new Function("$context","$element",k);a.set(e,g)}return g(d,c)}catch(r){throw r.message="Unable to parse bindings.\nBindings value: "+e+"\nMessage: "+r.message,r;}return null}}})();(()=>{function a(l){var m=(l=b.a.f.get(l,p))&&l.C;m&&(l.C=null,m.Ib())}function c(l,m){for(var n,u=b.h.firstChild(m);n=u;)u=b.h.nextSibling(n),
|
||||
d(l,n);b.c.notify(m,b.c.A)}function d(l,m){var n=l;if(1===m.nodeType||b.vb.kc(m))n=k(m,null,l).bindingContextForDescendants;n&&m.matches&&!m.matches("SCRIPT,TEXTAREA,TEMPLATE")&&c(n,m)}function e(l){var m=[],n={},u=[];b.a.K(l,function y(v){if(!n[v]){var x=b.b[v];x&&(x.after&&(u.push(v),x.after.forEach(C=>{if(l[C]){if(u.includes(C))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+u.join(", "));y(C)}}),u.length--),m.push({key:v,Db:x}));n[v]=!0}});return m}
|
||||
function k(l,m,n){var u=b.a.f.Xa(l,p,{}),w=u.Ub;if(!m){if(w)throw Error("You cannot apply bindings multiple times to the same element.");u.Ub=!0}w||(u.context=n);u.$a||(u.$a={});if(m&&"function"!==typeof m)var v=m;else{var y=b.j(()=>{if(v=m?m(n,l):b.vb.ac(l,n)){if(n[g])n[g]();if(n[h])n[h]()}return v},{i:l});v&&y.fa()||(y=null)}var x=n,C;if(v){var H=y?z=>()=>y()[z]():z=>v[z],F={get:z=>v[z]&&H(z)(),has:z=>z in v};b.c.A in v&&b.c.subscribe(l,b.c.A,()=>{var z=v[b.c.A]();if(z){var G=b.h.childNodes(l);
|
||||
G.length&&z(G,b.zb(G[0]))}});b.c.W in v&&(x=b.c.fb(l,n),b.c.subscribe(l,b.c.W,()=>{var z=v[b.c.W]();z&&b.h.firstChild(l)&&z(l)}));e(v).forEach(z=>{var G=z.Db.init,J=z.Db.update,M=z.key;if(8===l.nodeType&&!b.h.aa[M])throw Error("The binding '"+M+"' cannot be used with virtual elements");try{"function"==typeof G&&b.l.M(()=>{var S=G(l,H(M),F,x.$data,x);if(S&&S.controlsDescendantBindings){if(void 0!==C)throw Error("Multiple bindings ("+C+" and "+M+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
|
||||
C=M}}),"function"==typeof J&&b.j(()=>J(l,H(M),F,x.$data,x),{i:l})}catch(S){throw S.message='Unable to process binding "'+M+": "+v[M]+'"\nMessage: '+S.message,S;}})}u=void 0===C;return{shouldBindDescendants:u,bindingContextForDescendants:u&&x}}function r(l,m){return l&&l instanceof b.ca?l:new b.ca(l,void 0,void 0,m)}var g=Symbol("_subscribable"),f=Symbol("_ancestorBindingInfo"),h=Symbol("_dataDependency");b.b={};var q={};b.ca=class{constructor(l,m,n,u,w){function v(){var G=H?C():C,J=b.a.g(G);m?(b.a.extend(y,
|
||||
m),f in m&&(y[f]=m[f])):(y.$parents=[],y.$root=J,y.ko=b);y[g]=z;x?J=y.$data:(y.$rawData=G,y.$data=J);n&&(y[n]=J);u&&u(y,m,J);if(m&&m[g]&&!b.l.j().Ya(m[g]))m[g]();F&&(y[h]=F);return y.$data}var y=this,x=l===q,C=x?void 0:l,H="function"==typeof C&&!b.N(C),F=w&&w.dataDependency;if(w&&w.exportDependencies)v();else{var z=b.nc(v);z.F();z.fa()?z.equalityComparer=null:y[g]=void 0}}["createChildContext"](l,m,n,u){!u&&m&&"object"==typeof m&&(u=m,m=u.as,n=u.extend);return new b.ca(l,this,m,(w,v)=>{w.$parentContext=
|
||||
v;w.$parent=v.$data;w.$parents=(v.$parents||[]).slice(0);w.$parents.unshift(w.$parent);n&&n(w)},u)}["extend"](l,m){return new b.ca(q,this,null,n=>b.a.extend(n,"function"==typeof l?l(n):l),m)}};var p=b.a.f.U();class t{constructor(l,m,n){this.B=l;this.na=m;this.va=new Set;this.A=!1;m.C||b.a.H.la(l,a);n&&n.C&&(n.C.va.add(l),this.V=n)}Ib(){this.V&&this.V.C&&this.V.C.Yb(this.B)}Yb(l){this.va.delete(l);!this.va.size&&this.A&&this.yb()}yb(){this.A=!0;this.na.C&&!this.va.size&&(this.na.C=null,b.a.H.cb(this.B,
|
||||
a),b.c.notify(this.B,b.c.W),this.Ib())}}b.c={A:"childrenComplete",W:"descendantsComplete",subscribe:(l,m,n,u,w)=>{var v=b.a.f.Xa(l,p,{});v.ea||(v.ea=new b.P);w&&w.notifyImmediately&&v.$a[m]&&b.l.M(n,u,[l]);return v.ea.subscribe(n,u,m)},notify:(l,m)=>{var n=b.a.f.get(l,p);if(n&&(n.$a[m]=!0,n.ea&&n.ea.notifySubscribers(l,m),m==b.c.A))if(n.C)n.C.yb();else if(void 0===n.C&&n.ea&&n.ea.qa(b.c.W))throw Error("descendantsComplete event not supported for bindings on this node");},fb:(l,m)=>{var n=b.a.f.Xa(l,
|
||||
p,{});n.C||(n.C=new t(l,n,m[f]));return m[f]==n?m:m.extend(u=>{u[f]=n})}};b.qc=l=>(l=b.a.f.get(l,p))&&l.context;b.rb=(l,m,n)=>k(l,m,r(n));b.tb=(l,m)=>{1!==m.nodeType&&8!==m.nodeType||c(r(l),m)};b.sb=function(l,m,n){if(2>arguments.length){if(m=Q.body,!m)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!m||1!==m.nodeType&&8!==m.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
|
||||
d(r(l,n),m)};b.zb=l=>(l=l&&[1,8].includes(l.nodeType)&&b.qc(l))?l.$data:void 0;b.o("bindingHandlers",b.b);b.o("applyBindings",b.sb);b.o("applyBindingAccessorsToNode",b.rb);b.o("dataFor",b.zb)})();(()=>{function a(f,h){var q={},p=r[f]||{},t=p.template;p=p.viewModel;if(t){t.element||c(f,"Unknown template value: "+t);t=t.element;var l=Q.getElementById(t);l||c(f,"Cannot find element with ID "+t);l.matches("TEMPLATE")||c(f,"Template Source Element not a <template>");q.template=b.a.wa(l.content.childNodes)}p&&
|
||||
("function"!==typeof p[g]&&c(f,"Unknown viewModel value: "+p),q[g]=p[g]);q.template&&q[g]?h(q):h(null)}function c(f,h){throw Error(`Component '${f}': ${h}`);}function d(f,h){var q=!1;a(f,p=>{(q=null!=p)&&h(p)});q||h(null)}var e=Object.create(null),k=Object.create(null);b.Pa={get:(f,h)=>{var q=k[f];if(q)b.Pb.Lb(()=>h(q.definition));else{var p=e[f];if(p)p.subscribe(h);else{p=e[f]=new b.P;p.subscribe(h);d(f,l=>{k[f]={definition:l};delete e[f];t?p.notifySubscribers(l):b.Pb.Lb(()=>p.notifySubscribers(l))});
|
||||
var t=!0}}},sc:f=>delete k[f],register:(f,h)=>{if(!h)throw Error("Invalid configuration for "+f);if(r[f])throw Error("Component "+f+" is already registered");r[f]=h}};var r=Object.create(null),g="createViewModel";b.o("components",b.Pa);b.o("components.register",b.Pa.register)})();(()=>{function a(e,k,r){k=k.template;if(!k)throw Error("Component '"+e+"' has no template");e=b.a.wa(k);b.h.sa(r,e)}function c(e,k,r){var g=e.createViewModel;return g?g.call(e,k,r):k}var d=0;b.b.component={init:(e,k,r,g,
|
||||
f)=>{var h,q,p,t=()=>{var m=h&&h.dispose;"function"===typeof m&&m.call(h);p&&p.m();q=h=p=null},l=[...b.h.childNodes(e)];b.h.pa(e);b.a.H.la(e,t);b.j(()=>{var m=b.a.g(k());if("string"===typeof m)var n=m;else{n=b.a.g(m.name);var u=b.a.g(m.params)}if(!n)throw Error("No component name specified");var w=b.c.fb(e,f),v=q=++d;b.Pa.get(n,y=>{if(q===v){t();if(!y)throw Error("Unknown component '"+n+"'");a(n,y,e);var x=c(y,u,{element:e,templateNodes:l});y=w.createChildContext(x,{extend:C=>{C.$component=x;C.$componentTemplateNodes=
|
||||
l}});x&&x.koDescendantsComplete&&(p=b.c.subscribe(e,b.c.W,x.koDescendantsComplete,x));h=x;b.tb(y,e)}})},{i:e});return{controlsDescendantBindings:!0}}};b.h.aa.component=!0})();b.b.attr={update:(a,c)=>{c=b.a.g(c())||{};b.a.K(c,function(d,e){e=b.a.g(e);var k=d.indexOf(":");k="lookupNamespaceURI"in a&&0<k&&a.lookupNamespaceURI(d.substr(0,k));var r=!1===e||null==e;r?k?a.removeAttributeNS(k,d):a.removeAttribute(d):e=e.toString();r||(k?a.setAttributeNS(k,d,e):a.setAttribute(d,e));"name"===d&&(a.name=r?"":
|
||||
e)})}};var V=(a,c,d)=>{c&&c.split(/\s+/).forEach(e=>a.classList.toggle(e,d))};b.b.css={update:(a,c)=>{c=b.a.g(c());null!==c&&"object"==typeof c?b.a.K(c,(d,e)=>{e=b.a.g(e);V(a,d,!!e)}):(c=b.a.Nb(c),V(a,a.__ko__cssValue,!1),a.__ko__cssValue=c,V(a,c,!0))}};b.b.enable={update:(a,c)=>{(c=b.a.g(c()))&&a.disabled?a.removeAttribute("disabled"):c||a.disabled||(a.disabled=!0)}};b.b.disable={update:(a,c)=>b.b.enable.update(a,()=>!b.a.g(c()))};b.b.event={init:(a,c,d,e,k)=>{d=c()||{};b.a.K(d,r=>{"string"==typeof r&&
|
||||
a.addEventListener(r,function(g){var f=c()[r];if(f)try{e=k.$data;var h=f.apply(e,[e,...arguments])}finally{!0!==h&&g.preventDefault()}})})}};b.b.foreach={Gb:a=>()=>{var c=a(),d=b.N(c)?c.F():c;if(!d||"number"==typeof d.length)return{foreach:c};b.a.g(c);return{foreach:d.data,as:d.as,beforeRemove:d.beforeRemove}},init:(a,c)=>b.b.template.init(a,b.b.foreach.Gb(c)),update:(a,c,d,e,k)=>b.b.template.update(a,b.b.foreach.Gb(c),d,e,k)};b.D.Na.foreach=!1;b.h.aa.foreach=!0;b.b.hasfocus={init:(a,c,d)=>{var e=
|
||||
r=>{a.__ko_hasfocusUpdating=!0;r=a.ownerDocument.activeElement===a;var g=c();b.D.jb(g,d,"hasfocus",r,!0);a.__ko_hasfocusLastValue=r;a.__ko_hasfocusUpdating=!1},k=e.bind(null,!0);e=e.bind(null,!1);a.addEventListener("focus",k);a.addEventListener("focusin",k);a.addEventListener("blur",e);a.addEventListener("focusout",e);a.__ko_hasfocusLastValue=!1},update:(a,c)=>{c=!!b.a.g(c());a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===c||(c?a.focus():a.blur())}};b.D.hb.add("hasfocus");b.b.html={init:()=>
|
||||
({controlsDescendantBindings:!0}),update:(a,c)=>{b.a.Va(a);c=b.a.g(c());if(null!=c){const d=Q.createElement("template");d.innerHTML="string"!=typeof c?c.toString():c;a.appendChild(d.content)}}};(function(){function a(c,d,e){b.b[c]={init:(k,r,g,f,h)=>{var q,p={};d&&(p={as:g.get("as"),exportDependencies:!0});var t=g.has(b.c.W);b.j(()=>{var l=b.a.g(r()),m=!e!==!l,n=!q;t&&(h=b.c.fb(k,h));if(m){p.dataDependency=b.l.j();var u=d?h.createChildContext("function"==typeof l?l:r,p):b.l.za()?h.extend(null,p):
|
||||
h}n&&b.l.za()&&(q=b.a.wa(b.h.childNodes(k),!0));m?(n||b.h.sa(k,b.a.wa(q)),b.tb(u,k)):(b.h.pa(k),b.c.notify(k,b.c.A))},{i:k});return{controlsDescendantBindings:!0}}};b.D.Na[c]=!1;b.h.aa[c]=!0}a("if");a("ifnot",!1,!0);a("with",!0)})();var W={};b.b.options={init:a=>{if(!a.matches("SELECT"))throw Error("options binding applies only to SELECT elements");for(;0<a.length;)a.remove(0);return{controlsDescendantBindings:!0}},update:(a,c,d)=>{function e(){return Array.from(a.options).filter(n=>n.selected)}function k(n,
|
||||
u,w){var v=typeof u;return"function"==v?u(n):"string"==v?n[u]:w}function r(n,u){l&&q?b.c.notify(a,b.c.A):p.length&&(n=p.includes(b.v.L(u[0])),u[0].selected=n,l&&!n&&b.l.M(b.a.Qb,null,[a,"change"]))}var g=a.multiple,f=0!=a.length&&g?a.scrollTop:null,h=b.a.g(c()),q=d.get("valueAllowUnset")&&d.has("value");c={};var p=[];q||(g?p=e().map(b.v.L):0<=a.selectedIndex&&p.push(b.v.L(a.options[a.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var t=h.filter(n=>n||null==n);d.has("optionsCaption")&&
|
||||
(h=b.a.g(d.get("optionsCaption")),null!==h&&void 0!==h&&t.unshift(W))}var l=!1;c.beforeRemove=n=>a.removeChild(n);h=r;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(h=(n,u)=>{r(n,u);b.l.M(d.get("optionsAfterRender"),null,[u[0],n!==W?n:void 0])});b.a.Mb(a,t,function(n,u,w){w.length&&(p=!q&&w[0].selected?[b.v.L(w[0])]:[],l=!0);u=a.ownerDocument.createElement("option");n===W?(b.a.eb(u,d.get("optionsCaption")),b.v.Ka(u,void 0)):(w=k(n,d.get("optionsValue"),n),b.v.Ka(u,b.a.g(w)),
|
||||
n=k(n,d.get("optionsText"),w),b.a.eb(u,n));return[u]},c,h);if(!q){var m;g?m=p.length&&e().length<p.length:m=p.length&&0<=a.selectedIndex?b.v.L(a.options[a.selectedIndex])!==p[0]:p.length||0<=a.selectedIndex;m&&b.l.M(b.a.Qb,null,[a,"change"])}(q||b.l.Za())&&b.c.notify(a,b.c.A);f&&20<Math.abs(f-a.scrollTop)&&(a.scrollTop=f)}};b.b.options.ab=b.a.f.U();b.b.style={update:(a,c)=>{c=b.a.g(c()||{});b.a.K(c,(d,e)=>{e=b.a.g(e);if(null==e||!1===e)e="";if(/^--/.test(d))a.style.setProperty(d,e);else{d=d.replace(/-(\w)/g,
|
||||
(r,g)=>g.toUpperCase());var k=a.style[d];a.style[d]=e;e===k||a.style[d]!=k||isNaN(e)||(a.style[d]=e+"px")}})}};b.b.submit={init:(a,c,d,e,k)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.addEventListener("submit",r=>{var g=c();try{var f=g.call(k.$data,a)}finally{!0!==f&&(r.preventDefault?r.preventDefault():r.returnValue=!1)}})}};b.b.text={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{8===a.nodeType&&(a.text||a.after(a.text=Q.createTextNode("")),
|
||||
a=a.text);b.a.eb(a,c())}};b.h.aa.text=!0;b.b.textInput={init:(a,c,d)=>{var e=a.value,k,r,g=()=>{clearTimeout(k);r=k=void 0;var h=a.value;e!==h&&(e=h,b.D.jb(c(),d,"textInput",h))},f=()=>{var h=b.a.g(c());null==h&&(h="");void 0!==r&&h===r?setTimeout(f,4):a.value!==h&&(a.value=h,e=a.value)};a.addEventListener("input",g);a.addEventListener("change",g);a.addEventListener("blur",g);b.j(f,{i:a})}};b.D.hb.add("textInput");b.b.textinput={preprocess:(a,c,d)=>d("textInput",a)};b.b.value={init:(a,c,d)=>{var e=
|
||||
a.matches("SELECT"),k=a.matches("INPUT");if(!k||"checkbox"!=a.type&&"radio"!=a.type){var r=new Set,g=d.get("valueUpdate"),f=null;g&&("string"==typeof g?r.add(g):g.forEach(t=>r.add(t)),r.delete("change"));var h=()=>{f=null;var t=c(),l=b.v.L(a);b.D.jb(t,d,"value",l)};r.forEach(t=>{var l=h;(t||"").startsWith("after")&&(l=()=>{f=b.v.L(a);setTimeout(h,0)},t=t.substring(5));a.addEventListener(t,l)});var q=k&&"file"==a.type?()=>{var t=b.a.g(c());null==t||""===t?a.value="":b.l.M(h)}:()=>{var t=b.a.g(c()),
|
||||
l=b.v.L(a);if(null!==f&&t===f)setTimeout(q,0);else if(t!==l||void 0===l)e?(l=d.get("valueAllowUnset"),b.v.Ka(a,t,l),l||t===b.v.L(a)||b.l.M(h)):b.v.Ka(a,t)};if(e){var p;b.c.subscribe(a,b.c.A,()=>{p?d.get("valueAllowUnset")?q():h():(a.addEventListener("change",h),p=b.j(q,{i:a}))},null,{notifyImmediately:!0})}else a.addEventListener("change",h),b.j(q,{i:a})}else b.rb(a,{checkedValue:c})},update:()=>{}};b.D.hb.add("value");b.b.visible={update:(a,c)=>{c=b.a.g(c());var d="none"!=a.style.display;c&&!d?a.style.display=
|
||||
"":d&&!c&&(a.style.display="none")}};b.b.hidden={update:(a,c)=>a.hidden=!!b.a.g(c())};(function(a){b.b[a]={init:function(c,d,e,k,r){return b.b.event.init.call(this,c,()=>({[a]:d()}),e,k,r)}}})("click");(()=>{let a=b.a.f.U();class c{constructor(e){this.Sa=e}Ga(...e){let k=this.Sa;if(!e.length)return b.a.f.get(k,a)||(11===this.B?k.content:1===this.B?k:void 0);b.a.f.set(k,a,e[0])}}class d extends c{constructor(e){super(e);e&&(this.B=e.matches("TEMPLATE")&&e.content?e.content.nodeType:1)}}b.Ha={Sa:d,
|
||||
Ma:c}})();(()=>{function a(g,f){if(g.length){var h=g[0],q=h.parentNode;e(h,g[g.length-1],p=>{1!==p.nodeType&&8!==p.nodeType||b.sb(f,p)});b.a.ya(g,q)}}function c(g,f,h,q){var p=(g&&(g.nodeType?g:0<g.length?g[0]:null)||h||{}).ownerDocument;if("string"==typeof h){p=p||Q;p=p.getElementById(h);if(!p)throw Error("Cannot find template with ID "+h);h=new b.Ha.Sa(p)}else if([1,8].includes(h.nodeType))h=new b.Ha.Ma(h);else throw Error("Unknown template type: "+h);h=(h=h.Ga?h.Ga():null)?[...h.cloneNode(!0).childNodes]:
|
||||
null;if("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(f){case "replaceChildren":b.h.sa(g,h);p=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+f);}p&&(a(h,q),"replaceChildren"==f&&b.c.notify(g,b.c.A));return h}function d(g,f,h){return b.N(g)?g():"function"===typeof g?g(f,h):g}var e=(g,f,h)=>{var q;for(f=b.h.nextSibling(f);g&&(q=g)!==f;)g=b.h.nextSibling(q),h(q,g)};
|
||||
b.oc=function(g,f,h,q){h=h||{};var p=p||"replaceChildren";if(q){var t=q.nodeType?q:0<q.length?q[0]:null;return b.j(()=>{var l=f&&f instanceof b.ca?f:new b.ca(f,null,null,null,{exportDependencies:!0}),m=d(g,l.$data,l);c(q,p,m,l,h)},{oa:()=>!t||!b.a.Ua(t),i:t})}console.log("no targetNodeOrNodeArray")};b.pc=(g,f,h,q,p)=>{function t(v,y){b.l.M(b.a.Mb,null,[q,v,n,h,u,y]);b.c.notify(q,b.c.A)}var l,m=h.as,n=(v,y)=>{l=p.createChildContext(v,{as:m,extend:x=>{x.$index=y;m&&(x[m+"Index"]=y)}});v=d(g,v,l);return c(q,
|
||||
"ignoreTargetNode",v,l,h)},u=(v,y)=>{a(y,l);l=null};if(!h.beforeRemove&&b.Fb(f)){t(f.F());var w=f.subscribe(v=>{t(f(),v)},null,"arrayChange");w.i(q);return w}return b.j(()=>{var v=b.a.g(f)||[];"undefined"==typeof v.length&&(v=[v]);t(v)},{i:q})};var k=b.a.f.U(),r=b.a.f.U();b.b.template={init:(g,f)=>{f=b.a.g(f());if("string"==typeof f||"name"in f)b.h.pa(g);else if("nodes"in f){f=f.nodes||[];if(b.N(f))throw Error('The "nodes" option must be a plain, non-observable array.');let h=f[0]&&f[0].parentNode;
|
||||
h&&b.a.f.get(h,r)||(h=b.a.Hb(f),b.a.f.set(h,r,!0));(new b.Ha.Ma(g)).Ga(h)}else if(f=b.h.childNodes(g),0<f.length)f=b.a.Hb(f),(new b.Ha.Ma(g)).Ga(f);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:(g,f,h,q,p)=>{var t=f();f=b.a.g(t);h=!0;q=null;"string"==typeof f?f={}:(t="name"in f?f.name:g,"if"in f&&(h=b.a.g(f["if"])),h&&"ifnot"in f&&(h=!b.a.g(f.ifnot)),h&&!t&&(h=!1));"foreach"in f?q=b.pc(t,h&&f.foreach||[],f,g,p):h?
|
||||
(h=p,"data"in f&&(h=p.createChildContext(f.data,{as:f.as,exportDependencies:!0})),q=b.oc(t,h,f,g)):b.h.pa(g);p=q;(f=b.a.f.get(g,k))&&"function"==typeof f.m&&f.m();b.a.f.set(g,k,!p||p.fa&&!p.fa()?void 0:p)}};b.D.Na.template=g=>{g=b.D.lc(g);return 1==g.length&&g[0].unknown||b.D.jc(g,"name")?null:"This template engine does not support anonymous templates nested within its templates"};b.h.aa.template=!0})();b.a.Cb=(a,c,d)=>{if(a.length&&c.length){var e,k,r,g,f;for(e=k=0;(!d||e<d)&&(g=a[k]);++k){for(r=
|
||||
0;f=c[r];++r)if(g.value===f.value){g.moved=f.index;f.moved=g.index;c.splice(r,1);e=r=0;break}e+=r}}};b.a.xb=(()=>{function a(c,d,e,k,r){var g=Math.min,f=Math.max,h=[],q,p=c.length,t,l=d.length,m=l-p||1,n=p+l+1,u;for(q=0;q<=p;q++){var w=u;h.push(u=[]);var v=g(l,q+m);for(t=f(0,q-1);t<=v;t++)u[t]=t?q?c[q-1]===d[t-1]?w[t-1]:g(w[t]||n,u[t-1]||n)+1:t+1:q+1}g=[];f=[];m=[];q=p;for(t=l;q||t;)l=h[q][t]-1,t&&l===h[q][t-1]?f.push(g[g.length]={status:e,value:d[--t],index:t}):q&&l===h[q-1][t]?m.push(g[g.length]=
|
||||
{status:k,value:c[--q],index:q}):(--t,--q,r.sparse||g.push({status:"retained",value:d[t]}));b.a.Cb(m,f,!r.dontLimitMoves&&10*p);return g.reverse()}return function(c,d,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};c=c||[];d=d||[];return c.length<d.length?a(c,d,"added","deleted",e):a(d,c,"deleted","added",e)}})();(()=>{function a(e,k,r,g,f){var h=[],q=b.j(()=>{var p=k(r,f,b.a.ya(h,e))||[];if(0<h.length){var t=h.nodeType?[h]:h;if(0<t.length){var l=t[0],m=l.parentNode,n;var u=0;for(n=p.length;u<
|
||||
n;u++)m.insertBefore(p[u],l);u=0;for(n=t.length;u<n;u++)b.removeNode(t[u])}g&&b.l.M(g,null,[r,p,f])}h.length=0;h.push(...p)},{i:e,oa:()=>!!h.find(b.a.Ua)});return{J:h,Qa:q.fa()?q:void 0}}var c=b.a.f.U(),d=b.a.f.U();b.a.Mb=(e,k,r,g,f,h)=>{function q(F){x={ba:F,Ba:b.$(n++)};l.push(x)}function p(F){x=t[F];x.Ba(n++);b.a.ya(x.J,e);l.push(x)}k=k||[];"undefined"==typeof k.length&&(k=[k]);g=g||{};var t=b.a.f.get(e,c),l=[],m=0,n=0,u=[],w=[],v=[],y=0;if(t){if(!h||t&&t._countWaitingForRemove)h=Array.prototype.map.call(t,
|
||||
F=>F.ba),h=b.a.xb(h,k,{dontLimitMoves:g.dontLimitMoves,sparse:!0});for(let F=0,z,G,J;z=h[F];F++)switch(G=z.moved,J=z.index,z.status){case "deleted":for(;m<J;)p(m++);if(void 0===G){var x=t[m];x.Qa&&(x.Qa.m(),x.Qa=void 0);b.a.ya(x.J,e).length&&(g.beforeRemove&&(l.push(x),y++,x.ba===d?x=null:v[x.Ba.F()]=x),x&&u.push.apply(u,x.J))}m++;break;case "added":for(;n<J;)p(m++);void 0!==G?(w.push(l.length),p(G)):q(z.value)}for(;n<k.length;)p(m++);l._countWaitingForRemove=y}else k.forEach(q);b.a.f.set(e,c,l);
|
||||
u.forEach(g.beforeRemove?b.da:b.removeNode);var C,H;y=e.ownerDocument.activeElement;if(w.length)for(;void 0!=(k=w.shift());){x=l[k];for(C=void 0;k;)if((H=l[--k].J)&&H.length){C=H[H.length-1];break}for(m=0;u=x.J[m];C=u,m++)b.h.Eb(e,u,C)}for(k=0;x=l[k];k++){x.J||b.a.extend(x,a(e,r,x.ba,f,x.Ba));for(m=0;u=x.J[m];C=u,m++)b.h.Eb(e,u,C);!x.fc&&f&&(f(x.ba,x.J,x.Ba),x.fc=!0,C=x.J[x.J.length-1])}y&&e.ownerDocument.activeElement!=y&&y.focus();(function(F,z){if(F)for(var G=0,J=z.length;G<J;G++)z[G]&&z[G].J.forEach(M=>
|
||||
F(M,G,z[G].ba))})(g.beforeRemove,v);for(k=0;k<v.length;++k)v[k]&&(v[k].ba=d)}})();A.ko=U})(this);
|
||||
|
|
|
|||
165
vendors/knockout/src/components/defaultLoader.js
vendored
165
vendors/knockout/src/components/defaultLoader.js
vendored
|
|
@ -1,165 +0,0 @@
|
|||
(() => {
|
||||
|
||||
// The default loader is responsible for two things:
|
||||
// 1. Maintaining the default in-memory registry of component configuration objects
|
||||
// (i.e., the thing you're writing to when you call ko.components.register(someName, ...))
|
||||
// 2. Answering requests for components by fetching configuration objects
|
||||
// from that default in-memory registry and resolving them into standard
|
||||
// component definition objects (of the form { createViewModel: ..., template: ... })
|
||||
// Custom loaders may override either of these facilities, i.e.,
|
||||
// 1. To supply configuration objects from some other source (e.g., conventions)
|
||||
// 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic.
|
||||
|
||||
var defaultConfigRegistry = {};
|
||||
|
||||
ko.components.register = (componentName, config) => {
|
||||
if (!config) {
|
||||
throw new Error('Invalid configuration for ' + componentName);
|
||||
}
|
||||
|
||||
if (ko.components.isRegistered(componentName)) {
|
||||
throw new Error('Component ' + componentName + ' is already registered');
|
||||
}
|
||||
|
||||
defaultConfigRegistry[componentName] = config;
|
||||
};
|
||||
|
||||
ko.components.isRegistered = componentName =>
|
||||
Object.prototype.hasOwnProperty.call(defaultConfigRegistry, componentName);
|
||||
|
||||
ko.components.unregister = componentName => {
|
||||
delete defaultConfigRegistry[componentName];
|
||||
ko.components.clearCachedDefinition(componentName);
|
||||
};
|
||||
|
||||
ko.components.defaultLoader = {
|
||||
'getConfig': (componentName, callback) => {
|
||||
var result = ko.components.isRegistered(componentName)
|
||||
? defaultConfigRegistry[componentName]
|
||||
: null;
|
||||
callback(result);
|
||||
},
|
||||
|
||||
'loadComponent': (componentName, config, callback) => {
|
||||
var errorCallback = makeErrorCallback(componentName);
|
||||
resolveConfig(componentName, errorCallback, config, callback);
|
||||
},
|
||||
|
||||
'loadTemplate': (componentName, templateConfig, callback) =>
|
||||
resolveTemplate(makeErrorCallback(componentName), templateConfig, callback)
|
||||
,
|
||||
|
||||
'loadViewModel': (componentName, viewModelConfig, callback) =>
|
||||
resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback)
|
||||
};
|
||||
|
||||
var createViewModelKey = 'createViewModel';
|
||||
|
||||
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
|
||||
// into the standard component definition format:
|
||||
// { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.
|
||||
// Since both template and viewModel may need to be resolved asynchronously, both tasks are performed
|
||||
// in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,
|
||||
// so this is implemented manually below.
|
||||
function resolveConfig(componentName, errorCallback, config, callback) {
|
||||
var result = {},
|
||||
makeCallBackWhenZero = 2,
|
||||
tryIssueCallback = () => {
|
||||
if (--makeCallBackWhenZero === 0) {
|
||||
callback(result);
|
||||
}
|
||||
},
|
||||
templateConfig = config['template'],
|
||||
viewModelConfig = config['viewModel'];
|
||||
|
||||
if (templateConfig) {
|
||||
ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, templateConfig], resolvedTemplate => {
|
||||
result['template'] = resolvedTemplate;
|
||||
tryIssueCallback();
|
||||
});
|
||||
} else {
|
||||
tryIssueCallback();
|
||||
}
|
||||
|
||||
if (viewModelConfig) {
|
||||
ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, viewModelConfig], resolvedViewModel => {
|
||||
result[createViewModelKey] = resolvedViewModel;
|
||||
tryIssueCallback();
|
||||
});
|
||||
} else {
|
||||
tryIssueCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function resolveTemplate(errorCallback, templateConfig, callback) {
|
||||
if (templateConfig instanceof Array) {
|
||||
// Assume already an array of DOM nodes - pass through unchanged
|
||||
callback(templateConfig);
|
||||
} else if (templateConfig instanceof DocumentFragment) {
|
||||
// Document fragment - use its child nodes
|
||||
callback([...templateConfig.childNodes]);
|
||||
} else if (templateConfig['element']) {
|
||||
var element = templateConfig['element'];
|
||||
if (element instanceof HTMLElement) {
|
||||
// Element instance - copy its child nodes
|
||||
callback(cloneNodesFromTemplateSourceElement(element));
|
||||
} else if (typeof element === 'string') {
|
||||
// Element ID - find it, then copy its child nodes
|
||||
var elemInstance = document.getElementById(element);
|
||||
if (elemInstance) {
|
||||
callback(cloneNodesFromTemplateSourceElement(elemInstance));
|
||||
} else {
|
||||
errorCallback('Cannot find element with ID ' + element);
|
||||
}
|
||||
} else {
|
||||
errorCallback('Unknown element type: ' + element);
|
||||
}
|
||||
} else {
|
||||
errorCallback('Unknown template value: ' + templateConfig);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveViewModel(errorCallback, viewModelConfig, callback) {
|
||||
if (typeof viewModelConfig === 'function') {
|
||||
// Constructor - convert to standard factory function format
|
||||
// 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(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(() => fixedInstance);
|
||||
} else if ('viewModel' in viewModelConfig) {
|
||||
// Resolved AMD module whose value is of the form { viewModel: ... }
|
||||
resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback);
|
||||
} else {
|
||||
errorCallback('Unknown viewModel value: ' + viewModelConfig);
|
||||
}
|
||||
}
|
||||
|
||||
function cloneNodesFromTemplateSourceElement(elemInstance) {
|
||||
if (elemInstance.matches('TEMPLATE')) {
|
||||
// For browsers with proper <template> element support (i.e., where the .content property
|
||||
// gives a document fragment), use that document fragment.
|
||||
if (elemInstance.content instanceof DocumentFragment) {
|
||||
return ko.utils.cloneNodes(elemInstance.content.childNodes);
|
||||
}
|
||||
}
|
||||
throw 'Template Source Element not a <template>';
|
||||
}
|
||||
|
||||
function makeErrorCallback(componentName) {
|
||||
return message => {
|
||||
throw new Error('Component \'' + componentName + '\': ' + message)
|
||||
};
|
||||
}
|
||||
|
||||
ko.exportSymbol('components.register', ko.components.register);
|
||||
|
||||
// By default, the default loader is the only registered component loader
|
||||
ko.components['loaders'].push(ko.components.defaultLoader);
|
||||
})();
|
||||
221
vendors/knockout/src/components/loaderRegistry.js
vendored
221
vendors/knockout/src/components/loaderRegistry.js
vendored
|
|
@ -1,138 +1,137 @@
|
|||
(() => {
|
||||
var loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight
|
||||
loadedDefinitionsCache = {}; // Tracks component loads that have already completed
|
||||
var loadingSubscribablesCache = Object.create(null), // Tracks component loads that are currently in flight
|
||||
loadedDefinitionsCache = Object.create(null); // Tracks component loads that have already completed
|
||||
|
||||
ko.components = {
|
||||
get: (componentName, callback) => {
|
||||
var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName);
|
||||
var cachedDefinition = 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(() => // See comment in loaderRegistryBehaviors.js for reasoning
|
||||
callback(cachedDefinition.definition)
|
||||
);
|
||||
} else {
|
||||
ko.tasks.schedule(() => callback(cachedDefinition.definition) );
|
||||
}
|
||||
ko.tasks.schedule(() => callback(cachedDefinition.definition) );
|
||||
} else {
|
||||
// Join the loading process that is already underway, or start a new one.
|
||||
loadComponentAndNotify(componentName, callback);
|
||||
var subscribable = loadingSubscribablesCache[componentName],
|
||||
completedAsync;
|
||||
if (subscribable) {
|
||||
subscribable.subscribe(callback);
|
||||
} else {
|
||||
// It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.
|
||||
subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
|
||||
subscribable.subscribe(callback);
|
||||
|
||||
beginLoadingComponent(componentName, definition => {
|
||||
loadedDefinitionsCache[componentName] = { definition: definition };
|
||||
delete loadingSubscribablesCache[componentName];
|
||||
|
||||
// For API consistency, all loads complete asynchronously. However we want to avoid
|
||||
// adding an extra task schedule if it's unnecessary (i.e., the completion is already
|
||||
// async).
|
||||
//
|
||||
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
||||
// flag on your component configuration when you register it.
|
||||
if (completedAsync) {
|
||||
// Note that notifySubscribers ignores any dependencies read within the callback.
|
||||
// See comment in loaderRegistryBehaviors.js for reasoning
|
||||
subscribable['notifySubscribers'](definition);
|
||||
} else {
|
||||
ko.tasks.schedule(() => subscribable['notifySubscribers'](definition));
|
||||
}
|
||||
});
|
||||
completedAsync = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clearCachedDefinition: componentName =>
|
||||
delete loadedDefinitionsCache[componentName]
|
||||
,
|
||||
delete loadedDefinitionsCache[componentName],
|
||||
|
||||
_getFirstResultFromLoaders: getFirstResultFromLoaders
|
||||
register: (componentName, config) => {
|
||||
if (!config) {
|
||||
throw new Error('Invalid configuration for ' + componentName);
|
||||
}
|
||||
|
||||
if (defaultConfigRegistry[componentName]) {
|
||||
throw new Error('Component ' + componentName + ' is already registered');
|
||||
}
|
||||
|
||||
defaultConfigRegistry[componentName] = config;
|
||||
}
|
||||
};
|
||||
|
||||
function getObjectOwnProperty(obj, propName) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, propName) ? obj[propName] : undefined;
|
||||
// The default loader is responsible for two things:
|
||||
// 1. Maintaining the default in-memory registry of component configuration objects
|
||||
// (i.e., the thing you're writing to when you call ko.components.register(someName, ...))
|
||||
// 2. Answering requests for components by fetching configuration objects
|
||||
// from that default in-memory registry and resolving them into standard
|
||||
// component definition objects (of the form { createViewModel: ..., template: ... })
|
||||
// Custom loaders may override either of these facilities, i.e.,
|
||||
// 1. To supply configuration objects from some other source (e.g., conventions)
|
||||
// 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic.
|
||||
|
||||
var defaultConfigRegistry = Object.create(null);
|
||||
var createViewModelKey = 'createViewModel';
|
||||
|
||||
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
|
||||
// into the standard component definition format:
|
||||
// { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.
|
||||
// Since both template and viewModel may need to be resolved asynchronously, both tasks are performed
|
||||
// in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,
|
||||
// so this is implemented manually below.
|
||||
function loadComponent(componentName, callback) {
|
||||
var result = {},
|
||||
config = defaultConfigRegistry[componentName] || {},
|
||||
templateConfig = config['template'],
|
||||
viewModelConfig = config['viewModel'];
|
||||
|
||||
if (templateConfig) {
|
||||
if (!templateConfig['element']) {
|
||||
throwError(componentName, 'Unknown template value: ' + templateConfig);
|
||||
}
|
||||
// Element ID - find it, then copy its child nodes
|
||||
var element = templateConfig['element'];
|
||||
var elemInstance = document.getElementById(element);
|
||||
if (!elemInstance) {
|
||||
throwError(componentName, 'Cannot find element with ID ' + element);
|
||||
}
|
||||
if (!elemInstance.matches('TEMPLATE')) {
|
||||
throwError(componentName, 'Template Source Element not a <template>');
|
||||
}
|
||||
// For browsers with proper <template> element support (i.e., where the .content property
|
||||
// gives a document fragment), use that document fragment.
|
||||
result['template'] = ko.utils.cloneNodes(elemInstance.content.childNodes);
|
||||
}
|
||||
|
||||
if (viewModelConfig) {
|
||||
if (typeof viewModelConfig[createViewModelKey] !== 'function') {
|
||||
throwError(componentName, 'Unknown viewModel value: ' + viewModelConfig);
|
||||
}
|
||||
// Already a factory function - use it as-is
|
||||
result[createViewModelKey] = viewModelConfig[createViewModelKey];
|
||||
}
|
||||
|
||||
if (result['template'] && result[createViewModelKey]) {
|
||||
callback(result);
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
function loadComponentAndNotify(componentName, callback) {
|
||||
var subscribable = getObjectOwnProperty(loadingSubscribablesCache, componentName),
|
||||
completedAsync;
|
||||
if (!subscribable) {
|
||||
// It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.
|
||||
subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
|
||||
subscribable.subscribe(callback);
|
||||
|
||||
beginLoadingComponent(componentName, (definition, config) => {
|
||||
var isSynchronousComponent = !!(config && config['synchronous']);
|
||||
loadedDefinitionsCache[componentName] = { definition: definition, isSynchronousComponent: isSynchronousComponent };
|
||||
delete loadingSubscribablesCache[componentName];
|
||||
|
||||
// For API consistency, all loads complete asynchronously. However we want to avoid
|
||||
// adding an extra task schedule if it's unnecessary (i.e., the completion is already
|
||||
// async).
|
||||
//
|
||||
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
||||
// flag on your component configuration when you register it.
|
||||
if (completedAsync || isSynchronousComponent) {
|
||||
// Note that notifySubscribers ignores any dependencies read within the callback.
|
||||
// See comment in loaderRegistryBehaviors.js for reasoning
|
||||
subscribable['notifySubscribers'](definition);
|
||||
} else {
|
||||
ko.tasks.schedule(() => subscribable['notifySubscribers'](definition));
|
||||
}
|
||||
});
|
||||
completedAsync = true;
|
||||
} else {
|
||||
subscribable.subscribe(callback);
|
||||
}
|
||||
function throwError(componentName, message) {
|
||||
throw new Error(`Component '${componentName}': ${message}`)
|
||||
}
|
||||
|
||||
function beginLoadingComponent(componentName, callback) {
|
||||
getFirstResultFromLoaders('getConfig', [componentName], config => {
|
||||
if (config) {
|
||||
// We have a config, so now load its definition
|
||||
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
|
||||
// process and this callback would not run. For this callback to run, all loaders must
|
||||
// have confirmed they don't know about this component.
|
||||
callback(null, null);
|
||||
}
|
||||
// Try the candidates
|
||||
var found = false;
|
||||
loadComponent(componentName, result => {
|
||||
// This candidate returned a value. Use it.
|
||||
(found = result != null) && callback(result);
|
||||
});
|
||||
}
|
||||
|
||||
function getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders) {
|
||||
// On the first call in the stack, start with the full set of loaders
|
||||
if (!candidateLoaders) {
|
||||
candidateLoaders = ko.components['loaders'].slice(0); // Use a copy, because we'll be mutating this array
|
||||
}
|
||||
|
||||
// Try the next candidate
|
||||
var currentCandidateLoader = candidateLoaders.shift();
|
||||
if (currentCandidateLoader) {
|
||||
var methodInstance = currentCandidateLoader[methodName];
|
||||
if (methodInstance) {
|
||||
var wasAborted = false,
|
||||
synchronousReturnValue = methodInstance.apply(currentCandidateLoader, argsExceptCallback.concat(function(result) {
|
||||
if (wasAborted) {
|
||||
callback(null);
|
||||
} else if (result !== null) {
|
||||
// This candidate returned a value. Use it.
|
||||
callback(result);
|
||||
} else {
|
||||
// Try the next candidate
|
||||
getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
|
||||
}
|
||||
}));
|
||||
|
||||
// Currently, loaders may not return anything synchronously. This leaves open the possibility
|
||||
// that we'll extend the API to support synchronous return values in the future. It won't be
|
||||
// a breaking change, because currently no loader is allowed to return anything except undefined.
|
||||
if (synchronousReturnValue !== undefined) {
|
||||
wasAborted = true;
|
||||
|
||||
// Method to suppress exceptions will remain undocumented. This is only to keep
|
||||
// KO's specs running tidily, since we can observe the loading got aborted without
|
||||
// having exceptions cluttering up the console too.
|
||||
if (!currentCandidateLoader['suppressLoaderExceptions']) {
|
||||
throw new Error('Component loaders must supply values by invoking the callback, not by returning values synchronously.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// This candidate doesn't have the relevant handler. Synchronously move on to the next one.
|
||||
getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
|
||||
}
|
||||
} else {
|
||||
if (!found) {
|
||||
// No candidates returned a value
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
|
||||
// Reference the loaders via string name so it's possible for developers
|
||||
// to replace the whole array by assigning to ko.components.loaders
|
||||
ko.components['loaders'] = [];
|
||||
|
||||
ko.exportSymbol('components', ko.components);
|
||||
ko.exportSymbol('components.register', ko.components.register);
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue