/*! * Knockout JavaScript library v3.5.1 * (c) The Knockout.js team - http://knockoutjs.com/ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ (function(){var DEBUG=true;(function(undefined){var window=this||(0,eval)('this'),document=window['document'],navigator=window['navigator'],jQueryInstance=window["jQuery"],JSON=window["JSON"];if(!jQueryInstance&&typeof jQuery!=="undefined"){jQueryInstance=jQuery;} (function(factory){if(typeof define==='function'&&define['amd']){define(['exports','require'],factory);}else if(typeof exports==='object'&&typeof module==='object'){factory(module['exports']||exports);}else{factory(window['ko']={});}}(function(koExports,amdRequire){var ko=typeof koExports!=='undefined'?koExports:{};ko.exportSymbol=function(koPath,object){var tokens=koPath.split(".");var target=ko;for(var i=0;i',iElems[0]){} return version>4?version:undefined;}());var isIe6=ieVersion===6,isIe7=ieVersion===7;function isClickOnCheckableElement(element,eventType){if((ko.utils.tagNameLower(element)!=="input")||!element.type)return false;if(eventType.toLowerCase()!="click")return false;var inputType=element.type;return(inputType=="checkbox")||(inputType=="radio");} var cssClassNameRegex=/\S+/g;var jQueryEventAttachName;function toggleDomNodeCssClass(node,classNames,shouldHaveClass){var addOrRemoveFn;if(classNames){if(typeof node.classList==='object'){addOrRemoveFn=node.classList[shouldHaveClass?'add':'remove'];ko.utils.arrayForEach(classNames.match(cssClassNameRegex),function(className){addOrRemoveFn.call(node.classList,className);});}else if(typeof node.className['baseVal']==='string'){toggleObjectClassPropertyString(node.className,'baseVal',classNames,shouldHaveClass);}else{toggleObjectClassPropertyString(node,'className',classNames,shouldHaveClass);}}} function toggleObjectClassPropertyString(obj,prop,classNames,shouldHaveClass){var currentClassNames=obj[prop].match(cssClassNameRegex)||[];ko.utils.arrayForEach(classNames.match(cssClassNameRegex),function(className){ko.utils.addOrRemoveItem(currentClassNames,className,shouldHaveClass);});obj[prop]=currentClassNames.join(" ");} return{fieldsIncludedWithJsonPost:['authenticity_token',/^__RequestVerificationToken(_.*)?$/],arrayForEach:function(array,action,actionOwner){for(var i=0,j=array.length;i0){array.splice(index,1);} else if(index===0){array.shift();}},arrayGetDistinctValues:function(array){var result=[];if(array){ko.utils.arrayForEach(array,function(item){if(ko.utils.arrayIndexOf(result,item)<0) result.push(item);});} return result;},arrayMap:function(array,mapping,mappingOwner){var result=[];if(array){for(var i=0,j=array.length;i0){var insertionPoint=nodesToReplaceArray[0];var parent=insertionPoint.parentNode;for(var i=0,j=newNodesArray.length;i1&&continuousNodeArray[continuousNodeArray.length-1].parentNode!==parentNode) continuousNodeArray.length--;if(continuousNodeArray.length>1){var current=continuousNodeArray[0],last=continuousNodeArray[continuousNodeArray.length-1];continuousNodeArray.length=0;while(current!==last){continuousNodeArray.push(current);current=current.nextSibling;} continuousNodeArray.push(last);}} return continuousNodeArray;},setOptionNodeSelectionState:function(optionNode,isSelected){if(ieVersion<7) optionNode.setAttribute("selected",isSelected);else optionNode.selected=isSelected;},stringTrim:function(string){return string===null||string===undefined?'':string.trim?string.trim():string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,'');},stringStartsWith:function(string,startsWith){string=string||"";if(startsWith.length>string.length) return false;return string.substring(0,startsWith.length)===startsWith;},domNodeIsContainedBy:function(node,containedByNode){if(node===containedByNode) return true;if(node.nodeType===11) return false;if(containedByNode.contains) return containedByNode.contains(node.nodeType!==1?node.parentNode:node);if(containedByNode.compareDocumentPosition) return(containedByNode.compareDocumentPosition(node)&16)==16;while(node&&node!=containedByNode){node=node.parentNode;} return!!node;},domNodeIsAttachedToDocument:function(node){return ko.utils.domNodeIsContainedBy(node,node.ownerDocument.documentElement);},anyDomNodeIsAttachedToDocument:function(nodes){return!!ko.utils.arrayFirst(nodes,ko.utils.domNodeIsAttachedToDocument);},tagNameLower:function(element){return element&&element.tagName&&element.tagName.toLowerCase();},catchFunctionErrors:function(delegate){return ko['onError']?function(){try{return delegate.apply(this,arguments);}catch(e){ko['onError']&&ko['onError'](e);throw e;}}:delegate;},setTimeout:function(handler,timeout){return setTimeout(ko.utils.catchFunctionErrors(handler),timeout);},deferError:function(error){setTimeout(function(){ko['onError']&&ko['onError'](error);throw error;},0);},registerEventHandler:function(element,eventType,handler){var wrappedHandler=ko.utils.catchFunctionErrors(handler);var mustUseAttachEvent=eventsThatMustBeRegisteredUsingAttachEvent[eventType];if(!ko.options['useOnlyNativeEvents']&&!mustUseAttachEvent&&jQueryInstance){if(!jQueryEventAttachName){jQueryEventAttachName=(typeof jQueryInstance(element)['on']=='function')?'on':'bind';} jQueryInstance(element)[jQueryEventAttachName](eventType,wrappedHandler);}else if(!mustUseAttachEvent&&typeof element.addEventListener=="function") element.addEventListener(eventType,wrappedHandler,false);else if(typeof element.attachEvent!="undefined"){var attachEventHandler=function(event){wrappedHandler.call(element,event);},attachEventName="on"+eventType;element.attachEvent(attachEventName,attachEventHandler);ko.utils.domNodeDisposal.addDisposeCallback(element,function(){element.detachEvent(attachEventName,attachEventHandler);});}else throw new Error("Browser doesn't support addEventListener or attachEvent");},triggerEvent:function(element,eventType){if(!(element&&element.nodeType)) throw new Error("element must be a DOM node when calling triggerEvent");var useClickWorkaround=isClickOnCheckableElement(element,eventType);if(!ko.options['useOnlyNativeEvents']&&jQueryInstance&&!useClickWorkaround){jQueryInstance(element)['trigger'](eventType);}else if(typeof document.createEvent=="function"){if(typeof element.dispatchEvent=="function"){var eventCategory=knownEventTypesByEventName[eventType]||"HTMLEvents";var event=document.createEvent(eventCategory);event.initEvent(eventType,true,true,window,0,0,0,0,0,false,false,false,false,0,element);element.dispatchEvent(event);} else throw new Error("The supplied element doesn't support dispatchEvent");}else if(useClickWorkaround&&element.click){element.click();}else if(typeof element.fireEvent!="undefined"){element.fireEvent("on"+eventType);}else{throw new Error("Browser doesn't support triggering events");}},unwrapObservable:function(value){return ko.isObservable(value)?value():value;},peekObservable:function(value){return ko.isObservable(value)?value.peek():value;},toggleDomNodeCssClass:toggleDomNodeCssClass,setTextContent:function(element,textContent){var value=ko.utils.unwrapObservable(textContent);if((value===null)||(value===undefined)) value="";var innerTextNode=ko.virtualElements.firstChild(element);if(!innerTextNode||innerTextNode.nodeType!=3||ko.virtualElements.nextSibling(innerTextNode)){ko.virtualElements.setDomNodeChildren(element,[element.ownerDocument.createTextNode(value)]);}else{innerTextNode.data=value;} ko.utils.forceRefresh(element);},setElementName:function(element,name){element.name=name;if(ieVersion<=7){try{var escapedName=element.name.replace(/[&<>'"]/g,function(r){return"&#"+r.charCodeAt(0)+";";});element.mergeAttributes(document.createElement(""),false);} catch(e){}}},forceRefresh:function(node){if(ieVersion>=9){var elem=node.nodeType==1?node:node.parentNode;if(elem.style) elem.style.zoom=elem.style.zoom;}},ensureSelectElementIsRenderedCorrectly:function(selectElement){if(ieVersion){var originalWidth=selectElement.style.width;selectElement.style.width=0;selectElement.style.width=originalWidth;}},range:function(min,max){min=ko.utils.unwrapObservable(min);max=ko.utils.unwrapObservable(max);var result=[];for(var i=min;i<=max;i++) result.push(i);return result;},makeArray:function(arrayLikeObject){var result=[];for(var i=0,j=arrayLikeObject.length;i=0;i--){if(isMatchingField(fields[i])) matches.push(fields[i]);};return matches;},parseJson:function(jsonString){if(typeof jsonString=="string"){jsonString=ko.utils.stringTrim(jsonString);if(jsonString){if(JSON&&JSON.parse) return JSON.parse(jsonString);return(new Function("return "+jsonString))();}} return null;},stringifyJson:function(data,replacer,space){if(!JSON||!JSON.stringify) throw new 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 JSON.stringify(ko.utils.unwrapObservable(data),replacer,space);},postJson:function(urlOrForm,data,options){options=options||{};var params=options['params']||{};var includeFields=options['includeFields']||this.fieldsIncludedWithJsonPost;var url=urlOrForm;if((typeof urlOrForm=='object')&&(ko.utils.tagNameLower(urlOrForm)==="form")){var originalForm=urlOrForm;url=originalForm.action;for(var i=includeFields.length-1;i>=0;i--){var fields=ko.utils.getFormFields(originalForm,includeFields[i]);for(var j=fields.length-1;j>=0;j--) params[fields[j].name]=fields[j].value;}} data=ko.utils.unwrapObservable(data);var form=document.createElement("form");form.style.display="none";form.action=url;form.method="post";for(var key in data){var input=document.createElement("input");input.type="hidden";input.name=key;input.value=ko.utils.stringifyJson(ko.utils.unwrapObservable(data[key]));form.appendChild(input);} objectForEach(params,function(key,value){var input=document.createElement("input");input.type="hidden";input.name=key;input.value=value;form.appendChild(input);});document.body.appendChild(form);options['submitter']?options['submitter'](form):form.submit();setTimeout(function(){form.parentNode.removeChild(form);},0);}}}());ko.exportSymbol('utils',ko.utils);ko.exportSymbol('utils.arrayForEach',ko.utils.arrayForEach);ko.exportSymbol('utils.arrayFirst',ko.utils.arrayFirst);ko.exportSymbol('utils.arrayFilter',ko.utils.arrayFilter);ko.exportSymbol('utils.arrayGetDistinctValues',ko.utils.arrayGetDistinctValues);ko.exportSymbol('utils.arrayIndexOf',ko.utils.arrayIndexOf);ko.exportSymbol('utils.arrayMap',ko.utils.arrayMap);ko.exportSymbol('utils.arrayPushAll',ko.utils.arrayPushAll);ko.exportSymbol('utils.arrayRemoveItem',ko.utils.arrayRemoveItem);ko.exportSymbol('utils.cloneNodes',ko.utils.cloneNodes);ko.exportSymbol('utils.createSymbolOrString',ko.utils.createSymbolOrString);ko.exportSymbol('utils.extend',ko.utils.extend);ko.exportSymbol('utils.fieldsIncludedWithJsonPost',ko.utils.fieldsIncludedWithJsonPost);ko.exportSymbol('utils.getFormFields',ko.utils.getFormFields);ko.exportSymbol('utils.objectMap',ko.utils.objectMap);ko.exportSymbol('utils.peekObservable',ko.utils.peekObservable);ko.exportSymbol('utils.postJson',ko.utils.postJson);ko.exportSymbol('utils.parseJson',ko.utils.parseJson);ko.exportSymbol('utils.registerEventHandler',ko.utils.registerEventHandler);ko.exportSymbol('utils.stringifyJson',ko.utils.stringifyJson);ko.exportSymbol('utils.range',ko.utils.range);ko.exportSymbol('utils.toggleDomNodeCssClass',ko.utils.toggleDomNodeCssClass);ko.exportSymbol('utils.triggerEvent',ko.utils.triggerEvent);ko.exportSymbol('utils.unwrapObservable',ko.utils.unwrapObservable);ko.exportSymbol('utils.objectForEach',ko.utils.objectForEach);ko.exportSymbol('utils.addOrRemoveItem',ko.utils.addOrRemoveItem);ko.exportSymbol('utils.setTextContent',ko.utils.setTextContent);ko.exportSymbol('unwrap',ko.utils.unwrapObservable);if(!Function.prototype['bind']){Function.prototype['bind']=function(object){var originalFunction=this;if(arguments.length===1){return function(){return originalFunction.apply(object,arguments);};}else{var partialArgs=Array.prototype.slice.call(arguments,1);return function(){var args=partialArgs.slice(0);args.push.apply(args,arguments);return originalFunction.apply(object,args);};}};} ko.utils.domData=new(function(){var uniqueId=0;var dataStoreKeyExpandoPropertyName="__ko__"+(new Date).getTime();var dataStore={};var getDataForNode,clear;if(!ko.utils.ieVersion){getDataForNode=function(node,createIfNotFound){var dataForNode=node[dataStoreKeyExpandoPropertyName];if(!dataForNode&&createIfNotFound){dataForNode=node[dataStoreKeyExpandoPropertyName]={};} return dataForNode;};clear=function(node){if(node[dataStoreKeyExpandoPropertyName]){delete node[dataStoreKeyExpandoPropertyName];return true;} return false;};}else{getDataForNode=function(node,createIfNotFound){var dataStoreKey=node[dataStoreKeyExpandoPropertyName];var hasExistingDataStore=dataStoreKey&&(dataStoreKey!=="null")&&dataStore[dataStoreKey];if(!hasExistingDataStore){if(!createIfNotFound) return undefined;dataStoreKey=node[dataStoreKeyExpandoPropertyName]="ko"+uniqueId++;dataStore[dataStoreKey]={};} return dataStore[dataStoreKey];};clear=function(node){var dataStoreKey=node[dataStoreKeyExpandoPropertyName];if(dataStoreKey){delete dataStore[dataStoreKey];node[dataStoreKeyExpandoPropertyName]=null;return true;} return false;};} return{get:function(node,key){var dataForNode=getDataForNode(node,false);return dataForNode&&dataForNode[key];},set:function(node,key,value){var dataForNode=getDataForNode(node,value!==undefined);dataForNode&&(dataForNode[key]=value);},getOrSet:function(node,key,value){var dataForNode=getDataForNode(node,true);return dataForNode[key]||(dataForNode[key]=value);},clear:clear,nextKey:function(){return(uniqueId++)+dataStoreKeyExpandoPropertyName;}};})();ko.exportSymbol('utils.domData',ko.utils.domData);ko.exportSymbol('utils.domData.clear',ko.utils.domData.clear);ko.utils.domNodeDisposal=new(function(){var domDataKey=ko.utils.domData.nextKey();var cleanableNodeTypes={1:true,8:true,9:true};var cleanableNodeTypesWithDescendants={1:true,9:true};function getDisposeCallbacksCollection(node,createIfNotFound){var allDisposeCallbacks=ko.utils.domData.get(node,domDataKey);if((allDisposeCallbacks===undefined)&&createIfNotFound){allDisposeCallbacks=[];ko.utils.domData.set(node,domDataKey,allDisposeCallbacks);} return allDisposeCallbacks;} function destroyCallbacksCollection(node){ko.utils.domData.set(node,domDataKey,undefined);} function cleanSingleNode(node){var callbacks=getDisposeCallbacksCollection(node,false);if(callbacks){callbacks=callbacks.slice(0);for(var i=0;i",""],tbody=[2,"","
"],tr=[3,"","
"],select=[1,""],lookup={'thead':table,'tbody':table,'tfoot':table,'tr':tbody,'td':tr,'th':tr,'option':select,'optgroup':select},mayRequireCreateElementHack=ko.utils.ieVersion<=8;function getWrap(tags){var m=tags.match(/^(?:\s*?)*?<([a-z]+)[\s>]/);return(m&&lookup[m[1]])||none;} function simpleHtmlParse(html,documentContext){documentContext||(documentContext=document);var windowContext=documentContext['parentWindow']||documentContext['defaultView']||window;var tags=ko.utils.stringTrim(html).toLowerCase(),div=documentContext.createElement("div"),wrap=getWrap(tags),depth=wrap[0];var markup="ignored
"+wrap[1]+html+wrap[2]+"
";if(typeof windowContext['innerShiv']=="function"){div.appendChild(windowContext['innerShiv'](markup));}else{if(mayRequireCreateElementHack){documentContext.body.appendChild(div);} div.innerHTML=markup;if(mayRequireCreateElementHack){div.parentNode.removeChild(div);}} while(depth--) div=div.lastChild;return ko.utils.makeArray(div.lastChild.childNodes);} function jQueryHtmlParse(html,documentContext){if(jQueryInstance['parseHTML']){return jQueryInstance['parseHTML'](html,documentContext)||[];}else{var elems=jQueryInstance['clean']([html],documentContext);if(elems&&elems[0]){var elem=elems[0];while(elem.parentNode&&elem.parentNode.nodeType!==11) elem=elem.parentNode;if(elem.parentNode) elem.parentNode.removeChild(elem);} return elems;}} ko.utils.parseHtmlFragment=function(html,documentContext){return jQueryInstance?jQueryHtmlParse(html,documentContext):simpleHtmlParse(html,documentContext);};ko.utils.parseHtmlForTemplateNodes=function(html,documentContext){var nodes=ko.utils.parseHtmlFragment(html,documentContext);return(nodes.length&&nodes[0].parentElement)||ko.utils.moveCleanedNodesToContainerElement(nodes);};ko.utils.setHtml=function(node,html){ko.utils.emptyDomNode(node);html=ko.utils.unwrapObservable(html);if((html!==null)&&(html!==undefined)){if(typeof html!='string') html=html.toString();if(jQueryInstance){jQueryInstance(node)['html'](html);}else{var parsedNodes=ko.utils.parseHtmlFragment(html,node.ownerDocument);for(var i=0;i";},unmemoize:function(memoId,callbackParams){var callback=memos[memoId];if(callback===undefined) throw new Error("Couldn't find any memo with ID "+memoId+". Perhaps it's already been unmemoized.");try{callback.apply(null,callbackParams||[]);return true;} finally{delete memos[memoId];}},unmemoizeDomNodeAndDescendants:function(domNode,extraCallbackParamsArray){var memos=[];findMemoNodes(domNode,memos);for(var i=0,j=memos.length;imark){if(++countMarks>=5000){nextIndexToProcess=taskQueueLength;ko.utils.deferError(Error("'Too much recursion' after processing "+countMarks+" task groups."));break;} mark=taskQueueLength;} try{task();}catch(ex){ko.utils.deferError(ex);}}}}} function scheduledProcess(){processTasks();nextIndexToProcess=taskQueueLength=taskQueue.length=0;} function scheduleTaskProcessing(){ko.tasks['scheduler'](scheduledProcess);} var tasks={'scheduler':scheduler,schedule:function(func){if(!taskQueueLength){scheduleTaskProcessing();} taskQueue[taskQueueLength++]=func;return nextHandle++;},cancel:function(handle){var index=handle-(nextHandle-taskQueueLength);if(index>=nextIndexToProcess&&index0){if(observable.isDifferent(observable[observableLatestValue],arguments[0])){observable.valueWillMutate();observable[observableLatestValue]=arguments[0];observable.valueHasMutated();} return this;} else{ko.dependencyDetection.registerDependency(observable);return observable[observableLatestValue];}} observable[observableLatestValue]=initialValue;if(!ko.utils.canSetPrototype){ko.utils.extend(observable,ko.subscribable['fn']);} ko.subscribable['fn'].init(observable);ko.utils.setPrototypeOfOrExtend(observable,observableFn);if(ko.options['deferUpdates']){ko.extenders['deferred'](observable,true);} return observable;} var observableFn={'equalityComparer':valuesArePrimitiveAndEqual,peek:function(){return this[observableLatestValue];},valueHasMutated:function(){this['notifySubscribers'](this[observableLatestValue],'spectate');this['notifySubscribers'](this[observableLatestValue]);},valueWillMutate:function(){this['notifySubscribers'](this[observableLatestValue],'beforeChange');}};if(ko.utils.canSetPrototype){ko.utils.setPrototypeOf(observableFn,ko.subscribable['fn']);} var protoProperty=ko.observable.protoProperty='__ko_proto__';observableFn[protoProperty]=ko.observable;ko.isObservable=function(instance){var proto=typeof instance=='function'&&instance[protoProperty];if(proto&&proto!==observableFn[protoProperty]&&proto!==ko.computed['fn'][protoProperty]){throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");} return!!proto;};ko.isWriteableObservable=function(instance){return(typeof instance=='function'&&((instance[protoProperty]===observableFn[protoProperty])||(instance[protoProperty]===ko.computed['fn'][protoProperty]&&instance.hasWriteFunction)));};ko.exportSymbol('observable',ko.observable);ko.exportSymbol('isObservable',ko.isObservable);ko.exportSymbol('isWriteableObservable',ko.isWriteableObservable);ko.exportSymbol('isWritableObservable',ko.isWriteableObservable);ko.exportSymbol('observable.fn',observableFn);ko.exportProperty(observableFn,'peek',observableFn.peek);ko.exportProperty(observableFn,'valueHasMutated',observableFn.valueHasMutated);ko.exportProperty(observableFn,'valueWillMutate',observableFn.valueWillMutate);ko.observableArray=function(initialValues){initialValues=initialValues||[];if(typeof initialValues!='object'||!('length'in initialValues)) throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");var result=ko.observable(initialValues);ko.utils.setPrototypeOfOrExtend(result,ko.observableArray['fn']);return result.extend({'trackArrayChanges':true});};ko.observableArray['fn']={'remove':function(valueOrPredicate){var underlyingArray=this.peek();var removedValues=[];var predicate=typeof valueOrPredicate=="function"&&!ko.isObservable(valueOrPredicate)?valueOrPredicate:function(value){return value===valueOrPredicate;};for(var i=0;i=0;});},'destroy':function(valueOrPredicate){var underlyingArray=this.peek();var predicate=typeof valueOrPredicate=="function"&&!ko.isObservable(valueOrPredicate)?valueOrPredicate:function(value){return value===valueOrPredicate;};this.valueWillMutate();for(var i=underlyingArray.length-1;i>=0;i--){var value=underlyingArray[i];if(predicate(value)) value["_destroy"]=true;} this.valueHasMutated();},'destroyAll':function(arrayOfValues){if(arrayOfValues===undefined) return this['destroy'](function(){return true});if(!arrayOfValues) return[];return this['destroy'](function(value){return ko.utils.arrayIndexOf(arrayOfValues,value)>=0;});},'indexOf':function(item){var underlyingArray=this();return ko.utils.arrayIndexOf(underlyingArray,item);},'replace':function(oldItem,newItem){var index=this['indexOf'](oldItem);if(index>=0){this.valueWillMutate();this.peek()[index]=newItem;this.valueHasMutated();}},'sorted':function(compareFunction){var arrayCopy=this().slice(0);return compareFunction?arrayCopy.sort(compareFunction):arrayCopy.sort();},'reversed':function(){return this().slice(0).reverse();}};if(ko.utils.canSetPrototype){ko.utils.setPrototypeOf(ko.observableArray['fn'],ko.observable['fn']);} ko.utils.arrayForEach(["pop","push","reverse","shift","sort","splice","unshift"],function(methodName){ko.observableArray['fn'][methodName]=function(){var underlyingArray=this.peek();this.valueWillMutate();this.cacheDiffForKnownOperation(underlyingArray,methodName,arguments);var methodCallResult=underlyingArray[methodName].apply(underlyingArray,arguments);this.valueHasMutated();return methodCallResult===underlyingArray?this:methodCallResult;};});ko.utils.arrayForEach(["slice"],function(methodName){ko.observableArray['fn'][methodName]=function(){var underlyingArray=this();return underlyingArray[methodName].apply(underlyingArray,arguments);};});ko.isObservableArray=function(instance){return ko.isObservable(instance)&&typeof instance["remove"]=="function"&&typeof instance["push"]=="function";};ko.exportSymbol('observableArray',ko.observableArray);ko.exportSymbol('isObservableArray',ko.isObservableArray);var arrayChangeEventName='arrayChange';ko.extenders['trackArrayChanges']=function(target,options){target.compareArrayOptions={};if(options&&typeof options=="object"){ko.utils.extend(target.compareArrayOptions,options);} target.compareArrayOptions['sparse']=true;if(target.cacheDiffForKnownOperation){return;} var trackingChanges=false,cachedDiff=null,changeSubscription,spectateSubscription,pendingChanges=0,previousContents,underlyingBeforeSubscriptionAddFunction=target.beforeSubscriptionAdd,underlyingAfterSubscriptionRemoveFunction=target.afterSubscriptionRemove;target.beforeSubscriptionAdd=function(event){if(underlyingBeforeSubscriptionAddFunction){underlyingBeforeSubscriptionAddFunction.call(target,event);} if(event===arrayChangeEventName){trackChanges();}};target.afterSubscriptionRemove=function(event){if(underlyingAfterSubscriptionRemoveFunction){underlyingAfterSubscriptionRemoveFunction.call(target,event);} if(event===arrayChangeEventName&&!target.hasSubscriptionsForEvent(arrayChangeEventName)){if(changeSubscription){changeSubscription.dispose();} if(spectateSubscription){spectateSubscription.dispose();} spectateSubscription=changeSubscription=null;trackingChanges=false;previousContents=undefined;}};function trackChanges(){if(trackingChanges){notifyChanges();return;} trackingChanges=true;spectateSubscription=target.subscribe(function(){++pendingChanges;},null,"spectate");previousContents=[].concat(target.peek()||[]);cachedDiff=null;changeSubscription=target.subscribe(notifyChanges);function notifyChanges(){if(pendingChanges){var currentContents=[].concat(target.peek()||[]),changes;if(target.hasSubscriptionsForEvent(arrayChangeEventName)){changes=getChanges(previousContents,currentContents);} previousContents=currentContents;cachedDiff=null;pendingChanges=0;if(changes&&changes.length){target['notifySubscribers'](changes,arrayChangeEventName);}}}} function getChanges(previousContents,currentContents){if(!cachedDiff||pendingChanges>1){cachedDiff=ko.utils.compareArrays(previousContents,currentContents,target.compareArrayOptions);} return cachedDiff;} target.cacheDiffForKnownOperation=function(rawArray,operationName,args){if(!trackingChanges||pendingChanges){return;} var diff=[],arrayLength=rawArray.length,argsLength=args.length,offset=0;function pushDiff(status,value,index){return diff[diff.length]={'status':status,'value':value,'index':index};} switch(operationName){case'push':offset=arrayLength;case'unshift':for(var index=0;index0){if(typeof writeFunction==="function"){writeFunction.apply(state.evaluatorFunctionTarget,arguments);}else{throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");} return this;}else{if(!state.isDisposed){ko.dependencyDetection.registerDependency(computedObservable);} if(state.isDirty||(state.isSleeping&&computedObservable.haveDependenciesChanged())){computedObservable.evaluateImmediate();} return state.latestValue;}} computedObservable[computedState]=state;computedObservable.hasWriteFunction=typeof writeFunction==="function";if(!ko.utils.canSetPrototype){ko.utils.extend(computedObservable,ko.subscribable['fn']);} ko.subscribable['fn'].init(computedObservable);ko.utils.setPrototypeOfOrExtend(computedObservable,computedFn);if(options['pure']){state.pure=true;state.isSleeping=true;ko.utils.extend(computedObservable,pureComputedOverrides);}else if(options['deferEvaluation']){ko.utils.extend(computedObservable,deferEvaluationOverrides);} if(ko.options['deferUpdates']){ko.extenders['deferred'](computedObservable,true);} if(DEBUG){computedObservable["_options"]=options;} if(state.disposeWhenNodeIsRemoved){state.suppressDisposalUntilDisposeWhenReturnsFalse=true;if(!state.disposeWhenNodeIsRemoved.nodeType){state.disposeWhenNodeIsRemoved=null;}} if(!state.isSleeping&&!options['deferEvaluation']){computedObservable.evaluateImmediate();} if(state.disposeWhenNodeIsRemoved&&computedObservable.isActive()){ko.utils.domNodeDisposal.addDisposeCallback(state.disposeWhenNodeIsRemoved,state.domNodeDisposalCallback=function(){computedObservable.dispose();});} return computedObservable;};function computedDisposeDependencyCallback(id,entryToDispose){if(entryToDispose!==null&&entryToDispose.dispose){entryToDispose.dispose();}} function computedBeginDependencyDetectionCallback(subscribable,id){var computedObservable=this.computedObservable,state=computedObservable[computedState];if(!state.isDisposed){if(this.disposalCount&&this.disposalCandidates[id]){computedObservable.addDependencyTracking(id,subscribable,this.disposalCandidates[id]);this.disposalCandidates[id]=null;--this.disposalCount;}else if(!state.dependencyTracking[id]){computedObservable.addDependencyTracking(id,subscribable,state.isSleeping?{_target:subscribable}:computedObservable.subscribeToDependency(subscribable));} if(subscribable._notificationIsPending){subscribable._notifyNextChangeIfValueIsDifferent();}}} var computedFn={"equalityComparer":valuesArePrimitiveAndEqual,getDependenciesCount:function(){return this[computedState].dependenciesCount;},getDependencies:function(){var dependencyTracking=this[computedState].dependencyTracking,dependentObservables=[];ko.utils.objectForEach(dependencyTracking,function(id,dependency){dependentObservables[dependency._order]=dependency._target;});return dependentObservables;},hasAncestorDependency:function(obs){if(!this[computedState].dependenciesCount){return false;} var dependencies=this.getDependencies();if(ko.utils.arrayIndexOf(dependencies,obs)!==-1){return true;} return!!ko.utils.arrayFirst(dependencies,function(dep){return dep.hasAncestorDependency&&dep.hasAncestorDependency(obs);});},addDependencyTracking:function(id,target,trackingObj){if(this[computedState].pure&&target===this){throw Error("A 'pure' computed must not be called recursively");} this[computedState].dependencyTracking[id]=trackingObj;trackingObj._order=this[computedState].dependenciesCount++;trackingObj._version=target.getVersion();},haveDependenciesChanged:function(){var id,dependency,dependencyTracking=this[computedState].dependencyTracking;for(id in dependencyTracking){if(Object.prototype.hasOwnProperty.call(dependencyTracking,id)){dependency=dependencyTracking[id];if((this._evalDelayed&&dependency._target._notificationIsPending)||dependency._target.hasChanged(dependency._version)){return true;}}}},markDirty:function(){if(this._evalDelayed&&!this[computedState].isBeingEvaluated){this._evalDelayed(false);}},isActive:function(){var state=this[computedState];return state.isDirty||state.dependenciesCount>0;},respondToChange:function(){if(!this._notificationIsPending){this.evaluatePossiblyAsync();}else if(this[computedState].isDirty){this[computedState].isStale=true;}},subscribeToDependency:function(target){if(target._deferUpdates){var dirtySub=target.subscribe(this.markDirty,this,'dirty'),changeSub=target.subscribe(this.respondToChange,this);return{_target:target,dispose:function(){dirtySub.dispose();changeSub.dispose();}};}else{return target.subscribe(this.evaluatePossiblyAsync,this);}},evaluatePossiblyAsync:function(){var computedObservable=this,throttleEvaluationTimeout=computedObservable['throttleEvaluation'];if(throttleEvaluationTimeout&&throttleEvaluationTimeout>=0){clearTimeout(this[computedState].evaluationTimeoutInstance);this[computedState].evaluationTimeoutInstance=ko.utils.setTimeout(function(){computedObservable.evaluateImmediate(true);},throttleEvaluationTimeout);}else if(computedObservable._evalDelayed){computedObservable._evalDelayed(true);}else{computedObservable.evaluateImmediate(true);}},evaluateImmediate:function(notifyChange){var computedObservable=this,state=computedObservable[computedState],disposeWhen=state.disposeWhen,changed=false;if(state.isBeingEvaluated){return;} if(state.isDisposed){return;} if(state.disposeWhenNodeIsRemoved&&!ko.utils.domNodeIsAttachedToDocument(state.disposeWhenNodeIsRemoved)||disposeWhen&&disposeWhen()){if(!state.suppressDisposalUntilDisposeWhenReturnsFalse){computedObservable.dispose();return;}}else{state.suppressDisposalUntilDisposeWhenReturnsFalse=false;} state.isBeingEvaluated=true;try{changed=this.evaluateImmediate_CallReadWithDependencyDetection(notifyChange);}finally{state.isBeingEvaluated=false;} return changed;},evaluateImmediate_CallReadWithDependencyDetection:function(notifyChange){var computedObservable=this,state=computedObservable[computedState],changed=false;var isInitial=state.pure?undefined:!state.dependenciesCount,dependencyDetectionContext={computedObservable:computedObservable,disposalCandidates:state.dependencyTracking,disposalCount:state.dependenciesCount};ko.dependencyDetection.begin({callbackTarget:dependencyDetectionContext,callback:computedBeginDependencyDetectionCallback,computed:computedObservable,isInitial:isInitial});state.dependencyTracking={};state.dependenciesCount=0;var newValue=this.evaluateImmediate_CallReadThenEndDependencyDetection(state,dependencyDetectionContext);if(!state.dependenciesCount){computedObservable.dispose();changed=true;}else{changed=computedObservable.isDifferent(state.latestValue,newValue);} if(changed){if(!state.isSleeping){computedObservable["notifySubscribers"](state.latestValue,"beforeChange");}else{computedObservable.updateVersion();} state.latestValue=newValue;if(DEBUG)computedObservable._latestValue=newValue;computedObservable["notifySubscribers"](state.latestValue,"spectate");if(!state.isSleeping&¬ifyChange){computedObservable["notifySubscribers"](state.latestValue);} if(computedObservable._recordUpdate){computedObservable._recordUpdate();}} if(isInitial){computedObservable["notifySubscribers"](state.latestValue,"awake");} return changed;},evaluateImmediate_CallReadThenEndDependencyDetection:function(state,dependencyDetectionContext){try{var readFunction=state.readFunction;return state.evaluatorFunctionTarget?readFunction.call(state.evaluatorFunctionTarget):readFunction();}finally{ko.dependencyDetection.end();if(dependencyDetectionContext.disposalCount&&!state.isSleeping){ko.utils.objectForEach(dependencyDetectionContext.disposalCandidates,computedDisposeDependencyCallback);} state.isStale=state.isDirty=false;}},peek:function(evaluate){var state=this[computedState];if((state.isDirty&&(evaluate||!state.dependenciesCount))||(state.isSleeping&&this.haveDependenciesChanged())){this.evaluateImmediate();} return state.latestValue;},limit:function(limitFunction){ko.subscribable['fn'].limit.call(this,limitFunction);this._evalIfChanged=function(){if(!this[computedState].isSleeping){if(this[computedState].isStale){this.evaluateImmediate();}else{this[computedState].isDirty=false;}} return this[computedState].latestValue;};this._evalDelayed=function(isChange){this._limitBeforeChange(this[computedState].latestValue);this[computedState].isDirty=true;if(isChange){this[computedState].isStale=true;} this._limitChange(this,!isChange);};},dispose:function(){var state=this[computedState];if(!state.isSleeping&&state.dependencyTracking){ko.utils.objectForEach(state.dependencyTracking,function(id,dependency){if(dependency.dispose) dependency.dispose();});} if(state.disposeWhenNodeIsRemoved&&state.domNodeDisposalCallback){ko.utils.domNodeDisposal.removeDisposeCallback(state.disposeWhenNodeIsRemoved,state.domNodeDisposalCallback);} state.dependencyTracking=undefined;state.dependenciesCount=0;state.isDisposed=true;state.isStale=false;state.isDirty=false;state.isSleeping=false;state.disposeWhenNodeIsRemoved=undefined;state.disposeWhen=undefined;state.readFunction=undefined;if(!this.hasWriteFunction){state.evaluatorFunctionTarget=undefined;}}};var pureComputedOverrides={beforeSubscriptionAdd:function(event){var computedObservable=this,state=computedObservable[computedState];if(!state.isDisposed&&state.isSleeping&&event=='change'){state.isSleeping=false;if(state.isStale||computedObservable.haveDependenciesChanged()){state.dependencyTracking=null;state.dependenciesCount=0;if(computedObservable.evaluateImmediate()){computedObservable.updateVersion();}}else{var dependenciesOrder=[];ko.utils.objectForEach(state.dependencyTracking,function(id,dependency){dependenciesOrder[dependency._order]=id;});ko.utils.arrayForEach(dependenciesOrder,function(id,order){var dependency=state.dependencyTracking[id],subscription=computedObservable.subscribeToDependency(dependency._target);subscription._order=order;subscription._version=dependency._version;state.dependencyTracking[id]=subscription;});if(computedObservable.haveDependenciesChanged()){if(computedObservable.evaluateImmediate()){computedObservable.updateVersion();}}} if(!state.isDisposed){computedObservable["notifySubscribers"](state.latestValue,"awake");}}},afterSubscriptionRemove:function(event){var state=this[computedState];if(!state.isDisposed&&event=='change'&&!this.hasSubscriptionsForEvent('change')){ko.utils.objectForEach(state.dependencyTracking,function(id,dependency){if(dependency.dispose){state.dependencyTracking[id]={_target:dependency._target,_order:dependency._order,_version:dependency._version};dependency.dispose();}});state.isSleeping=true;this["notifySubscribers"](undefined,"asleep");}},getVersion:function(){var state=this[computedState];if(state.isSleeping&&(state.isStale||this.haveDependenciesChanged())){this.evaluateImmediate();} return ko.subscribable['fn'].getVersion.call(this);}};var deferEvaluationOverrides={beforeSubscriptionAdd:function(event){if(event=='change'||event=='beforeChange'){this.peek();}}};if(ko.utils.canSetPrototype){ko.utils.setPrototypeOf(computedFn,ko.subscribable['fn']);} var protoProp=ko.observable.protoProperty;computedFn[protoProp]=ko.computed;ko.isComputed=function(instance){return(typeof instance=='function'&&instance[protoProp]===computedFn[protoProp]);};ko.isPureComputed=function(instance){return ko.isComputed(instance)&&instance[computedState]&&instance[computedState].pure;};ko.exportSymbol('computed',ko.computed);ko.exportSymbol('dependentObservable',ko.computed);ko.exportSymbol('isComputed',ko.isComputed);ko.exportSymbol('isPureComputed',ko.isPureComputed);ko.exportSymbol('computed.fn',computedFn);ko.exportProperty(computedFn,'peek',computedFn.peek);ko.exportProperty(computedFn,'dispose',computedFn.dispose);ko.exportProperty(computedFn,'isActive',computedFn.isActive);ko.exportProperty(computedFn,'getDependenciesCount',computedFn.getDependenciesCount);ko.exportProperty(computedFn,'getDependencies',computedFn.getDependencies);ko.pureComputed=function(evaluatorFunctionOrOptions,evaluatorFunctionTarget){if(typeof evaluatorFunctionOrOptions==='function'){return ko.computed(evaluatorFunctionOrOptions,evaluatorFunctionTarget,{'pure':true});}else{evaluatorFunctionOrOptions=ko.utils.extend({},evaluatorFunctionOrOptions);evaluatorFunctionOrOptions['pure']=true;return ko.computed(evaluatorFunctionOrOptions,evaluatorFunctionTarget);}} ko.exportSymbol('pureComputed',ko.pureComputed);(function(){var maxNestedObservableDepth=10;ko.toJS=function(rootObject){if(arguments.length==0) throw new Error("When calling ko.toJS, pass the object you want to convert.");return mapJsObjectGraph(rootObject,function(valueToMap){for(var i=0;ko.isObservable(valueToMap)&&(i=0) this.values[existingIndex]=value;else{this.keys.push(key);this.values.push(value);}},get:function(key){var existingIndex=ko.utils.arrayIndexOf(this.keys,key);return(existingIndex>=0)?this.values[existingIndex]:undefined;}};})();ko.exportSymbol('toJS',ko.toJS);ko.exportSymbol('toJSON',ko.toJSON);ko.when=function(predicate,callback,context){function kowhen(resolve){var observable=ko.pureComputed(predicate,context).extend({notify:'always'});var subscription=observable.subscribe(function(value){if(value){subscription.dispose();resolve(value);}});observable['notifySubscribers'](observable.peek());return subscription;} if(typeof Promise==="function"&&!callback){return new Promise(kowhen);}else{return kowhen(callback.bind(context));}};ko.exportSymbol('when',ko.when);(function(){var hasDomDataExpandoProperty='__ko__hasDomDataOptionValue__';ko.selectExtensions={readValue:function(element){switch(ko.utils.tagNameLower(element)){case'option':if(element[hasDomDataExpandoProperty]===true) return ko.utils.domData.get(element,ko.bindingHandlers.options.optionValueDomDataKey);return ko.utils.ieVersion<=7?(element.getAttributeNode('value')&&element.getAttributeNode('value').specified?element.value:element.text):element.value;case'select':return element.selectedIndex>=0?ko.selectExtensions.readValue(element.options[element.selectedIndex]):undefined;default:return element.value;}},writeValue:function(element,value,allowUnset){switch(ko.utils.tagNameLower(element)){case'option':if(typeof value==="string"){ko.utils.domData.set(element,ko.bindingHandlers.options.optionValueDomDataKey,undefined);if(hasDomDataExpandoProperty in element){delete element[hasDomDataExpandoProperty];} element.value=value;} else{ko.utils.domData.set(element,ko.bindingHandlers.options.optionValueDomDataKey,value);element[hasDomDataExpandoProperty]=true;element.value=typeof value==="number"?value:"";} break;case'select':if(value===""||value===null) value=undefined;var selection=-1;for(var i=0,n=element.options.length,optionValue;i=0||(value===undefined&&element.size>1)){element.selectedIndex=selection;if(ko.utils.ieVersion===6){ko.utils.setTimeout(function(){element.selectedIndex=selection;},0);}} break;default:if((value===null)||(value===undefined)) value="";element.value=value;break;}}};})();ko.exportSymbol('selectExtensions',ko.selectExtensions);ko.exportSymbol('selectExtensions.readValue',ko.selectExtensions.readValue);ko.exportSymbol('selectExtensions.writeValue',ko.selectExtensions.writeValue);ko.expressionRewriting=(function(){var javaScriptReservedWords=["true","false","null","undefined"];var javaScriptAssignmentTarget=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i;function getWriteableValue(expression){if(ko.utils.arrayIndexOf(javaScriptReservedWords,expression)>=0) return false;var match=expression.match(javaScriptAssignmentTarget);return match===null?false:match[1]?('Object('+match[1]+')'+match[2]):expression;} var specials=',"\'`{}()/:[\\]',bindingToken=RegExp(['"(?:\\\\.|[^"])*"',"'(?:\\\\.|[^'])*'","`(?:\\\\.|[^`])*`","/\\*(?:[^*]|\\*+[^*/])*\\*+/","//.*\n",'/(?:\\\\.|[^/])+/\w*','[^\\s:,/][^'+specials+']*[^\\s'+specials+']','[^\\s]'].join('|'),'g'),divisionLookBehind=/[\])"'A-Za-z0-9_$]+$/,keywordRegexLookBehind={'in':1,'return':1,'typeof':1};function parseObjectLiteral(objectLiteralString){var str=ko.utils.stringTrim(objectLiteralString);if(str.charCodeAt(0)===123)str=str.slice(1,-1);str+="\n,";var result=[],toks=str.match(bindingToken),key,values=[],depth=0;if(toks.length>1){for(var i=0,tok;tok=toks[i];++i){var c=tok.charCodeAt(0);if(c===44){if(depth<=0){result.push((key&&values.length)?{key:key,value:values.join('')}:{'unknown':key||values.join('')});key=depth=0;values=[];continue;}}else if(c===58){if(!depth&&!key&&values.length===1){key=values.pop();continue;}}else if(c===47&&tok.length>1&&(tok.charCodeAt(1)===47||tok.charCodeAt(1)===42)){continue;}else if(c===47&&i&&tok.length>1){var match=toks[i-1].match(divisionLookBehind);if(match&&!keywordRegexLookBehind[match[0]]){str=str.substr(str.indexOf(tok)+1);toks=str.match(bindingToken);i=-1;tok='/';}}else if(c===40||c===123||c===91){++depth;}else if(c===41||c===125||c===93){--depth;}else if(!key&&!values.length&&(c===34||c===39)){tok=tok.slice(1,-1);} values.push(tok);} if(depth>0){throw Error("Unbalanced parentheses, braces, or brackets");}} return result;} var twoWayBindings={};function preProcessBindings(bindingsStringOrKeyValueArray,bindingOptions){bindingOptions=bindingOptions||{};function processKeyValue(key,val){var writableVal;function callPreprocessHook(obj){return(obj&&obj['preprocess'])?(val=obj['preprocess'](val,key,processKeyValue)):true;} if(!bindingParams){if(!callPreprocessHook(ko['getBindingHandler'](key))) return;if(twoWayBindings[key]&&(writableVal=getWriteableValue(val))){var writeKey=typeof twoWayBindings[key]=='string'?twoWayBindings[key]:key;propertyAccessorResultStrings.push("'"+writeKey+"':function(_z){"+writableVal+"=_z}");}} if(makeValueAccessors){val='function(){return '+val+' }';} resultStrings.push("'"+key+"':"+val);} var resultStrings=[],propertyAccessorResultStrings=[],makeValueAccessors=bindingOptions['valueAccessors'],bindingParams=bindingOptions['bindingParams'],keyValueArray=typeof bindingsStringOrKeyValueArray==="string"?parseObjectLiteral(bindingsStringOrKeyValueArray):bindingsStringOrKeyValueArray;ko.utils.arrayForEach(keyValueArray,function(keyValue){processKeyValue(keyValue.key||keyValue['unknown'],keyValue.value);});if(propertyAccessorResultStrings.length) processKeyValue('_ko_property_writers',"{"+propertyAccessorResultStrings.join(",")+" }");return resultStrings.join(",");} return{bindingRewriteValidators:[],twoWayBindings:twoWayBindings,parseObjectLiteral:parseObjectLiteral,preProcessBindings:preProcessBindings,keyValueArrayContainsKey:function(keyValueArray,key){for(var i=0;i";var startCommentRegex=commentNodesHaveTextProperty?/^$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/;var endCommentRegex=commentNodesHaveTextProperty?/^$/:/^\s*\/ko\s*$/;var htmlTagsWithOptionallyClosingChildren={'ul':true,'ol':true};function isStartComment(node){return(node.nodeType==8)&&startCommentRegex.test(commentNodesHaveTextProperty?node.text:node.nodeValue);} function isEndComment(node){return(node.nodeType==8)&&endCommentRegex.test(commentNodesHaveTextProperty?node.text:node.nodeValue);} function isUnmatchedEndComment(node){return isEndComment(node)&&!(ko.utils.domData.get(node,matchedEndCommentDataKey));} var matchedEndCommentDataKey="__ko_matchedEndComment__" function getVirtualChildren(startComment,allowUnbalanced){var currentNode=startComment;var depth=1;var children=[];while(currentNode=currentNode.nextSibling){if(isEndComment(currentNode)){ko.utils.domData.set(currentNode,matchedEndCommentDataKey,true);depth--;if(depth===0) return children;} children.push(currentNode);if(isStartComment(currentNode)) depth++;} if(!allowUnbalanced) throw new Error("Cannot find closing comment tag to match: "+startComment.nodeValue);return null;} function getMatchingEndComment(startComment,allowUnbalanced){var allVirtualChildren=getVirtualChildren(startComment,allowUnbalanced);if(allVirtualChildren){if(allVirtualChildren.length>0) return allVirtualChildren[allVirtualChildren.length-1].nextSibling;return startComment.nextSibling;}else return null;} function getUnbalancedChildTags(node){var childNode=node.firstChild,captureRemaining=null;if(childNode){do{if(captureRemaining) captureRemaining.push(childNode);else if(isStartComment(childNode)){var matchingEndComment=getMatchingEndComment(childNode,true);if(matchingEndComment) childNode=matchingEndComment;else captureRemaining=[childNode];}else if(isEndComment(childNode)){captureRemaining=[childNode];}}while(childNode=childNode.nextSibling);} return captureRemaining;} ko.virtualElements={allowedBindings:{},childNodes:function(node){return isStartComment(node)?getVirtualChildren(node):node.childNodes;},emptyNode:function(node){if(!isStartComment(node)) ko.utils.emptyDomNode(node);else{var virtualChildren=ko.virtualElements.childNodes(node);for(var i=0,j=virtualChildren.length;i0&&element.lookupNamespaceURI(attrName.substr(0,prefixLen));var toRemove=(attrValue===false)||(attrValue===null)||(attrValue===undefined);if(toRemove){namespace?element.removeAttributeNS(namespace,attrName):element.removeAttribute(attrName);}else{attrValue=attrValue.toString();} if(ko.utils.ieVersion<=8&&attrName in attrHtmlToJavaScriptMap){attrName=attrHtmlToJavaScriptMap[attrName];if(toRemove) element.removeAttribute(attrName);else element[attrName]=attrValue;}else if(!toRemove){namespace?element.setAttributeNS(namespace,attrName,attrValue):element.setAttribute(attrName,attrValue);} if(attrName==="name"){ko.utils.setElementName(element,toRemove?"":attrValue);}});}};(function(){ko.bindingHandlers['checked']={'after':['value','attr'],'init':function(element,valueAccessor,allBindings){var checkedValue=ko.pureComputed(function(){if(allBindings['has']('checkedValue')){return ko.utils.unwrapObservable(allBindings.get('checkedValue'));}else if(useElementValue){if(allBindings['has']('value')){return ko.utils.unwrapObservable(allBindings.get('value'));}else{return element.value;}}});function updateModel(){var isChecked=element.checked,elemValue=checkedValue();if(ko.computedContext.isInitial()){return;} if(!isChecked&&(isRadio||ko.computedContext.getDependenciesCount())){return;} var modelValue=ko.dependencyDetection.ignore(valueAccessor);if(valueIsArray){var writableValue=rawValueIsNonArrayObservable?modelValue.peek():modelValue,saveOldValue=oldElemValue;oldElemValue=elemValue;if(saveOldValue!==elemValue){if(isChecked){ko.utils.addOrRemoveItem(writableValue,elemValue,true);ko.utils.addOrRemoveItem(writableValue,saveOldValue,false);}}else{ko.utils.addOrRemoveItem(writableValue,elemValue,isChecked);} if(rawValueIsNonArrayObservable&&ko.isWriteableObservable(modelValue)){modelValue(writableValue);}}else{if(isCheckbox){if(elemValue===undefined){elemValue=isChecked;}else if(!isChecked){elemValue=undefined;}} ko.expressionRewriting.writeValueToProperty(modelValue,allBindings,'checked',elemValue,true);}};function updateView(){var modelValue=ko.utils.unwrapObservable(valueAccessor()),elemValue=checkedValue();if(valueIsArray){element.checked=ko.utils.arrayIndexOf(modelValue,elemValue)>=0;oldElemValue=elemValue;}else if(isCheckbox&&elemValue===undefined){element.checked=!!modelValue;}else{element.checked=(checkedValue()===modelValue);}};var isCheckbox=element.type=="checkbox",isRadio=element.type=="radio";if(!isCheckbox&&!isRadio){return;} var rawValue=valueAccessor(),valueIsArray=isCheckbox&&(ko.utils.unwrapObservable(rawValue)instanceof Array),rawValueIsNonArrayObservable=!(valueIsArray&&rawValue.push&&rawValue.splice),useElementValue=isRadio||valueIsArray,oldElemValue=valueIsArray?checkedValue():undefined;if(isRadio&&!element.name) ko.bindingHandlers['uniqueName']['init'](element,function(){return true});ko.computed(updateModel,null,{disposeWhenNodeIsRemoved:element});ko.utils.registerEventHandler(element,"click",updateModel);ko.computed(updateView,null,{disposeWhenNodeIsRemoved:element});rawValue=undefined;}};ko.expressionRewriting.twoWayBindings['checked']=true;ko.bindingHandlers['checkedValue']={'update':function(element,valueAccessor){element.value=ko.utils.unwrapObservable(valueAccessor());}};})();var classesWrittenByBindingKey='__ko__cssValue';ko.bindingHandlers['class']={'update':function(element,valueAccessor){var value=ko.utils.stringTrim(ko.utils.unwrapObservable(valueAccessor()));ko.utils.toggleDomNodeCssClass(element,element[classesWrittenByBindingKey],false);element[classesWrittenByBindingKey]=value;ko.utils.toggleDomNodeCssClass(element,value,true);}};ko.bindingHandlers['css']={'update':function(element,valueAccessor){var value=ko.utils.unwrapObservable(valueAccessor());if(value!==null&&typeof value=="object"){ko.utils.objectForEach(value,function(className,shouldHaveClass){shouldHaveClass=ko.utils.unwrapObservable(shouldHaveClass);ko.utils.toggleDomNodeCssClass(element,className,shouldHaveClass);});}else{ko.bindingHandlers['class']['update'](element,valueAccessor);}}};ko.bindingHandlers['enable']={'update':function(element,valueAccessor){var value=ko.utils.unwrapObservable(valueAccessor());if(value&&element.disabled) element.removeAttribute("disabled");else if((!value)&&(!element.disabled)) element.disabled=true;}};ko.bindingHandlers['disable']={'update':function(element,valueAccessor){ko.bindingHandlers['enable']['update'](element,function(){return!ko.utils.unwrapObservable(valueAccessor())});}};function makeEventHandlerShortcut(eventName){ko.bindingHandlers[eventName]={'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){var newValueAccessor=function(){var result={};result[eventName]=valueAccessor();return result;};return ko.bindingHandlers['event']['init'].call(this,element,newValueAccessor,allBindings,viewModel,bindingContext);}}} ko.bindingHandlers['event']={'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){var eventsToHandle=valueAccessor()||{};ko.utils.objectForEach(eventsToHandle,function(eventName){if(typeof eventName=="string"){ko.utils.registerEventHandler(element,eventName,function(event){var handlerReturnValue;var handlerFunction=valueAccessor()[eventName];if(!handlerFunction) return;try{var argsForHandler=ko.utils.makeArray(arguments);viewModel=bindingContext['$data'];argsForHandler.unshift(viewModel);handlerReturnValue=handlerFunction.apply(viewModel,argsForHandler);}finally{if(handlerReturnValue!==true){if(event.preventDefault) event.preventDefault();else event.returnValue=false;}} var bubble=allBindings.get(eventName+'Bubble')!==false;if(!bubble){event.cancelBubble=true;if(event.stopPropagation) event.stopPropagation();}});}});}};ko.bindingHandlers['foreach']={makeTemplateValueAccessor:function(valueAccessor){return function(){var modelValue=valueAccessor(),unwrappedValue=ko.utils.peekObservable(modelValue);if((!unwrappedValue)||typeof unwrappedValue.length=="number") return{'foreach':modelValue,'templateEngine':ko.nativeTemplateEngine.instance};ko.utils.unwrapObservable(modelValue);return{'foreach':unwrappedValue['data'],'as':unwrappedValue['as'],'noChildContext':unwrappedValue['noChildContext'],'includeDestroyed':unwrappedValue['includeDestroyed'],'afterAdd':unwrappedValue['afterAdd'],'beforeRemove':unwrappedValue['beforeRemove'],'afterRender':unwrappedValue['afterRender'],'beforeMove':unwrappedValue['beforeMove'],'afterMove':unwrappedValue['afterMove'],'templateEngine':ko.nativeTemplateEngine.instance};};},'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){return ko.bindingHandlers['template']['init'](element,ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));},'update':function(element,valueAccessor,allBindings,viewModel,bindingContext){return ko.bindingHandlers['template']['update'](element,ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor),allBindings,viewModel,bindingContext);}};ko.expressionRewriting.bindingRewriteValidators['foreach']=false;ko.virtualElements.allowedBindings['foreach']=true;var hasfocusUpdatingProperty='__ko_hasfocusUpdating';var hasfocusLastValue='__ko_hasfocusLastValue';ko.bindingHandlers['hasfocus']={'init':function(element,valueAccessor,allBindings){var handleElementFocusChange=function(isFocused){element[hasfocusUpdatingProperty]=true;var ownerDoc=element.ownerDocument;if("activeElement"in ownerDoc){var active;try{active=ownerDoc.activeElement;}catch(e){active=ownerDoc.body;} isFocused=(active===element);} var modelValue=valueAccessor();ko.expressionRewriting.writeValueToProperty(modelValue,allBindings,'hasfocus',isFocused,true);element[hasfocusLastValue]=isFocused;element[hasfocusUpdatingProperty]=false;};var handleElementFocusIn=handleElementFocusChange.bind(null,true);var handleElementFocusOut=handleElementFocusChange.bind(null,false);ko.utils.registerEventHandler(element,"focus",handleElementFocusIn);ko.utils.registerEventHandler(element,"focusin",handleElementFocusIn);ko.utils.registerEventHandler(element,"blur",handleElementFocusOut);ko.utils.registerEventHandler(element,"focusout",handleElementFocusOut);element[hasfocusLastValue]=false;},'update':function(element,valueAccessor){var value=!!ko.utils.unwrapObservable(valueAccessor());if(!element[hasfocusUpdatingProperty]&&element[hasfocusLastValue]!==value){value?element.focus():element.blur();if(!value&&element[hasfocusLastValue]){element.ownerDocument.body.focus();} ko.dependencyDetection.ignore(ko.utils.triggerEvent,null,[element,value?"focusin":"focusout"]);}}};ko.expressionRewriting.twoWayBindings['hasfocus']=true;ko.bindingHandlers['hasFocus']=ko.bindingHandlers['hasfocus'];ko.expressionRewriting.twoWayBindings['hasFocus']='hasfocus';ko.bindingHandlers['html']={'init':function(){return{'controlsDescendantBindings':true};},'update':function(element,valueAccessor){ko.utils.setHtml(element,valueAccessor());}};(function(){function makeWithIfBinding(bindingKey,isWith,isNot){ko.bindingHandlers[bindingKey]={'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){var didDisplayOnLastUpdate,savedNodes,contextOptions={},completeOnRender,needAsyncContext,renderOnEveryChange;if(isWith){var as=allBindings.get('as'),noChildContext=allBindings.get('noChildContext');renderOnEveryChange=!(as&&noChildContext);contextOptions={'as':as,'noChildContext':noChildContext,'exportDependencies':renderOnEveryChange};} completeOnRender=allBindings.get("completeOn")=="render";needAsyncContext=completeOnRender||allBindings['has'](ko.bindingEvent.descendantsComplete);ko.computed(function(){var value=ko.utils.unwrapObservable(valueAccessor()),shouldDisplay=!isNot!==!value,isInitial=!savedNodes,childContext;if(!renderOnEveryChange&&shouldDisplay===didDisplayOnLastUpdate){return;} if(needAsyncContext){bindingContext=ko.bindingEvent.startPossiblyAsyncContentBinding(element,bindingContext);} if(shouldDisplay){if(!isWith||renderOnEveryChange){contextOptions['dataDependency']=ko.computedContext.computed();} if(isWith){childContext=bindingContext['createChildContext'](typeof value=="function"?value:valueAccessor,contextOptions);}else if(ko.computedContext.getDependenciesCount()){childContext=bindingContext['extend'](null,contextOptions);}else{childContext=bindingContext;}} if(isInitial&&ko.computedContext.getDependenciesCount()){savedNodes=ko.utils.cloneNodes(ko.virtualElements.childNodes(element),true);} if(shouldDisplay){if(!isInitial){ko.virtualElements.setDomNodeChildren(element,ko.utils.cloneNodes(savedNodes));} ko.applyBindingsToDescendants(childContext,element);}else{ko.virtualElements.emptyNode(element);if(!completeOnRender){ko.bindingEvent.notify(element,ko.bindingEvent.childrenComplete);}} didDisplayOnLastUpdate=shouldDisplay;},null,{disposeWhenNodeIsRemoved:element});return{'controlsDescendantBindings':true};}};ko.expressionRewriting.bindingRewriteValidators[bindingKey]=false;ko.virtualElements.allowedBindings[bindingKey]=true;} makeWithIfBinding('if');makeWithIfBinding('ifnot',false,true);makeWithIfBinding('with',true);})();ko.bindingHandlers['let']={'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){var innerContext=bindingContext['extend'](valueAccessor);ko.applyBindingsToDescendants(innerContext,element);return{'controlsDescendantBindings':true};}};ko.virtualElements.allowedBindings['let']=true;var captionPlaceholder={};ko.bindingHandlers['options']={'init':function(element){if(ko.utils.tagNameLower(element)!=="select") throw new Error("options binding applies only to SELECT elements");while(element.length>0){element.remove(0);} return{'controlsDescendantBindings':true};},'update':function(element,valueAccessor,allBindings){function selectedOptions(){return ko.utils.arrayFilter(element.options,function(node){return node.selected;});} var selectWasPreviouslyEmpty=element.length==0,multiple=element.multiple,previousScrollTop=(!selectWasPreviouslyEmpty&&multiple)?element.scrollTop:null,unwrappedArray=ko.utils.unwrapObservable(valueAccessor()),valueAllowUnset=allBindings.get('valueAllowUnset')&&allBindings['has']('value'),includeDestroyed=allBindings.get('optionsIncludeDestroyed'),arrayToDomNodeChildrenOptions={},captionValue,filteredArray,previousSelectedValues=[];if(!valueAllowUnset){if(multiple){previousSelectedValues=ko.utils.arrayMap(selectedOptions(),ko.selectExtensions.readValue);}else if(element.selectedIndex>=0){previousSelectedValues.push(ko.selectExtensions.readValue(element.options[element.selectedIndex]));}} if(unwrappedArray){if(typeof unwrappedArray.length=="undefined") unwrappedArray=[unwrappedArray];filteredArray=ko.utils.arrayFilter(unwrappedArray,function(item){return includeDestroyed||item===undefined||item===null||!ko.utils.unwrapObservable(item['_destroy']);});if(allBindings['has']('optionsCaption')){captionValue=ko.utils.unwrapObservable(allBindings.get('optionsCaption'));if(captionValue!==null&&captionValue!==undefined){filteredArray.unshift(captionPlaceholder);}}}else{} function applyToObject(object,predicate,defaultValue){var predicateType=typeof predicate;if(predicateType=="function") return predicate(object);else if(predicateType=="string") return object[predicate];else return defaultValue;} var itemUpdate=false;function optionForArrayItem(arrayEntry,index,oldOptions){if(oldOptions.length){previousSelectedValues=!valueAllowUnset&&oldOptions[0].selected?[ko.selectExtensions.readValue(oldOptions[0])]:[];itemUpdate=true;} var option=element.ownerDocument.createElement("option");if(arrayEntry===captionPlaceholder){ko.utils.setTextContent(option,allBindings.get('optionsCaption'));ko.selectExtensions.writeValue(option,undefined);}else{var optionValue=applyToObject(arrayEntry,allBindings.get('optionsValue'),arrayEntry);ko.selectExtensions.writeValue(option,ko.utils.unwrapObservable(optionValue));var optionText=applyToObject(arrayEntry,allBindings.get('optionsText'),optionValue);ko.utils.setTextContent(option,optionText);} return[option];} arrayToDomNodeChildrenOptions['beforeRemove']=function(option){element.removeChild(option);};function setSelectionCallback(arrayEntry,newOptions){if(itemUpdate&&valueAllowUnset){ko.bindingEvent.notify(element,ko.bindingEvent.childrenComplete);}else if(previousSelectedValues.length){var isSelected=ko.utils.arrayIndexOf(previousSelectedValues,ko.selectExtensions.readValue(newOptions[0]))>=0;ko.utils.setOptionNodeSelectionState(newOptions[0],isSelected);if(itemUpdate&&!isSelected){ko.dependencyDetection.ignore(ko.utils.triggerEvent,null,[element,"change"]);}}} var callback=setSelectionCallback;if(allBindings['has']('optionsAfterRender')&&typeof allBindings.get('optionsAfterRender')=="function"){callback=function(arrayEntry,newOptions){setSelectionCallback(arrayEntry,newOptions);ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'),null,[newOptions[0],arrayEntry!==captionPlaceholder?arrayEntry:undefined]);}} ko.utils.setDomNodeChildrenFromArrayMapping(element,filteredArray,optionForArrayItem,arrayToDomNodeChildrenOptions,callback);if(!valueAllowUnset){var selectionChanged;if(multiple){selectionChanged=previousSelectedValues.length&&selectedOptions().length=0)?(ko.selectExtensions.readValue(element.options[element.selectedIndex])!==previousSelectedValues[0]):(previousSelectedValues.length||element.selectedIndex>=0);} if(selectionChanged){ko.dependencyDetection.ignore(ko.utils.triggerEvent,null,[element,"change"]);}} if(valueAllowUnset||ko.computedContext.isInitial()){ko.bindingEvent.notify(element,ko.bindingEvent.childrenComplete);} ko.utils.ensureSelectElementIsRenderedCorrectly(element);if(previousScrollTop&&Math.abs(previousScrollTop-element.scrollTop)>20) element.scrollTop=previousScrollTop;}};ko.bindingHandlers['options'].optionValueDomDataKey=ko.utils.domData.nextKey();ko.bindingHandlers['selectedOptions']={'init':function(element,valueAccessor,allBindings){function updateFromView(){var value=valueAccessor(),valueToWrite=[];ko.utils.arrayForEach(element.getElementsByTagName("option"),function(node){if(node.selected) valueToWrite.push(ko.selectExtensions.readValue(node));});ko.expressionRewriting.writeValueToProperty(value,allBindings,'selectedOptions',valueToWrite);} function updateFromModel(){var newValue=ko.utils.unwrapObservable(valueAccessor()),previousScrollTop=element.scrollTop;if(newValue&&typeof newValue.length=="number"){ko.utils.arrayForEach(element.getElementsByTagName("option"),function(node){var isSelected=ko.utils.arrayIndexOf(newValue,ko.selectExtensions.readValue(node))>=0;if(node.selected!=isSelected){ko.utils.setOptionNodeSelectionState(node,isSelected);}});} element.scrollTop=previousScrollTop;} if(ko.utils.tagNameLower(element)!="select"){throw new Error("selectedOptions binding applies only to SELECT elements");} var updateFromModelComputed;ko.bindingEvent.subscribe(element,ko.bindingEvent.childrenComplete,function(){if(!updateFromModelComputed){ko.utils.registerEventHandler(element,"change",updateFromView);updateFromModelComputed=ko.computed(updateFromModel,null,{disposeWhenNodeIsRemoved:element});}else{updateFromView();}},null,{'notifyImmediately':true});},'update':function(){}};ko.expressionRewriting.twoWayBindings['selectedOptions']=true;ko.bindingHandlers['style']={'update':function(element,valueAccessor){var value=ko.utils.unwrapObservable(valueAccessor()||{});ko.utils.objectForEach(value,function(styleName,styleValue){styleValue=ko.utils.unwrapObservable(styleValue);if(styleValue===null||styleValue===undefined||styleValue===false){styleValue="";} if(jQueryInstance){jQueryInstance(element)['css'](styleName,styleValue);}else if(/^--/.test(styleName)){element.style.setProperty(styleName,styleValue);}else{styleName=styleName.replace(/-(\w)/g,function(all,letter){return letter.toUpperCase();});var previousStyle=element.style[styleName];element.style[styleName]=styleValue;if(styleValue!==previousStyle&&element.style[styleName]==previousStyle&&!isNaN(styleValue)){element.style[styleName]=styleValue+"px";}}});}};ko.bindingHandlers['submit']={'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){if(typeof valueAccessor()!="function") throw new Error("The value for a submit binding must be a function");ko.utils.registerEventHandler(element,"submit",function(event){var handlerReturnValue;var value=valueAccessor();try{handlerReturnValue=value.call(bindingContext['$data'],element);} finally{if(handlerReturnValue!==true){if(event.preventDefault) event.preventDefault();else event.returnValue=false;}}});}};ko.bindingHandlers['text']={'init':function(){return{'controlsDescendantBindings':true};},'update':function(element,valueAccessor){ko.utils.setTextContent(element,valueAccessor());}};ko.virtualElements.allowedBindings['text']=true;(function(){if(window&&window.navigator){var parseVersion=function(matches){if(matches){return parseFloat(matches[1]);}};var userAgent=window.navigator.userAgent,operaVersion,chromeVersion,safariVersion,firefoxVersion,ieVersion,edgeVersion;(operaVersion=window.opera&&window.opera.version&&parseInt(window.opera.version()))||(edgeVersion=parseVersion(userAgent.match(/Edge\/([^ ]+)$/)))||(chromeVersion=parseVersion(userAgent.match(/Chrome\/([^ ]+)/)))||(safariVersion=parseVersion(userAgent.match(/Version\/([^ ]+) Safari/)))||(firefoxVersion=parseVersion(userAgent.match(/Firefox\/([^ ]+)/)))||(ieVersion=ko.utils.ieVersion||parseVersion(userAgent.match(/MSIE ([^ ]+)/)))||(ieVersion=parseVersion(userAgent.match(/rv:([^ )]+)/)));} if(ieVersion>=8&&ieVersion<10){var selectionChangeRegisteredName=ko.utils.domData.nextKey(),selectionChangeHandlerName=ko.utils.domData.nextKey();var selectionChangeHandler=function(event){var target=this.activeElement,handler=target&&ko.utils.domData.get(target,selectionChangeHandlerName);if(handler){handler(event);}};var registerForSelectionChangeEvent=function(element,handler){var ownerDoc=element.ownerDocument;if(!ko.utils.domData.get(ownerDoc,selectionChangeRegisteredName)){ko.utils.domData.set(ownerDoc,selectionChangeRegisteredName,true);ko.utils.registerEventHandler(ownerDoc,'selectionchange',selectionChangeHandler);} ko.utils.domData.set(element,selectionChangeHandlerName,handler);};} ko.bindingHandlers['textInput']={'init':function(element,valueAccessor,allBindings){var previousElementValue=element.value,timeoutHandle,elementValueBeforeEvent;var updateModel=function(event){clearTimeout(timeoutHandle);elementValueBeforeEvent=timeoutHandle=undefined;var elementValue=element.value;if(previousElementValue!==elementValue){if(DEBUG&&event)element['_ko_textInputProcessedEvent']=event.type;previousElementValue=elementValue;ko.expressionRewriting.writeValueToProperty(valueAccessor(),allBindings,'textInput',elementValue);}};var deferUpdateModel=function(event){if(!timeoutHandle){elementValueBeforeEvent=element.value;var handler=DEBUG?updateModel.bind(element,{type:event.type}):updateModel;timeoutHandle=ko.utils.setTimeout(handler,4);}};var ieUpdateModel=ko.utils.ieVersion==9?deferUpdateModel:updateModel,ourUpdate=false;var updateView=function(){var modelValue=ko.utils.unwrapObservable(valueAccessor());if(modelValue===null||modelValue===undefined){modelValue='';} if(elementValueBeforeEvent!==undefined&&modelValue===elementValueBeforeEvent){ko.utils.setTimeout(updateView,4);return;} if(element.value!==modelValue){ourUpdate=true;element.value=modelValue;ourUpdate=false;previousElementValue=element.value;}};var onEvent=function(event,handler){ko.utils.registerEventHandler(element,event,handler);};if(DEBUG&&ko.bindingHandlers['textInput']['_forceUpdateOn']){ko.utils.arrayForEach(ko.bindingHandlers['textInput']['_forceUpdateOn'],function(eventName){if(eventName.slice(0,5)=='after'){onEvent(eventName.slice(5),deferUpdateModel);}else{onEvent(eventName,updateModel);}});}else{if(ieVersion){onEvent('keypress',updateModel);} if(ieVersion<11){onEvent('propertychange',function(event){if(!ourUpdate&&event.propertyName==='value'){ieUpdateModel(event);}});} if(ieVersion==8){onEvent('keyup',updateModel);onEvent('keydown',updateModel);} if(registerForSelectionChangeEvent){registerForSelectionChangeEvent(element,ieUpdateModel);onEvent('dragend',deferUpdateModel);} if(!ieVersion||ieVersion>=9){onEvent('input',ieUpdateModel);} if(safariVersion<5&&ko.utils.tagNameLower(element)==="textarea"){onEvent('keydown',deferUpdateModel);onEvent('paste',deferUpdateModel);onEvent('cut',deferUpdateModel);}else if(operaVersion<11){onEvent('keydown',deferUpdateModel);}else if(firefoxVersion<4.0){onEvent('DOMAutoComplete',updateModel);onEvent('dragdrop',updateModel);onEvent('drop',updateModel);}else if(edgeVersion&&element.type==="number"){onEvent('keydown',deferUpdateModel);}} onEvent('change',updateModel);onEvent('blur',updateModel);ko.computed(updateView,null,{disposeWhenNodeIsRemoved:element});}};ko.expressionRewriting.twoWayBindings['textInput']=true;ko.bindingHandlers['textinput']={'preprocess':function(value,name,addBinding){addBinding('textInput',value);}};})();ko.bindingHandlers['uniqueName']={'init':function(element,valueAccessor){if(valueAccessor()){var name="ko_unique_"+(++ko.bindingHandlers['uniqueName'].currentIndex);ko.utils.setElementName(element,name);}}};ko.bindingHandlers['uniqueName'].currentIndex=0;ko.bindingHandlers['using']={'init':function(element,valueAccessor,allBindings,viewModel,bindingContext){var options;if(allBindings['has']('as')){options={'as':allBindings.get('as'),'noChildContext':allBindings.get('noChildContext')};} var innerContext=bindingContext['createChildContext'](valueAccessor,options);ko.applyBindingsToDescendants(innerContext,element);return{'controlsDescendantBindings':true};}};ko.virtualElements.allowedBindings['using']=true;ko.bindingHandlers['value']={'init':function(element,valueAccessor,allBindings){var tagName=ko.utils.tagNameLower(element),isInputElement=tagName=="input";if(isInputElement&&(element.type=="checkbox"||element.type=="radio")){ko.applyBindingAccessorsToNode(element,{'checkedValue':valueAccessor});return;} var eventsToCatch=[];var requestedEventsToCatch=allBindings.get("valueUpdate");var propertyChangedFired=false;var elementValueBeforeEvent=null;if(requestedEventsToCatch){if(typeof requestedEventsToCatch=="string"){eventsToCatch=[requestedEventsToCatch];}else{eventsToCatch=ko.utils.arrayGetDistinctValues(requestedEventsToCatch);} ko.utils.arrayRemoveItem(eventsToCatch,"change");} var valueUpdateHandler=function(){elementValueBeforeEvent=null;propertyChangedFired=false;var modelValue=valueAccessor();var elementValue=ko.selectExtensions.readValue(element);ko.expressionRewriting.writeValueToProperty(modelValue,allBindings,'value',elementValue);} var ieAutoCompleteHackNeeded=ko.utils.ieVersion&&isInputElement&&element.type=="text"&&element.autocomplete!="off"&&(!element.form||element.form.autocomplete!="off");if(ieAutoCompleteHackNeeded&&ko.utils.arrayIndexOf(eventsToCatch,"propertychange")==-1){ko.utils.registerEventHandler(element,"propertychange",function(){propertyChangedFired=true});ko.utils.registerEventHandler(element,"focus",function(){propertyChangedFired=false});ko.utils.registerEventHandler(element,"blur",function(){if(propertyChangedFired){valueUpdateHandler();}});} ko.utils.arrayForEach(eventsToCatch,function(eventName){var handler=valueUpdateHandler;if(ko.utils.stringStartsWith(eventName,"after")){handler=function(){elementValueBeforeEvent=ko.selectExtensions.readValue(element);ko.utils.setTimeout(valueUpdateHandler,0);};eventName=eventName.substring("after".length);} ko.utils.registerEventHandler(element,eventName,handler);});var updateFromModel;if(isInputElement&&element.type=="file"){updateFromModel=function(){var newValue=ko.utils.unwrapObservable(valueAccessor());if(newValue===null||newValue===undefined||newValue===""){element.value="";}else{ko.dependencyDetection.ignore(valueUpdateHandler);}}}else{updateFromModel=function(){var newValue=ko.utils.unwrapObservable(valueAccessor());var elementValue=ko.selectExtensions.readValue(element);if(elementValueBeforeEvent!==null&&newValue===elementValueBeforeEvent){ko.utils.setTimeout(updateFromModel,0);return;} var valueHasChanged=newValue!==elementValue;if(valueHasChanged||elementValue===undefined){if(tagName==="select"){var allowUnset=allBindings.get('valueAllowUnset');ko.selectExtensions.writeValue(element,newValue,allowUnset);if(!allowUnset&&newValue!==ko.selectExtensions.readValue(element)){ko.dependencyDetection.ignore(valueUpdateHandler);}}else{ko.selectExtensions.writeValue(element,newValue);}}};} if(tagName==="select"){var updateFromModelComputed;ko.bindingEvent.subscribe(element,ko.bindingEvent.childrenComplete,function(){if(!updateFromModelComputed){ko.utils.registerEventHandler(element,"change",valueUpdateHandler);updateFromModelComputed=ko.computed(updateFromModel,null,{disposeWhenNodeIsRemoved:element});}else if(allBindings.get('valueAllowUnset')){updateFromModel();}else{valueUpdateHandler();}},null,{'notifyImmediately':true});}else{ko.utils.registerEventHandler(element,"change",valueUpdateHandler);ko.computed(updateFromModel,null,{disposeWhenNodeIsRemoved:element});}},'update':function(){}};ko.expressionRewriting.twoWayBindings['value']=true;ko.bindingHandlers['visible']={'update':function(element,valueAccessor){var value=ko.utils.unwrapObservable(valueAccessor());var isCurrentlyVisible=!(element.style.display=="none");if(value&&!isCurrentlyVisible) element.style.display="";else if((!value)&&isCurrentlyVisible) element.style.display="none";}};ko.bindingHandlers['hidden']={'update':function(element,valueAccessor){ko.bindingHandlers['visible']['update'](element,function(){return!ko.utils.unwrapObservable(valueAccessor())});}};makeEventHandlerShortcut('click');ko.templateEngine=function(){};ko.templateEngine.prototype['renderTemplateSource']=function(templateSource,bindingContext,options,templateDocument){throw new Error("Override renderTemplateSource");};ko.templateEngine.prototype['createJavaScriptEvaluatorBlock']=function(script){throw new Error("Override createJavaScriptEvaluatorBlock");};ko.templateEngine.prototype['makeTemplateSource']=function(template,templateDocument){if(typeof template=="string"){templateDocument=templateDocument||document;var elem=templateDocument.getElementById(template);if(!elem) throw new Error("Cannot find template with ID "+template);return new ko.templateSources.domElement(elem);}else if((template.nodeType==1)||(template.nodeType==8)){return new ko.templateSources.anonymousTemplate(template);}else throw new Error("Unknown template type: "+template);};ko.templateEngine.prototype['renderTemplate']=function(template,bindingContext,options,templateDocument){var templateSource=this['makeTemplateSource'](template,templateDocument);return this['renderTemplateSource'](templateSource,bindingContext,options,templateDocument);};ko.templateEngine.prototype['isTemplateRewritten']=function(template,templateDocument){if(this['allowTemplateRewriting']===false) return true;return this['makeTemplateSource'](template,templateDocument)['data']("isRewritten");};ko.templateEngine.prototype['rewriteTemplate']=function(template,rewriterCallback,templateDocument){var templateSource=this['makeTemplateSource'](template,templateDocument);var rewritten=rewriterCallback(templateSource['text']());templateSource['text'](rewritten);templateSource['data']("isRewritten",true);};ko.exportSymbol('templateEngine',ko.templateEngine);ko.templateRewriting=(function(){var memoizeDataBindingAttributeSyntaxRegex=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi;var memoizeVirtualContainerBindingSyntaxRegex=//g;function validateDataBindValuesForRewriting(keyValueArray){var allValidators=ko.expressionRewriting.bindingRewriteValidators;for(var i=0;i","#comment",templateEngine);});},applyMemoizedBindingsToNextSibling:function(bindings,nodeName){return ko.memoization.memoize(function(domNode,bindingContext){var nodeToBind=domNode.nextSibling;if(nodeToBind&&nodeToBind.nodeName.toLowerCase()===nodeName){ko.applyBindingAccessorsToNode(nodeToBind,bindings,bindingContext);}});}}})();ko.exportSymbol('__tr_ambtns',ko.templateRewriting.applyMemoizedBindingsToNextSibling);(function(){ko.templateSources={};var templateScript=1,templateTextArea=2,templateTemplate=3,templateElement=4;ko.templateSources.domElement=function(element){this.domElement=element;if(element){var tagNameLower=ko.utils.tagNameLower(element);this.templateType=tagNameLower==="script"?templateScript:tagNameLower==="textarea"?templateTextArea:tagNameLower=="template"&&element.content&&element.content.nodeType===11?templateTemplate:templateElement;}} ko.templateSources.domElement.prototype['text']=function(){var elemContentsProperty=this.templateType===templateScript?"text":this.templateType===templateTextArea?"value":"innerHTML";if(arguments.length==0){return this.domElement[elemContentsProperty];}else{var valueToWrite=arguments[0];if(elemContentsProperty==="innerHTML") ko.utils.setHtml(this.domElement,valueToWrite);else this.domElement[elemContentsProperty]=valueToWrite;}};var dataDomDataPrefix=ko.utils.domData.nextKey()+"_";ko.templateSources.domElement.prototype['data']=function(key){if(arguments.length===1){return ko.utils.domData.get(this.domElement,dataDomDataPrefix+key);}else{ko.utils.domData.set(this.domElement,dataDomDataPrefix+key,arguments[1]);}};var templatesDomDataKey=ko.utils.domData.nextKey();function getTemplateDomData(element){return ko.utils.domData.get(element,templatesDomDataKey)||{};} function setTemplateDomData(element,data){ko.utils.domData.set(element,templatesDomDataKey,data);} ko.templateSources.domElement.prototype['nodes']=function(){var element=this.domElement;if(arguments.length==0){var templateData=getTemplateDomData(element),nodes=templateData.containerData||(this.templateType===templateTemplate?element.content:this.templateType===templateElement?element:undefined);if(!nodes||templateData.alwaysCheckText){var text=this['text']();if(text&&text!==templateData.textData){nodes=ko.utils.parseHtmlForTemplateNodes(text,element.ownerDocument);setTemplateDomData(element,{containerData:nodes,textData:text,alwaysCheckText:true});}} return nodes;}else{var valueToWrite=arguments[0];if(this.templateType!==undefined){this['text']("");} setTemplateDomData(element,{containerData:valueToWrite});}};ko.templateSources.anonymousTemplate=function(element){this.domElement=element;} ko.templateSources.anonymousTemplate.prototype=new ko.templateSources.domElement();ko.templateSources.anonymousTemplate.prototype.constructor=ko.templateSources.anonymousTemplate;ko.templateSources.anonymousTemplate.prototype['text']=function(){if(arguments.length==0){var templateData=getTemplateDomData(this.domElement);if(templateData.textData===undefined&&templateData.containerData) templateData.textData=templateData.containerData.innerHTML;return templateData.textData;}else{var valueToWrite=arguments[0];setTemplateDomData(this.domElement,{textData:valueToWrite});}};ko.exportSymbol('templateSources',ko.templateSources);ko.exportSymbol('templateSources.domElement',ko.templateSources.domElement);ko.exportSymbol('templateSources.anonymousTemplate',ko.templateSources.anonymousTemplate);})();(function(){var _templateEngine;ko.setTemplateEngine=function(templateEngine){if((templateEngine!=undefined)&&!(templateEngine instanceof ko.templateEngine)) throw new Error("templateEngine must inherit from ko.templateEngine");_templateEngine=templateEngine;} function invokeForEachNodeInContinuousRange(firstNode,lastNode,action){var node,nextInQueue=firstNode,firstOutOfRangeNode=ko.virtualElements.nextSibling(lastNode);while(nextInQueue&&((node=nextInQueue)!==firstOutOfRangeNode)){nextInQueue=ko.virtualElements.nextSibling(node);action(node,nextInQueue);}} function activateBindingsOnContinuousNodeArray(continuousNodeArray,bindingContext){if(continuousNodeArray.length){var firstNode=continuousNodeArray[0],lastNode=continuousNodeArray[continuousNodeArray.length-1],parentNode=firstNode.parentNode,provider=ko.bindingProvider['instance'],preprocessNode=provider['preprocessNode'];if(preprocessNode){invokeForEachNodeInContinuousRange(firstNode,lastNode,function(node,nextNodeInRange){var nodePreviousSibling=node.previousSibling;var newNodes=preprocessNode.call(provider,node);if(newNodes){if(node===firstNode) firstNode=newNodes[0]||nextNodeInRange;if(node===lastNode) lastNode=newNodes[newNodes.length-1]||nodePreviousSibling;}});continuousNodeArray.length=0;if(!firstNode){return;} if(firstNode===lastNode){continuousNodeArray.push(firstNode);}else{continuousNodeArray.push(firstNode,lastNode);ko.utils.fixUpContinuousNodeArray(continuousNodeArray,parentNode);}} invokeForEachNodeInContinuousRange(firstNode,lastNode,function(node){if(node.nodeType===1||node.nodeType===8) ko.applyBindings(bindingContext,node);});invokeForEachNodeInContinuousRange(firstNode,lastNode,function(node){if(node.nodeType===1||node.nodeType===8) ko.memoization.unmemoizeDomNodeAndDescendants(node,[bindingContext]);});ko.utils.fixUpContinuousNodeArray(continuousNodeArray,parentNode);}} function getFirstNodeFromPossibleArray(nodeOrNodeArray){return nodeOrNodeArray.nodeType?nodeOrNodeArray:nodeOrNodeArray.length>0?nodeOrNodeArray[0]:null;} function executeTemplate(targetNodeOrNodeArray,renderMode,template,bindingContext,options){options=options||{};var firstTargetNode=targetNodeOrNodeArray&&getFirstNodeFromPossibleArray(targetNodeOrNodeArray);var templateDocument=(firstTargetNode||template||{}).ownerDocument;var templateEngineToUse=(options['templateEngine']||_templateEngine);ko.templateRewriting.ensureTemplateIsRewritten(template,templateEngineToUse,templateDocument);var renderedNodesArray=templateEngineToUse['renderTemplate'](template,bindingContext,options,templateDocument);if((typeof renderedNodesArray.length!="number")||(renderedNodesArray.length>0&&typeof renderedNodesArray[0].nodeType!="number")) throw new Error("Template engine must return an array of DOM nodes");var haveAddedNodesToParent=false;switch(renderMode){case"replaceChildren":ko.virtualElements.setDomNodeChildren(targetNodeOrNodeArray,renderedNodesArray);haveAddedNodesToParent=true;break;case"replaceNode":ko.utils.replaceDomNodes(targetNodeOrNodeArray,renderedNodesArray);haveAddedNodesToParent=true;break;case"ignoreTargetNode":break;default:throw new Error("Unknown renderMode: "+renderMode);} if(haveAddedNodesToParent){activateBindingsOnContinuousNodeArray(renderedNodesArray,bindingContext);if(options['afterRender']){ko.dependencyDetection.ignore(options['afterRender'],null,[renderedNodesArray,bindingContext[options['as']||'$data']]);} if(renderMode=="replaceChildren"){ko.bindingEvent.notify(targetNodeOrNodeArray,ko.bindingEvent.childrenComplete);}} return renderedNodesArray;} function resolveTemplateName(template,data,context){if(ko.isObservable(template)){return template();}else if(typeof template==='function'){return template(data,context);}else{return template;}} ko.renderTemplate=function(template,dataOrBindingContext,options,targetNodeOrNodeArray,renderMode){options=options||{};if((options['templateEngine']||_templateEngine)==undefined) throw new Error("Set a template engine before calling renderTemplate");renderMode=renderMode||"replaceChildren";if(targetNodeOrNodeArray){var firstTargetNode=getFirstNodeFromPossibleArray(targetNodeOrNodeArray);var whenToDispose=function(){return(!firstTargetNode)||!ko.utils.domNodeIsAttachedToDocument(firstTargetNode);};var activelyDisposeWhenNodeIsRemoved=(firstTargetNode&&renderMode=="replaceNode")?firstTargetNode.parentNode:firstTargetNode;return ko.dependentObservable(function(){var bindingContext=(dataOrBindingContext&&(dataOrBindingContext instanceof ko.bindingContext))?dataOrBindingContext:new ko.bindingContext(dataOrBindingContext,null,null,null,{"exportDependencies":true});var templateName=resolveTemplateName(template,bindingContext['$data'],bindingContext),renderedNodesArray=executeTemplate(targetNodeOrNodeArray,renderMode,templateName,bindingContext,options);if(renderMode=="replaceNode"){targetNodeOrNodeArray=renderedNodesArray;firstTargetNode=getFirstNodeFromPossibleArray(targetNodeOrNodeArray);}},null,{disposeWhen:whenToDispose,disposeWhenNodeIsRemoved:activelyDisposeWhenNodeIsRemoved});}else{return ko.memoization.memoize(function(domNode){ko.renderTemplate(template,dataOrBindingContext,options,domNode,"replaceNode");});}};ko.renderTemplateForEach=function(template,arrayOrObservableArray,options,targetNode,parentBindingContext){var arrayItemContext,asName=options['as'];var executeTemplateForArrayItem=function(arrayValue,index){arrayItemContext=parentBindingContext['createChildContext'](arrayValue,{'as':asName,'noChildContext':options['noChildContext'],'extend':function(context){context['$index']=index;if(asName){context[asName+"Index"]=index;}}});var templateName=resolveTemplateName(template,arrayValue,arrayItemContext);return executeTemplate(targetNode,"ignoreTargetNode",templateName,arrayItemContext,options);};var activateBindingsCallback=function(arrayValue,addedNodesArray,index){activateBindingsOnContinuousNodeArray(addedNodesArray,arrayItemContext);if(options['afterRender']) options['afterRender'](addedNodesArray,arrayValue);arrayItemContext=null;};var setDomNodeChildrenFromArrayMapping=function(newArray,changeList){ko.dependencyDetection.ignore(ko.utils.setDomNodeChildrenFromArrayMapping,null,[targetNode,newArray,executeTemplateForArrayItem,options,activateBindingsCallback,changeList]);ko.bindingEvent.notify(targetNode,ko.bindingEvent.childrenComplete);};var shouldHideDestroyed=(options['includeDestroyed']===false)||(ko.options['foreachHidesDestroyed']&&!options['includeDestroyed']);if(!shouldHideDestroyed&&!options['beforeRemove']&&ko.isObservableArray(arrayOrObservableArray)){setDomNodeChildrenFromArrayMapping(arrayOrObservableArray.peek());var subscription=arrayOrObservableArray.subscribe(function(changeList){setDomNodeChildrenFromArrayMapping(arrayOrObservableArray(),changeList);},null,"arrayChange");subscription.disposeWhenNodeIsRemoved(targetNode);return subscription;}else{return ko.dependentObservable(function(){var unwrappedArray=ko.utils.unwrapObservable(arrayOrObservableArray)||[];if(typeof unwrappedArray.length=="undefined") unwrappedArray=[unwrappedArray];if(shouldHideDestroyed){unwrappedArray=ko.utils.arrayFilter(unwrappedArray,function(item){return item===undefined||item===null||!ko.utils.unwrapObservable(item['_destroy']);});} setDomNodeChildrenFromArrayMapping(unwrappedArray);},null,{disposeWhenNodeIsRemoved:targetNode});}};var templateComputedDomDataKey=ko.utils.domData.nextKey();function disposeOldComputedAndStoreNewOne(element,newComputed){var oldComputed=ko.utils.domData.get(element,templateComputedDomDataKey);if(oldComputed&&(typeof(oldComputed.dispose)=='function')) oldComputed.dispose();ko.utils.domData.set(element,templateComputedDomDataKey,(newComputed&&(!newComputed.isActive||newComputed.isActive()))?newComputed:undefined);} var cleanContainerDomDataKey=ko.utils.domData.nextKey();ko.bindingHandlers['template']={'init':function(element,valueAccessor){var bindingValue=ko.utils.unwrapObservable(valueAccessor());if(typeof bindingValue=="string"||'name'in bindingValue){ko.virtualElements.emptyNode(element);}else if('nodes'in bindingValue){var nodes=bindingValue['nodes']||[];if(ko.isObservable(nodes)){throw new Error('The "nodes" option must be a plain, non-observable array.');} var container=nodes[0]&&nodes[0].parentNode;if(!container||!ko.utils.domData.get(container,cleanContainerDomDataKey)){container=ko.utils.moveCleanedNodesToContainerElement(nodes);ko.utils.domData.set(container,cleanContainerDomDataKey,true);} new ko.templateSources.anonymousTemplate(element)['nodes'](container);}else{var templateNodes=ko.virtualElements.childNodes(element);if(templateNodes.length>0){var container=ko.utils.moveCleanedNodesToContainerElement(templateNodes);new ko.templateSources.anonymousTemplate(element)['nodes'](container);}else{throw new Error("Anonymous template defined, but no template content was provided");}} return{'controlsDescendantBindings':true};},'update':function(element,valueAccessor,allBindings,viewModel,bindingContext){var value=valueAccessor(),options=ko.utils.unwrapObservable(value),shouldDisplay=true,templateComputed=null,template;if(typeof options=="string"){template=value;options={};}else{template='name'in options?options['name']:element;if('if'in options) shouldDisplay=ko.utils.unwrapObservable(options['if']);if(shouldDisplay&&'ifnot'in options) shouldDisplay=!ko.utils.unwrapObservable(options['ifnot']);if(shouldDisplay&&!template){shouldDisplay=false;}} if('foreach'in options){var dataArray=(shouldDisplay&&options['foreach'])||[];templateComputed=ko.renderTemplateForEach(template,dataArray,options,element,bindingContext);}else if(!shouldDisplay){ko.virtualElements.emptyNode(element);}else{var innerBindingContext=bindingContext;if('data'in options){innerBindingContext=bindingContext['createChildContext'](options['data'],{'as':options['as'],'noChildContext':options['noChildContext'],'exportDependencies':true});} templateComputed=ko.renderTemplate(template,innerBindingContext,options,element);} disposeOldComputedAndStoreNewOne(element,templateComputed);}};ko.expressionRewriting.bindingRewriteValidators['template']=function(bindingValue){var parsedBindingValue=ko.expressionRewriting.parseObjectLiteral(bindingValue);if((parsedBindingValue.length==1)&&parsedBindingValue[0]['unknown']) return null;if(ko.expressionRewriting.keyValueArrayContainsKey(parsedBindingValue,"name")) return null;return"This template engine does not support anonymous templates nested within its templates";};ko.virtualElements.allowedBindings['template']=true;})();ko.exportSymbol('setTemplateEngine',ko.setTemplateEngine);ko.exportSymbol('renderTemplate',ko.renderTemplate);ko.utils.findMovesInArrayComparison=function(left,right,limitFailedCompares){if(left.length&&right.length){var failedCompares,l,r,leftItem,rightItem;for(failedCompares=l=0;(!limitFailedCompares||failedCompares0){ko.utils.replaceDomNodes(mappedNodes,newMappedNodes);if(callbackAfterAddingNodes) ko.dependencyDetection.ignore(callbackAfterAddingNodes,null,[valueToMap,newMappedNodes,index]);} mappedNodes.length=0;ko.utils.arrayPushAll(mappedNodes,newMappedNodes);},null,{disposeWhenNodeIsRemoved:containerNode,disposeWhen:function(){return!ko.utils.anyDomNodeIsAttachedToDocument(mappedNodes);}});return{mappedNodes:mappedNodes,dependentObservable:(dependentObservable.isActive()?dependentObservable:undefined)};} var lastMappingResultDomDataKey=ko.utils.domData.nextKey(),deletedItemDummyValue=ko.utils.domData.nextKey();ko.utils.setDomNodeChildrenFromArrayMapping=function(domNode,array,mapping,options,callbackAfterAddingNodes,editScript){array=array||[];if(typeof array.length=="undefined") array=[array];options=options||{};var lastMappingResult=ko.utils.domData.get(domNode,lastMappingResultDomDataKey);var isFirstExecution=!lastMappingResult;var newMappingResult=[];var lastMappingResultIndex=0;var currentArrayIndex=0;var nodesToDelete=[];var itemsToMoveFirstIndexes=[];var itemsForBeforeRemoveCallbacks=[];var itemsForMoveCallbacks=[];var itemsForAfterAddCallbacks=[];var mapData;var countWaitingForRemove=0;function itemAdded(value){mapData={arrayEntry:value,indexObservable:ko.observable(currentArrayIndex++)};newMappingResult.push(mapData);if(!isFirstExecution){itemsForAfterAddCallbacks.push(mapData);}} function itemMovedOrRetained(oldPosition){mapData=lastMappingResult[oldPosition];if(currentArrayIndex!==mapData.indexObservable.peek()) itemsForMoveCallbacks.push(mapData);mapData.indexObservable(currentArrayIndex++);ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes,domNode);newMappingResult.push(mapData);} function callCallback(callback,items){if(callback){for(var i=0,n=items.length;i=0){return 2;}}catch(ex){} return 1;})();function ensureHasReferencedJQueryTemplates(){if(jQueryTmplVersion<2) throw new Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");} function executeTemplate(compiledTemplate,data,jQueryTemplateOptions){return jQueryInstance['tmpl'](compiledTemplate,data,jQueryTemplateOptions);} this['renderTemplateSource']=function(templateSource,bindingContext,options,templateDocument){templateDocument=templateDocument||document;options=options||{};ensureHasReferencedJQueryTemplates();var precompiled=templateSource['data']('precompiled');if(!precompiled){var templateText=templateSource['text']()||"";templateText="{{ko_with $item.koBindingContext}}"+templateText+"{{/ko_with}}";precompiled=jQueryInstance['template'](null,templateText);templateSource['data']('precompiled',precompiled);} var data=[bindingContext['$data']];var jQueryTemplateOptions=jQueryInstance['extend']({'koBindingContext':bindingContext},options['templateOptions']);var resultNodes=executeTemplate(precompiled,data,jQueryTemplateOptions);resultNodes['appendTo'](templateDocument.createElement("div"));jQueryInstance['fragments']={};return resultNodes;};this['createJavaScriptEvaluatorBlock']=function(script){return"{{ko_code ((function() { return "+script+" })()) }}";};this['addTemplate']=function(templateName,templateMarkup){document.write("