Skip to content

Instantly share code, notes, and snippets.

@austinhyde

austinhyde/README.md

Last active Jun 28, 2020
Embed
What would you like to do?
KO Content Component

Using the changes in Knockout PR #1463, we can make a component that can inject the contents of a parent component into its template:

<my-component>Your name is <span data-bind="name"></span></my-component>
+
<template id="my-component">
  <strong><content></content></strong>
</template>
=
<strong>Your name is <span data-bind="name"></span></strong>

Any component contents will retain the binding context of the component's environment, not the component's context.

If no parent-component contents are found, the contents of the content component itself will be used, in the scope of the component view model.

The content component is also flexible enough to serve as a basic templating mechanism, via the select attribute (or param!) as seen in this example.

Note that the warning about combining bindings with components still holds!

ko.components.register('content', {
viewModel: { createViewModel: function(params, info) {
var selector = info.element.getAttribute('select') || ko.unwrap(params.select);
var selfNodes = info.templateNodes;
return {
getTemplate: function(parentNodes, componentVM, parentVM) {
if (selector) parentNodes = $(parentNodes).filter(selector).get();
if (!parentNodes.length) return { nodes: selfNodes, data: componentVM };
return { nodes: parentNodes, data: parentVM };
}
};
} },
template: '<!-- ko template: getTemplate($parentContext.$componentTemplateNodes, $parent, $parentContext.$parent) --><!-- /ko -->'
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>KO Content Component</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<style>
.modal {
position: static;
display: block;
}
.modal-body {
text-align: center;
}
</style>
</head>
<body>
<!-- ko with: data -->
<modal>
<modal-header><h3 class="modal-title" data-bind="text: title"></h3></modal-header>
<modal-body><img data-bind="attr: { src: url }"></modal-body>
</modal>
<!-- /ko -->
<template id="modal-tmpl">
<div class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<content select="modal-header"></content>
</div>
<div class="modal-body">
<content select="modal-body"></content>
</div>
<div class="modal-footer">
<content select="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Done</button>
</content>
</div>
</div>
</div>
</div>
</template>
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="knockout-latest.js"></script>
<script src="content.js"></script>
<script>
ko.components.register('modal', {template: {element: 'modal-tmpl'}});
ko.applyBindings({
data: { title: 'Modal One', url: 'http://media.giphy.com/media/yLgHIG7JJXyqk/giphy.gif' }
});
</script>
</body>
</html>
/*!
* Knockout JavaScript library v3.2.0
* (c) Steven Sanderson - http://knockoutjs.com/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
(function() {(function(n){var u=this||(0,eval)("this"),w=u.document,L=u.navigator,v=u.jQuery,F=u.JSON;(function(n){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?n(module.exports||exports,require):"function"===typeof define&&define.amd?define(["exports","require"],n):n(u.ko={})})(function(M,N){function H(a,c){return null===a||typeof a in Q?a===c:!1}function R(a,c){var d;return function(){d||(d=setTimeout(function(){d=n;a()},c))}}function S(a,c){var d;return function(){clearTimeout(d);
d=setTimeout(a,c)}}function I(b,c,d,e){a.d[b]={init:function(b,h,k,g,m){var l,r;a.s(function(){var g=a.a.c(h()),k=!d!==!g,x=!r;if(x||c||k!==l)x&&a.Y.la()&&(r=a.a.ia(a.e.childNodes(b),!0)),k?(x||a.e.U(b,a.a.ia(r)),a.Da(e?e(m,g):m,b)):a.e.ja(b),l=k},null,{o:b});return{controlsDescendantBindings:!0}}};a.h.ha[b]=!1;a.e.S[b]=!0}var a="undefined"!==typeof M?M:{};a.b=function(b,c){for(var d=b.split("."),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.B=function(a,c,d){a[c]=d};a.version="3.2.0";
a.b("version",a.version);a.a=function(){function b(a,b){for(var d in a)a.hasOwnProperty(d)&&b(d,a[d])}function c(a,b){if(b)for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a}function d(a,b){a.__proto__=b;return a}var e={__proto__:[]}instanceof Array,f={},h={};f[L&&/Firefox\/2/i.test(L.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];f.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");b(f,function(a,b){if(b.length)for(var d=
0,c=b.length;d<c;d++)h[b[d]]=a});var k={propertychange:!0},g=w&&function(){for(var a=3,b=w.createElement("div"),d=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",d[0];);return 4<a?a:n}();return{wb:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],u:function(a,b){for(var d=0,c=a.length;d<c;d++)b(a[d],d)},m:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var d=0,c=a.length;d<c;d++)if(a[d]===
b)return d;return-1},rb:function(a,b,d){for(var c=0,g=a.length;c<g;c++)if(b.call(d,a[c],c))return a[c];return null},ua:function(m,b){var d=a.a.m(m,b);0<d?m.splice(d,1):0===d&&m.shift()},sb:function(m){m=m||[];for(var b=[],d=0,c=m.length;d<c;d++)0>a.a.m(b,m[d])&&b.push(m[d]);return b},Ea:function(a,b){a=a||[];for(var d=[],c=0,g=a.length;c<g;c++)d.push(b(a[c],c));return d},ta:function(a,b){a=a||[];for(var d=[],c=0,g=a.length;c<g;c++)b(a[c],c)&&d.push(a[c]);return d},ga:function(a,b){if(b instanceof
Array)a.push.apply(a,b);else for(var d=0,c=b.length;d<c;d++)a.push(b[d]);return a},ea:function(b,d,c){var g=a.a.m(a.a.Ya(b),d);0>g?c&&b.push(d):c||b.splice(g,1)},xa:e,extend:c,Aa:d,Ba:e?d:c,H:b,na:function(a,b){if(!a)return a;var d={},c;for(c in a)a.hasOwnProperty(c)&&(d[c]=b(a[c],c,a));return d},La:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},Eb:function(b){b=a.a.O(b);for(var d=w.createElement("div"),c=0,g=b.length;c<g;c++)d.appendChild(a.T(b[c]));return d},ia:function(b,d){for(var c=
0,g=b.length,e=[];c<g;c++){var f=b[c].cloneNode(!0);e.push(d?a.T(f):f)}return e},U:function(b,d){a.a.La(b);if(d)for(var c=0,g=d.length;c<g;c++)b.appendChild(d[c])},Lb:function(b,d){var c=b.nodeType?[b]:b;if(0<c.length){for(var g=c[0],e=g.parentNode,f=0,h=d.length;f<h;f++)e.insertBefore(d[f],g);f=0;for(h=c.length;f<h;f++)a.removeNode(c[f])}},ka:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);if(1<a.length){var d=a[0],c=a[a.length-1];for(a.length=
0;d!==c;)if(a.push(d),d=d.nextSibling,!d)return;a.push(c)}}return a},Nb:function(a,b){7>g?a.setAttribute("selected",b):a.selected=b},eb:function(a){return null===a||a===n?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},vc:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},cc:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(3===a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&
16);for(;a&&a!=b;)a=a.parentNode;return!!a},Ka:function(b){return a.a.cc(b,b.ownerDocument.documentElement)},pb:function(b){return!!a.a.rb(b,a.a.Ka)},t:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},n:function(b,d,c){var e=g&&k[d];if(!e&&v)v(b).bind(d,c);else if(e||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var f=function(a){c.call(b,a)},h="on"+d;b.attachEvent(h,f);a.a.A.da(b,function(){b.detachEvent(h,f)})}else throw Error("Browser doesn't support addEventListener or attachEvent");
else b.addEventListener(d,c,!1)},oa:function(b,d){if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var c;"input"===a.a.t(b)&&b.type&&"click"==d.toLowerCase()?(c=b.type,c="checkbox"==c||"radio"==c):c=!1;if(v&&!c)v(b).trigger(d);else if("function"==typeof w.createEvent)if("function"==typeof b.dispatchEvent)c=w.createEvent(h[d]||"HTMLEvents"),c.initEvent(d,!0,!0,u,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(c);else throw Error("The supplied element doesn't support dispatchEvent");
else if(c&&b.click)b.click();else if("undefined"!=typeof b.fireEvent)b.fireEvent("on"+d);else throw Error("Browser doesn't support triggering events");},c:function(b){return a.C(b)?b():b},Ya:function(b){return a.C(b)?b.w():b},Ca:function(b,d,c){if(d){var g=/\S+/g,e=b.className.match(g)||[];a.a.u(d.match(g),function(b){a.a.ea(e,b,c)});b.className=e.join(" ")}},cb:function(b,d){var c=a.a.c(d);if(null===c||c===n)c="";var g=a.e.firstChild(b);!g||3!=g.nodeType||a.e.nextSibling(g)?a.e.U(b,[b.ownerDocument.createTextNode(c)]):
g.data=c;a.a.fc(b)},Mb:function(a,b){a.name=b;if(7>=g)try{a.mergeAttributes(w.createElement("<input name='"+a.name+"'/>"),!1)}catch(d){}},fc:function(a){9<=g&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},dc:function(a){if(g){var b=a.style.width;a.style.width=0;a.style.width=b}},tc:function(b,d){b=a.a.c(b);d=a.a.c(d);for(var c=[],g=b;g<=d;g++)c.push(g);return c},O:function(a){for(var b=[],d=0,c=a.length;d<c;d++)b.push(a[d]);return b},yc:6===g,zc:7===g,M:g,yb:function(b,d){for(var c=
a.a.O(b.getElementsByTagName("input")).concat(a.a.O(b.getElementsByTagName("textarea"))),g="string"==typeof d?function(a){return a.name===d}:function(a){return d.test(a.name)},e=[],f=c.length-1;0<=f;f--)g(c[f])&&e.push(c[f]);return e},qc:function(b){return"string"==typeof b&&(b=a.a.eb(b))?F&&F.parse?F.parse(b):(new Function("return "+b))():null},fb:function(b,d,c){if(!F||!F.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
return F.stringify(a.a.c(b),d,c)},rc:function(d,c,g){g=g||{};var e=g.params||{},f=g.includeFields||this.wb,h=d;if("object"==typeof d&&"form"===a.a.t(d))for(var h=d.action,k=f.length-1;0<=k;k--)for(var t=a.a.yb(d,f[k]),z=t.length-1;0<=z;z--)e[t[z].name]=t[z].value;c=a.a.c(c);var A=w.createElement("form");A.style.display="none";A.action=h;A.method="post";for(var C in c)d=w.createElement("input"),d.type="hidden",d.name=C,d.value=a.a.fb(a.a.c(c[C])),A.appendChild(d);b(e,function(a,b){var d=w.createElement("input");
d.type="hidden";d.name=a;d.value=b;A.appendChild(d)});w.body.appendChild(A);g.submitter?g.submitter(A):A.submit();setTimeout(function(){A.parentNode.removeChild(A)},0)}}}();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.u);a.b("utils.arrayFirst",a.a.rb);a.b("utils.arrayFilter",a.a.ta);a.b("utils.arrayGetDistinctValues",a.a.sb);a.b("utils.arrayIndexOf",a.a.m);a.b("utils.arrayMap",a.a.Ea);a.b("utils.arrayPushAll",a.a.ga);a.b("utils.arrayRemoveItem",a.a.ua);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",
a.a.wb);a.b("utils.getFormFields",a.a.yb);a.b("utils.peekObservable",a.a.Ya);a.b("utils.postJson",a.a.rc);a.b("utils.parseJson",a.a.qc);a.b("utils.registerEventHandler",a.a.n);a.b("utils.stringifyJson",a.a.fb);a.b("utils.range",a.a.tc);a.b("utils.toggleDomNodeCssClass",a.a.Ca);a.b("utils.triggerEvent",a.a.oa);a.b("utils.unwrapObservable",a.a.c);a.b("utils.objectForEach",a.a.H);a.b("utils.addOrRemoveItem",a.a.ea);a.b("unwrap",a.a.c);Function.prototype.bind||(Function.prototype.bind=function(a){var c=
this;if(1===arguments.length)return function(){return c.apply(a,arguments)};var d=Array.prototype.slice.call(arguments,1);return function(){var e=d.slice(0);e.push.apply(e,arguments);return c.apply(a,e)}});a.a.f=new function(){function a(b,h){var k=b[d];if(!k||"null"===k||!e[k]){if(!h)return n;k=b[d]="ko"+c++;e[k]={}}return e[k]}var c=0,d="__ko__"+(new Date).getTime(),e={};return{get:function(d,c){var e=a(d,!1);return e===n?n:e[c]},set:function(d,c,e){if(e!==n||a(d,!1)!==n)a(d,!0)[c]=e},clear:function(a){var b=
a[d];return b?(delete e[b],a[d]=null,!0):!1},G:function(){return c++ +d}}};a.b("utils.domData",a.a.f);a.b("utils.domData.clear",a.a.f.clear);a.a.A=new function(){function b(b,c){var g=a.a.f.get(b,d);g===n&&c&&(g=[],a.a.f.set(b,d,g));return g}function c(d){var e=b(d,!1);if(e)for(var e=e.slice(0),g=0;g<e.length;g++)e[g](d);a.a.f.clear(d);a.a.A.cleanExternalData(d);if(f[d.nodeType])for(e=d.firstChild;d=e;)e=d.nextSibling,8===d.nodeType&&c(d)}var d=a.a.f.G(),e={1:!0,8:!0,9:!0},f={1:!0,9:!0};return{da:function(a,
d){if("function"!=typeof d)throw Error("Callback must be a function");b(a,!0).push(d)},Kb:function(c,e){var g=b(c,!1);g&&(a.a.ua(g,e),0==g.length&&a.a.f.set(c,d,n))},T:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.ga(d,b.getElementsByTagName("*"));for(var g=0,m=d.length;g<m;g++)c(d[g])}return b},removeNode:function(b){a.T(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){v&&"function"==typeof v.cleanData&&v.cleanData([a])}}};a.T=a.a.A.T;a.removeNode=a.a.A.removeNode;
a.b("cleanNode",a.T);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.A);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.A.da);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.A.Kb);(function(){a.a.ba=function(b){var c;if(v)if(v.parseHTML)c=v.parseHTML(b)||[];else{if((c=v.clean([b]))&&c[0]){for(b=c[0];b.parentNode&&11!==b.parentNode.nodeType;)b=b.parentNode;b.parentNode&&b.parentNode.removeChild(b)}}else{var d=a.a.eb(b).toLowerCase();c=w.createElement("div");d=d.match(/^<(thead|tbody|tfoot)/)&&
[1,"<table>","</table>"]||!d.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!d.indexOf("<td")||!d.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];b="ignored<div>"+d[1]+b+d[2]+"</div>";for("function"==typeof u.innerShiv?c.appendChild(u.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.O(c.lastChild.childNodes)}return c};a.a.ab=function(b,c){a.a.La(b);c=a.a.c(c);if(null!==c&&c!==n)if("string"!=typeof c&&(c=c.toString()),v)v(b).html(c);else for(var d=a.a.ba(c),
e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b("utils.parseHtmlFragment",a.a.ba);a.b("utils.setHtml",a.a.ab);a.F=function(){function b(d,c){if(d)if(8==d.nodeType){var f=a.F.Gb(d.nodeValue);null!=f&&c.push({bc:d,oc:f})}else if(1==d.nodeType)for(var f=0,h=d.childNodes,k=h.length;f<k;f++)b(h[f],c)}var c={};return{Va:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*
(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},Rb:function(a,b){var f=c[a];if(f===n)throw Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{return f.apply(null,b||[]),!0}finally{delete c[a]}},Sb:function(d,c){var f=[];b(d,f);for(var h=0,k=f.length;h<k;h++){var g=f[h].bc,m=[g];c&&a.a.ga(m,c);a.F.Rb(f[h].oc,m);g.nodeValue="";g.parentNode&&g.parentNode.removeChild(g)}},Gb:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?
a[1]:null}}}();a.b("memoization",a.F);a.b("memoization.memoize",a.F.Va);a.b("memoization.unmemoize",a.F.Rb);a.b("memoization.parseMemoText",a.F.Gb);a.b("memoization.unmemoizeDomNodeAndDescendants",a.F.Sb);a.Ma={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.k({read:b,write:function(a){clearTimeout(d);d=setTimeout(function(){b(a)},c)}})},rateLimit:function(a,c){var d,e,f;"number"==typeof c?d=c:(d=c.timeout,e=c.method);f="notifyWhenChangesStop"==e?S:R;a.Ua(function(a){return f(a,
d)})},notify:function(a,c){a.equalityComparer="always"==c?null:H}};var Q={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.Ma);a.Pb=function(b,c,d){this.target=b;this.wa=c;this.ac=d;this.Bb=!1;a.B(this,"dispose",this.L)};a.Pb.prototype.L=function(){this.Bb=!0;this.ac()};a.Q=function(){a.a.Ba(this,a.Q.fn);this.D={}};var B={R:function(b,c,d){var e=this;d=d||"change";var f=new a.Pb(e,c?b.bind(c):b,function(){a.a.ua(e.D[d],f);e.ob&&e.ob(d)});e.va&&e.va(d);e.D[d]||(e.D[d]=[]);e.D[d].push(f);
return f},notifySubscribers:function(b,c){c=c||"change";if(this.Oa(c))try{a.j.Fa();for(var d=this.D[c].slice(0),e=0,f;f=d[e];++e)f.Bb||f.wa(b)}finally{a.j.end()}},Ua:function(b){var c=this,d=a.C(c),e,f,h;c.qa||(c.qa=c.notifySubscribers,c.notifySubscribers=function(a,b){b&&"change"!==b?"beforeChange"===b?c.lb(a):c.qa(a,b):c.mb(a)});var k=b(function(){d&&h===c&&(h=c());e=!1;c.Ra(f,h)&&c.qa(f=h)});c.mb=function(a){e=!0;h=a;k()};c.lb=function(a){e||(f=a,c.qa(a,"beforeChange"))}},Oa:function(a){return this.D[a]&&
this.D[a].length},gc:function(b){if(b)return this.D[b]&&this.D[b].length||0;var c=0;a.a.H(this.D,function(a,b){c+=b.length});return c},Ra:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},extend:function(b){var c=this;b&&a.a.H(b,function(b,e){var f=a.Ma[b];"function"==typeof f&&(c=f(c,e)||c)});return c}};a.B(B,"subscribe",B.R);a.B(B,"extend",B.extend);a.B(B,"getSubscriptionsCount",B.gc);a.a.xa&&a.a.Aa(B,Function.prototype);a.Q.fn=B;a.Cb=function(a){return null!=a&&"function"==
typeof a.R&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.Q);a.b("isSubscribable",a.Cb);a.Y=a.j=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{Fa:b,end:c,Jb:function(b){if(e){if(!a.Cb(b))throw Error("Only subscribable things can act as dependencies");e.wa(b,b.Vb||(b.Vb=++f))}},v:function(a,d,g){try{return b(),a.apply(d,g||[])}finally{c()}},la:function(){if(e)return e.s.la()},ma:function(){if(e)return e.ma}}}();a.b("computedContext",a.Y);a.b("computedContext.getDependenciesCount",
a.Y.la);a.b("computedContext.isInitial",a.Y.ma);a.b("computedContext.isSleeping",a.Y.Ac);a.p=function(b){function c(){if(0<arguments.length)return c.Ra(d,arguments[0])&&(c.X(),d=arguments[0],c.W()),this;a.j.Jb(c);return d}var d=b;a.Q.call(c);a.a.Ba(c,a.p.fn);c.w=function(){return d};c.W=function(){c.notifySubscribers(d)};c.X=function(){c.notifySubscribers(d,"beforeChange")};a.B(c,"peek",c.w);a.B(c,"valueHasMutated",c.W);a.B(c,"valueWillMutate",c.X);return c};a.p.fn={equalityComparer:H};var G=a.p.sc=
"__ko_proto__";a.p.fn[G]=a.p;a.a.xa&&a.a.Aa(a.p.fn,a.Q.fn);a.Na=function(b,c){return null===b||b===n||b[G]===n?!1:b[G]===c?!0:a.Na(b[G],c)};a.C=function(b){return a.Na(b,a.p)};a.ya=function(b){return"function"==typeof b&&b[G]===a.p||"function"==typeof b&&b[G]===a.k&&b.ic?!0:!1};a.b("observable",a.p);a.b("isObservable",a.C);a.b("isWriteableObservable",a.ya);a.b("isWritableObservable",a.ya);a.aa=function(b){b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
b=a.p(b);a.a.Ba(b,a.aa.fn);return b.extend({trackArrayChanges:!0})};a.aa.fn={remove:function(b){for(var c=this.w(),d=[],e="function"!=typeof b||a.C(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var h=c[f];e(h)&&(0===d.length&&this.X(),d.push(h),c.splice(f,1),f--)}d.length&&this.W();return d},removeAll:function(b){if(b===n){var c=this.w(),d=c.slice(0);this.X();c.splice(0,c.length);this.W();return d}return b?this.remove(function(d){return 0<=a.a.m(b,d)}):[]},destroy:function(b){var c=this.w(),
d="function"!=typeof b||a.C(b)?function(a){return a===b}:b;this.X();for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=!0);this.W()},destroyAll:function(b){return b===n?this.destroy(function(){return!0}):b?this.destroy(function(c){return 0<=a.a.m(b,c)}):[]},indexOf:function(b){var c=this();return a.a.m(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.X(),this.w()[d]=c,this.W())}};a.a.u("pop push reverse shift sort splice unshift".split(" "),function(b){a.aa.fn[b]=function(){var a=
this.w();this.X();this.tb(a,b,arguments);a=a[b].apply(a,arguments);this.W();return a}});a.a.u(["slice"],function(b){a.aa.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.a.xa&&a.a.Aa(a.aa.fn,a.p.fn);a.b("observableArray",a.aa);a.Ma.trackArrayChanges=function(b){function c(){if(!d){d=!0;var c=b.notifySubscribers;b.notifySubscribers=function(a,b){b&&"change"!==b||++f;return c.apply(this,arguments)};var g=[].concat(b.w()||[]);e=null;b.R(function(d){d=[].concat(d||[]);if(b.Oa("arrayChange")){var c;
if(!e||1<f)e=a.a.Ga(g,d,{sparse:!0});c=e}g=d;e=null;f=0;c&&c.length&&b.notifySubscribers(c,"arrayChange")})}}if(!b.tb){var d=!1,e=null,f=0,h=b.R;b.R=b.subscribe=function(a,b,d){"arrayChange"===d&&c();return h.apply(this,arguments)};b.tb=function(b,c,m){function l(a,b,d){return r[r.length]={status:a,value:b,index:d}}if(d&&!f){var r=[],h=b.length,p=m.length,x=0;switch(c){case "push":x=h;case "unshift":for(c=0;c<p;c++)l("added",m[c],x+c);break;case "pop":x=h-1;case "shift":h&&l("deleted",b[x],x);break;
case "splice":c=Math.min(Math.max(0,0>m[0]?h+m[0]:m[0]),h);for(var h=1===p?h:Math.min(c+(m[1]||0),h),p=c+p-2,x=Math.max(h,p),s=[],t=[],z=2;c<x;++c,++z)c<h&&t.push(l("deleted",b[c],c)),c<p&&s.push(l("added",m[z],c));a.a.xb(t,s);break;default:return}e=r}}}};a.s=a.k=function(b,c,d){function e(){a.a.H(w,function(a,b){b.L()});w={}}function f(){e();E=0;t=!0;p=!1}function h(){var a=g.throttleEvaluation;a&&0<=a?(clearTimeout(O),O=setTimeout(k,a)):g.jb?g.jb():k()}function k(b){if(x){if(A)throw Error("A 'pure' computed must not be called recursively");
}else if(!t){if(v&&v()){if(!s){u();return}}else s=!1;x=!0;if(C)try{var d={};a.j.Fa({wa:function(a,b){t||d[b]||(d[b]=1,++E)},s:g,ma:n});E=0;q=z.call(c)}finally{a.j.end(),x=p=!1}else try{var e=w,m=E,l=A?n:!E;a.j.Fa({wa:function(a,b){t||(m&&e[b]?(w[b]=e[b],++E,delete e[b],--m):w[b]||(w[b]=a.R(h),++E))},s:g,ma:l});w={};E=0;try{var f=c?z.call(c):z()}finally{a.j.end(),m&&a.a.H(e,function(a,b){b.L()}),p=!1}g.Ra(q,f)&&(r(q,"beforeChange"),q=f,!0!==b&&r(q));l&&r(q,"awake")}finally{x=!1}E||u()}}function g(){if(0<
arguments.length){if("function"===typeof y)y.apply(c,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}a.j.Jb(g);(C||p)&&k(!0);return q}function m(){(C||p&&!E)&&k(!0);return q}function l(){return p||0<E}function r(a,b){g.notifySubscribers(a,b)}var q,p=!0,x=!1,s=!1,t=!1,z=b,A=!1,C=!1;z&&"object"==typeof z?(d=z,z=d.read):(d=d||{},z||(z=d.read));if("function"!=typeof z)throw Error("Pass a function that returns the value of the ko.computed");
var y=d.write,D=d.disposeWhenNodeIsRemoved||d.o||null,J=d.disposeWhen||d.Ja,v=J,u=f,w={},E=0,O=null;c||(c=d.owner);a.Q.call(g);a.a.Ba(g,a.k.fn);g.w=m;g.la=function(){return E};g.ic="function"===typeof y;g.L=function(){u()};g.Z=l;var B=g.Ua;g.Ua=function(a){B.call(g,a);g.jb=function(){g.lb(q);p=!0;g.mb(g)}};d.pure?(C=A=!0,g.va=function(a){"change"==a&&C&&(C=!1,p=!0,k(!0),t||r(q,"awake"))},g.ob=function(a){"change"!=a||g.Oa("change")||(e(),C=!0,r(n,"asleep"))}):d.deferEvaluation&&(g.va=function(a){if("change"==
a||"beforeChange"==a)m(),delete g.va});a.B(g,"peek",g.w);a.B(g,"dispose",g.L);a.B(g,"isActive",g.Z);a.B(g,"getDependenciesCount",g.la);D&&(s=!0,D.nodeType&&(v=function(){return!a.a.Ka(D)||J&&J()}));C||d.deferEvaluation||k();D&&l()&&D.nodeType&&(u=function(){a.a.A.Kb(D,u);f()},a.a.A.da(D,u));return g};a.kc=function(b){return a.Na(b,a.k)};B=a.p.sc;a.k[B]=a.p;a.k.fn={equalityComparer:H};a.k.fn[B]=a.k;a.a.xa&&a.a.Aa(a.k.fn,a.Q.fn);a.b("dependentObservable",a.k);a.b("computed",a.k);a.b("isComputed",a.kc);
a.Ib=function(b,c){if("function"===typeof b)return a.s(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.s(b,c)};a.b("pureComputed",a.Ib);(function(){function b(a,f,h){h=h||new d;a=f(a);if("object"!=typeof a||null===a||a===n||a instanceof Date||a instanceof String||a instanceof Number||a instanceof Boolean)return a;var k=a instanceof Array?[]:{};h.save(a,k);c(a,function(d){var c=f(a[d]);switch(typeof c){case "boolean":case "number":case "string":case "function":k[d]=c;break;case "object":case "undefined":var l=
h.get(c);k[d]=l!==n?l:b(c,f,h)}});return k}function c(a,b){if(a instanceof Array){for(var d=0;d<a.length;d++)b(d);"function"==typeof a.toJSON&&b("toJSON")}else for(d in a)b(d)}function d(){this.keys=[];this.ib=[]}a.Qb=function(d){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return b(d,function(b){for(var d=0;a.C(b)&&10>d;d++)b=b();return b})};a.toJSON=function(b,d,c){b=a.Qb(b);return a.a.fb(b,d,c)};d.prototype={save:function(b,d){var c=a.a.m(this.keys,
b);0<=c?this.ib[c]=d:(this.keys.push(b),this.ib.push(d))},get:function(b){b=a.a.m(this.keys,b);return 0<=b?this.ib[b]:n}}})();a.b("toJS",a.Qb);a.b("toJSON",a.toJSON);(function(){a.i={q:function(b){switch(a.a.t(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?a.a.f.get(b,a.d.options.Wa):7>=a.a.M?b.getAttributeNode("value")&&b.getAttributeNode("value").specified?b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.i.q(b.options[b.selectedIndex]):n;default:return b.value}},ca:function(b,
c,d){switch(a.a.t(b)){case "option":switch(typeof c){case "string":a.a.f.set(b,a.d.options.Wa,n);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.f.set(b,a.d.options.Wa,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:""}break;case "select":if(""===c||null===c)c=n;for(var e=-1,f=0,h=b.options.length,k;f<h;++f)if(k=a.i.q(b.options[f]),k==c||""==k&&c===n){e=f;break}if(d||0<=e||c===n&&1<b.size)b.selectedIndex=e;break;default:if(null===
c||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.i);a.b("selectExtensions.readValue",a.i.q);a.b("selectExtensions.writeValue",a.i.ca);a.h=function(){function b(b){b=a.a.eb(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));var d=[],c=b.match(e),r,k,p=0;if(c){c.push(",");for(var x=0,s;s=c[x];++x){var t=s.charCodeAt(0);if(44===t){if(0>=p){r&&d.push(k?{key:r,value:k.join("")}:{unknown:r});r=k=p=0;continue}}else if(58===t){if(!k)continue}else if(47===t&&x&&1<s.length)(t=c[x-1].match(f))&&!h[t[0]]&&(b=
b.substr(b.indexOf(s)+1),c=b.match(e),c.push(","),x=-1,s="/");else if(40===t||123===t||91===t)++p;else if(41===t||125===t||93===t)--p;else if(!r&&!k){r=34===t||39===t?s.slice(1,-1):s;continue}k?k.push(s):k=[s]}}return d}var c=["true","false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,e=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),f=/[\])"'A-Za-z0-9_$]+$/,h={"in":1,"return":1,
"typeof":1},k={};return{ha:[],V:k,Xa:b,za:function(g,m){function l(b,g){var m;if(!x){var s=a.getBindingHandler(b);if(s&&s.preprocess&&!(g=s.preprocess(g,b,l)))return;if(s=k[b])m=g,0<=a.a.m(c,m)?m=!1:(s=m.match(d),m=null===s?!1:s[1]?"Object("+s[1]+")"+s[2]:m),s=m;s&&f.push("'"+b+"':function(_z){"+m+"=_z}")}h&&(g="function(){return "+g+" }");e.push("'"+b+"':"+g)}m=m||{};var e=[],f=[],h=m.valueAccessors,x=m.bindingParams,s="string"===typeof g?b(g):g;a.a.u(s,function(a){l(a.key||a.unknown,a.value)});
f.length&&l("_ko_property_writers","{"+f.join(",")+" }");return e.join(",")},nc:function(a,b){for(var d=0;d<a.length;d++)if(a[d].key==b)return!0;return!1},pa:function(b,d,c,e,f){if(b&&a.C(b))!a.ya(b)||f&&b.w()===e||b(e);else if((b=d.get("_ko_property_writers"))&&b[c])b[c](e)}}}();a.b("expressionRewriting",a.h);a.b("expressionRewriting.bindingRewriteValidators",a.h.ha);a.b("expressionRewriting.parseObjectLiteral",a.h.Xa);a.b("expressionRewriting.preProcessBindings",a.h.za);a.b("expressionRewriting._twoWayBindings",
a.h.V);a.b("jsonExpressionRewriting",a.h);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.h.za);(function(){function b(a){return 8==a.nodeType&&h.test(f?a.text:a.nodeValue)}function c(a){return 8==a.nodeType&&k.test(f?a.text:a.nodeValue)}function d(a,d){for(var g=a,e=1,f=[];g=g.nextSibling;){if(c(g)&&(e--,0===e))return f;f.push(g);b(g)&&e++}if(!d)throw Error("Cannot find closing comment tag to match: "+a.nodeValue);return null}function e(a,b){var c=d(a,b);return c?0<c.length?c[c.length-
1].nextSibling:a.nextSibling:null}var f=w&&"\x3c!--test--\x3e"===w.createComment("test").text,h=f?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=f?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,g={ul:!0,ol:!0};a.e={S:{},childNodes:function(a){return b(a)?d(a):a.childNodes},ja:function(d){if(b(d)){d=a.e.childNodes(d);for(var c=0,g=d.length;c<g;c++)a.removeNode(d[c])}else a.a.La(d)},U:function(d,c){if(b(d)){a.e.ja(d);for(var g=d.nextSibling,e=0,f=c.length;e<f;e++)g.parentNode.insertBefore(c[e],
g)}else a.a.U(d,c)},Hb:function(a,d){b(a)?a.parentNode.insertBefore(d,a.nextSibling):a.firstChild?a.insertBefore(d,a.firstChild):a.appendChild(d)},Ab:function(d,c,g){g?b(d)?d.parentNode.insertBefore(c,g.nextSibling):g.nextSibling?d.insertBefore(c,g.nextSibling):d.appendChild(c):a.e.Hb(d,c)},firstChild:function(a){return b(a)?!a.nextSibling||c(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=e(a));return a.nextSibling&&c(a.nextSibling)?null:a.nextSibling},hc:b,xc:function(a){return(a=
(f?a.text:a.nodeValue).match(h))?a[1]:null},Fb:function(d){if(g[a.a.t(d)]){var l=d.firstChild;if(l){do if(1===l.nodeType){var f;f=l.firstChild;var h=null;if(f){do if(h)h.push(f);else if(b(f)){var k=e(f,!0);k?f=k:h=[f]}else c(f)&&(h=[f]);while(f=f.nextSibling)}if(f=h)for(h=l.nextSibling,k=0;k<f.length;k++)h?d.insertBefore(f[k],h):d.appendChild(f[k])}while(l=l.nextSibling)}}}}})();a.b("virtualElements",a.e);a.b("virtualElements.allowedBindings",a.e.S);a.b("virtualElements.emptyNode",a.e.ja);a.b("virtualElements.insertAfter",
a.e.Ab);a.b("virtualElements.prepend",a.e.Hb);a.b("virtualElements.setDomNodeChildren",a.e.U);(function(){a.K=function(){this.Yb={}};a.a.extend(a.K.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind")||a.g.getComponentNameForNode(b);case 8:return a.e.hc(b);default:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.g.nb(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,
c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.g.nb(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.e.xc(b);default:return null}},parseBindingsString:function(b,c,d,e){try{var f=this.Yb,h=b+(e&&e.valueAccessors||""),k;if(!(k=f[h])){var g,m="with($context){with($data||{}){return{"+a.h.za(b,e)+"}}}";g=new Function("$context","$element",m);k=f[h]=g}return k(c,d)}catch(l){throw l.message="Unable to parse bindings.\nBindings value: "+
b+"\nMessage: "+l.message,l;}}});a.K.instance=new a.K})();a.b("bindingProvider",a.K);(function(){function b(a){return function(){return a}}function c(a){return a()}function d(b){return a.a.na(a.j.v(b),function(a,d){return function(){return b()[d]}})}function e(c,g,e){return"function"===typeof c?d(c.bind(null,g,e)):a.a.na(c,b)}function f(a,b){return d(this.getBindings.bind(this,a,b))}function h(b,d,c){var g,e=a.e.firstChild(d),f=a.K.instance,l=f.preprocessNode;if(l){for(;g=e;)e=a.e.nextSibling(g),
l.call(f,g);e=a.e.firstChild(d)}for(;g=e;)e=a.e.nextSibling(g),k(b,g,c)}function k(b,d,c){var g=!0,e=1===d.nodeType;e&&a.e.Fb(d);if(e&&c||a.K.instance.nodeHasBindings(d))g=m(d,null,b,c).shouldBindDescendants;g&&!r[a.a.t(d)]&&h(b,d,!e)}function g(b){var d=[],c={},g=[];a.a.H(b,function C(e){if(!c[e]){var f=a.getBindingHandler(e);f&&(f.after&&(g.push(e),a.a.u(f.after,function(d){if(b[d]){if(-1!==a.a.m(g,d))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+g.join(", "));
C(d)}}),g.length--),d.push({key:e,zb:f}));c[e]=!0}});return d}function m(b,d,e,l){var m=a.a.f.get(b,q);if(!d){if(m)throw Error("You cannot apply bindings multiple times to the same element.");a.a.f.set(b,q,!0)}!m&&l&&a.Ob(b,e);var h;if(d&&"function"!==typeof d)h=d;else{var k=a.K.instance,r=k.getBindingAccessors||f,p=a.k(function(){(h=d?d(e,b):r.call(k,b,e))&&e.J&&e.J();return h},null,{o:b});h&&p.Z()||(p=null)}var u;if(h){var w=p?function(a){return function(){return c(p()[a])}}:function(a){return h[a]},
v=function(){return a.a.na(p?p():h,c)};v.get=function(a){return h[a]&&c(w(a))};v.has=function(a){return a in h};l=g(h);a.a.u(l,function(d){var c=d.zb.init,g=d.zb.update,f=d.key;if(8===b.nodeType&&!a.e.S[f])throw Error("The binding '"+f+"' cannot be used with virtual elements");try{"function"==typeof c&&a.j.v(function(){var a=c(b,w(f),v,e.$data,e);if(a&&a.controlsDescendantBindings){if(u!==n)throw Error("Multiple bindings ("+u+" and "+f+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
u=f}}),"function"==typeof g&&a.k(function(){g(b,w(f),v,e.$data,e)},null,{o:b})}catch(l){throw l.message='Unable to process binding "'+f+": "+h[f]+'"\nMessage: '+l.message,l;}})}return{shouldBindDescendants:u===n}}function l(b){return b&&b instanceof a.N?b:new a.N(b)}a.d={};var r={script:!0};a.getBindingHandler=function(b){return a.d[b]};a.N=function(b,d,c,g){var e=this,f="function"==typeof b&&!a.C(b),l,m=a.k(function(){var l=f?b():b,h=a.a.c(l);d?(d.J&&d.J(),a.a.extend(e,d),m&&(e.J=m)):(e.$parents=
[],e.$root=h,e.ko=a);e.$rawData=l;e.$data=h;c&&(e[c]=h);g&&g(e,d,h);return e.$data},null,{Ja:function(){return l&&!a.a.pb(l)},o:!0});m.Z()&&(e.J=m,m.equalityComparer=null,l=[],m.Tb=function(b){l.push(b);a.a.A.da(b,function(b){a.a.ua(l,b);l.length||(m.L(),e.J=m=n)})})};a.N.prototype.createChildContext=function(b,d,c){return new a.N(b,this,d,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);c&&c(a)})};a.N.prototype.extend=function(b){return new a.N(this.J||
this.$data,this,null,function(d,c){d.$rawData=c.$rawData;a.a.extend(d,"function"==typeof b?b():b)})};var q=a.a.f.G(),p=a.a.f.G();a.Ob=function(b,d){if(2==arguments.length)a.a.f.set(b,p,d),d.J&&d.J.Tb(b);else return a.a.f.get(b,p)};a.ra=function(b,d,c){1===b.nodeType&&a.e.Fb(b);return m(b,d,l(c),!0)};a.Wb=function(b,d,c){c=l(c);return a.ra(b,e(d,c,b),c)};a.Da=function(a,b){1!==b.nodeType&&8!==b.nodeType||h(l(a),b,!0)};a.qb=function(a,b){!v&&u.jQuery&&(v=u.jQuery);if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
b=b||u.document.body;k(l(a),b,!0)};a.Ia=function(b){switch(b.nodeType){case 1:case 8:var d=a.Ob(b);if(d)return d;if(b.parentNode)return a.Ia(b.parentNode)}return n};a.$b=function(b){return(b=a.Ia(b))?b.$data:n};a.b("bindingHandlers",a.d);a.b("applyBindings",a.qb);a.b("applyBindingsToDescendants",a.Da);a.b("applyBindingAccessorsToNode",a.ra);a.b("applyBindingsToNode",a.Wb);a.b("contextFor",a.Ia);a.b("dataFor",a.$b)})();(function(b){function c(c,g){var e=f.hasOwnProperty(c)?f[c]:b,l;e?e.R(g):(e=f[c]=
new a.Q,e.R(g),d(c,function(a,b){var d=!(!b||!b.synchronous);h[c]={definition:a,lc:d};delete f[c];l||d?e.notifySubscribers(a):setTimeout(function(){e.notifySubscribers(a)},0)}),l=!0)}function d(a,b){e("getConfig",[a],function(d){d?e("loadComponent",[a,d],function(a){b(a,d)}):b(null,null)})}function e(d,c,f,l){l||(l=a.g.loaders.slice(0));var h=l.shift();if(h){var q=h[d];if(q){var p=!1;if(q.apply(h,c.concat(function(a){p?f(null):null!==a?f(a):e(d,c,f,l)}))!==b&&(p=!0,!h.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");
}else e(d,c,f,l)}else f(null)}var f={},h={};a.g={get:function(d,g){var e=h.hasOwnProperty(d)?h[d]:b;e?e.lc?a.j.v(function(){g(e.definition)}):setTimeout(function(){g(e.definition)},0):c(d,g)},ub:function(a){delete h[a]},kb:e};a.g.loaders=[];a.b("components",a.g);a.b("components.get",a.g.get);a.b("components.clearCachedDefinition",a.g.ub)})();(function(){function b(b,d,c,e){function h(){0===--s&&e(k)}var k={},s=2,t=c.template;c=c.viewModel;t?f(d,t,function(d){a.g.kb("loadTemplate",[b,d],function(a){k.template=
a;h()})}):h();c?f(d,c,function(d){a.g.kb("loadViewModel",[b,d],function(a){k[g]=a;h()})}):h()}function c(a,b,d){if("function"===typeof b)d(function(a){return new b(a)});else if("function"===typeof b[g])d(b[g]);else if("instance"in b){var e=b.instance;d(function(){return e})}else"viewModel"in b?c(a,b.viewModel,d):a("Unknown viewModel value: "+b)}function d(b){switch(a.a.t(b)){case "script":return a.a.ba(b.text);case "textarea":return a.a.ba(b.value);case "template":if(e(b.content))return a.a.ia(b.content.childNodes)}return a.a.ia(b.childNodes)}
function e(a){return u.DocumentFragment?a instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,d){"string"===typeof b.require?N||u.require?(N||u.require)([b.require],d):a("Uses require, but no AMD loader is present"):d(b)}function h(a){return function(b){throw Error("Component '"+a+"': "+b);}}var k={};a.g.register=function(b,d){if(!d)throw Error("Invalid configuration for "+b);if(a.g.Sa(b))throw Error("Component "+b+" is already registered");k[b]=d};a.g.Sa=function(a){return a in k};a.g.wc=
function(b){delete k[b];a.g.ub(b)};a.g.vb={getConfig:function(a,b){b(k.hasOwnProperty(a)?k[a]:null)},loadComponent:function(a,d,c){var e=h(a);f(e,d,function(d){b(a,e,d,c)})},loadTemplate:function(b,c,g){b=h(b);if("string"===typeof c)g(a.a.ba(c));else if(c instanceof Array)g(c);else if(e(c))g(a.a.O(c.childNodes));else if(c.element)if(c=c.element,u.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)g(d(c));else if("string"===typeof c){var f=w.getElementById(c);f?g(d(f)):b("Cannot find element with ID "+
c)}else b("Unknown element type: "+c);else b("Unknown template value: "+c)},loadViewModel:function(a,b,d){c(h(a),b,d)}};var g="createViewModel";a.b("components.register",a.g.register);a.b("components.isRegistered",a.g.Sa);a.b("components.unregister",a.g.wc);a.b("components.defaultLoader",a.g.vb);a.g.loaders.push(a.g.vb);a.g.Ub=k})();(function(){function b(b,e){var f=b.getAttribute("params");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.na(f,function(c){return a.s(c,
null,{o:b})}),h=a.a.na(f,function(c){var e=c.w();return c.Z()?a.s({read:function(){return a.a.c(c())},write:a.ya(e)&&function(a){c()(a)},o:b}):e});h.hasOwnProperty("$raw")||(h.$raw=f);return h}return{$raw:{}}}a.g.getComponentNameForNode=function(b){b=a.a.t(b);return a.g.Sa(b)&&b};a.g.nb=function(d,c,f,h){if(1===c.nodeType){var k=a.g.getComponentNameForNode(c);if(k){d=d||{};if(d.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var g={name:k,params:b(c,
f)};d.component=h?function(){return g}:g}}return d};var c=new a.K;9>a.a.M&&(a.g.register=function(a){return function(b){w.createElement(b);return a.apply(this,arguments)}}(a.g.register),w.createDocumentFragment=function(b){return function(){var c=b(),f=a.g.Ub,h;for(h in f)f.hasOwnProperty(h)&&c.createElement(h);return c}}(w.createDocumentFragment))})();(function(b){function c(b,d,c){d=d.template;if(!d)throw Error("Component '"+b+"' has no template");b=a.a.ia(d);a.e.U(c,b)}function d(a,b,d,c){var e=
a.createViewModel;return e?e.call(a,c,{element:b,templateNodes:d}):c}var e=0;a.d.component={init:function(f,h,k,g,m){function l(){var a=r&&r.dispose;"function"===typeof a&&a.call(r);q=null}var r,q,p=a.a.O(a.e.childNodes(f));a.a.A.da(f,l);a.s(function(){var g=a.a.c(h()),k,t;"string"===typeof g?k=g:(k=a.a.c(g.name),t=a.a.c(g.params));if(!k)throw Error("No component name specified");var n=q=++e;a.g.get(k,function(e){if(q===n){l();if(!e)throw Error("Unknown component '"+k+"'");c(k,e,f);var g=d(e,f,p,
t);e=m.createChildContext(g,b,function(a){a.$component=g;a.$componentTemplateNodes=p});r=g;a.Da(e,f)}})},null,{o:f});return{controlsDescendantBindings:!0}}};a.e.S.component=!0})();var P={"class":"className","for":"htmlFor"};a.d.attr={update:function(b,c){var d=a.a.c(c())||{};a.a.H(d,function(d,c){c=a.a.c(c);var h=!1===c||null===c||c===n;h&&b.removeAttribute(d);8>=a.a.M&&d in P?(d=P[d],h?b.removeAttribute(d):b[d]=c):h||b.setAttribute(d,c.toString());"name"===d&&a.a.Mb(b,h?"":c.toString())})}};(function(){a.d.checked=
{after:["value","attr"],init:function(b,c,d){function e(){var e=b.checked,f=r?h():e;if(!a.Y.ma()&&(!g||e)){var k=a.j.v(c);m?l!==f?(e&&(a.a.ea(k,f,!0),a.a.ea(k,l,!1)),l=f):a.a.ea(k,f,e):a.h.pa(k,d,"checked",f,!0)}}function f(){var d=a.a.c(c());b.checked=m?0<=a.a.m(d,h()):k?d:h()===d}var h=a.Ib(function(){return d.has("checkedValue")?a.a.c(d.get("checkedValue")):d.has("value")?a.a.c(d.get("value")):b.value}),k="checkbox"==b.type,g="radio"==b.type;if(k||g){var m=k&&a.a.c(c())instanceof Array,l=m?h():
n,r=g||m;g&&!b.name&&a.d.uniqueName.init(b,function(){return!0});a.s(e,null,{o:b});a.a.n(b,"click",e);a.s(f,null,{o:b})}}};a.h.V.checked=!0;a.d.checkedValue={update:function(b,c){b.value=a.a.c(c())}}})();a.d.css={update:function(b,c){var d=a.a.c(c());null!==d&&"object"==typeof d?a.a.H(d,function(d,c){c=a.a.c(c);a.a.Ca(b,d,c)}):(d=String(d||""),a.a.Ca(b,b.__ko__cssValue,!1),b.__ko__cssValue=d,a.a.Ca(b,d,!0))}};a.d.enable={update:function(b,c){var d=a.a.c(c());d&&b.disabled?b.removeAttribute("disabled"):
d||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,c){a.d.enable.update(b,function(){return!a.a.c(c())})}};a.d.event={init:function(b,c,d,e,f){var h=c()||{};a.a.H(h,function(h){"string"==typeof h&&a.a.n(b,h,function(b){var m,l=c()[h];if(l){try{var r=a.a.O(arguments);e=f.$data;r.unshift(e);m=l.apply(e,r)}finally{!0!==m&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}!1===d.get(h+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.d.foreach={Db:function(b){return function(){var c=
b(),d=a.a.Ya(c);if(!d||"number"==typeof d.length)return{foreach:c,templateEngine:a.P.Qa};a.a.c(c);return{foreach:d.data,as:d.as,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.P.Qa}}},init:function(b,c){return a.d.template.init(b,a.d.foreach.Db(c))},update:function(b,c,d,e,f){return a.d.template.update(b,a.d.foreach.Db(c),d,e,f)}};a.h.ha.foreach=!1;a.e.S.foreach=!0;a.d.hasfocus=
{init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var g=b.ownerDocument;if("activeElement"in g){var f;try{f=g.activeElement}catch(h){f=g.body}e=f===b}g=c();a.h.pa(g,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),h=e.bind(null,!1);a.a.n(b,"focus",f);a.a.n(b,"focusin",f);a.a.n(b,"blur",h);a.a.n(b,"focusout",h)},update:function(b,c){var d=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),a.j.v(a.a.oa,
null,[b,d?"focusin":"focusout"]))}};a.h.V.hasfocus=!0;a.d.hasFocus=a.d.hasfocus;a.h.V.hasFocus=!0;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.ab(b,c())}};I("if");I("ifnot",!1,!0);I("with",!0,!1,function(a,c){return a.createChildContext(c)});var K={};a.d.options={init:function(b){if("select"!==a.a.t(b))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function e(){return a.a.ta(b.options,
function(a){return a.selected})}function f(a,b,d){var c=typeof b;return"function"==c?b(a):"string"==c?a[b]:d}function h(d,c){if(r.length){var e=0<=a.a.m(r,a.i.q(c[0]));a.a.Nb(c[0],e);q&&!e&&a.j.v(a.a.oa,null,[b,"change"])}}var k=0!=b.length&&b.multiple?b.scrollTop:null,g=a.a.c(c()),m=d.get("optionsIncludeDestroyed");c={};var l,r;r=b.multiple?a.a.Ea(e(),a.i.q):0<=b.selectedIndex?[a.i.q(b.options[b.selectedIndex])]:[];g&&("undefined"==typeof g.length&&(g=[g]),l=a.a.ta(g,function(b){return m||b===n||
null===b||!a.a.c(b._destroy)}),d.has("optionsCaption")&&(g=a.a.c(d.get("optionsCaption")),null!==g&&g!==n&&l.unshift(K)));var q=!1;c.beforeRemove=function(a){b.removeChild(a)};g=h;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(g=function(b,c){h(0,c);a.j.v(d.get("optionsAfterRender"),null,[c[0],b!==K?b:n])});a.a.$a(b,l,function(c,e,g){g.length&&(r=g[0].selected?[a.i.q(g[0])]:[],q=!0);e=b.ownerDocument.createElement("option");c===K?(a.a.cb(e,d.get("optionsCaption")),a.i.ca(e,
n)):(g=f(c,d.get("optionsValue"),c),a.i.ca(e,a.a.c(g)),c=f(c,d.get("optionsText"),g),a.a.cb(e,c));return[e]},c,g);a.j.v(function(){d.get("valueAllowUnset")&&d.has("value")?a.i.ca(b,a.a.c(d.get("value")),!0):(b.multiple?r.length&&e().length<r.length:r.length&&0<=b.selectedIndex?a.i.q(b.options[b.selectedIndex])!==r[0]:r.length||0<=b.selectedIndex)&&a.a.oa(b,"change")});a.a.dc(b);k&&20<Math.abs(k-b.scrollTop)&&(b.scrollTop=k)}};a.d.options.Wa=a.a.f.G();a.d.selectedOptions={after:["options","foreach"],
init:function(b,c,d){a.a.n(b,"change",function(){var e=c(),f=[];a.a.u(b.getElementsByTagName("option"),function(b){b.selected&&f.push(a.i.q(b))});a.h.pa(e,d,"selectedOptions",f)})},update:function(b,c){if("select"!=a.a.t(b))throw Error("values binding applies only to SELECT elements");var d=a.a.c(c());d&&"number"==typeof d.length&&a.a.u(b.getElementsByTagName("option"),function(b){var c=0<=a.a.m(d,a.i.q(b));a.a.Nb(b,c)})}};a.h.V.selectedOptions=!0;a.d.style={update:function(b,c){var d=a.a.c(c()||
{});a.a.H(d,function(d,c){c=a.a.c(c);if(null===c||c===n||!1===c)c="";b.style[d]=c})}};a.d.submit={init:function(b,c,d,e,f){if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.n(b,"submit",function(a){var d,e=c();try{d=e.call(f.$data,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.cb(b,c())}};a.e.S.text=!0;(function(){if(u&&u.navigator)var b=
function(a){if(a)return parseFloat(a[1])},c=u.opera&&u.opera.version&&parseInt(u.opera.version()),d=u.navigator.userAgent,e=b(d.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),f=b(d.match(/Firefox\/([^ ]*)/));if(10>a.a.M)var h=a.a.f.G(),k=a.a.f.G(),g=function(b){var d=this.activeElement;(d=d&&a.a.f.get(d,k))&&d(b)},m=function(b,d){var c=b.ownerDocument;a.a.f.get(c,h)||(a.a.f.set(c,h,!0),a.a.n(c,"selectionchange",g));a.a.f.set(b,k,d)};a.d.textInput={init:function(b,d,g){function h(d,c){a.a.n(b,
d,c)}function k(){var c=a.a.c(d());if(null===c||c===n)c="";u!==n&&c===u?setTimeout(k,4):b.value!==c&&(z=c,b.value=c)}function s(){A||(u=b.value,A=setTimeout(t,4))}function t(){clearTimeout(A);u=A=n;var c=b.value;z!==c&&(z=c,a.h.pa(d(),g,"textInput",c))}var z=b.value,A,u;10>a.a.M?(h("propertychange",function(a){"value"===a.propertyName&&t()}),8==a.a.M&&(h("keyup",t),h("keydown",t)),8<=a.a.M&&(m(b,t),h("dragend",s))):(h("input",t),5>e&&"textarea"===a.a.t(b)?(h("keydown",s),h("paste",s),h("cut",s)):
11>c?h("keydown",s):4>f&&(h("DOMAutoComplete",t),h("dragdrop",t),h("drop",t)));h("change",t);a.s(k,null,{o:b})}};a.h.V.textInput=!0;a.d.textinput={preprocess:function(a,b,d){d("textInput",a)}}})();a.d.uniqueName={init:function(b,c){if(c()){var d="ko_unique_"+ ++a.d.uniqueName.Zb;a.a.Mb(b,d)}}};a.d.uniqueName.Zb=0;a.d.value={after:["options","foreach"],init:function(b,c,d){if("input"!=b.tagName.toLowerCase()||"checkbox"!=b.type&&"radio"!=b.type){var e=["change"],f=d.get("valueUpdate"),h=!1,k=null;
f&&("string"==typeof f&&(f=[f]),a.a.ga(e,f),e=a.a.sb(e));var g=function(){k=null;h=!1;var e=c(),g=a.i.q(b);a.h.pa(e,d,"value",g)};!a.a.M||"input"!=b.tagName.toLowerCase()||"text"!=b.type||"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete||-1!=a.a.m(e,"propertychange")||(a.a.n(b,"propertychange",function(){h=!0}),a.a.n(b,"focus",function(){h=!1}),a.a.n(b,"blur",function(){h&&g()}));a.a.u(e,function(d){var c=g;a.a.vc(d,"after")&&(c=function(){k=a.i.q(b);setTimeout(g,0)},d=d.substring(5));a.a.n(b,
d,c)});var m=function(){var e=a.a.c(c()),g=a.i.q(b);if(null!==k&&e===k)setTimeout(m,0);else if(e!==g)if("select"===a.a.t(b)){var f=d.get("valueAllowUnset"),g=function(){a.i.ca(b,e,f)};g();f||e===a.i.q(b)?setTimeout(g,0):a.j.v(a.a.oa,null,[b,"change"])}else a.i.ca(b,e)};a.s(m,null,{o:b})}else a.ra(b,{checkedValue:c})},update:function(){}};a.h.V.value=!0;a.d.visible={update:function(b,c){var d=a.a.c(c()),e="none"!=b.style.display;d&&!e?b.style.display="":!d&&e&&(b.style.display="none")}};(function(b){a.d[b]=
{init:function(c,d,e,f,h){return a.d.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,h)}}})("click");a.I=function(){};a.I.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");};a.I.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.I.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||w;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.r.l(d)}if(1==
b.nodeType||8==b.nodeType)return new a.r.fa(b);throw Error("Unknown template type: "+b);};a.I.prototype.renderTemplate=function(a,c,d,e){a=this.makeTemplateSource(a,e);return this.renderTemplateSource(a,c,d)};a.I.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.I.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0)};a.b("templateEngine",a.I);
a.gb=function(){function b(b,d,c,k){b=a.h.Xa(b);for(var g=a.h.ha,m=0;m<b.length;m++){var l=b[m].key;if(g.hasOwnProperty(l)){var r=g[l];if("function"===typeof r){if(l=r(b[m].value))throw Error(l);}else if(!r)throw Error("This template engine does not support the '"+l+"' binding within its templates");}}c="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.h.za(b,{valueAccessors:!0})+" } })()},'"+c.toLowerCase()+"')";return k.createJavaScriptEvaluatorBlock(c)+d}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,
d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{ec:function(b,d,c){d.isTemplateRewritten(b,c)||d.rewriteTemplate(b,function(b){return a.gb.pc(b,d)},c)},pc:function(a,f){return a.replace(c,function(a,d,c,e,l){return b(l,d,c,f)}).replace(d,function(a,d){return b(d,"\x3c!-- ko --\x3e","#comment",f)})},Xb:function(b,d){return a.F.Va(function(c,k){var g=c.nextSibling;g&&g.nodeName.toLowerCase()===d&&a.ra(g,b,k)})}}}();a.b("__tr_ambtns",a.gb.Xb);(function(){a.r={};a.r.l=function(a){this.l=a};a.r.l.prototype.text=
function(){var b=a.a.t(this.l),b="script"===b?"text":"textarea"===b?"value":"innerHTML";if(0==arguments.length)return this.l[b];var c=arguments[0];"innerHTML"===b?a.a.ab(this.l,c):this.l[b]=c};var b=a.a.f.G()+"_";a.r.l.prototype.data=function(d){if(1===arguments.length)return a.a.f.get(this.l,b+d);a.a.f.set(this.l,b+d,arguments[1])};var c=a.a.f.G();a.r.fa=function(a){this.l=a};a.r.fa.prototype=new a.r.l;a.r.fa.prototype.text=function(){if(0==arguments.length){var b=a.a.f.get(this.l,c)||{};b.hb===
n&&b.Ha&&(b.hb=b.Ha.innerHTML);return b.hb}a.a.f.set(this.l,c,{hb:arguments[0]})};a.r.l.prototype.nodes=function(){if(0==arguments.length)return(a.a.f.get(this.l,c)||{}).Ha;a.a.f.set(this.l,c,{Ha:arguments[0]})};a.b("templateSources",a.r);a.b("templateSources.domElement",a.r.l);a.b("templateSources.anonymousTemplate",a.r.fa)})();(function(){function b(b,d,c){var e;for(d=a.e.nextSibling(d);b&&(e=b)!==d;)b=a.e.nextSibling(e),c(e,b)}function c(d,c){if(d.length){var e=d[0],f=d[d.length-1],h=e.parentNode,
k=a.K.instance,n=k.preprocessNode;if(n){b(e,f,function(a,b){var d=a.previousSibling,c=n.call(k,a);c&&(a===e&&(e=c[0]||b),a===f&&(f=c[c.length-1]||d))});d.length=0;if(!e)return;e===f?d.push(e):(d.push(e,f),a.a.ka(d,h))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.qb(c,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.F.Sb(b,[c])});a.a.ka(d,h)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,e,f,k,q){q=q||{};var p=b&&d(b),p=p&&p.ownerDocument,n=q.templateEngine||h;
a.gb.ec(f,n,p);f=n.renderTemplate(f,k,q,p);if("number"!=typeof f.length||0<f.length&&"number"!=typeof f[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(e){case "replaceChildren":a.e.U(b,f);p=!0;break;case "replaceNode":a.a.Lb(b,f);p=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+e);}p&&(c(f,k),q.afterRender&&a.j.v(q.afterRender,null,[f,k.$data]));return f}function f(b,d,c){return a.C(b)?b():"function"===typeof b?b(d,c):b}
var h;a.bb=function(b){if(b!=n&&!(b instanceof a.I))throw Error("templateEngine must inherit from ko.templateEngine");h=b};a.Za=function(b,c,k,r,q){k=k||{};if((k.templateEngine||h)==n)throw Error("Set a template engine before calling renderTemplate");q=q||"replaceChildren";if(r){var p=d(r);return a.k(function(){var h=c&&c instanceof a.N?c:new a.N(a.a.c(c)),n=f(b,h.$data,h),h=e(r,q,n,h,k);"replaceNode"==q&&(r=h,p=d(r))},null,{Ja:function(){return!p||!a.a.Ka(p)},o:p&&"replaceNode"==q?p.parentNode:p})}return a.F.Va(function(d){a.Za(b,
c,k,d,"replaceNode")})};a.uc=function(b,d,h,k,q){function p(a,b){c(b,s);h.afterRender&&h.afterRender(b,a);s=null}function x(a,d){s=q.createChildContext(a,h.as,function(a){a.$index=d});var c=f(b,a,s);return e(null,"ignoreTargetNode",c,s,h)}var s;return a.k(function(){var b=a.a.c(d)||[];"undefined"==typeof b.length&&(b=[b]);b=a.a.ta(b,function(b){return h.includeDestroyed||b===n||null===b||!a.a.c(b._destroy)});a.j.v(a.a.$a,null,[k,b,x,h,p])},null,{o:k})};var k=a.a.f.G();a.d.template={init:function(b,
d){var c=a.a.c(d());if("string"==typeof c||c.name)a.e.ja(b);else{if("nodes"in c){if(c=c.nodes||[],a.C(c))throw Error('The "nodes" option must be a plain, non-observable array.');}else c=a.e.childNodes(b);c=a.a.Eb(c);(new a.r.fa(b)).nodes(c)}return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var h=c(),x;c=a.a.c(h);d=!0;e=null;"string"==typeof c?c={}:(h=c.name,"if"in c&&(d=a.a.c(c["if"])),d&&"ifnot"in c&&(d=!a.a.c(c.ifnot)),x=a.a.c(c.data));"foreach"in c?e=a.uc(h||b,d&&c.foreach||[],
c,b,f):d?(f="data"in c?f.createChildContext(x,c.as):f,e=a.Za(h||b,f,c,b)):a.e.ja(b);f=e;(x=a.a.f.get(b,k))&&"function"==typeof x.L&&x.L();a.a.f.set(b,k,f&&f.Z()?f:n)}};a.h.ha.template=function(b){b=a.h.Xa(b);return 1==b.length&&b[0].unknown||a.h.nc(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.e.S.template=!0})();a.b("setTemplateEngine",a.bb);a.b("renderTemplate",a.Za);a.a.xb=function(a,c,d){if(a.length&&c.length){var e,f,h,k,g;for(e=f=0;(!d||
e<d)&&(k=a[f]);++f){for(h=0;g=c[h];++h)if(k.value===g.value){k.moved=g.index;g.moved=k.index;c.splice(h,1);e=h=0;break}e+=h}}};a.a.Ga=function(){function b(b,d,e,f,h){var k=Math.min,g=Math.max,m=[],l,n=b.length,q,p=d.length,x=p-n||1,s=n+p+1,t,u,v;for(l=0;l<=n;l++)for(u=t,m.push(t=[]),v=k(p,l+x),q=g(0,l-1);q<=v;q++)t[q]=q?l?b[l-1]===d[q-1]?u[q-1]:k(u[q]||s,t[q-1]||s)+1:q+1:l+1;k=[];g=[];x=[];l=n;for(q=p;l||q;)p=m[l][q]-1,q&&p===m[l][q-1]?g.push(k[k.length]={status:e,value:d[--q],index:q}):l&&p===m[l-
1][q]?x.push(k[k.length]={status:f,value:b[--l],index:l}):(--q,--l,h.sparse||k.push({status:"retained",value:d[q]}));a.a.xb(g,x,10*n);return k.reverse()}return function(a,d,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<=d.length?b(a,d,"added","deleted",e):b(d,a,"deleted","added",e)}}();a.b("utils.compareArrays",a.a.Ga);(function(){function b(b,c,f,h,k){var g=[],m=a.k(function(){var l=c(f,k,a.a.ka(g,b))||[];0<g.length&&(a.a.Lb(g,l),h&&a.j.v(h,null,[f,l,k]));g.length=
0;a.a.ga(g,l)},null,{o:b,Ja:function(){return!a.a.pb(g)}});return{$:g,k:m.Z()?m:n}}var c=a.a.f.G();a.a.$a=function(d,e,f,h,k){function g(b,c){y=r[c];t!==c&&(C[b]=y);y.Pa(t++);a.a.ka(y.$,d);u.push(y);w.push(y)}function m(b,c){if(b)for(var d=0,e=c.length;d<e;d++)c[d]&&a.a.u(c[d].$,function(a){b(a,d,c[d].sa)})}e=e||[];h=h||{};var l=a.a.f.get(d,c)===n,r=a.a.f.get(d,c)||[],q=a.a.Ea(r,function(a){return a.sa}),p=a.a.Ga(q,e,h.dontLimitMoves),u=[],s=0,t=0,v=[],w=[];e=[];for(var C=[],q=[],y,D=0,B,F;B=p[D];D++)switch(F=
B.moved,B.status){case "deleted":F===n&&(y=r[s],y.k&&y.k.L(),v.push.apply(v,a.a.ka(y.$,d)),h.beforeRemove&&(e[D]=y,w.push(y)));s++;break;case "retained":g(D,s++);break;case "added":F!==n?g(D,F):(y={sa:B.value,Pa:a.p(t++)},u.push(y),w.push(y),l||(q[D]=y))}m(h.beforeMove,C);a.a.u(v,h.beforeRemove?a.T:a.removeNode);for(var D=0,l=a.e.firstChild(d),G;y=w[D];D++){y.$||a.a.extend(y,b(d,f,y.sa,k,y.Pa));for(s=0;p=y.$[s];l=p.nextSibling,G=p,s++)p!==l&&a.e.Ab(d,p,G);!y.jc&&k&&(k(y.sa,y.$,y.Pa),y.jc=!0)}m(h.beforeRemove,
e);m(h.afterMove,C);m(h.afterAdd,q);a.a.f.set(d,c,u)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.$a);a.P=function(){this.allowTemplateRewriting=!1};a.P.prototype=new a.I;a.P.prototype.renderTemplateSource=function(b){var c=(9>a.a.M?0:b.nodes)?b.nodes():null;if(c)return a.a.O(c.cloneNode(!0).childNodes);b=b.text();return a.a.ba(b)};a.P.Qa=new a.P;a.bb(a.P.Qa);a.b("nativeTemplateEngine",a.P);(function(){a.Ta=function(){var a=this.mc=function(){if(!v||!v.tmpl)return 0;try{if(0<=v.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();
this.renderTemplateSource=function(b,e,f){f=f||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var h=b.data("precompiled");h||(h=b.text()||"",h=v.template(null,"{{ko_with $item.koBindingContext}}"+h+"{{/ko_with}}"),b.data("precompiled",h));b=[e.$data];e=v.extend({koBindingContext:e},f.templateOptions);e=v.tmpl(h,b,e);e.appendTo(w.createElement("div"));v.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+
a+" })()) }}"};this.addTemplate=function(a,b){w.write("<script type='text/html' id='"+a+"'>"+b+"\x3c/script>")};0<a&&(v.tmpl.tag.ko_code={open:"__.push($1 || '');"},v.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.Ta.prototype=new a.I;var b=new a.Ta;0<b.mc&&a.bb(b);a.b("jqueryTmplTemplateEngine",a.Ta)})()})})();})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment