/*! Knockout projections plugin - version 1.1.0 ------------------------------------------------------------------------------ Copyright (c) Microsoft Corporation All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ------------------------------------------------------------------------------ */ !function(a){"use strict";function b(a,b,c,d,e,f,g){this.inputItem=b,this.stateArrayIndex=c,this.mappingOptions=e,this.arrayOfState=f,this.outputObservableArray=g,this.outputArray=this.outputObservableArray.peek(),this.isIncluded=null,this.suppressNotification=!1,this.outputArrayIndex=a.observable(d),this.disposeFuncFromMostRecentMapping=null,this.mappedValueComputed=a.computed(this.mappingEvaluator,this),this.mappedValueComputed.subscribe(this.onMappingResultChanged,this),this.previousMappedValue=this.mappedValueComputed.peek()}function c(a,b){if(!a)return null;switch(a.status){case"added":return a.index;case"deleted":return a.index+b;default:throw new Error("Unknown diff status: "+a.status)}}function d(a,c,d,e,f,g,h,i,j){var k="number"==typeof c.moved,l=k?d[c.moved]:new b(a,c.value,e,f,g,h,i);return h.splice(e,0,l),l.isIncluded&&j.splice(f,0,l.mappedValueComputed.peek()),k&&(l.stateArrayIndex=e,l.setOutputArrayIndexSilently(f)),l}function e(a,b,c,d,e){var f=b.splice(c,1)[0];f.isIncluded&&e.splice(d,1),"number"!=typeof a.moved&&f.dispose()}function f(a,b,c){return a.stateArrayIndex=b,a.setOutputArrayIndexSilently(c),c+(a.isIncluded?1:0)}function g(a,b){for(var c={},d=0;d