/*! * filename: ej.web.all.min.js * version : 20.4.0.38 * Copyright Syncfusion Inc. 2001 - 2022. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ (function(n){typeof define=="function"&&define.amd?define(["jquery","jsrender","jquery-validation"],n):n()})(function(){var LookupCachingMode,CalcQuickBase,FormulaInfoSetAction,FormulaInfoHashtable,HashTable,ejDateRangePicker,clipboardCleaner,documentManager,InternalAdaptive,InternalScroller,InternalSelection,InternalFilter,InternalDragAndDrop,InternalEdit,InternalContext,InternalSwimlane,InternalCommon,_sideBySeriesPadding,LoadingPriority,RoutingPriority,SegmentOrientation,ObstacleSideType,PortDirection,Orientation,ScanDirection,RoutingSolution,Directions,ejSparkline,__extends,ejSunburstChart;window.ej=window.Syncfusion=window.Syncfusion||{},function(n,t,i){"use strict";var e,u,f,o;t.version="20.4.0.38";t.consts={NamespaceJoin:"-"};t.TextAlign={Center:"center",Justify:"justify",Left:"left",Right:"right"};t.Orientation={Horizontal:"horizontal",Vertical:"vertical"};t.serverTimezoneOffset=0;t.parseDateInUTC=!1;t.persistStateVersion=null;t.locales=t.locales||[];Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(n,t){return n[t]!==i});Date.prototype.toISOString||function(){function n(n){var t=String(n);return t.length===1&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+n(this.getUTCMonth()+1)+"-"+n(this.getUTCDate())+"T"+n(this.getUTCHours())+":"+n(this.getUTCMinutes())+":"+n(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();String.format=function(){for(var t=arguments[0],n=0;n");e=n("head").find("link").add("style");t.browserInfo().name==="msie"?(u="",e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.write("<\/head>"+u+f[0].innerHTML+"<\/body><\/html>")):(u="",r.document.write(""),e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.writeln(u+"<\/head>"),r.document.writeln(f[0].innerHTML+"<\/body><\/html>"));r.document.close();r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},1e3))},1e3)},ieClearRemover:function(t){var i=n(t).height();t.style.paddingTop=parseFloat(i/2)+"px";t.style.paddingBottom=parseFloat(i/2)+"px";t.style.height="1px";t.style.lineHeight="1px"},sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.successHandler,error:t.errorHandler,beforeSend:t.beforeSendHandler,complete:t.completeHandler})},buildTag:function(t,r,u,f){var s=/^[a-z]*[0-9a-z]+/ig.exec(t)[0],e=/#([_a-z0-9-&@\/\\,+()$~%:*?<>{}\[\]]+\S)/ig.exec(t),o;return e=e?e[e.length-1].replace(/[&@\/\\,+()$~%.:*?<>{}\[\]]/g,""):i,o=/\.([a-z]+[-_0-9a-z ]+)/ig.exec(t),o=o?o[o.length-1]:i,n(document.createElement(s)).attr(e?{id:e}:{}).addClass(o||"").css(u||{}).attr(f||{}).html(r||"")},_preventDefaultException:function(n,t){if(n)for(var i in t)if(t[i].test(n[i]))return!0;return!1},getMaxZindex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute"||n(t).css("position")=="fixed")return parseInt(n(t).css("z-index"))||1})),(t==i||t==null)&&(t=1),t},blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},getDimension:function(t,i){var e,u=n(t).parents().andSelf().filter(":hidden"),r,f;return u&&(r={visibility:"hidden",display:"block"},f=[],u.each(function(){var t={};for(var n in r)t[n]=this.style[n],this.style[n]=r[n];f.push(t)}),e=/(outer)/g.test(i)?n(t)[i](!0):n(t)[i](),u.each(function(n){var i=f[n];for(var t in r)this.style[t]=i[t]})),e},transitionEndEvent:function(){return{"":"transitionend",webkit:"webkitTransitionEnd",Moz:"transitionend",O:"otransitionend",ms:"MSTransitionEnd"}[t.userAgent()]},animationEndEvent:function(){return{"":"animationend",webkit:"webkitAnimationEnd",Moz:"animationend",O:"webkitAnimationEnd",ms:"animationend"}[t.userAgent()]},startEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchstart":"mousedown"},endEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchend":"mouseup"},moveEvent:function(){return t.isTouchDevice()||n.support.hasPointer?n.support.hasPointer&&!t.isMobile()?"ejtouchmove":"touchmove":"mousemove"},cancelEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"touchcancel":"mousecancel"},tapEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"tap":"click"},tapHoldEvent:function(){return t.isTouchDevice()||n.support.hasPointer?"taphold":"click"},isDevice:function(){return t.getBooleanVal(n("head"),"data-ej-forceset",!1)?t.getBooleanVal(n("head"),"data-ej-device",this._device()):this._device()},isPortrait:function(){var n=document.documentElement;return n&&n.clientWidth/n.clientHeight<1.1},isLowerResolution:function(){return window.innerWidth<=640&&t.isPortrait()&&t.isDevice()||window.innerWidth<=800&&!t.isDevice()||window.innerWidth<=800&&!t.isPortrait()&&t.isWindows()&&t.isDevice()||t.isMobile()},isIOSWebView:function(){return/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)},isAndroidWebView:function(){return!(typeof Android=="undefined")},isWindowsWebView:function(){return location.href.indexOf("x-wmapp")!=-1},_device:function(){return/Android|BlackBerry|iPhone|iPad|iPod|IEMobile|kindle|windows\sce|palm|smartphone|iemobile|mobile|pad|xoom|sch-i800|playbook/i.test(navigator.userAgent.toLowerCase())},isMobile:function(){return/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(navigator.userAgent.toLowerCase())&&/mobile/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-mobile",!1)===!0},isTablet:function(){return/ipad|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(n("head"),"data-ej-tablet",!1)===!0||!t.isMobile()&&t.isDevice()},isTouchDevice:function(){return("ontouchstart"in window||window.navigator.msPointerEnabled&&t.isMobile())&&this.isDevice()},getClearString:function(t){return n.trim(t.replace(/\s+/g," ").replace(/(\r\n|\n|\r)/gm,"").replace(new RegExp(">[\n\t ]+<","g"),"><"))},getBooleanVal:function(t,i,r){var u=n(t).attr(i);return u!=null?u.toLowerCase()=="true":r},_getSkewClass:function(n,t,i){var h=n.width(),c=n.height(),f=n.offset().left,e=n.offset().left+h,o=n.offset().top,s=n.offset().top+c,r=h*.3,u=c*.3;return te-r&&ie-r&&i>s-u?"e-m-skew-bottomright":ts-u?"e-m-skew-bottomleft":t>f+r&&ie-r?"e-m-skew-right":i>s-u?"e-m-skew-bottom":"e-m-skew-center"},_removeSkewClass:function(t){n(t).removeClass("e-m-skew-top e-m-skew-bottom e-m-skew-left e-m-skew-right e-m-skew-topleft e-m-skew-topright e-m-skew-bottomleft e-m-skew-bottomright e-m-skew-center e-skew-top e-skew-bottom e-skew-left e-skew-right e-skew-topleft e-skew-topright e-skew-bottomleft e-skew-bottomright e-skew-center")},_getObjectKeys:function(n){var t,i=[];if(n=Object.prototype.toString.call(n)===Object.prototype.toString()?n:{},!Object.keys){for(t in n)n.hasOwnProperty(t)&&i.push(t);return i}if(Object.keys)return Object.keys(n)},_touchStartPoints:function(n,t){if(n){var i=n.touches?n.touches[0]:n;t._distX=0;t._distY=0;t._moved=!1;t._pointX=i.pageX;t._pointY=i.pageY}},_isTouchMoved:function(n,t){if(n){var i=n.touches?n.touches[0]:n,f=i.pageX-t._pointX,e=i.pageY-t._pointY,o=Date.now(),r,u;return t._pointX=i.pageX,t._pointY=i.pageY,t._distX+=f,t._distY+=e,r=Math.abs(t._distX),u=Math.abs(t._distY),!(r<5&&u<5)}},listenEvents:function(n,i,r,u,f,e){for(var o=0;o0)return e=i.parents(),f=n("body").children(),!t.isNullOrUndefined(i)&&i.length>0&&f.splice(f.index(r),1),n(f).each(function(n,t){e.push(t)}),u=Math.max.apply(u,n.map(e,function(t){if(n(t).css("position")!="static")return parseInt(n(t).css("z-index"))||1})),!u||u<1e4?u=1e4:u+=1,u},isValidAttr:function(t,i){var t=n(t)[0],r;return typeof t[i]!="undefined"?!0:(r=!1,n.each(t,function(n){if(n.toLowerCase()==i.toLowerCase())return r=!0,!1}),r)}};n.extend(t,t.util);t.widgetBase={droppables:{"default":[]},resizables:{"default":[]},_renderEjTemplate:function(i,r,u,f,e){var o=null;if((typeof i=="object"||i.startsWith("#")||i.startsWith("."))&&(o=n(i).attr("type")),o){if(o=o.toLowerCase(),t.template[o])return t.template[o](this,i,r,u,f)}else if(!t.isNullOrUndefined(e))return t.template["text/x-"+e](this,i,r,u,f);return t.template.render(this,i,r,u,f)},destroy:function(){var u,r,f,i;if(!this._trigger("destroy")){this.model.enablePersistence&&(this.persistState(),n(window).off("unload",this._persistHandler));try{this._destroy()}catch(e){}for(u=this.element.data("ejWidgets")||[],i=0;i-1,c){n.fn.off.apply(t,u?[i,r,f[3]]:[i,r]);e.splice(o,1);break}return this},_trigger:function(i,r){var f=null,e,u,o={},s;return(n.extend(o,r),i in this.model&&(f=this.model[i]),f&&(typeof f=="string"&&(f=t.util.getObject(f,window)),n.isFunction(f)&&(u=t.event(i,this.model,r),e=f.call(this,u),r&&n.extend(r,u),u.cancel||!t.isNullOrUndefined(e))))?e===!1||u.cancel:(s=Boolean(r),r=r||{},r.originalEventType=i,r.type=this.pluginName+i,u=n.Event(r.type,t.event(r.type,this.model,r)),this.element&&this.element.trigger(u),s&&n.extend(r,u),t.isOnWebForms&&u.cancel==!1&&this.model.serverEvents&&this.model.serverEvents.length&&t.raiseWebFormsServerEvents(i,r,o),u.cancel)},setModel:function(t,i){var r,f,o,u;if(!this._trigger("modelChange",{changes:t})){for(r in t){if(!i){if(this.model[r]===t[r]){delete t[r];continue}if(n.isPlainObject(t[r])&&(e(this.model[r],t[r]),n.isEmptyObject(t[r]))){delete t[r];continue}}if(this.dataTypes&&(f=this._isValidModelValue(r,this.dataTypes,t),f!==!0))throw"setModel - Invalid input for property :"+r+" - "+f;this.model.notifyOnEachPropertyChanges&&this.model[r]!==t[r]&&(o={oldValue:this.model[r],newValue:t[r]},t[r]=this._trigger(r+"Change",o)?this.model[r]:o.newValue)}n.isEmptyObject(t)||(this._setFirst?(u=t.dataSource,u&&delete t.dataSource,n.extend(!0,this.model,t),u&&(this.model.dataSource=u instanceof Array?u.slice():u,t.dataSource=this.model.dataSource),this._setModel&&this._setModel(t)):this._setModel&&this._setModel(t)===!1||n.extend(!0,this.model,t),"enablePersistence"in t&&this._setState(t.enablePersistence))}},option:function(r,u,f){if(!r)return this.model;if(n.isPlainObject(r))return this.setModel(r,f);if(typeof r=="string"){r=r.replace(/^model\./,"");var e=t.getObject(r,this.model);if(u===i&&!f)return e;if(r==="enablePersistence")return this._setState(u);if(f&&u===t.extensions.modelGUID)return this._setModel(t.createObject(r,t.getObject(r,this.model),{}));if(f||t.getObject(r,this.model)!==u)return this.setModel(t.createObject(r,u,{}),f)}return i},_isValidModelValue:function(n,t,i){var r=t[n],u=i[n],f,e,o;if(!r)return!0;if(typeof r=="string"){if(r=="enum"&&(i[n]=u?u.toString().toLowerCase():u,r="string"),r==="array"){if(Object.prototype.toString.call(u)==="[object Array]")return!0}else if(r==="data"||r==="parent"||typeof u===r)return!0;return"Expected type - "+r}if(u instanceof Array){for(e=0;e=0){delete u[r];return}t.push(n);for(var f in n)n.hasOwnProperty(f)&&i(n[f],f,n);t.pop();return}}var t=[];return i(n,"obj",null),n},stringify:function(n,i){for(var f,u=this.observables,r=0;r"),u=t.preferredCulture(u)?u:"en-US",f=i,l=i.split("{0:"),a=i.split("}"),h=l[0],c=a[1],typeof r=="string"&&n.isNumeric(r)&&(r=Number(r)),i.indexOf("{0:")!=-1)return v=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),s=v.exec(i),s!=null&&r!=null?h!=null&&c!=null?h+t.format(r,s[2],u)+c:t.format(r,s[2],u):r!=null?r:"";if(f.startsWith("{")&&!f.startsWith("{0:")){var o=f.split(""),r=(r||"")+"",p=r.split(""),w=/[0aA\*CN<>\?]/gm;for(e=0,y=0;e0&&n.isPlainObject(p)&&(r=t.copyObject({},p)),!b){h.prototype._requiresID!==!0||n(this[y]).attr("id")||s.attr("id",c("ejControl_"));r&&typeof r!="object"?o(f+": methods/properties can be accessed only after plugin creation"):(h.prototype.defaults&&!t.isNullOrUndefined(t.setCulture)&&"locale"in h.prototype.defaults&&f!="ejChart"&&(!r||"locale"in r?t.isNullOrUndefined(r)&&(r={},r.locale=t.setCulture().name):r.locale=t.setCulture().name),new h(s,r));continue}if(r)if(u=[].slice.call(arguments,1),this.length>0&&u[0]&&p==="option"&&n.isPlainObject(u[0])&&(u[0]=t.copyObject({},u[0])),n.isPlainObject(r))l.setModel(r);else if((r.indexOf("_")===0||t.isNullOrUndefined(a=t.getObject(r,l)))&&r.indexOf("model.")!==0)o(e+": function/property - "+r+" does not exist");else{if(!a||!n.isFunction(a)){if(arguments.length==1)return a;l.option(r,arguments[1]);continue}if(w=a.apply(l,u),w!==i)return w}}return f.indexOf("ejm")!=-1&&t.widget.registerInstance(s,f,e,h.prototype),this};t.widget.register(f,e,h.prototype);t.loadLocale(f)};t.loadLocale=function(i){for(var f=t.locales,r=0,u=f.length;r1?t[1]:i},set:function(n,t,i){typeof t=="object"&&(t=JSON.stringify(t));t=escape(t)+(i==null?"":"; expires="+i.toUTCString());document.cookie=n+"="+t}};u={getActionFromCode:function(n,t,i,r,f){var s,o,e;i=i||!1;r=r||!1;f=f||!1;for(s in n)if(s!=="focus")for(o=u.getKeyObject(n[s]),e=0;e9&&window.navigator.msPointerEnabled,i.pointerEnabled=window.navigator.pointerEnabled,i};t.eventType={mouseDown:"mousedown touchstart",mouseMove:"mousemove touchmove",mouseUp:"mouseup touchend",mouseLeave:"mouseleave touchcancel",click:"click touchend"};t.event=function(t,i,r){return n.extend(r||{},{type:t,model:i,cancel:!1})};t.proxy=function(n,t,i){return!n||typeof n!="function"?null:"on"in n&&t?i?n.on(t,i):n.on(t):function(){var r=i?[i]:[];return r.push.apply(r,arguments),n.apply(t||this,r)}};t.hasStyle=function(n){var r=document.documentElement.style,i,t;if(n in r)return!0;for(i=["ms","Moz","Webkit","O","Khtml"],n=n[0].toUpperCase()+n.slice(1),t=0;t",i,"<\/div>"].join(""));var e={prop:f,index:u};return n(i).render(r,e)};t.isPlainObject=function(n){if(!n||t.DataManager!==i&&n instanceof t.DataManager||typeof n!="object"||n.nodeType||jQuery.isWindow(n))return!1;try{if(n.constructor&&!n.constructor.prototype.hasOwnProperty("isPrototypeOf"))return!1}catch(f){return!1}var r,u=t.support.isOwnLast;for(r in n)if(u)break;return r===i||n.hasOwnProperty(r)};f=!1;t.util.valueFunction=function(n){return function(r,u){var e=t.getObject(n,this.model);if(f===!1&&(f=t.getObject("observables.getValue",t.widget)),r===i)return t.isNullOrUndefined(f)?typeof e=="function"?e.call(this):e:f(e,u);typeof e=="function"?(this["ob.values"][n]=r,e.call(this,r)):t.createObject(n,r,this.model)}};t.util.getVal=function(n){return typeof n=="function"?n():n};t.support={isOwnLast:function(){var n=function(){this.a=1},t;n.prototype.b=1;for(t in new n)return t==="b"}(),outerHTML:function(){return document.createElement("div").outerHTML!==i}()};o=t.throwError=function(n){try{throw new Error(n);}catch(t){throw t.message+"\n"+t.stack;}};t.getRandomValue=function(n,r){var u,f;return n===i||r===i?t.throwError("Min and Max values are required for generating a random number"):("crypto"in window&&"getRandomValues"in crypto?(f=new Uint16Array(1),window.crypto.getRandomValues(f),u=f[0]%(r-n)+n):u=Math.random()*(r-n)+n,u|0)};t.extensions={};t.extensions.modelGUID="{0B1051BA-1CCB-42C2-A3B5-635389B92A50}"}(window.jQuery,window.Syncfusion),function(){$.fn.addEleAttrs=function(n){var t=$(this);$.each(n,function(n,i){i&&i.specified&&t.attr(i.name,i.value)})};$.fn.removeEleAttrs=function(n){return this.each(function(){var t=$(this),i=$(this.attributes).clone();$.each(i,function(i,r){r&&r.specified&&n.test(r.name)&&t.removeAttr(r.name)})})};$.fn.attrNotStartsWith=function(n){var u=this,r=[],i,t;for(this.each(function(){i=$(this.attributes).clone()}),t=0;ti&&f.push(n);for(e=f,n=0;nthis.pageSize;)s.results.splice(0,1),s.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(s)),i},update:function(n,t,i,r){return this._crudAction=!0,this.cacheAdaptor.update(n,t,i,r)},insert:function(n,t,i){return this._insertAction=!0,this.cacheAdaptor.insert(n,t,i)},remove:function(n,t,i,r){return this._crudAction=!0,this.cacheAdaptor.remove(n,t,i,r)},batchRequest:function(n,t,i){return this.cacheAdaptor.batchRequest(n,t,i)}});var a=function(n,t){return n.filter(function(n){return n.fn===t})||[]},g=function(n,t){for(var r=n.filter(function(n){return t.indexOf(n.fn)!==-1}),u={},i=0;i\/?]/.test(r)&&(r=encodeURIComponent(r)),r="'"+r+"'",i&&(u="cast("+u+", 'Edm.String')"),t.isGUID(r)&&(f="guid"),n.ignoreCase&&(f?u:u="tolower("+u+")",r=r.toLowerCase()),{val:r,guid:f,field:u}},onPredicate:function(n,i,r){var f="",o,l,e=n.value,v=typeof e,h=this._p(n.field),s,c,y,a;if(e instanceof Date&&(e="datetime'"+u.replacer(e).toJSON()+"'"),v==="string"&&(c=this._typeStringQuery(n,r,e,h,l),e=c.val,h=c.field,l=c.guid),o=t.data.odBiOperator[n.operator],n.anyCondition!=""&&o)return f+=e.table,f+="/"+n.anyCondition,f+="(d:d/",f+=h,f+=o,f+=e.value,f+")";if(n.operator=="in"||n.operator=="notin"){for(f+="(",s=0;s-1;h--)/\bContent-ID:/i.test(i[h])&&/\bHTTP.+201/.test(i[h])&&(d=parseInt(/\bContent-ID: (\d+)/i.exec(i[h])[1]),s.added[d]&&(tt=u.parseJson(/^\{.+\}/m.exec(i[h])[0]),n.extend(s.added[d],this.processResponse(tt))));return s}var y=e&&e.getResponseHeader("DataServiceVersion"),w=null,rt={};if(y=y&&parseInt(y,10)||2,f&&f._requiresCount&&((i.__count||i["odata.count"])&&(w=i.__count||i["odata.count"]),i.d&&(i=i.d),(i.__count||i["odata.count"])&&(w=i.__count||i["odata.count"])),y===3&&i.value&&(i=i.value),i.d&&(i=i.d),y<3&&i.results&&(i=i.results),l&&l.aggregates&&l.aggregates.length){var p=l.aggregates,nt,ut={};for(h=0;h0;r--)if(u.indexOf(i._expands[r])>=0)i._expands.pop();else if(e.test(i._expands[r])){for(u=i._expands.pop(),f=u.replace(e,"($expand="),o=0;o-1;h--)/\bContent-ID:/i.test(i[h])&&/\bHTTP.+201/.test(i[h])&&(w=parseInt(/\bContent-ID: (\d+)/i.exec(i[h])[1]),s.added[w]&&(nt=u.parseJson(/^\{.+\}/m.exec(i[h])[0]),n.extend(s.added[w],this.processResponse(nt))));return s}if(y=null,d={},f&&f._requiresCount&&"@odata.count"in i&&(y=i["@odata.count"]),i=t.isNullOrUndefined(i.value)?i:i.value,l&&l.aggregates&&l.aggregates.length){var v=l.aggregates,g,it={};for(h=0;h=0;f--)u[f]&&(o=i.comparer,u[f].endsWith(" desc")&&(o=t.pvt.fnSort(t.sortOrder.Descending),u[f]=u[f].replace(" desc","")),n=it(n,u[f],o,[]));return n}return it(n,u,i.comparer,r?r.queries:[])},onGroup:function(n,i,r){var u,o,s,f,h;if(!n)return n;if(u=a(r.queries,"onAggregates"),o=[],u.length)for(f=0;f-1&&(e=this.rows.removeAt(i),e.markDelete(),this._deleted.push({model:e,position:i}),this._isDirty=!0,this._events.triggerHandler({type:"remove",model:e,table:this}))},isDirty:function(){return this._isDirty},getChanges:function(){for(var i={added:[],changed:[]},r=this.toArray(),n=0;n-1;u--){if(!t[u].offsetParent){t.splice(u,1);continue}n(t[u])[i](r)}},_changeHandler:function(t){t.data.self.set(t.data.prop,n(this).val())},_processField:function(n,t,i){var u={self:this,prop:t},r=this.get(t);if(i.fields.push(n[0]),this.formElements.indexOf(n[0].tagName.toLowerCase())===-1)return n.html(r),this._updates[t].read.push(n[0]);n.val(r).off("change",null,this._changeHandler).on("change",null,u,this._changeHandler);return this._updates[t].input.push(n[0])},formElements:["input","select","textarea"]};var ot=/[^\w]+/g,st=function(n){return n.replace(ot,"_")},ht=function(n){this.setDirty(!0,n.model)};if(t.Predicate=function(n,i,r,u,f){if(!(this instanceof t.Predicate))return new t.Predicate(n,i,r,u,f);if(this.ignoreAccent=!1,typeof n=="string"){var e="";i.toLowerCase().indexOf(" any")!=-1?(i=i.replace(" any",""),e="any"):i.toLowerCase().indexOf(" all")!=-1&&(i=i.replace(" all",""),e="all");this.field=n;this.operator=i;this.value=r;this.ignoreCase=u;this.ignoreAccent=f;this.isComplex=!1;this.anyCondition=e;this._comparer=t.data.fnOperators.processOperator(e!=""?e:this.operator)}else(n instanceof t.Predicate&&r instanceof t.Predicate||r instanceof Array)&&(this.isComplex=!0,this.condition=i.toLowerCase(),this.predicates=[n],r instanceof Array?[].push.apply(this.predicates,r):this.predicates.push(r));return this},t.Predicate.and=function(){return y._combinePredicates([].slice.call(arguments,0),"and")},t.Predicate.or=function(){return y._combinePredicates([].slice.call(arguments,0),"or")},t.Predicate.fromJSON=function(n){var i,t,r;if(p(n,Array)){for(i=[],t=0,r=n.length;t0&&(f=e,o=n[u]));return o},quickSelect:function(n,i,r,u,f,e){if(r==u)return n[r];var o=t.pvt.partition(n,i,r,u,e),s=o-r+1;return s==f?n[o]:f0||t.length>0;)f=n.length>0&&t.length>0?r?r(v(n,i,0),v(t,i,0))<=0?n:t:n[0][i]0?n:t,u.push(f.shift());return u},getObject:function(n,t){var i,f,u;if(!t)return r;if(!n)return t;if(n.indexOf(".")===-1)return t[n];for(i=t,f=n.split("."),u=0;u":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},t.data.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne ","in":" eq ",notin:" ne "},t.data.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof",notcontains:"substringof"},t.data.diacritics={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},t.data.fnOperators={equal:function(n,i,r,u){return(u&&(n=t.pvt.ignoreDiacritics(n),i=t.pvt.ignoreDiacritics(i)),r)?s(n)==s(i):n==i},notequal:function(n,i,r,u){return u&&(n=t.pvt.ignoreDiacritics(n),i=t.pvt.ignoreDiacritics(i)),!t.data.fnOperators.equal(n,i,r)},notin:function(n,i,r){for(var u=0;us(t):n>t},lessthanorequal:function(n,t,i){return i?s(n)<=s(t):n<=t},greaterthanorequal:function(n,t,i){return i?s(n)>=s(t):n>=t},contains:function(n,i,r,u){return(u&&(n=t.pvt.ignoreDiacritics(n),i=t.pvt.ignoreDiacritics(i)),r)?!c(n)&&!c(i)&&s(n).indexOf(s(i))!=-1:!c(n)&&!c(i)&&n.toString().indexOf(i)!=-1},notcontains:function(n,i,r,u){return u&&(n=t.pvt.ignoreDiacritics(n),i=t.pvt.ignoreDiacritics(i)),!t.data.fnOperators.contains(n,i,r)},notnull:function(n){return n!==null},isnull:function(n){return n===null},startswith:function(n,i,r,u){return(u&&(n=t.pvt.ignoreDiacritics(n),i=t.pvt.ignoreDiacritics(i)),r)?n&&i&&s(n).startsWith(s(i)):n&&i&&n.startsWith(i)},endswith:function(n,i,r,u){return(u&&(n=t.pvt.ignoreDiacritics(n),i=t.pvt.ignoreDiacritics(i)),r)?n&&i&&s(n).endsWith(s(i)):n&&i&&n.endsWith(i)},all:function(n,i,r){for(var u=0;u-1&&(this.array.splice(t,1),this._raise("remove",{item:n,index:t})),t},length:function(){return this.array.length},_raise:function(t,i){this._events.triggerHandler(n.extend({type:t},i));this._events.triggerHandler({type:"all",name:t,args:i})},toArray:function(){return this.array}},n.extend(t,t.dataUtil),Array.prototype.forEach=Array.prototype.forEach||function(n,t){for(var i=0,r=this.length;i9&&window.navigator.msPointerEnabled,n.pointerEnabled=window.navigator.pointerEnabled,n}function a(t,i,r){var u=r.type;r.type=i;n.event.dispatch.call(t,r);r.type=u}function it(n,t){if(t)for(var i in t)i in n||(n[i]=t[i])}function o(n){return n.originalEvent.touches?n.originalEvent.touches[0]:i?n.originalEvent:n}function d(n){var r=i?n.originalEvent.pointerType:n.originalEvent.touches?"touch":"mouse",u=i&&l==t?r==4?"mouse":"touch":r;return n.pointerType=u,n.type!="mousedown"&&n.type!="mouseup"&&it(n,n.originalEvent),u=="touch"&&(n.button=t),n}function s(t,i,r){var o,s,h,u={},e,f;return r&&(f=r.originalEvent.touches?[r.originalEvent.touches[0],t.originalEvent.changedTouches[0]]:[r.originalEvent,t.originalEvent],i._isSwipe||i._isdrag?(o=n.event.special.pinch._getdistance(f[0],f[1]),s=i.time,e={pageX:i.stopPoint.pageX,pageY:i.stopPoint.pageY}):i._isPinch&&(o=n.event.special.pinch.distance(t),s=t.timeStamp-r.timeStamp,h=i._pinchDistance),i._isDelta&&(u._dTime=t.timeStamp-r.timeStamp,u._x=f[1].pageX-f[0].pageX,u._y=f[1].pageY-f[0].pageY)),{options:t,delta:{time:u._dTime||null,X:u._x||null,Y:u._y||null},distance:o,scale:i._isPinch?h:null,time:s,velocity:{XY:o/u._dTime||null,X:u._x/u._dTime||null,Y:u._y/u._dTime||null},currentPosition:{pageX:e?e.pageX:null,pageY:e?e.pageY:null}}}function h(){var n=new Date;return n.getTime()}function v(n){i&&n.css("-ms-touch-action","pinch-zoom").css("touch-action","pinch-zoom")}var c=n(document);n.each("touchstart touchmove touchend tap doubletap taphold swipe swipeleft swiperight pinch pinchin pinchout pinchstop scrollstart scrollstop".split(" "),function(t,i){n.fn[i]=function(n){return n?this.on(i,n):this.trigger(i)};n.attrFn&&(n.attrFn[i]=!0)});var i=k().isMSPointerEnabled,l=k().pointerEnabled,y="ontouchstart"in window,rt="scroll",p=typeof orientation=="undefined",g=navigator.userAgent.match(/iPhone|iPad|iPod/i),u=i?l?"pointerdown":"MSPointerDown":y?"touchstart":"mousedown",f=i?l?"pointerup":"MSPointerUp":g?"touchend":y?"touchend":"mouseup",r=i?l?"pointermove":"MSPointerMove":y?"touchmove":"mousemove",w=i?l?"pointercancel":"MSPointerCancel":y?"touchcancel":"mouseleave",ut=i||!p?u:g?"touchstart":"touchstart mousedown",e=i||!p?f:"touchend mouseup",b=i||!p?r:"touchmove mousemove",nt=k(),tt=nt.name=="msie"&&nt.version=="9.0"?!0:!1;n.event.special.ejtouchmove={setup:function(){function s(){}function h(n){if(n.originalEvent&&!(n.which&&n.which!==1)){var f=n.target,u=n.originalEvent;i&&(t={x:u.x,y:u.y});o.on(r,l)}}function l(n){if(!(n.which&&n.which!==1)){var u=n.target,r=n.originalEvent;it(n,n.originalEvent);(!i||!t||Math.abs(t.x-r.x)>10||Math.abs(t.y-r.y)>10&&i)&&a(e,"ejtouchmove",n)}}var e=this,o=n(e),t;o.on(u,h);c.on(f,s);t={}}};n.event.special.swipeupdown={setup:function(){var e=this,i=n(e);v(i);i.on(u,function(u){function l(n){if(n.preventDefault(),e){var t=o(n);h={time:(new Date).getTime(),coords:[t.pageX,t.pageY]};Math.abs(e.coords[1]-h.coords[1])>10&&n.preventDefault()}}if(u.originalEvent){var a=u,c=o(u),e={time:(new Date).getTime(),coords:[c.pageX,c.pageY],origin:n(u.target)},h;i.on(r,l).one(f,function(u){if(i.off(r,l),e&&h&&h.time-e.time<1e3&&Math.abs(e.coords[1]-h.coords[1])>30&&Math.abs(e.coords[0]-h.coords[0])<75){var o={time:h.time-e.time,_isSwipe:!0,_isDelta:!0,stopPoint:h},f=s(u,o,a);e.origin.trigger(n.extend(!0,{type:"swipeupdown"},f)).trigger(n.extend(!0,{type:e.coords[1]>h.coords[1]?"swipeup":"swipedown"},f))}e=h=t})}})}};n.event.special.scrollstart={isEnabled:!0,setup:function(){function u(n,r){t=r;a(i,t?"scrollstart":"scrollstop",n)}var i=this,f=n(i),t,r;f.on(rt,function(i){n.event.special.scrollstart.isEnabled&&(t||u(i,!0),clearTimeout(r),r=setTimeout(function(){u(i,!1)},250))})}};n.event.special.tap={doubleTapThreshold:500,tapholdThreshold:650,canDoubleTap:function(t){return h()-t.doubleTapStartTime<=n.event.special.tap.doubleTapThreshold},setup:function(){var u=this,i=n(u),t=i.data(),r;v(i);t.isDoubleTapWait=!1;t.stopProcess=!1;t.preTouchend=null;t.preTouchstart=null;i.on(ut,function(f){function o(){clearTimeout(v);i.off(e,s);tt&&c.off(e,s);c.off(e,o);i.off(w,o);i.off(b,y);i.off("dragstart",it)}function y(n){var t=10,r=n.originalEvent.changedTouches?n.originalEvent.changedTouches[0]:n.originalEvent,u=f.originalEvent.changedTouches?f.originalEvent.changedTouches[0]:f.originalEvent;r.pageX-u.pageX-t&&r.pageY-u.pageY-t||(n.type=="mousemove"||n.type=="pointermove"&&n.originalEvent.pointerType=="mouse"||n.type=="MSPointerMove"&&n.originalEvent.pointerType==4?(clearTimeout(v),i.off(w,o),i.off(b,y)):o())}function s(i){var e,s;i.type=="touchend"&&(t.preTouchend=h());o();r!=i.target&&(i.type=="mouseup"||f.type=="pointerup"||"MSPointerUp")&&(e=i.target,jQuery.contains(r,e)?nt(i,r):jQuery.contains(e,r)||(s=n(r).parents().has(n(e)).first()[0],ej.isNullOrUndefined(s)||nt(i,s)));g===i.currentTarget&&(a(u,"tap",n.extend(d(i),{time:h()-t.startTime})),t.isDoubleTapWait&&n.event.special.tap.canDoubleTap(t)?(t.isDoubleTapWait=!1,a(u,"doubletap",n.extend(d(i),{time:h()-t.doubleTapStartTime}))):(t.isDoubleTapWait&&(t.isDoubleTapWait=!1,t.doubleTapStartTime=t.startTime),n.event.special.tap.canDoubleTap(t)&&(t.isDoubleTapWait=!0)))}function nt(n,t){n.target=t;n.toElement=t}function it(){o()}var g,l,v,p,k;if(f.originalEvent)if((f.type=="mousedown"||f.type=="pointerdown"||"MSPointerDown")&&(r=f.target),t=i.data(),t.startTime=h(),t.isDoubleTapWait||(t.doubleTapStartTime=t.startTime),f.type=="touchstart"&&(t.preTouchstart=t.startTime),t.stopProcess=f.type=="mousedown"&&(t.startTime-t.preTouchend<300||t.startTime-t.preTouchstart<30)?!0:!1,g=f.currentTarget,l=f.originalEvent,f.which&&f.which!==1||t.stopProcess)t.stopProcess&&(t.stopProcess=!1);else{i.on(e,s);c.on(e,o);if(tt)c.on(e,s);i.on(w,o);i.on(b,y);i.on("dragstart",it);p={};for(k in l)p[k]=l[k];v=setTimeout(function(){t.isDoubleTapWait&&(t.isDoubleTapWait=!1);a(u,"taphold",n.extend(d(f),{options:p,time:h()-t.startTime}))},n.event.special.tap.tapholdThreshold)}})}};n.event.special.swipe={scrollSupression:10,duration:1e3,horizontalDistance:30,verticalDistance:75,pointers:window.navigator.msPointerEnabled,startPoint:function(t){var i=o(t);return{time:(new Date).getTime(),Items:i,coords:[i.pageX,i.pageY],origin:n(t.target)}},stopPoint:function(n){var t=o(n);return{time:(new Date).getTime(),Items:t,coords:[t.pageX,t.pageY]}},handleSwipe:function(t,i,r,u){if((t.Items.pageY!=t.Items.clientY||i.Items.pageY!=i.Items.clientY)&&(n.event.special.swipe.horizontalDistance=130),i.time-t.timen.event.special.swipe.horizontalDistance&&Math.abs(t.coords[1]-i.coords[1])i.coords[0]?"swipeleft":"swiperight"},f))}},setup:function(){var e=this,i=n(e);v(i);i.on(u,function(u){function s(t){e&&(o=n.event.special.swipe.stopPoint(t),Math.abs(e.coords[0]-o.coords[0])>n.event.special.swipe.scrollSupression&&t.preventDefault())}if(u.originalEvent){var e=n.event.special.swipe.startPoint(u),o,h=u;n(u.target).data("_dataTouchStart",{event:u,_now:(new Date).getTime()});i.on(r,s).one(f,function(u){i.off(r,s);e&&o&&n.event.special.swipe.handleSwipe(e,o,u,h);e=o=t})}})}};n.event.special.pinch={distance:function(t){return t.originalEvent.touches.length<2?null:n.event.special.pinch._getdistance(t.originalEvent.touches[0],t.originalEvent.touches[1])},_getdistance:function(n,t){return Math.sqrt((n.pageX-t.pageX)*(n.pageX-t.pageX)+(n.pageY-t.pageY)*(n.pageY-t.pageY))},setup:function(){var e=this,i=n(e);v(i);i.on(u,function(u){var h;if(u.originalEvent&&(h=u,u.originalEvent.touches&&u.originalEvent.touches.length>=2)){var o=n.event.special.pinch.distance(u),e,a=5,c=o,l,v=s(u,{_isPinch:!0,_pinchDistance:c},h);n(u.target).trigger(n.extend(!0,{type:"pinch"},v));function y(t){l=t;e=n.event.special.pinch.distance(t)||null;o&&e&&Math.abs(o-e)>a&&(n(t.target).trigger(n.extend(!0,{type:o>e?"pinchin":"pinchout"},s(t,{_isPinch:!0,_pinchDistance:c},h))),o=e)}i.on(r,y).one(f,function(){i.off(r,y);n(u.target).trigger(n.extend(!0,{type:"pinchstop"},s(l,{_isPinch:!0,_pinchDistance:e},h)));o=e=t})}})}};n.event.special.touchdrag={setup:function(){var e=this,i=n(e);v(i);i.on(u,function(u){function c(t){h&&(e=o(t),n.event.special.pinch._getdistance(h,e)>5&&n(t.target).trigger(n.extend(!0,{type:"touchdrag"},s(t,{_isdrag:!0,stopPoint:e,_isDelta:!0},l))))}if(u.originalEvent){var h=o(u),e,l=u;n(u.target).data("_dataTouchStart",{event:u,_now:(new Date).getTime()});i.on(r,c).one(f,function(){i.off(r,c);h=e=t})}})}};n.each({scrollstop:"scrollstart",doubletap:"tap",taphold:"tap",swipeleft:"swipe",swiperight:"swipe",swipedown:"swipeupdown",swipeup:"swipeupdown",pinchin:"pinch",pinchout:"pinch",pinchstop:"pinch"},function(t,i){n.event.special[t]={setup:function(){n(this).on(i,n.noop)}}})}(jQuery),function(n,t,i){t.widget("ejDraggable","ej.Draggable",{element:null,model:null,validTags:["div","span","a"],defaults:{scope:"default",handle:null,dragArea:null,clone:!1,distance:1,dragOnTaphold:!1,cursorAt:{top:-1,left:-2},dragStart:null,drag:null,dragStop:null,create:null,destroy:null,autoScroll:!1,scrollSensitivity:20,scrollSpeed:20,helper:function(){return n('
').html("draggable").appendTo(document.body)}},_init:function(){this.handler=function(){};this.resizables={};this._wireEvents();this._browser=t.browserInfo();this._isIE8=this._browser.name=="msie"&&this._browser.version=="8.0";this._isIE9=this._browser.name=="msie"&&this._browser.version=="9.0";this._browser.name=="msie"&&this.element.addClass("e-pinch");this._browser.name=="edge"&&this.element.css("touch-action","none")},_setModel:function(n){for(var t in n)switch(t){case"dragArea":this.model.dragArea=n[t];break;case"dragOnTaphold":this.model.dragOnTaphold=n[t];break;case"autoScroll":this.model.autoScroll=n[t]}},_destroy:function(){n(document).off(t.eventType.mouseUp,this._destroyHandler).off(t.eventType.mouseUp,this._dragStopHandler).off(t.eventType.mouseMove,this._dragStartHandler).off(t.eventType.mouseMove,this._dragHandler).off("mouseleave",this._dragMouseOutHandler).off("selectstart",!1);t.widgetBase.droppables[this.scope]=null},_initialize:function(i){var r,u;if(i.target&&i.target.nodeName&&n(i.target).closest("input[type='text'], input[type='checkbox'], textarea, select, option").length)return!0;r=i;i.preventDefault();i=this._getCoordinate(i);this.target=n(r.currentTarget);this._initPosition={x:i.pageX,y:i.pageY};n(document).on(t.eventType.mouseMove,this._dragStartHandler).on(t.eventType.mouseUp,this._destroyHandler);this.model.clone||(u=this.element.offset(),this._relXposition=i.pageX-u.left,this._relYposition=i.pageY-u.top);n(document.documentElement).trigger(t.eventType.mouseDown,r)},_setDragArea:function(){var o=n(this.model.dragArea)[0],s,h,u,r,f,e,i;if(o){if(r=["left","right","bottom","top"],t.isNullOrUndefined(o.getBoundingClientRect)){for(s=n(this.model.dragArea).outerWidth(),h=n(this.model.dragArea).outerHeight(),i=0;i=this.model.distance){if(o=this.model.helper({sender:u,element:this.target}),!o||t.isNullOrUndefined(o))return;if(e=this.model.handle=this.helper=o,this.model.dragStart&&(f=null,u.type=="touchmove"?(s=u.originalEvent.changedTouches[0],f=document.elementFromPoint(s.clientX,s.clientY)):f=u.originalEvent.target||u.target,this.model.cursorAt.top==0&&this.model.cursorAt.left==0&&(f=this._checkTargetElement(r)||f),this._trigger("dragStart",{event:u,element:this.element,target:f,currentTarget:this._getCurrTarget(r)})))return this._destroy(),!1;if(this.model.dragArea?this._setDragArea():(this._left=this._top=this._right=this._bottom=0,this["border-top-width"]=this["border-left-width"]=0),!t.isNullOrUndefined(e)&&e.length>0){h=e.offsetParent().offset();n(document).off(t.eventType.mouseMove,this._dragStartHandler).off(t.eventType.mouseUp,this._destroyHandler).on(t.eventType.mouseMove,this._dragHandler).on(t.eventType.mouseUp,this._dragStopHandler).on("mouseleave",this._dragMouseOutHandler).on("selectstart",!1);t.widgetBase.droppables[this.model.scope]={draggable:this.element,helper:e.css({position:"absolute",left:this.position.left-h.left,top:this.position.top-h.top}),destroy:this._destroyHandler}}}}(this.model.autoScroll&&r.type=="touchmove"||r.type=="mousemove"&&(r.buttons!==i?r.buttons:r.which)==1||this._isIE8||this._isIE9)&&(a=this._getScrollParent(u.target))},_drag:function(i){var f,e,s,h,r,l,v,u,a,o,c;i.preventDefault();this.position=this._getMousePosition(i);this.position.top<0&&(this.position.top=0);n(document).height()this.position.left?this._left:this._rightthis.position.top?this._top:this._bottom0&&(r=n(u).data("ejDroppable"),!t.isNullOrUndefined(r)))return r},_elementUnderCursor:function(n){return n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"?document.elementFromPoint(n.originalEvent.changedTouches[0].clientX,n.originalEvent.changedTouches[0].clientY):document.elementFromPoint(n.clientX,n.clientY)},_contains:function(t,i){try{return n.contains(t,i)||t==i}catch(r){return!1}},_wireEvents:function(){t.isDevice()==!0&&this.model.dragOnTaphold==!0?this._on(this.element,"taphold",this._initialize):this._on(this.element,t.eventType.mouseDown,this._initialize);this._dragStartHandler=n.proxy(this._dragStart,this);this._destroyHandler=n.proxy(this._destroy,this);this._dragStopHandler=n.proxy(this._dragStop,this);this._dragHandler=n.proxy(this._drag,this);this._dragMouseEnterHandler=n.proxy(this._dragMouseEnter,this);this._dragMouseOutHandler=n.proxy(this._dragMouseOut,this)},_getMousePosition:function(n){n=this._getCoordinate(n);var t=this.model.clone?n.pageX:n.pageX-this._relXposition,i=this.model.clone?n.pageY:n.pageY-this._relYposition;return{left:t-[this.margins.left+this.model.cursorAt.left],top:i-[this.margins.top+this.model.cursorAt.top]}},_getCoordinate:function(n){var i=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend"||n.type=="taphold"&&t.browserInfo().name!="msie")&&(i=n.originalEvent.changedTouches[0]),i},_getScrollParent:function(n){return n&&n.scrollHeight>n.clientHeight?n:n&&n.parentNode?this._getScrollParent(n.parentNode):void 0}})}(jQuery,Syncfusion),function(n,t){t.widget("ejDroppable","ej.Droppable",{element:null,model:null,validTags:["div","span","a"],dropElements:[],defaults:{accept:null,scope:"default",drop:null,over:null,out:null,create:null,destroy:null},_init:function(){this._mouseOver=!1;this.dropElements.push(this)},_setModel:function(){},_destroy:function(){n(this.element).off("mouseup",n.proxy(this._drop,this))},_over:function(n){this._mouseOver||(this._trigger("over",n),this._mouseOver=!0)},_out:function(n){this._mouseOver&&(this._trigger("out",n),this._mouseOver=!1)},_drop:function(t,i){var u=t.target,f=n(u).parents(".e-droppable"),r;for(n(u).hasClass("e-droppable")&&f.push(u),r=0;r').html("resizable").appendTo(document.body)}},_init:function(){if(this.target=this.element,this._browser=t.browserInfo(),this._isIE8=this._browser.name=="msie"&&this._browser.version=="8.0",this._isIE9=this._browser.name=="msie"&&this._browser.version=="9.0",this.handle!=null)n(this.target).delegate(this.handle,t.eventType.mouseDown,n.proxy(this._mousedown,this)).delegate(this.handle,"resizestart",this._blockDefaultActions);else n(this.target).on(t.eventType.mouseDown,n.proxy(this._mousedown,this));this._resizeStartHandler=n.proxy(this._resizeStart,this);this._destroyHandler=n.proxy(this._destroy,this);this._resizeStopHandler=n.proxy(this._resizeStop,this);this._resizeHandler=n.proxy(this._resize,this);this._resizeMouseEnterHandler=n.proxy(this._resizeMouseEnter,this)},_mouseover:function(i){if(n(i.target).hasClass("e-resizable")){n(i.target).css({cursor:"se-resize"});n(this.target).on(t.eventType.mouseDown,n.proxy(this._mousedown,this))}else n(this.target).off(t.eventType.mouseDown),n(this.target).css({cursor:""})},_blockDefaultActions:function(n){n.cancelBubble=!0;n.returnValue=!1;n.preventDefault&&n.preventDefault();n.stopPropagation&&n.stopPropagation()},_setModel:function(){},_mousedown:function(i){var r=i;i=this._getCoordinate(i);this.target=n(r.currentTarget);this._initPosition={x:i.pageX,y:i.pageY};this._pageX=i.pageX;this._pageY=i.pageY;n(document).on(t.eventType.mouseMove,this._resizeStartHandler).on(t.eventType.mouseUp,this._destroyHandler);return n(document.documentElement).trigger(t.eventType.mouseDown,r),!1},_resizeStart:function(i){var r,h;if(n(i.target).hasClass("e-resizable")){i=this._getCoordinate(i);var u=this._initPosition.x-i.pageX,f=this._initPosition.y-i.pageY,e,o,s=Math.sqrt(u*u+f*f);if(s>=this.model.distance){if(this.model.resizeStart!=null&&this._trigger("resizeStart",{event:i,element:this.target}))return;r=this.model.helper({element:this.target});e=i.pageX-this._pageX+r.outerWidth();o=i.pageY-this._pageY+r.outerHeight();this._pageX=i.pageX;this._pageY=i.pageY;h=this.getElementPosition(r);n(document).off(t.eventType.mouseMove,this._resizeStartHandler).off(t.eventType.mouseUp,this._destroyHandler).on(t.eventType.mouseMove,this._resizeHandler).on(t.eventType.mouseUp,this._resizeStopHandler).on("mouseenter",this._resizeMouseEnterHandler).on("selectstart",!1);t.widgetBase.resizables[this.scope]={resizable:this.target,helper:r.css({width:e,height:o}),destroy:this._destroyHandler}}}},_resize:function(n){var i,r,u,e,f;n=this._getCoordinate(n);e=this.getElementPosition(t.widgetBase.resizables[this.scope].helper);f=this.model.helper({element:this.target});i=n.pageX-this._pageX+f.outerWidth();r=n.pageY-this._pageY+f.outerHeight();this._pageX=n.pageX;this._pageY=n.pageY;ithis.model.maxHeight&&(u=r-this.model.maxHeight,r=this.model.maxHeight,this._pageY=n.pageY-u);this.model.maxWidth!=null&&i>this.model.maxWidth&&(u=i-this.model.maxWidth,i=this.model.maxWidth,this._pageX=n.pageX-u);t.widgetBase.resizables[this.scope].helper.css({width:i,height:r});this._trigger("resize",{element:this.target})},_resizeStop:function(n){this.model.resizeStop!=null&&this._trigger("resizeStop",{element:this.target});(n.type=="mouseup"||n.type=="touchend")&&this._destroy(n)},_resizeMouseEnter:function(n){this._isIE9?this._resizeManualStop(n):this._isIE8?n.button==0&&this._resizeManualStop(n):n.buttons==0&&this._resizeManualStop(n)},_resizeManualStop:function(n){this.model.resizeStop!=null&&this._trigger("resizeStop",{element:this.target});this._destroy(n)},_destroy:function(){n(document).off(t.eventType.mouseUp,this._destroyHandler).off(t.eventType.mouseUp,this._resizeStopHandler).off(t.eventType.mouseMove,this._resizeStartHandler).off(t.eventType.mouseMove,this._resizeHandler).off("mouseenter",this._resizeMouseEnterHandler).off("selectstart",!1);t.widgetBase.resizables[this.scope]=null},getElementPosition:function(n){return n!=null&&n.length>0?{left:n[0].offsetLeft,top:n[0].offsetTop}:null},_getCoordinate:function(n){var t=n;return(n.type=="touchmove"||n.type=="touchstart"||n.type=="touchend")&&(t=n.originalEvent.changedTouches[0]),t}})}(jQuery,Syncfusion),function(n,t,i,r){"use strict";t.widget("ejScrollBar","ej.ScrollBar",{defaults:{orientation:"horizontal",viewportSize:0,height:18,width:18,smallChange:57,largeChange:57,value:0,maximum:0,minimum:0,buttonSize:18,infiniteScrolling:!1},validTags:["div"],type:"transclude",dataTypes:{buttonSize:"number",smallChange:"number",largeChange:"number"},observables:["value"],value:t.util.valueFunction("value"),_enabled:!0,content:function(){return this._content&&this._content.length||(this._content=this.model.orientation==="horizontal"?this.element.find(".e-hhandle"):this.element.find(".e-vhandle")),this._content},_init:function(){this.element.addClass("e-widget");this._ensureScrollers();this.content();this._setInitialValues()},_setInitialValues:function(){var n="X";this.model.orientation===t.ScrollBar.Orientation.Horizontal?this.element.addClass("e-hscrollbar"):(this.element.addClass("e-vscrollbar"),n="Y");(this.value()!==0||this.model.minimum!==0)&&(this.value(){2}<\/div>",u=n.fn.jquery,f={},o,e;f[i.dimension]=i.modelDim;e=t.buildTag("div."+i.css+"scroll e-box",String.format(r,"up e-chevron-up_01 e-icon e-box e-button",i.buttonSize)+String.format(r,"handlespace",i.handleSpace,String.format(r,"handle e-box e-pinch",i.handle))+String.format(r,"down e-chevron-down_01 e-icon e-box e-button",i.buttonSize),f);this.element.append(e);this.element.find(".e-vhandle").addClass("e-v-line e-icon");this.element.find(".e-hhandle").addClass("e-h-line e-icon");o=u==="1.7.1"||u==="1.7.2"?i.uDimension.toLowerCase():"outer"+i.uDimension;this[i.handler]=this.element.find("."+i.handler);this[i.handler].css("transition","none");this[i.scroll]=this[i.handler].parent();this[i.main]=this[i.scroll].parent();this[i.main].find(".e-button")["outer"+i.uDimension](i.buttonSize)},_calculateLayout:function(n){var i,u;n.scrollDim="scroll"+n.dimension;n.lPosition=n.position.toLowerCase();n.clientXy="page"+n.xy;n.scrollVal="scroll"+n.position;n.scrollOneStepBy=this.model.smallChange;n.modelDim=this.model[n.dimension=n.dimension.toLowerCase()];n.handler=n.css+"handle";n.buttonSize=this.model.buttonSize;n.main=n.css+"scroll";n.scroll=n.css+"ScrollSpace";n.handleSpace=n.modelDim-2*n.buttonSize;n.scrollable=this.model.maximum-this.model.minimum;i=this.model.height;this.model.orientation==="horizontal"&&(i=this.model.width);n.handle=this.model.viewportSize/(this.model.maximum-this.model.minimum+this.model.viewportSize)*(i-2*this.model.buttonSize);u=!t.isNullOrUndefined(this.model.elementHeight)&&typeof this.model.elementHeight=="string"&&this.model.elementHeight.indexOf("%")!=-1?!0:!1;n.handle<20&&!u&&(n.handle=20);n.onePx=n.scrollable/(n.handleSpace-n.handle);n.fromScroller=!1;n.up=!0;n.vInterval=r},_updateLayout:function(n){this.element.height(this.model.height);this.element.width(this.model.width);var t=this.element.find("."+n.css+"handle"),f=this.element.find("."+n.css+"handlespace"),u=n.dimension=="width"?t.css("left"):t.css("top"),i=n.dimension=="width"?f.outerWidth():f.outerHeight();u!==r&&u!=="auto"&&(i>=n.handle+parseFloat(u)||(this.model.enableRTL?t.css(n.dimension==="width"?"left":"top",parseFloat(i)-n.handle):t.css(n.dimension==="width"?"left":"top",parseFloat(i)-n.handle>0?parseFloat(i)-n.handle:0)));this.element.find("."+n.css+"scroll").css(n.dimension,n.modelDim+"px").find(".e-button").css(n.dimension,this.model.buttonSize).end().find("."+n.css+"handlespace").css(n.dimension,n.handleSpace+"px").find("."+n.css+"handle").css(n.dimension,n.handle+"px")},refresh:function(){this._ensureScrollers();this.value()&&this.scroll(this.value(),"none");this._scrollData&&(this._calculateLayout(this._scrollData),this._updateLayout(this._scrollData))},scroll:function(n,i,r,u){var o=this._scrollData,f,e;if(!r)if(this.model.orientation===t.ScrollBar.Orientation.Horizontal){if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollLeft:n,originalEvent:u}))return}else if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollTop:n,originalEvent:u}))return;this._scrollData&&(this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name!="msie"?this.value(-o.scrollable+n):this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name=="msie"?this.value(-1*n):this.value(n),this.content().length>0&&(this.model.orientation===t.ScrollBar.Orientation.Horizontal?(f=this.element.find(".e-hhandlespace").width()-this.element.find(".e-hhandle").outerWidth(),n=f<(n-this.model.minimum)/this._scrollData.onePx?f:(n-this.model.minimum)/this._scrollData.onePx,this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name!="msie"&&(n=f-n,n>0?n=n*-1:n),this._scrollData.enableRTL&&(u=="mousemove"||u=="touchmove")&&t.browserInfo().name=="msie"&&(n=-n),this._scrollData.enableRTL&&n>0&&!this._scrollData._scrollleftflag?n=0:n,this._scrollData._scrollleftflag&&(n>0?n=n*-1:n,this.value(n)),this.content()[0].style.left=n+"px",this._scrollData._scrollleftflag=!1):(e=this.element.find(".e-vhandlespace").height()-this.element.find(".e-vhandle").outerHeight(),n=e<(n-this.model.minimum)/this._scrollData.onePx?e:(n-this.model.minimum)/this._scrollData.onePx,t.browserInfo().name=="msie"&&isNaN(n)&&(n=""),this.content()[0].style.top=n+"px")))},_changeTop:function(n,t,i){var u,r;return u=n.dimension==="height"?this.value():this.value(),r=u+t,n.step=t,n.enableRTL&&t<0||t>0&&!n.enableRTL?n.enableRTL?rthis.model.maximum&&(r=this.model.maximum):n.enableRTL?r>this.model.minimum&&(r=this.model.minimum):r0:r<0)&&(r=0),r*(this._data.enableRTL?-1:1)+this._data.handle>=this._data.handleSpace&&(r=(this._data.handleSpace-this._data.handle)*(this._data.enableRTL?-1:1)),u=Math.ceil(r*this._data.onePx),this.scroll(u,"thumb")):(u=f*this._data.onePx,this._changeTop(this._data,u,"thumb",this._d)),this._trigger("thumbMove",{originalEvent:i,direction:this._data.step>0?1:-1,scrollData:this._data}));o===1&&(this._prevY=e)},_spaceMouseDown:function(r){var u,o,f,e;if(r.data&&this._enabled&&(u=r.data.d,o=this[u.handler][0].getBoundingClientRect(),r.which===1&&r.target!==this[u.handler][0])){f=r.data.step?this.model.smallChange:this.model.largeChange;e=r.data.top||o[u.lPosition];r[u.clientXy]=r[u.clientXy]||0;r[u.clientXy]-i.pageYOffsetr[u.clientXy])&&(u.up=!0),u.up){clearInterval(u.vInterval);return}this._changeTop(u,f,f===3?"track":"button",r);e=r.data?r.data.top||o[u.lPosition]:o[u.lPosition]},this),150);n(document).one("mouseup",{d:u},t.proxy(this._mouseUp,this));n(document).mouseout({d:u},t.proxy(this._mouseUp,this))}},_remove:function(){this.model.orientation===t.ScrollBar.Orientation.Horizontal&&this.element.find(".e-hscroll").remove();this.model.orientation===t.ScrollBar.Orientation.Vertical&&this.element.find(".e-vscroll").remove();this._scrollData=null;this._content=null},_destroy:function(){this.element.remove()}});t.ScrollBar.Orientation={Horizontal:"horizontal",Vertical:"vertical"}}(jQuery,Syncfusion,window),function(n,t,i,r){"use strict";t.widget("ejScroller","ej.Scroller",{_addToPersist:["scrollLeft","scrollTop"],defaults:{height:250,autoHide:!1,animationSpeed:600,width:0,scrollOneStepBy:57,buttonSize:18,scrollLeft:0,scrollTop:0,targetPane:null,scrollerSize:18,enablePersistence:!1,enableRTL:r,enableTouchScroll:!0,preventDefault:!1,enabled:!0,create:null,destroy:null,wheelStart:null,wheelMove:null,wheelStop:null},validTags:["div"],type:"transclude",dataTypes:{buttonSize:"number",scrollOneStepBy:"number"},observables:["scrollTop","scrollLeft"],scrollTop:t.util.valueFunction("scrollTop"),scrollLeft:t.util.valueFunction("scrollLeft"),keyConfigs:{up:"38",down:"40",left:"37",right:"39",pageUp:"33",pageDown:"34",pageLeft:"ctrl+37",pageRight:"ctrl+39"},content:function(){return!this._contentOffsetParent&&this._content&&this._content[0]&&(this._contentOffsetParent=this._content[0].offsetParent),this._content&&this._content.length&&this._contentOffsetParent||(this._content=this.element.children().first().addClass("e-content")),this._content},_setFirst:!0,_updateScroll:!1,_init:function(){t.isNullOrUndefined(this.content()[0])||(this._isJquery3=parseInt(n.fn.jquery)>=3?!0:!1,this._tempWidth=this.model.width,this._prevScrollWidth=this.content()[0].scrollWidth,this._prevScrollHeight=this.content()[0].scrollHeight,this.element.addClass("e-widget"),this.content(),this._browser=t.browserInfo().name,this._wheelStart=!0,this._eleHeight=this.model.height,this._eleWidth=this.model.width,this._isNativeScroll=t.isDevice(),this.model.targetPane!=null&&this.content().find(this.model.targetPane).addClass("e-target-pane"),this.model.enableRTL===r&&(this.model.enableRTL=this.element.css("direction")==="rtl"),this.model.autoHide&&this._on(this.element,"mousedown",this._mouseDownInitContent),this._ensureScrollers(),this.model.enableRTL&&(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft()),this._isNativeScroll&&this.element.addClass("e-native-scroll"),this._on(this.content(),"scroll",this._scroll),this.model.targetPane!=null&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll),this.scrollLeft()&&this._setScrollLeftValue(this.scrollLeft()),this.scrollTop()&&this.scrollTop(this._isJquery3?Math.ceil(this.scrollTop()):this.scrollTop()),this.content().scrollTop(this.scrollTop()),this.model.autoHide&&this._autohide(),this.model.enabled?this.enable():this.disable(),this._setDimension(),(this._prevScrollWidth!==this.content()[0].scrollWidth||this._prevScrollHeight!==this.content()[0].scrollHeight)&&this.refresh());this._addActionClass();this._isNativeScroll&&this._on(this.content(),"scrollstop",this._touchDown)},_mouseDownInitContent:function(){this.model.autoHide&&this._on(n(document),"mouseup",this._mouseUpContent);this.element.addClass("e-scroll-focus")},_addActionClass:function(){this._browser=="msie"&&(this.content().removeClass("e-pinch e-pan-x e-pan-y"),this._vScrollbar&&this._hScrollbar?this.content().addClass("e-pinch"):this._vScrollbar&&!this._hScrollbar?this.content().addClass("e-pan-x"):this._hScrollbar&&!this._vScrollbar&&this.content().addClass("e-pan-y"))},_setDimension:function(){t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1||(this._vScroll||this._hScroll?this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),this.element.parent().height()):n(this.content()[0]).height(""));t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1||(this._hScroll||this._vScroll?this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),this.element.parent().width()):n(this.content()[0]).width(""))},_setScrollLeftValue:function(n){this.model.enableRTL&&(n=t.browserInfo().name=="mozilla"?n<0?n:n*-1:!t.isNullOrUndefined(this._rtlScrollLeftValue)&&(t.browserInfo().name=="chrome"||this._rtlScrollLeftValue>0)?n<0?this._rtlScrollLeftValue+n:this._rtlScrollLeftValue-n:Math.abs(n));this.content().scrollLeft(n)},_ensureScrollers:function(){var u=n.fn.jquery,f;if(this.model.height=typeof this.model.height=="string"&&this.model.height.indexOf("px")!=-1?parseInt(this.model.height):this.model.height,this.model.width=typeof this.model.width=="string"&&this.model.width.indexOf("px")!=-1?parseInt(this.model.width):this.model.width,this.model.height&&this.element.height(this.model.height),this.model.width&&this.element.width(this.model.width),this._off(this.content(),"mousedown touchstart"),this.content().length>0){if(this.isVScroll()?(this._tempVscrollbar||(this._vScrollbar=this._createScrollbar(t.ScrollBar.Orientation.Vertical,this.isHScroll()),this._tempVscrollbar=this._vScrollbar),this.model.enableTouchScroll&&this._on(this.content(),"mousedown touchstart",{d:this._vScrollbar._scrollData},this._mouseDownOnContent)):(this._vScrollbar=null,this._tempVscrollbar=this._vScrollbar,this.element.children(".e-vscrollbar").remove()),this.isHScroll()?(this._tempHscrollbar||(this._hScrollbar=this._createScrollbar(t.ScrollBar.Orientation.Horizontal,this.isVScroll()),this._tempHscrollbar=this._hScrollbar),this.model.enableTouchScroll&&this._on(this.content(),"mousedown touchstart",{d:this._hScrollbar._scrollData},this._mouseDownOnContent)):(this._hScrollbar=null,this._tempHscrollbar=this._hScrollbar,this.element.children(".e-hscrollbar").remove()),this._vScrollbar||this._hScrollbar||this.content().css({width:"auto",height:"auto"}),this.element.find(".e-hscroll").length>0||this._vScrollbar&&this.content().outerHeight(this.content().outerHeight()-1),u==="1.7.1"||u==="1.7.2"?(this._contentHeight="height",this._contentWidth="width"):(this._contentHeight="outerHeight",this._contentWidth="outerWidth"),this._hScroll=this.isHScroll(),this._vScroll=this.isVScroll(),this._hScroll||this._vScroll){if(this.content().addClass("e-content"),f=this._exactElementDimension(this.element),this._elementDimension(f),this.model.targetPane!==null&&this.content().find(this.model.targetPane)[0]!==r?this.content().find(this.model.targetPane)[0].scrollLeft=this.scrollLeft():!this.isHScroll()&&this.element.children(".e-hscrollbar").length>0&&this._ensureScrollers(),isNaN(this._eleWidth)&&this._eleWidth.indexOf("%")>0&&isNaN(this._eleHeight)&&this._eleHeight.indexOf("%")>0)n(i).on("resize",n.proxy(this._resetScroller,this))}else this.content().removeClass("e-content");this._setDimension();this._parentHeight=n(this.element).parent().height();this._parentWidth=n(this.element).parent().width()}},_elementDimension:function(n){this._ElementHeight=n.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top);this.content()[this._contentHeight](this._ElementHeight-(this._hScroll&&!this.model.autoHide?this.model.scrollerSize:this.element.find(".e-hscrollbar").is(":visible")?this.model.scrollerSize:0));this._ElementWidth=n.width-(this.border_left+this.border_right+this.padding_left+this.padding_right);this.content()[this._contentWidth](this._ElementWidth-(this._vScroll&&!this.model.autoHide?this.model.scrollerSize:this.element.find(".e-vscrollbar").is(":visible")?this.model.scrollerSize:0))},_convertPercentageToPixel:function(n,t){return Math.floor(n*t/100)},isHScroll:function(){var u=parseFloat(n.fn.jquery)>=3?Math.ceil(this.element.width()):this.element.width(),i=this.model.width,r;if(t.isNullOrUndefined(this.model.width)||(i=typeof this.model.width=="string"&&this.model.width.indexOf("%")!=-1?u:parseFloat(n.fn.jquery)>=3&&!isNaN(parseFloat(this.model.width))?Math.ceil(parseFloat(this.model.width)):this.model.width),t.isNullOrUndefined(this._tempWidth)||typeof this._tempWidth!="string"||this._tempWidth.indexOf("%")==-1){if(i>0){if(r=this.content().find(this.model.targetPane),this.model.targetPane!=null&&r.length)return r[0].scrollWidth+r.siblings().width()>i;if(this.content()[0].scrollWidth>i)return!0;if(this.content()[0].scrollWidth==i){if(this.model.autoHide&&n(this.content()[0]).find("> *").length>0)return n(this.content()[0]).find("> *")[0].scrollWidth>n(this.content()[0]).width();if(n(this.content()[0]).find("> *").length>0)return n(this.content()[0]).find("> *")[0].scrollWidth>(t.isNullOrUndefined(this._tempVscrollbar)?i:i-this.model.scrollerSize)}return!1}return!1}if(t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1){if(this.content()[0].scrollWidth>u)return!0}else return this.content()[0].scrollWidth>u},isVScroll:function(){if(t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1){if(this.model.height>0&&(this.content()[0].scrollHeight>Math.ceil(this.model.height)||this.isHScroll()&&(this.content()[0].scrollHeight==this.model.height||this.content()[0].scrollHeight>this.model.height-(this.model.scrollerSize-2))))return!0}else return this.content()[0].scrollHeight>this.element.outerHeight();return!1},_setModel:function(n){for(var i in n)switch(i){case"enableRTL":n[i]?(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),t.isNullOrUndefined(this._hScrollbar)||(this._hScrollbar._scrollData.enableRTL=!0)):(this.element.removeClass("e-rtl"),t.isNullOrUndefined(this._hScrollbar)||(this._hScrollbar._scrollData.enableRTL=!1));this._hScrollbar&&(this.element.find(".e-hhandle").css("left",0),this._hScrollbar.value(0));break;case"preventDefault":this.model.preventDefault=n[i];break;case"scrollLeft":(parseFloat(t.util.getVal(n[i]))<0||!this._hScroll)&&(n[i]=0);this._hScrollbar&&(n[i]=parseFloat(t.util.getVal(n[i]))>this._hScrollbar._scrollData.scrollable?this._hScrollbar._scrollData.scrollable:parseFloat(t.util.getVal(n[i])));this._setScrollLeftValue(parseFloat(n[i]));this.scrollLeft(n[i]);!this._hScrollbar||this._hScrollbar._scrollData._scrollleftflag&&this.model.enableRTL||this.scrollX(n[i],!0);break;case"scrollTop":this._vScrollbar&&(n[i]=parseFloat(t.util.getVal(n[i]))>this._vScrollbar._scrollData.scrollable?this._vScrollbar._scrollData.scrollable:parseFloat(t.util.getVal(n[i])));(parseFloat(n[i])<0||!this._vScroll)&&(n[i]=0);this.content().scrollTop(parseFloat(n[i]));this.scrollTop(n[i]);this.scrollY(n[i],!0);break;case"touchScroll":this.model.enableTouchScroll?(this._vScrollbar&&this._on(this.content(),"mousedown touchstart",{d:this._vScrollbar._scrollData},this._mouseDownOnContent),this._hScrollbar&&this._on(this.content(),"mousedown touchstart",{d:this._hScrollbar._scrollData},this._mouseDownOnContent)):this._off(this.content(),"mousedown touchstart");break;case"scrollOneStepBy":this._vScrollbar&&(this._vScrollbar._scrollData.scrollOneStepBy=n[i],this._vScrollbar.model.smallChange=n[i]);this._hScrollbar&&(this._hScrollbar._scrollData.scrollOneStepBy=n[i],this._hScrollbar.model.smallChange=n[i]);break;case"buttonSize":this._vScrollbar&&(this._vScrollbar.model.buttonSize=this.model.buttonSize);this._hScrollbar&&(this._hScrollbar.model.buttonSize=this.model.buttonSize);this.refresh();break;case"height":this._eleHeight=n[i];this.refresh();break;case"width":this._eleWidth=n[i];this.refresh();break;case"enabled":n[i]?this.enable():this.disable();break;default:this.refresh()}},_createScrollbar:function(i,r){var c=this,f,o,l,s,a,h=document.createElement("div"),e,u;return i===t.ScrollBar.Orientation.Vertical?(o=this.model.scrollerSize,l=t.isNullOrUndefined(this.model.height)||typeof this.model.height!="string"||this.model.height.indexOf("%")==-1?f=this.model.height-(r?this.model.scrollerSize:0):f=this.element.height()-(r?this.model.scrollerSize:0),s=this.content()[0].scrollHeight,a=this.scrollTop()):(o=f=this.model.width-(r?this.model.scrollerSize:0),l=this.model.scrollerSize,t.isNullOrUndefined(this.model.width)||typeof this.model.width!="string"||this.model.width.indexOf("%")==-1?(e=this.content().find(this.model.targetPane),s=this.model.targetPane!=null&&e.length?e[0].scrollWidth+e.parent().width()-e.width():this.content()[0].scrollWidth):(o=f=this.element.width()-(r?this.model.scrollerSize:0),s=this.content()[0].scrollWidth),a=this.scrollLeft()),this.element.children(".e-hscrollbar").length>0?n(this.element.children(".e-hscrollbar")).before(h):this.element.append(h),n(h).ejScrollBar({elementHeight:c._eleHeight,elementWidth:c._eleWidth,buttonSize:c.model.buttonSize,orientation:i,viewportSize:f,height:l,width:o,maximum:s-f,value:a,smallChange:this.model.scrollOneStepBy,largeChange:3*this.model.scrollOneStepBy,scroll:t.proxy(this._scrollChanged,this),thumbEnd:t.proxy(this._thumbEnd,this),thumbStart:t.proxy(this._thumbStart,this),thumbMove:t.proxy(this._thumbMove,this)}),u=n(h).ejScrollBar("instance"),i!==t.ScrollBar.Orientation.Vertical&&r||this._off(this.element,this._browser=="msie"?"wheel mousewheel":"mousewheel DOMMouseScroll",this._mouseWheel)._on(this.element,this._browser=="msie"?"wheel mousewheel":"mousewheel DOMMouseScroll",{d:u._scrollData},this._mouseWheel),i===t.ScrollBar.Orientation.Horizontal?this._scrollXdata=u._scrollData:this._scrollYdata=u._scrollData,i===t.ScrollBar.Orientation.Horizontal&&this.model.enableRTL&&(u._scrollData.enableRTL=!0),u._enabled=this.model.enabled,u},_updateScrollbar:function(i,r){var u=i===t.ScrollBar.Orientation.Vertical?this._vScrollbar:this._hScrollbar;u&&(i===t.ScrollBar.Orientation.Vertical?(u.model.width=this.model.scrollerSize,u.model.height=u.model.viewportSize=this.model.height-(r?this.model.scrollerSize:0),u.model.maximum=this.content()[0].scrollHeight-u.model.viewportSize,u.model.value=this.scrollTop()):(u.model.width=u.model.viewportSize=this.model.width-(r?this.model.scrollerSize:0),u.model.height=this.model.scrollerSize,u.model.maximum=(this.model.targetPane!=null&&this.content().find(this.model.targetPane).length>0?this.content().find(this.model.targetPane)[0].scrollWidth+(this.content().width()-this.content().find(n(this.model.targetPane)).outerWidth()):this.content()[0].scrollWidth)-u.model.viewportSize,this.model.enableRTL||(u.model.value=this.scrollLeft())))},_autohide:function(){this.model.autoHide?(this.element.addClass("e-autohide"),this._on(this.element,"mouseenter mouseleave touchstart touchend",this._scrollerHover),n(":hover").filter(this.element[0]).length||this.content().siblings(".e-scrollbar.e-js").hide(),this._elementDimension(this._exactElementDimension(this.element))):(this.element.removeClass("e-autohide"),this._off(this.element,"mouseenter mouseleave touchstart touchend",this._scrollerHover),this.content().siblings(".e-scrollbar.e-js").show())},_mouseUpContent:function(t){t.type=="mouseup"&&(this.element.removeClass("e-scroll-focus"),this._autohide(),this._off(n(document),"mouseup",this._mouseUpContent))},_scrollChanged:function(i){this._updateScroll=!0;i.scrollTop!==r?this.scrollY(i.scrollTop,!0,"",i.source):i.scrollLeft!==r&&this.scrollX(i.scrollLeft,!0,"",i.source);this._updateScroll=!1;var u=this;n.when(this.content()).done(t.proxy(function(){u._trigger("scrollEnd",{scrollData:i})}))},_bindBlurEvent:function(r,u){this._scrollEle=n(r).data("ejScrollBar");this._event=u;var f=this;this._listener=function(){this._scrollEle._off(n(document),"mousemove touchmove",this._scrollEle._mouseMove);n(document).off("mouseup touchend",t.proxy(this._scrollEle._mouseUp,this._scrollEle));this._scrollEle._prevY=null;this._off(n(document),"mousemove touchmove",this._mouseMove);this._off(n(document),"mouseup touchend",this._mouseUp);this._off(n(i),"blur");this._evtData.handler==="e-vhandle"?this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData}):this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData})};this._on(n(i),"blur",this._listener)},_thumbStart:function(n){this._evtData=n.scrollData;var t=n.scrollData.handler==="e-vhandle"?this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"),t=n.scrollData.handler==="e-vhandle"?this.element.find("."+n.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+n.scrollData.handler).closest(".e-scrollbar");this._bindBlurEvent(t,n);this._trigger("thumbStart",n)},_thumbMove:function(n){this._trigger("thumbMove",n)},_thumbEnd:function(t){this._trigger("thumbEnd",t);this._off(n(i),"blur")},refresh:function(i){var r,u;i?(this._tempVscrollbar=null,this.element.children(".e-vscrollbar").remove(),this._tempHscrollbar=null,this.element.children(".e-hscrollbar").remove()):this.element.find(">.e-content").removeAttr("style");t.isNullOrUndefined(this._eleHeight)||typeof this._eleHeight!="string"||this._eleHeight.indexOf("%")==-1||this._parentHeight==n(this.element).parent().height()||(r=this._exactElementDimension(this.element.parent()),r=r.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),r));t.isNullOrUndefined(this._eleWidth)||typeof this._eleWidth!="string"||this._eleWidth.indexOf("%")==-1||this._parentWidth==n(this.element).parent().width()||(r=this._exactElementDimension(this.element.parent()),r=r.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),r));this._ensureScrollers();u=this.model.scrollLeft;this.model.enableRTL?(this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),u>0?this.content().scrollLeft(this._rtlScrollLeftValue-u):this._setScrollLeftValue(u)):this.content().scrollLeft(u);(this.scrollTop()&&t.isNullOrUndefined(this._vScrollbar)||!t.isNullOrUndefined(this._vScrollbar)&&this._vScrollbar&&this._vScrollbar._scrollData!=null&&!this._vScrollbar._scrollData.skipChange)&&this.scrollTop(this._isJquery3?Math.ceil(this.scrollTop()):this.scrollTop());this.content().scrollTop(this.scrollTop());this._vScrollbar&&(this._vScrollbar._scrollData.dimension="Height",this._updateScrollbar(t.ScrollBar.Orientation.Vertical,this._hScroll),this._vScroll&&!this._vScrollbar._calculateLayout(this._vScrollbar._scrollData)&&this._vScrollbar._updateLayout(this._vScrollbar._scrollData));this._hScrollbar&&(this._hScrollbar._scrollData.dimension="Width",this._updateScrollbar(t.ScrollBar.Orientation.Horizontal,this._vScroll),this._hScroll&&!this._hScrollbar._calculateLayout(this._hScrollbar._scrollData)&&this._hScrollbar._updateLayout(this._hScrollbar._scrollData));t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?this.element.find(".e-hhandle").css("left","0px"):this.model.targetPane!=null&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll);this._addActionClass();this._autohide()},_exactElementDimension:function(n){var i=n.get(0).getBoundingClientRect(),r=["left","right","top","bottom"],u,f,t;for(u=i.width?i.width:i.right-i.left,f=i.height?i.height:i.bottom-i.top,t=0;tthis._vScrollbar._scrollData.scrollable?this._vScrollbar._scrollData.scrollable:parseFloat(n));n=this._isJquery3?Math.ceil(n):n;this.scrollTop(n);this.content().stop().animate({scrollTop:n},r,"linear",function(){e._trigger("scroll",{source:u||"custom",scrollData:e._vScrollbar?e._vScrollbar._scrollData:null,scrollTop:n,originalEvent:f})})}},scrollX:function(n,i,r,u,f){var o=this,e,s;if(n!==""){if(this._hScrollbar&&(n=parseFloat(n)>this._hScrollbar._scrollData.scrollable?this._hScrollbar._scrollData.scrollable:parseFloat(n)),e=t.browserInfo().name,this.model.enableRTL&&e!="mozilla"&&e!="chrome"&&(n<0&&(n=Math.abs(n)),s=this.model.targetPane!=null?this.content().find(this.model.targetPane)[0]:this.content()[0],f!="mousemove"&&f!="touchmove"&&e!="msie"&&e!="msie"&&(n=this._hScrollbar._scrollData.scrollable-n)),this.scrollLeft(n),i){if(this._trigger("scroll",{source:u||"custom",scrollData:this._hScrollbar?this._hScrollbar._scrollData:null,scrollLeft:n,originalEvent:f}))return;this.model.targetPane!=null&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane).scrollLeft(n):this.content().scrollLeft(n);return}(t.isNullOrUndefined(r)||r==="")&&(r=100);this.model.targetPane!=null&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane).stop().animate({scrollLeft:n},r,"linear"):this.content().stop().animate({scrollLeft:n},r,"linear",function(){o._trigger("scroll",{source:u||"custom",scrollData:o._hScrollbar?o._hScrollbar._scrollData:null,scrollLeft:n,originalEvent:f})})}},enable:function(){var n=this.element.find(".e-vscrollbar,.e-hscrollbar,.e-vscroll,.e-hscroll,.e-vhandle,.e-hhandle,.e-vscroll .e-icon,.e-hscroll .e-icon");n.hasClass("e-disable")&&(n.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.enabled=!0);this._vScrollbar&&(this._vScrollbar._enabled=this.model.enabled);this._hScrollbar&&(this._hScrollbar._enabled=this.model.enabled)},disable:function(){var n=this.element.find(".e-vscrollbar,.e-hscrollbar,.e-vscroll,.e-hscroll,.e-vhandle,.e-hhandle,.e-vscroll .e-icon,.e-hscroll .e-icon");n.addClass("e-disable").attr({"aria-disabled":!0});this.model.enabled=!1;this._vScrollbar&&(this._vScrollbar._enabled=this.model.enabled);this._hScrollbar&&(this._hScrollbar._enabled=this.model.enabled)},_changeTop:function(n,i,r,u){var e=Math.ceil(this.model.targetPane!=null&&n.dimension!="height"?this.content().find(this.model.targetPane)[n.scrollVal]():this.content()[n.scrollVal]()),f;return n.dimension=="height"&&e==0&&(e=this.scrollTop()!=0?this.scrollTop():0),f=e+i,(n.enableRTL?fn.scrollable)&&(f=Math.round(n.scrollable)),(n.enableRTL?f>0:f<0)&&(f=0),f!==e&&(this["scroll"+n.xy](f,!0,"",r,u),n.xy!=="X"||t.isNullOrUndefined(this._hScrollbar)?t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(f,r,!0,u):this._hScrollbar.scroll(f,r,!0,u)),f!==e},_mouseWheel:function(t){var o;if((!this._vScrollbar||!t.ctrlKey)&&(this._vScrollbar||t.shiftKey)&&t.data&&this.model.enabled){var u=0,f=t.data.d,r=t,e;if(t=t.originalEvent,this._wheelStart&&this._trigger("wheelStart",{originalEvent:t,scrollData:r.data.d}),this._wheelStart=!1,clearTimeout(n.data(this,"timer")),this._wheelx!=1&&(t.wheelDeltaX==0||t.wheelDeltaY==0)&&(this._wheelx=1),navigator.platform.indexOf("Mac")==0&&this._wheelx==0&&(this._browser=="webkit"||this._browser=="chrome"))return!0;(this._browser=="mozilla"?t.axis==t.HORIZONTAL_AXIS?f=this._scrollXdata?this._scrollXdata:f:this._scrollYdata:this._browser=="msie"?(t.type=="wheel"&&(u=t.deltaX/120),t.type=="mousewheel"&&t.shiftKey&&(f=this._scrollXdata,t.preventDefault?t.preventDefault():t.returnValue=!1)):this._wheelx&&t.wheelDeltaX!=0&&t.wheelDeltaY==0&&this._scrollXdata&&(f=this._scrollXdata),t.wheelDeltaX==0&&(this._wheelx=t.wheelDeltaX),t.wheelDelta?(u=this._normalizingDelta(t),i.opera&&parseFloat(i.opera.version,10)<10&&(u=-u)):t.detail&&(u=t.detail/3),u)&&(r.originalEvent&&(e=r.originalEvent.wheelDelta&&r.originalEvent.wheelDelta>0||r.originalEvent.detail&&r.originalEvent.detail<0?-1:1),this._changeTop(f,u*f.scrollOneStepBy,"wheel",t)?(t.preventDefault?t.preventDefault():r.preventDefault(),this._trigger("wheelMove",{originalEvent:t,scrollData:r.data.d,direction:e})):(this._trigger("scrollEnd",{originalEvent:t,scrollData:r}),this._wheelx=0),o=this,n.data(this,"timer",setTimeout(function(){o._wheelStart=!0;o._trigger("wheelStop",{originalEvent:t,scrollData:r.data.d,direction:e})},250)))}},_normalizingDelta:function(n){return navigator.platform.indexOf("Mac")==0?Math.abs(n.wheelDelta)!==120?-n.wheelDelta/3:-n.wheelDelta/80:-n.wheelDelta/120},_contentHeightWidth:function(){this.content().siblings().css("display")=="block"&&this.model.autoHide?(this._hScroll&&this.content()[this._contentHeight](this._ElementHeight-this.model.scrollerSize),this._vScroll&&this.content()[this._contentWidth](this._ElementWidth-this.model.scrollerSize)):this.content().siblings().css("display")=="none"&&this.model.autoHide&&(this._vScroll||this._hScroll)&&(this.content()[this._contentHeight](this._ElementHeight),this.content()[this._contentWidth](this._ElementWidth))},_scrollerHover:function(n){this.model.enabled&&(n.type!="mouseenter"&&n.type!="touchstart"||this.content().siblings().is(":visible")?n.type!="mouseleave"&&n.type!="touchend"||this.element.hasClass("e-scroll-focus")||(this.content().siblings().hide(),this._contentHeightWidth(),this._trigger("scrollHide",{originalEvent:n})):(this.content().siblings().css("display","block"),this._contentHeightWidth(),this._ensureScrollers(),this._setScrollLeftValue(this.model.scrollLeft),this._trigger("scrollVisible",{originalEvent:n})))},_mouseUp:function(r){if(r.data){var u=r.data.d;this.model.enableRTL&&(r.type=="mouseup"||r.type=="touchend")&&(this.model.scrollLeft=this._rtlScrollLeftValue-this.model.scrollLeft);r.type!=="mouseup"&&r.type!=="touchend"&&(r.toElement||r.relatedTarget)||(this.content().css("cursor","default"),this._off(n(document),"mousemove touchmove"),this._off(this.content(),"touchmove",this._touchMove),this._off(n(document),"mouseup touchend",this._mouseUp),u.fromScroller=!1,this._mouseMoved!==!0||r.data.source!=="thumb"||t.isNullOrUndefined(this.model)||(n.when(this.content()).done(t.proxy(function(){this._trigger("thumbEnd",{originalEvent:r,scrollData:u})},this)),this._off(n(i),"blur")));u.up=!0;this._mouseMoved=!1;i.ontouchmove=null}},_mouseDownOnContent:function(u){var f,s;if((this._startX=u.clientX!=r?u.clientX:u.originalEvent.changedTouches[0].clientX,this._startY=u.clientY!=r?u.clientY:u.originalEvent.changedTouches[0].clientY,this._timeStart=u.timeStamp||Date.now(),this.model.enabled)&&(f=u.data.d,this._evtData=u.data,s=f.handler==="e-vhandle"?this.element.find("."+f.handler).closest(".e-scrollbar"):this.element.find("."+f.handler).closest(".e-scrollbar"),this._bindBlurEvent(s,u),!this._trigger("thumbStart",{originalEvent:u,scrollData:f}))&&(u.which!=3||u.button!=2)){f.fromScroller=!0;var e=null,o=1,c=5,h;this._document=n(document);this._window=n(i);this._mouseMove=function(n){var l,a,s;if(this.model.enableRTL&&this._UpdateScrollLeftValue(u),this._startX+this._startY!=n.clientX+n.clientY){if(this._relDisX=(this._startx=n.clientX!=r?n.clientX:n.originalEvent.changedTouches[0].clientX)-this._startX,this._relDisY=(this._starty=n.clientY!=r?n.clientY:n.originalEvent.changedTouches[0].clientY)-this._startY,this._duration=(n.timeStamp||Date.now())-this._timeStart,this._velocityY=Math.abs(this._relDisY)/this._duration,this._velocityX=Math.abs(this._relDisX)/this._duration,this._swipe=Math.abs(this._relDisX)>Math.abs(this._relDisY)?this._relDisX>0?"left":"right":this._relDisY>0?"up":"down",!t.isNullOrUndefined(n.target.tagName)&&n.target.tagName.toLowerCase()==="iframe"){n.type="mouseup";this._mouseUp(n);return}if(l=n.type=="mousemove"?n[f.clientXy]:n.originalEvent.changedTouches[0][f.clientXy],e&&l!==e&&(this._mouseMoved=!0,a=l-e,s=this.model[f.scrollVal]-a,o==1&&Math.abs(a)>c&&(h=f.position,o=0),o==0&&(e=l),s>=0&&s<=f.scrollable&&h===f.position)){var v=this._velocityY>.5&&this._duration<50&&f.position=="Top",y=this._velocityX>.5&&this._duration<50&&f.position=="Left",p=(this._velocityY>.5||this._velocityX>.5)&&this._duration<50;p?v?(s=Math.abs(this._relDisY)+this._duration*this._velocityY,this._startY>this._starty?(s+=this.scrollTop(),s>f.scrollable&&(s=f.scrollable)):(sthis.scrollTop()&&(s=0)),this.scrollTop()<=f.scrollable&&this.scrollY(s,!1,this.model.animationSpeed,"thumb")):y&&(s=Math.abs(this._relDisX),this._startX>this._startx?(s+=this.scrollLeft(),s>f.scrollable&&(s=f.scrollable)):(s-=this.scrollLeft(),s=Math.abs(s),(s>f.scrollable||s>=this.scrollLeft())&&(s=0)),this.scrollLeft()<=f.scrollable&&this.scrollX(s,!1,this.model.animationSpeed,"thumb")):(this["scroll"+f.xy](s,!0,"","thumb",n.type),f.xy==="X"?this._hScrollbar.scroll(s,"thumb",!0,n.type):t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(s,"thumb",!0,n.type),this.content().css("cursor","pointer"),this._trigger("thumbMove",{originalEvent:n,direction:this._swipe=="down"||this._swipe=="right"?1:-1,scrollData:f}))}i.ontouchmove=function(n){n=n||i.event;n.preventDefault&&n.preventDefault();n.returnValue=!1};e==null&&(e=l);(Math.round(this._content.scrollTop())==0&&this._swipe=="down"||(Math.ceil(this._content.scrollTop())==f.scrollable||Math.ceil(this._content.scrollTop())+1==f.scrollable)&&this._swipe=="up")&&(this._trigger("scrollEnd",{originalEvent:n.originalEvent,scrollData:n}),i.ontouchmove=null)}};this._trigger("touchStart",{originalEvent:u,direction:this._swipe=="down"||this._swipe=="right"?1:-1,scrollData:this._scrollData,scrollTop:this.content().scrollTop(),scrollLeft:this.content().scrollLeft()});this._on(n(document),"mousemove",{d:f,source:"thumb"},this._mouseMove);this._isNativeScroll?this._on(this.content(),"touchmove",{d:f,source:"thumb"},this._touchMove):this._on(n(document),"touchmove",{d:f,source:"thumb"},this._mouseMove);this._on(n(document),"mouseup touchend",{d:f,source:"thumb"},this._mouseUp)}},_touchMove:function(){this.content().css("cursor","pointer");this._mouseMoved=!0;this._tempLeft=this.model.targetPane!=null?this.content().find(this.model.targetPane).scrollLeft():this.content().scrollLeft();this._tempTop=this.content().scrollTop()},_touchDown:function(n){var t;t=this._tempLeft!=this.scrollLeft()?this._scrollXdata:this._tempTop!=this.scrollTop()?this._scrollYdata:this._scrollYdata?this._scrollYdata:this._scrollXdata;this._trigger("scrollStop",{source:"thumb",originalEvent:n,scrollData:t,scrollTop:this.content().scrollTop(),scrollLeft:this.content().scrollLeft()})},_speedScrolling:function(n){var r,i,u,n,t;if(this._mouseMoved){if(this.element.find(".e-vhandle").length>0&&(r=this.content().scrollTop(),this._tempTop!==r&&(this._trigger("thumbMove",{originalEvent:n,direction:this._swipe=="down"||this._swipe=="right"?1:-1,scrollData:this._scrollData}),this._vScrollbar.scroll(this.content().scrollTop(),"thumb",!0,"touchmove"),n={source:"thumb",scrollData:this._vScrollbar?this._vScrollbar._scrollData:null,scrollTop:this.content().scrollTop(),originalEvent:n},t=this._isJquery3?Math.ceil(n.scrollTop):n.scrollTop,this.scrollTop(t),this._trigger("scroll",n))))return;if(this.element.find(".e-hhandle").length>0&&(i=this.model.targetPane!=null?this.content().find(this.model.targetPane):this.content(),u=i.scrollLeft(),this._tempLeft!==u&&(this._trigger("thumbMove",{originalEvent:n,direction:this._swipe=="down"||this._swipe=="right"?1:-1,scrollData:this._scrollData}),this._hScrollbar.scroll(i.scrollLeft(),"thumb",!0,"touchmove"),n={source:"thumb",scrollData:this._hScrollbar?this._hScrollbar._scrollData:null,scrollLeft:this.content().scrollLeft(),originalEvent:n},t=this._isJquery3?Math.ceil(n.scrollLeft):n.scrollLeft,this.scrollLeft(t),this._trigger("scroll",n))))return;this.content().css("cursor","pointer")}},_scroll:function(r){var s=[this._vScrollbar?this._vScrollbar._scrollData:null,this._hScrollbar?this._hScrollbar._scrollData:null],h,e,u,o,f;for(this._evtData&&(h=this._evtData.d?this._evtData.d:this._evtData),e=0;e<2;e++)(u=s[e],u&&!u.skipChange)&&((this.model&&(!this.model.targetPane||this.model.targetPane&&h&&h.xy!="X")&&(u.dimension==="height"?this.scrollTop(r.target[u.scrollVal]):this.scrollLeft(r.target[u.scrollVal])),u.sTop=this.model&&this.model.targetPane!=null&&e==1&&this.content().find(this.model.targetPane).length?this.content().find(this.model.targetPane)[0][u.scrollVal]:u.scrollVal=="scrollTop"?this.scrollTop():this.scrollLeft(),this[u.scrollVal](u.sTop),u.fromScroller)||(e===1?(o=this.content()[0],this._rtlScrollLeftValue&&o.scrollWidth-o.clientWidth!=this._rtlScrollLeftValue&&(this._rtlScrollLeftValue=o.scrollWidth-o.clientWidth),u.sTop=this.model&&t.browserInfo().name!="mozilla"&&this.model.enableRTL&&!this._hScrollbar._scrollData._scrollleftflag?this._rtlScrollLeftValue==0?u.sTop*-1:u.sTop-this._rtlScrollLeftValue:u.sTop,this._hScrollbar.scroll(u.sTop,"",!0)):this._vScrollbar.scroll(u.sTop,"",!0),(s.length==2&&e==1||s.length==1&&e==0)&&(this._externalScroller=!1,this.model&&this._trigger("scroll",{source:"custom",scrollData:this._hScrollbar?this._hScrollbar._scrollData:null,scrollLeft:this.scrollLeft(),originalEvent:r}))));this._isNativeScroll&&this.model.enableTouchScroll&&this._speedScrolling(r);this._UpdateScrollLeftValue(r);f=this;this._vScrollbar&&this._scrollYdata&&this.model&&this._scrollYdata.scrollable-this.model.scrollOneStepBy>=this.scrollTop()&&(n(":hover").filter(this.element[0]).length||f._off(t.getScrollableParents(f.wrapper),"scroll",null),t.browserInfo().name!="chrome"?i.onmousewheel=function(t){f.model&&f.model.preventDefault&&n(":hover").filter(f.element[0]).length&&t.preventDefault()}:i.addEventListener("wheel",function(t){f.model&&f.model.preventDefault&&n(":hover").filter(f.element[0]).length&&t.preventDefault()},{passive:!1}))},_UpdateScrollLeftValue:function(n){this.model&&n.type!="touchstart"&&n.type!="mousedown"&&this.model.enableRTL&&this._rtlScrollLeftValue&&this.model.scrollLeft!=this._previousScrollLeft&&(this.model.scrollLeft=this._rtlScrollLeftValue-this.model.scrollLeft,this._previousScrollLeft=this.model.scrollLeft);(this.model&&n.type=="touchstart"||n.type=="mousedown")&&this.model.enableRTL&&(this.model.scrollLeft=this.content().scrollLeft(),this.option("scrollLeft",this.content().scrollLeft()))},_changevHandlerPosition:function(n){var t=this._vScrollbar;t&&(n=t._scrollData!=null&&n>=t._scrollData.scrollable?t._scrollData.scrollable:n,t!=null&&n>=0&&n<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,n/t._scrollData.onePx+"px"))},_changehHandlerPosition:function(n){var t=this._hScrollbar;t&&(n=t._scrollData!=null&&n>=t._scrollData.scrollable?t._scrollData.scrollable:n,t!=null&&top>=0&&n<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,n/t._scrollData.onePx+"px"))},_destroy:function(){this._off(this.content(),"scrollstop",this._touchDown);this._off(n(document),"mouseup",this._mouseUpContent);this.element.css({width:"",height:""}).children(".e-vscrollbar,.e-hscrollbar").remove();this.content().removeClass("e-content").css({width:"",height:""});this.element.removeClass("e-widget")},_preventDefault:function(n){n=n||i.event;n.preventDefault&&n.preventDefault();n.returnValue=!1}})}(jQuery,Syncfusion,window),function(n,t,i){t.widget("ejNavigationDrawerBase","ej.NavigationDrawerBase",{defaults:{contentId:null,cssClass:"",direction:"left",targetId:null,position:"normal",enableListView:!1,listViewSettings:{},type:"overlay",width:"auto",swipe:null,open:null,beforeClose:null,items:[],ajaxSettings:{type:"GET",cache:!1,data:{},dataType:"html",contentType:"html",async:!0},ajaxSuccess:null,ajaxError:null,ajaxComplete:null},dataTypes:{direction:"enum",type:"enum",ajaxSettings:"data"},loadContent:function(i,r){var f=this,u,e,o;r.indexOf("#")==0?(u=n(r)[0]&&n(r)[0].nodeName&&n(r)[0].nodeName.toLowerCase()=="script"?t.getClearString(n(r)[0].innerHTML):r,u!=n(r)&&(n(u).length!=0?this._scriptTemplate.push({id:r,data:n(u)}):(e=n.grep(this._scriptTemplate,function(n){if(n.id==u)return n.data}),u=e.length>0?e[0].data[0]:u)),n(i).html(n(u)),this._hide()):(o={url:r,success:function(t){try{if(n(i).html(t),f._trigger("ajaxSuccess",{data:t,url:r,content:i}))return;f._hide()}catch(u){}},error:function(n){try{if(f._trigger("ajaxError",{data:{status:n.status,responseText:n.responseText,statusText:n.statusText},content:i,url:r}))return;f._hide()}catch(n){}},complete:function(n){try{f._trigger("ajaxComplete",{data:n,content:i,url:r})}catch(n){}}},this._sendAjaxRequest(o))},_sendAjaxRequest:function(t){n.ajax({type:t.type,cache:t.cache,url:t.url,dataType:t.dataType,data:t.data,contentType:t.contentType,async:t.async,success:t.success,error:t.error,beforeSend:t.beforeSend,complete:t.complete})},_shadowWrapper:function(){this.model.isPaneOpen||(this._elementOverlay=t.buildTag("div#"+this._id+"_Overlay",{},{},{"class":this._rootCSS+" "+this._prefixClass+"nb-layout "+this._prefixClass+"nb-overlay"}),this._elementShadow=t.buildTag("div#"+this._id+"_shadow",{},{},{"class":this._rootCSS+" "+this._prefixClass+"nb-shadow "+this._prefixClass+"nb-type-"+(this.model.type=="slide"?"slide":"overlay")}),this._nbHome.append(this._elementOverlay),this._elementOverlay.hide(),this.element.hide(),this.element.prepend(this._elementShadow))},_renderControl:function(){this.model.position.toLowerCase()=="fixed"&&this.element.appendTo(this._nbHome);this._shadowWrapper();this.element.addClass(this._prefixClass+"user-select "+this.model.cssClass);this.element.addClass(this._prefixClass+"nb-layout "+(this.model.direction.toLowerCase()=="left"?this._prefixClass+"nb-left":this._prefixClass+"nb-right"));this.element.addClass(this._prefixClass+"nb-type-"+(this.model.type=="slide"?"slide":"overlay"));this._maxIndex=this._getMaxZindex();this._parentWidth=this._nbHome.width();this._setWidth();this._setLayout()},_getMaxZindex:function(){return Math.max.apply(null,n.map(n("body *"),function(t){return parseInt(n(t).css("z-index"))+1||1}))},_transform:function(t,i,r){var s="-"+this._browser+"-transform",u="translateX("+t+"px) translateZ(0px)",h="-"+this._browser+"-transition-property",f="transform",c="-"+this._browser+"-transition-duration",e=i+"ms",o;r?(o=this.model.position=="fixed"?"e-nb-fixed":"",this.model.position=="normal"&&this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").addClass("e-nb-normal"),this.element.addClass(""+this._prefixClass+"nb-animate "+o),this.element.css(h,f).css(c,e).css(s,u),this.element.css("transition-property",f).css("transition-duration",e).css("transform",u)):(o=this.model.position=="fixed"?"e-nb-fixed":"",this.model.position=="normal"&&this.model.type=="slide"&&n("#"+this._id+"_WrapContainer").addClass("e-nb-normal"),this._nbHome.addClass(this._rootCSS+" "+this._prefixClass+"nb-animate "+o),this._nbHome.css(h,f).css(c,e).css(s,u),this._nbHome.css("transition-property",f).css("transition-duration",e).css("transform",u))},_show:function(){t.isNullOrUndefined(this.element.css("left").match(/\d/g))||Number(this.element.css("left").match(/\d/g)[0]r.clientX?"right":"left";u=this._isOpened()?this._swipeDirection!=this.model.direction.toLowerCase()?!0:!1:!1;u?this._startSwipeOffsetX&&this._isOpened()&&(this._relativeX=r.clientX-this._startSwipeOffsetActualX,this._relativeY=r.clientY-this._startSwipeOffsetY,f=this.element.width()+this._relativeX-(this.model.type.toLowerCase()=="overlay"?this._nbHome.offset().left:0),n(r.target).hasClass(""+this._prefixClass+"nb-overlay")&&(this.model.direction=="left"?-this._relativeXthis._nbHome.width()-50)&&(this.element.show(),r=this.model.type.toLowerCase()=="slide"?0:this._nbHome.offset().left,(this.model.direction=="left"?this._relativeX-r-this.element.width())&&(!this._containerX||this.model.targetHome?this._transform(this._containerX+this._relativeX-r,0,this._isTransitionElement()):i)))},_touchEnd:function(r){var u=r.changedTouches?r.changedTouches[0]:r;(t.listenTouchEvent(this._nbHome,t.moveEvent(),this._touchMoveHandler,!0,this),this._isOpened()||(n.isFunction(t.isIOS7)?t.isIOS7():!1)||(this._containerX?this._hide():(this._relativeX=u.clientX-this._startSwipeOffsetX,this._relativeY=u.clientY-this._startSwipeOffsetY,(this.model.direction=="left"?this._startSwipeOffsetX<50:this._startSwipeOffsetX>this._nbHome.width()-50)&&(this._relativeX>30||this._relativeX<-30?this._show():this._hide()))),this._data={targetElement:this._nbHome,element:this.element,direction:this._swipeDirection},this.model.enableListView?n.extend(this._data,{listview:this._lb}):i,this._trigger("swipe",this._data))||(t.listenTouchEvent(this._nbHome,t.endEvent(),this._touchEndHandler,!0,this),t.listenTouchEvent(this._nbHome,"mouseleave",this._touchEndHandler,!0,this))},open:function(){this.model.isPaneOpen||this._show()},close:function(){if(!this.model.isPaneOpen){if(this._data={element:this.element},this.model.enableListView?n.extend(this._data,{listview:this._lb}):i,this._trigger("beforeClose",this._data))return;this._hide()}},toggle:function(){this.model.isPaneOpen||(this._isOpened()?this.close():this.open())}})}(jQuery,Syncfusion),function($,ej,undefined){ej.widget("ejListViewBase","ej.ListViewBase",{_addToPersist:["selectedItemIndex","checkedIndices"],defaults:{height:null,width:null,selectedItemIndex:-1,enableGroupList:!1,enableAjax:!1,enableCache:!1,enablePersistence:!1,ready:null,load:null,itemRequestCount:5,totalItemsCount:5,loadComplete:null,ajaxBeforeLoad:null,ajaxSuccess:null,ajaxError:null,ajaxComplete:null,ajaxSettings:{type:"GET",cache:!1,async:!0,dataType:"html",contentType:"html",url:"",data:{}},renderTemplate:!1,templateId:null,persistSelection:!1,preventSelection:!1,dataSource:[],query:null,allowVirtualScrolling:!1,virtualScrollMode:"normal",showHeader:!1,showHeaderBackButton:!1,cssClass:"",headerTitle:"Title",headerBackButtonText:null,enableFiltering:!1,enableCheckMark:!1,checkedIndices:[],locale:"en-US"},observables:["selectedItemIndex","dataSource"],selectedItemIndex:ej.util.valueFunction("selectedItemIndex"),dataSource:ej.util.valueFunction("dataSource"),checkedIndices:ej.util.valueFunction("checkedIndices"),_updateModelItems:function(){var ang_attr,i,ang_li,ele,ul,groupid,ulindex,index,element,groupTitle,index1,element1,primaryKey,parentPrimaryKey;if(this.model.items=eval(this.model.items),ang_attr=this.model.items,ang_attr.length){for(ul=ej.buildTag("ul.e-m-clearall"),i=0;iul"),groupid=1,ulindex=0;ulindexli"),index=0;indexli"),index1=0;index10?(this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="continuous"&&ej.isNullOrUndefined(this._totalitemscount)&&(this.model.totalItemsCount=this._dataUrl.dataSource.json.length),this._queryPromise(0,this,this.model.totalItemsCount,null)):this._queryPromise(0,this,this.model.totalItemsCount,null):ej.isNullOrUndefined(this._dataUrl)||this._dataUrl instanceof ej.DataManager||ej.isNullOrUndefined(this._totalitemscount)?this._renderControl():(this._dataUrl=ej.DataManager(this._dataUrl),this._rawList=ej.DataManager(this._dataUrl.dataSource.json).executeLocal(ej.Query().take(this.model.totalItemsCount).clone()),this.model.dataSource=this._rawList,this._renderControl()))},_loadVirtualData:function(n){var u,c,f,r,i,s,l,t,o,h,e;if(this._dummyUl=[],u=this._renderLists(),$.views.helpers({_checkAjaxUrls:this._checkAjaxUrl,_checkImgUrls:this._checkImgUrl,_checkIsChecked:this._checkIsCheck,Object:this,ej:ej}),this.jsRender=ej.buildTag("script#"+this.model.id+"_Template","",{},{type:"text/x-jsrender"}),this.jsRender[0].text=ej.browserInfo().name=="msie"&&ej.browserInfo().version<10?u[0].outerHTML.replace(/>/g,">"):u[0].outerHTML.replace(/>/g,">"),this.jsChildRender=ej.buildTag("script#"+this.model.id+"_ChildTemplate","",{},{type:"text/x-jsrender"}),this.model.allowVirtualScrolling==!0&&this.model.virtualScrollMode=="normal"&&(c=ej.buildTag("div")),f=ej.buildTag("ul."+this._prefixClass+"childcontainer "+this._prefixClass+"list-hdr "+this._prefixClass+"clearall"),u.addClass(this._prefixClass+"childli"),f[0].innerHTML="{{for items}}"+u[0].outerHTML+"{{/for}}",r=n,r)for(f.empty().html($(this.jsRender).render(r)),i=f.clone().find("li"),s="",this._initEJCheckBox&&this._initEJCheckBox(f),l=this,t=0;tul"):this.element.find("ul:first"),this.model.showHeader&&(hdr=this._renderHeader(this.model.id,!1,this.model.headerTitle,this.model.headerBackButtonText),this._lbEle.prepend(hdr)),this._hasDataSource()&&!this.model.renderTemplate&&this.element.empty(),this.model.renderTemplate&&(this.model.templateId?this._tempContent.find("#"+this.model.templateId).length&&(this._template=this._tempContent.find("#"+this.model.templateId),ej.destroyWidgets(this._template),this._template[0].nodeName.toLowerCase()!="script"&&this._template.remove(),this._template=this._template[0].nodeName&&this._template[0].nodeName.toLowerCase()=="script"?ej.getClearString(this._template[0].innerHTML):this._template[0].outerHTML):(ej.destroyWidgets(this.element),this._template=this.element.html(),this.element.empty()),this._lContainer.addClass(this._prefixClass+"template-list")),!this.model.renderTemplate||this._hasDataSource()||this.model.enableGroupList){if(!this.model.renderTemplate||this.model.renderTemplate&&this._hasDataSource()||this.model.renderTemplate&&this.model.enableGroupList){if(this._model_index=0,this.model.enableGroupList){if(this._lContainer.addClass(this._prefixClass+"grouped"),innerDiv=ej.buildTag("div."+this._prefixClass+"grouplist"),ul=this.element.children(),ul.length||this.dataSource().length)for(group=this.dataSource().length?ej.DataManager(this.dataSource()).executeLocal(ej.Query().from(this.dataSource()).group(this.model.fieldSettings.groupID)):ej.DataManager(this.model.items).executeLocal(ej.Query().from(this.model.items).group(this.model.fieldSettings.groupID)),length=group.length,i=0;i=0&&!this.model.preventSelection&&this.model.persistSelection&&!ej.getBooleanVal(ulItems[this.selectedItemIndex()],"data-preventselection",this.model.preventSelection)&&ej.getBooleanVal(ulItems[this.selectedItemIndex()],"data-persistselection",this.model.persistSelection)&&(this._currentItem=$(this._liEl[this.selectedItemIndex()]),this._prevItem=this._currentItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"));$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"lv-checkdiv");this.model.renderTemplate&&$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark");$(this.element.find("."+this._prefixClass+"lv-check").closest("li."+this._prefixClass+"list")).addClass(this._prefixClass+"list-check");$(this.element.find("."+this._prefixClass+"lv-input").closest("."+this._prefixClass+"lv-filter")).addClass(this._prefixClass+"lv-inputdiv");this._wireEvents()}}else this.element.append(this._lbEle.append(this._lContainer)),$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark"),this._template&&(this._lContainer.append(this._template),ej.widget.init&&ej.widget.init(this._lContainer));this._setHeightWidth();this.model.height!==null&&this._lContainer.height()>this.model.height&&this._refreshScroller(this._lContainer,!1);this.scrollerObj&&(this.scrollerObj.refresh(),$(this.scrollerObj.element).find(".e-vhandlespace").css("height",$(this.scrollerObj.element).find(".e-vhandlespace").height()-1));this.model.loadComplete&&this._trigger("loadComplete")},_createFilterWrapper:function(n){var t=this._createFilterDiv(),i=ej.buildTag("a."+this._prefixClass+"lv-anchor",ej.buildTag("span."+this._prefixClass+"input-btn"),{},{Title:"Clear text","data-role":"none"});$(t).append(i);n.append(t)},_refreshScroller:function(n,t){this.model.virtualScrollMode=="continuous"&&(this._lContainer.find(".e-content, .e-vhandle,.e-vhandle div").removeAttr("style"),this._lContainer.css({display:"block"}),this.scrollerObj&&(this.scrollerObj.model.height=this._lContainer.height(),this.scrollerObj.refresh(),this.scrollerObj.option("scrollTop",0)));n.find(".e-vhandle div").removeAttr("style");var i;i=t?this.model.showHeader&&this.model.enableFiltering?this.model.height-(ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")+ej.getDimension($(id).find("."+this._prefixClass+"lv-filter"),"outerHeight"))-2:this.model.showHeader?this.model.height-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")-2:this.model.enableFiltering?this.model.height-ej.getDimension($(id).find("."+this._prefixClass+"lv-filter"),"outerHeight")-2:this.model.height-2:this.model.showHeader&&this.model.enableFiltering?this.model.height-(ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")+$("."+this._prefixClass+"lv-filter").height())-2:this.model.showHeader?this.model.height-ej.getDimension(this._lbEle.find("."+this._prefixClass+"header"),"outerHeight")-2:this.model.enableFiltering?this.model.height-$("."+this._prefixClass+"lv-filter").height()-2:this.model.height-2;this.scrollerObj&&(this.scrollerObj.model.height=i)},_renderListItems:function(n){var u,o,e,t,r,f,i;if(n.addClass(this._prefixClass+"list-hdr "+this._prefixClass+"clearall"),this._liItems=n.find("li"),(this._liItems.length&&!this._hasDataSource()||this._hasDataSource())&&(this._renderParentChildTemplate(),this._hasDataSource()||this.model.enableGroupList||(this._items=this.model.items),u=this._items,o=this,this.model.allowVirtualScrolling?(e=[],t={parent:u,child:e}):t=this._filterParentChild(u),t.child.length&&this._childRendering(t.child),t.parent))for(n.empty().html($(this.jsRender).render(t.parent)),r=n.find(">li"),f="",i=0;i=this.element.find("li").length*i&&(this._updateLoadingClass(!0),ej.DataManager&&this._dataUrl instanceof ej.DataManager&&!ej.isNullOrUndefined(this._dataUrl.dataSource.url)?this._queryPromise(this.realUllength,t,this.realUllength+this.model.itemRequestCount,n):(ej.DataManager&&this._dataUrl instanceof ej.DataManager&&this._dataUrl.dataSource.offline&&this._dataUrl.dataSource.json&&this._dataUrl.dataSource.json.length>0||!ej.isNullOrUndefined(this._dataUrl)&&!(this._dataUrl instanceof ej.DataManager))&&window.setTimeout(function(){t._updateLoadingClass(!1)},300))):this.model.allowVirtualScrolling&&this.model.virtualScrollMode=="normal"&&(u=this.dataSource(),ej.DataManager&&this._dataUrl instanceof ej.DataManager&&n.scrollTop!=n.scrollData.scrollOneStepBy+n.scrollData.scrollable&&window.setTimeout(function(){t._virtualCount==0&&t._loadList()},300))}},_localDataVirtualScroll:function(){var n=this._rawList.length;return ej.DataManager(this._dataUrl.dataSource.json).executeLocal(ej.Query().skip(n).take(this.model.totalItemsCount).clone())},_loadList:function(){var n,o,i,s,h,e;this._virtualCount++;var c=this.scrollerObj.scrollTop(),t=this,u=0,r,f=null;if(this._currentPageindex=Math.round(c/(this._liItemHeight*this._items.length)),$.inArray(this._currentPageindex,this._virtualPages.sort(function(n,t){return n-t}))!=-1)if(this._currentPageindex==0){if($.inArray(this._currentPageindex+1,this._virtualPages)!=-1)return this._virtualCount--,!1;this._currentPageindex=this._currentPageindex+1}else if($.inArray(this._currentPageindex-1,this._virtualPages)!=-1){if($.inArray(this._currentPageindex+1,this._virtualPages)!=-1)return this._virtualCount--,!1;this._currentPageindex=this._currentPageindex+1}else this._currentPageindex=this._currentPageindex-1;for(r=!($.inArray(this._currentPageindex-1,this._virtualPages)!=-1),this._updateLoadingClass(!0),n=this._virtualPages.length-1;n>=0;n--)if(this._virtualPages[n]0?(this._appendVirtualList(this._localDataVirtualScroll(),u,this._currentPageindex,f,r),this._updateLoadingClass(!1)):(h=ej.DataManager(t.model.dataSource).executeLocal(i),this._appendVirtualList(h,u,this._currentPageindex,f,r),this._updateLoadingClass(!1))},_appendVirtualList:function(n,t,i,r,u){var f,s,c,e,o,l,h;if(this._virtualCount--,$.inArray(i,this._virtualPages.sort(function(n,t){return n-t}))!=-1)return!1;if(u&&$.inArray(i-1,this._virtualPages.sort())!=-1&&(n.splice(0,this._items.length),u=!1),f=this._items.length,s=$("
    "),c=u?(i-1)*f*this._liItemHeight-(t*f+f)*this._liItemHeight:i*f*this._liItemHeight-(t*f+f)*this._liItemHeight,c!=0&&s.append($("").addClass("e-virtual").css({display:"block",height:c})),this._loadVirtualData(n),$(this._dummyUl).attr("data-ej-page",i),u&&$(this._dummyUl).slice(0,f).attr("data-ej-page",i-1),s.append(this._dummyUl),o=this.element.find("ul"),e=(i*f+f)*this._liItemHeight,e=r!=null?r*f*this._liItemHeight-e:o.height()-e,e!=0&&s.append($("").addClass("e-virtual").css({display:"block",height:e})),l=o.find("li[data-ej-page="+t+"]").last(),l.next().remove(),s.children().insertAfter(l),this._removeEmptyElements(),this._virtualPages.push(i),u&&this._virtualPages.push(i-1),ej.DataManager&&this._dataUrl instanceof ej.DataManager&&this._dataUrl.dataSource.offline&&this._dataUrl.dataSource.json&&this._dataUrl.dataSource.json.length>0)for(h=0;h0&&i.select(r)}else this.model.query&&(i=this.model.query.clone());return this.model.allowVirtualScrolling&&(i.requiresCount(),i.take(this.model.totalItemsCount)),n=this.model.dataSource.dataSource,t&&(n&&n.url&&!n.url.match(t.tableName+"$")||n&&!n.url||!n)&&(ej.isNullOrUndefined(t.tableName)||i.from(t.tableName)),i},_filterParentChild:function(n){var t=ej.DataManager(n),i=t.executeLocal(ej.Query().from(n).where(ej.Predicate(this.model.fieldSettings.parentPrimaryKey,ej.FilterOperators.notEqual,null)).group(this.model.fieldSettings.parentPrimaryKey)),r=t.executeLocal(ej.Query().from(n).where(ej.Predicate(this.model.fieldSettings.parentPrimaryKey,ej.FilterOperators.equal,null)));return{parent:r,child:i}},_childRendering:function(n){var t=this;n.length&&(t.element.append($(t.jsChildRender).render(n)),$.each(n,function(i,r){var u;ej.widget.init&&ej.widget.init(t.element.find("#child"+r.key));var o=t.element.find("#child"+r.key).find("ul"),e=o.find("li"),f=0;for(u=0;u"):t[0].outerHTML.replace(/>/g,">");this.jsChildRender=ej.buildTag("script#"+this.model.id+"_ChildTemplate","",{},{type:"text/x-jsrender"});this.model.allowVirtualScrolling==!0&&this.model.virtualScrollMode=="normal"&&(u=ej.buildTag("div"));i=ej.buildTag("ul."+this._prefixClass+"childcontainer "+this._prefixClass+"list-hdr "+this._prefixClass+"clearall");t.addClass(this._prefixClass+"childli");i[0].innerHTML="{{for items}}"+t[0].outerHTML+"{{/for}}";n=ej.buildTag("div."+this._rootCSS+" subpage "+this._prefixClass+"childitem","",{},{id:"{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}",style:"display:none"});r=ej.buildTag("div."+this._prefixClass+"list-container","",{},{id:"{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}_container"});this.model.showHeader&&n.append(this._renderHeader("{{if key}}child{{>key}}{{else "+this.model.fieldSettings.childId+"}}{{>"+this.model.fieldSettings.childId+"}}{{else}}{{/if}}",!0,"Title"));this.model.enableFiltering&&this._createFilterWrapper(n);this.model.allowVirtualScrolling==!0&&this.model.virtualScrollMode=="normal"?n.append(r.append(u.append(i))):n.append(r.append(i));ej.browserInfo().name=="msie"&&ej.browserInfo().version<10?this.jsChildRender[0].text=n[0].outerHTML.replace(/>/g,">"):this.jsChildRender[0].innerHTML=n[0].outerHTML.replace(/>/g,">")},_renderChild:function(n){this._currentItem.attr("data-childid",n);this._currentItem.attr("data-childtitle")||this._currentItem.attr("data-childtitle",this._currentItem.text());this._createListDiv(n);this._div.hide();this._container=ej.buildTag("div."+this._prefixClass+"list-container#"+n+"_container");this.element.append(this._div)},_getText:function(n){return $(n).clone().children().remove().end().text()},_checkImgUrl:function(){var n=this.getRsc("helpers","Object"),t=this.data[n.model.fieldSettings.imageUrl];return $.support.pushstate||(t=typeof App=="object"?App.route.makeUrlAbsolute(t,!0):t),""},_checkAjaxUrl:function(){var t=this.data.href,u=this.data.childId,e=this.data.renderTemplate,o=this.data.templateId,n=this.getRsc("helpers","Object"),f=this.getRsc("helpers","ej"),r=n._currentPage(n),i;t&&t.indexOf("#")!=-1&&t!="#"?n._storedContent[u]||(r.find(t).show(),i=r.find(t).clone(),r.find(t).hide(),n._storedContent[u]=i[0].nodeName&&i[0].nodeName.toLowerCase()=="script"?f.getClearString(i[0].innerHTML):i[0].outerHTML):n._storedContent[this.index]&&(n._storedContent=f._pushValue(n._storedContent,"",this.index))},_currentPage:function(n){return n._prefixClass=="e-m-"?ej.getCurrentPage():$("body")},_checkIsCheck:function(){return this.data[this.getRsc("helpers","Object").model.fieldSettings.checked]?!0:!1},_onTouchStartHandler:function(n){if(this._mouseDown={x:ej.isNullOrUndefined(n.clientX)?n.touches[0].clientX:n.clientX,y:ej.isNullOrUndefined(n.clientY)?n.touches[0].clientY:n.clientY},$(n.target.parentElement).hasClass(this._prefixClass+"disable")||$(n.currentTarget).hasClass(this._prefixClass+"disable"))return!1;ej.isDevice()||ej._preventDefaultException(n.target,this._preventDefaultException)||n.preventDefault&&n.preventDefault();ej.isWindows&&ej.isWindows()&&ej._touchStartPoints(n,this);this._currentItem=$(n.currentTarget);this._scroll=!1;ej.getBooleanVal(this._currentItem,"data-preventSelection",this.model.preventSelection)||this._addSelection();this.model.renderMode!="windows"||this.model.windows.preventSkew||this._currentItem.addClass(this._prefixClass+"m-skew-center");ej.isNullOrUndefined(n)||(this._eventtrigger=$(n.target));this.model.mouseDown&&this._triggerStartEvent(this._returnData());ej.listenEvents([this._liEl,this._liEl],[ej.endEvent(),ej.moveEvent(),ej.cancelEvent()],[this._touchEndDelegate,this._touchMoveDelegate,this._touchMoveDelegate],!1,this);$(window).on(ej.endEvent()+" MSPointerUp pointerup",this._docClickDelegate)},_onTouchMoveHandler:function(n){(ej.browserInfo().name=="msie"&&ej.browserInfo().version>8||ej.browserInfo().name!="msie")&&((ej.isNullOrUndefined(n.clientX)?n.changedTouches[0].clientX!==this._mouseDown.x:n.clientX)||(ej.isNullOrUndefined(n.clientY)?n.changedTouches[0].clientY!==this._mouseDown.y:n.clientY))&&(this._isMoved=!0,ej.isDevice()&&(!ej.isWindows||ej.isWindows&&!ej.isWindows()||ej.isWindows&&ej.isWindows()&&ej._isTouchMoved(n,this))&&(this._scroll=!0,ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)?this._prevItem&&this._prevItem[0]!=this._currentItem[0]&&this._removeSelection():this._removeSelection(),this.model.renderMode!="windows"||this.model.windows.preventSkew?!ej.getBooleanVal(this._currentItem,"data-preventselection",this.model.preventSelection)&&this._prevItem&&ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)&&this._prevItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"):ej._removeSkewClass(this._currentItem)))},_onTouchEndHandler:function(n){var u,r,t,i,f,e;if(ej.browserInfo().name=="msie"&&ej.browserInfo().version==8&&n.stopImmediatePropagation(),this._isFromAjax=!1,ej.getBooleanVal(this._currentItem,"data-persistSelection",this.model.persistSelection)||this._removeSelection(),this.model.renderMode!="windows"||this.model.windows.preventSkew||ej._removeSkewClass(this._currentItem),this._scroll)return this._setCurrent(),this._unbindEvents(n),!1;if(!this._scroll){if(this._currentItem.find("."+this._prefixClass+"lv-check").length&&(u=this._currentItem.find("."+this._prefixClass+"lv-check"),this._prefixClass!="e-"||ej.isNullOrUndefined(n)||$(n.target).closest(".e-lv-checkdiv").length||this._toggleCheckboxValue(u)),r=this._currentItem.attr("data-childheaderbackbuttontext")==undefined?this._currentItem.closest("."+this._rootCSS+"").find("."+this._prefixClass+"header").length&&!this.model.showHeaderBackButton?this._currentItem.closest("."+this._rootCSS+"").find("."+this._prefixClass+"header ."+this._prefixClass+"htitle").text():"Back":ej.getAttrVal(this._currentItem,"data-childheaderbackbuttontext"),t=this._currentItem.attr("data-href"),this._currentItem.attr("data-navigateUrl"))this._touchEndEventHandler();else{if(i=this._isInsideNavigation?this._tempContent.find("[data-ajaxurl='"+this._convertToRelativeUrl(t)+"']"):this.element.find("[data-ajaxurl='"+this._convertToRelativeUrl(t)+"']"),ej.getBooleanVal(this._currentItem,"data-loadajax",this.model.enableAjax&&typeof t!="undefined"||!typeof t)&&(!this.model.enableCache||i.length==0)){i.length&&i.remove();(this._prefixClass=="e-"&&this._currentItem.hasClass("e-arrow")||this._prefixClass!="e-")&&this.loadAjaxContent(t,r);this._unbindEvents(n);this._isInsideNavigation&&this._nearestND.model.contentId&&this._closeNavigation();return}t&&t.indexOf("#")!=-1&&this._currentPage(this).find("#"+t.replace("#","")).length&&(this._renderChild(ej.getAttrVal(this._currentItem,"data-childid","page_"+parseInt(Math.random().toFixed(3)*1e3))),f=ej.buildTag("div."+this._prefixClass+"content",this._storedContent[this._currentItem.attr("data-childid")]),this._div.append(this._container.append(f)),ej.widget.init&&ej.widget.init(this._div));this._updateContent(this._currentItem,r);this.model.ready&&this._trigger("ready");this._isInsideNavigation&&(e=this._nearestND.model.contentId?!this._currentItem.attr("data-childid")||this._currentItem.attr("data-href"):!(this._currentItem.attr("data-childid")||this._currentItem.attr("data-href")));this._isInsideNavigation&&e&&this._closeNavigation();ej.isNullOrUndefined(n)||(this._eventtrigger=$(n.target));this._touchEndEventHandler(n)}this._prevItem=this._currentItem}this._unbindEvents(n)},_hasValue:function(n,t){for(var i=0;i","g"),"").toLowerCase())):this._elementText.push("")},_onKeyUp:function(n){for(var t=0;t]*>/gmi.test(r)?r.split(/<\/?body[^>]*>/gmi)[1]:r||""),f,e;i._div.append(i._container.append(u));i._updateContent(i._currentItem,t);f=i._prefixClass=="e-m-"?App.angularAppName:!1;(f||ej.angular.defaultAppName)&&ej.angular.compile(u);e={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxSuccess&&i._trigger("ajaxSuccess",e)},errorHandler:function(t,r,u){var f={xhr:t,textStatus:r,errorThrown:u,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxError&&i._trigger("ajaxError",f)},completeHandler:function(){var t={content:i._div,item:i._currentItem,index:$(i._currentItem).index(),text:$(i._currentItem).text(),url:i.model.ajaxSettings.url?i.model.ajaxSettings.url:n};i.model.ajaxComplete&&i._trigger("ajaxComplete",t)}};ej.sendAjaxRequest(u)},selectItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&(this.setActive(n,t),this._currentItem=$(this._getElement(t).find("li."+this._prefixClass+"list")[n]),this._prevItem=this._currentItem,this._onTouchEndHandler())},setActive:function(n,t){if(n>=0){var i=this._getElement(t);this._isEnable($(i.find("li."+this._prefixClass+"list")[n]))&&ej.getBooleanVal($(i.find("li."+this._prefixClass+"list")[n]),"data-persistSelection",this.model.persistSelection)&&(i.find("li."+this._prefixClass+"list."+this._prefixClass+"state-active").removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default"),this._currentItem=$(i.find("li."+this._prefixClass+"list")[n]),this._prevItem=this._currentItem,this._currentItem.removeClass(this._prefixClass+"state-default").addClass(this._prefixClass+"state-active"))}},deActive:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).removeClass(this._prefixClass+"state-active").addClass(this._prefixClass+"state-default")},enableItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).removeClass(this._prefixClass+"disable").addClass(this._prefixClass+"state-default").find("a").removeClass(this._prefixClass+"disable").find("."+this._prefixClass+"lv-check").ejCheckBox("enable")},disableItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).addClass(this._prefixClass+"disable").removeClass(this._prefixClass+"state-default").find("a").addClass(this._prefixClass+"disable").find("."+this._prefixClass+"lv-check").ejCheckBox("disable")},removeCheckMark:function(n,t){this._removeIndex=n;var i=this._getElement(t);n>=0&&this._isEnable($(i.find("li."+this._prefixClass+"list")[n]))?$(i.find("li."+this._prefixClass+"list")[n]).find("."+this._prefixClass+"lv-checkdiv").remove():i.find("."+this._prefixClass+"lv-checkdiv").remove()},checkItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&this._setCheckboxValue($(this._getElement(t).find("."+this._prefixClass+"lv-check")[n]),!0);this._checkedValues.push(n);this.checkedIndices(this._checkedValues)},unCheckItem:function(n,t){n>=0&&this._isEnable($(this._getElement(t).find("li."+this._prefixClass+"list")[n]))&&this._setCheckboxValue($(this._getElement(t).find("."+this._prefixClass+"lv-check")[n]),!1);this._checkedValues.splice(this._checkedValues.indexOf(n),1)},checkAllItem:function(n){var t=this;this._getElement(n).find("."+this._prefixClass+"lv-check").each(function(i,r){t._isEnable($(t._getElement(n).find("li."+t._prefixClass+"list")[i]))&&t._setCheckboxValue($(r),!0)});this._checkStatevalue()},unCheckAllItem:function(n){this.model.checkedIndices=[];this._checkedValues=[];var t=this;this._getElement(n).find("."+this._prefixClass+"lv-check").each(function(i,r){t._isEnable($(t._getElement(n).find("li."+t._prefixClass+"list")[i]))&&t._setCheckboxValue($(r),!1)})},_checkStatevalue:function(){var n,t;for(this._currentItem=$(this._liEl),n=0;n=0)return $(this._getElement(t).find("li."+this._prefixClass+"list")[n]).text()},getCheckedItems:function(n){var i,t,r;if(n!=undefined)return this._getElement(n).find("input."+this._prefixClass+"lv-check:checked").closest("li."+this._prefixClass+"list");for(i=[],t=0;t=0)return this.element.find("#"+$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).attr("data-childid")).length?!0:!1},isChecked:function(n,t){if(n>=0)return $(this._getElement(t).find("li."+this._prefixClass+"list")[n]).find("input."+this._prefixClass+"lv-check").prop("checked")},showItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).css("visibility","")},hideItem:function(n,t){n>=0&&$(this._getElement(t).find("li."+this._prefixClass+"list")[n]).css("visibility","hidden")},show:function(n){this._getElement(n).css("visibility","")},hide:function(n){this._getElement(n).css("visibility","hidden")},_objectSplice:function(n,t){for(var i=0;i=0)if(this._hasDataSource()){if(typeof n=="object")for(r=0;r div > ul").append(s)),typeof n=="object"?this._objectSplice(n,t):this.model.items.splice(t,0,this._getLiAttributes(n,null,null,i)),f=this.model.items;else this._orgEle.children().append(n);if(u=this.model.enableGroupList?$(this.element.find("ul[data-ej-grouplisttitle= "+i+"]")):$(this.element.find("ul:visible")),ej.isNullOrUndefined(this.jsRender))this._renderControl(),$(this.element).find(".subpage").length>1&&$(this.element).find(".subpage:nth-child(2)").remove();else{if(typeof n=="object")for(r=0;r0&&$(e).addEleAttrs($($(n).attrNotStartsWith(/^data-ej-/)))}this._processing(u);this._liEl=this.element.find("li."+this._prefixClass+"list");this._initEJCheckBox&&(this._initEJCheckBox(u),this.model.renderTemplate&&$(this.element.find("."+this._prefixClass+"lv-check").parent()).addClass(this._prefixClass+"template-checkmark"));this._setHeightWidth();this._wireEvents()},_processing:function(n){n.find("li."+this._prefixClass+"firstitem").removeClass(this._prefixClass+"firstitem");n.find("li:first").addClass(this._prefixClass+"firstitem");n.find("li."+this._prefixClass+"lastitem").removeClass(this._prefixClass+"lastitem");n.find("li:last").addClass(this._prefixClass+"lastitem");var t=n.find("li."+this._prefixClass+"list");t.removeEleEmptyAttrs();t.find("."+this._prefixClass+"chevron-right_01").removeEleEmptyAttrs();n.find("."+this._prefixClass+"lv-check").parent().addClass(this._prefixClass+"lv-checkdiv");n.find("."+this._prefixClass+"lv-check").closest("li."+this._prefixClass+"list").addClass(this._prefixClass+"list-check");n.find("."+this._prefixClass+"lv-input").closest("."+this._prefixClass+"lv-filter").addClass(this._prefixClass+"lv-inputdiv")},removeItem:function(n,t){var r=[],i,n;n>=0&&(element=this._getElement(t),i=$(element.find("li."+this._prefixClass+"list")[n]).attr("data-childid"),this.element.find($("#"+i).length)&&this.element.find($("#"+i)).remove(),$(element.find("li."+this._prefixClass+"list")[n]).remove(),n=[parseInt(n)],this.dataSource(this.dataSource().filter(function(t,i){if(n.indexOf(i)!=-1)r.push(t);else return!0})))},clear:function(){this.element.empty().html();this._liEl=this.element.find("li."+this._prefixClass+"list")},getItemsCount:function(n){return this._getElement(n).find("li."+this._prefixClass+"list").length},getActiveItemData:function(){if(this.getActiveItem().attr("data-id"))return this._generateData(this.dataSource().length?typeof this.dataSource()=="string"?eval(this.dataSource()):this.dataSource():this.model.items,this.getActiveItem().attr("data-id"))}});ej.VirtualScrollMode={Normal:"normal",Continuous:"continuous"}}(jQuery,Syncfusion),function(n,t){function st(n,t){var s=n||"",k=p,t=t.toString(),ct=t.indexOf(".")>-1||n.indexOf(".")>-1,r=0,rt=0,i="",d="",a=n.split(","),ut="0",lt,at=n.toLowerCase().indexOf("e"),w,o,ft=s.indexOf("#"),v,st,b,l,y,nt,tt,f,u,c,e;if(n.indexOf("\\")>-1&&(d=n.substr(0,n.lastIndexOf("\\")+1),n=n.substr(n.lastIndexOf("\\")+1,n.length),ft=n.indexOf("#")),at>-1){for(v="",s="",o=n.toLowerCase().split("e"),lt=n.indexOf("+")>-1?n.split("+")[1]:n.split("-")[1],t=parseInt(t).toExponential(),w=t.split("e"),r=o[1].length-w[1].length,u=o[1].length-1;u>0;u--)o[1][u]!="0"?s+=o[1][u]:r>1?(s+="#",r--):s+="0";for(st=n.indexOf("+")>-1?"+":"",s=st+s.split("").reverse().join(""),u=0;uo[0].length&&(v=o[0]);s=d+v+"e"+s}else if(ct){if(o=n.split("."),w=t.split("."),o[1]=o[1].replace(/[,.]/g,""),r=o[0].replace(/[,.]/g,"").length-w[0].replace(/[,.]/g,"").length,r<0&&ej.isNullOrUndefined(n.match(/[\[\(\)\]]/g))){for(a=o[0].split(","),i=o[0].split(","),e=a.length-1;e>=0;e--)if(a[e])for(f=a[e].length,u=0,c=Math.abs(r);u=0;l--)f===3?(b=","+b,f=0):f++,b=i[l]+b;s=d+b+"."+o[1]}}else{if(y=0,nt=a.splice(1,a.length),r=n.replace(/[,.\[\(\]\)]/g,"").length-t.replace(/[,.]/g,"").length,ft>-1){for(tt=0,c=n.length;tt=0;e--)if(nt[e])for(f=nt[e].length,i[e]||(i[e]=""),u=0,c=Math.abs(r)+1;u0&&rt<=l?(r--,rt++):r>0?r--:g=k[h]:h=="0"&&(ht||h!="0")||(g=k[h]),h==="0"&&yt>-1&&(g=k[h]),l===s.lastIndexOf("\\")&&(ot=!1),g&&!ot)et[it]={rule:g},it+=1;else for(h==="\\"&&(h="",l===s.lastIndexOf("\\")||(ot=!0)),h=h.split(""),e=0;e=0){var s=t.lastIndexOf("\\"),l=t.slice(0,s),f=t.slice(s+1,t.length),h;f=f.replace(/[9?CANa#&]/g,"_");h=l+f;r=h.replace(/[\\]/g,"");t=t.replace(/[\\]/g,"")}else r=t.replace(/[9?CANa#&]/g,"_");return r=c(r,i),ct(n,t,r,e,i,o)}function c(n,t){var r,f,e,o,u,i;if(n.length!=0){for(r=ej.preferredCulture(t),u="",f=r.numberFormat[","],e=r.numberFormat.currency.symbol,o=r.numberFormat["."],i=0;i-1&&(ft=o.indexOf("+")>-1?o.split("+")[1]:o.split("-")[1],i=i.toExponential(),o.indexOf("-")>-1&&(i=i.replace("+","")));var p,ut,k,et,rt=p=ut=i.toString(),s=u,a=k=0,h,g="_",d,v,y,tt,ot=r.match(/[\(\[\]\)]/g);if(rt=!r.indexOf("\\")>=0?i=ut.replace(/[\(\)-]/g,""):et,l=f.length-1,nt=p.length-1,ej.isNullOrUndefined(ot))while(art.length||l<0)break}else while(l>=0){if(h=p[nt],d=f[l],h==t)break;if(h===d||h===g||h==="e"&&h===d.toLowerCase()?(h===g?g:"",v=s.substring(0,l+1),y=s.substring(l+1),h=c(h,e),s=v.substr(0,v.length-1)+h+y,l--,nt--):f[l].rule!=t?(it=p.charCodeAt(nt),w(r,it,l)?(v=s.substring(0,l+1),y=s.substring(l+1),tt=b(p,nt,l,r,u),s=v.substr(0,v.length-1)+tt+y,l--,nt--):l--):l--,k>rt.length||l<0)break}if(i)return(s.indexOf("_")-s.indexOf(",")==1||s.indexOf("_")-s.indexOf(".")==1)&&(s=s.slice(0,s.indexOf("_")-1)),n.trim(s.replace(/[_]/g,""))==""?null:s.replace(/[_]/g,"")}}function w(t,i,r){var f=p,u=!1,e=t.substr(r,1),o=String.fromCharCode(i);return n.each(f,function(n,t){e==n&&(u=o.match(new RegExp(t))?!0:!1)}),u}function b(n,t,i,r,u){var f=!1;return r.indexOf(".")>-1&&i===u.length-1&&n[t+1]>5&&(f=!0),f?(parseInt(n[t])+1).toString():n[t]}function s(n,t){return n.indexOf(t)===0}function l(n,t){return n.substr(n.length-t.length)===t}function e(n){return(n+"").replace(rt,"")}function lt(n){return isNaN(n)?NaN:Math[n<0?"ceil":"floor"](n)}function h(n,t,i){for(var r=n.length;r1?parseInt(e[1],10):0;r=e[0];e=r.split(".");r=e[0];u=e.length>1?e[1]:"";f>0?(u=h(u,f,!1),r+=u.slice(0,f),u=u.substr(f)):f<0&&(f=-f,r=h(r,f+1,!0),u=r.slice(-f,r.length)+u,r=r.slice(0,-f));p=i["."]||".";u=t>0?p+(u.length>t?u.slice(0,t):h(u,t)):"";for(var o=r.length-1,y=i[","]||",",s="";o>=0;){if(c===0||c>o)return r.slice(0,o+1)+(s.length?y+s+u:u);s=r.slice(o-c+1,o+1)+(s.length?y+s:"");o-=c;a1&&(f=parseInt(t.slice(1),10));s=t.charAt(0).toUpperCase();switch(s){case"D":o="n";u=lt(u);f!==-1&&(u=h(""+u,f,!0));n<0&&(u=-u);break;case"N":r=e;r.pattern=r.pattern||["-n"];case"C":r=r||e.currency;r.pattern=r.pattern||["-$n","$n"];case"P":r=r||e.percent;r.pattern=r.pattern||["-n %","n %"];o=n<0?r.pattern[0]||"-n":r.pattern[1]||"n";f===-1&&(f=r.decimals);u=at(u*(s==="P"?100:1),f,r);break;default:return ht(n,t,i)}return yt(u,o,e)}function yt(n,t,i){for(var f=/n|\$|-|%/g,r="",e,u;;){if(e=f.lastIndex,u=f.exec(t),r+=t.slice(e,u?u.index:t.length),!u)break;switch(u[0]){case"n":r+=n;break;case"$":r+=i.currency.symbol||"$";break;case"-":/[1-9]/.test(n)&&(r+=i["-"]||"-");break;case"%":r+=i.percent.symbol||"%"}}return r}function k(n,t,i){var p,s,u,f,w,d,b,k,g,h,nt;typeof i=="string"&&(t=i,i=10);t=ej.globalize.findCulture(t);var c=NaN,o=t.numberFormat,y=t.numberFormat.pattern[0];if(n=n.replace(/ /g,""),n.indexOf(t.numberFormat.currency.symbol)>-1?(n=n.replace(t.numberFormat.currency.symbol||"$",""),n=n.replace(t.numberFormat.currency["."]||".",t.numberFormat["."]||"."),y=e(t.numberFormat.currency.pattern[0].replace("$",""))):n.indexOf(t.numberFormat.percent.symbol)>-1&&(n=n.replace(t.numberFormat.percent.symbol||"%",""),n=n.replace(t.numberFormat.percent["."]||".",t.numberFormat["."]||"."),y=e(t.numberFormat.percent.pattern[0].replace("%",""))),n=e(n),ut.test(n))c=parseFloat(n,"",i);else if(ft.test(n))c=parseInt(n,16);else{var l=a(n,o,y),v=l[0],r=l[1];v===""&&o.pattern[0]!=="-n"&&(l=a(n,o,"-n"),v=l[0],r=l[1]);v=v||"+";u=-1;et.test(r)&&(u=r.indexOf("e"),u<0&&(u=r.indexOf("E")));u<0?(s=r,p=null):(s=r.substr(0,u),p=r.substr(u+1));d=o["."]||".";b=s.indexOf(d);b<0?(f=s,w=null):(f=s.substr(0,b),w=s.substr(b+d.length));k=o[","]||",";f=f.split(k).join("");g=k.replace(/\u00A0/g," ");k!==g&&(f=f.split(g).join(""));h=v+f;w!==null&&(h+="."+w);p!==null&&(nt=a(p,o,y),h+="e"+(nt[0]||"+")+nt[1]);!i&&ot.test(h)?c=parseFloat(h):i&&(c=parseInt(h,i))}return c}function r(n,t,i){return ni}function pt(n,t){var u=new Date,i,r;return t<100&&(i=n.twoDigitYearMax,i=typeof i=="string"?(new Date).getFullYear()%100+parseInt(i,10):i,r=u.getFullYear(),t+=r-r%100,t>i&&(t-=100)),t}function o(n,t){if(n.indexOf)return n.indexOf(t);for(var i=0,r=n.length;i0&&(u-=1),i},l=function(t){var r=new RegExp("^\\d{1,"+t+"}"),i=n.substr(f,t).match(r);return i?(i=i[0],f+=i.length,parseInt(i,10)):null},a=function(t,i){for(var r=0,s=t.length,e,o,u;r0&&(k-=1),t},y=function(t){var r=numRegExp[t]||new RegExp("^\\d{1,"+t+"}"),i=n.substr(a,t).match(r);return i?(i=i[0],a+=i.length,parseInt(i,10)):null},rt=function(t,i){for(var r=0,o=t.length,f,e,u;rut&&(o-=100))}else if(s==="h"){if(c("h"),e=y(2),e==12&&(e=0),e===null||u(e,0,11))return null}else if(s==="H"){if(c("H"),e=y(2),e===null||u(e,0,23))return null}else if(s==="m"){if(c("m"),b=y(2),b===null||u(b,0,59))return null}else if(s==="s"){if(c("s"),d=y(2),d===null||u(d,0,59))return null}else if(s==="f"){if(f=c("f"),w=y(f),w!==null&&f>3&&(w=parseInt(w.toString().substring(0,3),10)),w===null||u(w,0,999))return null}else if(s==="t"){if(f=c("t"),ft=h.AM,et=h.PM,f===1&&(ft=mapDesignators(ft),et=mapDesignators(et)),lt=rt(et),!lt&&!rt(ft))return null}else if(s==="z"){if(at=!0,f=c("z"),n.substr(a,1)==="Z"){if(!yt)return null;g();continue}if((v=n.substr(a,6).match(f>2?longTimeZoneRegExp:shortTimeZoneRegExp),!v)||(v=v[0],a=v.length,v=v.split(":"),ot=parseInt(v[0],10),u(ot,-12,13))||f>2&&(it=parseInt(v[1],10),isNaN(it)||u(it,0,59)))return null}else if(s==="T")yt=g();else if(s==="'")st=!0,g();else if(!g())return null;return(pt=e!==null||b!==null||d||null,o===null&&p===null&&l===null&&pt?(o=tt,p=ht.getMonth(),l=ht.getDate()):(o===null&&(o=tt),l===null&&(l=1)),lt&&e<12&&(e+=12),at?(ot&&(e+=-ot),it&&(b+=-it),n=new Date(Date.UTC(o,p,l,e,b,d,w))):(n=new Date(o,p,l,e,b,d,w),ni(n,e)),o<100&&n.setFullYear(o),n.getDate()!==l&&at===t)?null:n}function u(n,t,i){return!(n>=t&&n<=i)}function ni(n,t){t||n.getHours()!==23||n.setHours(n.getHours()+2)}function tt(n,t,r){function o(n,t){var i,r=n+"";return t>1&&r.length":"",C:"[A-Za-z ]","?":"[A-Za-z]"};i={DAY_OF_WEEK_THREE_LETTER:"ddd",DAY_OF_WEEK_FULL_NAME:"dddd",DAY_OF_MONTH_SINGLE_DIGIT:"d",DAY_OF_MONTH_DOUBLE_DIGIT:"dd",MONTH_THREE_LETTER:"MMM",MONTH_FULL_NAME:"MMMM",MONTH_SINGLE_DIGIT:"M",MONTH_DOUBLE_DIGIT:"MM",YEAR_SINGLE_DIGIT:"y",YEAR_DOUBLE_DIGIT:"yy",YEAR_FULL:"yyyy",HOURS_SINGLE_DIGIT_12_HOUR_CLOCK:"h",HOURS_DOUBLE_DIGIT_12_HOUR_CLOCK:"hh",HOURS_SINGLE_DIGIT_24_HOUR_CLOCK:"H",HOURS_DOUBLE_DIGIT_24_HOUR_CLOCK:"HH",MINUTES_SINGLE_DIGIT:"m",MINUTES_DOUBLE_DIGIT:"mm",SECONDS_SINGLE_DIGIT:"s",SECONDS_DOUBLE_DIGIT:"ss",MERIDIAN_INDICATOR_SINGLE:"t",MERIDIAN_INDICATOR_FULL:"tt",DECISECONDS:"f",CENTISECONDS:"ff",MILLISECONDS:"fff",TIME_ZONE_OFFSET_SINGLE_DIGIT:"z",TIME_ZONE_OFFSET_DOUBLE_DIGIT:"zz",TIME_ZONE_OFFSET_FULL:"zzz",DATE_SEPARATOR:"/"};ej.globalize._getDateParseRegExp=function(n,t){var e=n._parseRegExp,s,p,o,w,r,b,k;if(e){if(s=e[t],s)return s}else n._parseRegExp=e={};for(var h=d(n,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),u=["^"],l=[],c=0,a=0,v=/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g,f;(f=v.exec(h))!==null;){if(p=h.slice(c,f.index),c=v.lastIndex,a+=y(p,u),a%2){u.push(f[0]);continue}o=f[0];w=o.length;switch(o){case i.DAY_OF_WEEK_THREE_LETTER:case i.DAY_OF_WEEK_FULL_NAME:case i.MONTH_FULL_NAME:case i.MONTH_THREE_LETTER:r="(\\D+)";break;case i.MERIDIAN_INDICATOR_FULL:case i.MERIDIAN_INDICATOR_SINGLE:r="(\\D*)";break;case i.YEAR_FULL:case i.MILLISECONDS:case i.CENTISECONDS:case i.DECISECONDS:r="(\\d{"+w+"})";break;case i.DAY_OF_MONTH_DOUBLE_DIGIT:case i.DAY_OF_MONTH_SINGLE_DIGIT:case i.MONTH_DOUBLE_DIGIT:case i.MONTH_SINGLE_DIGIT:case i.YEAR_DOUBLE_DIGIT:case i.YEAR_SINGLE_DIGIT:case i.HOURS_DOUBLE_DIGIT_24_HOUR_CLOCK:case i.HOURS_SINGLE_DIGIT_24_HOUR_CLOCK:case i.HOURS_DOUBLE_DIGIT_12_HOUR_CLOCK:case i.HOURS_SINGLE_DIGIT_12_HOUR_CLOCK:case i.MINUTES_DOUBLE_DIGIT:case i.MINUTES_SINGLE_DIGIT:case i.SECONDS_DOUBLE_DIGIT:case i.SECONDS_SINGLE_DIGIT:r="(\\d\\d?)";break;case i.TIME_ZONE_OFFSET_FULL:r="([+-]?\\d\\d?:\\d{2})";break;case i.TIME_ZONE_OFFSET_DOUBLE_DIGIT:case i.TIME_ZONE_OFFSET_SINGLE_DIGIT:r="([+-]?\\d\\d?)";break;case i.DATE_SEPARATOR:r="(\\"+n["/"]+")";break;default:throw"Invalid date format pattern '"+o+"'.";}r&&u.push(r);l.push(f[0])}return y(h.slice(c),u),u.push("$"),b=u.join("").replace(/\s+/g,"\\s+"),k={regExp:b,groups:l},e[t]=k};ej.globalize.addCulture=function(t,i){ej.cultures[t]=n.extend(!0,n.extend(!0,{},ej.cultures["default"],i),ej.cultures[t]);ej.cultures[t].calendar=ej.cultures[t].calendars.standard};ej.globalize.preferredCulture=function(n){return n=typeof n!="undefined"&&typeof n==typeof this.cultureObject?n.name:n,this.cultureObject=ej.globalize.findCulture(n),this.cultureObject};ej.globalize.setCulture=function(n){return ej.isNullOrUndefined(this.globalCultureObject)&&(this.globalCultureObject=ej.globalize.findCulture(n)),n=typeof n!="undefined"&&typeof n==typeof this.globalCultureObject?n.name:n,n&&(this.globalCultureObject=ej.globalize.findCulture(n)),ej.cultures.current=this.globalCultureObject,this.globalCultureObject};ej.globalize.culture=function(n){ej.cultures.current=ej.globalize.findCulture(n)};ej.globalize.findCulture=function(t){var f,i,e,u,r,o;if(t){if(n.isPlainObject(t)&&t.numberFormat&&(f=t),typeof t=="string"){if(i=ej.cultures,i[t])return i[t];if(t.indexOf("-")>-1){if(e=t.split("-")[0],i[e])return i[e]}else for(u=n.map(i,function(n){return n}),r=0;r0&&((this.targetElement.css("position")=="relative"||this.targetElement.css("position")=="absolute")&&this.targetElement[0]===n(this.model.appendTo)[0]?i={left:0,top:0}:(i.left-=this.targetElement.offsetParent().offset().left,i.top-=this.targetElement.offsetParent().offset().top));this.maindiv.css({position:"absolute",left:Math.ceil(i.left)+"px",top:Math.ceil(i.top)+"px","z-index":this._maxZindex()+1})},_setContentPosition:function(){if(this.model.template==null){var t=0,r=0,i,n=null;i=this.targetElement.outerHeight();this.popupText&&(t=this.popupText.outerHeight());this.popupImage&&(r=this.popupImage.outerHeight());this.popupImage&&(n=Math.ceil((i-(r+t))/2),this.popupImage.css("top",n+"px"));this.popupText&&(n||(n=Math.ceil((i-t)/2)),this.popupText.css("top",n+"px"))}else this.templateObj.css({position:"relative",left:Math.ceil((this.targetElement.outerWidth()-this.templateObj.outerWidth())/2),top:Math.ceil((this.targetElement.outerHeight()-this.templateObj.outerHeight())/2)})},_generateTextTag:function(n){this.popupText=t.buildTag("div.e-text",n);this.maindiv.append(this.popupText)},_setVisibility:function(n){n&&this._isTargetVisible()?this.show():this.hide()},_maxZindex:function(){return t.util.getZindexPartial(this.element)}})}(jQuery,Syncfusion),function(n,t){t.widget("ejButton","ej.Button",{element:null,model:null,validTags:["button","input"],_setFirst:!1,_rootCSS:"e-button",_requiresID:!0,defaults:{size:"normal",type:"submit",height:"",width:"",enabled:!0,htmlAttributes:{},text:null,contentType:"textonly",imagePosition:"imageleft",showRoundedCorner:!1,cssClass:"",prefixIcon:null,suffixIcon:null,enableRTL:!1,repeatButton:!1,timeInterval:"150",create:null,click:null,destroy:null},dataTypes:{size:"enum",enabled:"boolean",type:"enum",showRoundedCorner:"boolean",text:"string",contentType:"enum",imagePosition:"enum",prefixIcon:"string",suffixIcon:"string",cssClass:"string",repeatButton:"boolean",enableRTL:"boolean",timeInterval:"string",htmlAttributes:"data"},disable:function(){this.element.addClass("e-disable").attr("aria-disabled",!0);this.model.enabled=!1},enable:function(){this.element.removeClass("e-disable").attr("aria-disabled",!1);this.model.enabled=!0},_init:function(){this._cloneElement=this.element.clone();this._initialize();this._render();this._controlStatus(this.model.enabled);this._wireEvents(this.model.repeatButton);this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.element.addClass(n):i.element.attr(t,n);t=="disabled"&&n=="disabled"&&i.disable()})},_destroy:function(){this._off(this.element,"blur",this._btnBlur);this.element.removeClass(this.model.cssClass+"e-ntouch e-btn e-txt e-select e-disable e-corner e-widget").removeAttr("role aria-describedby aria-disabled");!this._cloneElement.attr("type")&&this.element.attr("type")&&this.element.removeAttr("type");this.element.removeClass("e-btn-"+this.model.size);this.model.contentType&&this.model.contentType!="textonly"?this.element.append(this._cloneElement.text())&&this.imgtxtwrap[0].remove():""},_setModel:function(n){for(var t in n)switch(t){case"size":this._setSize(n[t]);break;case"height":this._setHeight(n[t]);break;case"width":this._setWidth(n[t]);break;case"contentType":this._setContentType(n[t]);break;case"imagePosition":this._setImagePosition(n[t]);break;case"text":this._setText(n[t]);break;case"prefixIcon":this.element.is("input")||this._setMajorIcon(n[t]);break;case"suffixIcon":this.element.is("input")||this._setMinorIcon(n[t]);break;case"enabled":this._controlStatus(n[t]);break;case"showRoundedCorner":this._roundedCorner(n[t]);break;case"cssClass":this._setSkin(n[t]);break;case"enableRTL":this._setRTL(n[t]);break;case"timeInterval":this.model.timeInterval=n[t];break;case"htmlAttributes":this._addAttr(n[t])}},_setSize:function(n){this.element.removeClass("e-btn-mini e-btn-medium e-btn-small e-btn-large e-btn-normal");this.element.addClass("e-btn-"+n)},_setType:function(n){this.element.prop({type:n})},_setHeight:function(n){this.element.css("height",n)},_setWidth:function(n){this.element.css("width",n)},_setText:function(n){this.buttonType=="inputButton"?this.element.val(n):this.model.contentType==t.ContentType.TextOnly?this.element.html(n):this.textspan.html(n);this.model.text=n},_setMajorIcon:function(n){this.majorimgtag.removeClass(this.model.prefixIcon);this.majorimgtag.addClass(n);this.model.prefixIcon=n},_setMinorIcon:function(n){this.minorimgtag.removeClass(this.model.suffixIcon);this.minorimgtag.addClass(n);this.model.suffixIcon=n},_setContentType:function(n){n!=this.model.contentType&&(this.element.empty(),this.model.contentType=n,this.element.is("input")||this._renderButtonNormal())},_setImagePosition:function(n){this.model.contentType==t.ContentType.TextAndImage&&n!=this.model.imagePosition&&(this.element.empty(),this.model.imagePosition=n,this.element.is("input")||this._renderButtonNormal())},_setRTL:function(n){n?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_controlStatus:function(n){n?this.enable():this.disable()},_setSkin:function(n){this.model.cssClass!=n&&(this.element.removeClass(this.model.cssClass),this.element.addClass(n))},_initialize:function(){t.isTouchDevice()||this.element.addClass("e-ntouch");this.element.is("input")?this.buttonType="inputButton":this.element.is("a")||this.element.is("button")?this.buttonType="tagButton":this.element.removeClass("e-button");this.element.attr("type")?this.model.type=this.element.attr("type"):this._setType(this.model.type);this._timeout=null},_render:function(){this._setSize(this.model.size);this._setHeight(this.model.height);this._setWidth(this.model.width);this._setRTL(this.model.enableRTL);this.element.addClass(this.model.cssClass+" e-btn e-select e-widget").attr("role","button");this.buttonType=="inputButton"?(this.element.addClass("e-txt"),this.model.text!=null&&this.model.text!=""?this.element.val(this.model.text):this.model.text=this.element.val()):this._renderButtonNormal();this._roundedCorner(this.model.showRoundedCorner);this.element[0].id&&this.element.attr("aria-describedby",this.element[0].id)},_renderButtonNormal:function(){if((this.model.text==null||this.model.text=="")&&(this.model.text=this.element.html()),this.element.empty(),this.textspan=t.buildTag("span.e-btntxt",this.model.text),this.model.contentType.indexOf("image")>-1&&(this.majorimgtag=t.buildTag("span").addClass(this.model.prefixIcon),this.minorimgtag=t.buildTag("span").addClass(this.model.suffixIcon),this.imgtxtwrap=t.buildTag("span").addClass("e-btn-span")),this.model.contentType==t.ContentType.TextAndImage){switch(this.model.imagePosition){case t.ImagePosition.ImageRight:this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageLeft:this.imgtxtwrap.append(this.majorimgtag,this.textspan);break;case t.ImagePosition.ImageBottom:this.majorimgtag.attr("style","display:inherit");this.imgtxtwrap.append(this.textspan,this.majorimgtag);break;case t.ImagePosition.ImageTop:this.majorimgtag.attr("style","display:inherit");this.imgtxtwrap.append(this.majorimgtag,this.textspan)}this.element.append(this.imgtxtwrap)}else this.model.contentType==t.ContentType.ImageTextImage?(this.imgtxtwrap.append(this.majorimgtag,this.textspan,this.minorimgtag),this.element.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageBoth?(this.imgtxtwrap.append(this.majorimgtag,this.minorimgtag),this.element.append(this.imgtxtwrap)):this.model.contentType==t.ContentType.ImageOnly?(this.imgtxtwrap.append(this.majorimgtag),this.element.append(this.imgtxtwrap)):(this.element.addClass("e-txt"),this.element.html(this.model.text))},_roundedCorner:function(n){n==!0?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},_wireEvents:function(t){t&&(this._on(this.element,"mousedown",this._btnRepatMouseClickEvent),this._on(n(document),"mouseup",this._mouseUpClick),this._on(this.element,"keyup",this._btnRepatKeyUpEvent),this._on(n(document),"keypress",this._btnRepatKeyDownEvent));this._on(this.element,"click",this._btnMouseClickEvent);this._on(this.element,"blur",this._btnBlur)},_btnBlur:function(){this.element.removeClass("e-animate")},_btnMouseClickEvent:function(n){var t=this,i;if(this.element.addClass("e-animate"),!t.model.enabled)return!1;t.element.hasClass("e-disable")||(i={target:n.currentTarget,e:n,status:t.model.enabled},t._trigger("_click",i),t._trigger("click",i))},_btnRepatMouseClickEvent:function(n){var t=this,i;if(!t.model.enabled)return!1;t.element.hasClass("e-disable")||(i={status:t.model.enabled},(n.button==0||n.which==1)&&(t._timeout=setInterval(function(){t._trigger("click",{target:n.currentTarget,status:t.model.enabled})},this.model.timeInterval)))},_mouseUpClick:function(){clearTimeout(this._timeout)},_btnRepatKeyDownEvent:function(n){var t=this,i;t.element.hasClass("e-disable")||(i={status:t.model.enabled},(n.keyCode==32||n.keyCode==13)&&t._trigger("click",i))},_btnRepatKeyUpEvent:function(n){(n.keyCode==32||n.keyCode==13)&&clearTimeout(this._timeout)}});t.ContentType={TextOnly:"textonly",ImageOnly:"imageonly",ImageBoth:"imageboth",TextAndImage:"textandimage",ImageTextImage:"imagetextimage"};t.ImagePosition={ImageRight:"imageright",ImageLeft:"imageleft",ImageTop:"imagetop",ImageBottom:"imagebottom"};t.ButtonSize={Normal:"normal",Mini:"mini",Small:"small",Medium:"medium",Large:"large"};t.ButtonType={Button:"button",Reset:"reset",Submit:"submit"}}(jQuery,Syncfusion),function($,ej,undefined){return window.__calcQuickextends=function(n,t){function r(){this.constructor=n}for(var i=0;i=";this._validFunctionNameChars="_";this.bMARKER=String.fromCharCode(146);this.bMARKER2=this.bMARKER+this.bMARKER;this.tic='"';this._parseDecimalSeparator=".";this.parseDateTimeSeparator="/";this._parseArgumentSeparator=",";this._rightBracket=String.fromCharCode(131);this._leftBracket=String.fromCharCode(130);this.iFMarker="qIF"+String.fromCharCode(130);this.braceLeft="{";this.braceRight="}";this._braceRightNLeft=")(";this.computedValueLevel=0;this._circCheckList=[];this._maximumRecursiveCalls=100;this._sortedSheetNames=null;this.trueValueStr="TRUE";this.falseValueStr="FALSE";this.useDatesInCalcs=!1;this.sheetToken="!";this.namedRanges=null;this.undefinednamedRange=null;this.undefinedsheetNamedRnages=null;this.namerangecellcollection=null;this.sheetNamedRangesOriginalNames=null;this.sheetNamedRangeCellCollection=null;this.sheetDependentNamedRangeCells=null;this.namedRangesOriginalNames=null;this.namedRangeValues=null;this.rangeValues=null;this.dependentNamedRangeCells=null;this.namedRangesSized=null;this._namedRangesNonScoped=null;this.char_add="+";this.char_and="i";this.char_ANDop=String.fromCharCode(140);this.char_divide="/";this.char_ELSEop=String.fromCharCode(144);this.char_EM="r";this.char_EP="x";this.char_equal="=";this.char_greater=">";this.char_greatereq="h";this.char_IFop=String.fromCharCode(142);this.char_less="<";this.char_lesseq="f";this.char_multiply="*";this.char_noequal="p";this.char_NOTop=String.fromCharCode(145);this.char_or="w";this.char_ORop=String.fromCharCode(139);this.char_subtract="-";this.char_THENop=String.fromCharCode(143);this.char_XORop=String.fromCharCode(141);this.chartic="'"[0];this._string_and="&";this._string_E="E";this._string_EM="E-";this._string_empty="";this._string_EP="E+";this._string_fixedreference="$";this._string_greatereq=">=";this._string_lesseq="<=";this._string_noequal="<>";this._string_or="^";this.token_add="a";this.token_and="c";this.token_ANDop=String.fromCharCode(133);this.token_divide="d";this.token_ELSEop=String.fromCharCode(137);this.token_EM="v";this.token_EP="t";this.token_equal="e";this.token_greater="g";this.token_greatereq="j";this.token_IFop=String.fromCharCode(135);this.token_less="l";this.token_lesseq="k";this.token_multiply="m";this.token_noequal="o";this.token_NOTop=String.fromCharCode(138);this.token_or=String.fromCharCode(126);this.token_ORop=String.fromCharCode(132);this.token_subtract="s";this.token_THENop=String.fromCharCode(136);this.token_XORop=String.fromCharCode(134);this.tokens=[this.token_add,this.token_subtract,this.token_multiply,this.token_divide,this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal,this.token_and,this.token_or];this._dateTime1900=new Date(1900,0,1,0,0,0);this._preserveLeadingZeros=!1;this._ignoreCellValue=!1;this._errorStrings=null;this.cell="";this._iterationMaxCount=0;this._supportRangeOperands=!1;this._allowShortCircuitIFs=!1;this._processUpperCaseFormula="";this._processUpperCaseIvalue=0;this._processUpperCaseSheet="";this._markerChar="`";this._rowMaxCount=-1;this._columnMaxCount=-1;this._isInteriorFunction=!1;this._tempSheetPlaceHolder=String.fromCharCode(133);this.sheetFamilyID=0;this._supportsSheetRanges=!0;this._markers="()+-*/=><.,!";this._formulaInfoTable=null;this._dependentFormulaCells=null;this._dependentCells=new HashTable;this._calculatingSuspended=!1;this._inAPull=!1;this._useDatesInCalcs=!1;this._excelLikeComputations=!1;this._rethrowLibraryComputationExceptions=!1;this.formulaErrorStrings=["binary operators cannot start an expression","cannot parse","bad library","invalid char in front of","number contains 2 decimal points","expression cannot end with an operator","invalid characters following an operator","invalid character in number","mismatched parentheses","unknown formula name","requires a single argument","requires 3 arguments","invalid Math argument","requires 2 arguments","#NAME?","too complex","circular reference: ","missing formula","improper formula","invalid expression","cell empty","bad formula","empty expression","","mismatched string quotes","wrong number of arguments","invalid arguments","iterations do not converge","Control named '{0}' is already registered","Calculation overflow","Missing sheet"];this._parseDateTimeSeparator="/";this._millisecondsOfaDay=864e5;this.treat1900AsLeapYear=!1;this._oaDate=new Date(1899,11,30);this._saveStringsText="";this._processedCells=[];this.ignoreValueChanged=!1;this._breakedFormulaCells=[];this._tempBreakedFormulaCells=[];this._lockDependencies=!1;this._useDependencies=!1;this._inHandleIterations=!1;this._inRecalculateRange=!1;this._useNoAmpersandQuotes=!1;this._calcID=0;this._operators_cannot_start_an_expression=0;this._reservedWord_AND=1;this._reservedWord_XOR=2;this._reservedWord_IF=3;this._number_contains_2_decimal_points=4;this._reservedWord_ELSE=5;this._reservedWord_NOT=6;this._invalid_char_in_number=7;this._invalid_characters_following_an_operator=6;this._mismatched_parentheses=8;this._unknown_formula_name=9;this._requires_a_single_argument=10;this._requires_3_args=11;this._invalid_Math_argument=12;this._requires_2_args=13;this._bad_index=14;this._too_complex=15;this._circular_reference_=16;this._missing_formula=17;this._improper_formula=18;this._invalid_expression=19;this._cell_empty=20;this._bad_formula=21;this._empty_expression=22;this._virtual_mode_required=23;this._mismatched_tics=24;this._wrong_number_arguments=25;this._invalid_arguments=26;this._iterations_dont_converge=27;this._calculation_overflow=29;this._already_registered=28;this._missing_sheet=30;this._alwaysComputeDuringRefresh=!0;this._libraryComputationException=null;this._dependencyLevel=0;this._isDisposed=undefined;this._forceRefreshCall=!1;this.grid=this.parentObject;this._enableLookupTableCaching=0;this._lookupTables=new HashTable;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1;this._acc=4;this._bingo=1e10;this._bigni=1e-10;this.machineepsilon=5e-16;this.maxrealnumber=1e300;this.minrealnumber=1e-300;this.nativeFormats=[];this.nativeFormats.push("[DBNUM1]");this.nativeFormats.push("[DBNUM2]");this.nativeFormats.push("[DBNUM3]");this.nativeFormats.push("[DBNUM4]");this.computeFunctionLevel=0;this._table_Data="[#Data]";this._table_Row="[#THIS ROW]";this._table_Headers="[#Headers]";this._table_Totals="[#Totals]";this._table_All="[#All]";this._isArrayFormula=!1;this._getPositionHeight=0;this._getPositionWidth=0;this._calculateArraySizeheight=0;this._calculateArraySizewidth=0;this._calculateArraySizeminHeight=0;this._calculateArraySizeminWidth=0;this._length=0;this._arrayMarkers="+-*/&";this._validFunctionNameChars="_";this._findNamedRange=!1;this._addFunction=function(n,t){return(n=n.toUpperCase(),this._libraryFunctions.getItem(n)==undefined)?(this._libraryFunctions.add(n,t),!0):!1};this._addToFormulaDependentCells=function(n){var t=this.cell,i=CalcEngine.getSheetFamilyItem(this.grid),r;i.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(r=i.parentObjectToToken.getItem(this.grid),t=r+t);this.getDependentFormulaCells().containsKey(t)?this.getDependentFormulaCells().getItem(t).containsKey(n)||this.getDependentFormulaCells().getItem(t).add(n,n):(this.getDependentFormulaCells().add(t,new HashTable),this.getDependentFormulaCells().getItem(t).add(n,n))};this._arrayRemove=function(n,t){for(var i=null;(i=n.indexOf(t))!==-1;)n.splice(i,1);return n};this._canGetRowIndex=function(n){var t=0;if(t-1&&(t=n.substring(i+1),this._namedRangesNonScoped.containsKey(t)||this._namedRangesNonScoped.add(t,this.namedRanges.getItem(n)))};this._checkHasCharBeforeNumber=function(n){for(var i=!1,t=n.length-1;t>0;t--)if(this._isLetter(n[t])){i=!0;break}return i};this._checkIfScopedRange=function(n,t){var u,o,c,f,i,s;t="";var e="NaN",h=this.getSheetID(this.grid),r=CalcEngine.getSheetFamilyItem(this.grid);if(n[0]==this.sheetToken.toString()&&(u=n.indexOf(this.sheetToken,1),o=parseInt(n.substr(1,u-1)),u>1&&!isNaN(o)&&(n=n.substring(u+1),h=o)),c="!"+h.toString()+"!",r==null||r.sheetNameToToken==null)return e;for(f=r.sheetNameToToken.keys(),i=0;ithis._absoluteZero?Math.abs((n-t)/t)1;)e=i.pop().toString(),r=e==this.tic+this.tic?r+this.tic:e+r,u=f==3?e:u,f--;i[0]==this.tic+this.tic&&i.pop();r=n.length==t&&this._isTextEmpty(u.split(this.tic).join(""))?r+u:r;i.push(r)}return i};this._computeMath=function(n,t){var u=0,r,l=!1,a,i,f,e,s,y,h,c,o;if(n.length>0&&(n=this.splitArgsPreservingQuotedCommas(n)[0]),a=[this.getParseArgumentSeparator(),":"],n.length>0&&(!this._isLetter(n[0])&&n[0]!=this.sheetToken&&n[0]!=this.bMARKER||n[0]=="u"&&this._isDigit(n[1]))&&this._indexOfAny(n,a)==-1){if(n=n.split("u").join("-").split("n").join(""),i=this._parseDouble(n),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}else if(n.length>0&&(n[0]==this.bMARKER||n[0]=="u"||n[0]=="n"||this._indexOfAny(n,this.tokens)>-1)){n=n.split("{").join("(");n=n.split("}").join(")");f="";e=Math.PI.toString();try{n.indexOf(e)>-1?(r=this._substring(n,1,n.indexOf(e)-2),r=this._isTextEmpty(r)?"1":r,f=this._indexOfAny(n,this.tokens)>-1?n.split(e.toString())[1]:"1",l=!0):r=this.computedValue(n)}catch(v){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(l)if(s=this.computedValue(r.toString()),f.indexOf("180")>-1)if(i=this._parseDouble(s),i)u=t(i*(Math.PI/180));else return this.getErrorStrings()[1].toString();else{if(y=this.computedValue(s+f),h=this._parseDouble(y),isNaN(h))return this.getErrorStrings()[1].toString();u=t(h*Math.PI)}else{if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}}else for(n=n.split("u").join("-"),c=this.getCellsFromArgs(n),o=0;o0){if(i=this._parseDouble(r),isNaN(i))return this.getErrorStrings()[1].toString();u=t(i)}break}return this.computeIsErr(u.toString())==this.trueValueStr?this.getErrorStrings()[4].toString():u.toString()};this._computeInteriorFunctions=function(n){var i,f,t,s,e,h,o,c,u;try{if(this._isTextEmpty(n))return n;for(this.computeFunctionLevel++,i=this._findLastqNotInBrackets(n);i>0;){if(f=n.substring(i).indexOf(this._rightBracket),f==-1)throw this.formulaErrorStrings[this._bad_formula];if(this._isInteriorFunction=!0,t=this._substring(n,i,f+1),t=this.computedValue(t),ej.isNullOrUndefined(this.parentObject)||this.parentObject.pluginName!="ejSpreadsheet")t==""||t[0]!=this.tic[0]||t[t.length-1]!=this.tic[0]||(u=this._substring(t,1,t.length-2),u.indexOf(this.tic)!=-1&&(this._multiTick=!0,u=u.split(this.tic).join("|")),t=this.tic+u+this.tic),this._isInteriorFunction||(t=this._markupResultToIncludeInFormula(t));else if(t[0]=="-")t="nu"+t.substring(1);else if(t.length>0&&(t[0]==this.tic[0]||t[0]=="#"))t.length>1&&t[0]==this.bmarker&&t[1]==this.bmarker&&(t=this.tic+t+this.tic);else if(!t.startsWith(this.trueValueStr)&&!t.startsWith(this.falseValueStr))if(s=this._parseDouble(t),isNaN(s))if(this._isRange(t)||t[0]!=this.braceLeft||t[t.length-1]!=this.braceRight)this._isRange(t)||(t=this.tic+t+this.tic);else{for(t=t.Replace("{","").Replace("}",""),e=string.Empty,h=this.splitArgsPreservingQuotedCommas(t),o=0;o0?"{"+r+"}":r};this._parseLibraryFormula=function(n){var u,e,r,s,t,i,f,o;if(n.length>0&&(n=n.substr(1,n.length-2)),u=n,n=this._checkForNamedRange(n),n[0]=="{"&&n[n.length-1]=="}"||this._findNamedRange)return this._parseDimensionalArray(n);if(e=this._saveStrings(n),n=this._saveStringsText,n=n.split(" ").join(this._string_empty).split("{").join('"[').split("}").join(']"'),r=n.indexOf(")"),r==-1)n=this._parseArrayFormula(n,u);else while(r>-1){for(s=0,t=r-1;t>-1&&(n[t]!="("||s!=0);)n[t]==")"&&s++,t--;if(t==-1)return this.getErrorStrings()[0].toString();for(i=t-1;i>-1&&(this._isLetterOrDigit(n[i])||this._validFunctionNameChars.indexOf(n[i])>-1||n[i]==this._parseDecimalSeparator);)i--;f=t-i-1;f>0&&this.getLibraryFunctions().getItem(n.substr(i+1,f).toUpperCase())!=null?(o=n.substr(t,r-t+1),o=this._parseArrayFormula(o,u),n=n.substr(0,i+1)+n.substr(i+1,f)+o.split("(").join("{").split(")").join("}")+n.substr(r+1)):n=f==0?this._parseArrayFormula(n,u).split("(").join("{").split(")").join("}"):n.split("(").join("{").split(")").join("}");r=n.indexOf(")")}return e!=null&&e.length>0&&(n=this._setStrings(n,e)),n=n.split("{").join("(").split("}").join(")"),this._isMultiCellArray(u)&&(n=this._parseMultiCellArray(n,u)),n};this._parseArrayFormula=function(n,t){var u=n,c=this._string_empty,w=this._string_empty,i=null,p,v,r,y,o,h,f;if(this._indexOfAny(n,this._arrayMarkers)<0)return n;if(u.indexOf(this._parseArgumentSeparator.toString())>-1){for(u=u.split("{").join('"{').split("}").join('}"'),i=this.splitArgsPreservingQuotedCommas(u),r=0;r-1&&i[r].indexOf('"')==-1&&(u=i[r],c=u);if(c==this._string_empty&&(i.length!=1&&this._indexOfAny(i[0],this._arrayMarkers)<0||i[0].indexOf('"{')>-1&&i[0].indexOf('}"')>-1))return n}u=u.split("(").join(this._string_empty).split(")").join(this._string_empty);u=u.split('"').join(this._string_empty);var s=this._resizeCellRange(u,t),l=[],a=this._string_empty,e=this._string_empty;for(length==0&&(length=s[0].length),p=s.length,v=0,r=0;r1)for(f=0;f-1&&t.indexOf(")")==-1||t.indexOf("(")==-1&&t.indexOf(")")>-1){i=!1;break}(this._isRange(t.split(this._string_fixedreference).join(this._string_empty))||t[0]=="{"&&t[t.length-1]=="}")&&(i=!0)}return i};this._parseMultiCellArray=function(n,t){var o=t,u=this._splitString(t),f;if(t=this._markNamedRanges(t),o!=t)return this._parseDimensionalArray(n);if(!ej.isNullOrUndefined(this.cell)){var e=this._getHeight(u),r=this._getWidth(u),i=this._getPosition(e,r);e=this._getPositionHeight;r=this._getPositionWidth;this._getWidth(u)>r&&i!=-1&&i>=r&&(i=i+i/r*(this._getWidth(u)-r));i>=0?(n[0]=="("&&n[n.length-1]==")"&&(n=n.substr(1,n.length-2)),f=this.splitArgsPreservingQuotedCommas(n),f.length>i&&(n=f[i])):n=this.getErrorStrings()[0].toString()}return n};this._getWidth=function(n){var i=0,u=this._string_empty,r=0,t,e,f;for(n[0]=n[0].split(this._string_fixedreference).join(this._string_empty),this._isCellReference(n[0])?(u=this.computeColumns(n[0]),i=parseInt(u)):n[0].indexOf(",")>-1&&n[0].indexOf(";")==-1?(f=this.splitArgsPreservingQuotedCommas(n[0]),i=f.length):n[0].indexOf(";")>-1&&n[0].indexOf(",")==-1&&(i=1),t=0;t-1&&n[t].indexOf(";")==-1?(f=this.splitArgsPreservingQuotedCommas(n[t]),r=f.length):n[t].indexOf(";")>-1&&n[t].indexOf(",")==-1&&(r=1),r!=0&&(i==1||r-1&&n[0].indexOf(";")==-1?i=1:n[0].indexOf(";")>-1&&n[0].indexOf(",")==-1&&(f=this._splitArguments(n[0],";"),i=f.length),t=0;t-1&&n[t].indexOf(";")==-1?r=1:n[t].indexOf(";")>-1&&n[t].indexOf(",")==-1&&(f=this._splitArguments(n[t],";"),r=f.length),r!=0&&(i==1||i-1||!this._isCellReference(i[t])?i[t][0]=="["&&i[t][i[t].length-1]=="]"?(i[t]=i[t].substr(1,i[t].length-2),i[t].indexOf(",")>-1?(i[t]=this._calculateArraySize(i[t],s,f,e,h),r.push(this.splitArgsPreservingQuotedCommas(i[t]))):i[t].indexOf(";")>-1&&(i[t]=this._calculateArraySize(i[t],s,f,e,h),r.push(this._splitArguments(i[t],";"))),s=this._calculateArraySizeheight,f=this._calculateArraySizewidth,e=this._calculateArraySizeminHeight,h=this._calculateArraySizeminWidth):(r.push([i[t]]),this._indexOfAny(i[t],this._arrayMarkers)<0&&(e=1)):(i[t]=this._calculateArraySize(i[t],s,f,e,h),r.push(this.getCellsFromArgs(i[t])),s=this._calculateArraySizeheight,f=this._calculateArraySizewidth,e=this._calculateArraySizeminHeight,h=this._calculateArraySizeminWidth),r[t].length=a&&(u=0),l[c]=r[t][u],o++,c++;u++;o=0}if(e!=0&&e=a&&(u=0),l[o]=r[t][u],u++;r[t]=l}return r};this._parseDimensionalArray=function(n){var t,f,e,r,w,s,h;if(n=n.split(" ").join(this._string_empty),t=n,this._indexOfAny(n,this._arrayMarkers)>-1&&(n=n.split("{").join('"[').split("}").join(']"'),n=this._parseArrayFormula(n,t).split("(").join("{").split(")").join("}")),n[0]=="{"&&n[n.length-1]=="}"&&(n=n.substr(1,n.length-2)),n.Length==1)return n;if(f=n.indexOf(":"),this._isCellReference(n)&&f>-1){var b=this.getCellsFromArgs(n),c=this._string_empty,l=",",d=this.rowIndex(n.substr(0,f)),g=this.rowIndex(n.substr(f+1)),nt=this.colIndex(n.substr(0,f)),tt=this.colIndex(n.substr(f+1)),a=g-d+1,v=tt-nt+1;for(v==1?l=";":a==1&&(l=","),r=0;r1&&v>1)return this._parseRangeArray(n,a,v)}if(t.indexOf(",")>-1&&t.indexOf(";")==-1)return this._parseHorizontalArray(n);if(t.indexOf(";")>-1&&t.indexOf(",")==-1)return this._parseVerticalArray(n);if(this._indexOfAny(t,this._arrayMarkers)>-1)return e=this._splitString(t),this._parseRangeArray(n,this._getHeight(e),this._getWidth(e));var y=this._splitArguments(n,";"),e=[],p=[],o=y.length,i=0;for(r=0;ri&&u!=-1&&u>=i&&(u=u+u/i*(k-i)),n=u>-1?p[u]:this.getErrorStrings()[0].toString(),n};this._parseRangeArray=function(n,t,i){var u=this.splitArgsPreservingQuotedCommas(n);if(this.cell==this._string_empty)return u[0];var e=t,f=i,r=this._getPosition(t,i);return t=this._getPositionHeight,i=this._getPositionWidth,f>i&&r!=-1&&r>=i&&(r=r+r/i*(f-i)),r>-1?u[r]:this.getErrorStrings()[0].toString()};this._parseVerticalArray=function(n){var i=16384,r=this._splitArguments(n,";"),u=r.length,t;return this.cell==this._string_empty?r[0]:(t=this._getPosition(u,i),u=this._getPositionHeight,i=this._getPositionWidth,t=t>-1?t/i:t,t>-1?r[t]:this.getErrorStrings()[0].toString())};this._parseHorizontalArray=function(n){var u=1048576,i=this.splitArgsPreservingQuotedCommas(n),r=i.length,t;return this.cell==this._string_empty?i[0]:(t=this._getPosition(u,r),u=this._getPositionHeight,r=this._getPositionWidth,t=t>-1?t%r:t,t>-1?i[t]:this.getErrorStrings()[0].toString())};this._splitString=function(n){n=n.split(" ").join(this._string_empty).toUpperCase();n=this._markNamedRanges(n);return n.split(/([-+*/&])/)};this._computeArrayLen=function(n,t){var r=this._string_empty,i=this._string_empty,o=this._string_empty,l,s,h,a,u,f,v,c,e;if(n.indexOf(":")>-1&&t>0){for(l=this.getCellsFromArgs(n),s=0;s0){for(e=this.splitArgsPreservingQuotedCommas(n),h=0;h-1?this.cell!=this._string_empty?(a=this.getCellsFromArgs(n),u=this.computeRows(n),u=isNaN(u)?0:u,f=this.computeColumns(n),f=isNaN(f)?0:f,v=parseInt(this._getPosition(u,f)),u=this._getPositionHeight,f=this._getPositionWidth,c=isNaN(v)?-1:v,c>=0&&a.length>c?(r=this.getValueFromArg(a[c]).split('"').join(this._string_empty),r!=this._string_empty&&(i=r.length.toString())):i=this.getErrorStrings()[0].toString()):i=this._string_empty:(e=this.splitArgsPreservingQuotedCommas(n),r=this.getValueFromArg(e[0]).split('"').join(this._string_empty),r!=this._string_empty&&(i=r.length.toString()));return i};this._computeArrayRow=function(n,t){var u=this._string_empty,o,l,r,e,i,f;n=n.split('"').join(this._string_empty);var s=this.getCellsFromArgs(n),h=this.rowIndex(s[0].toString()),c=this.rowIndex(s[s.length-1].toString());if(t>0){for(r=h;r<=c;r++)u+=r.toString()+this._parseArgumentSeparator;u=u.substr(0,u.length-1)}else if(this.cell!=this._string_empty){for(o=[],o.length=c-h+1,l=0,r=h;r<=c;r++)o[l]=r.toString(),l++;e=this.computeRows(n);e=isNaN(e)?0:e;i=this.computeColumns(n);i=isNaN(i)?0:i;i==1&&(i=16384);f=this._getPosition(e,i);e=this._getPositionHeight;i=this._getPositionWidth;f=f>-1?f/i:f;u=f>-1?o[f].toString():this.getErrorStrings()[0].toString()}else u=this._string_empty;return u};this._computeArrayColumn=function(n,t){var u=this._string_empty,o,l,i,r,f,e;n=n.split('"').join(this._string_empty);var s=this.getCellsFromArgs(n),h=this.colIndex(s[0].toString()),c=this.colIndex(s[s.length-1].toString());if(t>0){for(i=h;i<=c;i++)u+=i.toString()+this._parseArgumentSeparator;u=u.substr(u.length-1)}else if(this.cell!=this._string_empty){for(o=[],o.length=c-h+1,l=0,i=h;i<=c;i++)o[l]=i.toString(),l++;r=this.computeRows(n);r=isNaN(r)?0:r;f=this.computeColumns(n);f=isNaN(f)?0:f;r==1&&(r=1048576);e=this._getPosition(r,f);r=this._getPositionHeight;f=this._getPositionWidth;e=e>-1?e%f:e;u=e>-1?o[e].toString():this.getErrorStrings()[0].toString()}else u=this._string_empty;return u};this._findAndCheckPrecedingChar=function(n,t,i){var r=n.indexOf(t,i);if(r>0)while(r>-1&&this.getValidPrecedingChars().indexOf(n[r-1])==-1)r=n.indexOf(t,r+1);return this._findAndCheckPrecedingCharCopy=n,r};this._findLastNonQB=function(n){var r=-1,i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>=0;--t)if(n[t]==this._rightBracket)i--;else if(n[t]==this._leftBracket)i++;else if(n[t]==this.bMARKER&&i==0){r=t;break}return r};this._findLastqNotInBrackets=function(n){for(var r=-1,i=!1,t=n.length-1;t>-1;){if(n[t]=="q"&&i){r=t;break}n[t]==this._leftBracket?i=!0:n[t]==this._rightBracket&&(i=!1);t--}return r};this._findNextSeparator=function(n,t){for(var i=0,r=!1;!r&&t-1)for(i=0,t=0;t59&&(n-=1),new Date(this._oaDate.setDate(this._oaDate.getDate()+n))};_weekEndType=["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"];this._getDoubleArray=function(n){var i,t="",u=[],f,r,o,e;for(n=this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),r=0;r-1)for(o=this.getCellsFromArgs(f[r]),e=0;e0&&(i=this._parseDouble(t),isNaN(i)?u.push(0):u.push(Number(i)));else t=this.getValueFromArg(f[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t.length>0?(i=this._parseDouble(t),isNaN(Number(i))||u.push(i)):u.push(0);return u};this._getDoubleArrayA=function(n){var t,i="",e=[],u,r,o,f;for(n=this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),r=0;r-1)for(o=this.getCellsFromArgs(u[r]),f=0;f0&&(i==this.trueValueStr?t=1:(t=this._parseDouble(i),isNaN(Number(t))&&t==0),e.push(t));else i=this.getValueFromArg(u[r]),i==this.trueValueStr?t=1:(t=this._parseDouble(i.toString()),isNaN(t)&&(t=0)),e.push(t);return e};this._getFormulaArrayBounds=function(n,t,i){var o=this.colIndex(this.cell),r=this.rowIndex(this.cell),s="",v=this.getFormulaInfoTable().containsKey(this.cell)?this.getFormulaInfoTable().getItem(this.cell):null,h,u,f,e;for(s=v!=null?v.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o),h=1,u=1,f=1;f<=t;f++)if(o-f>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(o-f)+r.toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r,o-f),u=o-f,s!=null&&l!=s){u++;break}}for(e=1;e<=i;e++)if(r-e>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(u)+(r-e).toString(),l="",a=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(l=a!=null?a.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u):this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,r-e,u),h=r-e,s!=null&&l!=s){h++;break}}return this._getFormulaArrayBoundsfirstRowIndex=h,this._getFormulaArrayBoundsfirstColIndex=u,this._getFormulaArrayBoundslastRowIndex=h+t,this._getFormulaArrayBoundslastColIndex=u+i,!0};FormulaArgumentType={None:{},Range:{},CellReference:{},TwoTextWithNumber:{},TextWithNumber:{},Numbers:{},Text:{},Date:{}};this.formulaErrorStringCheck=function(n,t){var r=this.splitArgsPreservingQuotedCommas(n),o,k,l,s,f,y,p,w,b,c,a,h,u,g,e,i;switch(t){case FormulaArgumentType.None:if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}break;case FormulaArgumentType.Range:if(o="",s=r,s!=null)for(i=0;i-1){if(f[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}for(k=this.getCellsFromArgs(f),l=0;l0&&this.getErrorStrings().indexOf(o)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return o}}}else{try{o=this.getValueFromArg(f)}catch(tt){}if(o.length>0&&(c=this.formulaErrorStringCheck(o,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c}break;case FormulaArgumentType.CellReference:if(s=r,s!=null)for(i=0;i-1)return y;if(p=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(p)>-1)return p;if(r.length==3&&(w=this.formulaErrorStringCheck(r[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(w)>-1))return w;break;case FormulaArgumentType.TextWithNumber:a=0;b=0;var v=this.getValueFromArg(r[0].split(this.tic).join("")),d=Boolean(v),it=r.length==2&&isNaN(typeof this.getValueFromArg(r[1])=="boolean"),a=isNaN(this._parseDouble(r[0].split(this.tic).join("")));if(a&&(u=this.getValueFromArg(r[0]),this.getErrorStrings().indexOf(u)>-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}if(r.length==2&&(b=this._parseDouble(r[1].split(this.tic).join("")),isNaN(b)&&(c=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1)))return c;break;case FormulaArgumentType.Text:for(e=r,i=0;i-1)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}}break;case FormulaArgumentType.Numbers:for(h=r,i=0;i-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}if(!d&&isNaN(this._parseDouble(u))&&u!=""||h[i].includes(":")&&this._isCellReference(h[i])||u.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}break;case FormulaArgumentType.Date:for(g=0,e=r,i=0;i-1){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return u}if(!nt&&isNaN(Date.parse(this._stripTics0(u)))&&isNaN(this._parseDouble(this._stripTics0(u)))&&u!=""){if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()}}}return n};this._getSerialDateFromDate=function(n,t,i){var u=0,f,r,e;for(n<1900&&(n+=1900),f=!1;!f;){while(t>12)n++,t-=12;for(f=!0,r=new Date(n,t,1,-1).getDate();i>r;)r=new Date(n,t,1,-1).getDate(),t++,i-=r,f=!1;i<1&&(t--,r=new Date(n,t,1,-1).getDate(),i=r-i)}return e=Date.parse(n.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+i.toString()),isNaN(e)||(u=this._toOADate(new Date(e))),this.treat1900AsLeapYear&&u>59&&(u+=1),u};this._getSerialDateTimeFromDate=function(n){var t=this._toOADate(n);return this.treat1900AsLeapYear&&t>59&&(t+=1),t};this._getSheetTokenFromReference=function(n){var i="",t;if(n.length>2&&n[0]==this.sheetToken){for(t=1,i=this.sheetToken;t0&&r[0]==this.getFormulaCharacter()&&u==null){u=new FormulaInfo;u.setFormulaText(f.toString());this.getDependentFormulaCells().containsKey(this.cell)||this.getDependentFormulaCells().add(this.cell,new HashTable);o=!0;try{u.setParsedFormula(this.parseFormula(r))}catch(h){this._inAPull?(r=h,u=null):u.setFormulaValue(h);o=!1}o&&(u.setFormulaValue(this.computeFormula(u.getParsedFormula())),e=!0);u!=null&&(u.calcID=this._calcID,this.getFormulaInfoTable().containsKey(this.cell)||this.getFormulaInfoTable().add(this.cell,u),r=u.getFormulaValue()!=null?u.getFormulaValue():"")}return u!=null&&(this.getUseFormulaValues()||this.getCalculatingSuspended()&&(!this._inAPull||e)?r=u.getFormulaValue()!=null?u.getFormulaValue():"":e||(this._calcID==u.calcID?r=u.getFormulaValue():(r=this.computeFormula(u.getParsedFormula()),u.setFormulaValue(r),u.calcID=this._calcID))),(r==""||r==undefined)&&(r=""),s=ej.isNullOrUndefined(ej.cultureObject)?this._parseDouble(r):ej.parseFloat(r,0,ej.cultureObject.name),r[r.length-1]!="%"||isNaN(s)||(r=(Number(s)/100).toString()),r};this._handleEmbeddedEs=function(n){for(var t=0,i,r;t>-1&&(t=n.indexOf(this._string_EP,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EP.length;r-1&&(t=n.indexOf(this._string_EM,t))>-1;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_EM.length;r-1&&(t=n.indexOf(this._string_E,t))>-1&&n[0]!=this.bMARKER;){if(this._notInBlock(n,t)){for(i=t;i>0&&(this._isDigit(n[i-1])||n[i-1]==this.getParseDecimalSeparator());)i--;if(i!=t&&(i==0||!this._isUpperChar(n[i-1]))){for(r=t+this._string_E.length;r-1)return i;return-1};this._lastIndexOfAny=function(n,t){for(var i=n.length-1;i>-1;i--)if(t.indexOf(n[i])>-1)return i;return-1};this._initLibraryFunctions=function(){this._libraryFunctions=new HashTable;this._addFunction("Countifs","ComputeCOUNTIFS");this._addFunction("SUM","computeSum");this._addFunction("EncodeURL","computeEncodeURL");this._addFunction("CHAR","computeChar");this._addFunction("CODE","computeCode");this._addFunction("UNICODE","computeUniCode");this._addFunction("UNICHAR","computeUniChar");this._addFunction("UPPER","computeUpper");this._addFunction("LOWER","computeLower");this._addFunction("LEN","computeLen");this._addFunction("MID","computeMid");this._addFunction("LEFT","computeLeft");this._addFunction("CLEAN","computeClean");this._addFunction("REPT","computeRept");this._addFunction("RIGHT","computeRight");this._addFunction("REPLACE","computeReplace");this._addFunction("EXACT","computeExact");this._addFunction("FIND","computeFind");this._addFunction("TRIM","computeTrim");this._addFunction("SEARCH","computeSearch");this._addFunction("SUBSTITUTE","computeSubstitute");this._addFunction("PROPER","computeProper");this._addFunction("T","computeT");this._addFunction("NUMBERVALUE","computeNumberValue");this._addFunction("CONCATENATE","computeConcatenate");this._addFunction("VALUE","computeValue");this._addFunction("DOLLAR","computeDollar");this._addFunction("FIXED","computeFixed");this._addFunction("BIN2DEC","computeBin2Dec");this._addFunction("BIN2OCT","computeBin2Oct");this._addFunction("BIN2HEX","computeBin2Hex");this._addFunction("DEC2BIN","computeDec2Bin");this._addFunction("DEC2OCT","computeDec2Oct");this._addFunction("HEX2BIN","computeHex2Bin");this._addFunction("HEX2OCT","computeHex2Oct");this._addFunction("BITAND","computeBitAnd");this._addFunction("BITOR","computeBitOr");this._addFunction("BITLSHIFT","computeBitLShift");this._addFunction("BITRSHIFT","computeBitRShift");this._addFunction("BITXOR","computeBitXor");this._addFunction("DATE","computeDate");this._addFunction("DATEVALUE","computeDatevalue");this._addFunction("DAY","computeDay");this._addFunction("DAYS","computeDays");this._addFunction("DAYS360","computeDays360");this._addFunction("EDATE","computeEDate");this._addFunction("EOMONTH","computeEOMonth");this._addFunction("HOUR","computeHour");this._addFunction("ISOWEEKNUM","computeISOWeeknum");this._addFunction("MINUTE","computeMinute");this._addFunction("MONTH","computeMonth");this._addFunction("NETWORKDAYS","computeNetworkDays");this._addFunction("NETWORKDAYS.INTL","computeNetworkDaysOintl");this._addFunction("NOW","computeNow");this._addFunction("SECOND","computeSecond");this._addFunction("TIME","computeTime");this._addFunction("TIMEVALUE","computeTimevalue");this._addFunction("TODAY","computeToday");this._addFunction("WEEKDAY","computeWeekday");this._addFunction("WEEKNUM","computeWeeknum");this._addFunction("WORKDAY","computeWorkDay");this._addFunction("WORKDAY.INTL","computeWorkDayOintl");this._addFunction("YEAR","computeYear");this._addFunction("ADDRESS","computeAddress");this._addFunction("AREAS","computeAreas");this._addFunction("CHOOSE","computeChoose");this._addFunction("COLUMN","computeColumn");this._addFunction("COLUMNS","computeColumns");this._addFunction("FORMULATEXT","computeFormulaText");this._addFunction("HYPERLINK","computeHyperlink");this._addFunction("HLOOKUP","computeHLookUp");this._addFunction("INDEX","computeIndex");this._addFunction("INDIRECT","computeIndirect");this._addFunction("LOOKUP","computeLookUp");this._addFunction("OFFSET","computeOffSet");this._addFunction("TRANSPOSE","computeTranspose");this._addFunction("LOGNORM.INV","computeLognormOinv");this._addFunction("NORM.INV","computeNormOinv");this._addFunction("NORM.DIST","computeNormOdist");this._addFunction("NORM.S.DIST","computeNormOsODist");this._addFunction("NORM.S.INV","computeNormOsOInv");this._addFunction("PERMUT","computePermut");this._addFunction("PERMUTATIONA","computePermutationA");this._addFunction("STANDARDIZE","computeStandardize");this._addFunction("BINOM.DIST","computeBinomOdist");this._addFunction("BINOM.INV","computeBinomOInv");this._addFunction("CHISQ.INV.RT","computeChisqOinvOrt");this._addFunction("CHISQ.INV","computeChisqOinv");this._addFunction("CHISQ.DIST.RT","computeChisqOdistOrt");this._addFunction("F.DIST","computeFOdist");this._addFunction("GAMMALN","computeGammaln");this._addFunction("CONFIDENCE.NORM","computeConfidenceOnorm");this._addFunction("EXPON.DIST","computeExponOdist");this._addFunction("FISHER","computeFisher");this._addFunction("FISHERINV","computeFisherInv");this._addFunction("GAMMALN.PRECISE","computeGammalnOPrecise");this._addFunction("AVERAGE","computeAverage");this._addFunction("AVERAGEA","computeAverageA");this._addFunction("POISSON.DIST","computePoissonODist");this._addFunction("WEIBULL.DIST","computeWeiBullODist");this._addFunction("F.INV.RT","computeFOinvOrt");this._addFunction("T.DIST","computeTOdist");this._addFunction("MAX","computeMax");this._addFunction("MAXA","computeMaxa");this._addFunction("MEDIAN","computeMedian");this._addFunction("MIN","computeMin");this._addFunction("MINA","computeMina");this._addFunction("PERCENTRANK.INC","computePercentrankInc");this._addFunction("PERCENTILE","computePercentile");this._addFunction("RANK.EQ","computeRankOEq");this._addFunction("COUNT","computeCount");this._addFunction("COUNTA","computeCounta");this._addFunction("DEVSQ","computeDevsq");this._addFunction("F.DIST.RT","computeFOdistORt");this._addFunction("FORECAST","computeForecast");this._addFunction("GEOMEAN","computeGeomean");this._addFunction("HARMEAN","computeHarmean");this._addFunction("INTERCEPT","computeIntercept");this._addFunction("LARGE","computeLarge");this._addFunction("SMALL","computeSmall");this._addFunction("LOGNORM.DIST","computeLognormOdist");this._addFunction("AVEDEV","computeAvedev");this._addFunction("COUNTBLANK","computeCountblank");this._addFunction("STDEV.P","computeStdevOp");this._addFunction("STDEV.S","computeStdevOS");this._addFunction("STDEVA","computeStdeva");this._addFunction("STDEVPA","computeStdevpa");this._addFunction("T.INV","computeTOinv");this._addFunction("VAR.P","computeVarp");this._addFunction("VARA","computeVara");this._addFunction("VARPA","computeVarpa");this._addFunction("CORREL","computeCorrel");this._addFunction("PERCENTILE.EXC","computePercentileExc");this._addFunction("PERCENTILE.INC","computePercentileOInc");this._addFunction("TRIMMEAN","computeTrimmean");this._addFunction("RSQ","computeRsq");this._addFunction("PEARSON","computePearson");this._addFunction("CHIDIST","computeChidist");this._addFunction("MODE.MULT","computeModeOMult");this._addFunction("NORMINV","computeNormInv");this._addFunction("SLOPE","computeSlope");this._addFunction("ABS","computeAbs");this._addFunction("ACOS","computeAcos");this._addFunction("ACOSH","computeAcosh");this._addFunction("ACOT","computeAcot");this._addFunction("ACOTH","computeAcoth");this._addFunction("ARABIC","computeArabic");this._addFunction("ASIN","computeAsin");this._addFunction("ATAN","computeAtan");this._addFunction("ATAN2","computeAtan2");this._addFunction("BIGMUL","computeBigMul");this._addFunction("CEILING.MATH","computeCeilingMath");this._addFunction("CEILING","computeCeiling");this._addFunction("COMBIN","computeCombin");this._addFunction("COMBINA","computeCombinA");this._addFunction("COS","computeCos");this._addFunction("COSH","computeCosh");this._addFunction("COT","computeCot");this._addFunction("CSC","computeCsc");this._addFunction("CSCH","computeCsch");this._addFunction("DECIMAL","computeDecimal");this._addFunction("DEGREES","computeDegrees");this._addFunction("ISTEXT","computeIsText");this._addFunction("EXP","computeExp");this._addFunction("EVEN","computeEven");this._addFunction("FACT","computeFact");this._addFunction("FACTDOUBLE","computeFactdouble");this._addFunction("FLOOR","computeFloor");this._addFunction("GCD","computeGcd");this._addFunction("INT","computeInt");this._addFunction("LCM","computeLcm");this._addFunction("LN","computeLn");this._addFunction("LOG","computeLog");this._addFunction("MUNIT","computeMunit");this._addFunction("PI","computePI");this._addFunction("PRODUCT","computeProduct");this._addFunction("SEC","computeSecant");this._addFunction("SERIESSUM","computeSeriessum");this._addFunction("SIGN","computeSign");this._addFunction("SIN","computeSin");this._addFunction("SINH","computeSinh");this._addFunction("SQRT","computeSqrt");this._addFunction("SUBTOTAL","computeSubTotal");this._addFunction("SUMIF","computeSumif");this._addFunction("TRUNC","computeTrunc");this._addFunction("TRUNCATE","computeTruncate");this._addFunction("TAN","computeTan");this._addFunction("LOG10","computeLogTen");this._addFunction("COTH","computeCoth");this._addFunction("RADIANS","computeRadians");this._addFunction("ODD","computeOdd");this._addFunction("MOD","computeMod");this._addFunction("RAND","computeRand");this._addFunction("RANDBETWEEN","computeRandBetween");this._addFunction("SECH","computeSecanth");this._addFunction("AND","computeAnd");this._addFunction("FALSE","computeFalse");this._addFunction("IF","computeIf");this._addFunction("IFERROR","computeIfError");this._addFunction("NOT","computeNot");this._addFunction("OR","computeOr");this._addFunction("TRUE","computeTrue");this._addFunction("XOR","computeXor");this._addFunction("IFS","computeIfs");this._addFunction("CELL","computeCell");this._addFunction("ERROR.TYPE","computeErrorType");this._addFunction("INFO","computeInfo");this._addFunction("ISBLANK","computeIsBlank");this._addFunction("ISERR","computeIsErr");this._addFunction("ISERROR","computeIsError");this._addFunction("ISEVEN","computeIsEven");this._addFunction("ISFORMULA","computeIsFormula");this._addFunction("ISLOGICAL","computeIsLogical");this._addFunction("ISNA","computeIsNA");this._addFunction("ISNONTEXT","computeIsNonText");this._addFunction("ISNUMBER","computeIsNumber");this._addFunction("ISODD","computeIsOdd");this._addFunction("ISREF","computeIsRef");this._addFunction("ISTEXT","computeIsText");this._addFunction("N","computeN");this._addFunction("NA","computeNA");this._addFunction("SHEET","computeSheet");this._addFunction("SHEETS","computeSheets");this._addFunction("TYPE","computeType");this._addFunction("ROW","computeRow");this._addFunction("ROWS","computeRows");this._addFunction("MATCH","computeMatch");this._addFunction("PMT","computePmt");this._addFunction("COUNTIF","computeCountif");this._addFunction("ROUND","computeRound");this._addFunction("ROUNDDOWN","computeRoundDown");this._addFunction("ROUNDUP","computeRoundUp");this._addFunction("MMULT","computeMmult");this._addFunction("PV","computePv");this._addFunction("NORMSDIST","computeNormsDist");this._addFunction("NORMDIST","computeNormDist");this._addFunction("SUMPRODUCT","computeSumProduct");this._addFunction("STDEV","computeStdev");this._addFunction("VLOOKUP","computeVLookUp");this._addFunction("ASINH","computeAsinh");this._addFunction("ATANH","computeAtanh");this._addFunction("BASE","computeBase");this._addFunction("AVERAGEIF","computeAverageIf");this._addFunction("AVERAGEIFS","computeAverageIfS");this._addFunction("BESSELI","computeBesselI");this._addFunction("BESSELJ","computeBesselJ");this._addFunction("BESSELK","computeBesselK");this._addFunction("BESSELY","computeBesselY");this._addFunction("TEXT","computeText");this._addFunction("POWER","computePow")};this._comb=function(n,t){for(var r,u=1,i=n+1;i<=t;++i)u=u*i;for(r=1,i=2;i<=t-n;++i)r=r*i;return u/r};this._finv=function(n,t,i){for(var o=Math.exp(this._gammaln((t+i)/2)-this._gammaln(t/2)-this._gammaln(i/2)+t/2*Math.log(t/i)),r=o,u=r/2,e=0,f=100,s=3,h=0;f==100&&s>0;)for(s--,r=r/2,u=r/2,f=0;f<100;++f){if(h++,e=1-o*this._fdist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e>n?r=r+u:(u=u/2,r-u<0&&(u=r/2),r=r-u)}return f==100&&(r=-1),r};this._tProbabilityDensity=function(n,t){var i=this._gammaFunction(.5*t+.5),r=Math.pow(1+n*n/t,-.5*t-.5),u=Math.sqrt(t*Math.PI)*this._gammaFunction(.5*t);return i*r/u};this._tCumulativeDensity=function(n,t){if(isNaN(n))return NaN;if(n==0)return.5;if(n>0){var i=t/(n*n+t);return 1-.5*this._rIBetaFunction(i,.5*t,.5)}return 1-this._tCumulativeDensity(-n,t)};this._sign=function(n){return n===0||isNaN(n)?n:n>0?1:-1};this._var=function(n){for(var u,f,i=0,r=n.length,t=0;t1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;switch(t){case 1:return Math.tan(Math.PI*(n-.5));case 2:return r=4*n*(1-n),2*(n-.5)*Math.sqrt(2/r);case 4:var r=4*n*(1-n),e=Math.sqrt(r),h=Math.cos(1/3*Math.acos(e))/e;return this._sign(n-.5)*2*Math.sqrt(h-1);default:for(i=t>6?this._standardNormalCumulativeDistributionFunctionInverse(n):this._tCumulativeDistributionInverse(n,4),u=0;u<50;u++){if(f=this._tCumulativeDensity(i,t),o=Math.abs(n-f),o<.0001)return i;s=this._tProbabilityDensity(i,t);i=i+(n-f)/s}throw"Solution did not converge";}};this._fdist=function(n,t,i){for(var s,p,f=32,e=0,c=n,o=(c-e)/f,l=o/3,y=this._fdensity(e,t,i)+this._fdensity(c,t,i),u=0,r=1;rt?(f=t-(n-t),c=n):(f=n,c=t+(t-n));var e=(c-f)/h,l=e/3,y=this._normaldensity(f,t,i)+this._normaldensity(c,t,i),u=0;for(r=1;rt?s+(1-s)/2:(1-s)/2};this._normaldensity=function(n,t,i){return 1/(Math.sqrt(2*Math.PI)*i)*Math.exp(-(n-t)*(n-t)/(2*i*i))};this._standardNormalCumulativeDistribution=function(n){if(n<0)return 1-this._standardNormalCumulativeDistribution(-n);var i=this._standardNormalProbabilityDensityFunction(n),t=1/(1+.2316419*n);return 1-i*(.31938153*t+-.356563782*Math.pow(t,2)+1.781477937*Math.pow(t,3)+-1.821255978*Math.pow(t,4)+1.330274429*Math.pow(t,5))};this._normalinv=function(n,t,i){var r=t;r=n<.05?t-2*i:n<.5?t:n<.95?t+2*i:t+5*i;for(var u=r/2,e=0,f=100,o=3,s=0;f==100&&o>0;)for(o--,r=r/2,u=r/2,f=0;f<100;++f){if(s++,e=this._normaldist(r,t,i),Math.abs((e-n)/n)<1e-7)break;e1)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 01)throw"Probability must be between 0 and 1";if(n==0)return Number.NEGATIVE_INFINITY;if(n==1)return Number.POSITIVE_INFINITY;if(n==.5)return 0;var u=-.0077848940024302926,f=-.32239645804113648,e=-2.4007582771618381,o=-2.5497325393437338,s=4.3746641414649678,h=2.9381639826987831,c=.0077846957090414622,l=.32246712907003983,a=2.445134137142996,v=3.7544086619074162,r=.02425,y=1-r,t;return 0=i){if(u=this._binomdist(n,r-1,t),isNaN(u))return this.maxValue;if(u0)break;r=r-f}else{if(u=this._binomdist(n,r+1,t),u>=i){r=r+1;break}r=r+f}e=this._binomdist(n,r,t)}while(r0);return r};this._newnormalinv=function(n){var f=[-39.696830286653757,220.9460984245205,-275.92851044696869,138.357751867269,-30.66479806614716,2.5066282774592392],e=[-54.476098798224058,161.58583685804089,-155.69897985988661,66.80131188771972,-13.280681552885721],i=[-.0077848940024302926,-.32239645804113648,-2.4007582771618381,-2.5497325393437338,4.3746641414649678,2.9381639826987831],u=[.0077846957090414622,.32246712907003983,2.445134137142996,3.7544086619074162],o=.02425,s=1-o,t=0,r=0;return n0;)for(e--,i=i/2,r=i/2,u=0;u<100;++u){if(f=1-this._chidist(i,t),Math.abs((f-n)/n)<1e-7)break;f>n?i=i+r:(r=r/2,i-r<0&&(r=i/2),i=i-r)}return u==100&&(i=-1),i};this._chidist=function(n,t){var c=[.09654008851,.09563872008,.09384439908,.0911738787,.087652093,.08331192423,.07819389579,.07234579411,.06582222278,.05868409348,.05099805926,.04283589802,.03427386291,.02539206531,.01627439473,.00701861001],l=[.04830766569,.14447196158,.23928736225,.33186860228,.42135127613,.50689990893,.58771575724,.66304426693,.73218211874,.79448379597,.84936761373,.89632115577,.93490607594,.96476225559,.98561151155,.99726386185],i=t/2,a=1/(Math.pow(2,i)*Math.exp(this._gammaln(i))),u;i=i-1;var o=0,s=n,f=(o+s)/2,h=(s-o)/2,e=0,r;for(u=0;u<16;++u)r=l[u]*h,e=Number(e)+Number(c[u]*(Math.pow(f+r,i)*Math.exp(-(f+r)/2)+Math.pow(f-r,i)*Math.exp(-(f-r)/2)));return Number(a)*Number(e)*Number(h)};this._gammaln=function(n){var r=[.918938533204673,.000595238095238,.000793650793651,.002777777777778,.083333333333333],t=n,i=0,u;if(t<7){for(i=t,t++;t<7;)i=i*t,t<7&&t++;i=-Math.log(i)}return u=this._parseDouble((1/(t*t)).toString()),i+(t-this._parseDouble("0.5"))*Math.log(t)-t+r[0]+(((-r[1]*u+r[2])*u-r[3])*u+r[4])/t};this._pearson=function(n,t,i){for(var u=0,f=0,r=0;r=1)return 1;if(t%1==0&&i%1==0&&t+i>0)return this._rIBetaFunction1(n,t,i);if(i%1==0&&t+i<172)return this._rIBetaFunction2(n,t,i);if(t%1==0&&t+i<172)return 1-this._rIBetaFunction2(1-n,i,t);if(t==.5&&i==.5)return 2/Math.PI*Math.atan(Math.sqrt(n/(1-n)));if(t==.5&&i%.5==0)return 1-this._rIBetaFunction(1-n,i,.5);if(t%.5==0&&i==.5){if(t<45){var u=0,e=Math.round(t-.5),l=this._parseDouble(this.computeGammaln("0.5".toString()));for(r=0;r.5?1-this._rIBetaFunction(1-n,i,t):(c=this._iBetaFunction(n,t,i)/this._betaFunction(t,i),Math.max(0,Math.min(1,c)))};this._rIBetaFunction1=function(n,t,i){var u=0,f=t+i-1,r;if(f<21){for(r=t;r172)throw"Cannot currently compute RegularizedIncompleteBetaFunction for a + b > 172";for(u=0,r=1;r143?t>20?2.5066282746310002*Math.pow(n,n-.5)*Math.pow(t,t-.5)/Math.pow(n+t,n+t-.5):this._gammaFunction(t)*Math.pow(n,-t):this._gammaFunction(n)*this._gammaFunction(t)/this._gammaFunction(n+t)};this._gammaFunction=function(n){var t,i;if(n>143)throw"Cannot currently compute gamma function for z > 143";if(n>0&&n<21&&n%1==0)return this._factorial(Math.round(n-1));if(n>0&&n<11&&n%.5==0)return t=parseInt(n),i=1.77245385090552,i*this._factorial(2*t)/(Math.pow(4,t)*this._factorial(t));var r=1+1/(12*n)+1/(288*n*n)-139/(51840*Math.pow(n,3))-571/(2488320*Math.pow(n,4))+163879/(209018880*Math.pow(n,5))+5246819/(75246796800*Math.pow(n,6));return Math.pow(n,n-.5)*Math.exp(-n)*2.5066282746310002*r};this._epsilon=494065645841247e-338;this._factorial=function(n){var t,i;if(n<0)throw"Factorial not defined for negative n";if(n>20)throw"Answer will exceed max long";for(t=1,i=n;i>0;i--)t=t*i;return t};this._combinations=function(n,t){var i=this._logCombin(n,t),r=Math.exp(i);return Math.round(r)};this._logCombin=function(n,t){return this._logFactorial(n)-this._logFactorial(t)-this._logFactorial(n-t)};this._logFactorial=function(n){for(var t=0,i=2;i<=n;i++)t=t+Math.log(i);return t};this._isCellReference=function(n){var e,f,t,i,u,r;if(n==""||(n=this.setTokensForSheets(n),e=this._sheetToken(n),f=!1,e!=""&&(n=n.split(this.sheetToken).join("")),t=!1,i=!1,n.indexOf(":")!=n.lastIndexOf(":")))return!1;for(u=n.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),r=0;r-1&&n.indexOf(this.tic)==-1?f&&t&&i?!0:(!t||i)&&(t||!i)||f?!1:!0:t&&i&&n.indexOf(this.tic)==-1?!0:!1};this._isDate=function(n){if(typeof n=="object"||ej.parseDate(n)!=null){var t=new Date(Date.parse(n));return t>=this._dateTime1900?t:"NaN"}return"NaN"};this._isDigit=function(n){var t=n.charCodeAt(0);return t>47&&t<58?!0:!1};this._isHLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&2)!=0};this._isVLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0};this._isLetter=function(n){var t=n.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122?!0:!1};this._isLetterOrDigit=function(n){var t=n.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?!0:!1};this._isLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0||(this._enableLookupTableCaching&2)!=0};this._isOptimizedMatchesEnabled=function(){return(this._enableLookupTableCaching&4)!=0};this._isRange=function(n){var u=!1,r=n.indexOf(":"),t,i;if(r>1&&r0&&this._isDigit(n[t]);)t--;if(this._isLetter(n[t])){for(t--;t>=0&&this._isLetter(n[t]);)t--;t>-1&&n[t]==this._string_fixedreference[0]&&t--;t<0?i=!0:n[t]==this.sheetToken&&(t-->1&&n[t]==this.tic[0]?i=n.substring(0,t-1).lastIndexOf(this.tic[0])==0:t>0&&this._isDigit(n[t])&&(i=n.substring(0,t).lastIndexOf(this.sheetToken)==0))}if(i&&(t=r+1,t64&&t<91};this._iisVLookupCachingEnabled=function(){return(this._enableLookupTableCaching&3)!=0||(this._enableLookupTableCaching&1)!=0};this._mark=function(n,t,i,r,u){var f=0,e;for(u?(f=this._findAndCheckPrecedingChar(n,i,f),n=this._findAndCheckPrecedingCharCopy):f=n.indexOf(i),e=i.length;f>-1;)n=n.substring(0,f)+r+n.substring(f+e),t=t.substring(0,f)+r+t.substring(f+e),u?(f=this._findAndCheckPrecedingChar(n,i,f),n=this._findAndCheckPrecedingCharCopy):f=n.indexOf(i,f);return this._markCopy="",t};this._markColonsInQuotes=function(n){for(var i=!1,t=0;t-1&&i>-1){var f=this.getReservedWordOperators()[this._reservedWord_IF].length,e=i-f,r=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,o=u-r,s=u+this.getReservedWordOperators()[this._reservedWord_ELSE].length,h=t.length-s;t="IF(("+this._substring(t,f,e)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,r,o)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,s,h)+"))";n=t}else if(i>-1){var f=0,e=i,r=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,o=t.length-r+1;t="IF(("+this._substring(t,f,e)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,r,o)+"))";n=t}return this._markIFCopy=t,t};this._markLibraryFormulas=function(n){var u=n.indexOf(")"),l,i,r,f,v,s,e,o,a,c,h,t;if(u==-1)n=this._markNamedRanges(n);else while(u>-1){for(l=0,i=u-1;i>-1&&(n[i]!="("||l!=0);)n[i]==")"?l++:n[i]==")"&&l--,i--;if(i==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];for(r=i-1;r>-1&&(this._isLetterOrDigit(n[r])||this._validFunctionNameChars.indexOf(n[r])>-1||n[r]==this.getParseDecimalSeparator());)r--;if(f=i-r-1,f>0&&this.getLibraryFunctions().getItem(this._substring(n,r+1,f))!=undefined){if(this._ignoreBracet=this._substring(n,r+1,f)=="AREAS"?!0:!1,t=this._substring(n,i,u-i+1),t.indexOf("({")>-1&&t.indexOf("})")>-1){for(v=this._string_empty,s=this._string_empty,e=0;e0&&s!=this._string_empty&&(this._checkForNamedRange(s.toUpperCase()),this._findNamedRange&&(o=o.split("{").join(this._string_empty)),this._findNamedRange=!1);s=this._string_empty;v+=o}t=v}t=this._markNamedRanges(t);t=this._swapInnerParens(t);t=this._addParensToArgs(t);n=n.substring(0,r+1)+"q"+this._substring(n,r+1,f)+t.split("(").join(this._leftBracket).split(")").join(this._rightBracket)+n.substring(u+1)}else{if(f>0){if(this.unknownFunction!=null){var y=CalcEngine.getSheetFamilyItem(this.grid),p=this.grid,w=this._sheetToken(this.cell),t=this.cell;for(w.length>0&&(p=y.tokenToParentObject.getItem(w),t=t.substring(t.lastIndexOf(this.sheetToken)+1)),a=y.sheetNameToParentObject.keys(),c=0;c0&&(t=n.substring(0,i));t=t+"{"+this._substring(n,i+1,u-i-1)+"}";u2&&(n=n[0]+n.substr(1,n.length-2).split("(").join("{").split(")").join("}")+n[n.length-1]),n};this._addParensToArgs=function(n){var u,t,r,e,f,i;if(n.length==0)return this._string_empty;if(u=[],u.push(this._parseArgumentSeparator),u.push(this._rightBracket),t=n.lastIndexOf(this._parseArgumentSeparator),r=0,t==-1)n.length>2&&n[0]=="("&&n[n.length-1]==")"&&(n[1]!="{"&&n[1]!="("?(n=n.substring(0,n.length-1)+"}"+n.substring(n.length-1),n=n[0]+"{"+n.substring(1)):(e=["+","-","*","/"],t=this._lastIndexOfAny(n,e),r==0&&n[n.length-1]==")"&&(r=n.length-1),r>0&&n[t+1]!="{"&&n[t-1]=="}"&&(n=n.substr(0,r)+"}"+n.substr(r),n=n.substr(0,t+1)+"{"+n.substr(t+1))));else for(f=!0;t>-1;)i=this._indexOfAny(n.substring(t+1,n.length),u),i>=0?i=t+i+1:i==-1&&n[n.length-1]==")"&&(i=n.length-1),i>0&&n[t+1]!="{"&&n[i-1]!="}"&&(n=n.substr(0,i)+"}"+n.substr(i),n=n.substr(0,t+1)+"{"+n.substr(t+1)),t=n.substr(0,t).lastIndexOf(this._parseArgumentSeparator),f&&t==-1&&n[0]=="("&&(t=0,f=!1);return n.split("{}").join(this._string_empty)};this._markNamedRanges=function(n){var s=n.indexOf(")"),u=[")",this.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&"],t=n.length>0&&(n[0]=="("||n[0]=="{")?1:0,r,f,i,e,o;for(n.indexOf("#N/A")>-1&&(n=n.split("#N/A").join("#N~A")),n.indexOf("#DIV/0!")>-1&&(n=n.split("#DIV/0!").join("#DIV~0!")),r=t,r=n.indexOf("[")==-1||n.indexOf("[")>this._indexOfAny(n.substring(t),u)?this._indexOfAny(n.substring(t),u):this._findNextEndIndex(n,r);r>-1&&r+t-1?i=this._getTableRange(this._substring(n,t,r)):this.getNamedRanges().containsKey(this._substring(n,t,r))&&(i=this._checkForNamedRange(this._substring(n,t,r))),i==undefined||typeof i=="string"||(i=i.getItem(this._substring(n,t,r))),ej.isNullOrUndefined(i)&&(f=this._checkIfScopedRange(this._substring(n,t,r)),f!="NaN"?(this._findNamedRange=!0,i=f):this._substring(n,t,r).startsWith(this.sheetToken.toString())&&(e=this._substring(n,t,r).indexOf(this.sheetToken,1),e>1&&(i=this.getNamedRanges().getItem(this._substring(n.substring(t),e+1,r-e-1)))),!ej.isNullOrUndefined(i)&&this._findNamedRange&&i.indexOf(this._string_fixedreference)>-1&&(i=i.split(this._string_fixedreference).join(this._string_empty))),ej.isNullOrUndefined(i)||(i=i.toUpperCase(),i=this.setTokensForSheets(i),i=this._markLibraryFormulas(i)),ej.isNullOrUndefined(i)||i==this._string_empty)for(t+=r+1;tthis._indexOfAny(n.substring(t),u)?this._indexOfAny(n.substring(t),u):this._findNextEndIndex(n,r),r=this._indexOfAny(n.substring(t),u);r==0&&t-1)&&t-1?this._getTableRange(n.substring(t)):this.getNamedRanges().length>0?this._checkForNamedRange(n.substring(t)):i,ej.isNullOrUndefined(i)&&(f=this._checkIfScopedRange(n.substring(t)),f!="NaN"&&(i=f)),ej.isNullOrUndefined(i)||i==this._string_empty||(i=i.toUpperCase(),i=this.setTokensForSheets(i),i=this._markLibraryFormulas(i),i!=null&&(o=n.substring(t),n=o[o.length-1]==")"?n.substring(0,t)+i+")":n.substring(0,t)+i,t+=i.toString().length+1)),r=t-1&&(n=n.split("#N~A").join("#N/A")),n.indexOf("#DIV~0!")>-1&&(n=n.split("#DIV~0!").join("#DIV/0!")),n};this._markReserveWords=function(n){var t=n.toLowerCase(),i=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim();return i[0]==this.getReservedWordOperators()[this._reservedWord_IF]&&(n=this._markIF(t,n),t=this._markIFCopy),n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_NOT],this.char_NOTop,!0),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_OR],this.char_ORop,!1),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_AND],this.char_ANDop,!1),t=this._markCopy,n=this._mark(t,n,this.getReservedWordOperators()[this._reservedWord_XOR],this.char_XORop,!1),t=this._markCopy,n};this._markupResultToIncludeInFormula=function(n){return n.length>0&&n[0]=="-"&&!isNaN(this._parseDouble(n))?n="nu"+n.substring(1):n.length>0&&(n[0]==this.tic[0]||n[0]==this.bMARKER||n[0]=="#")||n.startsWith(this.trueValueStr)||n.startsWith(this.falseValueStr)||(isNaN(this._parseDouble(n))?this._isRange(n)||(n=this.tic+n+this.tic):(n=n.split(this.getParseArgumentSeparator()).join(String.fromCharCode(32)),n="n"+n)),n};this._matchCompare=function(n,t){var i=n.toString(),r=t.toString(),u=this._parseDouble(i),f=this._parseDouble(r);return isNaN(u)||isNaN(f)?i==r?0:i>r?1:-1:u==f?0:u>f?1:-1};this._matchingRightBracket=function(n){for(var i=-1,t=1,r=0,e=this._sheetToken(n),u,f;i==-1&&t-1&&i-1&&(u=n.indexOf(this.sheetToken,t+1),u>-1&&(r=this._substring(n,t,u-t+1),n=n.replace(r,""),i=n.indexOf(":"))),this.rowIndex(n.substring(0,i)))};this._getTableRange=function(n){var t,f,r,i,e,s,u,o;if(n=n.replace(" ","").toUpperCase(),t=n.replace("]","").replace("#DATA",""),f=t,t.indexOf(this.getParseArgumentSeparator())>-1&&(f=t.substring(0,t.indexOf(this.getParseArgumentSeparator())).replace("[",""),t=t.replace("[","").replace(this.getParseArgumentSeparator(),"_")),r="",n.indexOf("#THISROW")>-1){if(i=this.getNamedRanges().getItem(t.replace("#THISROW","")),i==undefined||typeof i=="string"||(i=i.getItem(t.replace("#THISROW",""))),i==null)return i;i=i.toUpperCase();e=this.rowIndex(this.cell);i=i.replace(this._string_fixedreference,"");i=this.setTokensForSheets(i);s=0;u=this.getNamedRanges().getItem(f.Replace("#THISROW",""));u==undefined||typeof u=="string"||(u=u.getItem(f.Replace("#THISROW","")));u=u.replace(this._string_fixedreference,"").toUpperCase();u=this.setTokensForSheets(u);o=this._getTopRowIndexFromRange(i);r=this.getCellsFromArgs(i)[e-o]}else if(t=t[t.length-1]=="["?t.replace("[",""):t.replace("[","_"),(t.indexOf("#TOTALS")>-1||t.indexOf("#ALL")>-1||t.indexOf("#HEADERS")>-1||t.indexOf("#DATA")>-1)&&(t=t.replace("#","")),r=this.getNamedRanges().getItem(t),r==undefined||typeof r=="string"||(r=r.getItem(t)),r==null)return null;return r.toUpperCase()};this._calculateArraySize=function(n,t,i,r,u){var o=n.indexOf(":"),c=this._string_empty,f=0,e=0;if(u=0,r=0,this._isCellReference(n))if(o>-1){var l=this.rowIndex(n.substr(0,o)),s=this.rowIndex(n.substr(o+1)),a=this.colIndex(n.substr(0,o)),h=this.colIndex(n.substr(o+1));f=s-l+1;e=h-a+1;f>t&&(s=s-(f-t));e>i&&(h=h-(e-i));f-1&&n.indexOf(";")==-1?e=this.splitArgsPreservingQuotedCommas(n).length:n.indexOf(";")>-1&&n.indexOf(",")==-1&&(f=this._splitArguments(n,";").length),f-1&&(r=this._getTableRange(n),ej.isNullOrUndefined(r)||(this._findNamedRange=!0,n=r)),i=this._checkIfScopedRange(n),i!="NaN"?(this._findNamedRange=!0,n=i):(n.indexOf(this.sheetToken)>-1&&(u=CalcEngine.getSheetFamilyItem(this.grid),t=n.split("'").join(this._string_empty),t=t.substr(0,t.indexOf(this.sheetToken)),u.sheetNameToToken.containsKey(t.toUpperCase())&&(e=parseInt(u.sheetNameToToken.getItem(t.toUpperCase()).split(this.sheetToken).join(this._string_empty)),ej.isNullOrUndefined(this.parentObject)||this.parentObject.pluginName!="ejSpreadsheet"||(f=n.replace(t,this.parentObject.model.sheets[e+1].sheetInfo.text.toUpperCase()).split("'").join(this._string_empty),this.getNamedRanges().length>0&&this.getNamedRanges().contains(f.toUpperCase())&&(n=f)))),this.getNamedRanges().length>0&&this.getNamedRanges().contains(n.toUpperCase())&&(ej.isNullOrUndefined(this.parentObject)||this.parentObject.pluginName!="ejSpreadsheet"?(n=this._parse(this.getNamedRanges().getItem(n.toUpperCase())),n=this.setTokensForSheets(n),n.indexOf(this._string_fixedreference)>-1&&n.split(this._string_fixedreference).join(this._string_empty)):n=this._parse(this.getNamedRanges().getItem(n.toUpperCase())),this._findNamedRange=!0)),this._findNamedRange&&n[0]!="!"&&n[0]!="q"&&n[0]!="bq"&&(n=this.setTokensForSheets(n),n.indexOf(this._string_fixedreference)>-1&&(n=n.split(this._string_fixedreference).join(this._string_empty))),n};this._getTableRange=function(n){var i,t=n.split(this._table_Data).join(this._string_empty),a=t,u,r,o,c,l,e;if(t.indexOf(this._parseArgumentSeparator)>-1&&(a=t.substring(0,t.indexOf(this._parseArgumentSeparator)),t=t.split(this._parseArgumentSeparator).join(this._string_empty)),u=this._string_empty,n.toUpperCase().indexOf(this._table_Row)>-1)if(t=t[t.length-1]==")"?t.replace(")",this._string_empty):t,t.indexOf(":")>-1){var s=this._string_empty,h=t.toUpperCase().split(this._table_Row),f=this._splitArguments(h[1],":");for(r=0;r-1&&(u=n.substring(0,t+1).indexOf(this.sheetToken),u>-1&&(r=n.substring(t,u-t+1),n=n.split(r,this._string_empty),i=n.indexOf(":"))),this.rowIndex(arg.substring(0,i))};this._markColonsInQuotes=function(n){var r=!1,i,t;if(n.indexOf(":")==-1)return n;for(i=new StringBuilder,t=0;t0&&(t=this._checkForNamedRange(t),this._findNamedRange=!1),l=this._saveStrings(t),t=this._saveStringsText,t=t.split(this.braceLeft).join(this.tic),t=t.split(this.braceRight).join(this.tic),t=t.split("-+").join("-"),f=0,(t[t.length-1]!=this.bMARKER||this._indexOfAny(t,this.tokens)!=t.length-2)&&(t=t.toUpperCase()),t.indexOf(this.sheetToken)>-1&&(w=CalcEngine.getSheetFamilyItem(this.grid),w.sheetNameToParentObject!=null&&w.sheetNameToParentObject.length>0))try{t[0]!=this.sheetToken.toString()&&(t=this.setTokensForSheets(t));b=this._sheetToken(t.split(this.tic).join(this._string_empty));o=this._checkIfScopedRange(t.split("'").join(this._string_empty).split(this.sheetToken).join(this._string_empty));ej.isNullOrUndefined(b)&&b!=this._string_empty&&this.getNamedRanges().length>0&&o!=this._string_empty&&(t=o)}catch(a){if(this._rethrowExceptions)throw a;else return a}if(this._isRangeOperand)return this._isRangeOperand=!1,this._getCellFrom(this._parseSimple(t));if(h=this._string_empty,t.indexOf("[")>-1){for(f=0;f-1&&this.getNamedRanges().length>0){var d=this._string_empty,o=this._string_empty,c=!1,u=this._string_empty,k=!1;for(i=0;i-1?r=r.concat(" "+u):o==undefined&&this.getLibraryFunctions().getItem(u)!=undefined&&c?(r=r.concat(" "+u),k=!0):u!=this._string_empty&&(r=r.concat(u))}i!=t.length&&t[i]==")"?(r=r.concat(t[i]),k=!1):i!=t.length&&t[i]!=")"&&t[i]!=" "?r=r.concat(t[i]):i!=t.length&&t[i]==" "&&c&&this._isLetterOrDigit(t[i-1])|t[i-1]==")"?r=r.concat(t[i]):i==t.length||u!=this._string_empty||c||t[i]==" "||(r=r.concat(this._string_empty));d+=r;u=this._string_empty}t=d}else t=t.split(" ").join("");t=t.split("=>").join(">=");t=t.split("=<").join("<=");try{t=this._markLibraryFormulas(t)}catch(a){if(this._rethrowLibraryComputationExceptions)throw a;}if(!this._ignoreBracet)while((f=t.indexOf(")"))>-1){if(s=t.substring(0,f).lastIndexOf("("),s==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];if(s==f-1)throw this.formulaErrorStrings[this._empty_expression];if(e="",e=this._ignoreBracet?this._substring(t,s,f-s+1):this._substring(t,s+1,f-s-1),e.indexOf(":")>-1&&e.indexOf("q")==-1&&e.indexOf("=")==-1&&e.indexOf("[")==-1){e.indexOf(this._string_fixedreference)>-1&&(e=e.split(this._string_fixedreference).join(this._string_empty));try{if(v=this.getCellsFromArgs(e),v.length>0)for(y=0;y-1)throw this.formulaErrorStrings[this._mismatched_parentheses];return p=this._parseSimple(t),l!=null&&l.length>0&&(p=this._setStrings(p,l)),p};this._parseDouble=function(n){var t=ej.parseFloat(n.toString(),0,ej.cultureObject.name);return isNaN(t)?NaN:t};needToContinue=!0;this._parseSimple=function(n){var t=n;if(t.length>0&&t[0]=="+"&&(t=t.substring(1)),t=="#N/A"||t=="#N~A")return"#N/A";if(t.indexOf("#N/A")>-1&&(t=t.split("#N/A").join("#N~A")),t=="#DIV/0!"||t=="#DIV~0!")return"#DIV/0!";if(t.indexOf("#DIV/0!")>-1&&(t=t.split("#DIV/0!").join("#DIV~0!")),t=this._handleEmbeddedEs(t),t=t.split(this._string_lesseq).join(this.char_lesseq),t=t.split(this._string_greatereq).join(this.char_greatereq),t=t.split(this._string_noequal).join(this.char_noequal),t=t.split(this._string_fixedreference).join(this._string_empty),t=t.split(this._string_or).join(this.char_or),t=t.split(this._string_and).join(this.char_and),t=="")return t;needToContinue=!0;var i=[this.token_EP,this.token_EM],r=[this.token_or],u=[this.token_multiply,this.token_divide],f=[this.token_add,this.token_subtract],e=[this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal],o=[this.token_NOTop],s=[this.token_ORop,this.token_ANDop,this.token_XORop],h=[this.token_and],c=[this.char_EP,this.char_EM],l=[this.char_or],a=[this.char_multiply,this.char_divide],v=[this.char_add,this.char_subtract],y=[this.char_less,this.char_greater,this.char_equal,this.char_lesseq,this.char_greatereq,this.char_noequal],p=[this.char_NOTop],w=[this.char_ORop,this.char_ANDop,this.char_XORop],b=[this.char_and];return t=this._parseSimpleOperators(t,i,c),t=this._parseSimpleOperators(t,r,l),needToContinue&&(t=this._parseSimpleOperators(t,u,a)),needToContinue&&(t=this._parseSimpleOperators(t,f,v)),needToContinue&&(t=this._parseSimpleOperators(t,e,y)),needToContinue&&(t=this._parseSimpleOperators(t,o,p)),needToContinue&&(t=this._parseSimpleOperators(t,s,w)),needToContinue&&(t=this._parseSimpleOperators(t,h,b)),t.indexOf("#N~A")>-1&&(t=t.split("#N~A").join("#N/A")),t.indexOf("#DIV~0!")>-1&&(t=t.split("#DIV~0!").join("#DIV/0!")),t};this._parseSimpleOperators=function(n,t,i){for(var p,nt,b,w,tt,it,a,r,h,c,y,f,u=n,e,d="",g=0;g-").join(">u").split("<-").join("+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").toString();u.length>0&&u[0]=="-"?(u=u.substring(1).split("-").join(this.token_ORop),u="0-"+u,u=this._parseSimpleOperators(u,[this.token_subtract],[this.char_subtract]),u=u.split(this.token_ORop).join("-")):u.length>0&&u[0]=="+"&&(u=u.substring(1));try{if(this._indexOfAny(u,i)>-1)while((e=this._indexOfAny(u,i))>-1){var o="",s="",l=0,v=0,ft=this._supportLogicalOperators&&u[e]==this.char_NOTop,r=0;if(ft)l=e;else{if(e<1&&u[e]!="-")throw this.formulaErrorStrings[this._operators_cannot_start_an_expression];if(r=e-1,e==0&&u[e]=="-"){u=this.bMARKER+"nu"+u.substring(1)+this.bMARKER;continue}else if(u[r]==this.tic[0]){if(f=u.substring(0,r-1).lastIndexOf(this.tic),f<0)throw this.formulaErrorStrings[this._cannot_parse];o=this._substring(u,f,r-f+1);l=f}else if(u[r]==this.bMARKER){if(f=this._findLastNonQB(u.substring(0,r-1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];o=this._substring(u,f+1,r-f-1);l=f+1}else if(u[r]==this._rightBracket){for(h=0,f=r-1;f>0&&(u[f]!="q"||h!=0);)u[f]=="q"?h--:u[f]==this._rightBracket&&h++,f--;if(f<0)throw this.formulaErrorStrings[this._cannot_parse];o=this._substring(u,f,r-f+1);l=f}else if(this._isDigit(u[r])||u[r]=="%"){for(c=!1,y=!1;r>-1&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator()||!y&&u[r]=="%"||u[r]=="u"||u[r]=="_");)u[r]==this.getParseDecimalSeparator()?c=!0:u[r]=="%"&&(y=!0),r=r-1;if(r>-1&&c&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];if(r=r+1,r==0||r>0&&!this._isUpperChar(u[r-1]))o="n"+this._substring(u,r,e-r),l=r;else{for(r=r-1;r>-1&&(this._isUpperChar(u[r])||this._isDigit(u[r])||u[r]=="_");)r=r-1;if(r>-1&&u[r]=="u"&&(r=r-1),r>-1&&u[r]==this.sheetToken){for(r=r-1;r>-1&&u[r]!=this.sheetToken;)r=r-1;r>-1&&u[r]==this.sheetToken&&(r=r-1)}if(r>-1&&u[r]==":"){for(r=r-1;r>-1&&this._isDigit(u[r]);)r=r-1;while(r>-1&&this._isUpperChar(u[r]))r=r-1;if(r>-1&&u[r]==this.sheetToken){for(r--;r>-1&&u[r]!=this.sheetToken;)r--;r>-1&&u[r]==this.sheetToken&&r--}r=r+1;o=this._substring(u,r,e-r);o=this._getCellFrom(o)}else r=r+1,o=this._substring(u,r,e-r);this.updateDependencies(o);l=r;this.getNamedRanges().length>0&&(o=this._checkForNamedRange(o))}}else{while(r>=0&&(this._isUpperChar(u[r])||u[r]=="_"||u[r]=="."))r--;if(o=this._substring(u,r+1,e-r-1),l=r+1,tt="",this.getNamedRanges().length>0&&(o=this._checkForNamedRange(o)),!this._findNamedRange)if(o==this.trueValueStr)o="n"+this.trueValueStr;else if(o==this.falseValueStr)o="n"+this.falseValueStr;else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_char_in_front_of]+" "+u[e];return this.getErrorStrings()[5].toString()}this._findNamedRange=!1}}if(e==u.length-1)throw this.formulaErrorStrings[this._expression_cannot_end_with_an_operator];else if(r=e+1,p=u[r]=="u",p&&r++,u[r]==this.tic[0]){if(f=u.substring(r+1).indexOf(this.tic),f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,r,f+2);v=f+r+2}else if(u[r]==this.bMARKER){if(f=this._findNonQB(u.substring(r+1)),f<0)throw this.formulaErrorStrings[this._cannot_parse];s=this._substring(u,r+1,f);p&&(s=s+"nu1m");v=f+r+2}else if(u[r]=="q"){for(h=0,f=r+1;f1){while(r0&&(s=this._checkForNamedRange(s)),!this._findNamedRange)if(o==this.trueValueStr)o="n"+this.trueValueStr;else if(o==this.falseValueStr)o="n"+this.falseValueStr;else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_char_in_front_of]+" "+u[e];return this.getErrorStrings()[5].toString()}this._findNamedRange=!1}else this.updateDependencies(s);v=r+1}else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_characters_following_an_operator];return u.indexOf("#REF!")>-1?this.getErrorStrings()[2].toString():this.getErrorStrings()[5].toString()}it=d.indexOf(u[e]);a=this.bMARKER+this._zapBlocks(o)+this._zapBlocks(s)+t[it]+this.bMARKER;l>0&&(a=u.substring(0,l)+a);v0&&(u[f]!="q"||h!=0);)u[f]=="q"?h--:u[f]==this._rightBracket&&h++,f--;if(f<0)throw this.formulaErrorStrings[this._bad_library];}else if(this._isDigit(u[r])){for(c=!1,y=!1;r>-1&&(this._isDigit(u[r])||!c&&u[r]==this.getParseDecimalSeparator()||!y&&u[r]=="%");)u[r]==this.getParseDecimalSeparator()?c=!0:u[r]=="%"&&(y=!0),r=r-1;if(r>-1&&c&&u[r]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];}if(u.length>0&&(this._isUpperChar(u[0])||u[0]==this.sheetToken)){var k=!0,rt=!0,ut=!1;for(f=0;f0&&!ut)throw this.formulaErrorStrings[this._missing_sheet];for(ut=!0,f++;f-1)return this._isErrorString=!0,this.getErrorStrings().indexOf(t);if(t[0]=="#"||t=="")return 0;if(t==this.trueValueStr)return 1;if(t==this.falseValueStr)return 0;if(ej.isNullOrUndefined(ej.cultureObject)||ej.cultureObject.name=="en-US"||isNaN(parseFloat(t))||(t=_getLocaleNumberValue(t)),u=ej.isNullOrUndefined(ej.cultureObject)?this._parseDouble(t):ej.parseFloat(t,0,ej.cultureObject.name),isNaN(u)){if(this.getUseDatesInCalculations()&&isNaN(this._parseDouble(i)))return r=this._isDate(t),isNaN(r)?0:t.indexOf(":")>-1?this._getSerialDateTimeFromDate(r):Math.round(this._getSerialDateTimeFromDate(r))}else return u}return t==""&&this.getTreatStringsAsZero()?0:i!=null&&i.toString().length>0?Number.NaN:0};this._popString=function(n){var t=n.pop(),i=t!=null?ej.isNullOrUndefined(ej.cultureObject)?this._parseDouble(t.toString()):ej.parseFloat(t.toString(),0,ej.cultureObject.name):NaN;if(t==null)t="";else if(!isNaN(i))return i.toString();return this.removeTics(t.toString())};this._populateNamedRangesNonScoped=function(){this._namedRangesNonScoped==null&&(this._namedRangesNonScoped=new HashTable);this._namedRangesNonScoped.clear();for(var n=0;n-1)while(t>-1&&t-1){if(e=this.tic+this._uniqueStringMarker+s.toString()+this.tic,r-1&&t-1;u--)if(this.getValidPrecedingChars().indexOf(n[u].toString())==-1)i=n[u]+i;else break;if(!(i[0]=="'"&&i[i.length-1]=="'"))throw this.formulaErrorStrings[this._mismatched_tics];if(i[0]=="'"&&(i=i.substring(1)),i[i.length-1]=="'"&&(i=i.substring(0,i.length-1)),this.getSortedSheetNames().indexOf(i.toUpperCase())==-1)throw this.formulaErrorStrings[this._missing_sheet];t+11&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(n=this._substring(n,1,n.length-2)),n};this._substring=function(n,t,i){return n.substring(t,i+t)};this._isTextEmpty=function(n){return n==null||n==""};this._toOADate=function(n){return(n.getTime()-Date.parse(this._oaDate))/this._millisecondsOfaDay};this._zapBlocks=function(n){var i,t;if(n.indexOf(this.bMARKER)>-1)for(i=0,t=n.length-1;t>0;--t)n[t]==this._rightBracket?i--:n[t]==this._leftBracket?i++:n[t]==this.bMARKER&&i==0&&(n=n.substring(0,t-1)+n.substring(t+1));return n};this.addCustomFunction=function(n,t){return(n=n.toUpperCase(),this._addFunction(n,t),this._customlibraryFunctions.getItem(n)==undefined)?(this._customlibraryFunctions.add(n,t),!0):!1};this.UpdateDependentNamedRangeCell=function(n){var i,r,o;if(this.getDependentNamedRangeCells()!=null&&this.getDependentNamedRangeCells().containsKey(n)&&(i=this.getDependentNamedRangeCells().keys(),i!=null&&i.length>0))for(r=0;r-1?(o=CalcEngine.getSheetFamilyItem(this.grid),this.grid=o.tokenToParentObject.getItem(t.substring(0,e+3)),u=this.rowIndex(t),f=this.colIndex(t)):(u=this.rowIndex(t),f=this.colIndex(t));this.recalculateRange(RangeInfo.cells(u,f,u,f),this.grid);this.grid=c}};this.RemoveNamedRangeDependency=function(n){if(this.getDependentNamedRangeCells().containsKey(n)){var t=Hashtable(this.getDependentNamedRangeCells()[n]);t.Clear();this.getDependentNamedRangeCells().remove(n)}};this.SetNamedRangeDependency=function(n,t){var u=CalcEngine.getSheetFamilyItem(this.grid),f,i,r;u.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(f=u.GridModelToToken[this.grid],t=f+t);this.getDependentNamedRangeCells()!=null&&this.getDependentNamedRangeCells().containsKey(n)?(i=this.getDependentNamedRangeCells().getItem(n),i.containsKey(t)||i.add(t,"0")):(r=new HashTable,r.add(t,"0"),this.getDependentNamedRangeCells().add(n,r))};this.addNamedRange=function(n,t){return(n=n.toUpperCase(),this.getNamedRanges().getItem(n)==null)?(this.getNamedRanges().add(n,t),this.getNameRangeValues().containsKey(n)||this.getNameRangeValues().add(n,t.toString()),(this.getUndefinedNamedRanges().containsKey(n)||this.getUndefinedNamedRanges().containsKey(n.toUpperCase())||this.getUndefinedNamedRanges().containsKey(n.toLowerCase()))&&(this.SetNamedRangeDependency(n.toUpperCase(),this.cell),this.UpdateDependentNamedRangeCell(n.toUpperCase())),this.namedRangesSized=null,this._checkAddNonScopedNamedRange(n),!0):!1};this.adjustRangeArg=function(n){return n.length>1&&n[0]==this.bMARKER&&n[n.length-1]==this.bMARKER&&this._substring(n,1,n.length-2).indexOf(this.bMARKER)==-1&&(n=this.computedValue(n)),n.length>1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(n=this._substring(n,1,n.length-2)),n};this.clearFormulaDependentCells=function(n){var f=this.getDependentFormulaCells().getItem(n),i,t,r,u;if(f!=null){for(i=f.keys(),t=0;t1&&(this._isInteriorFunction=!0),this.computedValueLevel>this._maximumRecursiveCalls){this.computedValueLevel=0;throw this.formulaErrorStrings[this._too_complex];}if(_stack=[],i=0,_stack.length=0,sheet="",this.getAllowShortCircuitIFs()){loc=-1;do if(i-1&&(loc=this._matchingRightBracket(formula.substring(i)),loc>-1)){result="";nextIfLoc=formula.indexOf(this.iFMarker,loc);do{loc=i;sepLoc=this._findNextSeparator(formula,loc);isNaN(sepLoc)||(loc=sepLoc);for(var funcArgs=this._substring(formula,i+this.iFMarker.length,loc-this.iFMarker.length-1),ifArguments=[],argLoc=0,argNo=0;argLoc0&&arguments.push(funcArgs.substring(0,argLoc)):(argLoc=sepLoc,ifArguments.push(funcArgs.substring(0,argLoc)),funcArgs=funcArgs.substring(Number(argLoc)+1),argLoc=0);ifResult=this.getValueFromArg(ifArguments[0]);result=ifResult==this.trueValueStr?this.getValueFromArg(ifArguments[1]):this.getValueFromArg(ifArguments[2]);nextIfLoc=formula.indexOf(this.iFMarker,loc)}while(formula.indexOf(this.iFMarker)>-1&&nextIfLoc>-1);result=this._markupResultToIncludeInFormula(result);rightPiece="";i+loc+1-1&&loc>-1)}for(i=0;i=formula.length)continue;if(formula[i]==this.bMARKER&&i++,i>=formula.length)continue}if(formula[i]=="%"&&_stack.length>0){o=_stack[0];d=this._parseDouble(o);isNaN(d)||(_stack.pop(),_stack.push(Number(d)/100));i=i+1;continue}if(formula[i]==this.sheetToken){for(sheet=formula[i].toString(),i++;i50){if(this._breakedFormulaCells.indexOf(s)==-1&&this.getUseFormulaValues()){family=CalcEngine.getSheetFamilyItem(this.grid);token=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken;s=token+s;this._breakedFormulaCells.add(s);this._tempBreakedFormulaCells.add(s);break}_stack.push("FALSE")}else _stack.push(this.getValueFromParentObjectCell(s));else if(formula[i]=="q")if(formula=this._computeInteriorFunctions(formula),ii=formula.substring(i+1).indexOf(this._leftBracket),ii>0){for(var bracketCount=0,bracketFound=!1,start=ii+i+2,k=start;k0);)formula[k]==this._leftBracket?(bracketCount++,bracketFound=!0):formula[k]==this._leftBracket&&bracketCount--,k++;if(bracketFound){var s=this._substring(formula,start,k-start-2),s1="",splits=this.splitArgsPreservingQuotedCommas(s);for(t=0;t0&&(s1+=","),j=this._findLastqNotInBrackets(t),s1+=j>0?splits[t].substring(0,j)+this.computedValue(splits[t].substring(j)):this.computedValue(splits[t]);formula=formula.substring(0,start)+s1+formula.substring(k-2)}if(name=this._substring(formula,i+1,ii),name=="AVG"&&this._excelLikeComputations)throw this.formulaErrorStrings[this._bad_index];if(this.getLibraryFunctions().getItem(name)!=undefined){j=formula.substring(i+ii+1).indexOf(this._rightBracket);args=this._substring(formula,i+ii+2,j-1);try{if(functionName=this.getLibraryFunctions().getItem(name),result=this.getCustomLibraryFunctions().getItem(name)!=undefined?eval(functionName)(args,this.parentObject):this[functionName](args),isErrorStringValue=!1,this.getErrorStrings().indexOf(result)>0&&(isErrorStringValue=!0),!ej.isNullOrUndefined(this.parentObject)&&this.parentObject.pluginName=="ejSpreadsheet"&&this.parentObject.model.formulaComputed!=null){if(args={reqType:"formulaComputed",Formula:name,ComputedValue:result,Cell:this.cell,IsErrorString:isErrorStringValue,IsInteriorFunction:this._isInteriorFunction,Handled:!1},this.parentObject._trigger("formulaComputed",args),args.Handled)return this._string_empty;result=args.ComputedValue}_stack.push(result)}catch(ex){if(this.getRethrowLibraryComputationExceptions()){this._libraryComputationException=ex;throw ex;}return ex}i+=j+ii+2}else if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._missing_formula];}else if(formula[0]==this.bMARKER){i=0;_stack.length=0;continue}else throw this.formulaErrorStrings[this._improper_formula];else if(this._isDigit(formula[i])||formula[i]=="u"){if(s="",(formula[i]=="u"||uFound)&&(s="-",uFound?uFound=!1:i++),i-1)?(errIndex=formula.indexOf("!")==-1||formula.substring(i).indexOf("!")==-1?formula.indexOf("#N/A")>-1?formula.indexOf("#N/A")+4+i:formula.indexOf("?")+1+i:formula.indexOf("!")+1+i,_stack.push(this._substring(formula,i,errIndex-i))):(errIndex=i+1,_stack.push(this._substring(formula,i,errIndex-i)));i=errIndex;break;case"n":if(i=i+1,s="",formula.substring(i).indexOf("Infinity")==0)s="Infinity",i+=s.length;else if(formula.substring(i).indexOf("uInfinity")==0)s="Infinity",i+=s.length+1;else if(formula.substring(i).indexOf(this.trueValueStr)==0)s=this.trueValueStr,i+=s.length;else if(formula.substring(i).indexOf(this.falseValueStr)==0)s=this.falseValueStr,i+=s.length;else if(i<=formula.length-3&&formula.substring(i,3)=="NaN")i+=3,s="0";else{for((formula[i]=="u"||uFound)&&(s="-",uFound?uFound=!1:i=i+1);i0&&(o=_stack[0],d=this._parseDouble(o.toString()),isNaN(d)||(_stack.pop(),s=(d/100).toString())):s=(this._parseDouble(s)/100).toString()):i0?this.trueValueStr:this.falseValueStr:Number(d1)>Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_equal:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("")==s2.toUpperCase().split(this.tic).join("")?this.trueValueStr:this.falseValueStr:Number(d1)==Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_lesseq:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s2!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("").localeCompare(s2.toUpperCase().split(this.tic).join(""))<=0?this.trueValueStr:this.falseValueStr:Number(d1)<=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_greatereq:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("").localeCompare(s2.toUpperCase().split(this.tic).join(""))>=0?this.trueValueStr:this.falseValueStr:Number(d1)>=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_noequal:s1=this._popString(_stack);s2=this._popString(_stack);s2==""&&this.getTreatStringsAsZero()&&s1!=""&&(s2="0");d=this._parseDouble(s1);d1=this._parseDouble(s2);val=isNaN(d)||isNaN(d1)?s1=="#VALUE!"||s2=="#VALUE!"?"#VALUE!":s1.toUpperCase().split(this.tic).join("")!=s2.toUpperCase().split(this.tic).join("")?this.trueValueStr:this.falseValueStr:Number(d1)!=Number(d)?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_and:s1=this._popString(_stack);s2="";_stack.length>0&&(s2=this._popString(_stack));this.getUseNoAmpersandQuotes()?_stack.push(s2+s1):_stack.push(this.tic+s2+s1+this.tic);i=i+1;break;case this.token_or:d=this._pop(_stack);d1=this._pop(_stack);_stack.push(Math.pow(d1,d).toString());i=i+1;break;case this.token_ORop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr||s2.toUpperCase().split(this.tic).join("")==this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_ANDop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s2.toUpperCase().split(this.tic).join("")==this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_XORop:var s1=this._popString(_stack),s2=this._popString(_stack),d=this._parseDouble(s1),d1=this._parseDouble(s2),val;s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);s2==""?s2=this.falseValueStr:isNaN(d1)||(s2=Number(s2)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s2.toUpperCase().split(this.tic).join("")!=this.trueValueStr||s2.toUpperCase().split(this.tic).join("")==this.trueValueStr&&s1.toUpperCase().split(this.tic).join("")!=this.trueValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;case this.token_NOTop:s1=this._popString(_stack);d=this._parseDouble(s1);s1==""?s1=this.falseValueStr:isNaN(d)||(s1=Number(s1)!=0?this.trueValueStr:this.falseValueStr);val=s1.toUpperCase().split(this.tic).join("")==this.falseValueStr?this.trueValueStr:this.falseValueStr;_stack.push(val);i=i+1;break;default:if(this.computedValueLevel=0,this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_expression];else return this.getErrorStrings()[1].toString()}}if(this._checkDanglingStack&&_stack.length>1&&formula.length>1&&(formula.indexOf(this.bmarker.toString())!=0||formula.indexOf(this.bmarker)!=formula.length-1||formula.indexOf(this.bmarker2)>-1))return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];if(_stack.length==0)return"";s="";cc=_stack.length;do return(s=_stack.pop().toString()+s,s==""&&!this.getUseNoAmpersandQuotes()&&this._isCellReference(formula)&&this.getTreatStringsAsZero())?"0":!ej.isNullOrUndefined(ej.cultureObject)&&ej.cultureObject.name!="en-US"&&!isNaN(this._parseDouble(s))?_getLocaleNumberValue(s):s;while(cc>0&&!(s.indexOf(this.FALSEVALUESTR)>-1||s.indexOf(this.tRUEVALUESTR)>1));return!ej.isNullOrUndefined(ej.cultureObject)&&ej.cultureObject.name!="en-US"&&!isNaN(this._parseDouble(s))?_getLocaleNumberValue(s):s}catch(ex){if(this.computedValueLevel=0,ex.toString().indexOf(this.formulaErrorStrings[this._circular_reference_])>-1||this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();throw ex;}if(ex.toString().indexOf(this.formulaErrorStrings[this._cell_empty])>-1)return"";if(this.getRethrowLibraryComputationExceptions()){this._libraryComputationException=ex;throw ex;}return ex}finally{this.computedValueLevel--;this._isInteriorFunction=!1;this.computedValueLevel<0&&(this.computedValueLevel=0)}};this.computeFormula=function(n){if(this.getThrowCircularException())if(this._iterationMaxCount>0){if(this.computedValueLevel==0)this._circCheckList.length=0,this._circCheckList.push(this.cell);else if(this._circCheckList.indexOf(this.cell)>-1)return this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().getItem(this.cell).toString()}else{if(this.computedValueLevel==0)this._circCheckList.length=0;else if(this._circCheckList.indexOf(this.cell)>-1){this.computedValueLevel=0;this._circCheckList.length=0;throw this.formulaErrorStrings[this._circular_reference_];}this._circCheckList.push(this.cell)}var t=this.computedValue(n);return this.getUseNoAmpersandQuotes()&&t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]&&(t=this._substring(t,1,t.length-2)),t};this.dispose=function(){if(!this._isDisposed){var n=0;this.grid!=null&&(n=this.getSheetID(this.grid));CalcEngine._tokenCount--;CalcEngine.sheetFamilyID--;CalcEngine._sheetFamiliesList!=null&&CalcEngine._sheetFamiliesList.length>0&&(CalcEngine._sheetFamiliesList[n]=null,CalcEngine._sheetFamiliesList.remove(n));CalcEngine.modelToSheetID!=null&&CalcEngine.modelToSheetID.length>0&&(CalcEngine.modelToSheetID[n]=null,CalcEngine._sheetFamiliesList.remove(n));this._formulaInfoTable!=null&&(this._formulaInfoTable.clear(),this._formulaInfoTable=null);this._circCheckList!=null&&(this._circCheckList.length=0,this._circCheckList=null);this._dependentCells!=null&&(this._dependentCells.clear(),this._dependentCells=null);this._dependentFormulaCells!=null&&(this._dependentFormulaCells.clear(),this._dependentFormulaCells=null);this.getIterationValues()!=null&&(this.getIterationValues().clear(),this.getIterationValues(null));this._libraryFunctions!=null&&(this._libraryFunctions.clear(),this._libraryFunctions=null);this._lookupTables!=null&&(this._lookupTables.clear(),this._lookupTables=null);this.grid=null;this.getLibraryFunctions()!=null&&(this.getLibraryFunctions().clear(),this.setLibraryFunctions(null));this._isDisposed=!0}};this.getCalcID=function(){return this._calcID};this._getCellFrom=function(n){var u="",t=this.getCellsFromArgs(n),i=t.length-1,f=this.rowIndex(t[0]),o,s,r;if(f==this.rowIndex(t[i])){var h=this.colIndex(t[0]),c=this.colIndex(t[i]),e=this.colIndex(this.cell);e>=h&&e<=c&&(u=RangeInfo.getAlphaLabel(e).toString()+f.toString())}else(o=this.colIndex(t[0]))==this.colIndex(t[i])&&(s=this.rowIndex(t[i]),r=this.rowIndex(this.cell),r>=f&&r<=s&&(u=RangeInfo.getAlphaLabel(o).toString()+r.toString()));return u};this.getCellsFromArgs=function(n){var i,f,t,h,l,e,s,a,u,o;if(n=this._markColonsInQuotes(n),t=n.indexOf(":"),t==-1)return n=n.split(this._markerChar).join(":"),t=n.indexOf(this.getParseArgumentSeparator()),t==-1?(i=this.rowIndex(n),f=this.colIndex(n),h=[],h.push(n),h):this.splitArgsPreservingQuotedCommas(n);this.getRowIndexFromName=function(n){var i,t;if(n.indexOf(":")==-1){for(i="",t=0;t-1&&(l=n.indexOf(this.sheetToken,r+1),l>-1&&(c=this._substring(n,r,l-r+1),n=n.split(c).join(""),t=n.indexOf(":"))),t>0&&this._isLetter(n[t-1]))s=this._rowMaxCount>0?this._rowMaxCount:this.parentObject&&this.parentObject.pluginName=="ejSpreadsheet"&&this.parentObject.getSheet(this.parentObject.getActiveSheetIndex()).usedRange.rowIndex||50,n=n.substring(0,t)+"1:"+n.substring(t+1)+s.toString(),t=n.indexOf(":");else if(t>0&&this._isDigit(n[t-1])){for(e=t-2;e>=0&&this._isDigit(n[e]);)e--;e!=-1&&this._isLetter(n[e])||(s=this._columnMaxCount>0?this._columnMaxCount:50,n="A"+n.substring(0,t)+":"+RangeInfo.getAlphaLabel(s)+n.substring(t+1),t=n.indexOf(":"))}if(a=this._canGetRowIndex(n.substring(0,t)),!a)return this._ignoreCellValue=!0,n=y,this.splitArgsPreservingQuotedCommas(n);if(i=this.rowIndex(n.substring(0,t)),u=this.rowIndex(this._substring(n,t+1,n.length-t-1)),!(!(i==-1)||u==-1)==(i==-1||!(u==-1)))throw this.getErrorStrings()[5].toString();f=this.colIndex(n.substring(0,t));o=this.colIndex(this._substring(n,t+1,n.length-t-1));i>u&&(t=u,u=i,i=t);f>o&&(t=o,o=f,f=t);var w=(u-i+1)*(o-f+1),v=[],p=0;for(t=i;t<=u;++t)for(r=f;r<=o;++r)try{v[p++]=c+RangeInfo.getAlphaLabel(r)+t.toString()}catch(b){continue}return v};this.getFormulaRowCol=function(n,t,i){var f=CalcEngine.getSheetFamilyItem(n),r=RangeInfo.getAlphaLabel(i)+t.toString(),e,o,u;return(f.sheetNameToParentObject!=null&&(e=f.parentObjectToToken.getItem(n),r=e+r),this.getFormulaInfoTable().containsKey(r))?(o=this.getFormulaInfoTable.getItem(r),u=o.getFormulaText(),this.getFormulaText(u),u):""};this.getFormulaText=function(n){var t=new FormulaParsing(n);return t.getText()};this.getSheetID=function(n){var i=CalcEngine.getSheetFamilyItem(n),t,r;return i.sheetNameToParentObject!=null&&i.sheetNameToParentObject.length>0&&(t=i.parentObjectToToken.getItem(n),t=t.split("!").join(""),r=this._parseDouble(t),!isNaN(r))?r:-1};this.getStringArray=function(n){for(var f,r=[],i=0,u=!1,t=0;t-1)return n=n.split("{").join("("),n=n.split("}").join(")"),this.computedValue(n);if(n.length>1&&n.substring(0,2)=="ub")return(n=n.split("{").join("("),n=n.split("}").join(")"),f=n.substring(1),f=this.computedValue(f),u=this._parseDouble(f),!isNaN(u))?(u=-u,u.toString()):this.computedValue(n);if(n.indexOf("unu")==0?n="n"+n.substring(3):n.indexOf("un")==0&&(n="-"+n.substring(2)),n=n.split("u").join("-"),!this._isUpperChar(n[0])&&(this._isDigit(n[0])||n[0]==this.getParseDecimalSeparator()||n[0]=="-"||n[0]=="n"))if(n[0]=="n"&&(n=n.substring(1)),r=ej.isNullOrUndefined(ej.cultureObject)||ej.cultureObject.name=="en-US"?this._parseDouble(n):ej.isNullOrUndefined(n)?NaN:ej.parseFloat(n.toString(),0,ej.cultureObject.name),isNaN(r)){if(n.indexOf(this.trueValueStr)==0||n.indexOf(this.falseValueStr)==0)return n}else return this._preserveLeadingZeros?n:r.toString();if(this._ignoreCellValue&&!(n.indexOf(this.trueValueStr)==0||n.indexOf(this.falseValueStr)==0))return this._ignoreCellValue=!1,n;if(s=["+","-","/","*",")",")","{"],this._indexOfAny(n,s)==-1&&this._isUpperChar(n[0])||n[0]==this.sheetToken){if(n!=this.trueValueStr&&n!=this.falseValueStr&&this._isCellReference(n)&&(o=CalcEngine.getSheetFamilyItem(this.grid),o.sheetNameToParentObject!=null&&n.indexOf(this.sheetToken)==-1&&(h=o.parentObjectToToken.getItem(this.grid),n=h+n)),n==this.cell){e=this.getDependentCells().getItem(n);e!=null&&e.indexOf(n)>-1&&this._arrayRemove(e,n);this.getDependentFormulaCells().containsKey(this.cell)||this.clearFormulaDependentCells(this.cell);throw this.formulaErrorStrings[this._circular_reference_]+n;}return(t=this.getValueFromParentObjectCell(n),i=this._isDate(t),t=t.toString(),n!=this.trueValueStr&&n!=this.falseValueStr&&(r=this._parseDouble(t.split(this.tic).join("")),!this._preserveLeadingZeros&&!this._isCellReference(n)&&t.length>0&&!isNaN(r)&&(t=r.toString()),this.updateDependencies(n)),t==this.tic+this.tic)?"NaN":(this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&!isNaN(i)&&isNaN(this._parseDouble(t))&&!isNaN(i.getDate())&&this._dateTime1900<=i&&(t=this._toOADate(i).toString()),t)}return(n=n.split("{").join("("),n=n.split("}").join(")"),n=this._parse(n),r=ej.parseFloat(n.substring(0,n.length-1)),n.indexOf("%")!=n.length-1||isNaN(r)||(n=(Number(r)/100).toString()),this.getErrorStrings().indexOf(n)>-1)?n:this.computedValue(n)};this.getValueFromParentObjectCell=function(n){var t,e,s;if(n==this.trueValueStr||n==this.falseValueStr)return n;var r=n.lastIndexOf(this.sheetToken),u=0,f=0,o=this.grid,i=CalcEngine.getSheetFamilyItem(this.grid);if(r>-1&&i.tokenToParentObject!=null)this.grid=i.tokenToParentObject.getItem(n.substring(0,r+1)),u=this.rowIndex(n),f=this.colIndex(n);else if(r==-1){for(t=0;t0){if(this._circCheckList.indexOf(this.cell)>-1&&this.computedValueLevel>0)return this.grid=o,this.cell=e,this.getIterationValues().containsKey(this.cell)||this.getIterationValues().add(this.cell,"0"),this.getIterationValues().getItem(this.cell).toString();if(this.getIterationValues().containsKey(this.cell)&&this.computedValueLevel>0)return this.getIterationValues.getItem(this.cell).toString()}return s=this._getValueComputeFormulaIfNecessary(u,f,this.grid),this.grid=o,this.cell=e,s};this.getValueFromParentObject=function(n,t,i){var u=CalcEngine.getSheetFamilyItem(n),f=u.parentObjectToToken==null||u.parentObjectToToken.length==0?"":u.parentObjectToToken.getItem(n).toString(),o,s;f=f+RangeInfo.getAlphaLabel(i)+t.toString();o=this.grid;s=this.cell;this.cell=f;this.grid=n;var r=this._getValueComputeFormulaIfNecessary(t,i,n),e=new Date(Date.parse(r)),h=this._parseDouble(r);return this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&typeof r!="string"&&isNaN(h)&&!isNaN(e.getDate())&&this._dateTime1900<=e&&(r=this._toOADate(e).toString()),this.grid=o,this.cell=s,r};this.getValueFromParentObjectRowCol=function(n,t){return this._getValueComputeFormulaIfNecessary(n,t,this.grid)};this.handleIteration=function(n,t){return this.getFormulaInfoTable().containsKey(n)?this.getFormulaInfoTable.add(n,t):this.getFormulaInfoTable.add(n,t),this._iterationMaxCount>0&&n==this.cell&&this._handleIterations(t),t.getFormulaValue()};this.handleSheetRanges=function(n,t){for(var r=n.indexOf(this.sheetToken),i=0,o,s,e,u,v,f,y,h,c;r>0;){if(o=this._substring(n,i,r).lastIndexOf(":"),o>-1)if(s=this._substring(n,i+o+1,r-o-1).toUpperCase().split("'").join(""),e=this._isIE8?s.replace(/^\s+|\s+$/g,""):s.trim(),t.sheetNameToToken.containsKey(e)){if(u=i+o-1,this._sortedSheetNames.contains(s))u=u-s.length-1;else while(u>0&&this._markers.indexOf(n[u])==-1)u--;if(v=this._substring(n,u+1,o-u+i-1).toUpperCase().split("'").join(""),e=this._isIE8?v.replace(/^\s+|\s+$/g,""):v.trim(),t.sheetNameToToken.containsKey(e)){if(f=r+i+1,this._sortedSheetNames.contains(e))f=n.length-1;else while(fb&&p0&&(h+=this.getParseArgumentSeparator()),h+=c+String.fromCharCode(131)+w)}n=n.substring(0,u+1)+h+n.substring(f);i=n.length-f}else i=r+i}else i=r+i;else i=r+i;r=n.substring(i+1).indexOf(this.sheetToken)+1}return n.split(String.fromCharCode(131)).join(this.sheetToken)};this.isSheetMember=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n==null||n==undefined?!1:n.isSheetMember};this.parseAndComputeFormula=function(n){var i=n,r,t,u,f;for(i.length>0&&i[0]==this.getFormulaCharacter()&&(i=i.substring(1)),i.length>0&&i[0]=="+"&&(i=i.substring(1)),i.length>1&&i[0]==","&&i[1]>="0"&&i[1]<="9"&&(i="0,"+i.substring(1)),r=i.split(" ").join(""),t=r.indexOf("(");t!=-1&&t0){if(this._isDigit(r[t-1])&&!this._checkHasCharBeforeNumber(r.substring(0,t)))throw this.formulaErrorStrings[this._bad_formula]+" "+r.substring(0,t+1);if(u=r.substring(t+1).indexOf("("),u==-1)break;else t+=u}for(t=r.indexOf(")");t!=-1&&t0&&n[0]==this.getFormulaCharacter()&&(n=n.substring(1)),n.length>0&&n[0]=="+"&&(n=n.substring(1)),this._isRangeOperand=this._supportRangeOperands&&this._isRange(n),this.getCheckDanglingStack()&&n.split(" ").join("").indexOf(this._braceRightNLeft)>-1)return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];if(t=this._isIE8?n.replace(/^\s+|\s+$/g,""):n.trim(),!ej.isNullOrUndefined(this.parentObject)&&this.parentObject.pluginName=="ejSpreadsheet"){var r=this.rowIndex(this.cell),u=this.colIndex(this.cell),i=this.parentObject.XLEdit.getPropertyValue(r-1,u-1,"hasFormulaArray");this._isArrayFormula=ej.isNullOrUndefined(i)?!1:i;this._isArrayFormula&&(t=this._parseLibraryFormula("{"+t+"}"))}return this._parse(t)};this.getUpdatedValueCell=function(n){var i,h,c,f,e,u,s;this._inAPull=!0;var l=this.grid,a=this.cell,o=CalcEngine.getSheetFamilyItem(this.grid),t=n.toUpperCase(),r;if((r=t.indexOf(this.sheetToken))==-1&&this.cell!=""&&this.cell!=undefined?(r=this.cell.indexOf(this.sheetToken,1),r>-1&&o.tokenToParentObject!=null&&(t=this.cell.substring(0,r+1)+t,this.grid=o.tokenToParentObject.getItem(this.cell.substring(0,r+1)))):r>0&&o.sheetNameToToken!=null&&o.tokenToParentObject!=null&&(u=o.sheetNameToToken.getItem(t.substring(0,r)),t=u+t.substring(r+1),this.grid=o.tokenToParentObject.getItem(u),this.cell=t),this.updateCalcID(),this.getDependentFormulaCells().containsKey(t)||this.getFormulaInfoTable().containsKey(t))this._processedCells.clear(),this.updateDependenciesAndCell(t),this._processedCells.clear(),i=this.getValueFromParentObject(t);else{for(i=this.getValueFromParentObjectCell(t);this._breakedFormulaCells.length==1;)this.updateCalcID(),i=this.getValueFromParentObjectCell(this._breakedFormulaCells[0].toString()),this._breakedFormulaCells.removeAt(0),this.setUseFormulaValues(!0);if(this.getUseFormulaValues()&&(this.isUseFormulaValueChanged=!0,this.setUseFormulaValue(!1)),this._tempBreakedFormulaCells.length>0){for(h=1;h<=this._tempBreakedFormulaCells.length;h++)i=this.getValueFromParentObjectCell(this._tempBreakedFormulaCells[this._tempBreakedFormulaCells.length-h].toString());this._tempBreakedFormulaCells.length=0;i=this.getValueFromParentObjectCell(t)}this.setUseFormulaValues(this.isUseFormulaValueChanged);c=this.ignoreValueChanged;this.ignoreValueChanged=!0;f=this.rowIndex(t);e=this.colIndex(t);this.getPreserveFormula()?(u=this._sheetToken(n),u==""?(u="!"+this.getSheetID(this.grid)+"!",s=this.getFormulaInfoTable().getItem(u+t),s!=null&&s!=undefined&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,s.getFormulaText(),f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,s.getFormulaText(),f,e))):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e)):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i,f,e);this.ignoreValueChanged=c}return this.grid=l,this.cell=a,this._inAPull=!1,i};this.getUpdatedValueRowCol=function(n,t,i){var o=this.grid,s=CalcEngine.getSheetFamilyItem(this.grid),f=this.sheetToken+n.toString()+this.sheetToken,r,u,e;this.grid=s.tokenToParentObject.getItem(f);this._inAPull=!0;r=f+RangeInfo.getAlphaLabel(i)+t.toString();this.updateCalcID();this.getDependentFormulaCells().containsKey(r)||this.formulaInfoTable.containsKey(r)?(this._processedCells.clear(),this.updateDependenciesAndCell(r),this._processedCells.clear()):(u=this.getValueFromParentObjectCell(r),e=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,u,t,i):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,u,t,i),this.ignoreValueChanged=e);this.grid=o;this._inAPull=!1};this.setTokensForSheets=function(n){var f=CalcEngine.getSheetFamilyItem(this.grid),t,i,u,r;if(this.getSupportsSheetRanges()&&(n=this.handleSheetRanges(n,f)),t=this.getSortedSheetNames(),t!=null)for(i=0;i0&&(this.grid=a.tokenToParentObject.getItem(f));try{var s=this.rowIndex(t),h=this.colIndex(t),i=this.getFormulaInfoTable().getItem(t);i!=null&&(c=this.cell,this.cell=t,(this.getAlwaysComputeDuringRefresh()||i.calcID!=this._calcID||i.getFormulaValue()=="")&&(this.getComputedValue().containsKey(t)?r=this.getComputedValue().getItem(t):(r=this.computeFormula(i.getParsedFormula()),this._computedValue.add(t,r)),r!=i._formulaValue&&this._refreshedCells.containsKey(t)&&this._refreshedCells.remove(t),i._formulaValue=r),i.calcID=this._calcID,this.cell=c,l=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,i.getFormulaValue(),s,h):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,i.getFormulaValue(),s,h),this.ignoreValueChanged=l,this._refreshedCells.containsKey(t)||(this._refreshedCells.add(t,0),this.refresh(t)))}catch(y){continue}this.grid=o}this._lockDependencies=v}finally{this._refreshedCells.containsKey(n)||this._refreshedCells.add(n,0);this._dependencyLevel--;this._dependencyLevel==0&&this._refreshedCells.clear()}}};this.refreshRange=function(n){for(var i,r,u,f,t=n.getTop();t<=n.getBottom();t++)for(i=n.getLeft();i<=n.getRight();i++)r=RangeInfo.getAlphaLabel(i)+t.toString(),this._dependencyLevel=0,u=CalcEngine.getSheetFamilyItem(this.grid),f=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken,u.tokenToParentObject!=null&&u.tokenToParentObject.contains(f)&&(this.grid=u.tokenToParentObject.getItem(f)),r=f+r,this.getComputedValue().clear(),this.refresh(r),this.getComputedValue().clear()};this.registerGridAsSheet=function(n,t,i){var r,f,u;return CalcEngine.modelToSheetID!=null,CalcEngine.modelToSheetID==null&&(CalcEngine.modelToSheetID=new HashTable),(CalcEngine.modelToSheetID.getItem(t)==null||CalcEngine.modelToSheetID.getItem(t)==undefined)&&CalcEngine.modelToSheetID.add(t,i),r=CalcEngine.getSheetFamilyItem(t),r.isSheetMember=!0,f=n.toUpperCase(),r.sheetNameToParentObject==null&&(r.sheetNameToParentObject=new HashTable),r.tokenToParentObject==null&&(r.tokenToParentObject=new HashTable),r.sheetNameToToken==null&&(r.sheetNameToToken=new HashTable),r.parentObjectToToken==null&&(r.parentObjectToToken=new HashTable),r.sheetNameToParentObject.getItem(f)!=undefined?(u=r.sheetNameToToken.getItem(f),r.tokenToParentObject.add(u,t),r.parentObjectToToken.add(t,u)):(u=this.sheetToken+CalcEngine._tokenCount.toString()+this.sheetToken,CalcEngine._tokenCount++,r.tokenToParentObject.add(u,t),r.sheetNameToToken.add(f,u),r.sheetNameToParentObject.add(f,t),r.parentObjectToToken.add(t,u),this.sortedSheetNames=null),n};this.renameSheet=function(n,t){var i=CalcEngine.getSheetFamilyItem(t),r="",u;if(n.includes("/")||n.includes("?")||n.includes("*")||n.includes("[")||n.includes("]")||n.includes(":")||n.includes("\\"))throw"The name does not contain any of following characters: / ? * [ ] : \\";r=t.toString();r=r.toUpperCase();currentSheetName=n.toUpperCase();u=i.sheetNameToToken.getItem(r);CalcEngine.modelToSheetID.containsKey(t)&&(CalcEngine.modelToSheetID.remove(t),CalcEngine.modelToSheetID.add(n,this._calcID));i.sheetNameToParentObject.containsKey(r)&&(i.sheetNameToParentObject.remove(r),i.sheetNameToParentObject.add(currentSheetName,n));i.tokenToParentObject.containsKey(u)&&(i.tokenToParentObject.remove(u),i.tokenToParentObject.add(u,n));i.sheetNameToToken.containsKey(r)&&(i.sheetNameToToken.remove(r),i.sheetNameToToken.add(currentSheetName,u));i.parentObjectToToken.containsKey(r)&&(i.parentObjectToToken.remove(r),i.parentObjectToToken.add(n,u))};this.removeFunction=function(n){return(this._customlibraryFunctions.getItem(n)!=undefined&&this._customlibraryFunctions.remove(n),this._libraryFunctions.getItem(n)!=null)?(this._libraryFunctions.remove(n),!0):!1};this.removeNamedRange=function(n){return(n=n.toUpperCase(),this.getNamedRanges().getItem(n)!=null)?(this.getNamedRanges().remove(n),this._populateNamedRangesNonScoped(),!0):!1};this.rowIndex=function(n){var t=0,i,r=!1;if(t1&&n[0]==this.tic[0]&&n[n.length-1]==this.tic[0]&&(this._substring(n,1,n.length-2).indexOf(this.tic)==-1?n=this._substring(n,1,n.length-2):this._multiTick&&(n=this._substring(n,1,n.length-2))),n};this.updateCalcID=function(){this._calcID++;this._calcID==Number.MAX_SAFE_INTEGER&&(this._calcID=Number.MIN_SAFE_INTEGER+1)};this.updateDependencies=function(n){var s,t,c,h,u,e,o,i,f,r;if(!this._lockDependencies&&this.getUseDependencies())if(s=CalcEngine.getSheetFamilyItem(this.grid),t=this.cell,s.sheetNameToParentObject!=null&&t.indexOf(this.sheetToken)==-1&&(c=s.parentObjectToToken.getItem(this.grid),t=c+t),s.sheetNameToParentObject!=null&&n.indexOf(this.sheetToken)==-1&&(c=s.parentObjectToToken.getItem(this.grid),n=c+n),this.getDependentCells().containsKey(n)){if(u=this.getDependentCells().getItem(n),u.indexOf(t)==-1&&u.push(t),this._addToFormulaDependentCells(n),ej.isNullOrUndefined(this.parentObject)&&this.parentObject.pluginName!="ejSpreadsheet"&&this.getDependentFormulaCells().containsKey(n)&&(e=this.getDependentFormulaCells().getItem(n),e!=null))for(o=e.keys(),i=0;i0&&(this.grid=y.tokenToParentObject.getItem(h)),this.formulaInfoTable.containsKey(n)){if(t=this.formulaInfoTable[n],t.calcID!=this._calcID){if(c=this.cell,this.cell=n,this._iterationMaxCount>0&&this._circCheckList.indexOf(this.cell)>-1?this._handleIterations(t):t.setFormulaValue(this.computeFormula(t.getParsedFormula())),this.getDependentCells().containsKey(n))for(o=this.getDependentCells().getItem(n),u=0;u0&&(c=o.parentObjectToToken.getItem(e),u=c+u),t.getValue().length>0&&t.getValue()[0]==this.getFormulaCharacter()){if(this.cell=u,f=!0,ej.isNullOrUndefined(i)||(f=i),this.getFormulaInfoTable().containsKey(u)){if(r=this.getFormulaInfoTable().getItem(u),t.getValue()!=r.getFormulaText()||r.getParsedFormula()==null){r.setFormulaText(t.getValue());this.getDependentFormulaCells().containsKey(this.cell)&&this.clearFormulaDependentCells(this.cell);try{r.setParsedFormula(this.parseFormula(t.getValue()))}catch(l){r.setFormulaValue(l);f=!1}}f&&(s=this.computeFormula(r.getParsedFormula()),h=s!=r.getFormulaValue()||this.getForceRefreshCall(),r.setFormulaValue(s));r.calcID=this._calcID}else{r=new FormulaInfo;r.setFormulaText(t.getValue());this.getDependentFormulaCells().containsKey(u)||this.getDependentFormulaCells().add(u,new HashTable);try{r.setParsedFormula(this.parseFormula(t.getValue()))}catch(l){r.setFormulaValue(l);f=!1}f&&(r.setFormulaValue(this.computeFormula(r.getParsedFormula())),this.computeIsFormula(r).toString()!="#NAME?"||this.getNamedRanges().containsKey(r.getFormulaText().split("=")[1].toUpperCase())||this.getUndefinedNamedRanges().add(r.getFormulaText().split("=")[1].toUpperCase()));r.calcID=this._calcID;this.getFormulaInfoTable().containsKey(u)?this.getFormulaInfoTable().add(u,r):this.getFormulaInfoTable().add(u,r)}this._iterationMaxCount>0&&f&&!this._inHandleIterations&&u==this.cell&&this._handleIterations(r);a=this.ignoreValueChanged;this.ignoreValueChanged=!0;f&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(e)+1,r.getFormulaValue(),t.getRowIndex(),t.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(e)+1,r.getFormulaValue(),t.getRowIndex(),t.getColIndex()));this.ignoreValueChanged=a}else!this._inRecalculateRange&&this.getFormulaInfoTable().containsKey(u)&&(this.getFormulaInfoTable().remove(u),this.getDependentFormulaCells().containsKey(u)&&this.clearFormulaDependentCells(u));f&&h&&this.getDependentCells().containsKey(u)&&(this._dependencyLevel=0,this.getComputedValue().clear(),this.refresh(u))}};this.getActiveCell=function(){return this.cell};this.getAllowShortCircuitIFs=function(){return this._allowShortCircuitIFs};this.setAllowShortCircuitIFs=function(n){this._allowShortCircuitIFs=n};this.getAlwaysComputeDuringRefresh=function(){return this._alwaysComputeDuringRefresh};this.setAlwaysComputeDuringRefresh=function(n){this._alwaysComputeDuringRefresh=n};this.getCalculatingSuspended=function(){return this._calculatingSuspended};this.setCalculatingSuspended=function(n){this._calculatingSuspended=n};this.getCheckDanglingStack=function(){return this._checkDanglingStack};this.setCheckDanglingStack=function(n){this._checkDanglingStack=n};this.getCustomLibraryFunctions=function(){return this._customlibraryFunctions};this._computedValue=null;this.getComputedValue=function(){return this._computedValue==null&&(this._computedValue=new HashTable),this._computedValue};this.getDependentCells=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetDependentCells==null&&(n.sheetDependentCells=new HashTable),n.sheetDependentCells}return this._dependentCells==null&&(this._dependentCells=new HashTable),this._dependentCells};this.getDependentFormulaCells=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetDependentFormulaCells==null&&(n.sheetDependentFormulaCells=new HashTable),n.sheetDependentFormulaCells}return this._dependentFormulaCells==null&&(this._dependentFormulaCells=new HashTable),this._dependentFormulaCells};this.getEnableLookupTableCaching=function(){return this._enableLookupTableCaching};this.setEnableLookupTableCaching=function(n){this._enableLookupTableCaching=n};this.getErrorStrings=function(){return this._errorStrings==null&&(this._errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!"]),this._errorStrings};this.setErrorStrings=function(n){this._errorStrings=n};this.getExcelLikeComputations=function(){return this._excelLikeComputations};this.setExcelLikeComputations=function(n){this._excelLikeComputations=n};this.getForceRefreshCall=function(){return this._forceRefreshCall};this.setForceRefreshCall=function(n){this._forceRefreshCall=n};this.getFormulaCharacter=function(){return CalcEngine._formulaChar=='\0'&&(CalcEngine._formulaChar="="),CalcEngine._formulaChar};this.setFormulaCharacter=function(n){CalcEngine._formulaChar=n};this.getFormulaInfoTable=function(){if(this.isSheetMember()){var n=CalcEngine.getSheetFamilyItem(this.grid);return n.sheetFormulaInfoTable==null&&(n.sheetFormulaInfoTable=new HashTable),n.sheetFormulaInfoTable}return this._formulaInfoTable==null&&(this._formulaInfoTable=new HashTable),this._formulaInfoTable};this.getPreserveLeadingZeros=function(){return this._preserveLeadingZeros};this.setPreserveLeadingZeros=function(n){this._preserveLeadingZeros=n};this.getIterationMaxCount=function(){return this._iterationMaxCount};this.setIterationMaxCount=function(n){this._iterationMaxCount=n;this._iterationMaxCount>0&&this.setThrowCircularException(!0)};this.getIterationMaxTolerance=function(){return this._iterationMaxTolerance};this.setIterationMaxTolerance=function(n){this._iterationMaxTolerance=n};this.getIterationValues=function(){return this._iterationValues==null&&(this._iterationValues=new HashTable),this._iterationValues};this.getLibraryComputationException=function(){return this._libraryComputationException};this.getLibraryFunctions=function(){return this._libraryFunctions};this.getLockDependencies=function(){return this._lockDependencies};this.setLockDependencies=function(n){this._lockDependencies=n};this.getMaximumRecursiveCalls=function(){return this._maximumRecursiveCalls};this.setMaximumRecursiveCalls=function(n){this._maximumRecursiveCalls=n};this.getNamedRanges=function(){return this.namedRanges==null&&(this.namedRanges=new HashTable,this._namedRangesNonScoped=new HashTable),this.namedRanges};this.setNamedRanges=function(n){this.namedRanges=n;this._populateNamedRangesNonScoped()};this.getUndefinedNamedRanges=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.undefinedsheetNamedRnages==null&&(this.undefinedsheetNamedRnages=new HashTable),this.undefinedsheetNamedRnages):(this.undefinednamedRange==null&&(this.undefinednamedRange=new HashTable),this.undefinednamedRange)};this.getNameRangeValues=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.namedRangeValues==null&&(this.namedRangeValues=new HashTable),this.namedRangeValues):(this.rangeValues==null&&(this.rangeValues=new HashTable),this.rangeValues)};this.getNamedRangesOriginalNames=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetNamedRangesOriginalNames==null&&(this.sheetNamedRangesOriginalNames=new HashTable),this.sheetNamedRangesOriginalNames):(this.namedRangesOriginalNames==null&&(this.namedRangesOriginalNames=new HashTable),this.namedRangesOriginalNames)};this.getNamedRangeCellCollection=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetNamedRangeCellCollection==null&&(this.sheetNamedRangeCellCollection=new HashTable),this.sheetNamedRangeCellCollection):(this.namerangecellcollection==null&&(this.namerangecellcollection=new HashTable),this.namerangecellcollection)};this.getDependentNamedRangeCells=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null||n!=undefined?(this.sheetDependentNamedRangeCells==null&&(this.sheetDependentNamedRangeCells=new HashTable),this.sheetDependentNamedRangeCells):(this.dependentNamedRangeCells==null&&(this.dependentNamedRangeCells=new HashTable),this.dependentNamedRangeCells)};this.getParseArgumentSeparator=function(){this._parseArgumentSeparator=='\0'&&(this._parseArgumentSeparator=",");var n=",";return this._isParseArgumentSeparator||n==this._parseArgumentSeparator||(this._parseArgumentSeparator=n),this._parseArgumentSeparator};this.setParseArgumentSeparator=function(n){this._parseArgumentSeparator=n;this._isParseArgumentSeparator=!0};this.getParseDateTimeSeparator=function(){return this._parseDateTimeSeparator};this.setParseDateTimeSeparator=function(n){this._parseDateTimeSeparator=n};this.getParseDecimalSeparator=function(){this._parseDecimalSeparator=='\0'&&(this._parseDecimalSeparator=".");var n=".";return this._isParseDecimalSeparatorChanged||n==this._parseDecimalSeparator||(this._parseDecimalSeparator=n),this._parseDecimalSeparator};this.setParseDecimalSeparator=function(n){this._parseDecimalSeparator=n;this._isParseDecimalSeparatorChanged=!0};this.getPreserveFormula=function(){return this._preserveFormula};this.setPreserveFormula=function(n){this._preserveFormula=n};this.getReservedWordOperators=function(){return this._reservedWordOperators==null&&(this._reservedWordOperators=[" or "," and "," xor ","if "," then "," else ","not "]),this._reservedWordOperators};this.setReservedWordOperators=function(n){this._reservedWordOperators=n};this.getRethrowLibraryComputationExceptions=function(){return this._rethrowLibraryComputationExceptions};this.setRethrowLibraryComputationExceptions=function(n){this._rethrowLibraryComputationExceptions=n};this.getRethrowParseExceptions=function(){return this._rethrowExceptions};this.setRethrowParseExceptions=function(n){this._rethrowExceptions=n};this.getRowMaxCount=function(){return this._rowMaxCount};this.setRowMaxCount=function(n){this._rowMaxCount=n};this.getSortedSheetNames=function(){var n=CalcEngine.getSheetFamilyItem(this.grid);return n!=null&&n.sheetNameToToken!=null&&(this._sortedSheetNames=n.sheetNameToToken.keys(),this._sortedSheetNames.sort()),this._sortedSheetNames};this.getSupportLogicalOperators=function(){return this._supportLogicalOperators};this.setSupportLogicalOperators=function(n){this._supportLogicalOperators=n};this.getSupportRangeOperands=function(){return this._supportRangeOperands};this.setSupportRangeOperands=function(n){this._supportRangeOperands=n};this.getSupportsSheetRanges=function(){return this._supportsSheetRanges};this.setSupportsSheetRanges=function(n){this._supportsSheetRanges=n};this.getThrowCircularException=function(){return this._throwCircularException};this.setThrowCircularException=function(n){this._throwCircularException=n};this.getTreatStringsAsZero=function(){return this._treatStringsAsZero};this.setTreatStringsAsZero=function(n){this._treatStringsAsZero=n};this.getUseDatesInCalculations=function(){return this._useDatesInCalcs};this.setUseDatesInCalculations=function(n){this._useDatesInCalcs=n};this.getUseDependencies=function(){return this._useDependencies};this.setUseDependencies=function(n){this._useDependencies=n};this.getUseFormulaValues=function(){return this._useFormulaValues};this.setUseFormulaValues=function(n){this._useFormulaValues=n};this.getUseNoAmpersandQuotes=function(){return this._useNoAmpersandQuotes};this.setUseNoAmpersandQuotes=function(n){this._useNoAmpersandQuotes=n};this.getValidPrecedingChars=function(){return this._validPrecedingChar+this.getParseArgumentSeparator()};this.setValidPrecedingChars=function(n){this._validPrecedingChars=n};this.getEnableFormulaErrorValidation=function(){return this._enableFormulaErrorValidation};this.setEnableFormulaErrorValidation=function(n){this._enableFormulaErrorValidation=n};this.getWeekEndType=function(){return["","6,0","0,1","1,2","2,3","3,4","4,5","5,6","","","","0","1","2","3","4","5","6"]};this.computeSum=function(n){var e=0,t,i,u,l=this.splitArgsPreservingQuotedCommas(n),s,o,f,r,h,a,c;if(!n||n.length==0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(s)>-1))return s;for(o=0;o-1){if(u.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}for(f=this.getCellsFromArgs(u),r=0;r-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}}catch(v){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(t!=""){if(i=t==this.trueValueStr?!0:t==this.falseValueStr?!1:this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}ej.isNullOrUndefined(ej.cultureObject)||ej.cultureObject.name=="en-US"||(i=ej.isNullOrUndefined(t)?NaN:ej.parseFloat(t.toString(),0,ej.cultureObject.name));isNaN(i)?t="":e=e+i}}}else{try{if(u.startsWith(this.tic)&&isNaN(this._parseDouble(u))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=this.getValueFromArg(u).split(this.tic).join(""),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t}}catch(v){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return v}if(t.length>0){if(i=t==this.trueValueStr?!0:t==this.falseValueStr?!1:this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1)return t;ej.isNullOrUndefined(ej.cultureObject)||ej.cultureObject.name=="en-US"||(i=ej.isNullOrUndefined(t)?NaN:ej.parseFloat(t.toString(),0,ej.cultureObject.name));isNaN(i)||(e=e+i)}}return e.toString()};this.computeDate=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,s,r,i,o;if(h!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;for(r=0;r12)f-=12,u++;e=this._getSerialDateFromDate(u,f,c)}if(e==0){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return this._excelLikeComputations&&(i=this._fromOADate(e),i.toString()!="Invalid Date")?(o=ej.browserInfo(),o.name!="msie"&&o.name!="mozilla"&&!ej.isNullOrUndefined(o.name)&&this._isInteriorFunction?i.toLocaleDateString():_calculateDate(i.getMonth()+1)+"/"+_calculateDate(i.getDate())+"/"+i.getFullYear()):e.toString()};this.computeDatevalue=function(n){var f=this.splitArgsPreservingQuotedCommas(n),s=f.length,h,i,e,t,u;if(s!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(h)>-1))return h;if(this._isCellReference(n)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=new Date(Date.parse(f[0]));e=this._parseDouble(f[0]);try{if(!isNaN(e)||i.toString()=="Invalid Date")if(e>0)i=this._fromOADate(e);else{var r=n.split(this.getParseDateTimeSeparator()),s=r.length,o="";for(t=0;t59&&(u+=1),Math.round(u).toString()};this.computeDay=function(n){var e=this.splitArgsPreservingQuotedCommas(n),i,t;if(e.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;var r=1,f=this.getValueFromArg(n).split(this.tic).join(""),u=this._parseDouble(f);if(isNaN(u))if(t=new Date(Date.parse(f)),t.toString()!="Invalid Date")r=t.getDate();else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}else{if(u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}t=this._getDateFromSerialDate(u);r=t.getDate()}return r.toString()};this.computeDays=function(n){var l=n,r=this.splitArgsPreservingQuotedCommas(n),u,t,i,o,s,f,e,h,c;if(r.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)?u:(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("").toUpperCase()=="TRUE"?"1":t.split(this.tic).join("").toUpperCase()=="FALSE"?"0":t,i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("").toUpperCase()=="TRUE"?"1":i.split(this.tic).join("").toUpperCase()=="FALSE"?"0":i,t=t==""||t==null?new Date(Date.parse("1899-12-31")).toDateString():t,i=i==""||i==null?new Date(Date.parse("1899-12-31")).toDateString():i,f=this._parseDouble(t.split(this.tic).join("")),e=this._parseDouble(i.split(this.tic).join("")),o=isNaN(f)?new Date(Date.parse(t)):this._getDateFromSerialDate(f),s=isNaN(e)?new Date(Date.parse(i)):this._getDateFromSerialDate(e),h=o.getTime()-s.getTime(),c=Math.ceil(h/864e5),c.toString())};this.computeDays360=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,s,l,a,y;if(o!=2&&o!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(s)>-1))return s;var v=!1,u=0,i=new Date(Date.parse(this.getValueFromArg(r[0]).split(this.tic).join(""))),t=new Date(Date.parse(this.getValueFromArg(r[1]).split(this.tic).join(""))),h=this.getValueFromArg(r[0]),c=this.getValueFromArg(r[1]),f=h.split(this.tic).join("").toUpperCase()=="TRUE"?"1":h.split(this.tic).join("").toUpperCase()=="FALSE"?"0":h,e=c.split(this.tic).join("").toUpperCase()=="TRUE"?"1":c.split(this.tic).join("").toUpperCase()=="FALSE"?"0":c;if(f=this._parseDouble(f.split(this.tic).join("")),e=this._parseDouble(e.split(this.tic).join("")),isNaN(f)&&isNaN(this._isDate(i))||isNaN(e)&&isNaN(this._isDate(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}return i=f>0?this._getDateFromSerialDate(f):i,t=e>0?this._getDateFromSerialDate(e):t,l=!1,a=this.falseValueStr,o==3&&(a=this.getValueFromArg(r[2])),v=a==this.trueValueStr?!0:!1,i.getDate()==31&&(i=new Date(i.setDate(i.getDate()-1))),t.getDate()==31&&!v&&i.getDate()<30?t=new Date(t.setDate(t.getDate()+1)):t.getDate()==31&&(t=new Date(t.setDate(t.getDate()-1))),t-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;var u=this.getValueFromArg(i[0]).split(this.tic).join(""),y=parseInt(u),t=isNaN(u)?new Date(Date.parse(u)):this._fromOADate(parseInt(u)),h=this.getValueFromArg(i[1]).split(this.tic).join(""),c=parseInt(h);if(t.toString()=="Invalid Date"&&isNaN(c))try{var o=new Date(Date.now()),s=this._parseDouble(u),f=parseInt(h);if(f<0&&f-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;var f=this.getValueFromArg(i[0]).split(this.tic).join(""),t=new Date(f),u=this._parseDouble(this.getValueFromArg(i[1]).split(this.TIC).join(""));if(t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(isNaN(u))try{if(c=new Date(Date.now()),e=parseInt(f),u=this._parseDouble(this.getValueFromArg(i[1]).split(this.tic).join("")),u<0&&e<=0&&u9999&&(t=this._fromOADate(o)),t=new Date(t.setMonth(t.getMonth()+u)),s=new Date(t.getFullYear(),t.getMonth()+1,1,-1).getDate(),t=new Date(t.getFullYear(),t.getMonth(),s),this.getExcelLikeComputations()?t.toLocaleDateString():this._getSerialDateTimeFromDate(t).toString()};this.computeHour=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t,i,r,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=new Date(Date.now()),this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n=="TRUE"?"1":n=="FALSE"?"0":n,t=new Date(Date.parse(n)),r=parseInt(n),r<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(u=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(u))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getHours().toString()};this.computeISOWeeknum=function(n){var i=this.splitArgsPreservingQuotedCommas(n),h=i.length,u,r,t,e,o,s;if(h!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1))return u;if(r=this.getValueFromArg(i[0]),r[0]==this.tic&&this._isTextEmpty(r.split(this.tic).join(""))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}this._isTextEmpty(r)&&(n=this.computeDatevalue(new Date(1990,12,28).toLocaleDateString()));(n.indexOf(":")>-1||!this._isCellReference(this.getValueFromArg(i[0]))&&this.getValueFromArg(this.DateFormatter(i[0])).indexOf(":")>-1)&&(n="0");t=this.getValueFromArg(i[0]).split(this.tic).join("");t=t.split(this.tic).join("").toUpperCase()=="TRUE"?"1":t.split(this.tic).join("").toUpperCase()=="FALSE"?"0":t;var l=new Date(t),c=this.DateFormatter(t),f=new Date(Date.parse(c)),a=this.dateTime1900;if(f.toString()=="Invalid Date")try{e=parseInt(t);f=this._fromOADate(e);t=f.toLocaleDateString()}catch(v){if(this.getRethrowLibraryComputationExceptions())throw"Bad Cell reference";return this.getErrorStrings()[1].toString()}return o=n+this.getParseArgumentSeparator()+"21",s=parseInt(this.computeWeeknum(o))-1,s.toString()};this.DateFormatter=function(n){var r=new Date(n),t=r.getDate(),i=r.getMonth()+1,u=r.getFullYear(),n;return t<10&&(t=+t),i<10&&(i=i),i+"/"+t+"/"+u};this.computeMinute=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,t,r;if(u.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(t=new Date(Date.now()),n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=new Date(Date.parse(n)),n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(r=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(r))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getMinutes().toString()};this.computeMonth=function(n){var r=1,o=this.splitArgsPreservingQuotedCommas(n),e,i,t,u,f;if(o.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(e)>-1))return e;if(i=this.getValueFromArg(n),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=new Date(Date.parse(i.split(this.tic).join(""))),u=this._parseDouble(i),!isNaN(u)&&t.getFullYear()>9999&&(t=this._fromOADate(u)),i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(t=this._fromOADate(u)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(t.toString()!="Invalid Date")r=t.getMonth()+1;else{if(f=this._parseDouble(this.getValueFromArg(n)),isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];f<1?r=1:(t=this._getDateFromSerialDate(f),r=t.getMonth()+1)}return r.toString()};this.computeNetworkDays=function(n){var h=this.splitArgsPreservingQuotedCommas(n),y=h.length,c,f,t,e=[],p,o,s,u,k,l,w,a,rt;if(y!=2&&y!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(p=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(p)>-1))return p;if(o=this.getValueFromArg(h[0]).split(this.tic).join(""),s=this.getValueFromArg(h[1]).split(this.tic).join(""),o==""||s==""){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}var i=new Date(Date.parse(o)),r=new Date(Date.parse(s)),u=this._parseDouble(o);if(!isNaN(u)&&i.getFullYear()>9999&&(i=this._fromOADate(u)),i.toString()=="Invalid Date"&&(i=this._fromOADate(u)),i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(u=this._parseDouble(s),!isNaN(u)&&r.getFullYear()>9999&&(r=this._fromOADate(u)),r.toString()=="Invalid Date"&&(r=this._fromOADate(u)),r.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(y==3)if(c=h[2],c.indexOf(":")>-1)for(k=this.getCellsFromArgs(c),l=0;li&&t0&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&e.indexOf(t)==-1&&t>i&&t4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(c=0;c-1))return e;if(u>=3&&(e=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e}if(l=this.getValueFromArg(i[0]).split(this.tic).join(""),a=this.getValueFromArg(i[1]).split(this.tic).join(""),l==""||a==""){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(o=new Date(Date.parse(this._fromOADate(l))),v=new Date(Date.parse(this._fromOADate(a))),o.toString()=="Invalid Date"){if(s=this._parseDouble(l),isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}o=this.fromOADate(s)}if(v.toString()=="Invalid Date"){if(s=this._parseDouble(a),isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}v=this._fromOADate(s)}if(u==4)if(r=i[3],r=this.adjustRangeArg(r),r.indexOf(":")>-1||r.indexOf(",")>-1)for(b=this.getCellsFromArgs(r),w=0;wo&&t>v&&t.getDay()!=0&&t.getDay()!=6&&h.push(t))}else{try{f=this.getValueFromArg(r).split(this.tic).join("")}catch(d){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return d}f.length>0&&(t=new Date(Date.parse(f)),t.toString()!="Invalid Date"&&h.indexOf(t)==-1&&t>o&&t2&&!isNaN(y)){if(isNaN(i[2])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}y=parseInt(i[2])}else y=1;for(var it=this._splitArguments(this.getWeekEndType()[y].toString(),","),g=parseInt(this.computeDatevalue(a))-parseInt(this.computeDatevalue(l))+1,k=g,nt=1,p=o;nt=0?k--:h.indexOf(p)>=0&&k--,p=new Date(p.setDate(p.getDate()+1)),nt++;return k.toString()};this.computeNow=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,t,i;if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return(t=new Date(Date.now()),this.getExcelLikeComputations())?(i=ej.browserInfo(),i.name!="msie"&&i.name!="mozilla"&&!ej.isNullOrUndefined(i.name)&&this._isInteriorFunction?t.toLocaleDateString():t.getFullYear()+"/"+_calculateDate(t.getMonth()+1)+"/"+_calculateDate(t.getDate())):this._toOADate(t).toString()};this.computeSecond=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,t,r;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Date),this.getErrorStrings().indexOf(i)>-1))return i;if(t=new Date(Date.now()),n=this.getValueFromArg(n),n=n.split(this.tic).join(""),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=new Date(Date.parse(n)),n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(t.toString()=="Invalid Date"&&(r=new Date(Date.now()).toLocaleDateString()+" "+n,t=new Date(Date.parse(r))),t.toString()=="Invalid Date"&&(t=this._fromOADate(n)),t.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getSeconds().toString()};this.computeTime=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,r,o;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;t[0]=this.getValueFromArg(t[0]);t[1]=this.getValueFromArg(t[1]);t[2]=this.getValueFromArg(t[2]);t[0]=t[0]==""?"0":t[0];t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0];t[1]=t[1]==""?"0":t[1];t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1];t[2]=t[2]==""?"0":t[2];t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2];var u=this._parseDouble(t[0]),f=this._parseDouble(t[1]),e=this._parseDouble(t[2]),i=0;if(isNaN(u)||isNaN(f)||isNaN(e)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(i=(3600*u+60*f+e)/86400,o=new Date(Date.now()).toLocaleDateString()+" "+i,dt=new Date(Date.parse(o)),i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}return i.toString()};this.computeTimevalue=function(n){var u=this.splitArgsPreservingQuotedCommas(n),o=u.length,r,f,t,i,e;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]).split(this.tic).join(""),t=t.split(this.tic).join(""),t.indexOf(":")>-1&&(f=new Date,t=f.toLocaleDateString()+" "+t),i=new Date(Date.parse(t)),i.toString()=="Invalid Date"&&(n=new Date(Date.now()).toLocaleDateString()+" "+n,i=new Date(Date.parse(n))),i.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return e=(3600*i.getHours()+60*i.getMinutes()+i.getSeconds())/86400,e.toString()};this.computeToday=function(n){var t,i;if(n!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return t=new Date(Date.now()),this.getExcelLikeComputations()?(i=ej.browserInfo(),i.name!="msie"&&i.name!="mozilla"&&!ej.isNullOrUndefined(i.name)&&this._isInteriorFunction?t.toLocaleDateString():t.getFullYear()+"/"+_calculateDate(t.getMonth()+1)+"/"+_calculateDate(t.getDate())):this._toOADate(t).toString()};this.computeWeekday=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,o,s,i,r,f,h,u;if(e!=1&&e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(o)>-1)?o:t.length==2&&this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)?s:(i=this.getValueFromArg(t[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,r=new Date(Date.parse(i.split(this.tic).join(""))),f=this._parseDouble(i),!isNaN(f)&&r.getFullYear()>9999&&(r=this._fromOADate(f)),t[1]=e==2?t[1]:"1",r.toString()=="Invalid Date"&&(r=this._fromOADate(f)),h=parseInt(this.getValueFromArg(t[1])),u=r.getDay(),h==1?u+=1:(u==0&&(u=7),h==3&&(u-=1)),u.toString())};this.computeWeeknum=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,u,r,h,i;if(e>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)||e==2&&(u=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)))return u;if(t[0]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}this._fromOADate(this.DateFormatter(this.getValueFromArg(t[0]).split(this.tic).join("")))=="Invalid Date"?(r=this.getValueFromArg(t[0]).split(this.tic).join(""),r=this._fromOADate(r)):r=this.DateFormatter(this.getValueFromArg(t[0]).split(this.tic).join(""));var p=parseInt(r),w=new Date(r),o=new Date(Date.parse(r));if(o.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(h=["","0","1","","","","","","","","","1","2","3","4","5","6","0","","","","1"],e!=2?i=1:(i=this.getValueFromArg(t[1]),i==""&&(i=1)),Boolean(i=="TRUE"||i=="FALSE")){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}!isNaN(i);var f=parseInt(h[i]),c=new Date(o.getFullYear(),0,1),s=c.getDate(),l=s3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(r=0;r-1))return i;if(i=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)return i}if(t[0]==""||t[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(o="",s=0,o=f==3?t[0]+this.getParseArgumentSeparator()+t[1]+this.getParseArgumentSeparator()+"1"+this.getParseArgumentSeparator()+t[2]:t[0]+this.getParseArgumentSeparator()+t[1]+this.getParseArgumentSeparator()+"1",u=this.computeWorkDayOintl(o),e=new Date(Date.parse(this._fromOADate(u).toString())),isNaN(Date.parse(u))&&parseInt(u)&&(e=this._fromOADate(u)),e.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return this._toOADate(e).toString()};this.computeWorkDayOintl=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,u,a,b,v,i,l,p;if(o>4||o<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t[0]==""||t[1]==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)||(u=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)||o>=3&&(u=this.formulaErrorStringCheck(t[2],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)||o==4&&(u=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Date),this.getErrorStrings().indexOf(u)>-1)))return u;var e,f,s=[],c=this.getValueFromArg(t[0]).split(this.tic).join(""),h=new Date(Date.parse(c)),w=this.getValueFromArg(t[1]).split(this.tic).join(""),d;if(!isNaN(Date.parse(c))&&parseInt(c)&&(h=this._fromOADate(c)),isNaN(w)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(d=this._toOADate(h)+w,c.split(this.tic).join("")==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if(h.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(a=parseInt(w.toString()),o==4)if(e=t[3],e=this.adjustRangeArg(e),e.indexOf(":")>-1||e.indexOf(",")>-1)for(b=this.getCellsFromArgs(e),v=0;vh&&s.push(i.toString()))}else{try{f=this.getValueFromArg(e).split(this.tic).join("")}catch(nt){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}f!=""&&(i=new Date(Date.parse(f)),isNaN(Date.parse(f))&&parseInt(f)&&(i=this._fromOADate(f)),i.toString()!="Invalid Date"&&s.indexOf(i)==-1&&i>h&&s.push(i))}if(l=parseInt(t[2]),o>2&&!isNaN(l)||(l=1),l==0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}var k=this._splitArguments(_weekEndType[l].toString(),","),y=0,r=h;if(a<0)while(y>a)r=new Date(r.setDate(r.getDate()-1)),p=r.getDay(),k.indexOf(p.toString())<0&&s.indexOf(r)<0&&y--;else while(y-1))return f;t=this.getValueFromArg(u[0]).split(this.tic).join("");t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;var i=parseInt(t),r=new Date(Date.parse(i)),e=ej.browserInfo();if(isNaN(Date.parse(i))&&(e.name=="msie"||e.name=="mozilla"||ej.isNullOrUndefined(e.name))&&(o=u[0].split(this.tic),r=new Date(o[1])),!isNaN(i)&&r.getFullYear()>9999&&(r=this._fromOADate(t)),i==0)return"1900";if(i<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}if(t.toString().split(this.tic).join("")==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if(r.toString()=="Invalid Date"){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return r.getFullYear().toString()};this.computeChar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,r,t,i;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(u[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),!isNaN(i)&&i>0&&i<256)return String.fromCharCode(t);if(this.getRethrowLibraryComputationExceptions())throw this.getLibraryComputationException();return this._errorStrings[1].toString()};this.computeCode=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e=i.length,r,t,u,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]).split(this.tic).join(""),u=parseInt(t),!isNaN(u))return t.charCodeAt(0).toString();if(t==null||t==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return i[0].length>4?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return f=t,f.charCodeAt(0).toString()};this.computeUniCode=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,r,t,e,u;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),this._isCellReference(i[0])){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(e=this._parseDouble(t),t=="invalid expression"||t==null||t==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return u=t.split(this.tic).join("").charCodeAt(0),u.toString()};this.computeUpper=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(t)>-1)?t:this._stripTics0(this.getValueFromArg(n)).toUpperCase()};this.computeLower=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(t)>-1)?t:this._stripTics0(this.getValueFromArg(n)).toLowerCase()};this.computeLen=function(n){var f=this.splitArgsPreservingQuotedCommas(n),l=f.length,o,s,h,r,c,u;if((l!=1||n=="")&&!this._isArrayFormula){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var t=f[0],i="",e=0;if(this._isArrayFormula){if(o=this._computeArrayInteriorFunction(n,"LEN",this.computeFunctionLevel),o!=this._string_empty)return o;t.indexOf(":")>-1&&(t=this.getCellsFromArgs(t)[0])}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s;if(t.indexOf(":")>-1&&t.indexOf(":")>2)for(h=this.getCellsFromArgs(t),r=0;r-1)||(r=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)||(r=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1)))return r;t=i[0];t=this.getValueFromArg(t);var f=t[0]==this.tic&&t[t.length-1]==this.tic,e=this.getValueFromArg(i[1]),o=this._parseDouble(i[2]);if(e=this.getValueFromArg(i[1]),u=Number(e)+Number(f?0:-1),e==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return i[1].indexOf("#VALUE!")>-1?"#VALUE!":Number(u)>t.length?"":(t=u+o>t.length?t.substring(u):this._substring(t,u,o),f&&t[0]!=this.tic&&(t=this.tic+t),f&&t&&(t=t+this.tic),this._stripTics0(t))};this.computeLeft=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,e,t,o,i,r;if(f!=1&&f!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this._stripTics0(this.getValueFromArg(u[0])),!this._isCellReference(u[0])&&t.indexOf(this.tic)>-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return(o=t[0]==this.tic&&t[t.length-1]==this.tic,i=f==2?u[1]:"1",i=this._stripTics0(i),i=this.computedValue(i),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,r=Number(i)+Number(o?1:0),r=t.length>=r?r:t.length,r=t.length>=r?r:t.length,r<0)?this.getErrorStrings()[1].toString():(r==0?t="":(t=t.substring(0,r),o&&t[t.length-1]!=this.tic&&(t=t+this.tic)),this.getUseNoAmpersandQuotes()&&t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]&&(t=this._substring(t,1,t.length-2)),t)};this.computeRight=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,f,e,i,t,o;if(u!=1&&u!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(f)>-1))return f;if(s1=this._stripTics0(this.getValueFromArg(r[0])),!this._isCellReference(r[0])&&r[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return(e=s1[0]==this.tic&&s1[s1.length-1]==this.tic,i=u==2?this.getValueFromArg(r[1]):"1",i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=parseInt(this._stripTics0(i)),isNaN(t)||t<0||i.indexOf("#VALUE!")>-1)?"#VALUE!":t==0?"":(t=Number(t)+Number(e?1:0),o=s1.length>=t?s1.length-t:0,s1=s1.substring(o),e&&s1[0]!=this.tic&&(s1=this.tic+s1),s1)};this.computeReplace=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,s,h,i,o;if(c!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1)return s;if(h=this.formulaErrorStringCheck(r[3],FormulaArgumentType.Text),this.getErrorStrings().indexOf(h)>-1)return h}var u=this._stripTics0(this.getValueFromArg(r[0])),f=this._stripTics0(this.getValueFromArg(r[3])),e="",t=this.getValueFromArg(r[1]);if(t=t=="TRUE"?"1":t=="FALSE"?"0":t,t=this._parseDouble(t),i=this.getValueFromArg(r[2]),i=i=="TRUE"?"1":i=="FALSE"?"0":i,i=this._parseDouble(i),!this._isCellReference(r[0])&&r[0][0]!=this.tic||!this._isCellReference(r[3])&&r[3][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(t==0&&i==0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();if(isNaN(t)||isNaN(i))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();else try{if(o="",u==null||u=="")return f;u.length<=t&&t>i?e=u+f:u.length<=t?(o=u,e=u.split(o).join(f)):i==0?e=f+u:(o=this._substring(u,t-1,i),e=u.split(o).join(f))}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString()}return e};this.computeExact=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u,t,i,f,e;if(r.length!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)?u:(t=this.getValueFromArg(r[0]),i=this.getValueFromArg(r[1]),f=this._parseDouble(t),e=this._parseDouble(i),isNaN(f)||(t=f.toString()),isNaN(e)||(i=e.toString()),t.split(this.tic).join("")==i.split(this.tic).join("")?"TRUE":"FALSE")};this.computeFind=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r,e,u;if(t.length!=2&&t.length!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.TwoTextWithNumber),this.getErrorStrings().indexOf(r)>-1))return r;var o=this._stripTics0(this.getValueFromArg(t[0])),f=this._stripTics0(this.getValueFromArg(t[1])),i=1;return(t.length==3&&(e=this.getValueFromArg(t[2]),i=this._parseDouble(e),isNaN(i)&&(i=1)),i<=0||i>f.length)?"#VALUE!":(u=f.indexOf(o,i-1),u<0)?"#VALUE!":(Number(u)+Number(1)).toString()};this.computeSearch=function(n){var u=this.splitArgsPreservingQuotedCommas(n),s=u.length,o,e=1,h,t,r,i,c,f;if(s!=2&&s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.TwoTextWithNumber),this.getErrorStrings().indexOf(h)>-1))return h;if(t=this._stripTics0(this.getValueFromArg(u[0])).toUpperCase(),r=this._stripTics0(this.getValueFromArg(u[1])).toUpperCase(),!this._isCellReference(u[0])&&u[0][0]!=this.tic||!this._isCellReference(u[1])&&u[1][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(i=t,t.indexOf("*")>-1)t=t.split("*").join("")[0].toString();else if(t.indexOf("?")>-1){for(c=i.substring(0,i.indexOf("?")),f=Number(r.indexOf(c));r.indexOf(i)==-1;)for(f=Number(r.substring(f).indexOf(c))+Number(f)+1,i=t;i.indexOf("?")!=-1;){if(r.length<=f)return this.getErrorStrings()[1].toString();i=i.substring(0,i.indexOf("?"))+r[f]+t.substring(i.indexOf("?")+1);f++}t=i}if(o=Number(r.indexOf(t))+1,s==3){if(e=parseInt(this.getValueFromArg(u[2])),e==1&&t[0]==r[0])return e;if(!isNaN(e))try{o=Number(r.indexOf(t,e))+1}catch(l){return this.getErrorStrings()[1].toString()}}return o==0?this.getErrorStrings()[1].toString():o.toString()};this.computeSubstitute=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e,r,c,s,o,f;if(t.length!=3&&t.length!=4){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation())for(e=0;e<3;e++)if(r=this.formulaErrorStringCheck(t[e],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)return r;if(t.length==4&&this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;var i=this._stripTics0(this.getValueFromArg(t[0])),u=this._stripTics0(this.getValueFromArg(t[1])),h=this._stripTics0(this.getValueFromArg(t[2]));if(t.length==3){if(u==""||u==null)return i;i=i.split(u).join(h)}else{if(c=this.getValueFromArg(t[3]),!this._isCellReference(t[3])&&t[3][0]==this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(s=parseInt(c),!isNaN(s)){for(o=s,f=-1;o>0&&(f=i.indexOf(u,Number(f)+1))>-1;)o--;o==0&&(i=i.substring(0,f)+h+i.substring(Number(f)+Number(u.length)))}}return i};this.computeUniChar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,i,t,r,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(u[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(this._stripTics0(t)),isNaN(r)||r<=0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return t[0]==this.tic?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return f=String.fromCharCode(t),f.toString()};this.computeClean=function(n){var f=this.splitArgsPreservingQuotedCommas(n),r,i,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments].toString()}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;var t=this.getValueFromArg(f[0]),e=t=="TRUE"||t=="FALSE"?!0:!1;if(this.getErrorStrings().indexOf(t)>-1)return t;if(t.indexOf(this.tic)==-1&&!this._isCellReference(n)&&isNaN(this._parseDouble(t))&&!e)return this.getErrorStrings()[5].toString();for(i=0;i<=31;i++)u=this.computeChar(i.toString()),t.indexOf(u)>-1&&(t=t.replace(u,""));return t[0]==this.tic&&t[t.length-1]==this.tic&&(t=this._substring(t,1,t.length-1)),t};this.computeTrim=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i;if(u.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;for(var t=this._stripTics0(this.getValueFromArg(n)),f=[this.tic,""],r=0;t.length!=r;)r=t.length,t=t.split(" ").join(" ");return t};this.computeRept=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,s,u,i,e;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(f)>-1))return f;if(r=this._stripTics0(this.getValueFromArg(t[0])),s=1,t[1]=this.getValueFromArg(t[1].split(this.tic).join("")),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],r==null||r==""||t[1]==null||t[1]=="")return"";if(u=parseInt(t[1].split(this.tic).join("")),u<0||isNaN(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}for(i="",e=0;e32767){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}i=i.concat(r)}return i};this.computeProper=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,u,t,r;if(f!=1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(u=this.getValueFromArg(i[0]),!this._isCellReference(i[0])&&i[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return t=this._stripTics0(u),r=t.indexOf("'"),r>=0&&r64&&i<91);)t++,n[t]!=undefined?i=n[t].toUpperCase().charCodeAt(0):(t--,i=0);return n.substr(0,t)+n.charAt(t).toUpperCase()+n.substr(t+1).toLowerCase()}):/[a - zA - Z0 - 9] + $/.test(t)&&(t=t.replace(/[^a-zA-Z0-9_\\]/,"")),t};this.computeT=function(n){var r=0,u=this.splitArgsPreservingQuotedCommas(n),i,o,f,e;if(u.length>1)for(i=0;i-1)for(--r,o=this.getCellsFromArgs(i),f=0;f1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;var t=this.getValueFromArg(n),s=t=="TRUE"||t=="FALSE"?!0:!1;return isNaN(this._parseDouble(t))&&!s&&isNaN(this._isDate(t))?/[a-zA-Z0-9!#$%&'()*+,/:;<=>?@\^_`{|}~-]/.test(t)?this._stripTics0(t):" ":" "};this.computeNumberValue=function(n){var i=this.splitArgsPreservingQuotedCommas(n),l=i.length,f=this._parseDecimalSeparator,e=this._parseArgumentSeparator,o,t,r,u,s,h,c;if(l>3||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this._stripTics0(this.getValueFromArg(i[0])),l>1)try{if(r=i.length>1&&i[2]!=null?this._stripTics0(this.getValueFromArg(i[1])):e,u=i.length>1&&i[2]!=null?this._stripTics0(this.getValueFromArg(i[2])):f,r=="invalid expression"||u=="invalid expression"||(r==null||r=="")&&(u==null||u=="")){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}f=this._stripTics0(r)[0];e=this._stripTics0(u)[0]}catch(a){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==""||t==null)return"0";if(s=t.indexOf(f),h=t.indexOf(e),h>=s&&(s!=-1||h!=-1)&&i.length>2){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=t.replace(this.tic,""),t=t.replace(" ",""),t=t.replace(e.toString(),""),t=t.replace(f,this._parseDecimalSeparator),c=this.computeValue(t),isNaN(c)||t[t.length-1]=="$"){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return c};this.computeConcatenate=function(n){var i="",r=this.splitArgsPreservingQuotedCommas(n),u,t,f;if(!n||n.length==0){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1))return u;for(t=0;t-1&&(i="#N/A"),i};this.computeValue=function(n){var i="",r,h,f,e,o,s;try{if(r=this.splitArgsPreservingQuotedCommas(n),h=r.length,h!=1||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(f)>-1))return f;var t=r[0],u=!1,c=!1;if(t.indexOf(this.tic)>-1&&(u=!0),t=this._stripTics0(this.getValueFromArg(t)),(t!=null||t!="")&&!this._isCellReference(t)&&u&&isNaN(this._parseDouble(t.split(",").join("").split("$").join("")))&&(t=t.split(this.tic).join(""),c=!0),!this._isCellReference(r[0])&&r[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((t==null||t=="")&&u){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if((t==null||t=="")&&!u){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}if(t.indexOf(":")>-1)return i=this.computeTimevalue(t),i.toString();if(t[0]=="$"&&(t=t.split("$").join("")),t.indexOf(",")>-1&&(t=t.split(",").join("")),(t[0]=="%"||t[t.length-1]=="%")&&(t=t.split("%").join(""),e=this._parseDouble(t),isNaN(e)||(t=(e/100).toString())),o=new Date(Date.parse(t)),s=this._parseDouble(t),isNaN(s))if(o.toString()!="Invalid Date")i=this._toOADate(o);else{if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}else i=s.toString()}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return i.toString()};this.computeDollar=function(n){var u=this.splitArgsPreservingQuotedCommas(n),t=u[0],i="2",e,f,o,r,s,h;if(u.length==2&&(i=u[1]),u.length>2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(t),t=t==""||t==null?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(i),i=i==""||i==null?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f=this._parseDouble(t),o=!1,isNaN(this._parseDouble(i))){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((t==null||t=="")&&this._isCellReference(u[0])&&t[0]!=this.tic&&t[t.length-1]!=this.tic&&(f=0,o=!0),isNaN(f)&&!o){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return r=this._parseDouble(i),s=0,isNaN(r)&&(r=i==""?0:2),r>0?ej.format(f,"c"+r):(h=Math.pow(10,-r),s=Math.round(f/h)*h,ej.format(s,"c0"))};this.computeFixed=function(n){var f=this.splitArgsPreservingQuotedCommas(n),r=f[0],i="2",t="FALSE",s,h,e,u,c,o,l;if(f.length>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;if(h=f.length,h>1&&(i=f[1]),h>2&&(t=f[2]),r=this.getValueFromArg(r),i=this.getValueFromArg(i),t=this.getValueFromArg(t),r=r==""||r==null?"0":r,i=i==""||i==null?"0":i,t=t==""||t==null?"0":t,e=this._parseDouble(r),u=this._parseDouble(i),isNaN(u)&&(u=2),c=this._parseDouble(t),isNaN(c))if(t.toUpperCase()==this.falseValueStr)o=!1;else if(t.toUpperCase()==this.trueValueStr)o=!0;else return"#NAME?";else o=c==0?!1:!0;return o&&(ej.preferredCulture().numberFormat[","]=""),u>0?ej.format(e,"n"+u):(l=Math.pow(10,-u),e=Math.round(e/l)*l,ej.format(e,"n0"))};this.computeBin2Dec=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t,u;if(r.length>1||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(r[0]).split(this.tic).join(this._string_empty),!/^[01]{1,10}$/.test(t))return this.getErrorStrings()[4].toString();try{return t==""&&(t="0"),u=parseInt(t,2),t.length==10&&t.substring(0,1)=="1"?(parseInt(t.substring(1),2)-512).toString():u.toString()}catch(f){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}};this.computeBin2Oct=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t="",s,r,f,e,o,h,u;if(i.length>2||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];else i.length>1&&(places=parseInt(this.getValueFromArg(i[1]).split(this.tic).join("")));if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1))return s;if(r=this.getValueFromArg(i[0]).split(this.tic).join(""),!/^[01]{1,10}$/.test(r))return this.getErrorStrings()[4].toString();if(f=i.toString(),f.length==10&&f.substring(0,1)=="1"){for(e=10,o="",h=0;h<3;h++){e=e-3;var l=this._substring(f,e,3),a=this._parseDouble(parseInt(l,2).toString(8)),c=0;for(u=a;u>0;c+=parseInt(u%10),u=parseInt(u/10));o=c.toString()+o}return"7777777"+o}if(r<0)return(1073741824+r).toString(8);if(t=parseInt(r,2).toString(8),typeof places=="undefined")return t;if(isNaN(places))return"#VALUE!";if(places<0)return"#NUM!";if(places=Math.floor(places),places>=t.length&&places<=10)while(places-t.length>0)t="0"+t,places--;else if(this.getRethrowLibraryComputationExceptions())throw new Error("Parameter is not valid");else throw(new this.getErrorStrings)[4].toString();return t};this.computeBin2Hex=function(n){var u=0,r=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(r[0]).split(this.tic).join(this._string_empty),i="",f;if(r.length>2||n=="")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.formulaErrorStrings[this._wrong_number_arguments];else r.length>1&&(u=this._parseDouble(r[1]));if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(t=="1111111111")return t.replace("1","F");if(t.length==10&&t.substring(0,1)=="1")return(1073741312+parseInt(t,2).toString(8)).toString();try{if(t.length>10||this._parseDouble(t)<0||isNaN(t))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(i=parseInt(t,2).toString(16),i=="NaN"&&(i=this.getErrorStrings()[4].toString()),r.length>1)if(u>=i.length&&u<=10)i=this._padLeft("0",u,i);else if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else i=this.getErrorStrings()[4].toString()}catch(e){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else if(this.computeIsText(t)==this.trueValueStr)i=this.getErrorStrings()[5].toString();else return t==""?"0":this.getErrorStrings()[4].toString()}return i.toUpperCase()};this.computeDec2Bin=function(n){var f=0,i=this.splitArgsPreservingQuotedCommas(n),u="",e,t,r,o;if(n==null||n==""||i.length>2||i.length<1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(i[0]).split(this.tic).join(this._string_empty),r=i.length>1?this.getValueFromArg(i[1]).split(this.tic).join(this._string_empty):"10",isNaN(this._parseDouble(t))&&isNaN(this._parseDouble(r))){if((t!=null||t!="")&&this.computeIsText(t)==this.trueValueStr||(r!=null||r!="")&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t!=null&&t!=""&&this.computeIsText(t)==this.falseValueStr||t!=null&&t!=""&&this.computeIsText(r)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==null&&t==""||r==null||r==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}}try{if(i.length>1&&(o=this.getValueFromArg(i[1]).replace(this.tic,""),f=this._parseDouble(o)),isNaN(t)){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this._parseDouble(t)<-512||this._parseDouble(t)>511)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(u=(t>>>0).toString(2),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(u=u.substring(u.length-10)),i.length>1){if(f>10){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}f<=10&&(u=this._padLeft("0",f,u))}}catch(s){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}return u};this.computeDec2Oct=function(n){var f=0,u=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(u[0]).split(this.tic).join(this._string_empty),r=u.length>1?this.getValueFromArg(u[1]).replace(this.tic,""):"10",i="",e,o;if(n==null||n==""||u.length>2||u.length<1){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(!(!isNaN(this._parseDouble(t))&&!isNaN(this._parseDouble(r)))){if((t!=null||t!="")&&this.computeIsText(t)==this.trueValueStr||(r!=null||r!="")&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(t)>-1)return t;if(this.getErrorStrings().indexOf(r)>-1)return r;if(t!=null&&t!=""&&this.computeIsText(t)==this.falseValueStr||t!=null&&t!=""&&this.computeIsText(r)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t==null&&t==""||r==null||r==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[0].toString()}}try{if(u.length>1&&(o=this.getValueFromArg(u[1]).replace(this.tic,""),f=this._parseDouble(o)),this._parseDouble(t)<-536870912||this._parseDouble(t)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();else if(this._parseDouble(t)<0)i=parseInt(t>>>0,10).toString(8),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(i=i.substring(i.length-10));else if(i=parseInt(t,10).toString(8),!isNaN(this._parseDouble(t))&&this._parseDouble(t)<0&&(i=i.substring(i.length-10)),u.length>1){if(f>10){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}f<=10&&(i=this._padLeft("0",f,i))}}catch(s){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}return i};this.computeHex2Bin=function(n){var u=0,r=this.splitArgsPreservingQuotedCommas(n),s,h,i,o,c;if(r.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n==this._parseArgumentSeparator.toString())if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[0].toString();if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s;if(r.length==2&&this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var t=this.getValueFromArg(r[0]),f=r.length==2?this.getValueFromArg(r[1]):"0",e=0;if(e=this._parseDouble(f),!isNaN(e)&&(e<0||e>10)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(Boolean(t=="TRUE"||t=="FALSE")||r.length==2&&Boolean(f=="TRUE"||f=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t!=""){if(t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t)))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString()}else if(this._isCellReference(r[0])&&t=="")return"0";if(t[0]==this.tic&&(t.split(this.tic).join("")==null||t.split(this.tic).join("")==""))return"0";if(f[0]==this.tic)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[1].toString();else if(isNaN(this._parseDouble(f.split(this.tic).join(""))))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString();if(u=this._parseDouble(f),u<0||t[0]=="-")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();i="";t=t.split(this.tic).join("");try{for(o=0;o10||u>10||u=i.length)i=this._padLeft("0",u,i);else if(u!=0)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(!isNaN(this._parseDouble(i))&&this._parseDouble(i)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}catch(l){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}return i};this.computeHex2Oct=function(n){var u=0,i=this.splitArgsPreservingQuotedCommas(n),e,o,t,f,s,r;if(i.length>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n==this._parseArgumentSeparator.toString())if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[0].toString();if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(i.length==2&&this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this.getValueFromArg(i[0]),i[0]=i[0].split(this.TIC).join(""),f=i.length==2?this.getValueFromArg(i[1]):"0",t!=""&&t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5].toString()}if(Boolean(t=="TRUE"||t=="FALSE")||i.length==2&&Boolean(f=="TRUE"||f=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t[0]==this.tic&&(t.split(this.tic).join("")==null||t.split(this.tic).join("")==""))return"0";if(t.indexOf(this._parseArgumentSeparator.toString())>-1&&(s=t.indexOf(this._parseArgumentSeparator),t=t.split(this.tic).join("").substring(0,s-1)),r="",isNaN(this._parseDouble(f.split(this.tic).join(""))))if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[5].toString();if(u=this._parseDouble(f),u<0||t[0]=="-")if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(i.length>2)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();i.length>1&&(u=this._parseDouble(i[1]));try{if(t=t.split(this.tic).join(""),r=parseInt(t,16).toString(8),!isNaN(this._parseDouble(r))&&r.length>10&&(r=r.substring(r.length-10)),i.length>1){if(u>=r.length&&u<=10)r=this._padLeft("0",u,r);else if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString();if(!isNaN(this._parseDouble(r))&&this._parseDouble(r)>536870911)if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.getErrorStrings()[4].toString()}}catch(h){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();else return this.computeIsText(t)==this.trueValueStr?this.getErrorStrings()[4].toString():t==""?"0":this.getErrorStrings()[4].toString()}return r};this._padLeft=function(n,t,i){var u=i.length,r;if(i.length0)for(r=0;r5||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){for(c=0;c-1)return s;if(f==5&&(s=this.formulaErrorStringCheck(i[4],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1))return s}if(t=this._string_empty,r=this.getValueFromArg(i[0].split(this.tic).join(this._string_empty)),r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,e=this.getValueFromArg(i[1].split(this.tic).join(this._string_empty)),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,r==""||e==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(o=this._parseDouble(r),u=this._parseDouble(e),o<1||u<1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}var v=f>2?this.getValueFromArg(i[2].split(this.tic).join(this._string_empty)):"1",l=u,y=l%26;if(l=parseInt(l/26),t=t+this._charTable[y],t=t+this._charTable[parseInt(l)],a=t.split("").join(",").split(this.getParseArgumentSeparator()),a.reverse(),h=a.join(""),t="$"+h+"$"+r,f>2)switch(v){case"2":t=h+"$"+r;break;case"3":t="$"+h+r;break;case"4":t=h+r}if(f>3&&(this.getValueFromArg(i[3].split(this.tic).join(this._string_empty))=="FALSE"||this.getValueFromArg(i[3].split(this.tic).join(this._string_empty))=="0"))switch(v){case"":t="R"+o+"C"+u;break;case"1":t="R"+o+"C"+u;break;case"2":t="R"+o+"C["+u+"]";break;case"3":t="R["+o+"]C"+u;break;case"4":t="R["+o+"]C["+u+"]"}return f>4&&this.getValueFromArg(i[4].split(this.tic).join(this._string_empty))==this._string_empty&&(i[4]=this.getValueFromArg(i[4]),t=i[4].split(this.tic).join(this._string_empty)+"!"+t),t};this.computeAreas=function(n){var r,u,f,t,e,i;if(n.indexOf(" ")>0&&(n=n.substring(0,n.indexOf(" "))),!this._isCellReference(n)&&!this.getNamedRanges().containsKey(n)&&!n.indexOf(")")){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(r=this._splitArguments(n,")"),r.length>2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[1].toString()}if(u=r[0].split("(").join(this._string_empty),this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(u,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1))return f;for(t=this.splitArgsPreservingQuotedCommas(u),e=t.length,i=0;i-1))return u;if(i=this.getValueFromArg(t[0]).split(this.tic).join(""),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,e=this.splitArgsPreservingQuotedCommas(i),i=e[0],r=parseInt(i),isNaN(r)||r>t.length-1||r<1)return"#VALUE!";if(this._isInteriorFunction)return t[r];if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1))return u;if(f=this.getValueFromArg(t[r]),f==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return f};this.computeColumn=function(n){var t,u,i,r;if(n==null||n==this._string_empty)return this.colIndex(this.cell).toString();if(u=this.splitArgsPreservingQuotedCommas(n),u.length!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(n.indexOf(":")>-1&&this._isArrayFormula){if(r=this._computeArrayInteriorFunction(n,"COLUMN",this.copmuteFunctionLevel),r==this._string_empty)n=this.getCellsFromArgs(n)[0];else return r;n.indexOf(":")>-1&&(n=this.getCellsFromArgs(n)[0])}if(t=this.colIndex(n).toString(),t<=0||!isNaN(this._parseDouble(n))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return t};this.computeColumns=function(n){var t,e,o,s,h,i,u,f,r;if(t=this.splitArgsPreservingQuotedCommas(n),t.length!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1))return e;if(o=-1,this._parseDouble(t[0],o))return"1";if(t[0].indexOf(this.tic)&&!t[0].indexOf(";")&&!t[0].indexOf(this.getParseArgumentSeparator().toString())||!this._isCellReference(t[0])&&!this.getNamedRanges().containsValue(t[0])&&!n.indexOf(";")&&!n.indexOf(this.getParseArgumentSeparator().toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(i=1,n.indexOf(":")>-1)u=this.getCellsFromArgs(n),s=this.colIndex(u[0].toString()),h=this.colIndex(u[u.length-1].toString()),i=h-s+1,i=i>0?i:1;else if(n.indexOf(";")>-1)for(r=this._splitArguments(n.split(this.tic).join(this._string_empty),";"),f=1;f2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)?r:(f=this._stripTics0(this.getValueFromArg(i[0])),u==2)?(t=this._stripTics0(this.getValueFromArg(i[1])),t==null)?"0":t==this._string_empty?"0":t:f};this.computeAbs=function(n){var i=this.splitArgsPreservingQuotedCommas(n),f=i.length,r,t,u;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=ej.parseFloat(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.abs(u).toString()};this.computeAcos=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>1||i<-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return Math.acos(i).toString()};this.computeAcosh=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("").toUpperCase()=="TRUE"?"1":t.split(this.tic).join("").toUpperCase()=="FALSE"?"0":t,t=this._stripTics0(t),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(z=Math.log(i+Math.sqrt(i*i-1)),i<=0||z==Infinity){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return z.toString()};this.computeAcot=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,e,t,r;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(e=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(n),r=0,isNaN(t)||(r=t<=0?Math.PI/2-Math.atan(t):Math.atan(1/t)),r.toString())};this.computeAcoth=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e=f.length,r,t,i,u;if(e!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(f[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(i<1&&i>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(u=(Math.log((i+1)/(i-1))/2).toString(),this.computeIsErr(u)==this.trueValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return u};this.computeArabic=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,o,s;if(u.length!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(u[0]),this.getErrorStrings().indexOf(i)!=-1)return i;if(o=parseInt(i.split(this.tic).join("").toUpperCase()),!isNaN(o)||!this._isCellReference(u[0])&&u[0][0]!=this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return isNaN(o)?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}i=i.split(this.tic).join("").toUpperCase();var f=0,h=null,r=0,t=0,e=0;for(e=1e3,s=!1,f=1;f<=i.length;f++){h=this._substring(i,f-1,1);switch(h){case"-":s=!0;break;case"I":t=1;break;case"V":t=5;break;case"X":t=10;break;case"L":t=50;break;case"C":t=100;break;case"D":t=500;break;case"M":t=1e3;break;default:if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}r=t>e?r+t-2*e:r+t;e=t}return s&&(r=-r),r.toString()};this.computeAsin=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,u,t,i,f,e;if(o!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>1||i<-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=0,isNaN(f)||(e=Math.asin(f)),e.toString()};this.computeAtan=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.atan).toString())};this.computeAtan2=function(n){var f=this.splitArgsPreservingQuotedCommas(n),c=f.length,e,u,r,o,t,i,s,h;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(r=0,o=0,t=this.getValueFromArg(f[0]),i=this.getValueFromArg(f[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,s=t=="true"?!0:!1,h=i=="true"?!0:!1,s?t=s.toString():t==this._string_empty&&(t="0"),h?i=h.toString():i==this._string_empty&&(i="0"),this.getErrorStrings().indexOf(t)>-1)return t;if(this.getErrorStrings().indexOf(i)>-1)return i;if(u=this._parseDouble(t),r=this._parseDouble(i),isNaN(u)||isNaN(r))if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();else if(r==0&&u==0)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();else return this.getErrorStrings()[3].toString();return o=Math.atan2(r,u),o.toString()};this.computeCeilingMath=function(n){var e=this.splitArgsPreservingQuotedCommas(n),s=e.length,h,r,t,u,y;if(this._isTextEmpty(n)||s>3||s<1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;r=this.getValueFromArg(e[0]);r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r;t=s>1&&e[1].length!=0?this.getValueFromArg(e[1]):"1";t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;u=s==3&&e[2].length!=0?this.getValueFromArg(e[2]):"1";u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u;var i,f=-1,o=-1,c,l=!1,a=!1,v=!1;if(l=r.split(this.tic).join(this._string_empty)=="true"?!0:!1,a=t.split(this.tic).join(this._string_empty)=="true"?!0:!1,v=u.split(this.tic).join(this._string_empty)=="true"?!0:!1,r=l?l.toString():r,t=a?a.toString():t,u=v?v.toString():u,this.getErrorStrings().indexOf(r)!=-1)return r;if(this.getErrorStrings().indexOf(t)!=-1)return t;if(this.getErrorStrings().indexOf(u)!=-1)return u;if(t.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(t.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(i=this._parseDouble(r),f=this._parseDouble(t),o=this._parseDouble(u),isNaN(i)&&!isNaN(f)&&!isNaN(o)){if(i==0&&!this._isTextEmpty(r)&&this.computeIsText(r)==this.falseValueStr||f==0&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr||o==0&&!this._isTextEmpty(u)&&this.computeIsText(u)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(r.split(this.tic).join(this._string_empty))&&r[0]==this.tic||this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[1]==this.tic||this._isTextEmpty(u.split(this.tic).join(this._string_empty))&&u[2]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(r.split(this.tic).join(this._string_empty))||this._isTextEmpty(t.split(this.tic).join(this._string_empty))||this._isTextEmpty(u.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return(i<0&&o<0&&(f=-1),i==0||f==0)?"0":(y=0,i=this._parseDouble(i.toString()),i>0&&(i+=.4999999999),i<0&&-.5>=i-parseInt(i)&&(i-=.4999999999),i=Math.round(i),y=Math.floor(i/f),c=y*f,i<0&&i%2!=0&&o==0&&(c+=f),c.toString())};this.computeCeiling=function(n){var f=this.splitArgsPreservingQuotedCommas(n),h=f.length,c,i,t,o,s,u,r,e;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c;if(f[0]=this.getValueFromArg(f[0]),i=h>1?f[0]:"1",i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f[1]=this.getValueFromArg(f[1]),t=h>1&&f[1].length!=0?f[1]:"0",t=t==""||t==null?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,o=!1,s=!1,o=i.split(this.tic).join(this._string_empty)=="true"?!0:!1,s=t.split(this.tic).join(this._string_empty)=="true"?!0:!1,i=o?o.toString():i,t=s?s.toString():t,t==this.trueValueStr)return"1";if(t==this.falseValueStr)return"0";if(t.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(i)!=-1)return i;if(this.getErrorStrings().indexOf(t)!=-1)return t;if(r=-1,e=-1,u=this._parseDouble(i),r=this._parseDouble(t),isNaN(u)&&!isNaN(r)){if(u==0&&!this._isTextEmpty(i)&&this.computeIsText(i)==this.falseValueStr||r==0&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(i.split(this.tic).join(this._string_empty))&&i[0]==this.tic||this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[0]==this.TIC){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(i.split(this.tic).join(this._string_empty))||this._isTextEmpty(t.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(u=this._parseDouble(i),r=this._parseDouble(t),!isNaN(u)&&!isNaN(r)){if(u>0&&r<0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(u==0||r==0)return"0";if(e=Math.floor(u/r)*r,r>0)while(eu)e+=r}return e.toString()};this.computeDecimal2=function(n){var r=this.splitArgsPreservingQuotedCommas(n),h=r.length,o,t,i,f,u,s,e;if(h>3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/",!this.getValueFromArg(r[0]).indexOf(this.tic)&&!this._isCellReference(r[0])){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=0;try{t=this.getValueFromArg(r[0]).split(this.tic).join("");i=parseInt(this.getValueFromArg(r[1]).split(this.tic).join(""))}catch(c){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+c;return this.getErrorStrings()[1].toString()}if(i<2||i>o.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),i<=36&&(t=t.toUpperCase()),u=0,f=0;u=0&&e-1))return o;if(h=0,t=this.getValueFromArg(e[0]).split(this.tic).join(""),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(e[1]).split(this.tic).join(""),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t.split(this.tic).join("")==this._string_empty||i.split(this.tic).join("")==this._string_empty)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();if(s=this._parseDouble(t),r=this._parseDouble(i),isNaN(s)||isNaN(r)){if(this._rethrowLibraryComputationExceptions)return this.formulaErrorStrings[this._invalid_arguments];throw this.getErrorStrings()[1].toString();}else{if(u=parseInt((r+.1).toString()),f=parseInt((s+.1).toString()),f-1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(s!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(n.length>15){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return t=this.getValueFromArg(r[0]).split(this.tic).join(""),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t==""||t==0?"0":t,t=parseInt(t.split(this.tic).join("")),i=this.getValueFromArg(r[1]).split(this.tic).join(""),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i==""||i==0?"0":i,i=parseInt(i.split(this.tic).join("")),t==0&&i==0?f="1":(e=t+i-1,o=e+","+(t-1),f=this.computeCombin(o)),f};this.computeCos=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t;if(i.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.cos).toString())};this.computeCosh=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),e=i.length,r,t,u,f;if(e>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.exp(u),(f+1/f)/2};this.computeCot=function(n){var u=this.splitArgsPreservingQuotedCommas(n),o=u.length,o=u.length,r,f,t,e,i;if(o!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(f=this.computeIsNumber(n),f==this.trueValueStr){if(t=n,t=t.indexOf("u")?t.split("u").join(this._string_empty):t,e=this._parseDouble(t),e>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}}else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}if(n=="0"){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return i=this._computeMath(n,Math.tan),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeCsc=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(1/parseFloat(Math.sin(i))).toString()};this.computeCsch=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,u,t,i,e;if(f!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this._parseDouble(t),e=this.computeIsNumber(n),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i==0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[3].toString()}return i>709?"0":(2/(Math.exp(i)-Math.exp(-i))).toString()};this.computeDecimal=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,o,s,t,i,u,f,h,e;if(c>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.TextWithNumber),this.getErrorStrings().indexOf(o)>-1))return o;if(r[1]==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";i=0;try{t=this.getValueFromArg(r[0]).split(this.tic).join("");i=parseInt(this.getValueFromArg(r[1]).split(this.tic).join(""))}catch(l){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+l;return this.getErrorStrings()[1].toString()}if(i<2||i>s.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),i<=36&&(t=t.toUpperCase()),f=0,u=0;f=0&&e-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=0,f=180*u/Math.PI,f.toString()};this.computeExp=function(n){var r=this.splitArgsPreservingQuotedCommas(n),f=r.length,i,t,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t==""&&(n="0"),u=this._parseDouble(t),u>709){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return this._computeMath(n,Math.exp).toString()};this.computeEven=function(n){var e=0,r=this.splitArgsPreservingQuotedCommas(n),o=r.length,u,i,t,f;if(o>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(i=this.getValueFromArg(r[0]),t=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(t.split(this.tic).join("")),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.sign(t),t=Math.abs(t),t=Math.ceil(t),e=t%2==1?f*(t+1):f*t,e.toString()};this.computeFact=function(n){var i=0,o=this.splitArgsPreservingQuotedCommas(n),e,r,t,u,f;if(o.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(r=this.getValueFromArg(n),t=r.split(this.tic).join("").toUpperCase()=="TRUE"?"1":r.split(this.tic).join("").toUpperCase()=="FALSE"?"0":r,t=this._parseDouble(t.split(this.tic).join("")),isNaN(t))return this.getErrorStrings()[1].toString();if(t<0)return this.getErrorStrings()[4].toString();if(u=parseInt(t),u>12)for(i=this._factorialTable[12],f=13;f<=u;f++)i*=f;else i=this._factorialTable[u];return i.toString()};this.computeFactdouble=function(n){var r,u=1,e=this.splitArgsPreservingQuotedCommas(n),f,t,i;if(e.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(r=parseInt(this.getValueFromArg(n)),isNaN(r))return this.getErrorStrings()[1].toString();if(r<0)return this.getErrorStrings()[4].toString();if(t=r,i=t,t>3)while(i>0)u=u*i,i=i-2;else u=t==0?1:t;return u.toString()};this.computeFloor=function(n){var u=this.splitArgsPreservingQuotedCommas(n),e=u.length,f;if(e!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;var t=this._parseDouble(this.getValueFromArg(u[0])),i=this._parseDouble(this.getValueFromArg(u[1])),r=0;if(!isNaN(t)&&!isNaN(i)){if(t==0)return r.toString();if(t*i<=0&&!(t<0))return this.formulaErrorStrings[this._invalid_arguments];if(r=Math.ceil(t/i)*i,i>0)while(r>t)r-=i;else while(r1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(i[0]),this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=Math.floor(t).toString(),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return u};this.computeLn=function(n){var i=this.splitArgsPreservingQuotedCommas(n),u=i.length,r,t;if(u>1)return this.formulaErrorStrings[this.invalid_arguments];if(r=this.getValueFromArg(i[0]),t=this._parseDouble(r),t<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return r[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.log(t).toString()};this.computeLog=function(n){var f=this.splitArgsPreservingQuotedCommas(n),o=f.length,e,t,i,r,u;if(o>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),i=o==2?this.getValueFromArg(f[1]):"10",ej.isNullOrUndefined(ej.cultureObject)||ej.cultureObject.name=="en-US"||(t=!ej.isNullOrUndefined(t)&&t!=this._string_empty?ej.parseFloat(t.toString(),0,ej.cultureObject.name).toString():t,i=!ej.isNullOrUndefined(i)&&i!=this._string_empty?ej.parseFloat(i.toString(),0,ej.cultureObject.name).toString():i),t==""||t==null||i==""||i==null){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(t),u=this._parseDouble(i),r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(r)||isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||i[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return(Math.log(r)/Math.LN10/(Math.log(u)/Math.LN10)).toString()};this.computeLogTen=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),f=i.length,r,t,u;if(f>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(this._computeMath(t,Math.log)/Math.LN10).toString()};this.computePI=function(n){if(this.getEnableFormulaErrorValidation()){var t=this.formulaErrorStringCheck(n,FormulaArgumentType.None);return this.formulaErrorStrings[this._invalid_arguments]==t?t:Math.PI.toString()}return Math.PI.toString()};this.computeProduct=function(n){var f=1,r,t,o=!0,u,s,i,c,h,e;if(this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(s=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(s)>-1))return s;for(i=0;i-1)for(h=this.getCellsFromArgs(c),e=0;e0){if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}f=f*r;o=!1}}else{try{t=this.getValueFromArg(u[i]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(l){return l}if(t.length>0){if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t==this.tic||this._isCellReference(u[i])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}f=f*r;o=!1}}return o?"0":f.toString()};this.computeSecant=function(n){var e=this.splitArgsPreservingQuotedCommas(n),r,u,t,f,i;if(n=this.getValueFromArg(n),r=e.length,r!=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(u=this.computeIsNumber(n),u==this.trueValueStr){if(t=n,t=t.indexOf("u")?t.split("u").join(""):t,f=parseFloat(t),f>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}}else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}return i=this._computeMath(n,Math.cos),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeSecanth=function(n){var o=this.splitArgsPreservingQuotedCommas(n),u,r,f,t,e,i;if(n=this.getValueFromArg(n),u=o.length,u!=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n[0]==this.tic&&n[length-1]==this.tic&&(n=n.split(this.tic).join("")),n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,n=n.split(this.tic).join(""),f=this.computeIsNumber(n),f==this.trueValueStr&&(t=n,t=t.includes("u")?t.replace("u",""):t,e=parseFloat(t),e>=134217728)){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return n=n.includes("-")?n.replace("-",""):n,i=this._computeMath(n,Math.cosh),(i!="#NUM!"||i!="#VALUE!")&&(i=(1/parseFloat(i)).toString()),i};this.computeSeriessum=function(n){var t=this.splitArgsPreservingQuotedCommas(n),r,f,e,i;if(t.length!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(r=0;r<=2;r++)if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(t[r],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(t[3],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;var h=0,c=0,l=0,o=0,u=0,s;if(s=t[3].indexOf(";")>-1?this._splitArguments(t[3].split(this.tic).join(""),";"):this.getCellsFromArgs(t[3].split(this.tic).join("")),t[0]==""||t[1]==""||t[2]==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}for(h=this._parseDouble(this.getValueFromArg(t[0])),c=this._parseDouble(this.getValueFromArg(t[1])),l=this._parseDouble(this.getValueFromArg(t[2])),i=0;i1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.sin).toString())};this.computeSinh=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),e=i.length,r,t,u,f;if(e>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(i[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,u=this._parseDouble(t.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(i[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return f=Math.exp(u),(f-1/f)/2};this.computeSqrt=function(n){var i=this._splitArguments(n,this.getParseArgumentSeparator().toString()),r=i.length,t;if(r>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.sqrt).toString())};this.computeSubTotal=function(n){var f=!1,t=this._string_empty,e,r=0,u=this._splitArguments(n,this.getParseArgumentSeparator().toString()),s=u.length,o,i;if(s<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(u[0],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this._isCellReference(u[0])?this.getValueFromArg(u[0]):u[0].toString(),e=this._parseDouble(t),isNaN(e)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(r=parseInt(e.toString()),(r<1||r>11)&&(r<101||r>111))return this.getErrorStrings()[1].toString();if(f)return"0";t=n.substring(u[0].toString().length+1);f=!0;i=this._string_empty;switch(r){case 1:case 101:i=this.computeAverage(t);break;case 2:case 102:i=this.computeCount(t);break;case 3:case 103:i=this.computeCounta(t);break;case 4:case 104:i=this.computeMax(t);break;case 5:case 105:i=this.computeMin(t);break;case 6:case 106:i=this.computeProduct(t);break;case 7:case 107:i=this.computeStdev(t);break;case 8:case 108:i=this.computeStdevp(t);break;case 9:case 109:i=this.computeSum(t);break;case 10:case 110:i=this.computeVar(t);break;case 11:case 111:i=this.ComputeVarp(t);break;default:i=this.getErrorStrings()[1].toString()}return f=!1,i};this.computeSumif=function(n){var b=this.splitArgsPreservingQuotedCommas(n),ut=b.length,tt,e,s,i,t,c,l,nt,r,u;if(ut!=2&&ut!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((tt=this.formulaErrorStringCheck(b[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(tt)>-1)||ut==3&&(tt=this.formulaErrorStringCheck(b[2],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(tt)>-1)))return tt;var p=b[0],f=b[1].split(this.tic).join(this._string_empty),k=this.token_equal;f[0]!=this.tic[0]&&"=><".indexOf(f[0])==-1&&this._isCellReference(f)&&(f=this.getValueFromArg(f));var h=ut==2?p:b[2],w=this.getCellsFromArgs(p),o=this.getCellsFromArgs(h),a=w.length;if(a>o.length){var d=h.indexOf(":"),ft=p.indexOf(":"),et=this.rowIndex(p.substr(0,ft)),it=this.colIndex(p.substr(0,ft)),g=this.rowIndex(p.substr(ft+1)),rt=this.colIndex(p.substr(ft+1));if(d>-1){var st=this.rowIndex(h.substr(0,d)),ot=this.colIndex(h.substr(0,d)),y=this.rowIndex(h.substr(d+1)),v=this.colIndex(h.substr(d+1));st!=y?y+=a-o.length:ot!=v&&(v+=a-o.length);st==et&&y==g?v+=rt-it:ot==it&&v==rt?y+=g-et:st==et&&y<=g&&ot==v?(y=g,v+=rt-it):(y=g,v+=rt-it-(v-ot));h=h.substr(0,d+1)+RangeInfo.getAlphaLabel(v)+y.toString()}else{var ht=0,ct=0,lt=string.Empty;ht=this.RowIndex(h);ct=this.ColIndex(h);ht+=g-et;ct+=rt-it;lt=RangeInfo.GetAlphaLabel(ct);h=h+":"+lt+ht}o=this.getCellsFromArgs(h)}for(e=[],s=!1,e[0]=0,f=f.split(this.tic).join(""),numer=f.split(this._parseArgumentSeparator),l=f.length>0&&f[0]==this.tic[0]?1:0,nt=this.minValue,f=numer,r=0;r=")?(f[r]=this._substring(numer[r],l+2,numer[r].length-2-2*l),numer[r]=this._parseDouble(f[r],nt),k=this.token_greatereq):f[r].startsWith("<=")?(f[r]=this._substring(numer[r],l+2,numer[r].length-2-2*l),numer[r]=this._parseDouble(f[r],nt),k=this.token_lesseq):f[r].startsWith("<")?(f[r]=this._substring(numer[r],l+1,numer[r].length-1-2*l),numer[r]=this._parseDouble(f[r],nt),k=this.token_less):f[r].startsWith(">")?(f[r]=this._substring(numer[r],l+1,numer[r].length-1-2*l),numer[r]=this._parseDouble(f[r],nt),k=this.token_greater):f[r].startsWith("=")&&(f[r]=this._substring(numer[r],l+1,numer[r].length-1-2*l),numer[r]=this._parseDouble(f[r],nt),k=this.token_equal),!s)switch(k){case this.token_equal:for(u=0;u1?(t.split(this.tic).join("")==f[r]||numer[r]==i&&i!=this._string_empty)&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),this.computeFunctionLevel==0?isNaN(i)||(e[0]+=i,s=!0):isNaN(i)||e.push(i)):(t.split(this.tic).join("")==f[r]||i==numer[r])&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),isNaN(i)||(e[0]+=i));if(s)break;break;case this.token_noequal:for(u=0;u1?(t.split(this.tic).join("")==f[r]||numer[r]!=i&&i!=this._string_empty)&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),this.computeFunctionLevel==0?isNaN(i)||(e[0]+=i,s=!0):isNaN(i)||e.push(i)):(t.split(this.tic).join("")==f[r]||i!=numer[r])&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),isNaN(i)||(e[0]+=i));if(s)break;break;case this.token_greatereq:for(u=0;u1?c>=0&&!isNaN(i)&&i>=numer[r]&&i!=this._string_empty&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),this.computeFunctionLevel==0?isNaN(i)||(e[0]+=i,s=!0):isNaN(i)||e.push(i)):(c>=0||i>=numer[r])&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),isNaN(i)||(e[0]+=i));if(s)break;break;case this.token_greater:for(u=0;u1?c>0&&!isNaN(i)&&i>numer[r]&&i!=this._string_empty&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),this.computeFunctionLevel==0?isNaN(i)||(e[0]+=i,s=!0):isNaN(i)||e.push(i)):(c>0||i>numer[r])&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),isNaN(i)||(e[0]+=i));if(s)break;break;case this.token_less:for(u=0;u1?c<0&&!isNaN(i)&&i1?c<=0&&!isNaN(i)&&i<=numer[r]&&i!=this._string_empty&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),this.computeFunctionLevel==0?isNaN(i)||(e[0]+=i,s=!0):isNaN(i)||e.push(i)):(c<=0||i<=numer[r])&&(t=o[u],t=this.getValueFromArg(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("").split("$").join("")),isNaN(i)||(e[0]+=i));if(s)break}return e.toString()};this.computeTan=function(n){return this._computeMath(n,Math.tan).toString()};this.computeTrunc=function(n){var r=this.splitArgsPreservingQuotedCommas(n),o=r.length,t=0,f,i,u,e,s;if(o>2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(o==2&&(t=this.getValueFromArg(r[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=this._parseDouble(t)),i=this.getValueFromArg(r[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,u=this._parseDouble(i.split(this.tic).join("")),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i[0]==this.tic||this._isCellReference(r[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return e=Math.pow(10,t),s=u<0?-1:1,(s*Math.floor(e*Math.abs(u))/e).toString()};this.computeLognormOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,e,u,f,i,h,c;if(s!=4||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(f=0,i=0;i-1))return f;for(o=0,i=0;i=1||u<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}o=Math.exp(this._normalinv(r,e,u))}return o.toString()};this.computeNormOinv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,r,o,u,f,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,i=0;i=0&&r<=0||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments]+this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=this._normalCumulativeDistributionFunctionInverse(r,o,u)}return f<=0?this.formulaErrorStrings[this._iterations_dont_converge]:f.toString()};this.computeNormOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),e=t.length,o,u,f,r,s,h,i;if(e!=4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(s=0,h=0,i=0;i=1){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value doesnot match with in range level";return this.getErrorStrings()[4].toString()}return u=this._standardNormalCumulativeDistributionFunctionInverse(t),u.toString()};this.computePermut=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,r,u,f,e,i;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(e=0,t[0]=this.getValueFromArg(t[0]),t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=this.getValueFromArg(t[1]),t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],u=this._parseDouble(this.getValueFromArg(t[0])),f=this._parseDouble(this.getValueFromArg(t[1])),isNaN(u)||isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];var c=parseInt(f+.1),s=parseInt(u+.1),o=1;for(i=s-c+1;i<=s;++i)o=o*i;return e=o,e.toString()};this.computePermutationA=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,u,i,r,e,o,s;if(f!=2||n==""){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)?u:(e=0,t[0]=this.getValueFromArg(t[0]),t[0]=t[0]==""||t[0]==null?"0":t[0],t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0],t[1]=this.getValueFromArg(t[1]),t[1]=t[1]==""||t[1]==null?"0":t[1],t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],i=this._parseDouble(t[0]),r=this._parseDouble(t[1]),isNaN(i)||isNaN(r))?this.formulaErrorStrings[this._invalid_arguments]:(o=r+.1,s=i+.1,Math.pow(i,r).toString())};this.computeStandardize=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,u,f,e,r,o,i;if(s!=3||n=="")return this.formulaErrorStrings[this._wrong_number_arguments];if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;for(r=0,o=0,i=0;i-1))return e;for(o=0,s=0,i=0;if||u<0||u>1){if(this._rethrowLibraryComputationExceptions)throw"#NAME! Passed argument value is not equal to minimum par value";return this.getErrorStrings()[4].toString()}return o=this._parseDouble(t[3]),s=o==0?this._comb(r,f)*Math.pow(u,r)*Math.pow(1-u,f-r):this._binomdist(f,r,u),s.toString()};this.computeChisqOinvOrt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,r,u,e,i;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i1||u<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(r==1)return"0";e=this._chiinv(r,u)}return e.toString()};this.computeChisqOdistOrt=function(n){var i=this.splitArgsPreservingQuotedCommas(n),o=i.length,e,u,r,f,t,s;if(o!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,t=0;t-1))return e;var r,u=0,f=0,o=0;for(i=0;i1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=0,t=this._parseDouble(n),!isNaN(t)&&t>1)t=this._gammaln(t);else{if(t==1)return"0";if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return t.toString()};this.computeConfidenceOnorm=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,f,e,u,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw"Wrong number of arguments";return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(u=0,i=0;i=1||f<=0||e<1){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is different from minimum par";return this.getErrorStrings()[4].toString()}u=this._excelLikeComputations?this._normalinv(1-r+r/2,0,1):this._newnormalinv(1-r+r/2);u=u*f/Math.sqrt(e)}return u.toString()};this.computeExponOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,u,r,f,o,i,h;if(s!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,o=0,i=0;i-1))return r;if(u=0,i=this.getValueFromArg(f[0]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(i),!isNaN(t)&&t>-1&&t<1)u=.5*Math.log((1+t)/(1-t));else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return u.toString()};this.computeFisherInv=function(n){var e=this.splitArgsPreservingQuotedCommas(n),o=e.length,i,r,u,t,f;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(u=0,t=this.getValueFromArg(e[0]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,r=this._parseDouble(t),isNaN(r)||(f=Math.exp(2*r),u=(f-1)/(f+1)),u.toString())};this.computeGammalnOPrecise=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,i,t;if(u!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=0,t=this._parseDouble(n.toString()),!isNaN(t)&&t>1)t=this._gammaln(t);else{if(t==1)return"0";if(t<=0){if(this._rethrowLibraryComputationExceptions)throw"Passed Argument value is less than or equal to minimum value 0";return this.getErrorStrings()[4].toString()}}return t.toString()};this.computeLarge=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,r,u,f,i;if(h!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(r=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1)return r;if(t[0][0]==this.tic)return this.getErrorStrings()[4].toString();if(u=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1)return u}if(i=this.getValueFromArg(t[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,f=this._parseDouble(i),isNaN(f))return this.formulaErrorStrings[this._invalid_arguments];var e=f,o=this._getDoubleArray(t[0]),s=o.length;return e<1||e>s?this.formulaErrorStrings[this._invalid_arguments]:(o.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),o[s-e].toString())};this.computeSmall=function(n){var i=this.splitArgsPreservingQuotedCommas(n),s=i.length,u,f,t,e;if(s!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(u=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)return u;if(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)return f}if(t=this.getValueFromArg(i[1]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,e=this._parseDouble(t),isNaN(e))return this.formulaErrorStrings[this._invalid_arguments];var o=e,r=this._getDoubleArray(i[0]),h=r.length;return o<1||o>r.length?this.formulaErrorStrings[this._invalid_arguments]:(r.sort(function(n,t){return isNaN(n)||isNaN(t)?n-1)for(o=this.getCellsFromArgs(t),e=0;e0&&r++}else if(t=="")r++;else if(this._isLetter(t[0]))f=this.getValueFromArg(t),f.length>0&&r++;else if(t.indexOf(this.getParseArgumentSeparator())>-1)for(s=this.splitArgsPreservingQuotedCommas(t.split(this.tic).join("")),i=0;i0||i=="")&&r++}else u.length>0&&r++;return r.toString()};this.computeAverage=function(n){var i=0,e=0,r,t,f=[],h=this.splitArgsPreservingQuotedCommas(n),c,o,l,s,u;if(h.length<1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(c)>-1))return c;for(o=0;o-1)for(l=this.getCellsFromArgs(f),s=0;s0&&!isNaN(t))if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)==-1)return t;if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString()}else i=Number(i)+Number(r),e++}else{try{t=this.getValueFromArg(f).split(this.tic).join(this._string_empty);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;u=this.getValueFromArg(f);u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u}catch(a){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();else return this.getErrorStrings()[4].toString()}if(t.length>0)if(r=this._parseDouble(t),isNaN(r))if(u[0]==this.tic)if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();else return this.getErrorStrings()[1].toString();else if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();else return this.getErrorStrings()[5].toString();else i=Number(i)+Number(r),e++}return e>0&&(i=Number(i)/Number(e)),i.toString()};this.computeAverageA=function(n){var i=this.splitArgsPreservingQuotedCommas(n),e,t,h,u,r,o,c,f,s;if(i.length<1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this._string_empty,h=0,i==this.trueValueStr||i==this.falseValueStr)return u=i==this.trueValueStr,u?+u:+u;for(r=0;r-1)for(o=this.splitArgsPreservingQuotedCommas(i[r].split(this.tic).join(this._string_empty)),c=0,f=0;f-1)for(s=this.getCellsFromArgs(i),o=0;o0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.max(r,u)}else{try{if(!this._isCellReference(i)&&i[0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}t=i==this._string_empty?"0":this.getValueFromArg(i);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return h}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.max(r,u)}return r!=this.minValue?r.toString():this._string_empty};this.computeMaxa=function(n){var f=this.minValue,i,t,u,o,r,s,e;if(this.adjustRangeArg(n),u=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(o)>-1))return o;for(r=0;r-1)for(s=this.getCellsFromArgs(u[r]),e=0;e0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}f=Math.max(f,i)}}else{try{if(u[r].startsWith(this.tic)||u[r]!=""){if(t=this.getValueFromArg(u[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return t}t==""&&(t="0")}else t="0"}catch(h){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}f=Math.max(f,i)}}return f!=this.minValue?f.toString():this._string_empty};this.computeMedian=function(n){var r,t,i,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(r)>-1)?r:(t=this._getDoubleArray(n),t.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),i=parseInt((t.length/2).toString()),u="",t.length%2==1?t[i].toString():((t[i]+t[i-1])/2).toString())};this.computeMin=function(n){var r=this.maxValue,u,t,f,s,h,e,i,c,o;if(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(s=n.split(";"),s.length>1){for(i=0;i0)if(u=this._parseDouble(e),isNaN(u)){if(this.getErrorStrings().indexOf(e)==-1)return e}else r=Math.min(r,u);if(r!=this.maxValue)return r.toString()}for(i=0;i-1)for(c=this.getCellsFromArgs(f[i]),o=0;o0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.min(r,u)}else{try{if(!this._isCellReference(f[i])&&f[i][0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}t=f[i]==this._string_empty?"0":this.getValueFromArg(f[i]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;t==""&&this._isCellReference(f[i])&&(t="0")}catch(l){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return l}if(t.length>0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)!=-1)return t}else r=Math.min(r,u)}return r!=this.maxValue?r.toString():this._string_empty};this.computeMina=function(n){var u=this.maxValue,i,t,o,s,h,c,f,r,l,e;if(this.adjustRangeArg(n),o=this.splitArgsPreservingQuotedCommas(n),s=n.split(";"),n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(h)>-1))return h;if(s.length>1){for(r=0;r0){if(i=0,f.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(f)==-1)return f;f=f.split(this.tic).join("")=="TRUE"?"1":f.split(this.tic).join("")=="FALSE"?"0":f;i=this._parseDouble(f)}u=Math.min(u,i)}if(u!=this.maxValue)return u.toString()}for(r=0;r-1)for(l=this.getCellsFromArgs(o[r]),e=0;e0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else if(t.toUpperCase()==this.falseValueStr)i=0;else{if(this.getErrorStrings().indexOf(t)!=-1)return t;i=this._parseDouble(t)}u=Math.min(u,i)}}else{try{o[r].startsWith(this.tic)||o[r]!=""?(t=this.getValueFromArg(o[r]),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t==""&&(t="0")):t="0"}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0){if(i=0,t.toUpperCase()==this.trueValueStr)i=1;else{if(this.getErrorStrings().indexOf(t)>-1)return t;i=this._parseDouble(t)}u=Math.min(u,i)}}return u!=this.maxValue?u.toString():this._string_empty};this.computePercentrankInc=function(n){var i=this.splitArgsPreservingQuotedCommas(n),l=i.length,f,u,o,e,r,s,h,t,c,a,v;if(l!=2&&l!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i[0]!=""&&i[1]==""||i[1]!=""&&i[0]==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[0].toString();return this.getErrorStrings()[0].toString()}if(this.getEnableFormulaErrorValidation()){if(f=this.formulaErrorStringCheck(i[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)return f;for(t=1;t-1)return f}if(o=3,e=this.getValueFromArg(i[1]),e==""&&(e="0"),u=this._parseDouble(e),isNaN(u)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(u==0,l==3&&(i[2]=i[2].split(this.tic).join("")=="TRUE"?"1":i[2].split(this.tic).join("")=="FALSE"?"0":i[2],e=this.getValueFromArg(i[2]),o=this._parseDouble(e),isNaN(o)||o<1)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}for(r=this._getDoubleArray(i[0]),s=r.length,r.sort(),h=1,t=0;t0&&r[t-1]-1)||(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)))return f;if(e=0,t=this.getValueFromArg(i[0]),i[0]==this._string_empty||i[1]==this._string_empty||!this._isCellReference(i[1]))return this.getErrorStrings()[4].toString();if(r=this._parseDouble(t),!isNaN(r)){if(h=0,s==3){if(this.getEnableFormulaErrorValidation()&&(c=this.formulaErrorStringCheck(i[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(c)>-1))return c;t=this.getValueFromArg(i[2]);t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t;t==this._string_empty?t="0":this._parseDouble(t)>1&&(t="1");h=this._parseDouble(t)}var l=i[1],u=0,a=!1;if(l.indexOf(":")==-1)return this.getErrorStrings()[4].toString();if(l.indexOf(":")>-1){for(v=this.getCellsFromArgs(l),o=0;or?e+=1:u==r&&(a=!0))}a&&(e+=1)}}return e.toString()};this.computePercentile=function(n){var u=this.splitArgsPreservingQuotedCommas(n),c=u.length,f,t,h,r,e,o,s,i;if(c!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((f=this.formulaErrorStringCheck(u[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(f)>-1)||(f=this.formulaErrorStringCheck(u[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)))return f;if(h=this.getValueFromArg(u[1]),t=this._parseDouble(h),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];for(r=this._getDoubleArray(u[0]),e=r.length,r.sort(function(n,t){return isNaN(n)||isNaN(t)?nt){t=(t-i*o)/o;s=r[i]+t*(r[i+1]-r[i]);break}return s.toString()};this.computePoissonODist=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,o,u,s,i,e,f,h,t;if(c!=3)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,i=0,t=0;t-1))return s;for(f=0,h=!0,e=0;e=5&&r.toString().length>=3){if(this._rethrowLibraryComputationExceptions)throw"Passed argument length exceeded the minimum length";return this.getErrorStrings()[4].toString()}return o!=3&&(f=i[3]==this.trueValueStr?1:0,c=0,c=this._parseDouble(i[3]),isNaN(c)||(f=1)),h=f==1?!0:!1,f=h?1-Math.exp(-Math.pow(u/r,t)):Math.pow(u,t-1)*Math.exp(-Math.pow(u/r,t))*t/Math.pow(r,t),f.toString()};this.computeFOinvOrt=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,o,r,u,f,e,i;if(s!=3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;for(e=0,i=0;i0&&r<1&&!isNaN(u)&&!isNaN(f)){if((r<0||r>1||u<1||f<1)&&this.getRethrowLibraryComputationExceptions())throw"#NUM! Passed Argument value is less than or equal to minimum value";e=this._finv(r,u,f)}if(e<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[4].toString()}return e.toString()};this.computeTOdist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,e,r,i,f,u;if(o!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(i=0,f=0,u=0;u-1)for(c=this.getCellsFromArgs(f),o=0;o0)if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)>0)return t}else i=i+r,u.push(r)}else{try{if(t=this.getValueFromArg(f).split(this.tic).join(this._string_empty),t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,this.getEnableFormulaErrorValidation()&&(l=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1))return l}catch(a){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return a}if(t.length>0)if(r=this._parseDouble(t),isNaN(r)){if(this.getErrorStrings().indexOf(t)==-1)return t}else i=i+r,u.push(r)}if(u.length>0){for(v=i/u.length,i=0,s=0;s-1))return f;for(r=0,e=0,u=0;u-1))return f;for(e=0,i=0;i=1||u<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}return r==0?"0":(e=this._chiinv(r,u),e.toString())}};this.computeCount=function(n){var u=0,t,f,e=new Date,r,i,s,o;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(r=this.splitArgsPreservingQuotedCommas(n),i=0;i-1)for(s=this.getCellsFromArgs(r[i].split(this.tic).join("")),o=0;o0){if(t==this.formulaErrorStrings[19]){if(this.geLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}f=this._parseDouble(t);e=new Date(Date.parse(t));isNaN(f)&&e.toString()=="Invalid Date"||this.getErrorStrings().indexOf(t)!=-1||u++}}else{try{r[i]!=this._string_empty||r[i][0]==this.tic||u++;t=this.getValueFromArg(r[i].split(this.tic).join(""));t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t}catch(h){if(this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();throw this.getErrorStrings()[4].toString();}if(t.length>0){if(t[0]==this.formulaErrorStrings[19]){if(this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}f=this._parseDouble(t);e=new Date(Date.parse(t));isNaN(f)&&e.toString()=="Invalid Date"||this.getErrorStrings().indexOf(t)!=-1||u++}}return u.toString()};this.computeMod=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u,t,i;if(this._isArrayFormula&&n.length>2&&(r[1]=r[r.length-1]),r.length!=2||n==this._string_empty&&!this._isArrayFormula){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;t=r[0];i=r[1];t=this.getValueFromArg(t).split(this.tic).join(this._string_empty);i=this.getValueFromArg(i).split(this.tic).join(this._string_empty);t=t=="TRUE"?"1":t=="FALSE"||t==this._string_empty?"0":t;i=i=="TRUE"?"1":i=="FALSE"||i==this._string_empty?"0":i;var f=parseFloat(t),e=parseFloat(i),o=0;if(!isNaN(f)&&!isNaN(e)){if(o=f-e*Math.floor(f/e),this.computeIsError(o)==this.trueValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[3].toString()}return o.toString()}};this.computeRadians=function(n){var u=this.splitArgsPreservingQuotedCommas(n),i,r,t;if(u.length>1||u==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(r=0,t=this.getValueFromArg(n).split(this.tic).join(this._string_empty),n=t=="TRUE"?"1":t=="FALSE"||t==this._string_empty?"0":t,n=this._parseDouble(n),isNaN(n))?this.formulaErrorStrings[this._invalid_arguments]:(r=Math.PI*n/180,r.toString())};this.computeOdd=function(n){var f=this.splitArgsPreservingQuotedCommas(n),i,t,r,u;if(f.length>1||f==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1)?i:(n=this.getValueFromArg(n).split(this.tic).join(this._string_empty),n=n=="TRUE"?"1":n=="FALSE"||n==this._string_empty?"0":n,t=this._parseDouble(n),r=0,isNaN(t)||(u=t==0?1:t<0?-1:1,t=Math.abs(t),(parseInt(t)!=t||t==0)&&(t=parseInt(t)+1),r=t%2==0?u*(t+1):u*t),r.toString())};this.computeRand=function(n){var i=this.splitArgsPreservingQuotedCommas(n),t=this.formulaErrorStringCheck(n,FormulaArgumentType.None);return this.formulaErrorStrings[this._invalid_arguments]==t?t:Math.random().toString()};this.computeRandBetween=function(n){var t=this.splitArgsPreservingQuotedCommas(n),h=t.length,e,i,r,u,f,o,s;if(h!=2||t==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(i=this.getValueFromArg(t[0]).split(this.tic).join(this._string_empty),r=this.getValueFromArg(t[1]).split(this.tic).join(this._string_empty),this._isCellReference(t[0])&&i==""?i="0":this._isCellReference(t[1])&&r==""&&(r="0"),i==null||i==""||r==null||r==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}return(u=this._parseDouble(i),f=this._parseDouble(r),isNaN(u)||isNaN(f))?this.getErrorStrings()[1].toString():u>f?this.getErrorStrings()[4].toString():(o=parseInt(u),s=parseInt(f),Math.floor(Math.random()*(s-o+1)+o).toString())};this.computeCountif=function(n){return this.computeCountIFFunctions(n,!0)};this.computeCountIFFunctions=function(n,t){var a=this.splitArgsPreservingQuotedCommas(n),nt=a.length,rt=0,b=!1,y=[],p=[],k=[],tt=[],d,ut,h,r,u,o,c,s,ft,et;for(i=0;i-1&&d==this.getErrorStrings()[1]||a[0]==""||!this._isCellReference(a[0]))return this.formulaErrorStrings[this._invalid_arguments];if(this.getErrorStrings().indexOf(d)>-1)return d;if(ut=this.getCellsFromArgs(y[0]),nt<2&&y.length==p.length&&!t)return this.formulaErrorStrings[this._wrong_number_arguments];if(y.length!=p.length&&this.getErrorStrings()[1].toString(),nt!=2&&nt!=3&&t){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.FormulaErrorStrings[this._wrong_number_arguments]);return this.formulaErrorStrings[this._wrong_number_arguments]}for(v=0;v<".indexOf(r[0])==-1&&(r=this.getValueFromArg(r)),v!=y.length-1||t||(b=!0),t&&(b=!0),r.length<1&&t)return"0";if(u=r.length>0&&r[0]==this.tic[0]?1:0,o=Number.MIN_VALUE,r.substring(u).startsWith(">=")?(r=r.substr(u+2,r.length-2-2*u),h=this.token_greatereq):r.substring(u).startsWith("<=")?(r=r.substr(u+2,r.length-2-2*u),h=this.token_lesseq):r.substring(u).startsWith("<>")?(r=r.substr(u+2,r.length-2-2*u),h=this.token_noequal):r.substring(u).startsWith("<")?(r=r.substr(u+1,r.length-1-2*u),h=this.token_less):r.substring(u).startsWith(">")?(r=r.substr(u+1,r.length-1-2*u),h=this.token_greater):r.substring(u).startsWith("=")&&(r=r.substr(u+1,r.length-1-2*u)),r=r.split(this.tic).join(this._string_empty),o=this._parseDouble(r),c=!isNaN(o),s=this.getCellsFromArgs(y[v]),s.length!=ut.length)return this.getErrorStrings()[1].toString();if(s[0]==this.getErrorStrings()[5]){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._bad_index]);return this.getErrorStrings()[5].toString()}var ot=s.length,e,f,g=0,l=!1,w="=",it=r.indexOf("*"),st=r;for(index=0;index=o:!(f==this._string_empty)&&g>=0;w=">=";break;case this.token_greater:e=this._parseDouble(f);l=c?!isNaN(e)&&e>o:!(f==this._string_empty)&&g>0;w=">";break;case this.token_less:e=this._parseDouble(f);l=c?!isNaN(e)&&e0&&v!=0)for(et=k.length,i=0;i-1)return e;if(h==1)return n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,this._computeMath(n,Math.round).toString();var f=0,r=0,o=0,t=this.getValueFromArg(u[0]),i=u[1]==""?"0":this.getValueFromArg(u[1]);return t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t!=""&&i!=""&&(f=this._parseDouble(t),r=this._parseDouble(i),!isNaN(r)&&!isNaN(f)&&r>0?o=f.toFixed(r):(s=Math.pow(10,-r),o=Math.round(f/s)*s)),o.toString()};this.computeRoundDown=function(n){var t=0,u=this.splitArgsPreservingQuotedCommas(n),o=u.length,e,i,r,f;if(n==""){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._wrong_number_arguments]);return this.formulaErrorStrings[this._wrong_number_arguments]}if(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1)return e;if(o==1){if(n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(this.getValueFromArg(n).split(this.tic).join(this._string_empty)),!isNaN(t))return t=t-.4999999999*Math.sign(t),this.computeRound(String.format("{0}",t))}else if(o!=2)return this.formulaErrorStrings[this._invalid_arguments];return(i=this.getValueFromArg(u[0]),r=u[1]==""?"0":this.getValueFromArg(u[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,f=0,i!=""&&(t=this._parseDouble(i.split(this.tic).join(this._string_empty))),f=this._parseDouble(r.split(this.tic).join(this._string_empty)),t!=Number.NaN)?(t=t-.4999999999*Math.pow(10,-f)*Math.sign(t),this.computeRound(String.format("{0}{1}{2}",t,this._parseArgumentSeparator,f))):this.getErrorStrings()[1].toString()};this.computeRoundUp=function(n){var t=0,f=this.splitArgsPreservingQuotedCommas(n),o=f.length,e;if(n==""){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._wrong_number_arguments]);return this.formulaErrorStrings[this._wrong_number_arguments]}if(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1)return e;if(o==1)return n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(this.getValueFromArg(n).split(this.tic).join(this._string_empty)),t>0?t+=.4999999999:t<0&&(t-=.4999999999),t=t.toFixed(0),String.format("{0}",t);if(o!=2)return this.formulaErrorStrings[this._invalid_arguments];var i=0,r=this.getValueFromArg(f[0]),u=f[1]==""?"0":this.getValueFromArg(f[1]);return r=r.split(this.tic).join("")=="TRUE"?"1":r.split(this.tic).join("")=="FALSE"?"0":r,u=u.split(this.tic).join("")=="TRUE"?"1":u.split(this.tic).join("")=="FALSE"?"0":u,r!=""&&(t=this._parseDouble(r.split(this.tic).join(this._string_empty))),i=this._parseDouble(u.split(this.tic).join(this._string_empty)),i=Math.ceil(i),i>0?(t>0?t+=.4999999999/Math.pow(10,i):t<0&&(t-=.4999999999/Math.pow(10,i)),t=t.toFixed(i)):(t>0?t=t/Math.pow(10,-i)+.49999:t<0&&(t=t/Math.pow(10,-i)-.49999),t=t.toFixed(0)*Math.pow(10,-i)),String.format("{0}",t)};this.computeMmult=function(n){var r=this.splitArgsPreservingQuotedCommas(n),v,g,y,p,w,b,it,rt,k,d;if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._wrong_number_arguments]);return this.formulaErrorStrings[this._wrong_number_arguments]}if(v=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(v)>-1)return v;if(g=0,!this._isCellReference(r[0])&&!this._isCellReference(r[1])&&(!isNaN(this._parseDouble(this._stripTics0(r[0])))||!isNaN(this._parseDouble(this._stripTics0(r[0]))))){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._invalid_arguments]);return this.getErrorStrings()[1].toString()}r[0]=this._stripTics0(r[0]);r[1]=this._stripTics0(r[1]);var nt=this.getCellsFromArgs(r[0]),tt=this.getCellsFromArgs(r[1]),t,i,e,u,s,h,c,o=0;if(u=parseInt(this.computeRows(r[0])),s=parseInt(this.computeColumns(r[0])),h=parseInt(this.computeRows(r[1])),c=parseInt(this.computeColumns(r[1])),u!=c||h!=s){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._invalid_Math_argument]);return this.getErrorStrings()[0].toString()}var ut=u-1,l=[],a=[],f=[];for(t=0;t<=u-1;t++)for(l[t]=[],i=0;i<=s-1;i++){if(l[t][i]=this._parseDouble(this.getValueFromArg(nt[o])),isNaN(l[t][i]))return this.getErrorStrings()[1].toString();o++}for(o=0,t=0;t<=h-1;t++)for(a[t]=[],i=0;i<=c-1;i++){if(a[t][i]=this._parseDouble(this.getValueFromArg(tt[o])),isNaN(a[t][i]))return this.getErrorStrings()[1].toString();o++}for(t=0;t<=u-1;t++)for(f[t]=[],i=0;i<=c-1;i++)for(e=0;e<=h-1;e++)isNaN(f[t][i])&&(f[t][i]=0),f[t][i]+=l[t][e]*a[e][i];return this.cell==""?f[0][0].toString():(y=this.colIndex(this.cell),p=this.rowIndex(this.cell),this._getFormulaArrayBounds(this.cell,u,s),w=this._getFormulaArrayBoundsfirstRowIndex,b=this._getFormulaArrayBoundsfirstColIndex,it=this._getFormulaArrayBoundslastRowIndex,rt=this._getFormulaArrayBoundslastColIndex,k=p-w,d=y-b,f[k][d].toString())};this.computePv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,e,i,l;if(u!=5&&u!=4&&u!=3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1)return e;var r,o,s=0,h=0,f=0,c=0;for(i=0;i.5?1:0,l=Math.pow(1+r,o),c=(s*(1+r*f)*(1-l)-r*h)/(r*l),c.toString())};this.computeNormsDist=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t,i;if(r.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(t)>-1)?t:(n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,i=n+", 0, 1, "+this.trueValueStr,this.computeNormDist(i))};this.computeNormDist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),l=t.length,a,f,c;if(l!=4){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(a=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(a)>-1)return a;var o=0,s=0,h=0,v=0,y=0;for(f=0;f-1){var t=i.indexOf(":"),f=this.rowIndex(i.substr(0,t)),e=this.rowIndex(i.substr(t+1));if(!(f!=-1||e==-1)==(f==-1||e!=-1)&&this.getErrorStrings()[5].toString(),a=this.colIndex(i.substr(0,t)),v=this.colIndex(i.substr(t+1)),r==null)for(h=(e-f+1)*(v-a+1),r=[],t=0;t-1)?t:(n=n.split(this.tic).join(""),i=this._getDoubleArray(n),r=i.length,r<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,this._sd(i,u).toString())};this.computeVLookUp=function(n){var c=this._isVLookupCachingEnabled(),b=this._isOptimizedMatchesEnabled(),p,i,u,it,e,a,v,rt,f;if(c&&this._lookupTables==null&&(this._lookupTables=new HashTable),p=this.splitArgsPreservingQuotedCommas(n),i=this.getValueFromArg(p[0]),i=i.split(this.tic).join(this._string_empty).toUpperCase(),u=p[1].split('"').join(this._string_empty),u=="#REF!")return u;if(it=this.getValueFromArg(p[2]).split('"').join(this._string_empty),e=0,e=this._parseDouble(it),this.computeIsLogical(it)==this.trueValueStr)e=this._parseDouble(this.computeN(it));else if(isNaN(e)||it=="NaN")return"#N/A";if(e<1)return this.getErrorStrings()[1].toString();var lt=e,k=!0,et=!0;p.length==4&&(k=et=this.getValueFromArg(p[3])==this.trueValueStr||this.getValueFromArg(p[3].split(this.tic).join(this._string_empty))=="1");e=this._parseDouble(i);a=!isNaN(e);v=u.indexOf(":");v==-1&&(u=u+":"+u,v=u.indexOf(":"));var ot=u.substr(0,v).lastIndexOf(this.sheetToken),st=this.grid,at=CalcEngine.getSheetFamilyItem(this.grid);ot>-1&&(this.grid=at.tokenToParentObject.getItem(u.substring(0,ot+1)));var l=this.rowIndex(u.substring(0,v)),w=this.rowIndex(u.substring(v+1)),d=this.colIndex(u.substring(0,v)),ht=this.colIndex(u.substring(v+1));if(!(l!=-1||w==-1)==(l==-1||w!=-1))return this.getErrorStrings()[5].toString();l==-1&&(l=1);d==-1&&(d=1);w==-1&&this.parentObject.getSheet!=undefined&&(w=this.parentObject.getSheet(this.parentObject._getSheetIndex()).usedRange.rowIndex);ht==-1&&this.parentObject.getSheet!=undefined&&(ht=this.parentObject.getSheet(this.parentObject._getSheetIndex()).usedRange.colIndex);var ut=!0,g="",r=null,o=null;c&&(g=d.toString()+"_"+l.toString()+"_"+w.toString()+"_"+this.grid.GetHashCode(),this._lookupTables.containsKey(g)||(b?(rt=new LookUps,rt.setMatchLookUpList(new HashTable),this._lookupTables.add(g,rt)):(rt=new LookUps,this._lookupTables.add(g,rt)),ut=!0),r=this._lookupTables.getItem(g).getLinearLookUpList(),b&&(o=this._lookupTables.getItem(g).getMatchLookUpList()));var s="",nt=l,ct=0,t="",y=0,ft=!0,tt=!1,h=[];if(c&&b&&o.length>0)o.containsKey(i)&&(nt=o.getItem(i),t=i,tt=!0);else for(f=l;f<=w;++f){if(c&&b){t=this.getValueFromParentObject(this.grid,f,d).toString().toUpperCase().split('"').join("");r.indexOf(t)==-1&&r.push(t);b&&!o.containsKey(t)&&o.add(t,f);y=a?this._parseDouble(t):y;(f==w&&o.containsKey(i)||k&&(a?!isNaN(y)&&y>e:t>i))&&(o.containsKey(i)?(nt=o.getItem(i),t=i,tt=!0):ft=!1);ft&&!o.containsKey(i)&&(nt=f);continue}if(!c||f-l>=r.length||ut?(t=this.getValueFromParentObject(this.grid,f,d).toString().toUpperCase().split('"').join(""),h.indexOf(t)==-1&&h.push(t),c&&(r.indexOf(t)==-1&&r.push(t),b&&!o.containsKey(t)&&o.add(t,f))):t=r[f-l],y=a?this._parseDouble(t):y,t==i||k&&(a?!isNaN(y)&&y>e:t>i))if(t.toUpperCase()==i&&(nt=f,k=!0,tt=!0,ct++),ut)ft=!1;else break;ft&&(nt=f);ut=ct==0?!0:!1;k=!0}if(k||t==i){if(r!=null&&r.length>0&&(c||r.sort(),r[0]=r[0]==""?"0":r[0]),h!=null&&h.length>0&&i!=""&&(c||h.sort(),h[0]=h[0]==""?"0":h[0]),!tt&&(!a||a&&h!=null&&h.length>0&&this._parseDouble(h[0].toString())>this._parseDouble(i))||!tt&&c&&a&&r!=null&&this._parseDouble(r[0].toString())>this._parseDouble(i)||!et&&!tt)return this.grid=st,"#N/A";s=this.getValueFromParentObject(this.grid,nt,lt+d-1).toString();s.length>0&&s[0]==CalcEngine.getFormulaCharacter()&&(s=this.parseFormula(s));e=this._parseDouble(s);s.length>0&&s[0]!=this.tic[0]&&isNaN(e)&&(s=this.tic+s+this.tic)}else s="#N/A";return this.grid=st,s};this.computeAsinh=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t;if(r.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(n),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return t=Math.sign(t)*Math.log(Math.abs(t)+Math.sqrt(t*t+1)),t.toString()};this.computeAtanh=function(n){var u=this.splitArgsPreservingQuotedCommas(n),r,t,i;if(u.length>1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n=this.getValueFromArg(n),n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,t=this._parseDouble(n),i=Math.abs(t),!isNaN(t)&&i<1)t=.5*Math.sign(t)*Math.log((1+i)/(1-i));else{if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return t.toString()};this.computeBase=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,h,o,c,p,i,l,a;if(u<2||u>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var f=0,r=0,e=1;try{t[0]=this.getValueFromArg(t[0]);t[1]=this.getValueFromArg(t[1]);t[0]=t[0]==null||t[0]==""?"0":t[0];t[0]=t[0].split(this.tic).join("")=="TRUE"?"1":t[0].split(this.tic).join("")=="FALSE"?"0":t[0];t[1]=t[1]==null||t[1]==""?"0":t[1];t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1];u==3&&(t[2]=this.getValueFromArg(t[2]),t[2]=t[2]==null||t[2]==""?"0":t[2],t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2]);f=parseInt(this.getValueFromArg(t[0]).split(this.tic).join(""));r=parseInt(this.getValueFromArg(t[1]).split(this.tic).join(""));e=u==3?parseInt(this.getValueFromArg(t[2]).split(this.tic).join("")):1}catch(w){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();return this.getErrorStrings()[5].toString()}if(o=64,c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",f<0||r<2||r>c.length||e<0||e>255){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}for(var v=o-1,s=Math.abs(f),y=new Array(o);s!=0;)p=parseInt(s%r),y[v--]=c[p],s=parseInt(s/r);for(i=y.slice(v+1,o),l=new StringBuilder,a=0;a-1))return g;if(nt=w[0],t=w[1],t=t==null||t==""?"0":t,t.length<1)return"0";v=this.token_equal;t[0]!=this.tic[0]&&"=><".indexOf(t[0])==-1&&(t=this.getValueFromArg(t));f=t.length>0&&t[0]==this.tic[0]?1:0;a=Number.MIN_VALUE;t.substring(f).startsWith(">=")?(t=t.substr(f+2,t.length-2-2*f),v=this.token_greatereq):t.substring(f).startsWith("<=")?(t=t.substr(f+2,t.length-2-2*f),v=this.token_lesseq):t.substring(f).startsWith("<>")?(t=t.substr(f+2,t.length-2-2*f),v=this.token_noequal):t.substring(f).startsWith("<")?(t=t.substr(f+1,t.length-1-2*f),v=this.token_less):t.substring(f).startsWith(">")?(t=t.substr(f+1,t.length-1-2*f),v=this.token_greater):t.substring(f).startsWith("=")&&(t=t.substr(f+1,t.length-1-2*f));t=t.split(this.tic).join("");var a=this._parseDouble(t),s=d==2?nt:w[2],h=this.getCellsFromArgs(nt),e=this.getCellsFromArgs(s);if(h[0]==this.getErrorStrings()[5]||e[0]==this.getErrorStrings()[5]){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();return this.getErrorStrings()[5].toString()}if(o=h.length,o>e.length&&(y=s.indexOf(":"),y>-1)){if(b=this.rowIndex(s.substring(0,y)),p=this.rowIndex(s.substring(y+1)),!(b!=-1||p==-1)==(b==-1||p!=-1))return this.getErrorStrings()[5].toString();rt=this.colIndex(s.substring(0,y));k=this.colIndex(s.substr(y+1));b!=p?p+=o-e.length:rt!=k&&(k+=o-e.length);s=s.substring(0,y+1)+RangeInfo.getAlphaLabel(k)+p.toString();e=this.getCellsFromArgs(s)}c=0;switch(v){case this.token_equal:if(t.indexOf("*")>-1)for(tt=t.indexOf("*"),t=t.substring(0,tt),u=0;u=a&&(i=e[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r,l++));break;case this.token_greater:for(u=0;ua&&(i=e[u],i=this.getValueFromArg(i),r=this._parseDouble(i),isNaN(r)||(c+=r,l++));break;case this.token_less:for(u=0;u<".indexOf(u[0])==-1&&(u=this.getValueFromArg(u)),v==d.length-1&&(p=!0),e=u.length>0&&u[0]==this.tic[0]?1:0,h=Number.MIN_VALUE,u.substring(e).startsWith(">=")?(u=u.substr(e+2,u.length-2-2*e),w=this.token_greatereq):u.substring(e).startsWith("<=")?(u=u.substr(e+2,u.length-2-2*e),w=this.token_lesseq):u.substring(e).startsWith("<>")?(u=u.substr(e+2,u.length-2-2*e),w=this.token_noequal):u.substring(e).startsWith("<")?(u=u.substr(e+1,u.length-1-2*e),w=this.token_less):u.substring(e).startsWith(">")?(u=u.substr(e+1,u.length-1-2*e),w=this.token_greater):u.substring(e).startsWith("=")&&(u=u.substr(e+1,u.length-1-2*e)),u=u.split(this.tic).join(""),h=this._parseDouble(u),et=!isNaN(h),c=this.getCellsFromArgs(d[v]),c[0]==this.getErrorStrings()[5]||f[0]==this.getErrorStrings()[5])return this.getErrorStrings()[5].toString();if(s=c.length,s>f.length&&(o=l.indexOf(":"),o>1)){if(nt=this.rowIndex(l.substring(0,o)),b=this.rowIndex(l.substring(o+1)),!(nt!=-1||b==-1)==(nt==-1||b!=-1))return this.getErrorStrings()[5].toString();ft=this.colIndex(l.substring(0,o));tt=this.colIndex(l.substr(o+1));nt!=b?b+=s-f.length:ft!=tt&&(tt+=s-f.length);l=l.substring(0,o+1)+RangeInfo.getAlphaLabel(tt)+b.toString();f=this.getCellsFromArgs(l)}switch(w){case this.token_equal:if(u.indexOf("*")>-1)for(it=u.indexOf("*"),u=u.substring(0,it),t=0;t=h?f[t]!=null&&(i=f[t],i=this.getValueFromArg(i),r=this._parseDouble(i),!isNaN(r)&&p&&(y+=r,a++)):f[t]=null);break;case this.token_greater:for(t=0;th?f[t]!=null&&(i=f[t],i=this.getValueFromArg(i),r=this._parseDouble(i),!isNaN(r)&&p&&(y+=r,a++)):f[t]=null);break;case this.token_less:for(t=0;t2||o.length<=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(o[0]),t=t.split(this.tic).join(""),i=this.getValueFromArg(o[1]),i=i.split(this.tic).join(""),l=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1)return l;try{if(this._parseDouble(t)==0)return"0.0";if(this._parseDouble(i)<0){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._bad_formula]);return this.getErrorStrings()[4].toString()}if(t==""||i=="")return this.getErrorStrings()[0].toString();if(this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr)return this.getErrorStrings()[5].toString();if(t==this.trueValueStr||i==this.trueValueStr||t==this.falseValueStr||i==this.falseValueStr)return this.getErrorStrings()[1].toString();if(this._parseDouble(t)<2&&this._parseDouble(t)>1){var a=2/Math.abs(this._parseDouble(t)),r=0,e=0,u=1,v=Math.round(2*(this._parseDouble(i)+Math.sqrt(this._acc*this._parseDouble(i))));for(f=v;f>0;--f)s=e+f*a*u,e=u,u=s,Math.abs(u)>this._bingo&&(r*=this._bigni,u*=this._bigni,e*=this._bigni),h=this.computeRound(f.toString()),c=this.computeRound(i),parseInt(h)==parseInt(c)&&(r=e);return r*=this.besseli0(this._parseDouble(t))/u,r==Number.POSITIVE_INFINITY||isNaN(r)?this.getErrorStrings()[4].toString():(this._parseDouble(t)<0&&parseInt(i)%2==0?-r:r).toString()}var a=2/Math.abs(this._parseDouble(t)),r=0,e=0,u=1,v=Math.round(2*(this._parseDouble(i)+Math.sqrt(this._acc*this._parseDouble(i))));for(f=v;f>0;--f)s=e+f*a*u,e=u,u=s,Math.abs(u)>this._bingo&&(r*=this._bigni,u*=this._bigni,e*=this._bigni),h=this.computeRound(f.toString()),c=this.computeRound(i),h==c&&(r=e);return(r*=this.besseli0(this._parseDouble(t))/u,p=r,this._parseDouble(t)<.9&&this._parseDouble(t)>0)?(y=this.besseli0(this._parseDouble(t)),y.toString()):r==Number.POSITIVE_INFINITY||isNaN(r)?this.getErrorStrings()[4].toString():(this._parseDouble(t)<0&&parseInt(i)%2!=0?-r:r).toString()}catch(w){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException("The Parameters are not correct");else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}};this.computeBesselJ=function(n){var v=this.splitArgsPreservingQuotedCommas(n),u="",t="",b,p,w;if(v.length>2||v.length<=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(u=this.getValueFromArg(v[0]),u=u.split(this.tic).join(""),t=this.getValueFromArg(v[1]),t=t.split(this.tic).join(""),b=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(b)>-1)return b;var r,y,s,i,h,f,e,a,o,c,k=40,d=1e10,l=1e-10;try{if(this._parseDouble(t)==0)return this.j0(u).toString();if(this._parseDouble(t)==1)return this.j1(u).toString();if(this._parseDouble(t)<0){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._bad_formula]);return this.getErrorStrings()[4].toString()}if(u==""||t=="")return this.getErrorStrings()[0].toString();if(this.computeIsText(u)==this.trueValueStr||this.computeIsText(t)==this.trueValueStr)return this.getErrorStrings()[5].toString();if(u==this.trueValueStr||t==this.trueValueStr||u==this.falseValueStr||t==this.falseValueStr)return this.getErrorStrings()[1].toString();if(s=Math.abs(this._parseDouble(u)),s==0)return"0";if(this._parseDouble(u)<.9&&this._parseDouble(t)<.9)a=2/s,h=this.j0(s.toString()),o=h;else if(s>this._parseDouble(t)){for(a=2/s,h=this.j0(s.toString()),i=this.j1(s.toString()),r=1;r0;r--)h=r*a*i-f,f=i,i=h,Math.abs(i)>d&&(i*=l,f*=l,o*=l,e*=l),c&&(e+=i),c=!c,p=this.computeRound(r.toString()),w=this.computeRound(t),parseInt(p)<=parseInt(w)&&(o=f);e=2*e-i;o/=e}else{for(a=2/s,y=2*(this._parseDouble(t)+parseInt(Math.sqrt(k*this._parseDouble(t)))/2),c=!1,f=o=e=0,i=1,r=y;r>0;r--)h=r*a*i-f,f=i,i=h,Math.abs(i)>d&&(i*=l,f*=l,o*=l,e*=l),c&&(e+=i),c=!c,p=this.computeRound(r.toString()),w=this.computeRound(t),p==w&&(o=f);e=2*e-i;o/=e}return(this._parseDouble(u)<0&&this._parseDouble(t)%2==1?-o:o).toString()}catch(g){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException("The Parameters are not correct");else return this.computeIsText(x)==this.trueValueStr||this.computeIsText(t)==this.trueValueStr?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}};this.computeBesselK=function(n){var o=this.splitArgsPreservingQuotedCommas(n),t="",r="",ft=o.length==2?o.indexOf("u")>-1:!1,g,ut;if(o.length>2||o.length<=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(o[0]),t=t.split(this.tic).join(""),r=this.getValueFromArg(o[1]),r=r.split(this.tic).join(""),g=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(g)>-1)return g;if(ft=o.length==2?this.computeIsNumber(o[1])!=this.trueValueStr:!1,t==""&&r=="")if(this._rethrowLibraryComputationExceptions)throw new ArgumentException("Passed arguments contains invalid argument");else return this.getErrorStrings()[0].toString();if(o.length==2)t=this.getValueFromArg(o[0]),t=t.split(this.tic).join(""),r=this.getValueFromArg(o[1]),r=r.split(this.tic).join("");else if(o.length==1)t=this.getValueFromArg(o[0]),r="0";else return this.formulaErrorStrings[10].toString();var v=0,e=0,b=0,a=0,it=0,k=0,u=0,i=0,w=0,d=0,y=0,l=0,s=0,c=0,p=0,nt=0,tt=0,h=0,f,rt=.57721566490153287;try{if(f=this._parseDouble(r)<0?"-"+r.toString():r,this._parseDouble(t)<0||this._parseDouble(r)<0){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException(this.formulaErrorStrings[this._bad_formula]);return this.getErrorStrings()[4].toString()}if(t==""||r=="")return this.getErrorStrings()[0].toString();if(this.computeIsText(t)==this.trueValueStr||this.computeIsText(r)==this.trueValueStr)return this.getErrorStrings()[5].toString();if(t==this.trueValueStr||r==this.trueValueStr||t==this.falseValueStr||r==this.falseValueStr)return this.getErrorStrings()[1].toString();if(this._parseDouble(t)<=9.55){if(y=0,w=.25*this._parseDouble(t)*this._parseDouble(t),l=1,s=0,p=1,tt=2/this._parseDouble(t),this._parseDouble(f)>0){for(s=-rt,e=1,f=parseInt(this._parseDouble(f)).toString(),h=1;h<=this._parseDouble(f)-1;h++)s=s+1/e,e=e+1,l=l*e;if(p=tt,this._parseDouble(f)==1)y=1/this._parseDouble(t);else{for(a=l/this._parseDouble(f),b=1,i=a,d=-w,k=1,h=1;h<=this._parseDouble(f)-1;h++)a=a/(this._parseDouble(f)-h),b=b*h,k=k*d,u=a*k/b,i=i+u,p=p*tt;i=i*.5;u=Math.abs(i);y=i*p}}nt=2*Math.log(.5*this._parseDouble(t));c=-rt;this._parseDouble(f)==0?(s=c,u=1):(s=s+1/this._parseDouble(f),u=1/l);i=(c+s-nt)*u;e=1;do u=u*(w/(e*(e+this._parseDouble(f)))),c=c+1/e,s=s+1/(e+this._parseDouble(f)),i=i+(c+s-nt)*u,e=e+1;while(this._parseDouble(Math.abs(u/i))>this.machineepsilon);return i=.5*i/p,this._parseDouble(f)%2!=0&&(i=-i),y=y+i,v=y,v.toString()}if(this._parseDouble(t)>this._parseDouble(Math.log(this.maxrealnumber)))return v=0,v.toString();e=this._parseDouble(f);s=4*e*e;c=1;w=8*this._parseDouble(t);l=1;u=1;i=u;h=0;do{if(d=s-c*c,u=u*d/(l*w),a=Math.abs(u),h>=this._parseDouble(f)&&this._parseDouble(a)>this._parseDouble(it))break;it=a;i=i+u;l=l+1;c=c+2;h=h+1}while(this._parseDouble(Math.abs(u/i))>this.machineepsilon);return ut="-"+t,v=Math.exp(this._parseDouble(ut))*Math.sqrt(Math.PI/(2*this._parseDouble(t)))*i,v.toString()}catch(et){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException("The Parameters are not correct");else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(r)==this.trueValueStr?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}};this.computeBesselY=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t="",i="",c=r.length==2?r.indexOf("u")>-1:!1,o,u,f,h,s,e;if(r.length>2||r.length<=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(r[0]),t=t.split(this.tic).join(""),i=this.getValueFromArg(r[1]),i=i.split(this.tic).join(""),o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1)return o;if(c=r.length==2?this.computeIsNumber(r[1])!=this.trueValueStr:!1,t==""&&i=="")if(this._rethrowLibraryComputationExceptions)throw new ArgumentException("Passed arguments contains invalid argument");else return this.getErrorStrings()[0].toString();if(r.length==2)t=this.getValueFromArg(r[0]),t=t.split(this.tic).join(""),i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("");else if(r.length==1)t=this.getValueFromArg(r[0]),i="0";else return this.formulaErrorStrings[10].toString();try{if(this._parseDouble(t)<0||this._parseDouble(i)<0){if(this._rethrowLibraryComputationExceptions)throw new ArgumentException(this.formulaErrorStrings[this._bad_formula]);return this.getErrorStrings()[4].toString()}if(t==""||i=="")return this.getErrorStrings()[0].toString();if(this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr)return this.getErrorStrings()[5].toString();if(t==this.trueValueStr||i==this.trueValueStr||t==this.falseValueStr||i==this.falseValueStr)return this.getErrorStrings()[1].toString();if(this._parseDouble(t)==0)return this.y0(this._parseDouble(t)).toString();if(this._parseDouble(i)==1)return this.y1(this._parseDouble(t)).toString();if(this._parseDouble(t)<2&&this._parseDouble(t)>1)return s=2/this._parseDouble(t),u=this.y1(this._parseDouble(t)),f=this.y0(this._parseDouble(t)),u.toString();for(s=2/this._parseDouble(t),u=this.y1(this._parseDouble(t)),f=this.y0(this._parseDouble(t)),e=1;e-1)return y;if(i=this.getValueFromArg(i),t=this.getValueFromArg(t),t=t.split(this.tic).join(""),t==this._string_empty)return this._string_empty;if(i==this._string_empty&&t.length>0&&(t.toUpperCase().indexOf("M")>-1||t.toUpperCase().indexOf("D")>-1||t.toUpperCase().indexOf("Y")>-1||t.toUpperCase().indexOf("S")>-1||t.toUpperCase().indexOf("T")>-1)&&(i=s.toString()),f=this._parseDouble(i),isNaN(f)&&this._isDate(new Date(i))!="NaN"&&(f=this._toOADate(new Date(i))),s=Date.parse(i.split(this.tic).join("")),!isNaN(f)||!isNaN(s)){if(t[0]=="["&&this.nativeFormats.indexOf(t)!=-1)return this.tic+i+this.tic;if(t.length>0&&(t.toUpperCase().indexOf("M")>-1||t.toUpperCase().indexOf("D")>-1||t.toUpperCase().indexOf("Y")>-1||t.toUpperCase().indexOf("S")>-1||t.toUpperCase().indexOf("T")>-1)){t=t.split("Y").join("y").split("D").join("d").split("H").join("h").split("S").join("s").split("m").join("M").split("AM/PM").join("tt");for(var u=t.split(""),c=!1,l=!1,w=!1,e=0,p=0,o=0,a=0,e=0;e1&&a++,r=="M"&&c&&(u[e]="m",l=!0,w=p==1),r=="h"?c=!0:this._isLetter(r)&&r!="M"&&r!="h"&&!l&&(c=!1,l=!1),e++;t=new String(u);t=t.split(",").join("").split("\n").join(" ");v=this._fromOADate(f);f==0&&(v=s);i=ej.format(v,t,"en-US")}else i=ej.format(f,t,"en-US")}return this.tic+i+this.tic};this.computePow=function(n){var o=0,r,u,t,i,s=this.splitArgsPreservingQuotedCommas(n),f,e;if(s.length!=2||n==this._string_empty){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException(this.formulaErrorStrings[this._wrong_number_arguments]);return this.formulaErrorStrings[this._wrong_number_arguments]}if(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1)return f;if(e=this.splitArgsPreservingQuotedCommas(n),t=this.getValueFromArg(e[0]),i=this.getValueFromArg(e[1]),t==""&&i==""){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException(this.formulaErrorStrings[this._bad_formula]);return this.getErrorStrings()[4].toString()}if(t=t==""&&this._treatStringsAsZero?"0":t,i=i==""&&this._treatStringsAsZero?"0":i,t=this.getValueFromArg(t).split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,i=this.getValueFromArg(i).split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,r=this._parseDouble(t),u=this._parseDouble(i),!isNaN(r)&&!isNaN(u)){if(r==0&&u<0){if(this.getRethrowLibraryComputationExceptions())throw new ArgumentException(this.formulaErrorStrings[this._bad_formula]);return this.getErrorStrings()[3].toString()}o=Math.pow(r,u)}return o.toString()};this.j0=function(n){var i;if(i=Math.abs(this._parseDouble(n)),i<8){var t=this._parseDouble(n)*this._parseDouble(n),u=57568490574+t*(-13362590354+t*(651619640.7+t*(-11214424.18+t*(77392.33017+t*-184.9052456)))),f=57568490411+t*(1029532985+t*(9494680.718+t*(59272.64853+t*(267.8532712+t*1))));return u/f}var r=8/i,t=r*r,e=i-.785398164,u=1+t*(-.001098628627+t*(2734510407e-14+t*(-2073370639e-15+t*2093887211e-16))),f=-.01562499995+t*(.0001430488765+t*(-6911147651e-15+t*(7621095161e-16-t*934935152e-16)));return Math.sqrt(.636619772/i)*(Math.cos(e)*u-r*Math.sin(e)*f)};this.j1=function(n){var i,t,r,u,f,o,e;return i=Math.abs(this._parseDouble(n)),i<8?(t=this._parseDouble(n)*this._parseDouble(n),r=this._parseDouble(n)*(72362614232+t*(-7895059235+t*(242396853.1+t*(-2972611.439+t*(15704.4826+t*-30.16036606))))),u=144725228442+t*(2300535178+t*(18583304.74+t*(99447.43394+t*(376.9991397+t*1)))),r/u):(f=8/i,o=i-2.356194491,t=f*f,r=1+t*(.00183105+t*(-3516396496e-14+t*(2457520174e-15+t*-240337019e-15))),u=.04687499995+t*(-.0002002690873+t*(8449199096e-15+t*(-88228987e-14+t*105787412e-15))),e=Math.sqrt(.636619772/i)*(Math.cos(o)*r-f*Math.sin(o)*u),this._parseDouble(n)<0&&(e=-e),e)};this.y0=function(n){if(n<8){var t=n*n,r=-2957821389+t*(7062834065+t*(-512359803.6+t*(10879881.29+t*(-86327.92757+t*228.4622733)))),u=40076544269+t*(745249964.8+t*(7189466.438+t*(47447.2647+t*(226.1030244+t*1))));return r/u+.636619772*this.j0(n.toString())*Math.log(n)}var i=8/n,t=i*i,f=n-.785398164,r=1+t*(-.001098628627+t*(2734510407e-14+t*(-2073370639e-15+t*2093887211e-16))),u=-.01562499995+t*(.0001430488765+t*(-6911147651e-15+t*(7621095161e-16+t*-934945152e-16)));return Math.sqrt(.636619772/n)*(Math.sin(f)*r+i*Math.cos(f)*u)};this.y1=function(n){if(n<8){var t=n*n,r=n*(-4900604943e3+t*(127527439e4+t*(-51534381390+t*(734926455.1+t*(-4237922.726+t*8511.937935))))),u=249958057e5+t*(424441966400+t*(3733650367+t*(22459040.02+t*(102042.605+t*(354.9632885+t)))));return r/u+.636619772*(this.j1(n.toString())*Math.log(n)-1/n)}var i=8/n,t=i*i,f=n-2.356194491,r=1+t*(.00183105+t*(-3516396496e-14+t*(2457520174e-15+t*-240337019e-15))),u=.04687499995+t*(-.0002002690873+t*(8449199096e-15+t*(-88228987e-14+t*105787412e-15)));return Math.sqrt(.636619772/n)*(Math.sin(f)*r+i*Math.cos(f)*u)};this.besseli0=function(n){var i=0,u=0,r=0,t={b0:0,b1:0,b2:0};return(this._parseDouble(n)-1))return e;var f,r=0,u=0,s=0;for(i=0;i-1){if(r[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}for(s=this.getCellsFromArgs(f[r]),o=0;o0)if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,i=i*u}}else{try{t=this.getValueFromArg(f[r])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0){if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;if(u=this._parseDouble(t),isNaN(u)){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,i=i*u}}return e>0&&(i=Math.pow(i,1/e)),i.toString()};this.computeHarmean=function(n){var r=0,t,i,e=0,f,u,s,o,h;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(this.adjustRangeArg(n),f=this.splitArgsPreservingQuotedCommas(n),u=0;u-1){if(u[0]==this.tic){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}for(s=this.getCellsFromArgs(f[u]),o=0;o0)if(i=this._parseDouble(t),isNaN(i)||i==0){if(this.getErrorStrings().indexOf(t)==-1)return t}else e++,r=r+1/i}}else{try{t=this.getValueFromArg(f[u])}catch(c){if(this._rethrowLibraryComputationExceptions&&this.getLibraryComputationException()!=null)throw this.getLibraryComputationException();return c}if(t.length>0){if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(t,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;if(i=this._parseDouble(t),isNaN(i)||i==0){if(this.getErrorStrings().indexOf(t))return t}else e++,r=r+1/i}}return e>0&&(r=e/r),r.toString()};this.computeIntercept=function(n){var f=this.splitArgsPreservingQuotedCommas(n),a=f.length,o,r,u,c,l,e,t;if(a!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(o)>-1))return o;if(value1=this.getValueFromArg(f[0]),value2=this.getValueFromArg(f[1]),value1.toString().toUpperCase()==this.trueValueStr||value1.toString().toUpperCase()==this.falseValueStr||value2.toString().toUpperCase()==this.trueValueStr||value2.toString().toUpperCase()==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}var s=this._getDoubleArray(f[0]),h=this._getDoubleArray(f[1]),i=h.length;if(i<=0||i!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(r=0,u=0,t=0;t1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(o)>-1))return o;for(u=0;u-1)for(s=this.getCellsFromArgs(r),f=0;f-1))return o;if(r.length<=0){if(this.getLibraryComputationException()!=null)throw this.formulaErrorStrings[this._bad_formula];throw this.getErrorStrings()[4].toString();}for(i=0,t=0;t-1))return a;for(t=1;t<=2;t++)if(this.getEnableFormulaErrorValidation()&&(v=this.formulaErrorStringCheck(f[t],FormulaArgumentType.Text),this.getErrorStrings().indexOf(v)>-1))return v;if(e=this.getValueFromArg(f[0]),e=e.split(this.tic).join("")=="TRUE"?"1":e.split(this.tic).join("")=="FALSE"?"0":e,y=this._parseDouble(e),isNaN(y)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(s=this._getDoubleArray(f[1]),h=this._getDoubleArray(f[2]),i=h.length,i<=0||i!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(r=0,u=0,t=0;t-1))return t;if(i=this._getDoubleArrayA(n),r=i.length,r<2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}return this._stdevdotP(i).toString()};this.computeStdevOS=function(n){var t,i,r,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1))return t;if(i=this._getDoubleArrayA(n),r=i.length,r<2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}return u=0,this._sd(i,u).toString()};this.computeStdeva=function(n){var t,i,r,u;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(t=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(t)>-1)?t:(i=this._getDoubleArrayA(n),r=i.length,r<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,this._sd(i,u).toString())};this.computeStdevpa=function(n){var i,r,t,u,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(i)>-1)?i:(r=this._getDoubleArrayA(n),t=r.length,t<2)?this.formulaErrorStrings[this._invalid_arguments]:(u=0,f=this._sd(r,u),(f*Math.sqrt(t-1)/Math.sqrt(t)).toString())};this.computeVarp=function(n){var t=this._getDoubleArray(n.split(this.tic).join(this._string_empty)),i=t.length;return((i-1)*this._var(t)/i).toString()};this.computeVara=function(n){var t=this._getDoubleArrayA(n);return this._var(t).toString()};this.computeVarpa=function(n){var t=this._getDoubleArrayA(n),i=t.length;return((i-1)*this._var(t)/i).toString()};this.computeCorrel=function(n){var f=this.splitArgsPreservingQuotedCommas(n),b=f.length,v,y,p,e,o,i,r,u,t,w;if(b!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(v=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(v)>-1))return v;if(y=this.getValueFromArg(f[0]),p=this.getValueFromArg(f[1]),y==null||y==""||p==null||p==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[1].toString()}if(e=this._getDoubleArray(f[0]),o=this._getDoubleArray(f[1]),i=o.length,i<=0||i!=e.length){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[0].toString()}for(r=0,u=0,t=0;t-1)return s;if(h=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1)return h}if(i=this.getValueFromArg(r[1]),u=this.getValueFromArg(r[0]),i==null||i==""||u==""||u==null||Boolean(i=="TRUE"||i=="FALSE")||Boolean(u=="TRUE"||u=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=this._parseDouble(i),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(e=this._parseDouble(i),e==0||e<=0||e>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(o=this._getDoubleArray(r[0]),a=o.length,o.sort(function(n,t){return isNaN(n)||isNaN(t)?n=this._parseDouble((f/(f+1)).toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return c=t*(f+1),c.toString()};this.computePercentileOInc=function(n){var f=this.splitArgsPreservingQuotedCommas(n),a=f.length,e,t,r,o,s,u,h,c,l,i;if(a!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((e=this.formulaErrorStringCheck(f[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)||(e=this.formulaErrorStringCheck(f[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1)))return e;if(r=this.getValueFromArg(f[1]),o=this.getValueFromArg(f[0]),r==null||r==""||o==null||o==""||Boolean(r=="TRUE"||r=="FALSE")||Boolean(o=="TRUE"||o=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(t=this._parseDouble(r),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(s=this._parseDouble(r),s==0||s<0||s>1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}for(u=this._getDoubleArray(f[0]),h=u.length,u.sort(function(n,t){return n-t}),c=1/(h-1),l=u[h-1],i=0;it){t=(t-i*c)/c;l=u[i]+t*(u[i+1]-u[i]);break}return l.toString()};this.computeTrimmean=function(n){var r=this.splitArgsPreservingQuotedCommas(n),l=r.length,o,s,t,i,c,e;if(l!=2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(o=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1)return o;if(s=this.formulaErrorStringCheck(r[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(s)>-1)return s}if(i=this.getValueFromArg(r[1]),i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,t=this._parseDouble(i),isNaN(t)&&(t="1"),t>=1||t==0||t<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}var h=this._getDoubleArray(r[0]),u=h.length,f=parseInt((t*u).toString());for(f=parseInt(f/2),h.sort(function(n,t){return isNaN(n)||isNaN(t)?n>t?1:-1:n-t}),c=0,u=u-f,e=f;e-1))return i;if(t[0]==null||t[0]==""||t[1]==null||t[1]==""||Boolean(t[0]=="TRUE"||t[0]=="FALSE")||Boolean(t[1]=="TRUE"||t[1]=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}var r=this._getDoubleArray(t[0]),o=this._getDoubleArray(t[1]),f=r.length;if(f<=0||!isNaN(r)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}if(u=this._pearson(o,r,f).toString(),this.computeIsErr(u)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[3].toString()}return u};this.computeRsq=function(n){var u=this.splitArgsPreservingQuotedCommas(n),r,i,t;if(u.length!=2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Range),this.getErrorStrings().indexOf(r)>-1))return r;if(i=this.computePearson(n).toString(),t=0,t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)!=-1)return i}else t=t*t;return t.toString()};this.computeHLookUp=function(n){var v=this._isHLookupCachingEnabled(),w=this._isOptimizedMatchesEnabled(),r,s,u,rt,h,b,t,c,k,p,o;if(v&&this._lookupTables==null&&(this.lookupTables=new HashTable),r=this.splitArgsPreservingQuotedCommas(n),r.length>4||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if((s=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(s)>-1)||(s=this.formulaErrorStringCheck(r[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(s)>-1))return s;for(t=2;t-1)return s}u=this.getValueFromArg(r[0]);u=u.split(this.tic).join("").toUpperCase();var f=r[1].split('"').join(""),ut=this.getValueFromArg(r[2]).split(this.tic).join(""),l=this._parseDouble(ut);if(isNaN(l))return"#N/A";rt=parseInt(ut);h=!0;r.length==4&&(h=this.getValueFromArg(r[3])==this.trueValueStr);l=this._parseDouble(u);b=h?!isNaN(l):!1;t=f.indexOf(":");t==-1&&(f=f+":"+f,t=f.indexOf(":"));var ft=f.substring(0,t).lastIndexOf(this.sheetToken),et=this.grid,ct=CalcEngine.getSheetFamilyItem(this.grid);if(ft>-1&&(this.grid=ct.tokenToParentObject.getItem(f.substring(0,ft+1))),c=this.rowIndex(f.substring(0,t)),k=this.rowIndex(f.substring(t+1)),!(c!=-1||k==-1)==(c==-1||k!=-1))return this.getErrorStrings()[5].toString();var y=this.colIndex(f.substring(0,t)),ot=this.colIndex(f.substring(t+1)),d=!1,a="",g=null,nt=null;v&&(a=c.toString()+"_"+y.toString()+"_"+ot.toString()+"_"+this.grid.GetHashCode(),this._lookupTables.containsKey(a)||(w?(p=new LookUps,p.setMatchLookUpList(new HashTable),this._lookupTables.add(a,p)):(p=new LookUps,this._lookupTables.add(a,p)),d=!0),g=this._lookupTables.getItem(a).getLinearLookUpList(),w&&(nt=this._lookupTables.getItem(a).getMatchLookUpList()));var i="",tt=y,e="",it=0,st=!0,ht=!1;if(v&&w&&nt.containsKey(u))tt=nt.getItem(u),e=u;else for(o=y;o<=ot;++o){if(!v||o-y>=g.length||d?(e=this.getValueFromParentObject(this.grid,c,o).toString().toUpperCase().split('"').join(""),v&&(g.push(e),w&&nt.add(e,o))):e=g[o-y],it=b?this._parseDouble(e):it,e==u||h&&(b?!isNaN(it)&&it>l:e>u))if(e==u&&(tt=o,h=!0,ht=!0),d)st=!1;else break;st&&(tt=o);h=d=!0}if(h||e==u){if(!ht&&!b)return this.grid=et,"#N/A";if(rt+c-1>k)return"#REF!";i=this.getValueFromParentObject(this.grid,rt+c-1,tt).toString();i.length>0&&i[0]==this.getFormulaCharacter()&&(i=this.parseFormula(i));l=this._parseDouble(i);i.length>0&&i[0]!=this.tic[0]&&isNaN(l)&&(i=i)}else i="#N/A";return this.grid=et,i};this.computeIndex=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,a,i,r,y,s,u,f,g,h,c,l,p,w,nt,tt,it,b;if(o<2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((a=this.formulaErrorStringCheck(t[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(a)>-1)||o==3&&(a=this.formulaErrorStringCheck(t[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(a)>-1)))return a;if(this._isTextEmpty(t[0])||this._isTextEmpty(t[1])||o==3&&this._isTextEmpty(t[2])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[bad_formula];return this.getErrorStrings()[1].toString()}if(i=t[0],i=i.split(this.tic).join(""),r=i.indexOf(":"),r==-1)if(this._isCellReference(i))i=i+":"+i;else if(i.indexOf(";")>-1)try{if(y=this._splitArguments(i,";"),y[0].indexOf(",")>-1){var rt=parseInt(this.splitArgsPreservingQuotedCommas(y[0]).length),e=[],k=rt,d=0;for(r=0;r=0&&f>=0)return u==0&&f!=0?e[parseInt(u)][parseInt(f)-1].toString():f==0&&u!=0?e[parseInt(u)-1][parseInt(f)].toString():f==0&&u==0?e[0][0].toString():e[parseInt(u)-1][parseInt(f)-1].toString();if(u>=0)return u==0?e[0][0].toString():e[parseInt(u)-1][0].toString()}else return this._findArrayIndex(i,t)}catch(ut){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[2].toString()}else return this._findArrayIndex(i,t);return(r=i.indexOf(":"),n.indexOf("#N/A")>-1||n.indexOf("#N~A")>-1)?"#N/A":n.indexOf("#DIV/0!")>-1||n.indexOf("#DIV~0!")>-1?"#DIV/0!":(g=this._getSheetTokenFromReference(i),t[1]=o==1||t[1]==""?"1":t[1],t[2]=o<=2||t[2]==""?"1":t[2],t[1]=this.getValueFromArg(t[1]),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],h=parseInt(t[1]),c=isNaN(h)?-1:h,t[2]=this.getValueFromArg(t[2]),t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2],h=parseInt(t[2]),l=isNaN(h)?-1:h,c==-1||l==-1)?"#REF":(p=this.rowIndex(i.substring(0,r)),w=this.rowIndex(i.substring(r+1)),!(p!=-1||w==-1)==(p==-1||w!=-1))?this.getErrorStrings()[5].toString():(nt=this.colIndex(i.substring(0,r)),tt=this.colIndex(i.substring(r+1)),c>w-p+1||l>tt-nt+1)?"#REF":(c=this.rowIndex(i.substring(0,r))+c-1,l=this.colIndex(i.substring(0,r))+l-1,it=g+RangeInfo.getAlphaLabel(l)+c,b=this.getValueFromArg(it),this._isTextEmpty(b))?"0":b};this._findArrayIndex=function(n,t){var i=[],f=this._string_empty,r=-1,u=-1,e=t.length;if(i=n.indexOf(";")>-1?this._splitArguments(n,";"):this.splitArgsPreservingQuotedCommas(n),t[1]=this.getValueFromArg(t[1]),t[1]=t[1].split(this.tic).join("")=="TRUE"?"1":t[1].split(this.tic).join("")=="FALSE"?"0":t[1],r=this._parseDouble(t[1]),e==3&&(t[2]=this.getValueFromArg(t[2]),t[2]=t[2].split(this.tic).join("")=="TRUE"?"1":t[2].split(this.tic).join("")=="FALSE"?"0":t[2],u=this._parseDouble(t[2])),e==3&&r>=0&&r==1&&u>=0)i.length>=u&&(f=parseInt(u)==0?i[0]:i[parseInt(u)-1]);else if(r>=0)if(i.length>=r)f=parseInt(r)==0?i[0]:i[parseInt(r)-1];else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[2].toString()}else{if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return f};this.computeIndirect=function(n){var i,s,o,r,h,t,f;if(n[n.length-1]==this.bMARKER&&(n=this.getValueFromArg(n)),i=this.splitArgsPreservingQuotedCommas(n),s=i.length,s>2||s==0||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((o=this.formulaErrorStringCheck(i[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(o)>-1)||s==2&&(o=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1)))return o;if(i[0]=i[0].toUpperCase(),i[0]=this.setTokensForSheets(i[0]),r=this._sheetToken(i[0].split(this.tic).join("")),r!=""&&(i[0]=i[0].split(r).join("")),i.length==2&&i[1]==this.falseValueStr){var l=i[0][0]==this.tic&&i[0][n[0].length-1]==this.tic,a=i[0].toUpperCase().split(this.tic).join(""),e=a.split(":"),u=e[0].split("R").join("C").split("C"),c=u.indexOf("");if(c>-1&&u.splice(c,1),u.length>2)return this.getErrorStrings()[2].toString();i[0]=RangeInfo.getAlphaLabel(parseInt(u[1]))+u[0];e.length==2&&(h=this._sheetToken(e[1]),(h!=null||h!="")&&(e[1]=e[1].split(h).join("")),u=e[0].split("R").join("C").split("C"),i[0]+=":"+RangeInfo.getAlphaLabel(parseInt(u[1]))+u[0]);l&&(i[0]=this.tic+i[0]+this.tic)}if(t="",i[0][0]==this.tic)t=r+i[0].split(this.tic).join("");else if(this._isCellReference(i[0])){if(f="",t=this.getValueFromArg(r+i[0]),t==null||t=="")return"0";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,i[0].split(this._string_fixedreference).join("");if(f=this._checkIfScopedRange(t.toUpperCase()),this.getNamedRanges().containsKey(t.toUpperCase()))t=this.getNamedRanges().getItem(t.toUpperCase()),t=t.toUpperCase(),t=t.split(this._string_fixedreference).join(""),t=this.setTokensForSheets(t),t[0]!=this.sheetToken&&(t=r+t);else if(f!="NaN")t=f,t=t.toUpperCase(),t=t.split(this._string_fixedreference).join(""),t=this.setTokensForSheets(t),t[0]!=this.sheetToken&&(t=r+t);else return this._isCellReference(t)?this.getValueFromArg(t):t.indexOf(!1)?this.getErrorStrings()[2].toString():t}else t=i[0];if(!this._isCellReference(t.split(this._string_fixedreference).join("")))if(f="",f=this._checkIfScopedRange(t.toUpperCase()),this.getNamedRanges().containsKey(t.toUpperCase()))t=this.getNamedRanges().getItem(t.toUpperCase()),t[0]!=this.sheetToken&&(t=r+t);else if(f!="NaN")t=f,t[0]!=this.sheetToken&&(t=r+t);else return this.getErrorStrings()[2].toString();return t.indexOf(":")>-1&&this._isInteriorFunction||this.computedValueLevel>1?(this._isInteriorFunction=!this._isInteriorFunction,t.split(this._string_fixedreference).join("")):this.getValueFromArg(t)};this.computeLookUp=function(n){var st=this._isHLookupCachingEnabled(),lt=this._isOptimizedMatchesEnabled(),g={value:!1},t,p,y,f,ht,ct,a,ut,w,v,u,h,b,r,k,d,o,c,ot,tt,it,e;if(st&&this._lookupTables==null&&(this.lookupTables=new HashTable),t=this.splitArgsPreservingQuotedCommas(n),t.length>3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(p=this.formulaErrorStringCheck(t[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(p)>-1)return p;for(y=1;y-1)return p}f=this.getValueFromArg(t[0]);f=f.split(this.tic).join("").toUpperCase();var nt=0,rt="",l=t[1].split('"').join(""),at=this.getValueFromArg(t[0]),i=[],s=[];if(t.length==2)if(ht=t[1],ct=this.splitArgsPreservingQuotedCommas(t[1]),t[1].indexOf(";")>-1)if(a=this._splitArguments(t[1],";"),a.length==1)for(v=this.splitArgsPreservingQuotedCommas(a[0].toUpperCase()),u=0;u-1)for(h=this.getCellsFromArgs(t[1]),r=0;r-1){var y=l.indexOf(":"),ft=this.colIndex(l.substr(0,y)),et=this.colIndex(l.substr(y+1,l.length-y-1));for(nt=et>ft?et-ft+1:ft-et+1,h=this.getCellsFromArgs(l),r=0;r-1&&c.indexOf(":")==-1||this.getCellsFromArgs(t[1]).length>this.getCellsFromArgs(t[2]).length?c=this.getResultRange(l,c,g):g.value=!0,!this._isCellReference(c))return this.getErrorStrings()[0].toString();if(c.indexOf(":")>-1)for(h=this.getCellsFromArgs(c),r=0;rk&&f>i[o]&&k>f||f>i[o])k=f>i[o]?i[o]:i[o+1],d++;else if(d!=0)break}else ot=this._parseDouble(i[o]),!isNaN(ot)&&c>=ot&&(k=i[o],d++);if(d==0)return this.getErrorStrings()[0].toString();f=k}if(tt=0,it=0,t.length==3&&t[2].indexOf(":")>-1){for(e=0;e-1?(o=t.indexOf(":"),u=this.rowIndex(t.substr(0,o)),r=t.substr(0,o)+":"+r+u):r=t+":"+r+u,i.value=!0,r};this.computeOffSet=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,e,s,v,w,h,b,a,k,y;if(f<3||f>5||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()){if(e=this.formulaErrorStringCheck(u[0],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)return e;for(s=1;s-1))return e}var t=u[0],i=this._parseDouble(this.getValueFromArg(u[1])),p=isNaN(i)?-1:parseInt(i.toString());i=this._parseDouble(this.getValueFromArg(u[2]));v=isNaN(i)?-1:parseInt(i.toString());w=f>=4?u[3]:"-1";i=parseInt(this.getValueFromArg(w));h=isNaN(i)?1:i;b=f==5?u[4]:"-1";i=parseInt(this.getValueFromArg(b));var c=isNaN(i)?1:i,r=t.indexOf(":"),o=r==-1;o&&(t=t+":"+t,r=t.indexOf(":"));o=o&&c<=1&&h<=1;c==-1&&(o=!0);var d=this._getSheetTokenFromReference(t),l=this.rowIndex(t.substring(0,r))+p,g=this.rowIndex(t.substring(r+1))+p;return!(this.rowIndex(t.substring(0,r))!=-1||this.rowIndex(t.substring(r+1))!=-1)==(this.rowIndex(t.substring(0,r))==-1||this.rowIndex(t.substring(r+1))!=-1)?this.getErrorStrings()[5].toString():(a=this.colIndex(t.substring(0,r))+v,k=this.colIndex(t.substring(r+1))+v,l<=0||a<=0)?this.getErrorStrings()[2].toString():((h>0&&c<0||h<1&&c>1)&&(l=this.rowIndex(this.cell)),k==parseInt(this.computeColumn(t))-1&&(o=!0),y=d+RangeInfo.getAlphaLabel(a)+l,o?this.computedValue(y):y+":"+RangeInfo.getAlphaLabel(a+c-1)+(l+h-1))};this.computeTranspose=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e,c,o,l,s,a,i,t,u,r;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(!this._isCellReference(n)&&!this.getNamedRanges().containsKey(n)&&n.indexOf(";")==-1){if(t=this._splitArguments(n.split(this.tic).join(""),";"),t.length==1)return this.getValueFromArg(this.splitArgsPreservingQuotedCommas(t[0])[0]);if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(f=this.splitArgsPreservingQuotedCommas(n),c=f.length,c!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i="",n.indexOf(";")>-1){for(t=this._splitArguments(n.split(this.tic).join(""),";"),u=1;u-1&&(this.grid=ft.tokenToParentObject[n.substring(0,w+1)]);i=this._getValueComputeFormulaIfNecessary(o+rt,s+it,this.grid);this.grid=ut}return(i==null||i=="")&&(i="0"),i};this.computeEncodeURL=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i,r;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;if(!this._isCellReference(t[0])&&!this.getNamedRanges().containsKey(t[0])&&t[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(t[0]))&&!Boolean(t[0]=="TRUE"||t[0]=="FALSE")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5]}return r=this._stripTics0(this.getValueFromArg(t[0])),encodeURIComponent(r)};this.ComputeCOUNTIFS=function(n){return this.computeCountIFFunctions(n,!1)};this.computeAnd=function(n){var f=!0,t,e,r,i,u,o,s;if(n==null||n=="")if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];else return this.formulaErrorStrings[this._bad_formula];for(r=this.splitArgsPreservingQuotedCommas(n),i=0;i-1)for(cells=this.getCellsFromArgs(r[i]),u=0;u-1)return cells[u];if(cells[u][0]==this.tic)if(this.getRethrowLibraryComputationExceptions)throw(new this.getErrorStrings)[5].toString();else return this.getErrorStrings()[5].toString();try{if(t=this.getValueFromArg(cells[u]),this.getErrorStrings().indexOf(t)>-1)return t}catch(h){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=f&(t==""?!0:t.split(this.tic).join("").toUpperCase()==this.trueValueStr||(e=this._parseDouble(t))&&e!=0)}else{try{if(t=this.getValueFromArg(r[i]),this.getErrorStrings().indexOf(t)>-1)return t;if(o=Date.parse(t.split(this.tic).join("")),e=this._parseDouble(t.split(this.tic).join("")),isNaN(o)){if(isNaN(e)&&!(t==this._string_empty)&&!(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||t.split(this.tic).join("").toUpperCase()==this.falseValueStr))if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();else return this._isCellReference(r[i])||t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}else return this.trueValueStr}catch(c){if(this.getRethrowLibraryComputationExceptions()&&this.getLibraryComputationException()!=null)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}s=this._parseDouble(t);f=f&(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||!isNaN(s)&&e!=0)}}return f?this.trueValueStr:this.falseValueStr};this.computeFalse=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>0&&t!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.falseValueStr};this.computeIf=function(n){var t=this._string_empty,i=this.splitArgsPreservingQuotedCommas(n),u,f,r;if(this.getErrorStrings().indexOf(n)>0)return n;if(i.length==1||i.length>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i.length<=3)try{if(t=this.getValueFromArg(i[0]),this.getErrorStrings().indexOf(t)!=-1)return t;if(!this._isCellReference(i[0])&&!isNaN(typeof t=="boolean")&&t.startsWith(this.tic)||this._isCellReference(i[0])&&t.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(t.split(this.tic).join("")==this.trueValueStr||(u=this._parseDouble(t))&&u!=0){if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(i[1],FormulaArgumentType.Text),this.getErrorStrings().indexOf(f)>-1))return f;if(t=this.getValueFromArg(i[1]),t==""&&this.getTreatStringsAsZero())return"0";t==this._string_empty||t[0]!=this.tic[0]||this._isCellReference(i[1])||(t=t.split(this.tic[0]).join(this._string_empty))}else if(t.split(this.tic).join(this._string_empty)==this.falseValueStr&&i.length<3)t=this.falseValueStr;else if(t.split(this.tic).join(this._string_empty)==this.falseValueStr||t==this._string_empty||(u=this._parseDouble(t))&&u==0){if(t=i.length==3?this.getValueFromArg(i[2]):!1,t==this._string_empty&&this.getTreatStringsAsZero())return"0";if(t==this._string_empty||t[0]!=this.tic[0]||this._isCellReference(i[2])||(t=t.split(this.tic[0]).join(this._string_empty)),this.getErrorStrings().indexOf(t)!=-1)return t}else{if(i.indexOf(this.tic)>-1){var e=i[0].indexOf(this.tic)+1,o=i[0].lastIndexOf(this.tic)-1,s=i[0].substring(e,o-e+1);for(r=0;r-1))return r;if(t[0]==this.tic)return this.getValueFromArg(i[0]);try{if(t[0]==this.bMARKER&&(t=t.replace(this.bMARKER," "),t=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim(),t[0]=="NAN"||t[0]=="-NAN"||t[0]=="INFINITY"||t[0]=="-INFINITY"||t[0]=="#"||t[0]=="n#"))return this.getValueFromArg(i[1]);t=i[0];t=this.getValueFromArg(t).toUpperCase().split(this.tic).join(this._string_empty)}catch(u){t=t.toUpperCase()}return t[0]=="NAN"||t[0]=="-NAN"||t[0]=="INFINITY"||t[0]=="-INFINITY"||t[0]=="#"||t[0]=="n#"?this.getValueFromArg(i[1]):this.getValueFromArg(i[0])};this.computeIfNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i=this._string_empty,r;if(u!=2)return this.getFormulaErrorStrings();if(this.computeIsNA(t[0])==this.trueValueStr){if(this.tic.indexOf(t[1])==-1&&!this._isCellReference(t[1])&&!(r=this._parseDouble(t[0]))&&!this.namedRanges.containsKey(t[1]))return this.getErrorStrings()[5].toString();i=this.getValueFromArg(t[1])}else if(this._isRange(t[0]))i=this.getErrorStrings()[1].toString();else{if(this.tic.indexOf(t[0])==-1&&!this._isCellReference(t[0])&&!(r=this._parseDouble(t[0]))&&!this.NamedRanges.ContainsKey(t[0]))return this.getErrorStrings()[5].toString();i=this.getValueFromArg(t[0])}return i[0]==this.tic&&i[length-1]==this.tic&&(i=this.substring(i,1,i.length-2)),i};this.computeNot=function(n){var t=n,i,r=[this.getParseArgumentSeparator(),":"];if(n.length>0&&this._indexOfAny(n,r)>-1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{if(t=this.getValueFromArg(t),this.getErrorStrings().indexOf(t)!=-1)return t;if(t==this.trueValueStr)t=this.falseValueStr;else if(t==this.falseValueStr)t=this.trueValueStr;else{if(isNaN(i=this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}t=Math.abs(i)>1e-10?this.falseValueStr:this.trueValueStr}}catch(u){if(this.rethrowLibraryComputationExceptions&&this.getLibraryComputationException!=null)throw this.getLibraryComputationException;return u}return t};this.computeOr=function(n){var e=this.falseValueStr,t,r,u=this.splitArgsPreservingQuotedCommas(n),i,f;if(n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(i=0;i-1&&this._isCellReference(i))for(cells=this.getCellsFromArgs(u[i]),f=0;f-1&&this._isCellReference(i))for(o=this.getCellsFromArgs(u[i]),f=0;f2||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((u=this.formulaErrorStringCheck(r[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(u)>-1)||r.length==2&&(u=this.formulaErrorStringCheck(r[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(u)>-1)))return u;if(i="",r.length==2){if(!this._isCellReference(r[1])&&!this.namedRanges.containsKey(r[1])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}i=r[1]}else i=this.cell;f=r[0].split(this.tic).join(this._string_empty).toLowerCase();t="";switch(f){case"address":t=this.rowIndex(i).toString()+this.getParseArgumentSeparator()+this.colIndex(i).toString();t=this.computeAddress(t);break;case"col":t=this.computeColumn(i);break;case"contents":t=this.getValueFromArg(i);break;case"filename":t="Not Supported";break;case"row":t=this.computeRow(i);break;case"type":t=this.computeIsBlank(i)==this.trueValueStr?"b":this.computeIsText(i)==this.trueValueStr?"l":"v"}if(t==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return t.toString()};this.computeErrorType=function(n){var t=this._string_empty,r=this._splitArguments(n,this.getParseArgumentSeparator()),u=r.length,i;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1)?i:(t=this._isCellReference(n)?this.getValueFromArg(n):n,t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0])?"#N/A":t=="#NULL!"?"1":t=="#DIV/0!"?"2":t=="#VALUE!"?"3":t=="#REF!"?"4":t=="#NAME?"?"5":t=="#NUM!"?"6":t=="#N/A"?"7":t=="#GETTING_DATA"?"8":"#N/A"};this.computeInfo=function(n){var r=this.splitArgsPreservingQuotedCommas(n),e=r.length,i,u,t,f;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(i)>-1))return i;u=this._stripTics0(this.getValueFromArg(r[0])).toLowerCase();t=this._string_empty;switch(u){case"directory":t=window.location.toString();break;case"numfile":t=this.getSortedSheetNames()!=null&&CalcEngine._sheetFamiliesList.length==0?this.getSortedSheetNames().length.toString():"1";break;case"origin":f=this.rowIndex(this.cell).toString()+this.getParseArgumentSeparator()+this.colIndex(this.cell).toString();t="$A: "+this.computeAddress(f);break;case"osversion":t=navigator.platform.toString();break;case"recalc":t=this._alwaysComputeDuringRefresh?"Automatic":"Manual";break;case"release":t=this.System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.toString();break;case"system":switch(navigator.appVersion.indexOf()){case navigator.platform:t="unix";break;case navigator.platform:t="mac";break;default:t="pcdos"}break;default:if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return t};this.computeIsBlank=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.getValueFromArg(n)==""?this.trueValueStr:this.falseValueStr};this.computeIsErr=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return n=this.getValueFromArg(n).toUpperCase().split(this.tic).join(this._string_empty),n.count>1,(n.startsWith("NAN")||n.startsWith("-NAN")||n.startsWith("INFINITY")||n.startsWith("-INFINITY")||n.startsWith("#")||n.startsWith("n#"))&&!n.startsWith("#N/A")?this.trueValueStr:this.falseValueStr};this.computeIsError=function(n){var t=this.splitArgsPreservingQuotedCommas(n),i=t.length;if(i!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{n=this.getValueFromArg(n).toUpperCase().split(this.tic).join(this._string_empty)}catch(r){return this.trueValueStr}return n.indexOf("NAN")==0||n.indexOf("-NAN")==0||n.indexOf("INFINITY")==0||n.indexOf("-INFINITY")==1||n.indexOf("#")==0||n.indexOf("n#")==0?this.trueValueStr:this.falseValueStr};this.computeIsEven=function(n){var s=this._string_empty,f=this.splitArgsPreservingQuotedCommas(n),o=f.length,i,t,r,u,e;if(o!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(f[0]),t=parseInt(i.split(this.tic).join("")),this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(u=new Date(Date.parse(i)),isNaN(t)&&u.toString()!="invalid Date"&&(t=this._toOADate(u)),e=t,isNaN(t)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return e%2==0?this.trueValueStr:this.falseValueStr};this.computeIsFormula=function(n){var t=this.splitArgsPreservingQuotedCommas(n),f=t.length,u=this._string_empty,i,r;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(u=this.getValueFromArg(t[0]),this.namedRanges.containsValue(u)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return r=CalcEngine.getSheetFamilyItem(this.grid),this.isSheetMember()&&r.parentObjectToToken!=null&&(t[0]=r.parentObjectToToken.getItem(this.grid)+t[0]),this.getFormulaInfoTable().containsKey(t[0])?this.trueValueStr:this.falseValueStr};this.computeIsLogical=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return(n=this.getValueFromArg(n),n==this.falseValueStr||n==this.trueValueStr)?this.trueValueStr:this.falseValueStr};this.computeIsNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n=this.getValueFromArg(n),this.getErrorStrings().indexOf(n.toUpperCase())!=-1)return n.toUpperCase()=="#N/A"?this.trueValueStr:this.falseValueStr;try{n=this.getValueFromArg(n).toUpperCase()}catch(i){return this.falseValueStr}return n[0]=="#N/A"?this.trueValueStr:this.falseValueStr};this.computeIsNonText=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return this.computeIsText(n)==this.trueValueStr?this.falseValueStr:this.trueValueStr};this.computeIsNumber=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return n=this.getValueFromArg(n),isNaN(this._parseDouble(n))?this.falseValueStr:this.trueValueStr};this.computeIsRef=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t.length!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return((this.namedRanges.containsKey(n)||this._isCellReference(n))&&n[0]!=this.tic&&n[length-1]!=this.tic).toString().toUpperCase()};this.computeIsOdd=function(n){var r=this._string_empty,t=0,u=this._splitArguments(n,this.getParseArgumentSeparator()),f=u.length,e=[this.getParseArgumentSeparator(),":"],i;if(f!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n!=this._string_empty){if(this._indexOfAny(n,e)!=-1)return"#VALUE!";if(r=this.getValueFromArg(u[0]),t=parseInt(r.split(this.tic).join(this._string_empty)),isNaN(t)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return t%2!=0?this.trueValueStr:this.falseValueStr}return this.trueValueStr};this.computeIsText=function(n){var r=this.splitArgsPreservingQuotedCommas(n),i,t;if(r.length>1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return i=this._isCellReference(n),t=i?this.getValueFromArg(n):n,(i||t[0]==this.tic)&&t.length>0&&isNaN(this._parseDouble(t))?this.trueValueStr:this.falseValueStr};this.computeN=function(n){var t=this._string_empty,i=0,u,f=this._splitArguments(n,this.getParseArgumentSeparator()),e=f.length,r;if(e!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(r)>-1))return r;if(t=this.getValueFromArg(n),u=new Date(Date.parse(t)),this._parseDouble(t))return i=this._parseDouble(t),i.toString();if(new Date(Date.parse(t))&&(i=this._getSerialDateTimeFromDate(u)),t==this.trueValueStr)i=1;else if(t==this.falseValueStr)i=0;else return this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1?t:isNaN(i)?"0":i.toString();return i.toString()};this.computeNA=function(n){var t=this.splitArgsPreservingQuotedCommas(n);if(t.length>0&&t!=""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return"#N/A"};this.computeSheet=function(n){var o=this.splitArgsPreservingQuotedCommas(n),h=o.length,c=this._string_empty,e,t,i,s;if(h>1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(t=o[0].toUpperCase(),t=t==null||t==this._string_empty?this.cell:t,t==null||t==this._string_empty)return"1";if(this.getErrorStrings().indexOf(t)>-1)return t;if(!this._isCellReference(t)&&!this.namedRanges.containsKey(t)&&this.getSortedSheetNames().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}var r=CalcEngine.getSheetFamilyItem(this.grid),u=this._getSheetTokenFromReference(t),f=0;if(u!=null&&u!=this._string_empty||this.getSortedSheetNames().indexOf(t)!=-1||t.indexOf(this.sheetToken.toString()))if(u.length>0)f=parseInt(u.split(this.sheetToken).join(this._string_empty))+1;else try{for(i=0;i1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=0,t=u[0].toUpperCase(),this.getErrorStrings().indexOf(t)>-1)return t;if(t==null||t==this._string_empty)return this.getSortedSheetNames().length.toString();if(this.getEnableFormulaErrorValidation()){if(r=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(r)>-1)return r}else{if(t.split(this.tic).join(this._string_empty)==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(!this._isCellReference(t)&&!this.namedRanges.containsKey(t)&&this.getSortedSheetNames().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}}try{f=this._splitArguments(t,"!");i=(f.length-1)/2}catch(s){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[2].toString();return this.getErrorStrings()[2].toString()}return i.toString()};this.computeType=function(n){var r=this.splitArgsPreservingQuotedCommas(n),u=r.length,i=0,t;if(u!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(r[0]),t==null||t==this._string_empty){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return n.indexOf(this.getParseArgumentSeparator())>-1?i=64:this.computeIsNumber(t)==this.trueValueStr?i=1:this.computeIsLogical(t)==this.trueValueStr?i=4:this.getErrorStrings().indexOf(t)>-1?i=16:this.computeIsText(t)==this.trueValueStr&&(i=2),i.toString()};this.computeRow=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u=t.length,i,r;if(u!=1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t[0]==this._string_empty)return this.rowIndex(this.cell).toString();if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(i)>-1))return i;if(!this._isCellReference(t[0])&&!this.namedRanges.containsKey(t[0])){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(n.indexOf(":")>-1&&this._isArrayFormula)if(r=this._computeArrayInteriorFunction(n,"ROW",this.computeFunctionLevel),r==this._string_empty)n=this.getCellsFromArgs(n)[0];else return r;return n.indexOf(":")>-1&&(n=this.getCellsFromArgs(n)[0]),this.rowIndex(n).toString()};this.computeRows=function(n){var f=this.splitArgsPreservingQuotedCommas(n),e,o,s,t,r,i,u;if(f.length!=1||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1))return e;if(t=1,f[0].indexOf(":")>-1)r=this.getCellsFromArgs(n),o=this.rowIndex(r[0].toString()),s=this.rowIndex(r[r.length-1].toString()),t=s-o+1,t=t>0?t:1;else if(f[0].indexOf(";")>-1)for(i=this._splitArguments(n.split(this.tic).join(this._string_empty),";"),u=1;u5||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(h=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(h)>-1))return h;var r,e=0,o=0,s=0,u=0,c=0;for(i=0;i.5?1:0,r==0?c=1*(s+o)/((1+r*u)*(1-(e+1))):(l=Math.pow(1+r,e),c=r*(s+o*l)/((1+r*u)*(1-l))),this.computeDollar(c.toString())};this.computeMatch=function(n){var f=this.splitArgsPreservingQuotedCommas(n),v=f.length,e,l,a,r,c,p,u;if(v>3||n==""){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&((e=this.formulaErrorStringCheck(f[0],FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1)||(e=this.formulaErrorStringCheck(f[1],FormulaArgumentType.CellReference),this.getErrorStrings().indexOf(e)>-1)))return e;var y=f[1].split(this.tic).join(this._string_empty),w=y.indexOf(":"),t=1;if(v==3){if(this.getEnableFormulaErrorValidation()&&(l=this.formulaErrorStringCheck(f[2],FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(l)>-1))return l;if(r=this.getValueFromArg(f[2]),r=r.split(this.tic).join(this._string_empty),a=this._parseDouble(r),t=isNaN(a)?1:a,r==this.falseValueStr)t=0;else if(r==this.trueValueStr)t=1;else if(r.includes(this.tic)&&this.computeIsText(r)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}}var s=this.getValueFromArg(f[0].split(this.tic).join(this._string_empty)).toUpperCase(),o=this.getCellsFromArgs(this._stripTics0(y)),i=1,h="",u;for(c=0;c0){i=-1;break}if((t==0||t==1)&&u==s)break;else if(t==1&&this._matchCompare(s,u)<0){i--;break}else if(t==-1&&this._matchCompare(s,u)>0){i--;break}i++;h==u}return t!=0&&i==o.length+1&&(i=o.length),i>0&&i<=o.length?i.toString():this.getErrorStrings()[0].toString()};this.computeBitAnd=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,f,e,u;try{if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(r[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),t<0||i<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=this._parseDouble(i),(f&e).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBitOr=function(n){var r=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,f,e,u;try{if(r.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t=this.getValueFromArg(r[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(r[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),t<0||i<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return f=this._parseDouble(t),e=this._parseDouble(i),(f|e).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBitLShift=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||Math.abs(u)>53||r<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(u>=0?r<>-u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this._parseDouble(t)<0||this._parseDouble(i)<0?this.getErrorStrings()[4].toString():this.getErrorStrings()[1].toString()}};this.computeBitRShift=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||Math.abs(u)>53||r<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(u>=0?r>>u:r<<-u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[5].toString():t==""||i==""?this.getErrorStrings()[1].toString():this._parseDouble(t)<0||this._parseDouble(i)<0?this.getErrorStrings()[4].toString():this.getErrorStrings()[1].toString()}};this.computeBitXor=function(n){var f=this.splitArgsPreservingQuotedCommas(n),t=null,i=null,r,u,e;try{if(f.length!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;if(t=this.getValueFromArg(f[0]),t=t==null||t==""?"0":t,t=t.split(this.tic).join("")=="TRUE"?"1":t.split(this.tic).join("")=="FALSE"?"0":t,t=t.split(this.tic).join(this._string_empty),i=this.getValueFromArg(f[1]),i=i==null||i==""?"0":i,i=i.split(this.tic).join("")=="TRUE"?"1":i.split(this.tic).join("")=="FALSE"?"0":i,i=i.split(this.tic).join(this._string_empty),r=this._parseDouble(t),u=this._parseDouble(i),r>0xffffffffffff||u>0xffffffffffff||r<0||u<0){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return(r^u).toString()}catch(o){if(this._rethrowLibraryComputationExceptions)throw"The parameters are not correct";else return this.computeIsText(t)==this.trueValueStr||this.computeIsText(i)==this.trueValueStr?this.getErrorStrings()[1].toString():t==""||i==""?this.getErrorStrings()[1].toString():this.getErrorStrings()[1].toString()}};this.computeBinomOInv=function(n){var r=this.splitArgsPreservingQuotedCommas(n),c=r.length,f;if(c!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;var u,t,i=0,e=0,o=this.getValueFromArg(r[0]),s=this.getValueFromArg(r[1]),h=this.getValueFromArg(r[2]);if(o==""&&(r[0]=o="0"),s==""||h==""){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(u=this._parseDouble(o.split(this.tic).join("")),t=this._parseDouble(s.split(this.tic).join("")),i=this._parseDouble(h.split(this.tic).join("")),u==0)return"0";if(u<0||t<=0||t>=1||i<=0||i>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(t>0&&t<1&&i>=0&&i<1){if(e=this._critbinom(u,t,i),e==this.maxValue){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._calculation_overflow];return this.formulaErrorStrings[this._calculation_overflow]}}else{if(u<=0||t<=0||t>=1||i<0||i>1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return e.toString()};this.computeChidist=function(n){var t=this.splitArgsPreservingQuotedCommas(n),o=t.length,f,e,i,r,u;if(o!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;for(e=0,i=0;i-1))return s;var t=this._getDoubleArray(n),h=t.slice(),c=t.length;if(c<=1)return this._errorStrings[0].toString();t.sort();var r=[],e,u=0,f=0;for(i=1;if?(f=u,e=t[i-1],r.length=0,r.push(e)):u==f&&r.push(t[i-1]),u=0);if(u>f&&(f=u,e=t[i-1],r.length=0,r.push(e)),f>0){if(u==f&&r.push(t[i-1]),r.length>1)for(o=0;o-1){e=d;break}return e.toString()}return this._errorStrings[0].toString()};this.computeMunit=function(n){var e=this.splitArgsPreservingQuotedCommas(n),o,t,r,f,i,u;if(e.length!=1||e==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(o=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(o)>-1))return o;if(t=this.getValueFromArg(e[0]).split(this.tic).join(this._string_empty),t=t==this.trueValueStr?1:t==this.falseValueStr?0:t,r=parseInt(t),r<=0||isNaN(r)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this._errorStrings[1].toString()}for(f=[],i=0;i1||n==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(f=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(f)>-1))return f;if(n=this.getValueFromArg(n).split(this.tic).join(this._string_empty),n=n==this.trueValueStr?"1":n==this.falseValueStr?"0":n,n.length>0&&!this._isLetter(n[0])&&(n.indexOf(":")==-1||n.indexOf(this._parseArgumentSeparator)==-1))e=parseFloat(n),isNaN(e)||(r=Math.sign(e));else if(n.length>0&&(n[0]==this.bMARKER||n[0]=="u"||n[0]=="n"||this._indexOfAny(n,this.tokens))){n=n.replace("{","(");n=n.replace("}",")");try{i=this.computeValue(n)}catch(s){return s.message}if(t=parseFloat(i),isNaN(t))return this.formulaErrorStrings[this._invalid_arguments];r=Math.Sign(t)}else for(o=this.getCellsFromArgs(n),u=0;u0&&(t=parseFloat(i),!isNaN)){r=Math.sign(t);break}}return r.toString()};this.computeBigMul=function(n){var t=this.splitArgsPreservingQuotedCommas(n),u,i,r;if(t.length!=2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(u=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(u)>-1))return u;if(t[0]=t[0].toString()==this.trueValueStr?1:t[0].toString()==this.falseValueStr?0:t[0].split(this.tic).join(this._string_empty),t[1]=t[1].toString()==this.trueValueStr?1:t[1].toString()==this.falseValueStr?0:t[1].split(this.tic).join(this._string_empty),this.computeIsNumber(t[0]).toString()!=this.trueValueStr||this.computeIsNumber(t[1]).toString()!=this.trueValueStr){if(this._rethrowLibraryComputationExceptions)throw this._errorStrings[4].toString();return this._errorStrings[4].toString()}if(n.length>150){if(this._rethrowLibraryComputationExceptions)throw this._errorStrings[4].toString();return this._errorStrings[4].toString()}return i=this.getValueFromArg(t[0]),i=i.toString()==this.trueValueStr?1:i.toString()==this.falseValueStr?0:i,i=parseInt(i),r=this.getValueFromArg(t[1]),r=r.toString()==this.trueValueStr?1:r.toString()==this.falseValueStr?0:r,r=parseInt(r),(i*r).toString()};this.computeNormInv=function(n){var t=this.splitArgsPreservingQuotedCommas(n),s=t.length,e,r,o,u,f,i;if(s!=3||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(e)>-1))return e;for(f=0,i=0;i=1||u<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments]+this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}f=this._normalinv(r,o,u)}return f<=0?this.formulaErrorStrings[this._iterations_dont_converge]:f.toString()};this.computeSlope=function(n){var i=this.splitArgsPreservingQuotedCommas(n),y=i.length,h,c,e,t,s;if(y!=2||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(h=this.getValueFromArg(i[0]),c=this.getValueFromArg(i[1]),!this._isCellReference(i[0])&&this.getEnableFormulaErrorValidation()&&(e=this.formulaErrorStringCheck(n,FormulaArgumentType.Text),this.getErrorStrings().indexOf(e)>-1))return e;if(!this._isCellReference(i[0])&&h==this._string_empty||!this._isCellReference(i[1])&&c==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}var u=this._getDoubleArray(i[0]),r=this._getDoubleArray(i[1]),o=r.length;if(o!=u.length){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}if(r.length==0||u.length==0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}var f=0,l=0,a=0,v=0;for(t=0;t-1)for(s=this.getCellsFromArgs(u[r]),f=0;f-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[_invalid_arguments];return e}if(i=parseFloat(e.split(this.tic).join(this._string_empty)),(!isNaN(i)||s[f].length>0)&&i>0)t.push(i);else{if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[_invalid_arguments];return this._errorStrings[4].toString()}}else{if(h=this.getValueFromArg(u[r]).split(this.tic).join(this._string_empty),this._errorStrings.indexOf(h)>-1&&this._rethrowLibraryComputationExceptions)return e;if(!this._isCellReference(u[r])&&h==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this._errorStrings[1].toString()}if(i=parseFloat(h),isNaN(i)){if(!this._isCellReference(u[r])&&!u[r].startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[_invalid_arguments];return this._errorStrings[5].toString()}if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[_invalid_arguments];return this._errorStrings[1].toString()}if(i>=0)i=parseInt(i),t.push(i);else{if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[_invalid_arguments];return this._errorStrings[4].toString()}}if(t.length==1)return t[0].toString();for(o=0;o2&&o0)for(e=0;e-1)for(--c,y=this.getCellsFromArgs(i[e]),l=0;l-1)for(s=this.getCellsFromArgs(i[u]),o=0;o0&&t>=0)r[f]=parseInt(t),f++;else return this.getErrorStrings()[4].toString()}else{if(h=this.getValueFromArg(i[u]).split(this.tic).join(this._string_empty),this._errorStrings.indexOf(h)>-1)return h;if(t=parseFloat(h),isNaN(t))return this.getErrorStrings()[1].toString();if(i[f].length>0&&t>=0)r[f]=parseInt(t),f++;else return this.getErrorStrings()[4].toString()}return r.length==1?r[0].toString():(p=r[0]*r[1],v=r[0].toString()+this._parseArgumentSeparator+r[1].toString(),a=this.computeGcd(v),w=p/parseInt(a),w.toString())};this.computeTruncate=function(n){var u=this.splitArgsPreservingQuotedCommas(n),f=u.length,i,r,t;if(f!=1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(i=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(i)>-1))return i;if(n.length>15){if(this._rethrowLibraryComputationExceptions)throw this._errorStrings[4].toString();return this._errorStrings[4].toString()}return r=this._string_empty,t=this.getValueFromArg(u[0]).split(this.tic).join(this._string_empty),n=t==this.trueValueStr?1:t==this.falseValueStr?0:t,t=parseFloat(n),isNaN(t)&&t>=0&&(r=t),r.toString()};this.computeCoth=function(n){var o=this.splitArgsPreservingQuotedCommas(n),s=o.length,r,u,f,i,e,t;if(s!=1||n==""){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(this.getEnableFormulaErrorValidation()&&(r=this.formulaErrorStringCheck(n,FormulaArgumentType.Numbers),this.getErrorStrings().indexOf(r)>-1))return r;if(n=this.getValueFromArg(n),u=!1,n=n.split(this.tic).join("")=="TRUE"?"1":n.split(this.tic).join("")=="FALSE"?"0":n,f=this.computeIsNumber(n),f==this.trueValueStr&&(i=n,i.includes("-")&&(u=!0),i=i.includes("u")?i.replace("u",""):i,e=this._parseDouble(i),e>=134217728)){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(n=="0"){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return n=n.includes("-")?n.replace("-",""):n,t=this._computeMath(n,Math.tanh),(t!="#NUM!"||t!="#VALUE!")&&(t=(1/parseFloat(t)).toString()),u&&(t="-"+t),t};this._initLibraryFunctions()},CalcEngine.CalcEngine=function(){},CalcEngine.getFormulaCharacter=function(){return this._formulaChar=='\0'&&(this._formulaChar="="),this._formulaChar},CalcEngine._formulaChar="=",CalcEngine.sheetFamilyID=0,CalcEngine._tokenCount=0,CalcEngine.modelToSheetID=null,CalcEngine._sheetFamiliesList=null,CalcEngine._defaultFamilyItem=null,CalcEngine.createSheetFamilyID=function(){return this.sheetFamilyID==Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},CalcEngine.getSheetFamilyItem=function(n){if(this.sheetFamilyID==0)return CalcEngine._defaultFamilyItem==null&&(CalcEngine._defaultFamilyItem=new GridSheetFamilyItem),CalcEngine._defaultFamilyItem;CalcEngine._sheetFamiliesList==null&&(CalcEngine._sheetFamiliesList=new HashTable);var t=CalcEngine.modelToSheetID.getItem(n);return CalcEngine._sheetFamiliesList.containsKey(t)||CalcEngine._sheetFamiliesList.add(t,new GridSheetFamilyItem),CalcEngine._sheetFamiliesList.getItem(t)},CalcEngine.resetSheetFamilyID=function(){this.sheetFamilyID=0;CalcEngine.modelToSheetID!=null&&(CalcEngine.modelToSheetID.clear(),CalcEngine.modelToSheetID=null);CalcEngine._sheetFamiliesList!=null&&(CalcEngine._sheetFamiliesList.clear(),CalcEngine._sheetFamiliesList=null,this.resetSheetIDs())},CalcEngine.resetSheetIDs=function(){this._tokenCount=0},CalcEngine.unregisterGridAsSheet=function(n,t){var i=CalcEngine.getSheetFamilyItem(t),r=n.toUpperCase(),u;i.sheetNameToParentObject!=null&&i.sheetNameToParentObject.containsKey(r)&&(i.sheetNameToParentObject.remove(r),u=i.sheetNameToToken.getItem(r),i.sheetNameToToken.remove(r),i.tokenToParentObject.remove(u),i.parentObjectToToken.remove(t))},CalcEngine}(jQuery,Syncfusion),function(n){n[n.None=0]="None";n[n.VLOOKUP=1]="VLOOKUP";n[n.HLOOKUP=2]="HLOOKUP";n[n.Both=3]="Both";n[n.OptimizeForMatches=4]="OptimizeForMatches"}(LookupCachingMode||(LookupCachingMode={})),function(n){n[n.FormulaSet=0]="FormulaSet";n[n.NonFormulaSet=1]="NonFormulaSet";n[n.CalculatedValueSet=2]="CalculatedValueSet"}(FormulaInfoSetAction||(FormulaInfoSetAction={}));CalcQuickBase=function(){function n(n){this.resetStaticMembers=n;this._calcQuickID=0;this._controlModifiedFlags=null;this._dataStore=null;this._engine={};this._keyToRowsMap=null;this._keyToVectors=null;this._nameToControlMap=null;this._rowsToKeyMap=null;this._isValueSetEventChanged=!1;this._autoCalc=!1;this._isIE8=!1;this._cellPrefix="!0!A";this._checkKeys=!0;this._disposeEngineResource=!0;this._ignoreChanges=!1;this._leftBrace="{";this._tic='"';this._leftBracket="[";this._rightBracket="]";this._validLeftChars="+-*/><=^(&,";this._validRightChars="+-*/><=^)&,";this.getKeyValue=function(n){if(n=n.toUpperCase(),this.getDataStore().containsKey(n)){var t=this.getDataStore().getItem(n),i=t.getFormulaText();if(i.length>0&&i[0]==CalcEngine.getFormulaCharacter()&&t.calcID!=this.getEngine().getCalcID()){this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString();i=i.substring(1);try{t.setParsedFormula(this.getEngine().parseFormula(this._markKeys(i)))}catch(r){if(this.getCheckKeys())return t.setFormulaValue(r.Message),t.calcID=this.getEngine().getCalcID(),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,t.getFormulaValue(),2)),this.getDataStore().getItem(n).getFormulaValue()}try{t.setFormulaValue(this.getEngine().computeFormula(t.getParsedFormula()))}catch(r){if(this.getThrowCircularException()&&r.toString().indexOf(this.getEngine().formulaErrorStrings[this.getEngine().circular_reference_])==0)throw r;}t.calcID=this.getEngine().getCalcID();this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,t.getFormulaValue(),2))}return this.getEngine().getThrowCircularException()&&this.getEngine().getIterationMaxCount()>0&&t.setFormulaValue(this.getEngine().handleIteration(this.getEngine().cell,t)),this.getDataStore().getItem(n).getFormulaValue()}return this.getKeyToVectors().containsKey(n)?this.getKeyToVectors().getItem(n).toString():""};this.setKeyValue=function(n,t){var i,f,u,e,r,s,c;if(n=n.toUpperCase(),i=this._isIE8?t.toString().replace(/^\s+|\s+$/g,""):t.toString().trim(),!this.getDataStore().containsKey(n)||i.indexOf(this._leftBrace)==0){if(i.indexOf(this._leftBrace)==0){this.getKeyToVectors().containsKey(n)||this.getKeyToVectors().add(n,"");i=i.substr(1,i.length-2);var h=this.getKeyToRowsMap().length+1,o=i.split(this.getEngine().getParseArgumentSeparator()),l="A"+h+":A"+(h+o.length-1);for(this.getKeyToVectors()[n]=l,f=0;f0&&r.getFormulaText()!=i&&(s=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString(),c=this.getEngine().getDependentFormulaCells().getItem(s),c!=null&&this.getEngine().clearFormulaDependentCells(s));i.length>0&&i[0]==CalcEngine.getFormulaCharacter()?(r.setFormulaText(i),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,r.getFormulaValue(),2))):r.getFormulaValue()!=i&&(r.setFormulaText(""),r.setParsedFormula(""),r.setFormulaValue(i),this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(n,r.getFormulaValue(),2)));this.getAutoCalc()&&this.updateDependencies(n)};this.resetKeys=function(){this.getDataStore().clear();this.getKeyToRowsMap().clear();this.getRowsToKeyMap().clear();this.getKeyToVectors().clear();this.getNameToControlMap().clear()};this._checkAdjacentPiece=function(n,t,i){var r=!0;return n=this._isIE8?n.replace(/^\s+|\s+$/g,""):n.trim(),n.length>0&&(r=t.indexOf(n[i?0:n.length-1])>-1),r};this.createEngine=function(){return new CalcEngine(this)};this.dispose=function(){this._dataStore=null;this._rowsToKeyMap=null;this._keyToRowsMap=null;this._keyToVectors=null;this._controlModifiedFlags=null;this._nameToControlMap=null;this.getDisposeEngineResource()&&(this._engine.getDependentFormulaCells().clear(),this._engine.getDependentCells().clear(),this._engine!=null&&this._engine.dispose(),this._engine=null)};this.tryParseAndCompute=function(n){var t="";try{t=this.parseAndCompute(n)}catch(i){t=i.message}return t};this.getFormula=function(n){return(n=n.toUpperCase(),this.getDataStore().containsKey(n))?this.getDataStore().getItem(n).getFormulaText():""};this.getValueRowCol=function(n,t){var u=this.getRowsToKeyMap().getItem(t).toString(),i=this.getKeyValue(u).toString(),r;return i!=null&&i[i.length-1]=="%"&&i.length>1&&(r=this._parseDouble(i.substring(0,i.length-1)),isNaN(r)&&(i=(Number(r)/100).toString())),i};this.initCalcQuick=function(n){this._dataStore=new HashTable;this._rowsToKeyMap=new HashTable;this._keyToRowsMap=new HashTable;this._keyToVectors=new HashTable;this._controlModifiedFlags=new HashTable;this._nameToControlMap=new HashTable;var t=CalcEngine.createSheetFamilyID();this._engine=this.createEngine();n&&(CalcEngine.resetSheetFamilyID(),this._engine.getDependentFormulaCells().clear(),this._engine.getDependentCells().clear());this._cellPrefix="!"+t+"!A";this._engine.registerGridAsSheet(RangeInfo.getAlphaLabel(this.getCalcQuickID()),this,t);this._engine.setCalculatingSuspended(!0);this._engine.ignoreValueChanged=!0;this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1};this._markKeys=function(n){for(var t=n.indexOf(this._leftBracket),r,i,u,f;t>-1;)if(r=n.substring(t).indexOf(this._rightBracket)-1,i="",r>0)if(i=n.substring(t+1,r+t+1).toUpperCase(),this.getKeyToVectors().containsKey(i)){if(u=t+r+20?n.substring(0,t):"",this.getCheckKeys()&&!this._checkAdjacentPiece(f,this._validLeftChars,!1))throw"not followed properly"+i;n=f+this.getKeyToVectors().getItem(i).toString()+u;t=n.indexOf(this._leftbraket)}else if(this.getKeyToRowsMap().containsKey(i)){if(u=t+r+20?n.substring(0,t):"",this.getCheckKeys()&&!this._checkAdjacentPiece(f,this._validLeftChars,!1))throw"not followed properly"+i;n=f+"A"+this.getKeyToRowsMap().getItem(i).toString()+u;t=n.indexOf(this._leftBracket)}else if(n.toUpperCase().indexOf(this._tic+this._leftBracket+i+this._rightBracket+this.tic)>0)break;else throw"Unknown key: "+i;else t=-1;return n};this.parseAndCompute=function(n){return n.length>0&&n[0]==this.getEngine().getFormulaCharacter()&&(n=n.substring(1)),this.getEngine().parseAndComputeFormula(this._markKeys(n))};this.refreshAllCalculations=function(){var i,u;if(this.getAutoCalc()){for(this.setDirty(),this.ignoreChanges=!0,i=0;i0&&t[0]==this.getEngine().getFormulaCharacter()&&n.calcID!=this.getEngine().getCalcID()&&(t=t.substring(1),this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(r).toString(),n.setParsedFormula(this.getEngine().parseFormula(this._markKeys(t))),n.setFormulaValue(this.getEngine().computeFormula(n.getParsedFormula())),n.calcID=this.getEngine().getCalcID(),u=parseInt(this.getKeyToRowsMap().getItem(r)),this.getEngine().valueChanged(this,new ValueChangedArgs(u,1,n.getFormulaValue())));this._valueSetEvent!=null&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(r,n.getFormulaValue(),2))}this.ignoreChanges=!1}};this.setDirty=function(){this.getEngine().updateCalcID()};this.setValueRowCol=function(){};this.updateDependencies=function(n){var u,t,i,r;if(this.getAutoCalc()&&(u=this._cellPrefix+this.getKeyToRowsMap().getItem(n).toString(),t=this.getEngine().getDependentCells().getItem(u),this.setDirty(),t!=null))for(i=0;i-1&&(r=parseInt(t[i].substring(r+1)),n=this.getRowsToKeyMap().getItem(r).toString(),this.ignoreChanges=!0,this.setKeyValue(n,this.getKeyValue(n)),this.ignoreChanges=!1)};this.initCalcQuick(n)}return n.prototype.getAutoCalc=function(){return this._autoCalc},n.prototype.setAutoCalc=function(n){this._autoCalc=n;this.getEngine().setCalculatingSuspended(!n);this.getEngine().setUseDependencies(n);n&&this.setDirty()},n.prototype.getCalcQuickID=function(){return this._calcQuickID++,this._calcQuickID==Number.MAX_VALUE&&(this._calcQuickID=1),this._calcQuickID},n.prototype.getCheckKeys=function(){return this._checkKeys},n.prototype.setCheckKeys=function(n){this._checkKeys=n},n.prototype.getControlModifiedFlags=function(){return this._controlModifiedFlags},n.prototype.getDataStore=function(){return this._dataStore},n.prototype.getDisposeEngineResource=function(){return this._disposeEngineResource},n.prototype.setDisposeEngineResource=function(n){this._disposeEngineResource=n},n.prototype.getEngine=function(){return this._engine},n.prototype.getFormulaCharacter=function(){return this.getEngine().getFormulaCharacter()},n.prototype.setFormulaCharacter=function(n){this.getEngine().setFormulaCharacter(n)},n.prototype.getKeyToRowsMap=function(){return this._keyToRowsMap},n.prototype.getKeyToVectors=function(){return this._keyToVectors},n.prototype.getNameToControlMap=function(){return this._nameToControlMap},n.prototype.getRowsToKeyMap=function(){return this._rowsToKeyMap},n.prototype.getThrowCircularException=function(){return this.getEngine().getThrowCircularException()},n.prototype.setThrowCircularException=function(n){this.getEngine().setThrowCircularException(n)},n.prototype.getValueSetEventHandler=function(){return this._valueSetEvent==null&&(this._valueSetEvent=new ValueSetEvent),this._valueSetEvent.getValueSet()},n.prototype.setValueSetEventHandler=function(n){this._valueSetEvent==null&&(this._valueSetEvent=new ValueSetEvent);this._valueSetEvent.setValueSet(n)},n}();window.CalcQuick=function(n){function t(){n.apply(this,arguments);this.registerControlArray=function(n){for(var t=0;t0&&t<9;)n--,f="A".charCodeAt(0),u[t]=String.fromCharCode(n%26+f),n=parseInt((n/26).toString()),t++;for(r=[],i=0;i-1&&this.wrapper.find("span:first").hasClass("e-chk-inact")&&(this._isChecked=!1,r.splice(n.inArray(this.model.value,this.model.checked()),1),this._hiddenInput.setAttribute("name",this.model.name)))},disable:function(){this.wrapper.hasClass("e-disable")||(this.wrapper.addClass("e-disable"),this.wrapper[0].setAttribute("aria-disabled",!0),this.element[0].setAttribute("disabled","disabled"),this._isIE8&&this.span.addClass("e-disable"),this._unWireEvents(),this.model.enabled=!1)},enable:function(){this.wrapper.hasClass("e-disable")&&(this.wrapper.removeClass("e-disable"),this.wrapper[0].setAttribute("aria-disabled",!1),this.element.prop("disabled",!1),this._isIE8&&this.span.removeClass("e-disable"),this._wireEvents(),this.model.enabled=!0)},isChecked:function(){if(this._isChecked!=null&&this._isChecked!=i)return this._isChecked}});t.CheckboxSize={Small:"small",Medium:"medium"};t.CheckState={Check:"check",Uncheck:"uncheck",Indeterminate:"indeterminate"}}(jQuery,Syncfusion),function(n,t){t.widget("ejRadioButton","ej.RadioButton",{_rootCSS:"e-radiobtn",element:null,_requiresID:!0,model:null,validTags:["input"],_addToPersist:["checked"],_setFirst:!1,angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{id:null,name:null,value:null,checked:!1,cssClass:"",text:"",enableRTL:!1,htmlAttributes:{},enablePersistence:!1,idPrefix:"ej",size:"small",enabled:!0,validationRules:null,validationMessage:null,validationMessages:null,beforeChange:null,change:null,create:null,destroy:null},dataTypes:{id:"string",name:"string",enablePersistence:"boolean",size:"enum",enabled:"boolean",idPrefix:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data"},observables:["checked"],checked:t.util.valueFunction("checked"),_init:function(n){var i=t.browserInfo();this._cloneElement=this.element.clone();this._isIE8=i.name=="msie"&&i.version=="8.0"?!0:!1;this._setValue();this._renderControl();this.isChecked&&this._checkedHandler();t.isNullOrUndefined(this.radbtn.attr("disabled"))||(this.model.enabled=!1);this._setEnabled(this.model.enabled);this._addAttr(this.model.htmlAttributes);t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());this._wireEvents();this.initialRender=!1},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="class"?i.div.addClass(n):t=="name"?i.radbtn.attr(t,n):t=="required"?i.radbtn.attr(t,n):t=="disabled"&&n=="disabled"?i.disable():t=="checked"&&n=="checked"?i._checkedChange(!0,!0):i.div.attr(t,n)})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,f,i,u,e;this.element.find("input").rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();f=this.element.find("input").attr("name");r.settings.messages[f]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[f][i]=n.validator.messages[i];for(e in this.model.validationMessages)i==e?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[f][i]=u!=null?u:n.validator.messages[i]}},_setModel:function(t){for(var i in t)switch(i){case"cssClass":this._changeSkin(t[i]);break;case"enableRTL":this.model.text?t[i]?this.div.addClass("e-rtl"):this.div.removeClass("e-rtl")&&this.element.closest(".e-radiobtn-wrap").hasClass("e-rtl")?this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl"):"":t[i]?this.element.closest(".e-radiobtn-wrap").addClass("e-rtl"):this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl");break;case"text":this._setText(t[i]);break;case"size":this._setSize(t[i]);break;case"validationRules":this.model.validationRules!=null&&(this.element.find("input").rules("remove"),this.model.validationMessages=null);this.model.validationRules=t[i];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=t[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=t[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"checked":n(this.div).removeClass("e-material-animate");typeof this.checked()=="boolean"?(this.model.checked=t[i],this._checkedChange(this.model.checked)):t[i]()!=null&&t[i]()==this.element.find(".e-input").attr("value")&&this._checkedChange(t[i]());break;case"enabled":this._setEnabled(t[i]);break;case"id":this._setIdAttr(t[i]);break;case"name":this.radbtn.attr("name",t[i]);break;case"value":this.radbtn.attr("value",t[i]);break;case"htmlAttributes":this._addAttr(t[i])}},_destroy:function(){this.radbtn.remove();this._cloneElement.removeClass("e-js e-input e-radiobtn");this._cloneElement.insertBefore(this.element);this.element.remove()},_changeSkin:function(n){this.model.cssClass!=n&&(this.element.removeClass(this.model.cssClass).addClass(n),this.div.removeClass(this.model.cssClass).addClass(n))},_setValue:function(){t.isNullOrUndefined(this.element.attr("type"))&&this.element.attr("type","radio");t.isNullOrUndefined(this.element.attr("id"))||(this.model.id=this.element.attr("id"));t.isNullOrUndefined(this.element.attr("name"))||(this.model.name=this.element.attr("name"));t.isNullOrUndefined(this.element.attr("value"))||(this.model.value=this.element.attr("value"));this.element.attr({id:this.model.id,name:this.model.name,value:this.model.value});typeof this.checked()=="boolean"?this.model.checked=this.isChecked=this.model.checked||this.element.attr("checked")=="checked":this.isChecked=this.element.attr("value")==this.checked();this.isChecked&&this.element.attr("checked","checked");this._hiddenValue=this.element.attr("value");this._isUI=!1},_setIdAttr:function(t){n("#"+this.model.idPrefix+this.model.id+"_wrapper").attr("id",this.model.idPrefix+t+"_wrapper");n("#"+this.model.idPrefix+this.model.id).attr("id",this.model.idPrefix+t);this.radbtn.attr("id",t)},_setSize:function(n){n==t.RadioButtonSize.Medium?(this.span.removeClass("e-radsmaller").addClass("e-radmedium"),this.div.removeClass("e-radsmall").addClass("e-radmed")):(this.span.removeClass("e-radmedium").addClass("e-radsmaller"),this.div.removeClass("e-radmed").addClass("e-radsmall"))},_setEnabled:function(n){n?this.enable():this.disable()},_renderControl:function(){this.initialRender=!0;var i=t.browserInfo();this.div=i.name=="msie"&&i.version=="8.0"?n('
    <\/div>'):n('
    <\/div>');this.div.attr({id:this.model.idPrefix+this.model.id,role:"radio",tabindex:0,"aria-checked":!1});this.span=n("<\/span>");this.span.addClass("e-spanicon");this._setSize(this.model.size);this.spanImg=n('<\/span>',"",{},{role:"presentation"});this.element.addClass("e-input");this.div.addClass(this.model.cssClass);this.span.append(this.spanImg);this.div.insertBefore(this.element);this.div.append(this.element);this.div.append(this.span);this._setTextWrapper(this.model.text);this.radbtn=this.element;this.element=this.div},_setTextWrapper:function(n){n!=""?(this.txtSpan=t.buildTag("div.e-text",n),this.div.append(this.txtSpan),this.model.enableRTL&&this.div.addClass("e-rtl")):this.model.enableRTL&&this.element.closest(".e-radiobtn-wrap").addClass("e-rtl")},_setText:function(n){this.model.text==""&&n!=""?this._setTextWrapper(n):this.txtSpan.html(n)},_wireEvents:function(){this._on(this.element,"click",function(n){this._isUI=!0;this._checkedHandler(n)});this._on(this.element,"focus",this._focusIn);this._on(this.element,"focusout",this._focusOut)},_focusIn:function(){n(this.element).addClass("e-focus");n(this.element).on("keydown",n.proxy(this._checkUnCheck,this))},_focusOut:function(){n(this.element).removeClass("e-focus");n(this.element).off("keydown",n.proxy(this._checkUnCheck,this))},_checkUnCheck:function(n){(n.keyCode==32||n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40)&&(n.preventDefault(),this._checkedHandler())},_checkedHandler:function(t){t&&(this._interacted=!0);this.element.hasClass("e-disable")||(this.isChecked=typeof this.checked()=="boolean"?this.radbtn.attr("checked")=="checked"?!0:!1:this.checked()==this.radbtn.attr("value"),n(this.element).find(".e-rad-icon").hasClass("e-circle_01")||this._changeEvent(!0),t&&n(this.div).addClass("e-material-animate"))},_checkedChange:function(n,t){this.isChecked=n;this._changeEvent(t)},_changeEvent:function(i){var u={isChecked:this.isChecked,isInteraction:!!i};if(!this.initialRender&&!0==this._trigger("beforeChange",u))return!1;if(n(this.element).find(".e-rad-icon").hasClass("e-circle_01"))this.spanImg.removeClass("e-circle_01").addClass("e-rad-select"),this.span.removeClass("e-rad-active"),this.div.attr({tabindex:0,"aria-checked":!1}),this.radbtn.removeAttr("checked");else{var f=this.element.find(".e-input").attr("name"),e=n('input.e-radiobtn[name="'+f+'"]:radio'),o=this,s=this.element.find(".e-input"),r=n(s).data("ejRadioButton");u.isChecked&&(this.spanImg.addClass("e-circle_01").removeClass("e-rad-select"),this.span.addClass("e-rad-active"),this.div.attr({tabindex:0,"aria-checked":!0}),this.radbtn.attr("checked","checked"));n.each(e,function(i,r){o._interacted&&n(n(r).closest(".e-widget")).find("span.e-spanicon").hasClass("e-rad-active")&&n(r).closest(".e-radiobtn-wrap").addClass("e-material-animate");n(r).closest(".e-radiobtn-wrap").find(".e-rad-icon").removeClass("e-circle_01").addClass("e-rad-select");n(r).closest(".e-radiobtn-wrap").find(".e-spanicon").removeClass("e-rad-active");n(r).closest(".e-radiobtn-wrap").attr({tabindex:0,"aria-checked":!1});var u=n(r).data("ejRadioButton");t.isNullOrUndefined(u)||u.checked()==null||typeof u.checked()!="boolean"||(u.model.checked=!1,u.isChecked=!1,u.radbtn.removeAttr("checked"))});r!=null&&r.checked()!=null&&typeof r.checked()=="boolean"?r.model.checked=!0:r.checked(r.radbtn.attr("value"));this.element.find(".e-rad-icon").addClass("e-circle_01").removeClass("e-rad-select");this.span.addClass("e-rad-active");this.div.attr({tabindex:0,"aria-checked":!0});this._isUI&&this.element.find(".e-input").click();this.isChecked=!0;this.isChecked==!0?this.radbtn.attr("checked","checked"):this.radbtn.removeAttr("checked")}u={isChecked:this.isChecked,isInteraction:!!i};this.initialRender||this._trigger("change",u);i&&this._trigger("_change",{value:this._hiddenValue})},disable:function(){this.element.hasClass("e-disable")||(this.element.addClass("e-disable"),this.radbtn.attr("disabled","disabled"));this._isIE8&&this.span.addClass("e-disable");this.div.attr("aria-disabled",!0);this.model.enabled=!1},enable:function(){this.element.hasClass("e-disable")&&(this.element.removeClass("e-disable"),this.radbtn.prop("disabled",!1));this._isIE8&&this.span.removeClass("e-disable");this.div.attr("aria-disabled",!1);this.model.enabled=!0}});t.RadioButtonSize={Small:"small",Medium:"medium"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejAutocomplete","ej.Autocomplete",{element:null,model:null,validTags:["input"],_ignoreOnPersist:["fields","dataSource","query","focusIn","focusOut","change","select","create","destroy","open","close","actionComplete","actionSuccess","actionFailure"],_setFirst:!1,_timeStamp:0,_rootCSS:"e-autocomplete",type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"]},_requiresID:!0,defaults:{dataSource:null,query:null,fields:{text:null,key:null,category:null,groupBy:null,htmlAttributes:null},locale:"en-US",name:null,template:null,allowGrouping:!1,enableDistinct:!1,ignoreAccent:!1,allowSorting:!0,sortOrder:"ascending",htmlAttributes:{},multiSelectMode:"none",delimiterChar:",",allowAddNew:!1,addNewText:"Add New",showRoundedCorner:!1,readOnly:!1,cssClass:"",watermarkText:null,value:"",selectValueByKey:null,filterType:"startswith",caseSensitiveSearch:!1,showLoadingIcon:!0,showResetIcon:!1,itemsCount:0,minCharacter:1,delaySuggestionTimeout:200,showPopupButton:!1,highlightSearch:!1,enableAutoFill:!1,enableRTL:!1,enabled:!0,visible:!0,height:"",width:"",emptyResultText:"No suggestions",animateType:"slide",showEmptyResultText:!0,enablePersistence:!1,popupHeight:"152px",popupWidth:"auto",autoFocus:!1,loadOnDemand:!1,isChangeOnBlur:!1,multiColumnSettings:{enable:!1,showHeader:!0,stringFormat:"{0}",searchColumnIndices:[],columns:[{field:null,headerText:null,textAlign:"left",headerTextAlign:"left",cssClass:"",type:"string",filterType:"startswith",visible:!0}]},validationRules:null,validationMessage:null,focusIn:null,focusOut:null,change:null,select:null,create:null,open:null,close:null,destroy:null,actionBegin:null,actionComplete:null,actionSuccess:null,actionFailure:null},dataTypes:{autoFocus:"boolean",watermarkText:"string",locale:"string",cssClass:"string",filterType:"enum",caseSensitiveSearch:"boolean",showLoadingIcon:"boolean",template:"string",allowGrouping:"boolean",enableDistinct:"boolean",allowSorting:"boolean",sortOrder:"enum",allowAddNew:"boolean",addNewText:"string",showRoundedCorner:"boolean",showResetIcon:"boolean",readOnly:"boolean",itemsCount:"number",animateType:"enum",minCharacter:"number",showPopupButton:"boolean",highlightSearch:"boolean",enableAutoFill:"boolean",enableRTL:"boolean",loadOnDemand:"boolean",multiSelectMode:"enum",delimiterChar:"string",emptyResultText:"string",showEmptyResultText:"boolean",enabled:"boolean",visible:"boolean",enablePersistence:"boolean",isChangeOnBlur:"boolean",dataSource:"data",query:"data",fields:"data",validationRules:"data",validationMessage:"data",htmlAttributes:"data",multiColumnSettings:"data",columns:"data",searchColumnIndices:"array"},observables:["value","selectValueByKey"],value:t.util.valueFunction("value"),_selectValueByKey:t.util.valueFunction("selectValueByKey"),enable:function(){this.model.enabled||(this.model.enabled=!0,this.target.disabled=!1,this.element.removeClass("e-disable").attr({"aria-disabled":!1}),this.element.removeAttr("disabled"),this.model.showPopupButton&&this.dropdownbutton.removeClass("e-disable").attr({"aria-disabled":!1}),this.model.multiSelectMode=="visualmode"&&this._ulBox.removeClass("e-disable").attr({"aria-disabled":!1}),this.wrapper.removeClass("e-disable-wrap"))},disable:function(){this.model.enabled&&(this._hideResult(),this.model.enabled=!1,this.target.disabled=!0,this.element.attr("disabled","disabled"),this.element.addClass("e-disable").attr({"aria-disabled":!0}),this.model.showPopupButton&&this.dropdownbutton.addClass("e-disable").attr({"aria-disabled":!0}),this.model.multiSelectMode=="visualmode"&&this._ulBox&&this._ulBox.addClass("e-disable").attr({"aria-disabled":!0}),this.wrapper.addClass("e-disable-wrap"))},clearText:function(){this.model.multiSelectMode=="visualmode"&&this._deleteBox(this._ulBox.children("li"));this.element.val("");this._preVal="";this._valueChange();this._isFocused||this._focusOutAction();this._hideResult()},getValue:function(){var n=this.value();return n==null?"":n},getSelectedItems:function(){return this._isFocused&&this.model.multiSelectMode!="visualmode"&&this._updateSelectedItemArray(this.getValue()),this._selectedItems},_setValue:function(i){var r,u,f;if(this._isWatermark||this._hiddenSpan.css("display","none"),(typeof i=="object"||typeof i=="number"&&isNaN(i)||n.trim(i)=="")&&(i=""),this.model.multiSelectMode=="visualmode"&&this._hiddenInput.val(""),this.element.val(""),this._hiddenInput||(this._hiddenInput=t.buildTag("input#"+this.target.id+"_hidden","",{},{type:"hidden",name:this.element.attr("name")}).insertBefore(this.element)),i)if(this.model.multiSelectMode=="visualmode")if(this._selectedItems=[],this._modelValue=i,this._deleteBox(this._ulBox.children("li")),r=i.split(this.model.delimiterChar),this.element.width(1).val("").removeAttr("placeholder"),t.DataManager&&this.model.dataSource instanceof t.DataManager)this._createBoxForObjectType(r);else if(this.suggestionListItems=this.model.dataSource,this.suggestionListItems&&typeof this.suggestionListItems[0]!="object")for(this._hiddenInput.val(i),u=0,f=r.length;u-1)&&(this.model.multiSelectMode=="none"?this._hiddenInput.val(f||i):this._hiddenInput.val(this._hiddenInput.val()+(f||i)+e));this.model.multiSelectMode=="visualmode"?(r=typeof r=="string"&&this._addNewTemplate&&r.substr(r.length-this._addNewTemplate.length)==this._addNewTemplate?r.replace(this._addNewTemplate,""):r,typeof i=="number"&&(i=this._textFormateString(i)),o=i.indexOf(this._addNewTemplate),this._addNewTemplate&&(i=i.substr(0,i.length-this._addNewTemplate.length)),(!(this._selectValueByKey()==f||f==null)||o>-1)&&this._selectValueByKey(this._selectValueByKey()!=null?this._selectValueByKey()+(o>-1?i:f)+e:(o>-1?i:f)+e),this._modelValue=t.isNullOrUndefined(this.value())?i+e:this.value().indexOf(i)!=-1&&u?i+e:this.value()+i+e,this.element.val("").removeAttr("placeholder").width(1),this._ulBox.append(this._createBox(i)),this.model.height!=""&&(n(this._ulBox).parent().css("overflow","auto"),this.model.showPopupButton&&this._ulBox.parent()[0].scrollHeight!=0&&this.dropdownbutton.css("height",this.model.height)),this._addNewTemplate=null):this.model.multiSelectMode=="delimiter"?(e=this.target.value.lastIndexOf(this.model.delimiterChar),this._typed||this.element.val()==""||u||!this.model.showPopupButton?u?this.element.val(this.element.val()==""?i+this.model.delimiterChar:this.element.val()+i+this.model.delimiterChar):e==-1?this.element.val(this._queryString.substr(0,e+1)+i+this.model.delimiterChar):this.element.val(this._queryString.substr(0,e+this.model.delimiterChar.length)+i+this.model.delimiterChar):!this.model.enableAutoFill||this.showSuggestionBox?this._checkDeli()?this.element.val(this._queryString.substr(0,e)+this.model.delimiterChar+i+this.model.delimiterChar):this.element.val(this.element.val()+this.model.delimiterChar):this._checkDeli()||this.element.val(this.element.val()+this.model.delimiterChar),this._typed=!1):(this.element.val(i),this._selectedItems=[]);this._selectedItems.push(r);this._originalval.push(i);this._moveCaretToEnd(this.element[0])},_removeDuplicates:function(n){return this._selectedItems.length==0?!1:this._selectedItems.indexOf(n)!=-1?!0:void 0},search:function(){this.model.enabled&&this._checkDelimiter()&&(this._hideResult(),this._autoFill=!1,this._queryString=n.trim(this._queryString),this._queryString.length>0&&this._OnTextEnter())},setVisible:function(n){n?this.wrapper.show():this.wrapper.hide()},hide:function(){this._hideResult()},open:function(){this._showFullList()},_changeWatermark:function(n){this._isWatermark?this.element.attr("placeholder",n):this._hiddenSpan.text(n)},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.suggestionList.removeClass(this.model.cssClass).addClass(n)},_setDropdown:function(n){this.model.showPopupButton=n;n?this._renderDropdown():this._destroyDropdown()},_changeHeight:function(n){this.wrapper.height(n)},_changeWidth:function(n){this.wrapper.width(n);this._setListWidth()},_setCulture:function(){this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.addNewText)||(this._localizedLabels.addNewText=this._options.addNewText),t.isNullOrUndefined(this._options.emptyResultText)||(this._localizedLabels.emptyResultText=this._options.emptyResultText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this.model.addNewText=this._localizedLabels.addNewText;this.model.emptyResultText=this._localizedLabels.emptyResultText;this.model.watermarkText=this._localizedLabels.watermarkText},_init:function(n){if(this._options=n,this._selectkey=[],this._hiddenColumns=[],this._setCulture(),!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this.model.fields.groupBy=this.model.fields.groupBy?this.model.fields.groupBy:this.model.fields.category;this._initialize();this._render();this._wireEvents();this.initialRender=!1;this.model.validationRules!=null&&(this._initValidator(),this._setValidation())},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var e,r,f,i,u,o;if(this.model.validationRules){e=this.model.multiSelectMode=="visualmode"?this._hiddenInput:this.element;e.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();f=e.attr("name");r.settings.messages[f]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[f][i]=n.validator.messages[i];for(o in this.model.validationMessage)i==o?u=this.model.validationMessage[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[f][i]=u!=null?u:n.validator.messages[i]}}},_removeDuplicateValue:function(n){return n.split(this.model.delimiterChar).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]).join(this.model.delimiterChar)},_delimiterChar:function(){return this.model.multiSelectMode!="none"?this.model.delimiterChar:""},_setModel:function(r){var u,l,f,e,a,y,p,v,c,o,s,h;for(u in r){switch(u){case"dataSource":this.model.loadOnDemand&&(l=n("#"+this.element[0].id+"_suggestion").get(0),l&&n(l).remove(),this.suggestionList=i);this.model.dataSource=r[u];break;case"watermarkText":this._changeWatermark(r[u]);break;case"delaySuggestionTimeout":this.model.delaySuggestionTimeout=parseInt(r[u]);break;case"value":f=t.util.getVal(r[u]);e=this._delimiterChar();this.model.multiSelectMode!="none"&&(s=f.substr(f.length-e.length)==e?f:f+e,f=f==""?this.value():(this.value()?this.value():"")+s,this.model.multiSelectMode=="visualmode"&&(f=f.split(e).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]),f=f.join(e)));this.value(this._setValue(f));a=this.model.dataSource;t.DataManager&&a instanceof t.DataManager?this._loadInitData():this._setHiddenkeyByValue(a);this._modelValue=this.value();y=this.model.multiSelectMode=="visualmode"?this._hiddenInput.val():this.element.val();this._changeEvtTrigger(y);this.model.showResetIcon&&this._showReset();break;case"showPopupButton":this._setDropdown(r[u]);break;case"enableRTL":this._RightToLeft(r[u]);break;case"showRoundedCorner":this._setRoundedCorner(r[u]);break;case"readOnly":this._checkReadOnly(r[u]);break;case"delimiterChar":p=this.model.delimiterChar;r[u]=this._validateDelimiter(r[u]);this.model.delimiterChar=r[u];this.element.val(this.value().replace(new RegExp(p,"g"),this.model.delimiterChar));this.value(this.element.val());break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessage=null);this.model.validationRules=r[u];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=r[u];this.model.validationRules!=null&&this.model.validationMessage!=null&&(this._initValidator(),this._setValidation());break;case"locale":t.Autocomplete.Locale[r[u]]?(this.model.locale=r[u],this._setCulture(),this._setWatermark()):this.model.locale=r[u];break;case"filterType":v=[];for(o in t.filterType)t.filterType.hasOwnProperty(o)&&v.push(t.filterType[o]);v.indexOf(r[u])>-1?this.model.filterType=r[u]:r[u]=this.model.filterType;break;case"multiSelectMode":this.model.multiSelectMode=r[u];c=this._delimiterChar();this.model.multiSelectMode!="none"&&(o=this._selectValueByKey(),s=this.value(),s&&(s=s.substr(s.length-c.length)==c?s:s+c,this.value(s),this.model.multiSelectMode=="visualmode"&&this.value(this._removeDuplicateValue(this.value()))),o&&(this._selectValueByKey(o.substr(o.length-c.length)==c?o:o+c),this.model.multiSelectMode=="visualmode"&&this._selectValueByKey(this._removeDuplicateValue(this._selectValueByKey()))));r[u]=="visualmode"?(this.model.validationRules!=null&&this.element.rules("remove"),this.element.val()!=""&&this._isWatermark&&this.element.removeAttr("placeholder")):this.element.hasClass("e-visual-mode")&&this._destroyBoxModel();this._destroy();this._init();this._setValue(this.value());this._setValidation();t.isNullOrUndefined(this.element.attr("placeholder"))&&this._isWatermark&&this._setWatermark();break;case"enabled":this._disabled(!r[u]);break;case"visible":this.setVisible(r[u]);break;case"height":this._changeHeight(r[u]);break;case"width":this._changeWidth(r[u]);break;case"cssClass":this._changeSkin(r[u]);break;case"itemsCount ":(r[u]<=0||isNaN(r[u]))&&(r[u]=0);break;case"popupHeight":this.suggestionList.css({"max-height":isNaN(r[u])?r[u]:r[u]+"px"});break;case"popupWidth":this.model.popupWidth=r[u];this._setListWidth();break;case"selectValueByKey":e=this._delimiterChar();o=t.util.getVal(r[u]);this.selectValueByKey(o);h=this.model.multiSelectMode!="none"?this._selectValueByKey()+r[u]:r[u];h=h.split(e).reduce(function(n,t){return n.indexOf(t)<0&&n.push(t),n},[]);h=h.join(e);r[u]=h.substr(h.length-e.length)==e?h:h+e;break;case"htmlAttributes":this._addAttr(r[u]);break;case"emptyResultText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.emptyResultText=this.model.emptyResultText=r[u];this._setCulture();break;case"addNewText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.addNewText=this.model.emptyResultText=r[u];this._setCulture();break;case"multiColumnSettings":t.isNullOrUndefined(r[u].enable)||(this.model.multiColumnSettings.enable=r[u].enable);t.isNullOrUndefined(r[u].showHeader)||(this.model.multiColumnSettings.showHeader=r[u].showHeader);t.isNullOrUndefined(r[u].stringFormat)||(this.model.multiColumnSettings.stringFormat=r[u].stringFormat);t.isNullOrUndefined(r[u].searchColumnIndices)||(this.model.multiColumnSettings.searchColumnIndices=r[u].searchColumnIndices);t.isNullOrUndefined(r[u].columns)||(this.model.multiColumnSettings.columns=r[u].columns);this.suggestionList.remove();this._renderSuggestionList();break;case"showResetIcon":this.model.showResetIcon=r[u];r[u]&&!t.isNullOrUndefined(this.value())&&this.value()!=""?this._showReset():this._removeReset()}this._hideResult()}},_destroy:function(){this.element.width("").removeAttr("role aria-label aria-expanded aria-haspopup aria-autocomplete autocomplete placeholder aria-owns aria-disabled disabled aria-activedescendant");this.element.insertAfter(this.wrapper);this.model.multiSelectMode=="visualmode"&&this.element.removeClass("e-visual-mode").attr("name",this._hiddenInput.attr("name"));this.model.enabled||this.element.removeClass("e-disable");this.wrapper.remove();this.element.removeClass("e-input").val("");this._isWatermark&&this.element.removeAttr("placeholder");this._hideResult();this.suggestionList&&this.suggestionList.remove()},_initialize:function(){this.value(this.value()===""?this.element[0].value:this.value());this.element.attr("role","combobox").attr("aria-label","Autocomplete textbox").attr("aria-expanded",!1).attr("aria-autocomplete","list").attr("aria-activedescendant","null");t.isNullOrUndefined(this.element.attr("tabindex"))&&this.element.attr("tabindex",0);/Edge\/12./i.test(navigator.userAgent)&&this.element.addClass("edge-browser");this.target=this.element[0];this.dropdownbutton=null;this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this.showSuggestionBox=!1;this.noresult=!0;this._queryString=null;this.suggLen=0;this._selectedItems=[];this._modelValue="";this._activeItem=0;this._originalval=[];this.ctrlKeyPressed=!1;this._isFocused=!1;this._isOpened=!1;this._typed=!1;this._cancelEvent=!1;this._isWatermark=this._checkWatermarkSupport();this._selectedObj=[];this.eleClick=!1;this.lastScrollTop=0},_render:function(){this._renderWrapper();this._addAttr(this.model.htmlAttributes);this._setDimentions();this._renderDropdown();this._checkProperties();this._isWatermark?this._setWatermark():this._setWatermarkTxt();this.model.loadOnDemand||(this._renderSuggestionList(),this._setListPosition());this._RightToLeft(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner);this.setVisible(this.model.visible)},_renderWrapper:function(){var n,i;this.element.addClass("e-input").attr("autocomplete","off");this.model.multiSelectMode=="visualmode"?(this.wrapper=t.buildTag("div.e-atc e-widget "+this.model.cssClass+"#"+this.target.id+"_wrapper").insertAfter(this.element),this.container=t.buildTag("div.e-in-wrap e-box").append(this.element)):(this.wrapper=t.buildTag("span.e-atc e-widget "+this.model.cssClass+"#"+this.target.id+"_wrapper").insertAfter(this.element),this.container=t.buildTag("span.e-in-wrap e-box").append(this.element));document.activeElement==this.element[0]&&(n=!0);this.wrapper.append(this.container);this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this.model.watermarkText),this._hiddenSpan.css("display","none"),i=this,this._hiddenSpan.click(function(){this._isFocused||i.element.focus()}));n&&this.element.focus()},_renderDropdown:function(){if(this.model.showPopupButton){var i=t.buildTag("span.e-icon e-search").attr(this._isIE8?{unselectable:"on"}:{});this.dropdownbutton=t.buildTag("span.e-select#"+this.target.id+"_dropdown").attr(this._isIE8?{unselectable:"on"}:{}).append(i);this.container.append(this.dropdownbutton).addClass("e-padding");this.model.enabled||this.dropdownbutton.addClass("e-disable").attr({"aria-disabled":!0});this.dropdownbutton.on("mousedown",n.proxy(this._OnDropdownClick,this))}},_addAttr:function(t){var i=this;n.map(t,function(n,t){t=="required"&&i.element.attr(t,n);t=="class"?i.wrapper.addClass(n):t=="name"?i.element.attr(t,n):t=="disabled"&&n=="disabled"?i._disabled(!0):t=="readOnly"&&n===!0?i._checkReadOnly(!0):t=="id"?(i.wrapper.attr(t,n+"_wrapper"),i.element.attr(t,n)):i.wrapper.attr(t,n)})},_setDimentions:function(){this.model.height&&this.wrapper.height(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_renderBoxModel:function(){this._ulBox=t.buildTag("ul.e-ul e-boxes");var i=this.model.enabled?"":"e-disable";this._ulBox.addClass(i);this._hiddenInput=t.buildTag("input#"+this.target.id+"_hidden","",{},{type:"hidden"}).insertBefore(this.element);this._hiddenInput.attr("name",this.element.attr("name"));this.element.val("").removeAttr("name").addClass("e-visual-mode");this._isWatermark||this.element.width(1);this.container.prepend(this._hiddenInput,this._ulBox);this.model.height!=""?this.wrapper.height(this.model.height):this.wrapper.height("auto");this._on(this.container,"mousedown",function(t){if(!this.model.enabled)return!1;var i=n(t.target);i.is(this.element)||(t.preventDefault(),this._isFocused||this.element.focus(),i.hasClass("e-options")?(!t.ctrlKey&&i.siblings().hasClass("e-active")&&this._removeActive(),i.hasClass("e-active")?i.removeClass("e-active"):i.addClass("e-active")):this._moveCaretToEnd(this.element[0]));!t.ctrlKey&&(i.hasClass("e-boxes")||i.hasClass("e-input"))&&this._removeActive()})},_destroyBoxModel:function(){this.container.prepend(this.element);this.element.attr({name:this._hiddenInput.attr("name")}).removeAttr("style").removeClass("e-visual-mode");this.wrapper.height(this.model.height);this._hiddenInput.remove();this._hiddenInput=null;this._ulBox.remove();this._off(this.container,"mousedown")},_deleteLastBox:function(){var t=this._ulBox.children(),n=t.last(),i=n.hasClass("e-active");this._removeActive();i?this._deleteBox(n):n.addClass("e-active")},_deleteBox:function(t){for(var s,u,i,f,e,r=0,o=t.length;r0)&&u._setHiddenkeyByValue(n.result)})}},_setHiddenkeyByValue:function(n){var u,r,o,s,h;t.isNullOrUndefined(this.value())&&this.value("");var i=this.value(),f=n,c=[],e=[];if(i=this.model.multiSelectMode=="none"?i:i.split(this.model.delimiterChar),!t.isNullOrUndefined(f)){for(u=0;u0&&(this.suggestionListItems=t.DataManager(this.suggestionListItems).executeLocal(t.Query().take(this.model.itemsCount)));this._checkEmptyList();this._addNewTemplate=null;this.noresult&&this.model.multiSelectMode=="visualmode"&&this.model.allowAddNew&&this.element.val()!=""&&!this._repeatRemove&&(this.noresult=!1,this.suggestionListItems.pop(),this._addNewTemplate=" ("+this.model.addNewText+")",this.suggestionListItems.push(this.element.val()+this._addNewTemplate),this._checkEmptyList());(!this.noresult||this.model.showEmptyResultText)&&this._generateSuggestionList(i)},_generateSuggestionList:function(i){var f=this.suggestionListItems,r,h,g,c,y,e,o,nt,p,w,u,s,tt,b,a,l;if(this.model.multiColumnSettings.enable?this._tableColumn.empty()&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv.css("display",""):this.ul.empty(),r=this,h=document.createDocumentFragment(),typeof f[0]!="object"){if(r.model.multiColumnSettings.enable){var k=t.buildTag("tbody"),it=t.buildTag("tr").attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}),rt=t.buildTag("td",{},{},{role:"option"});for(u=0,s=f.length;s>u;u++){var c=r.model.highlightSearch&&!r.noresult?r._highlightSuggestion(f[u]):f[u],d=it.clone(),v=rt.clone();n(v).attr(r._isIE8?{unselectable:"on"}:{}).attr(f[u]!=f.length-1?{"class":"e-atc-tdbottom"}:{}).html(c);d[0].appendChild(v[0]);k[0].appendChild(d[0]);h.appendChild(k[0]);r.model.showEmptyResultText&&r.model.emptyResultText==c&&r.model.multiColumnSettings.showHeader&&r._tableHeaderDiv.css("display","none")&&n(v).removeClass("e-atc-tdbottom");r._addNewTemplate&&!t.isNullOrUndefined(r._tableHeaderDiv)&&r._tableHeaderDiv.css("display","none")}r._tableColumn[0].appendChild(h)}else{for(g=t.buildTag("li",{},{},{role:"option"}).attr(r._isIE8?{unselectable:"on"}:{}),u=0,s=f.length;s>u;u++)c=r.model.highlightSearch&&!r.noresult?r._highlightSuggestion(f[u]):f[u],y=g.clone(),y[0].innerHTML=c,h.appendChild(y[0]);r.ul[0].appendChild(h)}this._currList=f;this._mapper={txt:null,key:null}}else e=this.model.fields,o={_key:null,_text:null,_attr:null},o._key=e&&e.key?e.key:"key",o._text=e&&e.text?e.text:"text",o._attr=e&&e.htmlAttributes?e.htmlAttributes:"htmlAttributes",this._mapper={txt:o._text,key:o._key},this._currList=[],this.model.fields.groupBy?(nt=e&&e.groupBy?e.groupBy:"groupBy",w=t.Query().group(nt),this._addSortingQuery(w,"key"),p=t.DataManager(f).executeLocal(w),this._swapUnCategorized(p),p.forEach(function(n,i){if(n.key)if(r.model.multiColumnSettings.enable){var u=t.buildTag("tr.e-category").attr("role","option").attr(r._isIE8?{unselectable:"on"}:{});u.append(t.buildTag("td",n.key).attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}).attr(i!=f.length-1?{"class":"e-atc-tdbottom"}:{}));r._tableColumn.append(u)}else r.ul.append(t.buildTag("li.e-category",n.key).attr("role","option").attr(r._isIE8?{unselectable:"on"}:{}));r._generateLi(n.items,o)})):this._generateLi(f,o);for(u=0,s=f.length;s>u;u++)if(this.model.multiColumnSettings.enable)tt=this._textFormateString(this._currList[u]),tt==this.value()&&(l=this._getLiTags()[u],n(l).addClass("e-activeli"));else for(b=this.value().split(this.model.delimiterChar),a=0;a<=b.length;a++)this._currList[u]==b[a]&&(l=this._getLiTags()[u],n(l).addClass("e-activeli"));this._getLiTags().length>0&&this._isFocused&&this._showResult(i)},_swapUnCategorized:function(n){for(var t,r=n.length,i=0;i0;t--)n[t]=n[t-1];return n[t]=n[i],!1}},_generateLi:function(i,r){var u=this,a=document.createDocumentFragment(),y=document.createDocumentFragment(),p,w,b,d,h,e,l,k,f,v,o,s,c;if(u.model.multiColumnSettings.enable){for(p=u.model.multiColumnSettings.columns.length,this._tableColumn.append(t.buildTag("tbody")),w=t.buildTag("tr"),b=t.buildTag("td"),f=0,v=i.length;v>f;f++)if(o=this._getField(i[f],r._text),s=this._getField(i[f],r._key),!t.isNullOrUndefined(o)||u.model.multiColumnSettings.enable){for(d=u._getField(i[f]),h=w.clone(),h[0].className=f%2?"e-atc-trbgcolor":"",e=0;e-1?u._highlightSuggestion(u._getField(i[f],u.model.multiColumnSettings.columns[e].field).toString()):u._getField(i[f],u.model.multiColumnSettings.columns[e].field):u.model.highlightSearch&&n.inArray(e.toString(),u._columnIndex)>-1?t.isNullOrUndefined(u._getField(i[f],u.model.multiColumnSettings.columns[e].field))?u._highlightSuggestion(""):u._highlightSuggestion(u._getField(i[f],u.model.multiColumnSettings.columns[e].field).toString()):u._getField(i[f],u.model.multiColumnSettings.columns[e].field),l[0].className=(f!=i.length-1?"e-atc-tdbottom ":"")+(e!=u.model.multiColumnSettings.columns.length-1?u.model.enableRTL?"e-atc-tdleft ":"e-atc-tdright ":"")+(u.model.multiColumnSettings.columns[e].cssClass?u.model.multiColumnSettings.columns[e].cssClass:""),l[0].style.textAlign=u.model.multiColumnSettings.columns[e].textAlign?u.model.multiColumnSettings.columns[e].textAlign:"left",y.appendChild(l[0]));h[0].appendChild(y);s&&h.attr("id",s);u._setAttributes(u._getField(i[f],r._attr),h[0]);a.appendChild(h[0]);u._currList=u._currList.concat([i[f]])}n(u._tableColumn).find("tbody")[0].appendChild(a)}else{for(k=n("
  • <\/li>"),f=0,v=i.length;v>f;f++)o=this._getField(i[f],r._text),s=this._getField(i[f],r._key),t.isNullOrUndefined(o)||(u.model.highlightSearch&&(o=u._highlightSuggestion(o)),u.model.template&&(o=u._getTemplatedString(i[f],r._text,o)),c=k.clone(),c[0].innerHTML+=o,s&&c[0].setAttribute("id",s),u._setAttributes(u._getField(i[f],r._attr),c[0]),c.attr({role:"option","data-value":o}),a.appendChild(c[0]),u._currList=u._currList.concat([i[f]]));u.ul[0].appendChild(a)}},_getLiTags:function(){return this.model.multiColumnSettings.enable?this._tableColumn.find("tbody tr:not('.e-category')"):this.ul.children("li:not('.e-category')")},_getTemplatedString:function(n,t,i){for(var r=this.model.template,f=r.indexOf("${"),e=r.indexOf("}");f!=-1&&e!=-1;){var o=r.substring(f,e+1),s=o.replace("${","").replace("}",""),u=this._getField(n,s);t==s&&(u=i);u||(u="");r=r.split(o).join(u);f=r.indexOf("${");e=r.indexOf("}")}return r},_getField:function(n,i){return t.pvt.getObject(i,n)},_setAttributes:function(t,i){if(t){typeof t=="string"&&(t=n.parseJSON(t));for(var r in t)i.setAttribute(r,t[r])}},_setListWidth:function(){var n=this.model.popupWidth;n&&n!="auto"?this.suggestionList.css({width:n}):this.suggestionList.css({width:this.wrapper.width()})},_setListHeight:function(){this.suggestionList.css({"max-height":this.model.popupHeight})},_refreshPopup:function(){this.model.popupWidth=="auto"&&Math.floor(this.wrapper.outerWidth())!=Math.floor(this.suggestionList.outerWidth())&&(this.suggestionList.css({width:this.wrapper.width()}),this._refreshScroller());this._setListPosition()},_showResult:function(r){var u,e,o,f;if(this._refreshScroller(),this._refreshPopup(),this._isOpened)n(document).on("mousedown",n.proxy(this._OnDocumentClick,this));else this.suggestionList.css("display","none"),u=this,clearTimeout(this._typing),this._typing=setTimeout(function(){u.suggestionList[u.model.animateType=="slide"?"slideDown":"fadeIn"](u.model.animateType=="none"?0:300,function(){n(document).on("mousedown",n.proxy(u._OnDocumentClick,u))})},this.model.delaySuggestionTimeout),e=r!=i?{event:r,isInteraction:!0}:{isInteraction:!1},this._trigger("open",e),this.wrapper.addClass("e-active");this._isOpened=!0;this.showSuggestionBox=!0;o=this._getLiTags();this._listSize=o.length;n(window).on("resize",n.proxy(this._OnWindowResize,this));f=t.getScrollableParents(this.wrapper);f[0]!=window&&this._on(f,"scroll",this._hideResult)},_hideResult:function(r){var u,f;this.showSuggestionBox&&(this.showSuggestionBox=!1,this._activeItem=0,clearTimeout(this._hiding),this.element.attr("aria-expanded",!1),u=this,this._isOpened?(this.suggestionList.css("display","none"),f=r!=i?{event:r,isInteraction:!0}:{isInteraction:!1},this._trigger("close",f)):this._hiding=setTimeout(function(){u.model&&u.suggestionList[u.model.animateType=="slide"?"slideUp":"fadeOut"](u.model.animateType=="none"?0:100);u._activeItem=0},this.model.delaySuggestionTimeout),n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this.wrapper.removeClass("e-active"))},_refreshScroller:function(){this.suggestionList.css("height","auto");this.suggestionList.find(".e-content , .e-scroller").removeAttr("style");this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&(n(this._tableColumn).css("width","auto"),n(this._tableHeader).css("width","auto"));this.suggestionList.css("display","block");this.model.multiColumnSettings.enable&&(this.scrollerObj.option("height","auto"),this._columnBorderAlign());var i=this.suggestionList.height()>parseInt(n.isNumeric(this.model.popupHeight)?this.model.popupHeight:this.model.popupHeight.replace("px",""))-4;i||this.model.multiColumnSettings.enable&&(this.suggestionList.height()<=this._tableColumn.height()||this.suggestionList.width()<=this._tableColumn.width()||this.model.multiColumnSettings.showHeader&&this.suggestionList.width()<=this._tableHeader.width())?(i&&(this.scrollerObj.model.height=this.model.multiColumnSettings.showHeader&&this._tableHeader?parseInt(this.suggestionList.height())-parseInt(this._tableHeader.height()):this.suggestionList.height()),!this.model.multiColumnSettings.enable&&this.suggestionList.width()0&&this._tableHeader.parent(".e-atc-tableHeaderContent").scrollLeft(this.model.enableRTL?this.suggestionList.find(".e-content")[0].scrollWidth-this.suggestionList.find(".e-content")[0].clientWidth:0))},_columnBorderAlign:function(){var i,t,r;if(this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv.css("display")!="none"){for(this._tableWid=this._tableHeader.outerWidth()>this._tableColumn.outerWidth()?this._tableHeader.outerWidth():this._tableColumn.outerWidth(),this._tableColumn.find("colgroup").remove(),n(this._headerColGroup.children).removeAttr("style"),t=0,r=this._headerColGroup.children.length;tparseInt(this._tableHeader.find("tr:first th").eq(t).outerWidth())?n(this._tableColumn).find("tr:first td").eq(t).outerWidth():this._tableHeader.find("tr:first th").eq(t).outerWidth()});this._tableColumn.append(n(this._headerColGroup).clone());i=this._tableWid>this.suggestionList.width()?this._tableWid:"100%";n(this._tableColumn).css("width",i);n(this._tableHeader).css("width",i)}else if(this.model.multiColumnSettings.enable&&!this.model.multiColumnSettings.showHeader){if(n(this._tableColumn).css("width","auto"),this._tableWid=this._tableColumn.outerWidth(),n(this._headerColGroup.children).removeAttr("style"),i=this._tableWid>this.suggestionList.width()?this._tableWid:"100%",i!="100%"){for(t=0,r=this._headerColGroup.children.length;tc?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&ethis.lastScrollTop?this.container[0].scrollHeight-parseInt(this.model.height)+"px":this.container[0].scrollTop+"px";this.lastScrollTop=n;this.dropdownbutton[0].style.float="right"},_focusOutAction:function(n){var i=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val(),r,u,f;if(this._isFocused=!1,this.wrapper.removeClass("e-focus"),t.isNullOrUndefined(this.model.fields.key)&&(this.model.multiSelectMode=="none"?(r=this.model.dataSource,t.DataManager&&r instanceof t.DataManager?this._loadInitData():this._setHiddenkeyByValue(r)):this._hiddenInput.val(i)),this._focusValue==this.model.value||this.model.isChangeOnBlur)if(this.model.isChangeOnBlur&&this._preVal!=i)this.value(i),this._hiddenInput.val()==""&&this._hiddenInput.val(i),this._changeEvtTrigger(i,n);else return!1;else this._hiddenInput.val()==""&&this._hiddenInput.val(i),this._changeEvtTrigger(i,n);this.model.showPopupButton&&this.dropdownbutton.removeClass("e-active");this._isWatermark||this._setWatermarkTxt();this._removeSelection();this.model.multiSelectMode=="visualmode"&&this.model.showResetIcon&&this.element.val()!=""&&this._removeReset();this.model.multiSelectMode=="visualmode"?(this._removeActive(),this.element.val(""),this._setWatermarkWidth(1),this._preVal="",this._addNewTemplate=null):(this.model.multiSelectMode=="delimiter"&&this._valueChange(n),this._updateSelectedItemArray(this.getValue()));t.isNullOrUndefined(this.value())||this.value()==""||(u=this.value().split(this.model.delimiterChar),(this.model.multiSelectMode=="delimiter"||this.model.multiSelectMode=="none")&&(f=this._removeDuplicateVal(u),this._keyProcess(f)));this.element.val()==""&&(this.value()==""||this.value()==null)&&this._selectValueByKey(null)},_targetBlur:function(n){this._focusOutAction(n);this._trigger("focusOut",{event:n,isInteraction:!0,value:this.value()});this._targetEle()},_setWatermarkWidth:function(n){this.model.watermarkText&&this.element.attr("placeholder")?this.element.width(""):this.element.val("").width(n)},_checkDeli:function(){var n=this.element.val(),t=this.model.delimiterChar,i=n.substr(n.length-t.length,n.length);return i==t?(this.element.val(n.substr(0,n.length-t.length)),!0):!1},_removeSelection:function(){if(this.model.enableAutoFill){this.element.attr("aria-autocomplete","both");var n=this._getCaretSelection();n.end-n.start!=0&&n.end-n.start!=this.element.val().length&&(this.target.value=this.target.value.substr(0,n.start))}},_removeListHover:function(){this._getLiTags().removeClass("e-hover")},_addListHover:function(){var t=n(this._getLiTags()[this._activeItem-1]);t.addClass("e-hover");this.element.attr("aria-activedescendant",t.attr("id"));this.scrollerObj.setModel({scrollTop:this._calcScrollTop()});t.focus()},_calcScrollTop:function(){var r=this.model.multiColumnSettings.enable?this.model.multiColumnSettings.showHeader?this._tableColumn.outerHeight()+this._tableHeader.outerHeight():this._tableColumn.outerHeight():this.ul.outerHeight(),t=this.model.multiColumnSettings.enable?this._tableColumn.find("tr"):this.ul.find("li"),i=0,n;return n=this.model.multiColumnSettings.enable?this._tableColumn.find("tr.e-hover").index():this.ul.find("li.e-hover").index(),i=t.eq(1).outerHeight()*n,i-((this.model.multiColumnSettings.enable?this._tableColumn.parent().outerHeight():this.suggestionList.outerHeight())-t.eq(n).outerHeight())/2},getActiveText:function(){if(this._activeItem>0)return this.model.multiColumnSettings.enable?this._textFormateString(this._currList[this._activeItem-1]):!t.isNullOrUndefined(this._mapper)&&this._mapper.txt?this._getField(this._currList[this._activeItem-1],this._mapper.txt):this._currList[this._activeItem-1]},_getUniqueKey:function(){var n=null;return t.isNullOrUndefined(this._mapper)||(this._mapper.key&&(n=this._getField(this._currList[this._activeItem-1],this._mapper.key)),t.isNullOrUndefined(n)&&(n=null)),n},_setTextBoxValue:function(){var t,f,i,e,r,u;this._activeItem&&!this.noresult&&(t=this.model.multiColumnSettings.enable?this._textFormateString(this._currList[this._activeItem-1]):this.getActiveText(),f=this._getCaretSelection(),this.suggLen=f.start,i=this.target.value.substr(0,this.suggLen),r=this.target.value.lastIndexOf(this.model.delimiterChar),u=r==-1?n.trim(i.substr(r+1,this.suggLen)):n.trim(i.substr(r+this.model.delimiterChar.length,this.suggLen)),i&&(i.toLowerCase()==t.substr(0,this.suggLen).toLowerCase()||u.toLowerCase()==t.substr(0,this.suggLen-(r+this.model.delimiterChar.length)).toLowerCase())?(e=this.model.multiSelectMode=="delimiter"?i+t.substr(u.length,t.length):i+t.substr(i.length,t.length),this.element.val(e),this._autofilSelection(),this.model.multiSelectMode=="visualmode"&&(this._adjustWidth(),this.model.enableAutoFill&&this._refreshPopup()),this.model.autoFocus&&!this.noresult&&this._addListHover()):(this.model.multiSelectMode=="delimiter"&&t&&u?this.element.val(this.element.val().replace(u,t)):t&&this.element.val(t),this._removeSelection()))},_enterTextBoxValue:function(n){var t,i,r;this._timeStamp&&-(this._timeStamp-n.timeStamp)<400||(!this._activeItem||this.noresult||this.model.readOnly||(t=this.getActiveText(),i=this._currList[this._activeItem-1],this._preVal=t+(this.model.multiSelectMode=="delimiter"?this.model.delimiterChar:""),this._timeStamp=n.timeStamp,this._valueToTextBox(t,i,!1),r=this.model.multiSelectMode=="visualmode"?this._modelValue:this.element.val()==""?null:this.element.val(),this._trigger("select",{event:n,isInteraction:!0,value:r,text:t,key:this._getUniqueKey(),item:i}),this._valueChange(n),this.model.showResetIcon&&this._showReset()),this._isOpened&&this._trigger("close",{event:n,isInteraction:!0}))},_createBox:function(i){var r=t.buildTag("span.e-icon e-close"),u=t.buildTag("li.e-options",i).append(r);return this._on(r,"click",function(t){if(!this.model.enabled)return!1;this._deleteBox(n(t.target).parent())}),u},_addLoadingClass:function(){this.model.showLoadingIcon&&this.element.addClass("e-load")},_removeLoadingClass:function(){this.element.removeClass("e-load")},_highlightSuggestion:function(t){var o,s,u,e,f,i,h,r,c;if(n.trim(this._queryString)!=""&&(o=this.model.caseSensitiveSearch?"g":"gi",i=n.trim(this._queryString),i=/^[a-zA-Z0-9- ]*$/.test(i)?i:i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),s=this.model.filterType=="startswith"?"^"+i:this.model.filterType=="endswith"?i+"$":i,u=new RegExp(s,o),u.test(t)))for(e=t.match(u),h=t.replace(u,"~^"),f=h.split("~^"),t="",r=0,c=f.length;c>r;r++)t+=e[r]?f[r]+""+e[r]+"<\/span>":f[r];return t},_RightToLeft:function(n){n?(this.wrapper.addClass("e-rtl"),this.suggestionList&&this.suggestionList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.suggestionList&&this.suggestionList.removeClass("e-rtl"));this.model.multiColumnSettings.enable&&this.model.multiColumnSettings.showHeader&&this._tableHeaderDiv&&(this._tableHeaderDiv.removeClass(n?"e-atc-tableHeaderRTL":"e-atc-tableHeaderScroll"),this._tableHeader.find("tr :not(th:last)").addClass(n?"e-atc-thleft":"e-atc-thright").removeClass(n?"e-atc-thright":"e-atc-thleft"))},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.suggestionList&&this.suggestionList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.suggestionList&&this.suggestionList.removeClass("e-corner"))},_checkReadOnly:function(n){this.model.readOnly=n;this.model.readOnly?(this.element.attr({readonly:"readonly","aria-readonly":!0}),this._off(this.element,"keydown",this._OnKeyDown),this._off(this.element,"keyup",this._OnKeyUp),this._off(this.element,"paste",this._OnPaste),this._off(this.element,"keypress",this._onkeyPress)):(this.element.removeAttr("readonly aria-readonly"),this._on(this.element,"keydown",this._OnKeyDown),this._on(this.element,"keyup",this._OnKeyUp),this._on(this.element,"paste",this._OnPaste),this._on(this.element,"keypress",this._onkeyPress))},_onkeyPress:function(n){n.keyCode==13&&this._PreventDefaultAction(n)},_OnPaste:function(n){var t=this;setTimeout(function(){t._OnKeyUp(n)},0)},_OnKeyDown:function(t){var f;this.model.filterType!="startswith"&&(this.model.enableAutoFill=!1);switch(t.keyCode){case 37:case 35:case 36:this._removeSelection();break;case 38:this.showSuggestionBox&&this.suggestionList&&(this._removeListHover(),this._activeItem>1?this._activeItem-=1:this._activeItem=this._listSize,this._navigationHover());this._PreventDefaultAction(t);break;case 40:this.showSuggestionBox&&this.suggestionList?(this._removeListHover(),this._activeItemthis._listSize&&(this._activeItem=this._listSize);this._navigationHover()}this._PreventDefaultAction(t);break;case 8:n.trim(this.element.val())==""&&(this._isOpened=!1);this.element.hasClass("e-load")&&this._queryString&&this._queryString.length<=this.model.minCharacter&&t.preventDefault();this.model.multiSelectMode=="visualmode"&&this.element.val()==""&&this._deleteLastBox();break;case 17:this.ctrlKeyPressed=!0;break;case 9:this.showSuggestionBox&&(this._queryString=this.element.val(),this._enterTextBoxValue(t),this._hideResult(t),this._isOpened=!1,this._PreventDefaultAction(t));break;case 27:this._isOpened=!1;f=this.showSuggestionBox;this._hideResult(t);this._PreventDefaultAction(t);f&&this._trigger("close",{event:t,isInteraction:!0})}this.model.multiSelectMode=="visualmode"&&(t.keyCode!=17&&t.keyCode!=8&&t.keyCode!=46&&this._removeActive(),this._adjustWidth())},_PreventDefaultAction:function(n){n.preventDefault();this._cancelEvent||(n.stopPropagation(),n.cancelBubble=!0,n.returnValue=!0)},_bubbleEvent:function(n){return typeof n=="boolean"&&(this._cancelEvent=n),this._cancelEvent},_navigationHover:function(){this._addListHover();this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this._queryString=this.target.value,this._setTextBoxValue())},_OnKeyUp:function(t){if(this._keyDownComplete(t),this.ctrlKeyPressed&&t.type!="paste")return t.keyCode==17&&(this.ctrlKeyPressed=!1),!1;if(n.trim(this.element.val())==""&&t.keyCode==38&&t.keyCode==40)return this._hideResult(t),!1;if(!this._checkDelimiter())return!1;this._queryString=n.trim(this._queryString);switch(t.keyCode){case 34:case 33:case 38:case 40:case 37:case 39:case 20:case 16:case 17:case 18:case 35:case 36:case 144:case 9:case 27:break;case 13:t.preventDefault();this._queryString=this.element.val();this._enterTextBoxValue(t);this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this.suggLen=this.element.val().length,this._autofilSelection());this._isOpened=!1;this._hideResult(t);break;case 46:if(this.model.multiSelectMode=="visualmode"&&this.element.val()==""){this._deleteBox(this._ulBox.children("li.e-active"));break}case 8:this._queryString.length>=this.model.minCharacter?(this._autoFill=!1,this._OnTextEnter(t)):(this.noresult=!0,this._hideResult(t),n.trim(this.element.val())==""&&(this._isOpened=!1));this._typed=!0;break;default:this._queryString.length>=this.model.minCharacter?(this._autoFill=!0,this._OnTextEnter(t)):(this.noresult=!0,this._isOpened=!1);this._typed=!0}},_getFilteredList:function(n,i){var u,r;clearTimeout(this.timeDelay);t.isNullOrUndefined(n)||typeof n[0]!="object"||(u=this.model.fields.text?this.model.fields.text:"text",this.model.actionFailure&&t.isNullOrUndefined(t.DataManager(n).executeLocal(t.Query().select(u))[0])&&this._trigger("actionFailure",{error:this._localizedLabels.actionFailure}));!n||!n.length||n.length<1?(this.suggestionListItems=[],this.model.actionFailure&&this._trigger("actionFailure",{error:this._localizedLabels.actionFailure})):(r=t.Query(),this._addQuery(r,typeof n[0]=="object"),this.suggestionListItems=t.DataManager(n).executeLocal(r),this.model.actionSuccess&&this._trigger("actionSuccess"));this._doneRemaining(i);this.model.actionComplete&&this._trigger("actionComplete")},_performSearch:function(n){var i,r;this.model.actionBegin&&this._trigger("actionBegin");i=this.model.dataSource;t.DataManager&&i instanceof t.DataManager?i.dataSource.offline||i.dataSource.json&&i.dataSource.json.length>0?(this._getFilteredList(i.dataSource.json,n),this._selectedObj.push(i.dataSource.json)):(window.clearTimeout(this.timer),r=this,this.timer=window.setTimeout(function(){r._fetchRemoteDat(i)},700)):this._getFilteredList(i,n)},_fetchRemoteDat:function(n){var t=this,i,r=this._getQuery();this._addQuery(r,!0);i=n.executeQuery(r);i.fail(function(n){t.suggestionListItems=null;t._removeLoadingClass();t._trigger("actionFailure",n)}).done(function(n){t._isServerFiltering?t.suggestionListItems=n.result:t._getFilteredList(n.result,n);t.model.multiSelectMode=="none"?t._selectedObj=n.result:t.model.multiSelectMode=="delimiter"&&(t._selectedObj=t._selectedObj.concat(n.result));t._doneRemaining(n);t._trigger("actionSuccess",n)}).always(function(n){t._trigger("actionComplete",n)})},_addSortingQuery:function(n,t){if(this.model.allowSorting){var i=this.model.sortOrder=="descending"?!0:!1;n.sortBy(t,i)}},_addQuery:function(n,i){var u="",f,e,o,s,r;if(this._predicates=[],i&&(o=this.model.fields,u=o&&o.text?o.text:"text"),this._queryString)if(this.model.multiColumnSettings.enable)if(this._columnsIndex(),i){if(u=[],this.model.multiColumnSettings.searchColumnIndices.length!=0)for(r=0,s=this._searchColumnIndex.length;r0&&n.where(t.Predicate.or(this._predicates)):this.model.multiColumnSettings.searchColumnIndices.length!=0?n.where(e.and(this._predicates)):t.isNullOrUndefined(e)?n.where(f):n.where(e.and(f))}else n.where(u,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch,this.model.ignoreAccent);else n.where(u,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch,this.model.ignoreAccent);this._addSortingQuery(n,u)},_predicateConvertion:function(n,r,u,f,e,o){var s,h=this.model.ignoreAccent;return o=="number"?s=Number(f):o=="boolean"?f=="true"||f=="yes"||f=="1"?s=!0:(f=="false"||f=="no"||f=="0")&&(s=!1):s=o=="date"?new Date(f):f,o=="number"&&isNaN(s)||o=="boolean"&&s==i?n=n:this.model.multiColumnSettings.searchColumnIndices.length!=0?this._predicates.push(new t.Predicate(r,u,s,e,h)):n=n!=i?n.or(r,u,s,e,h):t.Predicate(r,u,s,e,h),n},_getQuery:function(){var r;if(t.isNullOrUndefined(this.model.query)){var u=[],i=t.Query(),n=this.model.fields;for(r in n)r!=="tableName"&&n[r]&&u.push(n[r]);u.length>0&&i.select(u);t.isNullOrUndefined(this.model.dataSource.dataSource.url)||this.model.dataSource.dataSource.url.match(n.tableName+"$")||t.isNullOrUndefined(n.tableName)||i.from(n.tableName)}else i=this.model.query.clone();return i},_OnTextEnter:function(n){var i=this;t.isDevice()?(clearTimeout(this.timeDelay),this.timeDelay=setTimeout(function(){i._onTextProcess(n)},i.model.delaySuggestionTimeout)):i._onTextProcess(n)},_onTextProcess:function(n){this._addLoadingClass();this.element.attr("aria-expanded",!1);this._performSearch(n);this.model.showResetIcon&&this._showReset()},_showReset:function(){t.isNullOrUndefined(this.resetSpan)&&(this.resetSpan=t.buildTag("span.e-icon e-iclose"),this.model.showPopupButton?(this.dropdownbutton.before(this.resetSpan),this.container.addClass("e-popup e-reset")):this.container.append(this.resetSpan).addClass("e-reset"),this._on(this.resetSpan,"mousedown",this._refreshSearch))},_targetEle:function(){this.eleClick&&(this.element[0].focus(),this.eleClick=!1)},_refreshSearch:function(){this.model.enabled&&!this.model.readOnly&&(this.resetSpan=null,this.clearText(),this.eleClick=!0,this._refreshPopup())},_removeReset:function(){this.resetSpan=this.resetSpan&&this.resetSpan[0].remove();this._refreshPopup()},_doneRemaining:function(n){this._showSuggestionList(n);this.element.attr({"aria-expanded":!0,"aria-haspopup":!0});(this.model.enableAutoFill&&this._autoFill&&!this.noresult||this.model.autoFocus)&&(this.element.attr("aria-autocomplete","both"),this._activeItem=1,this._queryString=this.target.value);this.model.enableAutoFill&&this._autoFill&&!this.noresult&&this._setTextBoxValue();this.model.autoFocus&&!this.noresult&&(this._addListHover(),this.wrapper.width()>0&&this.suggestionList.children("div.e-content").css({width:this.wrapper.width()}));this._removeLoadingClass();this.noresult&&!this.model.showEmptyResultText&&this._hideResult(n)},_removeRepeated:function(){var u=this.suggestionListItems,i,e,r,n,f;if(!u||this._selectedItems.length==0||this.suggestionListItems.length==1&&this.suggestionListItems[0]==this.element.val()+this._addNewTemplate)return!1;for(this._repeatRemove=!1,i=0,e=this._selectedItems.length;i0||this.value()&&this.model.multiSelectMode!="visualmode"?(t.isNullOrUndefined(this._queryString)&&(this._queryString=this.value()),this._isFocused=!0,this._OnTextEnter(i)):this._showFullList(i)))},_iconEventBind:function(t,i){t.on({mouseleave:n.proxy(this._OnMouseIconClick,this)},i)},_OnMouseIconClick:function(){this.dropdownbutton.removeClass("e-active")},_showFullList:function(n){this._isFocused||this.element.focus();this._queryString=null;this._autoFill=!1;this._performSearch(n)},_OnMouseEnter:function(n){this._getActiveItemIndex(n);this.model.showPopupButton&&this.dropdownbutton.removeClass("e-active")},_getActiveItemIndex:function(t){var i=t.target;this.model.multiColumnSettings.enable&&t.target.tagName.toLowerCase()!="tr"?i=n(t.target).parents("tr"):t.target.tagName.toLowerCase()!="li"&&(i=n(t.target).parents("li"));this._getLiTags().removeClass("e-hover");n(i).addClass("e-hover");this._queryString=this.element.val();this._activeItem=this._getLiTags().index(n(i))+1},_OnMouseLeave:function(){this._getLiTags().removeClass("e-hover");this.model.showPopupButton&&this.dropdownbutton.removeClass("e-active");this.model.highlightSearch&&this._getLiTags().find(".e-hilight-txt").removeClass("e-hover")},_OnMouseClick:function(n){this._getActiveItemIndex(n);this._checkEmptyList();this.noresult||(this._enterTextBoxValue(n),this._isOpened=!1,this._hideResult(n))},_OnDocumentClick:function(t){n(t.target).is(this.suggestionList)||n(t.target).parents(".e-atc-popup").is(this.suggestionList)||n(t.target).is(this.element)||n(t.target).parents(".e-atc").is(this.wrapper)?(n(t.target).is(this.suggestionList)||n(t.target).parents(".e-atc-popup").is(this.suggestionList))&&t.preventDefault():(this._isOpened=!0,this._hideResult(t))},_OnWindowResize:function(){this._refreshPopup()},_keyProcess:function(n){var r=this._declareVariable(),o=this,u,i,e,f;if(u=this._delimiterChar(),!t.isNullOrUndefined(n))for(i=0,e=n.length;i0?f:i)):this._createBoxForObjectType(r))},_keyDownComplete:function(n){var i=this.element.val(),f=this.value();if(!t.isNullOrUndefined(this.model.fields.key)&&(n.keyCode==46||n.keyCode==8||n.keyCode==65)&&this.model.multiSelectMode=="delimiter"){var e=this.value(),o=e.split(","),r=this.model.delimiterChar,s=o.indexOf(f.replace(/,/g,"")),u=this._hiddenInput.val().split(r);this._hiddenInput.val(u.join(r));u.splice(s,1)}this._preVal==i||this.model.isChangeOnBlur&&(n.keyCode!=13||this._activeItem&&!this.noresult&&!this.model.readOnly)||(this._preVal=i,this.model.multiSelectMode=="visualmode"&&this._adjustWidth(),this._valueChange(n))},_moveCaretToEnd:function(n){var t,i;n.scrollLeft=n.scrollWidth;n.createTextRange&&(t=n.createTextRange(),t.moveEnd("textedit"),t.moveStart("textedit"),t.select());typeof n.selectionStart=="number"?n.selectionStart=n.selectionEnd=n.value.length:typeof n.createTextRange!="undefined"&&(i=n.createTextRange(),i.collapse(!1),i.select())},_getCaretSelection:function(){var n=this.element[0],u=0,f=0,e,t,i,r,o;return isNaN(n.selectionStart)?(e=document.selection.createRange().getBookmark(),t=n.createTextRange(),t.moveToBookmark(e),i=n.createTextRange(),i.collapse(!0),i.setEndPoint("EndToStart",t),r=i.text.length,o=t.text.length,{start:r,end:r+o}):(u=n.selectionStart,f=n.selectionEnd,{start:Math.abs(u),end:Math.abs(f)})},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_wireEvents:function(){this._on(this.element,"focus",this._targetFocus);this._on(this.element,"blur",this._targetBlur);this._on(this.container,"scroll",this._onScroll)}});t.Autocomplete.Locale=t.Autocomplete.Locale||{};t.Autocomplete.Locale["default"]=t.Autocomplete.Locale["en-US"]={addNewText:"Add New",emptyResultText:"No suggestions",actionFailure:"The specified field doesn't exist in given data source",watermarkText:""};t.filterType={StartsWith:"startswith",Contains:"contains",EndsWith:"endswith",LessThan:"lessthan",GreaterThan:"greaterthan",LessThanOrEqual:"lessthanorequal",GreaterThanOrEqual:"greaterthanorequal",Equal:"equal",NotEqual:"notequal"};t.SortOrder={Ascending:"ascending",Descending:"descending"};t.MultiSelectMode={None:"none",Delimiter:"delimiter",VisualMode:"visualmode"};t.Animation={None:"none",Slide:"slide",Fade:"fade"};t.Type={Number:"number",String:"string",Boolean:"boolean",Date:"date"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejDatePicker","ej.DatePicker",{element:null,_rootCss:"e-datepicker",model:null,validTags:["input","div","span"],_setFirst:!1,_addToPersist:["value"],_cancelValue:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},defaults:{dayHeaderFormat:"min",showPopupButton:!0,enableAnimation:!0,showFooter:!0,displayInline:!1,htmlAttributes:{},dateFormat:"",watermarkText:"Select date",value:null,minDate:new Date("01/01/1900"),maxDate:new Date("12/31/2099"),startLevel:"month",depthLevel:"",cssClass:"",startDay:-1,stepMonths:1,locale:"en-US",showOtherMonths:!0,enableStrictMode:!1,enablePersistence:!1,enabled:!0,width:"",height:"",enableRTL:!1,showRoundedCorner:!1,headerFormat:"MMMM yyyy",buttonText:"Today",readOnly:!1,specialDates:null,fields:{date:"date",tooltip:"tooltip",iconClass:"iconClass",cssClass:"cssClass"},showTooltip:!0,showDisabledRange:!0,highlightSection:"none",highlightWeekend:!1,validationRules:null,validationMessage:null,validationMessages:null,allowEdit:!0,tooltipFormat:"ddd MMM dd yyyy",allowDrillDown:!0,blackoutDates:[],beforeDateCreate:null,open:null,close:null,select:null,change:null,focusIn:null,focusOut:null,beforeOpen:null,beforeClose:null,navigate:null,create:null,destroy:null,weekNumber:!1,timeZone:!0},dataTypes:{startDay:"number",stepMonths:"number",showOtherMonths:"boolean",enableStrictMode:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",displayInline:"boolean",showPopupButton:"boolean",locale:"string",readOnly:"boolean",cssClass:"string",dateFormat:"string",watermarkText:"string",headerFormat:"string",buttonText:"string",specialDates:"data",showTooltip:"boolean",highlightSection:"enum",highlightWeekend:"boolean",enableAnimation:"boolean",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data",tooltipFormat:"string",allowEdit:"boolean",allowDrillDown:"boolean",weekNumber:"boolean"},_renderPopup:function(){this.sfCalendar=t.buildTag("div.e-datepicker e-popup e-widget "+this.model.cssClass+" e-calendar "+(this.model.specialDates?this.model.specialDates[0][this._mapField._icon]?"e-icons ":"":""),"",{},{id:this._id?"e-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{}).insertBefore(this.element);this.model.displayInline&&!this.element.is("input")&&this.sfCalendar.addClass("e-inline");this.popup=this.sfCalendar;t.isTouchDevice()||this.sfCalendar.addClass("e-ntouch");this._setRestrictDateState(this.model.showDisabledRange);this._createCalender();this._setDisplayInline(this.model.displayInline);this._resizeCalender();this._setRTL(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner);this._wireCalendarEvents()},_setModel:function(i){var u=!1,f=!1,e=!1,r,o;for(r in i){r!="showPopupButton"&&r!="width"&&r!="dateFormat"&&r!="height"&&r!="readOnly"&&r!="allowEdit"&&r!="enabled"&&r!="watermarkText"&&r!="htmlAttributes"&&r!="validationMessages"&&r!="validationRules"&&t.isNullOrUndefined(this.sfCalendar)&&this._renderPopup();switch(r){case"dayHeaderFormat":this.model.dayHeaderFormat=i[r];u=f=!0;break;case"weekNumber":this.model.weekNumber=i[r];this._refreshDatepicker();break;case"showPopupButton":this._renderDateIcon(i[r],!0);break;case"displayInline":if(i[r]||this._bindDateButton(),this._setDisplayInline(i[r]),!this.model.allowEdit&&!i[r]&&this._isInputBox)this.element.on("mousedown",n.proxy(this._showDatePopUp,this));break;case"value":t.isPlainObject(i[r])&&(i[r]=null);t.isNullOrUndefined(i.minDate)&&t.isNullOrUndefined(i.maxDate)?(this._setDateValue(i[r]),this._specificFormat()&&(this._stopRefresh=!0),i[r]=this.model.value):this._updateDateValue(i[r]);this.model.value&&this.sfCalendar?n(this.element).attr("aria-activedescendant",n(this.sfCalendar.find(".e-active")).attr("id")):n(this.element).removeAttr("aria-activedescendant");e=u=f=!0;break;case"specialDates":this.model.specialDates=i[r];this._createSpecialDateObject();u=f=!0;break;case"fields":this.model.fields=i[r];this._mapField=this._getMapper();u=f=!0;break;case"showTooltip":this.model.showTooltip=i[r];u=f=!0;break;case"highlightWeekend":this.model.highlightWeekend=i[r];u=f=!0;break;case"highlightSection":this.model.highlightSection=i[r];u=f=!0;break;case"dateFormat":this.model.dateFormat=i[r];this._ensureValue();break;case"minDate":this._setMinDate(i[r]);i[r]=this.model.minDate;this._ensureValue();e=u=f=!0;break;case"maxDate":this._setMaxDate(i[r]);i[r]=this.model.maxDate;this._ensureValue();e=u=f=!0;break;case"locale":this.model.locale=i[r];this.model.startDay=t.isNullOrUndefined(this._options.startDay)&&this.model.startDay===this.culture.calendar.firstDay?-1:this._options.startDay===this.defaults.startDay?-1:this.model.startDay;this.model.dateFormat=t.isNullOrUndefined(this._options.dateFormat)&&this.model.dateFormat===this.culture.calendar.patterns.d?"":this.model.dateFormat;this._setCulture(i[r]);this.model.value&&this._setDateValue(this.model.value);i[r]=this.model.locale;u=f=!0;break;case"showOtherMonths":this.model.showOtherMonths=i[r];this._otherMonthsVisibility();break;case"enableStrictMode":this.model.enableStrictMode=i[r];e=u=f=!0;break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"readOnly":this.model.readOnly=i[r];this._disbleMaualInput();break;case"width":this._setWidth(i[r]);break;case"height":this._setHeight(i[r]);break;case"cssClass":this._setSkin(i[r]);break;case"enableRTL":this._setRTL(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enabled":i[r]?this.enable():this.disable();break;case"buttonText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.buttonText=this.model.buttonText=i[r];this._localizedLabels.buttonText=this.model.buttonText;this._setFooterText(i[r]);break;case"showFooter":this._enableFooter(i[r]);break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options.watermarkText=this.model.watermarkText=i[r];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"startDay":o=i[r];(parseInt(i[r])<0||parseInt(i[r])>6)&&(i[r]=this.culture.calendar.firstDay,o=-1);this.model.startDay=i[r];t.isNullOrUndefined(this._options)&&(this._options={});this._options.startDay=o;u=f=!0;break;case"startLevel":this.model.startLevel=i[r];u=f=!0;break;case"headerFormat":this.model.headerFormat=i[r];u=f=!0;break;case"depthLevel":this.model.depthLevel=i[r];u=f=!0;break;case"htmlAttributes":this._addAttr(i[r]);break;case"allowEdit":this._changeEditable(i[r]);break;case"tooltipFormat":this.model.tooltipFormat=i[r];u=f=!0;break;case"allowDrillDown":this._allowQuickPick(i[r]);u=f=!0;break;case"showDisabledRange":this._setRestrictDateState(i[r]);break;case"blackoutDates":this.model.blackoutDates=i[r];this._initDisableObj(this.model.blackoutDates);u=f=!0}}e&&(this._validateMinMaxDate(),i.value=this.model.value,i.maxDate=this.model.maxDate,i.minDate=this.model.minDate);this._setWaterMark();u&&(this.isValidState||this.model.displayInline)&&this._refreshDatepicker();f&&!this._startNavigate&&this._startLevel(this.model.startLevel);this._triggerChangeEvent();this._checkErrorClass()},observables:["value"],_destroy:function(){this.model.displayInline&&n(window).off("resize",n.proxy(this._OnWindowResize,this));this._isOpen&&this.hide();this.sfCalendar&&this.sfCalendar.remove();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove());this.element.removeClass("e-datepicker e-input");this.element.removeAttr("aria-atomic aria-live aria-activedescendant aria-expanded role placeholder tabindex");this._cloneElement.hasAttribute("name")||this.element.removeAttr("name")},_init:function(n){this._options=n;this._cloneElement=this.element.clone();this._dt_drilldown=!1;this._ISORegex();this._initDisableObj(this.model.blackoutDates);this.animation={open:{duration:200},close:{duration:100}};this._animating=!1;this._isInputBox=this._isInputBox();this._startNavigate=!1;this._keyboardInteraction=!1;this._isSupport=document.createElement("input").placeholder==i?!1:!0;this._checkAttribute();this._setValues();this._createDatePicker();t.isNullOrUndefined(n)||t.isNullOrUndefined(n.validationMessage)||(this.model.validationMessages=this.model.validationMessage);this.model.validationRules!=null&&(this._initValidator(),this._setValidation());n&&n.value!=i&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._isISODate=/[T]/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var r,f,i,u,e;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();f=this.element.attr("name");r.settings.messages[f]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[f][i]=n.validator.messages[i];for(e in this.model.validationMessages)i==e?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[f][i]=u!=null?u:n.validator.messages[i]}},setValue:function(n){typeof n=="string"&&(n=new Date(n));var t=this.model.value;this._setDateValue(n);this._checkErrorClass();t!=this.model.value&&this._triggerChangeEvent()},_checkAttribute:function(){for(var u=["min","max","readonly","disabled"],f=["minDate","maxDate","readOnly","enabled"],i,n,r=0;r6)&&(this.model.startDay=0);this.Date.firstDayOfWeek=this.model.startDay;this.Date.fullYearStart="20";this._showHeader=!0;t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value);this._validateMinMaxDate();this._dateValue=new Date(this._calendarDate.toString());this._isIE7=this._checkIE7();this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._isIE9=t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0"?!0:!1;this._getInternalEvents=!1;this._flag=!0;this._ejHLWeekEnd=!1;this._isOpen=!1;this._prevDate=null;this._preValue=null;this._isFocused=!1},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"?r.disable():u=="readOnly"?r.model.readOnly=!0:u=="style"?r.wrapper.attr(i,n):u=="id"?(r.wrapper.attr(i,n+"_wrapper"),r.element.attr(i,n)):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_createDatePicker:function(){this._createWrapper();this._wireEvents();this.model.displayInline&&this.show();this.model.enableRTL&&this._setRTL(!0);this.model.showRoundedCorner&&this._setRoundedCorner(!0)},_checkNameAttr:function(){!this.element.attr("name")&&this._isInputBox&&this.element.attr("name",this.element[0].id);this.model.displayInline&&!this._isInputBox&&this._hiddenInput.attr("name",this.element[0].id)},_createWrapper:function(){if(this._getMapper(),this.model.specialDates&&this._createSpecialDateObject(),this.element[0].hasAttribute("tabindex")||this.element.attr("tabindex","0"),this._isInputBox&&(this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive","aria-expanded":"false",role:"combobox"}),this.wrapper=t.buildTag("span.e-datewidget e-widget "+this.model.cssClass),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.innerWrapper=t.buildTag("span.e-in-wrap e-box e-padding"),this.wrapper.append(this.innerWrapper).insertBefore(this.element),this.innerWrapper.append(this.element),this.dateIcon=t.buildTag("span.e-select#"+this._id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-icon e-calendar","",{},{"aria-label":"Select"}).attr(this._isIE8?{unselectable:"on"}:{})).insertAfter(this.element)),!this._isSupport||this.model.displayInline&&!this._isInputBox){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._isInputBox&&this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}this._checkNameAttr();this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this._setHeight(this.model.height);this._setWidth(this.model.width);this._id&&n("#e-"+this._id).remove();this._setDateValue(this.model.value);this._preValue=this._parseDate(this.element.val(),this.model.dateFormat);this._setWaterMark();this._dateValue=new Date(this._calendarDate.toString());this.model.displayInline?this._renderPopup():this._isInputBox&&this._renderDateIcon(this.model.showPopupButton,!1);this.model.readOnly&&this._disbleMaualInput();this.model.enabled?this.model.enabled&&n(this.element).hasClass("e-disable")&&this.enable():this.disable();this._layoutChanged();this._checkErrorClass();this._addAttr(this.model.htmlAttributes)},_isInputBox:function(){return this.element.is("input[type=date]")&&this.element.attr("type","text"),this.element.is("input")&&(this.element.is("input[type=text]")||!this.element.attr("type"))},_renderDateIcon:function(n,t){t&&this.model.showPopupButton==n||(!n&&this.dateIcon?(this._bindInputEvent(),this.dateIcon.css("display","none"),this.innerWrapper.removeClass("e-padding")):(this.innerWrapper&&(this.innerWrapper.addClass("e-padding"),this.dateIcon.css("display","block")),this.model.displayInline||this._bindDateButton()),this.model.showPopupButton=n)},_resizeCalender:function(){this.model.dayHeaderFormat=="short"||this.model.dayHeaderFormat=="min"||this.model.dayHeaderFormat=="none"?this.sfCalendar.removeClass("e-headerlong"):this.model.dayHeaderFormat=="long"&&this.sfCalendar.addClass("e-headerlong")},_setWidth:function(n){n?this.wrapper?this.wrapper.width(n):this.element.width(n):this.model.width=this.wrapper?this.wrapper.outerWidth():this.element.width()},_setHeight:function(n){n?this.wrapper?this.wrapper.height(n):this.element.height(n):this.model.height=this.wrapper?this.wrapper.outerHeight():this.element.height();this._isIE7&&this.element.height(this.innerWrapper.height())},_setRTL:function(n){n?(this.wrapper&&this.wrapper.addClass("e-rtl"),this.sfCalendar&&this.sfCalendar.addClass("e-rtl")):(this.wrapper&&this.wrapper.removeClass("e-rtl"),this.sfCalendar&&this.sfCalendar.removeClass("e-rtl"))},_setRoundedCorner:function(n){n?(this.innerWrapper&&this.innerWrapper.addClass("e-corner"),this.sfCalendar&&this.sfCalendar.addClass("e-corner")):(this.innerWrapper&&this.innerWrapper.removeClass("e-corner"),this.sfCalendar&&this.sfCalendar.removeClass("e-corner"))},_refreshDatepicker:function(){var r,f,u,t;if(this._stopRefresh){this._stopRefresh=!1;return}if(r=this.element.val(),f=!1,this.model.navigate!==null&&this.sfCalendar.find("table")[0]!==i)if(u=this.sfCalendar.find("table")[0].className,u==="e-dp-viewdays"&&+this._dateValue!=+this._calendarDate)this._calendarDate=this._dateValue,f=!0;else if(u!=="e-dp-viewdays"){(u==="e-dp-viewmonths"||u==="e-dp-viewyears"||u==="e-dp-viewallyears")&&(this._startNavigate=!0);return}t=this._specificFormat()&&this._formatter(this._preValue,this.model.dateFormat,this.model.locale)!=r?this._parseDate(r,!0):this._parseDate(r);t=this._validateYearValue(t);this.model.navigate!==null&&t!==null&&t!==this._calendarDate&&(t=this._calendarDate);this._setDateValue(t);this._specificFormat()&&this._compareDate(this.model.value,this._calendarDate)&&this.element.val(r);n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._calendarDate,this.model.headerFormat));this._resizeCalender();this._dateValue=new Date(this._calendarDate.toString());this._hoverDate=this._calendarDate.getDate()-1;this._renderCalendar(this,this._dateValue);f&&r===""&&this._addFocus("day",this._hoverDate);this._setFooterText(this._localizedLabels.buttonText);this._enableFooter(this.model.showFooter);this._layoutChanged()},_removeCurrentMonthFromHideDate:function(){for(var u,i,r,f=this.sfCalendar.find("tbody.e-datepicker-days tr").length,t=0;ti&&n.setFullYear(this._calendarDate.getFullYear())}return n},_setFooterText:function(t){n(".e-footer-text",this.sfCalendar).html(t)},_setSkin:function(n){this.wrapper?(this.wrapper.removeClass(this.model.cssClass),this.wrapper.addClass(n)):(this.element.removeClass(this.model.cssClass),this.element.addClass(n));this.sfCalendar.removeClass(this.model.cssClass);this.sfCalendar.addClass(n)},_setDisplayInline:function(t){this.model.displayInline=t;t&&this._isInputBox?(this.sfCalendar.insertAfter(this.wrapper),this._setDatePickerPosition()):t?(this.element.append(this.sfCalendar),this._isSupport&&this._isInputBox||this._hiddenInput.css("display","none")):(this.sfCalendar.css("display","none"),n("body").append(this.sfCalendar),this._isOpen=!1);t&&(this.show(),this._off(this.dateIcon,"mousedown",this._showDatePopUp),this.element.off("mousedown",n.proxy(this._showDatePopUp,this)))},_disbleMaualInput:function(){this.model.readOnly?(n(this.element).attr("readonly","readonly"),this.model.displayInline||this.hide()):this.model.allowEdit&&n(this.element).prop("readonly",!1)},_checkDateObject:function(n,t){var t;if(n&&(typeof JSON!="object"||JSON.stringify(n)!=="{}"))n instanceof Date||(t=this._specificFormat()?this._parseDate(n,!0):this._parseDate(n,t),n=t?t:(t=this._checkJSONString(n))?t:null);else return null;return!isNaN(Date.parse(n))&&(this._dateValue=this._calendarDate=this._zeroTime(n),this._validateDate(n))?this._dateValue:null},_checkJSONString:function(n){if(isNaN(Date.parse(n))){if(this.model.enableStrictMode&&t.parseDate(n,this.model.value,this.model.locale)==null)return null;if(this._extISORegex.exec(n)||this._basicISORegex.exec(n))return this._dateFromISO(n)}else if(new Date(n).toJSON()===n||new Date(n).toDateString()===n||new Date(n).toGMTString()===n||new Date(n).toISOString()===n||new Date(n).toLocaleString()===n||new Date(n).toString()===n||new Date(n).toUTCString()===n){if(this.model.timeZone)return new Date(new Date(n).getTime()+t.serverTimezoneOffset*36e5);if(n.match(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i)&&n.match(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i).length>0)return n=n.split("T"),n=n[0],t.parseDate(n,"yyyy-MM-dd",this.model.locale)}else if(typeof n=="string")return this._dateFromISO(n)},_dateFromISO:function(n){var i=this._isISODate.test(n)&&(this._extISORegex.exec(n)||this._basicISORegex.exec(n)),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){var t=n.toLowerCase();return t=="t"||t=="z"||t==":"||t=="-"?!0:!1},_checkInstanceType:function(n){if(n=this._stringToObject(n),n)n instanceof Date||(n=this._parseDate(n));else return null;return isNaN(Date.parse(n))?null:this._zeroTime(n)},_stringToObject:function(n){if(typeof n=="string"){var i=t.parseDate(n,this.model.dateFormat,this.model.locale);n=i!=null?i:new Date(n)}return n},_validateMinMaxDate:function(){var n=!1,t=!1;this.model.maxDatethis.model.maxDate?(this._calendarDate=this.model.maxDate,this.isValidState=!1,t=!0):this.isValidState=!0:this._calendarDatethis.model.maxDate&&(this._calendarDate=this.model.maxDate):(this.model.value?this.model.valuethis.model.maxDate&&(this._calendarDate=this.model.value=this.model.maxDate,n=!0):(this.element.val(""),this._calendarDatethis.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0);n&&this.element.val(this._formatter(this.model.value,this.model.dateFormat));t&&this._getInternalEvents&&this._trigger("outOfRange")},_setCulture:function(n){this.culture=t.preferredCulture(n);this.culture&&(this.model.locale=this.culture.name=="en"?"en-US":this.culture.name,this.Date.dayNames=this.culture.calendar.days.names,this.Date.dayNamesMin=this.culture.calendar.days.namesShort,this.Date.abbrDayNames=this.culture.calendar.days.namesAbbr,this.Date.monthNames=this.culture.calendar.months.names,this.Date.abbrMonthNames=this.culture.calendar.months.namesAbbr,this.Date.format=this.culture.calendar.patterns.d,this.model.dateFormat==""&&(this.model.dateFormat=this.culture.calendar.patterns.d),this.model.startDay==-1&&(this.model.startDay=this.culture.calendar.firstDay));this._separator=this._getSeparator();this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText),t.isNullOrUndefined(this._options.buttonText)||(this._localizedLabels.buttonText=this._options.buttonText));this._localizedLabelToModel()},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_setDatePickerPosition:function(){if(!this.model.displayInline||this._isInputBox){var i=this.element.is("input")?this.wrapper:this.element,r=this._getOffset(i),o,s,l=n(document).scrollTop()+n(window).height()-(r.top+n(i).outerHeight()),a=r.top-n(document).scrollTop(),f=this.sfCalendar.outerHeight(),e=this.sfCalendar.outerWidth(),u=r.left,h=i.outerHeight(),p=(h-i.height())/2,v=this._getZindexPartial(),c=3,y=fa?r.top+h+c:r.top-f-c;o=n(document).scrollLeft()+n(window).width()-u;s=n(document).scrollLeft()+u+i.width();(this.model.enableRTL||e>o&&es&&(u=r.left);this.sfCalendar.css({left:u+"px",top:y+"px","z-index":v})}},_getOffset:function(n){return t.util.getOffset(n)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.sfCalendar)},_setMinDate:function(n){this.model.minDate=this._checkInstanceType(n);this.model.minDate||(this.model.minDate=new Date("11/31/1899"))},_setMaxDate:function(n){this.model.maxDate=this._checkInstanceType(n);this.model.maxDate||(this.model.maxDate=new Date("12/31/2099"))},_setDateValue:function(n,i){var r=this._checkDateObject(n,i);r!=null?(this.isValidState=!0,this.model.value=new Date(r),this.model.displayInline||this.wrapper.addClass("e-valid"),this._validateMinMaxDate(),this._preTxtValue=this.element.val(this._formatter(this.model.value,this.model.dateFormat))):(n instanceof Date&&(this._validateMinMaxDate(),n=this._formatter(n,this.model.dateFormat)),this.model.enableStrictMode?this.element.val(n):this.element.val(null),this.model.value=null,this.model.displayInline||this.wrapper.removeClass("e-valid"),this._triggerChangeEvent(),this.isValidState=this.element.val()==""||t.isNullOrUndefined(this.element.val())?!0:!1);this._removeWatermark()},_updateInputVal:function(){var n=this._validateValue();(n!=null||!this.model.enableStrictMode)&&this.sfCalendar&&this.sfCalendar.find(".e-datepicker-days").is(":visible")&&this._refreshDatepicker()},_validateInputVal:function(){var n=this._validateValue();n!=null&&(this.model.enableStrictMode||(n<=this.model.maxDate&&n>=this.model.minDate?this.isValidState=!0:(this.model.value=null,this.isValidState=!0)))},_validateValue:function(){var n;return n=this._specificFormat()&&this.element.val()!=this._formatter(this._preValue,this.model.dateFormat,this.model.locale)?this._parseDate(this.element.val(),!0):this._parseDate(this.element.val()),this._validateYearValue(n)},_getSeparator:function(){var t,i,n;for(t=this.culture?this.culture.calendar.patterns.d:this.model.dateFormat,i=new RegExp("^[a-zA-Z0-9]+$"),n=0;n=7&&n<8)return!0}return!1},_isValidDate:function(n){return n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_formatter:function(n,i){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)},_parseDate:function(n,r){var f=this._checkFormat(this.model.dateFormat),u=n;return!this._specificFormat()||u==i||n==""||r==!0||t.format(t.parseDate(u,f,this.model.locale),this.model.dateFormat,this.model.locale)==u?t.parseDate(n,f,this.model.locale):this._dateValue},_checkFormat:function(n){var i=this,r=this._regExp();return n.replace(r,function(n){return n==="/"?t.preferredCulture(i.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},_regExp:function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},isLeapYear:function(n){return n%4==0&&n%100!=0||n%400==0},_zeroTime:function(n){var t=typeof n=="string"?this._parseDate(n):new Date(n);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_getDaysInMonth:function(n){return[31,this.isLeapYear(n)?29:28,31,30,31,30,31,31,30,31,30,31][n.getMonth()]},_addDays:function(n,t){return n.setDate(n.getDate()+t),n},_addYears:function(n,t){return n.setFullYear(n.getFullYear()+t),n},_addMonths:function(n,t){var i=n.getDate();return n.setMonth(n.getMonth()+t),i>n.getDate()&&this._addDays(n,-n.getDate()),n},_isWeekend:function(n){return n.getDay()==0||n.getDay()==6},_isSpecialDates:function(n){if(this.model.specialDates)for(var t=0;te.getTime()&&(u=e),s=this.displayedMonth,h=this.displayedYear,this.displayedMonth=u.getMonth(),this.displayedYear=u.getFullYear(),o=u,r&&(this.displayedMonth!=s||this.displayedYear!=h)&&(this._renderCalendar(this,o),this._dateValue=o,this._trigger("monthChanged",[this.displayedMonth,this.displayedYear])))},_clearSelected:function(){this.numSelected=0;t.isNullOrUndefined(this.sfCalendar)||(this.model.highlightSection=="week"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().removeClass("e-selected-week"):this.model.highlightSection=="month"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().parent().removeClass("e-selected-month"):this.model.highlightSection=="workdays"?n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1).parent().removeClass("e-work-week"):n("td.e-active",this.sfCalendar).removeClass("e-active").addClass("e-state-hover").attr("aria-selected",!1))},_addSelected:function(){this.model.highlightSection=="week"?n("td.e-active",this.sfCalendar).parent().addClass("e-selected-week"):this.model.highlightSection=="month"?n("td.e-active, this.sfCalendar").parent().parent().addClass("e-selected-month"):this.model.highlightSection=="workdays"&&n("td.e-active",this.sfCalendar).parent().addClass("e-work-week")},_hideOtherMonths:function(t){n("td.other-month",t).css("visibility","hidden")},_showOtherMonths:function(t){n("td.other-month",t).css({visibility:"visible"})},_otherMonthsVisibility:function(){this.model.showOtherMonths?this._showOtherMonths(this.sfCalendar):this._hideOtherMonths(this.sfCalendar)},_createCalender:function(){t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-datepicker-headertext").text(this._formatter(this._calendarDate,this.model.headerFormat)).attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this.sfCalendar);this._enableHeader(this._showHeader);var i=t.buildTag("table.e-dp-viewdays","",{}).data("e-table","data").attr({role:"grid"}).attr(this._isIE8?{unselectable:"on"}:{});this.sfCalendar.append(i);this._renderCalendar(this);this._startLevel(this.model.startLevel);t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this.sfCalendar);n(".e-footer-text",this.sfCalendar).html(this._localizedLabels.buttonText);this._enableFooter(this.model.showFooter)},_enableHeader:function(t){t?n(".e-header",this.sfCalendar).show():n(".e-header",this.sfCalendar).hide()},_enableFooter:function(t){t?n(".e-footer",this.sfCalendar).show():n(".e-footer",this.sfCalendar).hide();this._todayBtnDisable()},_todayBtnDisable:function(){var t=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate(),0,0,0);+this.model.minDate<=+t&&+this.model.maxDate>=+t?n(".e-footer",this.sfCalendar).removeClass("e-footer-disable"):n(".e-footer",this.sfCalendar).addClass("e-footer-disable")},_checkArrows:function(n,t){this._preArrowCondition(n,this.model.minDate.getFullYear());this._nextArrowCondition(t,this.model.maxDate.getFullYear())},_checkDateArrows:function(){this._preArrowCondition(this._tempMinDate,this.model.minDate);this._nextArrowCondition(this._tempMaxDate,this.model.maxDate)},_preArrowCondition:function(n,t){n<=t?this.sfCalendar.find(".e-prev").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-prev").removeClass("e-disable").attr({"aria-disabled":!1})},_nextArrowCondition:function(n,t){n>=t?this.sfCalendar.find(".e-next").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-next").removeClass("e-disable").attr({"aria-disabled":!1})},_previousNextHandler:function(t){var r,u,f,e,o,s,i;if(this.model.readOnly||!this.model.enabled||n(t.target).hasClass("e-disable")||n(t.currentTarget).hasClass("e-disable"))return!1;t.preventDefault();this._keyboardInteraction=!1;r=n("table",this.sfCalendar);u=this._navigateFrom(r);f=n(t.target).is("a")?n(t.target.parentNode):n(t.target);e=f.hasClass("e-prev")?!0:!1;this._processNextPrevDate(e);o=n("table",this.sfCalendar);s=o.get(0).className;switch(s){case"e-dp-viewdays":i="month";break;case"e-dp-viewmonths":i="year";break;case"e-dp-viewyears":i="decade";break;case"e-dp-viewallyears":i="century"}this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:i,navigateFrom:u})},_processNextPrevDate:function(t){var c,i,u,l,s,h,f,e,o,r;if((this._DRPdisableFade&&(c=new Date(this.sfCalendar.find("td.current-month").attr("data-date")),this._dateValue=c),t&&this.sfCalendar.find(".e-arrow-sans-left").hasClass("e-disable"))||!t&&this.sfCalendar.find(".e-arrow-sans-right").hasClass("e-disable"))return!1;i=n("table",this.sfCalendar);l=i.get(0).className;switch(l){case"e-dp-viewdays":if(s=this.model.stepMonths,t){if(this._dateValue<=this.model.minDate)return this._flag=!1,!1}else if(this._dateValue>=this.model.maxDate)return this._flag=!1,!1;this._flag=!0;this._addMonths(this._dateValue,t?-s:s);this._clickedDate&&(this._calendarDate=this._clickedDate);this._dateValue=this._dateValuethis.model.maxDate?new Date(this.model.maxDate.toString()):this._dateValue;this._renderCalendar(this,this._dateValue);this._keyboardInteraction&&(this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat)}),this._removeCurrentMonthFromHideDate(),this._keyboardInteraction=!1);n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));this._addFocus("day",this._hoverDate);h=this._findFirstLastDay(new Date(this._dateValue.toString()));this._preArrowCondition(h.firstDay,this.model.minDate);this._nextArrowCondition(h.lastDay,this.model.maxDate);break;case"e-dp-viewmonths":if(f=this._dateValue,f.setFullYear(n(".e-datepicker-headertext",this.sfCalendar).text()),t){if(f.getFullYear()<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(f.getFullYear()>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0;this._addYears(f,t?-1:1);this._renderCalendar(this,f);u=f.getFullYear();n(".e-datepicker-headertext",this.sfCalendar).text(u);n("tbody,tr.e-week-header",i).not(".e-datepicker-months").hide();n(n(i).find(".e-datepicker-months")).show();this._addFocus("month",this._hoverMonth);this._checkArrows(u,u);break;case"e-dp-viewyears":if(e=this._dateValue,e.setFullYear(n(i).find(".e-state-hover").text()),t){if(parseInt(this.popup.find("td.e-year-first:first").text())<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(parseInt(n("td.e-year-last:first").prev().text())>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0;n(i).find(".e-state-hover").hasClass("e-year-first")&&t||n(i).find(".e-state-hover").hasClass("e-year-last")&&!t?this._dateValue.setFullYear(e.getFullYear()):n(i).find(".e-state-hover").hasClass("e-year-first")&&!t?this._dateValue.setFullYear(e.getFullYear()+11):n(i).find(".e-state-hover").hasClass("e-year-last")&&t?this._dateValue.setFullYear(e.getFullYear()-11):this._dateValue.setFullYear(e.getFullYear()+(t?-10:10));this._renderCalendar(this,this._dateValue);r=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1);n(".e-datepicker-headertext",this.sfCalendar).text(r+1+" - "+(r+10));n("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide();n(n(i).find(".e-datepicker-years")).show();this._addFocus("year",this._hoverYear+(n(".e-year-first.e-hidedate").length?-1:0));this._checkArrows(r+1,r+10);break;case"e-dp-viewallyears":if(t){if(o=parseFloat(n("td.e-allyear-first",i.get(0)).text().split("-")[1]),o<=this.model.minDate.getFullYear())return this._flag=!1,!1;this._flag=!0}else{if(o=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]),o>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0}this._dateValue.setFullYear((this._lastHoveredYear?this._lastHoveredYear:this._dateValue.getFullYear())+(t?-100:100));this._lastHoveredYear=this._dateValue.getFullYear();this._renderCalendar(this,this._dateValue);r=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%100+1);u=parseFloat(n("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]);n(".e-datepicker-headertext",this.sfCalendar).text(r+1+" - "+u);n("tbody,tr.e-week-header",i).not(".e-datepicker-allyears").hide();n(n(i).find(".e-datepicker-allyears")).show();this._addFocus("allyear",this._hoverAllYear+(n(".e-allyear-first.e-hidedate").length?-1:0));this._checkArrows(r+1,u)}this._layoutChanged()},_addFocus:function(t,i){var f="e-current-"+t,u,r;return t=="day"&&(f="current-month"),u=this.sfCalendar.find("tbody tr td."+f),t=="month"&&n(u).each(function(t,r){if(parseInt(n(r).attr("data-index"))==parseInt(i)){i=t;return}}),r=u[i],r||(r=u.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),n(r).hasClass("e-hidedate")||n(r).addClass("e-state-hover"),this._setActiveState(t),i},_setActiveState:function(t){var e,f,o;if(this.model.value instanceof Date){var i=this.sfCalendar.find("tbody tr td.e-current-"+t),r,s=this,u=-1;switch(t){case"month":this.model.value.getFullYear()===parseInt(n(".e-text",this.sfCalendar).text())&&n(i).each(function(t,i){if(parseInt(n(i).attr("data-index"))==parseInt(s.model.value.getMonth())){u=t;return}});break;case"year":e=this.model.value.getFullYear();n(i).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(e)){u=n;return}});break;case"allyear":f=parseInt(this.model.value.getFullYear())-(parseInt(this.model.value.getFullYear())%10+1);o=f+1+" - "+(f+10);n(i).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(o)){u=n;return}})}r=i[u];r&&(this.sfCalendar.find("table td").removeClass("e-active"),n(r).hasClass("e-hidedate")||n(r).addClass("e-active"))}},_setFocusByName:function(t,i){var u=this.sfCalendar.find("tbody tr td.e-current-"+t),f,r;return n(u).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(i)){f=n;return}}),r=u[f],r||(r=u.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),n(r).addClass("e-state-hover"),this._setActiveState(t),f},_getHeaderTxt:function(){return this.sfCalendar.find(".e-datepicker-headertext").text()},_findFirstLastDay:function(n){var t=n.getFullYear(),i=n.getMonth(),r=new Date(t,i,1),u=new Date(t,i+1,0);return{firstDay:r,lastDay:u}},_forwardNavHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t&&t.preventDefault();var u=n("table",this.sfCalendar),e=n("table",this.sfCalendar).get(0).className,o=this,i,r,f=this._navigateFrom(u);switch(e){case"e-dp-viewdays":this._hoverMonth=this._getDateObj(u.find(".e-state-hover")).getMonth()||this._getDateObj(u.find(".e-active")).getMonth()||0;this._DRPdisableFade&&(this._renderCalendar(this,this._calendarDate),n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat)));this._startLevel("year");r="year";this._addFocus("month",this._hoverMonth);break;case"e-dp-viewmonths":i=this._getHeaderTxt();this._startLevel("decade");r="decade";this._hoverYear=this._setFocusByName("year",i);break;case"e-dp-viewyears":i=this._getHeaderTxt();this._startLevel("century");r="century";this._hoverAllYear=this._setFocusByName("allyear",i)}f!="century"&&this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:r,navigateFrom:f});this._layoutChanged()},_cellSelection:function(){var u=n("table",this.sfCalendar),r=n("table",this.sfCalendar).get(0).className,t,i;switch(r){case"e-dp-viewmonths":this._hoverMonth=this._addFocus("month",this._dateValue.getMonth());break;case"e-dp-viewyears":t=new Date(this._dateValue.toString());this._navigationToPrevNext("year");this._dateValue=t;this._hoverYear=this._setFocusByName("year",this._dateValue.getFullYear());break;case"e-dp-viewallyears":t=new Date(this._dateValue.toString());this._navigationToPrevNext("allyear");this._dateValue=t;i=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1);this._hoverAllYear=this._setFocusByName("allyear",i+1+" - "+i+10)}this._layoutChanged()},_navigationToPrevNext:function(t){var r=this.sfCalendar.find("tbody tr td.e-current-"+t),u,i,f=this._dateValue.getFullYear();n(r).each(function(n,t){if(parseInt(t.innerHTML)==parseInt(f)){u=n;return}});i=r[u];i&&(n(i).hasClass("e-"+t+"-last")?this._processNextPrevDate(!1):n(i).hasClass("e-"+t+"-first")&&this._processNextPrevDate(!0))},_navigateFrom:function(n){var i=n.get(0).className,t;switch(i){case"e-dp-viewdays":t="month";break;case"e-dp-viewmonths":t="year";break;case"e-dp-viewyears":t="decade";break;case"e-dp-viewallyears":t="century"}return t},_backwardNavHandler:function(i){var u,r;if(this._animating=!0,this.model.readOnly||!this.model.enabled)return!1;i.type?(i.preventDefault(),u=n(i.currentTarget)):u=i;var f=n("table",this.sfCalendar),o,c=n("table",this.sfCalendar).get(0).className,e=this,s,h=this._navigateFrom(f);switch(c){case"e-dp-viewmonths":f.removeClass("e-dp-viewmonths").addClass("e-dp-viewdays");this._lastHoveredMonth=parseInt(n(u).attr("data-index"));this._dateValue=new Date(this._dateValue.getFullYear(),this._lastHoveredMonth,1);this._DRPdisableFade&&this._trigger("_month_Loaded",{currentTarget:i.currentTarget});this._renderCalendar(this,this._dateValue);n("tbody",f).not(".e-datepicker-days,.e-week-header").hide();n(n(f).find(".e-datepicker-days,.e-week-header")).fadeIn("fast",function(){e._addFocus("day",e._hoverDate||0);e._animating=!1});n(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));s="month";break;case"e-dp-viewyears":f.removeClass("e-dp-viewyears").addClass("e-dp-viewmonths");this._lastHoveredYear=parseInt(u.text());this._dateValue.setFullYear(this._lastHoveredYear);this._renderCalendar(this,this._dateValue);n("tbody,tr.e-week-header",f).not(".e-datepicker-months").hide();t.isNullOrUndefined(this._hoverMonth)&&!t.isNullOrUndefined(this._dateValue)&&(this._hoverMonth=this._dateValue.getMonth());n(n(f).find(".e-datepicker-months")).fadeIn("fast",function(){e._addFocus("month",e._hoverMonth||0);e._animating=!1});o=u.text();n(".e-datepicker-headertext",this.sfCalendar).text(o);this._checkArrows(o,o);s="year";break;case"e-dp-viewallyears":r=u.text().split("-");f.removeClass("e-dp-viewallyears").addClass("e-dp-viewyears");r[0]this.model.maxDate.getFullYear()&&(r[0]=this.model.maxDate.getFullYear().toString());this._renderCalendar(this,new Date(r[0],0,1));n("tbody,tr.e-week-header",f).not(".e-datepicker-years").hide();n(n(f).find(".e-datepicker-years")).fadeIn("fast",function(){e._addFocus("year",e._hoverYear||0);e._animating=!1});n(".e-datepicker-headertext",this.sfCalendar).text(r[0]+" - "+r[1]);this._checkArrows(r[0],r[1]);s="decade";this._dateValue=new Date(this._dateValue.setFullYear(parseInt(n.trim(r[0]))+(this._lastHoveredYear?this._lastHoveredYear%10:this._dateValue.getFullYear()%10)));break;default:this._clearSelected();this.sfCalendar.find("table td").removeClass("e-state-hover");u.not("td.e-hidedate").addClass("e-active").attr("aria-selected",!0);this._addSelected();this._hoverDate=this._getDateObj(u).getDate()-1;this._dateValue=new Date(u.attr("data-date"));this._clickedDate=new Date(u.attr("data-date"));this._animating=!1}h!="month"&&this._trigger("navigate",{date:this._dateValue,value:this._formatter(this._dateValue,this.model.dateFormat),navigateTo:s,navigateFrom:h});this._layoutChanged()},_startLevel:function(t){var i=n("table",this.sfCalendar),o=n(".e-datepicker-headertext",this.sfCalendar),r,f,u=this._dateValue,s,e;switch(t){case"decade":i.removeClass("e-dp-viewallyears e-dp-viewmonths e-dp-viewdays").addClass("e-dp-viewyears");n("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide();n(n(i).find(".e-datepicker-years")).show();u=this.model.enableStrictMode&&this._calendarDatethis.model.maxDate.getFullYear()?(f.addClass("e-hidedate"),f.removeClass("e-current-month")):(r.getFullYear()<=this.model.minDate.getFullYear()&&u=this.model.maxDate.getFullYear()&&u>this.model.maxDate.getMonth()+1)&&(f.addClass("e-hidedate"),f.removeClass("e-current-month")),e.append(f);t.append(e)}i.append(t);s=r.getFullYear();this._checkArrows(s,s)},_datepickerYears:function(t,i,r){for(var e,s,h,u,c=function(n){return document.createElement(n)},l=parseInt(r)-(parseInt(r)%10+1),f=[],o=0;o<12;o++)f.push(l+o);for(e=0,s=0;s<3;s++){for(h=n(c("tr")),o=0;o<4;o++)u=n(c("td")),u.attr(this._isIE8?{unselectable:"on"}:{}),e==0?u.addClass("e-year-first e-current-year "):e==11?u.addClass("e-year-last e-current-year "):u.addClass("e-current-year e-state-default"),(f[e]this.model.maxDate.getFullYear())&&(u.addClass("e-hidedate"),u.removeClass("e-current-year")),u.attr({"data-year":f[e],id:f[e]}),u.html(f[e++]),h.append(u);t.append(h)}i.append(t);this._checkArrows(f[0],f[f.length])},_datepickerAllYears:function(t,i,r){for(var f,h,c,u,o=parseInt(r)-(parseInt(r)%100+10),a=o,e=[],l=this._isIE8||this._isIE9?"":"\n",s=0;s<12;s++)e.push(parseInt(o)+" -"+l+parseInt(o+9)),o=o+10;for(f=0,h=0;h<3;h++){for(c=n(document.createElement("tr")),s=0;s<4;s++)u=n(document.createElement("td")),u.attr(this._isIE8?{unselectable:"on"}:{}),f==0?u.addClass("e-allyear-first e-current-allyear "):f==11?u.addClass("e-allyear-last e-current-allyear "):u.addClass("e-current-allyear e-state-default"),(parseInt(e[f].split("-\n")[1])this.model.maxDate.getFullYear())&&(u.addClass("e-hidedate"),u.removeClass("e-current-allyear")),u.attr({"data-decade":e[f].replaceAll("-","to"),id:e[f].replaceAll(" ","")}),u.html(e[f++]),c.append(u);t.append(c)}i.append(t)},_renderHeader:function(i){var a=n(document.createElement("thead")),h=t.preferredCulture(this.model.locale).calendars.standard.days,f,e,c,s,u,r,o,l;if(i.model.dayHeaderFormat!="none")for(f=t.buildTag("tr.e-week-header").attr({role:"row"}).attr(this._isIE8?{unselectable:"on"}:{}),this.model.weekNumber==!0&&(e=t.preferredCulture(this.model.locale).calendars.standard.week,r=e.name,o=i.model.dayHeaderFormat=="short"?e.nameAbbr:i.model.dayHeaderFormat=="long"?week:e.nameShort,c=t.buildTag("th","",{},{scope:"col",abbr:r,"data-date":r,title:this._formatter(r,"dddd")}).attr(this._isIE8?{unselectable:"on"}:{}).html(o),f.append(c)),s=this.Date.firstDayOfWeek;s1&&(a-=7);nt=Math.ceil((-1*a+1+this._getDaysInMonth(f))/7);this._addDays(f,a-1);tt=d._zeroTime(new Date);it=this._calendarDate;e=t.buildTag("tbody.e-datepicker-months","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});this._datepickerMonths(e,s,h);e=t.buildTag("tbody.e-datepicker-days","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});for(var ft=0,rt=!0,w=!0;ft++<\/span>"+f.getDate():f.getDate()+"").attr({"data-date":f.toDateString(),title:this.model.showTooltip?p&&this.model.specialDates[l][this._mapField._tooltip]?this.model.specialDates[l][this._mapField._tooltip]:this._formatter(f,this.model.tooltipFormat):"","aria-selected":!1,role:"gridcell",id:this._formatter(f,"yyyyddMM")}).attr(this._isIE8?{unselectable:"on"}:{}).addClass((y?"current-month e-state-default ":"other-month e-state-default ")+(this._isWeekend(f)?this._ejHLWeekEnd?"e-dp-weekend e-week-end ":this.model.highlightWeekend?"e-week-end ":"":"e-week-day ")+(y&&f.getTime()==tt.getTime()?"today e-state-hover":""));o.find("span:first-of-type").addClass(p?this.model.specialDates[l][this._mapField._icon]?"e-special-date-icon "+this.model.specialDates[l][this._mapField._icon]+" ":"e-special-day":"");o.addClass(p?this.model.specialDates[l][this._mapField._custom]?this.model.specialDates[l][this._mapField._custom]:"":"");et&&this._disableDates({date:f,element:o});it.getTime()==f.getTime()&&y&&(o.hasClass("e-hidedate")||(this.model.value?(o.addClass("e-active").attr({"aria-selected":!0}),this.model.highlightSection=="week"&&c.addClass("e-selected-week"),this.model.highlightSection=="month"&&e.addClass("e-selected-month"),this.model.highlightSection=="workdays"&&c.addClass("e-work-week")):this.model.value!=null&&o.addClass("e-state-hover").attr({"aria-selected":!1})),this._hoverDate||(o.hasClass("e-hidedate")||o.addClass("e-state-hover"),this._hoverDate=f.getDate()-1));k=!0;(fthis.model.maxDate)&&(o.addClass("e-hidedate"),o.removeClass("current-month"),this.model.showOtherMonths&&o.removeClass("other-month"),k=w=!1);y&&(k&&rt&&(this._tempMinDate=f,rt=!1,w=!0),w&&(this._tempMaxDate=f));this._trigger("beforeDateCreate",{date:f,value:this._formatter(f,this.model.dateFormat),element:o});c.append(o);f=new Date(f.getFullYear(),f.getMonth(),f.getDate()+1,0,0,0)}e.append(c)}s.append(e);this._DRPdisableFade?(n(e).css("display","block"),n(e).css({display:"table-row-group","vertical-align":"middle","border-color":"inherit"})):this._isIE8||this._isIE7?n(e).css("display","table-row-group"):n(e).fadeIn("fast");this.model.startLevel===this.model.depthLevel?this._depthLevel(this.model.depthLevel):this.model.depthLevel!="month"&&this.model.depthLevel!=""?this.model.startLevel=="century"?this._depthLevel(this.model.depthLevel):this.model.startLevel=="decade"&&this.model.depthLevel!="century"?this._depthLevel(this.model.depthLevel):this.model.startLevel=="year"&&this.model.depthLevel!="decade"&&this.model.depthLevel!="century"?this._depthLevel(this.model.depthLevel):(this._on(s.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this)),this._on(s.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this))):(this._on(s.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",n.proxy(this._backwardNavHandler,this)),this._on(s.find(".current-month , .other-month"),"click",n.proxy(this._onSetCancelDateHandler,this)));this._otherMonthsVisibility();this._checkDateArrows()},_checkDisableRange:function(n){return!t.isNullOrUndefined(this._disableCollection[n.getFullYear()])&&jQuery.inArray(n.getMonth(),this._disableCollection[n.getFullYear()])!==-1?!0:!1},_initDisableObj:function(){var i,r,n,u;for(this._disableCollection={},i=0;i1)t.row-=1;else return this._processNextPrevDate(!0),this.sfCalendar.find(h+":nth-child("+t.col+"):last");if(o=this._getCell(t,s),o.length<=1){if(o=this._findVisible(t,s,"up"),o!==null)return o;this._processNextPrevDate(!0);o=this.sfCalendar.find(h+":nth-child("+t.col+"):last")}return o;case 37:if(e)return this._processNextPrevDate(!0),this.sfCalendar.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else if(t.row>1)t={row:t.row-1,col:u};else return this._processNextPrevDate(!0),this.sfCalendar.find(h+":last");if(o=this._getCell(t,s),o.length<=1){if(o=this._findVisible(t,s,"left"),o!==null)return o;this._processNextPrevDate(!0);o=this.sfCalendar.find(h+":last")}return o;case 39:if(e)return this._processNextPrevDate(!1),this.sfCalendar.find("tbody tr td.e-state-hover");if(t.col=0;e++){if(f=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+r+") td:nth-child("+u+")"),f.length<=0)return null;if(f.hasClass("e-hidedate")||!f.is(":visible")){if((i=="right"||i=="left"?i=="right"?u++:u--:i=="down"?r++:r--,r<=0||r>this.sfCalendar.find("tbody"+t.parent+" tr").length)||(u>this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+r+") td").length&&(r++,u=1),u<=0&&(r--,u=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+r+") td").length),r<=0||r>this.sfCalendar.find("tbody"+t.parent+" tr").length))return null}else{if(f.hasClass("other-month"))return null;if(f.hasClass(o))return n.col=u,n.row=r,f}}},_getCell:function(n,t){return this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+n.row+") td"+t.child+":nth-child("+n.col+")")},_getDateObj:function(n){return n.attr("data-year")?new Date(n.attr("data-year")):n.attr("data-month")?new Date(n.attr("data-month")):new Date(n.attr("data-date"))},_touchCalendar:function(n){var t=this.sfCalendar.find("table")[0].className;switch(n.type){case"pinchin":t!="e-dp-viewdays"&&this._keyboardNavigation({keyCode:13});break;case"pinchout":t!="e-dp-viewallyears"&&this.model.allowDrillDown&&this._forwardNavHandler();break;case"swipeleft":this._processNextPrevDate(!1);break;case"swiperight":this._processNextPrevDate(!0)}},show:function(i){var r,u;if(t.isNullOrUndefined(this.sfCalendar)&&this._renderPopup(),this._isOpen)return!1;if(r=this,this._popupOpen=!0,n(this.element).attr("aria-expanded",!0),u=this._preValue!=null?new Date(this._preValue.toString()):this._preValue,this.model.enabled){if(this.model.displayInline||this._setDatePickerPosition(),this._trigger("beforeOpen",{element:this.sfCalendar,events:i}))return!1;this.sfCalendar.attr({"aria-hidden":"false"});r._isOpen=!0;this.sfCalendar.slideDown(this.model.enableAnimation?this.animation.open.duration:0,function(){if(r.model&&!r.model.displayInline)n(document).on("mousedown",n.proxy(r._onDocumentClick,r))});this._isIE8?this.element.val()&&this._compareDate(new Date(this.element.val()),u)&&this._updateInputVal():this._updateInputVal();this._refreshLevel(u);this._trigger("open",{prevDate:u,date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)});n(window).on("resize",n.proxy(this._OnWindowResize,this));this.model.displayInline||(this._on(t.getScrollableParents(this.wrapper),"scroll",this.hide),this._on(t.getScrollableParents(this.wrapper),"touchmove",this.hide));this._isInputBox&&this.wrapper.addClass("e-active");this.model.value!=null?n(this.element).attr("aria-activedescendant",n(this.sfCalendar.find(".e-active")).attr("id")):n(this.element).attr("aria-activedescendant",n(this.sfCalendar.find(".today")).attr("id"))}},hide:function(r){if(!this._isOpen||this._getInternalEvents||this._trigger("beforeClose",{element:this.sfCalendar,events:r}))return!1;var u=this;(this._popupOpen=!1,n(this.element).attr("aria-expanded",!1),this.sfCalendar.attr({"aria-hidden":"true"}),this._popClose&&r!=i&&r.type!="click")||(this.sfCalendar.slideUp(this.model.enableAnimation?this.animation.close.duration:0,function(){u._isOpen=!1;n(document).off("mousedown",n.proxy(u._onDocumentClick,u));u._setWaterMark()}),this.element.val()!=""&&this._validateInputVal(),this._trigger("close",{prevDate:this._prevDate,date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)}),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this.hide),this._off(t.getScrollableParents(this.wrapper),"touchmove",this.hide),this._isInputBox&&this.wrapper.removeClass("e-active"),this.model.value?n(this.element).attr("aria-activedescendant",n(this.sfCalendar.find(".e-active")).attr("id")):n(this.element).removeAttr("aria-activedescendant"))},enable:function(){this.model.enabled=!0;this.wrapper&&this.wrapper.removeClass("e-disable");this.element.removeClass("e-disable").attr({"aria-disabled":!1});this.element.prop("disabled",!1);this.dateIcon&&this.dateIcon.removeClass("e-disable").attr({"aria-disabled":!1});this._isIE8&&this.dateIcon&&this.dateIcon.children().removeClass("e-disable");this.element.prop("disabled",!1);this._isSupport||this._hiddenInput.prop("disabled",!1);this.sfCalendar&&this.sfCalendar.removeClass("e-disable").attr({"aria-disabled":!1})},disable:function(){this.model.enabled=!1;this.wrapper&&this.wrapper.addClass("e-disable");this.element.addClass("e-disable").attr({"aria-disabled":!0});this.element.attr("disabled","disabled");this.dateIcon&&this.dateIcon.addClass("e-disable").attr({"aria-disabled":!0});this._isIE8&&this.dateIcon&&this.dateIcon.children().addClass("e-disable");this.element.attr("disabled","disabled");this._isSupport||this._hiddenInput.attr("disabled","disabled");this.sfCalendar&&this.sfCalendar.addClass("e-disable").attr({"aria-disabled":!0});this._isOpen&&(this.element.is(":input")&&this.element.blur(),this.model.displayInline||this.hide())},getValue:function(){return this._formatter(this.model.value,this.model.dateFormat)},_wireCalendarEvents:function(){if(this._allowQuickPick(this.model.allowDrillDown),this._on(n(".e-next",this.sfCalendar),"click",n.proxy(this._previousNextHandler,this)),this._on(n(".e-prev",this.sfCalendar),"click",n.proxy(this._previousNextHandler,this)),!this.model.displayInline){this.sfCalendar.on("mouseenter touchstart",n.proxy(function(){this._popClose=!0},this));this.sfCalendar.on("mouseleave touchend",n.proxy(function(){this._popClose=!1},this))}this.model.showFooter&&this._on(n(".e-footer",this.sfCalendar),"click",this._setCurrDate);this.sfCalendar&&this._on(this.sfCalendar,"pinchin pinchout swipeleft swiperight",n.proxy(this._touchCalendar,this))},_wireEvents:function(){if(this.element.is(":input")&&this.model.allowEdit&&(this._on(this.element,"blur",this._onFocusOut),this._on(this.element,"focus",this._onFocusIn),this._on(this.element,"keydown",this._onKeyDown)),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showDatePopUp,this))}},_bindDateButton:function(){this._on(this.dateIcon,"mousedown",this._showDatePopUp);this.model.allowEdit&&this.element.off("mousedown",n.proxy(this._showDatePopUp,this))},_bindInputEvent:function(){this._off(this.dateIcon,"mousedown",this._showDatePopUp)},_specificFormat:function(){var i=t.globalize._getDateParseRegExp(t.globalize.findCulture(this.model.locale).calendar,this.model.dateFormat);return n.inArray("dddd",i.groups)>-1||n.inArray("ddd",i.groups)>-1},_onFocusOut:function(i){var f,r,u,e;if(this._isFocused=!1,f=this._preValue!=null?new Date(this._preValue.toString()):this._preValue,this.model.enableStrictMode&&this.element.val()&&!isNaN(+new Date(this.element.val())))for(this._formatArray=this.model.dateFormat.split(this._getSeparator()),this._valArray=this.element.val().split(this._getSeparator()),r=0;r1&&this._formatArray[r].length==4&&this._valArray[r].length==2&&(this._valArray[r]=(parseInt(this._valArray[r])+2e3).toString(),this.element.val(this._valArray.join(this._getSeparator())));this._validateOnFocusOut(this._validateValue(),i);this.wrapper.removeClass("e-focus");t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid");this._isOpen&&!this.model.displayInline||this._setWaterMark()||this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._updateInputVal();(!this._isOpen||this.model.displayInline)&&this._refreshLevel(f);this.element.val()!=""&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal();this.element.off("keydown",n.proxy(this._keyboardNavigation,this));this.model.showPopupButton||this._off(this.element,"click",this._elementClick);u=this.element.val();e={prevDate:this._prevDate,value:u};this._specificFormat()?this._prevDate!=u&&this._setDateValue(u,!0):this._setDateValue(u);this.model.value||this._clearSelected();this._trigger("focusOut",e);this._checkErrorClass()},_onFocusIn:function(t){if(this._isSupport&&(t.preventDefault(),this._isFocused=!0),this.wrapper.removeClass("e-error"),this.isValidState=!0,this.wrapper.addClass("e-focus"),this.wrapper.addClass("e-valid"),!this.model.readOnly){this._isSupport||this._hiddenInput.css("display","none");this.element.on("keydown",n.proxy(this._keyboardNavigation,this));this.model.showPopupButton||this.model.readOnly||this.show(t);this.model.showPopupButton||this._on(this.element,"click",this._elementClick);this._trigger("focusIn",{date:this.model.value,value:this._formatter(this.model.value,this.model.dateFormat)})}},_elementClick:function(n){this._popupOpen||this.show(n)},_removeWatermark:function(){this.element.val()==""||this._isSupport||this._hiddenInput.css("display","none")},_refreshPopup:function(){this._refreshDatepicker();this._startLevel(this.model.startLevel)},_weekDate:function(n){var i,t=new Date(n.getTime());return t.setDate(t.getDate()+4-(t.getDay()||7)),i=t.getTime(),t.setMonth(0),t.setDate(1),Math.floor(Math.round((i-t)/864e5)/7)+1},_refreshLevel:function(n){if(this.model.startLevel==this.model.depthLevel&&this.model.startLevel!="month"){var t=this._stringToObject(this.element.val());t=this._validateYearValue(t);t&&(this._compareDate(n,t)||this._refreshPopup())}},_validateOnFocusOut:function(n,i){var f=this._preValue!=null?this._calendarDate:this._preValue,e=this._formatter(f,this.model.dateFormat),o,s,h,r,u;this._prevDate=this._formatter(this._preValue,this.model.dateFormat);o=e;s={prevDate:this._prevDate,value:o,isInteraction:!!i};this._specificFormat()&&n>this.model.minDate&&nthis.model.maxDate?(this.isValidState=!1,u=!0,this._calendarDate=nthis.model.maxDate&&(this._calendarDate=this.model.maxDate)):(this._preTxtValue==null||this.element.val()==""?(this.element.val(""),this._isSupport||this._hiddenInput.css("display","block")):this.element.val(e),this._triggerChangeEvent(i),this.model.value!=null&&this._trigger("change",s)):(t.isNullOrUndefined(this.model.value)&&(this.model.value=this._parseDate(this.element.val())),this.model.maxDatethis.model.maxDate)&&(r=!0,this._calendarDate=n=nthis.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0),r&&this.element.val(this._formatter(n,this.model.dateFormat)),this._compareDate(this._preValue,this._parseDate(this.element.val(),!0))||this._triggerChangeEvent(i))},_onKeyDown:function(n){if(n.keyCode===13){var t=this._preValue!=null?new Date(this._preValue.toString()):this._preValue;this._validateOnFocusOut(this._validateValue(),n);this._isOpen&&!this.model.displayInline||this._setWaterMark()||this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._updateInputVal();(!this._isOpen||this.model.displayInline)&&this._refreshLevel(t);this.element.val()!=""&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal();this._checkErrorClass()}},_showhidePopup:function(n){if(!this.model.enabled)return!1;this._isOpen?(this._isFocused||!this.element.is(":input")||t.isTouchDevice()||this.element.focus(),this._cancelValue||this.hide(n)):(this._isFocused||!this.element.is(":input")||t.isTouchDevice()||this.element.focus(),this.show(n))},_compareDate:function(n,t){return+n==+t?!0:!1},_validateDate:function(n){var i=!0,t,r;if(n!=null){for(t=0;tthis.model.maxDate)&&this.model.enableStrictMode&&(i=!1,this.isValidState=!1)}return i},_triggerChangeEvent:function(n){var r,u=this.element.val()==""?null:this.element.val(),t;this._prevDate=this._formatter(this._preValue,this.model.dateFormat);t={prevDate:this._prevDate,value:u,isInteraction:!!n};r=this._specificFormat()&&n!=i&&n.type=="keydown"&&this._formatter(this._preValue,this.model.dateFormat,this.model.locale)!=this.element.val()?this._parseDate(this.element.val(),!0):this._specificFormat()&&n!=i&&n.type=="blur"?this.model.value:this._parseDate(u);r=this._validateYearValue(r);this._validateDate(r)||(r=null);this._compareDate(this._preValue,r)?this.element.val()==""&&this._prevDate==null||this.element.val()==this._prevDate||(t.value=this.element.val(),this._trigger("_change",t)):(this._preValue=this.model.value=r,t.value=this._formatter(this.model.value,this.model.dateFormat),this.model.value&&(this._clickedDate=this._calendarDate=this.model.value),this.model.displayInline&&!this._isInputBox&&this._hiddenInput.attr("value",u),this.model.value||this.model.enableStrictMode||this._setDateValue(this.model.value),t.value=u,this._trigger("_change",t),t.value=this._formatter(this.model.value,this.model.dateFormat),this._trigger("change",t),this._checkErrorClass())},_triggerSelectEvent:function(){var i=this.element.val(),t;this._parseDate(i)&&(t={prevDate:this._prevDate,date:this.model.value,value:i,isSpecialDay:this._isSpecialDates(this.model.value)},this._prevDate!=i&&this._parseDate(t.value)&&this.model.value>=this.model.minDate&&this.model.value<=this.model.maxDate&&(this._cancelValue=this._trigger("select",t)),this._dt_drilldown&&this._trigger("dt_drilldown",t));this.model.value&&n(this.element).attr("aria-activedescendant",n(this.sfCalendar.find(".e-active")).attr("id"))},_onDocumentClick:function(t){this.model&&(n(t.target).is(this.popup)||n(t.target).parents(".e-popup").is(this.popup)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-datewidget").is(this.wrapper)?(n(t.target).is(this.popup)||n(t.target).parents(".e-popup").is(this.popup))&&t.preventDefault():this.hide(t))},_OnWindowResize:function(){this.sfCalendar&&this._setDatePickerPosition()},_showDatePopUp:function(n){var t=!1;if((n.button?t=n.button==2:n.which&&(t=n.which==3),!t)&&(this._isSupport||this.model.showPopupButton||(n.preventDefault(),this._onFocusIn()),!this.model.readOnly)){if(n.preventDefault(),!this.model.enabled&&this.model.displayInline)return!1;this._showhidePopup(n)}},_layoutChanged:function(){this._getInternalEvents&&this._trigger("layoutChange")},_setCurrDate:function(n){if(this.model.readOnly||!this.model.enabled)return!1;n&&n.preventDefault();var t=this;this._prevDate=this._formatter(this.model.value,this.model.dateFormat);this._dateValue=this._zeroTime(new Date);this.model.value=this._calendarDate=new Date(this._dateValue.toString());this._setDateValue(this.model.value);this._triggerSelectEvent(n);this._triggerChangeEvent(n);this._refreshDatepicker();this._changeDayClass();this._startLevel(this.model.startLevel);this._onSetCancelDateHandler(n);this._layoutChanged()},_changeDayClass:function(){var n=this.popup.children("table")[0].className;n!="e-dp-viewdays"&&this.popup.children("table").removeClass(n).addClass("e-dp-viewdays")},_onSetCancelDateHandler:function(t){if(this.model.readOnly||!this.model.enabled||t&&(n(t.target).hasClass("e-disable")||n(t.target).hasClass("e-hidedate")))return!1;t&&t.type&&t.preventDefault();this._specificFormat()?this._prevDate=this.element.val():this.model.value=this._parseDate(this.element.val());this._prevDate=this._formatter(this.model.value,this.model.dateFormat);this._setDateValue(this._dateValue);this._triggerSelectEvent(t);this._triggerChangeEvent(t);this._dateValue=this.model.value==null?null:new Date(this.model.value.toString());this.element.is(":input")&&!this.model.displayInline&&this._showhidePopup(t);t&&n(t.currentTarget).hasClass("other-month")&&this._refreshDatepicker();this._cellSelection()},_closeCalendar:function(n){n&&n!=this.element||this.sfCalendar.empty().remove()},_checkErrorClass:function(){this.wrapper&&(this.isValidState?this.wrapper.removeClass("e-error"):this.wrapper.addClass("e-error"))},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.DatePicker.Locale=t.DatePicker.Locale||{};t.DatePicker.Locale["default"]=t.DatePicker.Locale["en-US"]={watermarkText:"Select date",buttonText:"Today"};t.DatePicker.Header={None:"none",Short:"short",Min:"min",Long:"long"};t.DatePicker.HighlightSection={Month:"month",Week:"week",WorkDays:"workdays",None:"none"};t.DatePicker.Level={Month:"month",Year:"year",Decade:"decade",Century:"century"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejTimePicker","ej.TimePicker",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_rootCSS:"e-timepicker",_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},_requiresID:!0,defaults:{cssClass:"",timeFormat:"",value:null,enableAnimation:!0,locale:"en-US",htmlAttributes:{},readOnly:!1,showPopupButton:!0,enableStrictMode:!1,interval:30,hourInterval:1,minutesInterval:1,secondsInterval:1,height:"",width:"",minTime:"12:00 AM",maxTime:"11:59 PM",showRoundedCorner:!1,enableRTL:!1,popupHeight:"191px",popupWidth:"auto",enabled:!0,enablePersistence:!1,disableTimeRanges:null,validationRules:null,validationMessages:null,focusIn:null,focusOut:null,beforeChange:null,change:null,select:null,create:null,destroy:null,beforeOpen:null,beforeClose:null,open:null,close:null,watermarkText:"select a time"},dataTypes:{timeFormat:"string",minTime:"string",maxTime:"string",readOnly:"boolean",interval:"number",showPopupButton:"boolean",locale:"string",hourInterval:"number",minutesInterval:"number",secondsInterval:"number",enabled:"boolean",enablePersistence:"boolean",enableAnimation:"boolean",enableStrictMode:"boolean",disableTimeRanges:"data",htmlAttributes:"data",validationRules:"data",validationMessages:"data",watermarkText:"string"},observables:["value"],enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.element.prop("disabled",!1),this.model.enabled=!0,this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable").attr("aria-disabled",!1),this.model.showPopupButton&&(this.timeIcon.removeClass("e-disable").attr("aria-disabled",!1),this.popupList&&this.popupList.removeClass("e-disable").attr("aria-disabled",!1)),this._isIE8&&this.timeIcon.children().removeClass("e-disable"))},disable:function(){this.model.enabled&&(this.element[0].disabled=!0,this.model.enabled=!1,this.element.attr("disabled","disabled"),this.wrapper.addClass("e-disable"),this.element.addClass("e-disable").attr("aria-disabled",!0),this.model.showPopupButton&&(this.timeIcon.addClass("e-disable").attr("aria-disabled",!0),this.popupList&&this.popupList.addClass("e-disable").attr("aria-disabled",!0)),this._isIE8&&this.timeIcon.children().addClass("e-disable"),this._hideResult())},getValue:function(){return this.element.val()},setCurrentTime:function(){this.model.readOnly||this._setMask()},setValue:function(n){var i=this.model.value,r;this.model.value=t.format(this._createObject(n,!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(n,!0)&&(r=this._isValid(this.model.value)?this._localizeTime(this.model.value):this.model.value,this.element.val(r));i!=this.model.value&&this._raiseChangeEvent(i,!0);this._checkErrorClass()},show:function(){this.showDropdown||this._getInternalEvents||this._showResult()},hide:function(){this.showDropdown&&this._hideResult()},_ISORegex:function(){this._tokens=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;this._extISORegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._basicISORegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;this._numberRegex={2:/\d\d?/,4:/^\d{4}/,z:/Z|[+-]\d\d(?::?\d\d)?/gi,t:/T/,"-":/\-/,":":/:/};this._zeroRegex=/Z|[+-]\d\d(?::?\d\d)?/;this._dates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]];this._times=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]]},_timeFormat:function(n){var r,i;return n||(n=t.preferredCulture(this.model.locale).calendars.standard.patterns.t),r=this._validateTimeFormat(n),r&&(this.model.timeFormat=r,this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale),this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale),this.model.value?(this._setModelOption=!0,this.model.value=this._localizeTime(this.model.value),this.element.val(this.model.value)):(this._setModelOption=!1,i=this._localizeTime(this.element.val()),i&&this._checkMinMax(i)&&(this.model.value=i,this.element.val(i)))),r},_getTimeFormat:function(){this._prevTimeFormat&&(this.model.timeFormat=t.preferredCulture(this.model.locale).calendar.patterns.t||"h:mm tt");this.seperator=this._getSeperator()},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popupList&&this.popupList.removeClass(this.model.cssClass).addClass(n)},_localize:function(n){var i=this._createObject(this.model.value,!0);this.model.locale=n;this._getTimeFormat();this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale);this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale);t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText);i?(this.model.value=this._localizeTime(i),this.element.val(this.model.value)):(i=this._localizeTime(this.element.val()),i&&this._checkMinMax(i)&&(this.model.value=i,this.element.val(i)));this._getAmPm()},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_setLocalize:function(n){var n=t.preferredCulture(n);n&&(this.model.locale=n.name=="en"?"en-US":n.name,t.isNullOrUndefined(this._options)||!t.isNullOrUndefined(this._options.timeFormat)&&this._options.timeFormat||(this.model.timeFormat=t.preferredCulture(this.model.locale).calendars.standard.patterns.t),this._prevTimeFormat=t.isNullOrUndefined(this._options.timeFormat)||this._options.timeFormat==""?!0:!1)},_updateInput:function(){if(!t.isNullOrUndefined(this._options)){var n=this._localizeTime(this._options.value);t.isNullOrUndefined(n)||typeof n=="string"&&this.model.enableStrictMode&&!this.model.value&&(this.element.val(this._options.value),this.isValidState=this.element.val()==""?!0:!1,this._checkErrorClass())}},_createMinMaxObj:function(){this._minTimeObj=this._createObject(this.model.minTime);this._minTimeObj||(this.model.minTime=t.format(this._createObject((new Date).setHours(0,0,0,0)),this.model.timeFormat,this.model.locale));this._maxTimeObj=this._createObject(this.model.maxTime);this._maxTimeObj||(this.model.maxTime=t.format(this._createObject((new Date).setHours(23,59,59,59)),this.model.timeFormat,this.model.locale))},_setMinMax:function(){var n=(new Date).setHours(0,0,0,0),i=(new Date).setHours(23,59,59,59);!t.isNullOrUndefined(this._options)&&t.isNullOrUndefined(this._options.minTime)&&(this.model.minTime=t.format(this._createObject(n),this.model.timeFormat,this.model.locale));!t.isNullOrUndefined(this._options)&&t.isNullOrUndefined(this._options.maxTime)&&(this.model.maxTime=t.format(this._createObject(i),this.model.timeFormat,this.model.locale));this._createMinMaxObj()},_init:function(n){if(this._options=n,this._cloneElement=this.element.clone(),this._ISORegex(),this._isSupport=document.createElement("input").placeholder==i?!1:!0,!this.element.is("input")||this.element.attr("type")&&this.element.attr("type")!="text")return!1;this._initialize();this._render();this._wireEvents();n&&n.value!=i&&n.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()});this._updateInput();this._updateTextbox();this.model.validationRules!=null&&(this._initTimeValidator(),this._setTimeValidation())},_updateTextbox:function(){var t,n;if(this._options.disableTimeRanges){for(t=!0,n=0;n=this._options.disableTimeRanges[n].startTime||this.model.minTime<=this._options.disableTimeRanges[n].endTime)&&this._options.disableTimeRanges[n].startTime==this.model.minTime){t=!1;break}(this._options===i||this._options.value===i&&!this.model.value&&t)&&this._setTime(this._localizeTime(this.model.minTime))}else this._options!==i&&(this._options.value!==i||this.model.value)||this._setTime(this._localizeTime(this.model.minTime))},_setMinMaxTime:function(i,r){!t.isNullOrUndefined(r.minTime)&&n.trim(r.minTime)&&this._isValid(r.minTime)&&(this.model.minTime=r.minTime,this._minTimeObj=this._createObject(this.model.minTime),this._validateTimes());!t.isNullOrUndefined(r.maxTime)&&n.trim(r.maxTime)&&this._isValid(r.maxTime)&&(this.model.maxTime=r.maxTime,this._maxTimeObj=this._createObject(this.model.maxTime),this._validateTimes());this._validateMinMax();this._createMinMaxObj();t.isNullOrUndefined(r.minTime)||(r.minTime=this.model.minTime);t.isNullOrUndefined(r.maxTime)||(r.maxTime=this.model.maxTime);this._checkMinMax(this.model.value)||(this.model.enableStrictMode?(this.isValidState=!1,this.model.value=null):(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime)));i!==this.model.value&&this._isValid(this.model.value,!0)&&this.element.val(this.model.value)},_setModel:function(n){var r=!1,o=this.model.value,i,e,u,f,s;for(i in n){i!="height"&&i!="width"&&i!="htmlAttributes"&&i!="watermarkText"&&i!="enabled"&&i!="validationRules"&&i!="validationMessages"&&t.isNullOrUndefined(this.popupList)&&this._renderDropdown();switch(i){case"timeFormat":u=this._createObject(this.model.value);this._preTimeformat=this.model.timeFormat;e=this._timeFormat(n[i]);n[i]=this.model.timeFormat;e&&(this.seperator=this._getSeperator());f=this._createObject(this.model.value);r=+u==+f?!1:!0;break;case"locale":u=this._createObject(this.model.value);this._localize(n[i]);this.model.minTime=t.format(this._createObject(this._minTimeObj),this.model.timeFormat,this.model.locale);this.model.maxTime=t.format(this._createObject(this._maxTimeObj),this.model.timeFormat,this.model.locale);f=this._createObject(this.model.value);r=+u==+f?!1:!0;break;case"interval":this.model.interval=n[i];break;case"cssClass":this._changeSkin(n[i]);break;case"showRoundedCorner":this._setRoundedCorner(n[i]);break;case"enableRTL":this._setRtl(n[i]);break;case"height":this._setHeight(n[i]);break;case"width":this.wrapper.width(n[i]);this._setListWidth();break;case"value":t.isPlainObject(n[i])&&(n[i]=null);this.model.value=t.format(this._createObject(n[i],!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(n[i],!0)&&(s=this._isValid(n[i])?this._localizeTime(n[i]):n[i],this.element.val(s));n[i]=this.model.value;r=!0;break;case"enableStrictMode":this.model.enableStrictMode=n[i];break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=n[i];this.model.validationRules!=null&&(this._initTimeValidator(),this._setTimeValidation());break;case"validationMessages":this.model.validationMessages=n[i];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initTimeValidator(),this._setTimeValidation());break;case"popupHeight":this.model.popupHeight=n[i];this._setListHeight();break;case"popupWidth":this.model.popupWidth=n[i];this._setListWidth();break;case"enabled":n[i]?this.enable():this.disable();break;case"htmlAttributes":this._addAttr(n[i]);break;case"disableTimeRanges":this.model.disableTimeRanges=n[i];this._initStartEnd();this.model.value=t.format(this._createObject(this.element.val(),!0),this.model.timeFormat,this.model.locale);this._ensureValue();this._enableMask();this.model.enableStrictMode&&!this._isValid(this.element.val(),!0)&&this.element.val(this.element.val());r=!0;break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options[i]=this.model.watermarkText=n[i];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark()}}t.isNullOrUndefined(n.minTime)&&t.isNullOrUndefined(n.maxTime)||(this._setMinMaxTime(o,n),r=!0);t.isNullOrUndefined(n.showPopupButton)?!this.model.showPopupButton||!e&&t.isNullOrUndefined(n.minTime)&&t.isNullOrUndefined(n.maxTime)&&t.isNullOrUndefined(n.locale)&&t.isNullOrUndefined(n.interval)&&t.isNullOrUndefined(n.disableTimeRanges)||this._reRenderDropdown():this._showButton(n[i]);r&&(this._raiseChangeEvent(o,!0),n.value=this.model.value);this._checkErrorClass()},_destroy:function(){this.element.insertAfter(this.wrapper);this.wrapper.remove();this.element.removeClass("e-input").removeAttr("ondragstart draggable aria-atomic aria-live aria-readonly").val(this.element.attr("value"));this._cloneElement.attr("name")||this.element.removeAttr("name");this.popupList&&this.popupList.remove()},_initialize:function(){this.target=this.element[0];this.timeIcon=null;this._disabledItems=[];this.popupList=null;this.focused=!1;this.start=0;this.end=0;this.min=null;this.max=null;this.incomplete=!1;this.downPosition=0;this._setLocalize(this.model.locale);this.model.enableStrictMode||this._setMinMax();this._getAmPm();this.showDropdown=!1;this._activeItem=0;this.isValidState=!0;this._manualFocus=!1;this._isIE7=this._checkIE7();this._initStartEnd();this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText);t.isNullOrUndefined(this.model.value)&&this.element[0].value!=""&&(this.model.value=this.element[0].value);this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._getInternalEvents=!1;this._dateTimeInternal=!1;this.model.timeFormat?this.seperator=this._getSeperator():this._getTimeFormat()},_render:function(){this._renderWrapper();this._setDimentions();this._renderTimeIcon();this._validateTimes();this.model.enableStrictMode||this._createMinMaxObj();this._addAttr(this.model.htmlAttributes);this._checkProperties();this._enableMask();this._checkErrorClass();this.element.attr({"aria-atomic":"true","aria-live":"assertive","aria-readonly":this.model.readOnly,value:this.model.value});t.isNullOrUndefined(this.model.value)?this.wrapper.addClass("e-valid"):this.wrapper.removeClass("e-valid")},_renderWrapper:function(){if(this.element.addClass("e-input").attr({tabindex:"0",role:"combobox","aria-expanded":"false"}),this.wrapper=t.buildTag("span.e-timewidget e-widget "+this.model.cssClass+"#"+this.target.id+"_timewidget").insertAfter(this.element),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.container=t.buildTag("span.e-in-wrap e-box").append(this.element),this.wrapper.append(this.container),!this._isSupport){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"&&n=="disabled"?r.disable():u=="readOnly"&&n=="readOnly"?r.model.readOnly=!0:u=="style"?r.wrapper.attr(i,n):u=="id"?(r.wrapper.attr(i,n+"_wrapper"),r.element.attr(i,n)):t.isValidAttr(r.element[0],i)?r.element.attr(i,n):r.wrapper.attr(i,n)})},_initTimeValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setTimeValidation:function(){var r,f,i,u,e;this.element.rules("add",this.model.validationRules);r=this.element.closest("form").data("validator");r=r?r:this.element.closest("form").validate();f=this.element.attr("name");r.settings.messages[f]={};for(i in this.model.validationRules)if(u=null,!t.isNullOrUndefined(this.model.validationRules[i])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[i])){r.settings.messages[f][i]=n.validator.messages[i];for(e in this.model.validationMessages)i==e?u=this.model.validationMessages[i]:""}else u=this.model.validationRules.messages[i];r.settings.messages[f][i]=u!=null?u:n.validator.messages[i]}},_renderTimeIcon:function(){if(this.model.showPopupButton){this.timeIcon=t.buildTag("span.e-select").attr({role:"button","aria-label":"select"});var n=t.buildTag("span.e-icon e-clock").attr("role","presentation");this._isIE8&&(this.timeIcon.attr("unselectable","on"),n.attr("unselectable","on"));this.timeIcon.append(n);this.container.append(this.timeIcon).addClass("e-padding");this._on(this.timeIcon,"mousedown",this._timeIconClick)}},_elementClick:function(){this.showDropdown||this.model.enableStrictMode||this._showResult()},_renderDropdown:function(){var i=n("#"+this.element[0].id+"_popup").get(0),r;if(i&&n(i).remove(),this.popupList)return!1;this.popupList=t.buildTag("div.e-time-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.target.id+"_popup","",{},{tabindex:0,role:"listbox"});t.isTouchDevice()||this.popupList.addClass("e-ntouch");this.popup=this.popupList;this.ul=t.buildTag("ul.e-ul");this._isIE8&&this.ul.attr("unselectable","on");r=t.buildTag("div").append(this.ul);n("body").append(this.popupList.append(r));this._renderLiTags();this._setListHeight();this._setListWidth();this.popupList.ejScroller({height:this.popupList.height(),width:0,scrollerSize:20});this.scrollerObj=this.popupList.ejScroller("instance");this.popupList.css("display","none");this._listSize=this.ul.find("li").length},_renderLiTags:function(){var r,o,f,s,h,e,i,u;for(this._disabledItems=[],s=this.model.interval*6e4,h=!t.isNullOrUndefined(this.model.disableTimeRanges)&&this.model.disableTimeRanges.length>0?!0:!1,r=this._minTimeObj,o=this._maxTimeObj,e=0;this._compareTime(o,r,!0);)f=this._localizeTime(r),i=n(document.createElement("li")),i[0].appendChild(document.createTextNode(f)),this._isIE8&&i.attr("unselectable","on"),h&&(this._ensureTimeRange(f)?(i.addClass("e-disable"),this._disabledItems.push(e)):i.removeClass("e-disable")),this.ul[0].appendChild(i[0]),r=new Date(r).getTime()+s,e++;u=this.ul.find("li");t.isTouchDevice()||(this._on(u,"mouseenter",n.proxy(this._OnMouseEnter,this)),this._on(u,"mouseleave",n.proxy(this._OnMouseLeave,this)));this._on(u,"click",n.proxy(this._OnMouseClick,this));(this.model.showPopupButton||!t.isNullOrUndefined(this.popupList))&&this.ul.find("li").attr({tabindex:-1,"aria-selected":!1,role:"option"})},_ensureTimeRange:function(n){var r,i;if(!t.isNullOrUndefined(this.model.disableTimeRanges))for(r=this._makeDateTimeObj(n),i=0;i=+this._makeDateTimeObj(this.model.disableTimeRanges[i].startTime)&&+r<=+this._makeDateTimeObj(this.model.disableTimeRanges[i].endTime))return!0;return!1},_initStartEnd:function(){if(this._startTime=[],this._endTime=[],!t.isNullOrUndefined(this.model.disableTimeRanges))for(var n=0;n0?n:"auto"&&(this.model.popupWidth="auto"):n>0?n:"auto"&&(this.model.popupWidth="auto");t&&t!="auto"?this.popupList.css({width:t}):this.popupList.css({width:this.wrapper.width()})}this.scrollerObj&&(this._refreshScroller(),this._updateScrollTop())},_setListHeight:function(){this.popupList&&this.popupList.css({"max-height":this.model.popupHeight||"191px"});this.scrollerObj&&(this._refreshScroller(),this._updateScrollTop())},_updateScrollTop:function(){this.scrollerObj.setModel({scrollTop:this._calcScrollTop()})},_refreshPopup:function(){this.model.popupWidth=="auto"&&this.popupList.css({width:this.wrapper.width()});this._setListPosition();this._refreshScroller()},_setListPosition:function(){var t=this.wrapper,i=this._getOffset(t),f,h=n(document).scrollTop()+n(window).height()-(i.top+n(t).outerHeight()),c=i.top-n(document).scrollTop(),u=this.popupList.outerHeight(),e=this.popupList.outerWidth(),r=i.left,o=t.outerHeight(),l=(o-t.height())/2,a=this._getZindexPartial(),s=3,v=(uc?i.top+o+s:i.top-u-s)-l;f=n(document).scrollLeft()+n(window).width()-r;(this.model.enableRTL||e>f&&e=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){var t=n.toLowerCase();return t=="t"||t=="z"||t==":"||t=="-"?!0:!1},_setMask:function(){this.model.value=new Date;this._enableMask()},_validateTimes:function(){var n=this._validateTimeFormat(this.model.timeFormat);this.model.timeFormat=n?n:"h:mm tt";this._isValid(this.model.minTime)||(this.model.minTime="12:00 AM");this._isValid(this.model.maxTime)||(this.model.maxTime="11:59 PM");this._isValid(this.model.value,!0)||(this.model.value=null);this._checkMinMax(this.model.value)||this.model.enableStrictMode||(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime));this._validateMinMax()},_ensureValue:function(){!this._checkMinMax(this.model.value)&&this._isValid(this.model.value,!0)&&(this.model.enableStrictMode?this.isValidState=!1:(this.model.minTime&&!this._compareTime(this.model.value,this.model.minTime,!0)&&(this.model.value=this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this.model.value,!0)&&(this.model.value=this.model.maxTime)))},_validateMinMax:function(){this.model.minTime&&this.model.maxTime&&this._compareTime(this.model.minTime,this.model.maxTime)&&(this.model.minTime=this.model.maxTime)},_checkProperties:function(){this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable());this._addProperty();this._checkAttributes()},_addProperty:function(){this._setRtl(this.model.enableRTL);this._setRoundedCorner(this.model.showRoundedCorner)},_setRtl:function(n){n?(this.wrapper.addClass("e-rtl"),this.popupList&&this.popupList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popupList&&this.popupList.removeClass("e-rtl"))},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popupList&&this.popupList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popupList&&this.popupList.removeClass("e-corner"))},_showButton:function(t){this.model.showPopupButton=t;t?(this.container.addClass("e-padding"),this._renderTimeIcon(),this._renderDropdown(),this._addProperty()):(this.container.removeClass("e-padding"),this.timeIcon.remove(),this.popupList.remove(),this.timeIcon=this.popupList=null,n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)))},_checkAttributes:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id});"ondragstart"in document.createElement("input")&&this.element.attr({ondragstart:"return false"});"draggable"in document.createElement("input")&&this.element.attr({draggable:"false"})},_getAmPm:function(){var t=new Date;t.setHours(0);this.ttAM=n.trim(this._localizeMeridian(t));t.setHours(23);this.ttPM=n.trim(this._localizeMeridian(t))},_setDimentions:function(){this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this._setHeight(this.model.height);this.model.width&&this.wrapper.width(this.model.width)},_setHeight:function(n){n&&this.wrapper.height(n);this._isIE7&&this.element.height(this.container.height())},_validateTimeFormat:function(t){var i=t.split(" "),r="";return i.length==1||i.length==2?(n(i).each(function(t,i){r+=n.trim(i)+" "}),n.trim(r)):null},_getSeperator:function(){for(var i=this._getElePlace(),t=this._formatparts[i.time],r=new RegExp("^[a-zA-Z0-9]+$"),n=0;n-1&&this.element.val("");!this._checkMinMax(this.target.value)&&this._isValid(this.target.value,!0)?this.model.enableStrictMode?this.isValidState=!1:(this.model.minTime&&!this._compareTime(this._createObject(this.target.value),this.model.minTime,!0)&&this.element.val(this.model.minTime),this.model.maxTime&&!this._compareTime(this.model.maxTime,this._createObject(this.target.value),!0)&&this.element.val(this.model.maxTime),this._isValid(this.model.value,!0)||this.element.val(null),this.isValidState=!0,t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")):this.isValidState=!0;this._ensureValue();this._raiseChangeEvent();this._checkErrorClass();this._raiseEvent("focusOut");this.model.enableStrictMode||this._checkInComplete();t.isNullOrUndefined(this.model.value)?this.wrapper.removeClass("e-valid"):this.wrapper.addClass("e-valid")},_clearRange:function(){var n=this.element[0];isNaN(n.selectionStart)||(n.selectionStart=0,n.selectionEnd=0)},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error").attr("aria-invalid","false"):this.wrapper.addClass("e-error").attr("aria-invalid","true")},_getExactPostions:function(){var t=this.model.timeFormat,r=this.model.timeFormat.split(" "),n;this._formatparts=[];this._valueparts=[];this._amPMPosition=t.match("([t][t]+)")?t.match("([t][t]+)").index:null;this._amPMPosition==i?(this._formatparts=this.model.timeFormat.split(" "),this._valueparts=this.element.val().split(" "),this._noTT=!0):(this._amPMPosition==this.model.timeFormat.length-2?(this._ttAtEnd=!0,this._isSpace=this.model.timeFormat[this.model.timeFormat.split("").indexOf("t")-1]==" "):(this._ttAtEnd=!1,this._isSpace=this.model.timeFormat[this.model.timeFormat.split("").indexOf("t")+2]==" "),this._ttAtEnd==!0?(this._ttStartPostion=this.model.timeFormat.match("([t]?[t]+)").index,this._ttEndPosition=this.model.timeFormat.length,this._formatStartPosition=0,n=0,this.element&&this.element.val()&&(n=this.element.val().length-this.model.timeFormat.length),this._updatedttStartPosition=this._ttStartPostion+n,this._formatEndPostion=this.model.timeFormat.match("([t][t]+)").index,this._formatparts[0]=this.model.timeFormat.substr(this._formatStartPosition,this._formatEndPostion).trim(),this._formatparts[1]=this.model.timeFormat.substr(this._ttStartPostion,this._ttEndPosition).trim(),this._valueparts[0]=this.element.val().substr(this._formatStartPosition,this._formatEndPostion+n).trim(),this._valueparts[1]=this.element.val().substr(this._ttStartPostion+n,this._ttEndPosition).trim()):(this._ttStartPostion=0,this._ttEndPosition=this.model.timeFormat.match("([t]?[t]+)")?this._ttStartPostion+this.model.timeFormat.match("([t]?[t]+)")[0].length:0,this._formatStartPosition=this._isSpace?this._ttEndPosition+1:this._ttEndPosition,this._formatEndPostion=this.model.timeFormat.length,this._formatparts[1]=this.model.timeFormat.substr(this._formatStartPosition,this._formatEndPostion).trim(),this._formatparts[0]=this.model.timeFormat.substr(this._ttStartPostion,this._ttEndPosition).trim(),this._valueparts[1]=this.element.val().substr(this._formatStartPosition,this._formatEndPostion).trim(),this._valueparts[0]=this.element.val().substr(this._ttStartPostion,this._ttEndPosition).trim()))},_getCaretSelection:function(){var n=this.element[0],u=0,f=0,e,t,i,r,o;return isNaN(n.selectionStart)?(e=document.selection.createRange().getBookmark(),t=n.createTextRange(),t.moveToBookmark(e),i=n.createTextRange(),i.collapse(!0),i.setEndPoint("EndToStart",t),r=i.text.length,o=t.text.length,{start:r,end:r+o}):(u=n.selectionStart,f=n.selectionEnd,{start:Math.abs(u),end:Math.abs(f)})},_mouseDownOnInput:function(){this.focused||t.isTouchDevice()||this._focusElement();this._getExactPostions();this.downPosition=this._getCaretSelection();n(document).on("mouseup",n.proxy(this._mouseUpOnInput,this))},_mouseUpOnInput:function(t){t.preventDefault();n(document).off("mouseup",n.proxy(this._mouseUpOnInput,this));var i=this._getCaretSelection();this.incomplete&&(this.incomplete=!1,i=this.downPosition);this.target.value!=this._getSelectedText()&&(i=this._getStartEnd(i),this._setSelection(i.start,i.end))},_getCategoryPosition:function(n){var t=0,i=0,u=this._getTimeParts(),r=this._getElePlace(),h=this.seperator,e=!1,o=this._getFormatParts()[r.time].split(h),c=u[r.time].split(h),s,f;if(o.length>c.length)return{start:t,end:i,isValid:e};if(n=="tt")(u[r.tt]==this.ttAM||u[r.tt]==this.ttPM)&&(t=r.tt==0?0:u[r.time].length+1,i=t+u[r.tt].length,!this._isSpace&&this._ttAtEnd&&(t=t-1,i=i-1),e=!0);else if(t=r.time==0?0:u[r.tt].length+1,s=o.indexOf(n),s!=-1){for(f=0;f=this._updatedttStartPosition&&n.end<=this._ttEndPosition&&this._formatparts[0].split(this._getSeperator())[1].length==this._valueparts[0].split(this._getSeperator())[1].length){t+=s[f].length+1;continue}if(n.start<=u){o=f;e=!1;i=r.length;break}else t+=s[f].length+1}}else{if(!this._isSpace&&!this._ttAtEnd?n.start9&&r<13||i=="H"&&r>9&&r<24||i=="H"&&r<9&&t.start==2&&t.end==2||i=="mm"&&this._poschange==!0&&t.start==4&&t.end==4||i=="ss"&&t.start==8&&t.end==8||i=="ss"&&this._poschange==!0&&t.start==7&&t.end==7||i=="mm"&&t.start==5&&t.end==5?i=="mm"&&(this.model.timeFormat=="HH:mm"||this.model.timeFormat=="hh:mm"||this.model.timeFormat=="H:mm"||this.model.timeFormat=="h:mm")||i=="ss"&&(this.model.timeFormat=="HH:mm:ss"||this.model.timeFormat=="hh:mm:ss"||this.model.timeFormat=="H:mm:ss"||this.model.timeFormat=="h:mm:ss")||this._movePosition(t,null):(i=="hh"||i=="HH")&&t.start&&t.end==2&&r<24&&this._movePosition(t,null)},_getNextCategory:function(t,i){var r=[],e=this.seperator,o=this._getFormatParts(),u,f;return(n(o).each(function(n,t){if(t=="tt")r.push(t);else{var i=t.split(e);r=i.concat(r)}}),u=r.indexOf(t),u!=-1)?(f=i?u==0?r.length-1:u-1:u==r.length-1?0:u+1,r[f]):t},_getElePlace:function(){this._getExactPostions();var i=this._getFormatParts(),n,t;return i[0]=="tt"?(n=1,t=0):(n=0,t=1),{time:n,tt:t}},_movePosition:function(n,t){var i=this._getStartEnd(n),r=this._getCategory(i),u;r||(r=this._getLeast(t));u=this._getNextCategory(r,t);i=this._getCategoryPosition(u);i.isValid&&this._setSelection(i.start,i.end)},_findActiveIndex:function(){var t=this.ul.find("li"),i=this.element.val(),r=t.first().html(),n;n=(this._parse(i)-this._parse(r))/(this.model.interval*6e4);n=Math.round(n);this._activeItem=n==t.length?n:n+1;(this._activeItem<0||this._activeItem>t.length||isNaN(this._activeItem))&&(this._activeItem=0)},_keyDownOnInput:function(n){var t,u,i,y,f,d,c,g,l,o,p,w,nt,a,s,tt,v,b,e,k,h,r;if(this.model.readOnly&&!this._readOnlyKeys(n)||(i=n.keyCode,this._getInternalEvents&&i!=38&&i!=40&&i!=36&&i!=35&&i!=9))return!1;if(!this.model.enableStrictMode){if(this.showDropdown&&i!=38&&i!=40&&i!=27&&!this._readOnlyKeys(n))return!1;this.showDropdown&&(i==37||i==39)&&(n.keyCode=i==37?38:40)}t=this._getCaretSelection();r=this._getStartEnd(t);u=this._getCategory(r);switch(n.keyCode){case 38:n.preventDefault();this.showDropdown?this.showDropdown&&(n.preventDefault(),this._findActiveIndex(),f=this._activeItem,this._activeItem=this._disableItemSelectUp(this._activeItem-1),this._activeItem==0&&(this._activeItem=f),this._addListHover(),y=this._getActiveItem(),y.length&&this._selectTimeItem(y)):this._isValid(this.target.value)&&this._modifyValue(!0);break;case 40:n.preventDefault();n.altKey&&this.model.showPopupButton?this._showhidePopup():this.showDropdown?this.showDropdown&&(n.preventDefault(),this._findActiveIndex(),f=this._activeItem,this._activeItem=this._disableItemSelectDown(this._activeItem),this._activeItem0?o=!0:!n.shiftKey&&t.end47&&n.keyCode<58?e=String.fromCharCode(b):n.keyCode>95&&n.keyCode<106&&(e=String.fromCharCode(b-48));u=="tt"&&(!n.shiftKey&&!n.ctrlKey&&!n.altKey&&n.keyCode>64&&n.keyCode<91||n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106)&&(n.preventDefault(),k=this._getCategoryPosition(u),this.start=k.start,this.end=k.end,this._changeAmPm(v),this._raiseChangeEvent());this.target.value!=this._getSelectedText()||n.shiftKey||n.ctrlKey||n.altKey||(n.keyCode>64&&n.keyCode<91&&!this.model.enableStrictMode&&n.preventDefault(),(n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106)&&(r=this._getStartEnd(t),this._setSelection(r.start,r.end)));!n.shiftKey&&!n.ctrlKey&&!n.altKey&&n.keyCode>47&&n.keyCode<58||n.keyCode>95&&n.keyCode<106?u!="tt"&&(this._getMinMax(u,!0),t.start==t.end?(this._findCategoryPosition(u),t.start==this.start?(h=e+v,this.model.enableStrictMode==!1&&(this._validateTimes(),this._targetBlur()),this.model.value==null&&this.element.val(this.model.minTime),r=this._getStartEnd(t),this._setSelection(r.start,r.end)):h=v+e,(h.length>2||!(Number(h)>=this.min&&this.max>=Number(h)))&&(this.model.enableStrictMode||n.preventDefault())):Number(e)>=this.min&&this.max>=Number(e)||this.model.enableStrictMode||n.preventDefault()):this._allowKeyCodes(n)||(this.model.enableStrictMode?n.stopPropagation():n.keyCode==8||n.keyCode==46?n.stopPropagation():n.preventDefault())},_getSelectedText:function(){if(window.getSelection){var t=n("#"+this.element[0].id).get(0);return t.value.substring(t.selectionStart,t.selectionEnd)}return document.selection.createRange().text},_allowKeyCodes:function(n){return n.ctrlKey&&(n.keyCode==65||n.keyCode==67||n.keyCode==90||n.keyCode==89)||n.keyCode==9||n.keyCode==116||n.keyCode==13?!0:!1},_readOnlyKeys:function(n){return n.keyCode==35||n.keyCode==36||n.keyCode==37||n.keyCode==39||this._allowKeyCodes(n)?!0:!1},_firstlastVal:function(n){var t=this._getFormatParts(),r=this.seperator,i;return n?t[0]!="tt"?t[0].split(r)[0]:"tt":t[0]!="tt"?"tt":t[1]?(i=t[1].split(r),i.length?i[i.length-1]:"tt"):"tt"},_mouseWheel:function(n){if(n.preventDefault(),this.model.readOnly)return!1;var t,i=n.originalEvent;i.wheelDelta?t=i.wheelDelta/120:i.detail&&(t=-i.detail/3);t>0?this._modifyValue(!0):t<0&&this._modifyValue(!1)},_addListHover:function(){this._addSelected();this._updateScrollTop()},_addSelected:function(){this.ul.find("li").removeClass("e-active e-hover");var n=this._getActiveItem();n.length&&!n.hasClass("e-disable")&&n.addClass("e-active")},_disableItemSelectDown:function(t){return(t==null||t<0)&&(t=0),t0)return this._disableItemSelectUp(t)}return 0},_getActiveItem:function(){return n(this.ul.find("li")[this._activeItem-1])},_timeIconClick:function(n){var i,r;if(t.isNullOrUndefined(this.popupList)&&(this._renderDropdown(),this._addProperty()),i=!1,n.button?i=n.button==2:n.which&&(i=n.which==3),!i){if(n.preventDefault(),!this.model.enabled||this.model.readOnly||this.ul.find("li").length<1)return!1;this._showhidePopup();r=this.element.val().length;t.isTouchDevice()||this._setSelection(r,r)}},_showhidePopup:function(){if(this._getInternalEvents)return!1;this.showDropdown?this._hideResult():this._showResult()},_showResult:function(){if(this.popupList==null&&this._renderDropdown(),this._raiseEvent("beforeOpen"))return!1;this.focused||t.isTouchDevice()||this._focusElement();this.model.value?this._changeActiveEle():this.ul.find("li").removeClass("e-active");var i=this,r=this._visibleAndCalculateTop();this.popupList.slideDown(this.model.enableAnimation?200:0,function(){n(document).on("mousedown",n.proxy(i._OnDocumentClick,i))});this.scrollerObj.setModel({scrollTop:r});this.showDropdown=!0;this._listSize=this.ul.find("li").length;n(window).on("resize",n.proxy(this._OnWindowResize,this));this._on(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._on(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult);this._raiseEvent("open");this.wrapper.addClass("e-active")},_hideResult:function(i){if(this._raiseEvent("beforeClose"))return!1;i&&(i.type=="touchmove"||i.type=="scroll")&&n(i.target).parents("#"+this.popupList[0].id).length>0||this.showDropdown&&!this._getInternalEvents&&(this.showDropdown=!1,this.popupList.slideUp(this.model.enableAnimation?100:0),n(document).off("mousedown",n.proxy(this._OnDocumentClick,this)),n(window).off("resize",n.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this._off(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult),this._raiseEvent("close"),this.wrapper.removeClass("e-active"))},_visibleAndCalculateTop:function(){this.popupList.css({display:"block"});var n=this._calcScrollTop();return this._refreshPopup(),this.popupList.css({display:"none"}),n},_calcScrollTop:function(){var i=this.ul.outerHeight(),n=this.ul.find("li").outerHeight(),t;return t=this.ul.find("li.e-active").index(),n*t-(this.popupList.outerHeight()-n)/2},_changeActiveEle:function(){if(!this.popupList)return!1;var t=this.ul.find("li"),i=this.element.val(),r=t.first().html(),n;n=(this._parse(i)-this._parse(r))/(this.model.interval*6e4);n=Math.round(n);this._activeItem=n==t.length?n:n+1;(this._activeItem<0||this._activeItem>t.length||isNaN(this._activeItem)||this._ensureTimeRange(i))&&(this._activeItem=0);this._addListHover()},_OnDocumentClick:function(t){n(t.target).is(this.popupList)||n(t.target).parents(".e-time-popup").is(this.popupList)||n(t.target).is(this.wrapper)||n(t.target).parents(".e-timewidget").is(this.wrapper)?(n(t.target).is(this.popupList)||n(t.target).parents(".e-time-popup").is(this.popupList))&&t.preventDefault():this._hideResult()},_OnWindowResize:function(){this._refreshPopup()},_OnMouseEnter:function(t){var i=t.target;this.ul.find("li").removeClass("e-hover");n(i).hasClass("e-disable")||n(i).addClass("e-hover")},_OnMouseLeave:function(){(!this._dateTimeInternal||this.model.value)&&this.ul.find("li").removeClass("e-hover")},_OnMouseClick:function(t){(t.preventDefault(),n(t.target).hasClass("e-disable"))||(this.model.enabled&&!this.model.readOnly&&(this._activeItem=n(t.target).index()+1,this.ul.find("li").attr({tabindex:-1,"aria-selected":!1}),n(t.target).attr({"aria-selected":!0,tabindex:0}),this._addSelected(),this._selectTimeItem(n(t.target))),this._showhidePopup())},_selectTimeItem:function(n){this._beforeChange(n);var t=this._raiseChangeEvent();t&&this._trigger("select",{value:this.model.value,prevTime:this._previousValue})},_findCategoryPosition:function(n){n=="least"&&(n=this._getLeast(!0));var t=this._getCategoryPosition(n);this.start=t.start;this.end=t.end},_getLeast:function(t){var r=this._getFormatParts(),u=this.seperator,i=null;return n(r).each(function(n,r){if(r!="tt"){var f=r.split(u);i=t?f[f.length-1]:f[0]}}),i},_changeValue:function(n,i){var l=this.target.value,r,u=this._getCategory(n),f,o;if(!u)return!1;if(this._setSelection(this.start,this.end),r=this.target.value.substring(this.start,this.end),this._checkMinMax(this.target.value))if(r!=this.ttAM&&r!=this.ttPM){if(r=this._changeCurrentValue(r,u,i),u.length!=1&&(r=this._changeWhole(r)),this._findCategoryPosition(u),this.element.val(this._replaceAt(this.target.value,this.start,this.end,r)),this.end=this.start+r.toString().length,this._setSelection(this.start,this.end),this._ensureTimeRange(this.target.value)&&this._checkMinMax(this.target.value)){var e=this._createObject(this.target.value),s=e.getHours(),h=i?this._startTime:this._endTime,c=i?this._endTime:this._startTime;if(!t.isNullOrUndefined(this.model.disableTimeRanges))for(f=0;f=+this._startTime[f]&&+e<=+this._endTime[f])&&(this.target.value=this._localizeTime(c[f]),this._findCategoryPosition(u),this._setSelection(this.start,this.end),this._changeValue(n,i))}}else this._changeAmPm(r);else o=this._checkExceedRange(this.target.value),this._setTime(this.model[o]),this._findCategoryPosition(u),this._setSelection(this.start,this.end);this._checkMinMax(this.target.value)?this._raiseChangeEvent():(this.element.val(this.model.value),this._findCategoryPosition(u),this._setSelection(this.start,this.end))},_checkMinMax:function(n){var t=this._checkExceedRange(n);return t==null&&(t=!1),!t},_checkExceedRange:function(n){if(n){if(this.model.minTime&&!this._compareTime(n,this.model.minTime,!0))return"minTime";if(this.model.maxTime&&!this._compareTime(this.model.maxTime,n,!0))return"maxTime"}return null},_changeWhole:function(n){return n>9?""+n:"0"+n},_changeAmPm:function(n){n=n==this.ttAM?this.ttPM:this.ttAM;this.element.val(this._replaceAt(this.target.value,this.start,this.end,n));this._setSelection(this.start,this.end)},_changeMinute:function(n){var i=this._getExactFormat(["mm","m"]),t;i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),n?t==this.max?(t=this.min,this._changeHour(n)):t+=1:t==this.min?(t=this.max,this._changeHour(n)):t-=1,this._findCategoryPosition(i),i.length!=1&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_changeHour:function(n){var i=this._getExactFormat(["hh","h","HH","H"]),t;i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),n?t==this.max?(t+=1,this._changeMeridian()):t>this.max?t=this.min:t+=1:t==this.min?t=this.max+1:t>this.max?(t=this.max,this._changeMeridian()):t-=1,this._findCategoryPosition(i),i.length!=1&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_getExactFormat:function(n){for(var i=this.model.timeFormat,t=0;tthis.max?n=this.min-1+u:nthis.max+1&&(n=n-(this.max+1),f&&this._changeAdjacent(r,i)),r!="hh"&&r!="h"&&n==this.max+1&&(n=this.min,f&&this._changeAdjacent(r,i))):(r!="hh"&&r!="h"&&n>this.min?n-=u:(r=="hh"||r=="h")&&n>this.min&&n<=this.max?n-=u:(r=="hh"||r=="h")&&n==this.min?n=this.max+2-u:(f=!1,n=this.max+1-u,this._changeAdjacent(r,i)),n=7&&n<8)return!0}return!1},_replaceAt:function(n,t,i,r){return n.substring(0,t)+r+n.substring(i)},_localizeTime:function(i){return i?n.trim(t.format(this._createObject(i),this.model.timeFormat,this.model.locale)):null},_localizeMeridian:function(i){return n.trim(t.format(i,"tt",this.model.locale))},_compareTime:function(n,t,i){return i=i?!0:!1,i?this._parse(n)>=this._parse(t):this._parse(n)>this._parse(t)},_isValid:function(n,t){return n=this._createObject(n,t),n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_parse:function(n){return Date.parse(this._createObject(n))},_setEmptyDate:function(n){var t=new Date(n);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_createObject:function(n,i){var r=null,f,e;if(typeof n=="string"){var o=this._setModelOption?this._preTimeformat:this.model.timeFormat,u=t.preferredCulture(this.model.locale).calendar.patterns.d,s=t.format(new Date("1/1/2000"),u,this.model.locale);r=t.parseDate(s+" "+n,u+" "+o,this.model.locale);(this._extISORegex.exec(n)||this._basicISORegex.exec(n))&&(this.model.value=r=this._timeFromISO(n));this._setModelOption=!1;r||(f=new Date(n),r=isNaN(Date.parse(f))||t.isNullOrUndefined(n)?!this._dateTimeInternal||n==""?null:new Date("1/1/2000 "+n):this._setEmptyDate(n))}else typeof n=="number"?r=new Date(n):n instanceof Date&&(r=this._setEmptyDate(n));return r&&!this._dateTimeInternal&&i&&(e=this._localizeTime(r),this._ensureTimeRange(e)&&(r=null)),r},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_wireEvents:function(){this._on(this.element,"focus",this._targetFocus);this._on(this.element,"blur",this._targetBlur);this._on(this.element,"mousedown",this._mouseDownOnInput);this._on(this.element,"keydown",this._keyDownOnInput);this._on(this.element,"keyup",this._keyUpOnInput)}});t.TimePicker.Locale=t.TimePicker.Locale||{};t.TimePicker.Locale["default"]=t.TimePicker.Locale["en-US"]={watermarkText:"select a time"}}(jQuery,Syncfusion),function(n,t,i){t.widget("ejDateTimePicker","ej.DateTimePicker",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,_rootCSS:"e-datetimepicker",type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},_requiresID:!0,defaults:{cssClass:"",locale:"en-US",readOnly:!1,showRoundedCorner:!1,enableRTL:!1,htmlAttributes:{},allowEdit:!0,enabled:!0,value:"",name:null,minDateTime:new Date("1/1/1900 12:00:00 AM"),maxDateTime:new Date("12/31/2099 11:59:59 PM"),height:"",width:"",dateTimeFormat:"",showPopupButton:!0,enableStrictMode:!1,buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"},watermarkText:"Select datetime",enablePersistence:!1,interval:30,timeDisplayFormat:"",timePopupWidth:105,popupPosition:"bottom",dayHeaderFormat:"short",startLevel:"month",depthLevel:"",startDay:-1,stepMonths:1,showOtherMonths:!0,specialDates:null,highlightWeekend:!1,enableAnimation:!0,headerFormat:"MMMM yyyy",validationRules:null,validationMessage:null,validationMessages:null,timeDrillDown:{enabled:!1,interval:5,showMeridian:!1,autoClose:!0,showFooter:!0},beforeOpen:null,beforeClose:null,open:null,close:null,change:null,create:null,destroy:null,focusIn:null,focusOut:null,disableDateTimeRanges:null,timeZone:!0,disableTimeRanges:null},dataTypes:{allowEdit:"boolean",cssClass:"string",locale:"string",readOnly:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",enabled:"boolean",enableAnimation:"boolean",dateTimeFormat:"string",showPopupButton:"boolean",buttonText:"data",watermarkText:"string",enablePersistence:"boolean",enableStrictMode:"boolean",interval:"number",timeDrillDown:"data",timeDisplayFormat:"string",dayHeaderFormat:"string",startLevel:"string",depthLevel:"string",startDay:"number",stepMonths:"number",showOtherMonths:"boolean",highlightWeekend:"boolean",specialDates:"data",headerFormat:"string",validationRules:"data",validationMessage:"data",validationMessages:"data",htmlAttributes:"data",disableDateTimeRanges:"data",disableTimeRanges:"data"},_setModel:function(i){var r,e=!1,o,u,s,f;for(r in i){r!="allowEdit"&&r!="readOnly"&&r!="enabled"&&r!="validationRules"&&r!="validationMessages"&&r!="enableStrictMode"&&r!="height"&&r!="width"&&r!="showPopupButton"&&r!="dateTimeFormat"&&r!="watermarkText"&&r!="htmlAttributes"&&(this.popup||this._renderDropdown());switch(r){case"allowEdit":this._changeEditable(i[r]);break;case"cssClass":this._changeSkin(i[r]);break;case"locale":this._localize(i[r]);break;case"readOnly":this._readOnly(i[r]);break;case"showRoundedCorner":this._setRoundedCorner(i[r]);break;case"enableRTL":this._setRtl(i[r]);break;case"enabled":this._enabled(i[r]);break;case"validationRules":this.model.validationRules!=null&&(this.element.rules("remove"),this.model.validationMessages=null);this.model.validationRules=i[r];this.model.validationRules!=null&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"validationMessages":this.model.validationMessages=i[r];this.model.validationRules!=null&&this.model.validationMessages!=null&&(this._initValidator(),this._setValidation());break;case"value":i[r]=this._setValue(i[r]);this._specificFormat()&&(this._stopRefresh=!0);e=!0;this._prevDateTime=this._prevDateTimeVal||this._preVal;break;case"enableStrictMode":this.model.enableStrictMode=i[r];e=!0;break;case"minDateTime":u=this._stringToObject(i[r]);o=this._getFormat(u,this.timePicker.model.timeFormat);this._isValidDate(u)?(this.datePicker.option("minDate",u),this.datePicker.model.value&&this.datePicker.model.value.toDateString()==this.datePicker.model.minDate.toDateString()&&this.timePicker.option("minTime",o),i[r]=u,this.model.minDateTime=u):i[r]=this.model[r];e=!0;break;case"maxDateTime":u=this._stringToObject(i[r]);s=this._getFormat(i[r],this.timePicker.model.timeFormat);this._isValidDate(u)?(this.datePicker.option("maxDate",u),this.datePicker.model.value&&this.datePicker.model.value.toDateString()==this.datePicker.model.maxDate.toDateString()&&this.timePicker.option("maxTime",s),i[r]=u,this.model.maxDateTime=u):i[r]=this.model[r];e=!0;break;case"height":this.wrapper.height(i[r]);break;case"width":this.wrapper.width(i[r]);break;case"dateTimeFormat":this.model.dateTimeFormat=i[r];this.isValidState&&this._setValue(this.model.value);break;case"showPopupButton":this._showButton(i[r]);break;case"watermarkText":t.isNullOrUndefined(this._options)&&(this._options={});this._options[r]=this.model.watermarkText=i[r];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"buttonText":t.isNullOrUndefined(this._options)||(this._options.buttonText=this.model.buttonText=i[r]);this._localizedLabels.buttonText=this.model.buttonText;this._buttonText(i[r]);break;case"interval":this._updateTimeHeight();this.timePicker.option("interval",i[r]);break;case"timeDisplayFormat":this._updateTimeHeight();this.timePicker.option("timeFormat",i[r]);break;case"disableDateTimeRanges":this._disabledDate&&(this._disabledDates=!1);this.model.disableDateTimeRanges=i[r];this._setValue(this.model.value);break;case"disableTimeRanges":this.model.disableTimeRanges=i[r];this.timePicker.option("disableTimeRanges",this.model.disableTimeRanges);break;case"timePopupWidth":this._updateTimeHeight();f=i[r];i[r]=typeof f=="string"&&f.indexOf("%")!=-1||typeof f=="string"?parseInt(f)>0?f:105:f>0?f:105;this.timePicker.option("popupWidth",i[r]);break;case"dayHeaderFormat":this.datePicker.option("dayHeaderFormat",i[r]);break;case"startLevel":this.datePicker.option("startLevel",i[r]);break;case"depthLevel":this.datePicker.option("depthLevel",i[r]);break;case"startDay":this.datePicker.option("startDay",i[r]);this.model.startDay=this.datePicker.model.startDay;i[r]=this.model.startDay;break;case"stepMonths":this.datePicker.option("stepMonths",i[r]);break;case"showOtherMonths":this.datePicker.option("showOtherMonths",i[r]);break;case"highlightWeekend":this.datePicker.option("highlightWeekend",i[r]);break;case"specialDates":this.datePicker.option("specialDates",i[r]);this.model.specialDates=this.datePicker.model.specialDates;break;case"headerFormat":this.datePicker.option("headerFormat",i[r]);break;case"htmlAttributes":this._addAttr(i[r]);break;case"popupPosition":this.model.popupPosition=i[r];this._setListPosition();break;case"timeDrillDown":t.isNullOrUndefined(i[r].enabled)||(this.model.timeDrillDown.enabled=i[r].enabled,this._changeDesign());t.isNullOrUndefined(i[r].interval)||(this.model.timeDrillDown.interval=i[r].interval,this._generateMins(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale))));t.isNullOrUndefined(i[r].showMeridian)||(this.model.timeDrillDown.showMeridian=i[r].showMeridian,this._sfTimeHour.empty(),this._renderHourTable());t.isNullOrUndefined(i[r].showFooter)||(this.model.timeDrillDown.showFooter=i[r].showFooter,this._changeDesign())}}e&&this._validateMinMax();this._valueChange(!0);r=="value"&&(i[r]=this.model.value);this.popup&&this._updateTimeHeight();this._checkErrorClass()},observables:["value"],_destroy:function(){this.isPopupOpen&&this._hideResult();this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove());this.element.removeClass("e-js e-input").removeClass(t.util.getNameSpace(this.sfType));this.element.removeAttr(" type aria-atomic aria-live tabindex aria-expanded aria-disabled placeholder role");this._cloneElement[0].hasAttribute("name")||this.element.removeAttr("name");t.isNullOrUndefined(this.datePicker)||this.datePicker.destroy();t.isNullOrUndefined(this.timePicker)||this.timePicker.destroy();this.popup&&this.popup.remove()},_initDisableTimeRanges:function(n){for(var e,o,h,c,f,u,r,s=this._getDateObj(n,this.datePicker.model.dateFormat),i=0;i=new Date(this.model.disableDateTimeRanges[n].startDateTime).getTime()&&new Date(this.model.value).getTime()<=new Date(this.model.disableDateTimeRanges[n].endDateTime).getTime()&&(this.model.value=null),this.model.value==null&&t!=null&&this.model.enableStrictMode&&(this.isValidState=!1),this.isValidState&&this.element.val(this._getFormat(this.model.value,this.model.dateTimeFormat))},_addAttr:function(i){var r=this;n.map(i,function(n,i){var u=i.toLowerCase();u=="class"?r.wrapper.addClass(n):u=="disabled"?r._enabled(!1):u=="readOnly"?r._readOnly(!0):u=="style"?r.wrapper.attr(i,n):u=="id"?(r.wrapper.attr(i,n+"_wrapper"),r.element.attr(i,n)):t.isValidAttr(r.element[0],u)?r.element.attr(u,n):r.wrapper.attr(u,n)})},_validateMeridian:function(){var n=t.preferredCulture(this.model.locale);n&&(this.model.locale=n.name=="en"?"en-US":n.name);t.isNullOrUndefined(this._options)?this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0:t.isNullOrUndefined(this._options.timeDrillDown)?this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0:t.isNullOrUndefined(this._options.timeDrillDown.showMeridian)&&(this.model.timeDrillDown.showMeridian=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM)?!1:!0)},_initialize:function(){var i,r,u,f;this.popup=null;this.isPopupOpen=!1;this.isValidState=!0;this._localizedLabels=this._getLocalizedLabels();t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.buttonText)||n.extend(this._localizedLabels.buttonText,this._options.buttonText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this._localizedLabelToModel();this.model.startDay==-1&&(this.model.startDay=t.preferredCulture(this.model.locale).calendar.firstDay);this._isIE8=t.browserInfo().name=="msie"&&t.browserInfo().version=="8.0"?!0:!1;this._isIE9=t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0"?!0:!1;this.model.dateTimeFormat&&this.model.timeDisplayFormat||this._getDateTimeFormat();this.model.value&&(typeof JSON!="object"||JSON.stringify(this.model.value)!=="{}")?this.model.value instanceof Date?i=this.model.value:(r=t.parseDate(this.model.value,this.model.dateTimeFormat,this.model.locale),i=r?r:(r=this._checkJSONString(this.model.value))?r:null):i=null;i&&(this.model.value=i);u=this.model.minDateTime=this._stringToObject(this.model.minDateTime);u&&this._isValidDate(u)||(this.model.minDateTime=this.defaults.minDateTime);f=this.model.maxDateTime=this._stringToObject(this.model.maxDateTime);f&&this._isValidDate(f)||(this.model.maxDateTime=this.defaults.maxDateTime)},_checkJSONString:function(n){var i=new Date(n),r;if(isNaN(Date.parse(i))){if(this._extISORegex.exec(n)||this._basicISORegex.exec(n))return this._dateFromISO(n)}else if(i.toJSON()===this.model.value||i.toGMTString()===this.model.value||i.toISOString()===this.model.value||i.toLocaleString()===this.model.value||i.toString()===this.model.value||i.toUTCString()===this.model.value){if(this.model.timeZone)return new Date(new Date(i).getTime()+t.serverTimezoneOffset*36e5);if(n.match(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i)&&n.match(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i).length>0)return r=n.split("Z"),r=r[0],new Date(r)}else if(typeof n=="string")return this._dateFromISO(n)},_render:function(){this._renderWrapper();this._renderIcon();this._setDimentions();this._checkProperties()},_renderWrapper:function(){if(this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0",role:"combobox","aria-expanded":"false"}),this.wrapper=t.buildTag("span.e-datetime-wrap e-widget "+this.model.cssClass+"#"+this.element[0].id+"_wrapper").insertAfter(this.element),this._setValue(this.model.value),this.wrapper.attr("style",this.element.attr("style")),this.element.removeAttr("style"),t.isTouchDevice()||this.wrapper.addClass("e-ntouch"),this.container=t.buildTag("span.e-in-wrap e-box").append(this.element),this.wrapper.append(this.container),!this._isSupport){this._hiddenInput=t.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element);this._hiddenInput.val(this._localizedLabels.watermarkText);this._hiddenInput.css("display","block");var i=this;n(this._hiddenInput).focus(function(){i.element.focus()})}},_removeWatermark:function(){this.element.val()!=""&&!this._isSupport&&this._hiddenInput&&this._hiddenInput.css("display","none")},_renderIcon:function(){if(!this.model.showPopupButton)return!1;this.datetimeIcon=t.buildTag("span.e-select","",{}).attr(this._isIE8?{unselectable:"on"}:{});var n=t.buildTag("span.e-icon e-datetime","",{},{"aria-label":"select"}).attr(this._isIE8?{unselectable:"on"}:{});this.datetimeIcon.append(n);this.container.append(this.datetimeIcon).addClass("e-padding");this._on(this.datetimeIcon,"click",this._iconClick);this._on(this.datetimeIcon,"mousedown",function(n){n.preventDefault()})},_setDimentions:function(){this.model.height||(this.model.height=this.element.attr("height"));this.model.width||(this.model.width=this.element.attr("width"));this.wrapper.height(this.model.height);this.wrapper.width(this.model.width)},_renderDropdown:function(){var f=n("#"+this.element[0].id+"_popup").get(0),e,o,i,r,u;f&&n(f).remove();this.popup=t.buildTag("div.e-datetime-popup e-popup e-widget e-box "+this.model.cssClass+"#"+this.element[0].id+"_popup").css("visibility","hidden");t.isTouchDevice()||this.popup.addClass("e-ntouch");n("body").append(this.popup);this._renderControls();e=t.buildTag("div.e-header",this._localizedLabels.buttonText.timeTitle).attr(this._isIE8?{unselectable:"on"}:{});this._dateContainer=t.buildTag("div.e-datecontainer").append(this.datePicker.popup).attr(this._isIE8?{unselectable:"on"}:{});this._timeContainer=t.buildTag("div.e-timecontainer").append(e,this.timePicker.popup).attr(this._isIE8?{unselectable:"on"}:{});this._drillDownContainer=t.buildTag("div.e-drillDowncontainer").append().attr(this._isIE8?{unselectable:"on"}:{});o=t.buildTag("div.e-popup-container").append(this._dateContainer,this._timeContainer,this._drillDownContainer).attr(this._isIE8?{unselectable:"on"}:{});i=t.buildTag("div.e-dt-button e-dt-today e-btn e-select e-flat",this._localizedLabels.buttonText.today).attr(this._isIE8?{unselectable:"on"}:{});r=t.buildTag("div.e-dt-button e-dt-now e-btn e-select e-flat",this._localizedLabels.buttonText.timeNow).attr(this._isIE8?{unselectable:"on"}:{});u=t.buildTag("div.e-dt-button e-dt-done e-btn e-select e-flat",this._localizedLabels.buttonText.done).attr(this._isIE8?{unselectable:"on"}:{});this._buttonContainer=t.buildTag("div.e-button-container").append(i,r,u).attr(this._isIE8?{unselectable:"on"}:{});this._renderDrillDown();this.popup.append(o,this._buttonContainer);this._checkForResponsive();this._updateTimeHeight();this._bindOperations();this._updateValues();this.popup.css({visibility:"visible",display:"none"});this._on(i,"click",this._todayClick);this._on(r,"click",this._nowClick);this._on(u,"click",this._doneClick);this.popup.on("mouseenter touchstart",n.proxy(function(){this._popClose=!0},this));this.popup.on("mouseleave touchend",n.proxy(function(){this._popClose=!1},this));this._changeDesign()},_renderControls:function(){this._renderDateControl();this._renderTimeControl();var n=t.buildTag("span").append(this.datePicker.wrapper,this.timePicker.wrapper);n.find("span").css("display","none");this.popup.append(n)},_renderDrillDown:function(){this._renderHourPopup();this._renderMinsPopup()},_renderHourPopup:function(){this._sfTimeHour=t.buildTag("div.e-timepicker e-popup e-widget "+this.model.cssClass+" e-time-hours ","",{},{id:this._id?"e-hours-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{});t.isTouchDevice()||this._sfTimeHour.addClass("e-ntouch");this._drillDownContainer.append(this._sfTimeHour);this._renderHourTable()},_renderHourTable:function(){var i,o,a,v,s,u,y,p,r,w,l,e;if(t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-hours-headertext").text("October 2015").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeHour),this._interval<1)return!1;y=this._interval*6e4;p=this.model.timeDrillDown.showMeridian?2:1;v=this.model.timeDrillDown.showMeridian?6:4;var b=this.model.timeDrillDown.showMeridian?"hh":"HH:00",h=["AM","PM"],c=0,f="";for(i=this.timePicker._createObject("12:00:00 AM"),o=this.model.timeDrillDown.showMeridian?this.timePicker._createObject("11:59:59 AM"):this.timePicker._createObject("11:59:59 PM"),r=0;r=v&&(c=0,l.append(u),u=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),i=this.timePicker._createObject(i).getTime()+y;s.append(l);this.model.timeDrillDown.showMeridian&&(i=this.timePicker._createObject("12:00:00 PM"),o=this.timePicker._createObject("11:59:59 PM"))}t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this._sfTimeHour);n(".e-footer-text",this._sfTimeHour).html(this._localizedLabels.buttonText.timeNow);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this.datePicker.model.value,"dd MMM yyyy"));this._on(this._sfTimeHour.find(".e-hour"),"click",n.proxy(this._hourNavHandler,this));this._on(n(".e-next",this._sfTimeHour),"click",n.proxy(this._prevNextHourHandler,this));this._on(n(".e-prev",this._sfTimeHour),"click",n.proxy(this._prevNextHourHandler,this));this._on(n(".e-footer",this._sfTimeHour),"click",this._todayBtn);n(".e-hours-headertext",this._sfTimeHour).on("click",n.proxy(this._forwardNavHandler,this));this._sfTimeHour.hide()},_localizeTime:function(i,r){return n.trim(t.format(this.timePicker._createObject(i),r,this.model.locale))},_renderMinsPopup:function(){var r,e,i,s,h,c,u,f,o;if(this._sfTimeMins=t.buildTag("div.e-timepicker e-popup e-widget "+this.model.cssClass+" e-time-minitues ","",{},{id:this._id?"e-time-minitues-"+this._id:""}).attr({"aria-hidden":"true"}).attr(this._isIE8?{unselectable:"on"}:{}),t.isTouchDevice()||this._sfTimeMins.addClass("e-ntouch"),this._drillDownContainer.append(this._sfTimeMins),t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-arrow-sans-left").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-text").append(t.buildTag("span.e-minitues-headertext").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).append(t.buildTag("span.e-next").append(t.buildTag("a.e-icon e-arrow-sans-right").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeMins),t.buildTag("div.e-mins-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-text").append(t.buildTag("span.e-minitues-meridiantxt").text("AM").attr({"aria-atomic":"true","aria-live":"assertive",role:"heading"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeMins),r=t.buildTag("table.e-dp-viewmins","",{}).data("e-table","data").attr({role:"grid"}).attr(this._isIE8?{unselectable:"on"}:{}),this._sfTimeMins.append(r),e=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),this._intervall<1)return!1;for(c=this._interval*6e4,i=this.timePicker._createObject("12:00:00 AM"),s=this.timePicker._createObject("11:59:59 PM"),u=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),f=0;this.timePicker._compareTime(s,i,!0);)h=this._localizeTime(i,"HH:00"),o=t.buildTag("td.e-mins e-state-default",h),this._isIE8&&o.attr("unselectable","on"),u.append(o),f++,f>=4&&(f=0,e.append(u),u=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),i=this.timePicker._createObject(i).getTime()+c;r.append(e);n(".e-minitues-headertext",this._sfTimeMins).text(n(".e-hours-headertext",this._sfTimeHour).text());t.buildTag("div.e-footer").append(t.buildTag("span.e-footer-icon")).append(t.buildTag("span.e-footer-text")).appendTo(this._sfTimeMins);n(".e-footer-text",this._sfTimeMins).html(this._localizedLabels.buttonText.timeNow);n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this.datePicker.model.value,"dd MMM yyyy"));this.model.timeDrillDown.showMeridian||n(".e-mins-header",this._sfTimeMins).css("display","none");this._on(r.find(".e-mins"),"click",n.proxy(this._minsNavHandler,this));this._on(n(".e-next",this._sfTimeMins),"click",n.proxy(this._prevNextMinsHandler,this));this._on(n(".e-prev",this._sfTimeMins),"click",n.proxy(this._prevNextMinsHandler,this));this._on(n(".e-footer",this._sfTimeMins),"click",this._todayBtn);n(".e-minitues-headertext",this._sfTimeMins).on("click",n.proxy(this._forwardNavHandler,this));this._sfTimeMins.hide()},_todayBtn:function(){this._nowClick();this._hideResult()},_hourNavHandler:function(i){var r,f;if(this.model.readOnly||!this.model.enabled||i&&n(i.target).hasClass("e-disable"))return!1;i&&i.type&&i.preventDefault();n("table",this._sfTimeHour).find("td").removeClass("e-active");n(i.target).addClass("e-active");this._sfTimeHour.hide();this._sfTimeMins.show();this._addFocus(this._sfTimeMins);this.model.timeDrillDown.showMeridian?(f=n(i.target).hasClass("e-hour-am")?"AM":"PM",r=n(i.target).text()+":00 "+f):r=n(i.target).text();this._generateMins(r);var e=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),o=n.trim(t.format(this.timePicker._createObject(e),"HH:mm",this.model.locale)),s=n.trim(t.format(this.timePicker._createObject(e),"HH:00",this.model.locale)),u=(this.timePicker._parse(o)-this.timePicker._parse(s))/(this.model.timeDrillDown.interval*6e4);u=Math.ceil(u);this._hoverMins=this._setFocusByIndex("mins",u,this._sfTimeMins)},_minsNavHandler:function(i){if(this.model.readOnly||!this.model.enabled||i&&n(i.target).hasClass("e-disable"))return!1;if(i&&i.type&&i.preventDefault(),n("table",this._sfTimeMins).find("td").removeClass("e-active").removeClass("e-state-hover"),n(i.target).addClass("e-active"),this.model.timeDrillDown.showMeridian){var r=n(i.target).text()+" "+t.format(this._datetimeValue,"tt","en-US");r=this.timePicker._localizeTime(r)}else r=n(i.target).text();this.timePicker.option("value",r);this.datePicker.option("value",this._datetimeValue);this._datetimeValue=new Date(this.model.value.toString());this._updateInput();this.model.timeDrillDown.autoClose&&this._hideResult(i)},_generateMins:function(i){var f=n("table",this._sfTimeMins),h,s;f.empty();this.model.timeDrillDown.showMeridian?n(".e-mins-header",this._sfTimeMins).show():n(".e-mins-header",this._sfTimeMins).hide();h=this.model.timeDrillDown.showMeridian?"hh:mm":"HH:mm";n(".e-minitues-headertext",this._sfTimeMins).text(n(".e-hours-headertext",this._sfTimeHour).text());var e=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),r,u,c,l,o=0,a=this.model.timeDrillDown.interval*6e4;for(r=this.timePicker._createObject(i),this._datetimeValue.setHours(r.getHours()),c=this.timePicker._createObject(r).getTime()+354e4,u=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),e.append(u);this.timePicker._compareTime(c,r,!0);)o>=4&&(o=0,u=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),e.append(u)),l=this._localizeTime(r,h),s=t.buildTag("td.e-mins e-state-default",l),this._isIE8&&s.attr("unselectable","on"),u.append(s),o++,r=this.timePicker._createObject(r).getTime()+a;f.append(e);n(".e-mins-header",this._sfTimeMins).find(".e-minitues-meridiantxt").text(t.format(this._datetimeValue,"tt",this.model.locale));this._disableRange("mins");this._on(f.find(".e-mins"),"click",n.proxy(this._minsNavHandler,this))},_prevNextHourHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=n(t.target).is("a")?n(t.target.parentNode):n(t.target),r=i.hasClass("e-prev")?!0:!1;this._processNextPrev(r,this._sfTimeHour)},_prevNextMinsHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=n(t.target).is("a")?n(t.target.parentNode):n(t.target),r=i.hasClass("e-prev")?!0:!1;this._processNextPrev(r,this._sfTimeMins)},_processNextPrev:function(i,r){var e,o,u,s;if(i&&r.find(".e-arrow-sans-left").hasClass("e-disable")||!i&&r.find(".e-arrow-sans-right").hasClass("e-disable"))return!1;e=n("table",r);s=e.get(0).className;switch(s){case"e-dp-viewhours":u=i?-1:1;this._datetimeValue.setDate(this._datetimeValue.getDate()+u);this._disableRange("hour");this._hoverHour=this._setFocusByIndex("hour",this._hoverHour,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"));break;case"e-dp-viewmins":u=i?-1:1;this._datetimeValue.setHours(this._datetimeValue.getHours()+u);this._generateMins(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)));var o=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),h=n.trim(t.format(this.timePicker._createObject(o),"HH:mm",this.model.locale)),c=n.trim(t.format(this.timePicker._createObject(o),"HH:00",this.model.locale)),f=(this.timePicker._parse(h)-this.timePicker._parse(c))/(this.model.timeDrillDown.interval*6e4);f=Math.ceil(f);this._disableRange("mins");this._hoverMins=this._setFocusByIndex("mins",f,this._sfTimeMins);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))}},_forwardNavHandler:function(i,r){var f,e;if(this.model.readOnly||!this.model.enabled)return!1;e=this;i&&i.preventDefault();f=i?n(i.currentTarget).get(0).className:r.find(".e-text>span").get(0).className;switch(f){case"e-hours-headertext":this._sfTimeHour.css("display","none");this._dateContainer.css("display","block");this._addFocus(this._dateContainer.find(".e-datepicker"));break;case"e-minitues-headertext":this._sfTimeMins.css("display","none");this._disableRange("hour");var o=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"),s=n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),u=(this.timePicker._parse(s)-this.timePicker._parse(o))/(this._interval*6e4);u=Math.floor(u);this._hoverHour=this._setFocusByIndex("hour",u,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"));this._sfTimeHour.css("display","block");this._addFocus(this._sfTimeHour)}},_renderDateControl:function(){var n=t.buildTag("input#"+this.element[0].id+"_date","",{},{type:"text"});this.popup.append(n);n.ejDatePicker({height:"0px",width:"0px",displayInline:!0,showDateIcon:!1,showFooter:this.model.timeDrillDown.enabled?this.model.timeDrillDown.showFooter:!1,enableStrictMode:!0,buttonText:this._localizedLabels.buttonText.today,minDate:this._stringToObject(this.model.minDateTime),maxDate:this._stringToObject(this.model.maxDateTime),dayHeaderFormat:this.model.dayHeaderFormat,startLevel:this.model.startLevel,depthLevel:this.model.depthLevel,startDay:this.model.startDay,stepMonths:this.model.stepMonths,showOtherMonths:this.model.showOtherMonths,specialDates:this.model.specialDates,highlightWeekend:this.model.highlightWeekend,headerFormat:this.model.headerFormat,enabled:this.model.enabled,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,readOnly:this.model.readOnly,cssClass:this.model.cssClass,locale:this.model.locale});t.isNullOrUndefined(this.model.value)||(this._datetimeValue=new Date(this.model.value.toString()));this.datePicker=n.data("ejDatePicker");this._datetimeValue=new Date(this.datePicker._dateValue.toString());this.model.startDay=this.datePicker.model.startDay;this.datePicker._getInternalEvents=!0;this.datePicker._dt_drilldown=!0;this.datePicker.popup.css({position:"static",display:"block"})},_renderTimeControl:function(){var i=t.buildTag("input#"+this.element[0].id+"_time","",{},{type:"text"}),n,r,u,f;this.popup.append(i);n=this.model.timePopupWidth;r=typeof n=="string"&&n.indexOf("%")!=-1||typeof n=="string"?parseInt(n)>0?n:105&&(this.model.timePopupWidth=105):n>0?n:105&&(this.model.timePopupWidth=105);i.ejTimePicker({height:"0px",width:"0px",interval:this.model.interval,timeFormat:this.model.timeDisplayFormat,popupWidth:r,enabled:this.model.enabled,enableRTL:this.model.enableRTL,showRoundedCorner:this.model.showRoundedCorner,readOnly:this.model.readOnly,cssClass:this.model.cssClass,locale:this.model.locale,disableTimeRanges:this.model.disableTimeRanges});this.timePicker=i.data("ejTimePicker");this.timePicker._renderDropdown();this.timePicker.popup.css({position:"static",display:"block"});this.timePicker._getInternalEvents=!0;this.timePicker.showDropdown=!0;this.timePicker._dateTimeInternal=!0;u=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime;f=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime},_updateTimeHeight:function(){var n=this.popup.find(".e-timecontainer .e-header").is(":visible")?this.datePicker.popup.height()-this.popup.find(".e-header").height():this.datePicker.popup.height();n=this.popup.hasClass("e-dt-responsive")?"98px":n;this.timePicker.option("popupHeight",n)},_bindOperations:function(){var t=this;this.datePicker.option("layoutChange",function(){t._updateTimeHeight()});this.datePicker.option("outOfRange",function(){t.isValidState=!1});this.timePicker.option("outOfRange",function(){t.isValidState=!1});this.datePicker.option("change",function(n){t._refreshTimes(n)});this.datePicker.option("select",function(n){t._updateInput(n)});this.datePicker.option("dt_drilldown",function(n){t.model.timeDrillDown.enabled&&(t._updateInput(n),t._switchToDrilDown(n))});this.timePicker.option("select",function(){t._updateInput()});this.datePicker.option("_setAriaAttribute",function(i){n(t.element).attr("aria-activedescendant",i.attr("id"))})},_switchToDrilDown:function(){var r;this._dateContainer.hide();this._sfTimeHour.show();this._addFocus(this._sfTimeHour);r=new Date(this.model.value.toString());this._datetimeValue=new Date(r.setHours(this._datetimeValue.getHours(),this._datetimeValue.getMinutes(),this._datetimeValue.getSeconds(),this._datetimeValue.getMilliseconds()));this._disableRange("hour");var u=this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"),f=n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),i=(this.timePicker._parse(f)-this.timePicker._parse(u))/(this._interval*6e4);i=Math.floor(i);this._hoverHour=this._setFocusByIndex("hour",i,this._sfTimeHour);n(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy"));n(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))},_disableRange:function(i){var l=i=="hour"?this._interval:this.model.timeDrillDown.interval,u=i=="hour"?this._sfTimeHour:this._sfTimeMins,h=i=="hour"?"e-hide-hour e-disable":"e-hide-mins e-disable",c,e,r,a,f,o,s;if(u.find("tbody tr td.e-"+i).removeClass(h),u.find(".e-arrow-sans-left").removeClass("e-disable"),u.find(".e-arrow-sans-right").removeClass("e-disable"),c=i=="hour"?this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"):this._localizeTime(n.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),"HH:00"),this._compareDate(this.model.minDateTime,this._datetimeValue)){if(i=="mins"&&!(this.model.minDateTime.getHours()===this._datetimeValue.getHours()))return!1;for(e=n.trim(t.format(this.timePicker._createObject(this.model.minDateTime),"HH:mm",this.model.locale)),r=(this.timePicker._parse(e)-this.timePicker._parse(c))/(l*6e4),r=i=="hour"?Math.floor(r):Math.ceil(r),f=0;f+this.model.maxDateTime?this.model.minDateTime:(new Date).setHours(0,0,0,0),i=this._getDate()||new Date(u),r=this._getTime()||this.timePicker._createObject(u);this.model.value=new Date(i.getFullYear(),i.getMonth(),i.getDate(),r.getHours(),r.getMinutes(),r.getSeconds());this._updateDateTime();this._raiseChangeEvent();this._updateModel(t,!0);n(this.element).attr("aria-activedescendant",n(this.datePicker.popup).find(".e-active").attr("id"));t&&(t.cancel=!0)},_updateDateTime:function(){this.isValidState=!0;var n=this._objectToString(this.model.value);this.element.val(n);this._removeWatermark()},_refreshTimes:function(n){var i=this._getDateObj(n.value,this.datePicker.model.dateFormat),r,f,u;if(!i)return!1;this.isValidState=!0;this._compare(i,this._setEmptyTime(this.model.minDateTime))?(r=this._getFormat(this.model.minDateTime,this.timePicker.model.timeFormat),u=this._getTime(),this.timePicker.option("minTime",r),this.model.enableStrictMode||this._updateInput()):this.timePicker.option("minTime",this._defaultMinVal());this._compare(i,this._setEmptyTime(this.model.maxDateTime))?(f=this._getFormat(this.model.maxDateTime,this.timePicker.model.timeFormat),u=this._getTime(),this.timePicker.option("maxTime",f),this.model.enableStrictMode||this._updateInput()):this.timePicker.option("maxTime",this._defaultMaxVal());this.timePicker._changeActiveEle();t.isNullOrUndefined(this.model.disableDateTimeRanges)||this._setDisabledTimeRanges(n)},_setDisabledTimeRanges:function(n){var t=n?n.value:this._setEmptyTime(this.model.value);this._between=[];this._initDisableTimeRanges(t);this._datesDisabled||(this._disableBetweenDates(),this.datePicker.option("blackoutDates",this._between))},_defaultMinVal:function(){var n=(new Date).setHours(0,0,0,0);return t.format(this.timePicker._createObject(n),this.timePicker.model.timeFormat,this.timePicker.model.locale)},_defaultMaxVal:function(){var n=(new Date).setHours(23,59,59,59);return t.format(this.timePicker._createObject(n),this.timePicker.model.timeFormat,this.timePicker.model.locale)},_updateValues:function(){var n=this.model.enableStrictMode&&this.model.value==null?this.element.val():this.model.value;this.model.value!=null&&(this.datePicker.option("value",this.model.value),this.timePicker.option("value",this.model.value));this._setValue(n);this._validateMinMax();this._preVal=this.element.val();this._checkErrorClass()},_specificFormat:function(){var i=t.globalize._getDateParseRegExp(t.globalize.findCulture(this.model.locale).calendar,this.model.dateTimeFormat);return n.inArray("dddd",i.groups)>-1||n.inArray("ddd",i.groups)>-1},_changeEditable:function(t){var i=t?"_on":"_off";if(this.element.is(":input")){if(t)this.model.readOnly||this.element.attr("readonly",!1),this.element.off("mousedown",n.proxy(this._showhidePopup,this));else{this.model.readOnly||this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showhidePopup,this))}this[i](this.element,"blur",this._targetBlur);this[i](this.element,"focus",this._targetFocus);this[i](this.element,"keydown",this._keyDownOnInput)}this._change("allowEdit",t)},_setValue:function(n){return n&&(typeof JSON!="object"||JSON.stringify(n)!=="{}")?typeof n=="string"?this._extISORegex.exec(n)||this._basicISORegex.exec(n)?this._checkObject(this._dateFromISO(n)):(this.element.val(n),this._updateModel(),this._validateMinMax(),this._checkStrictMode(),this.wrapper.addClass("e-valid")):n instanceof Date&&this._isValidDate(n)&&this._checkObject(n):(this.element.val(""),this.model.value=null,this.isValidState=!0,this.wrapper.removeClass("e-valid")),t.isNullOrUndefined(this.model.disableDateTimeRanges)||this._validateDisableRanges(),this._checkErrorClass(),this.model.value},_checkObject:function(n){n instanceof Date&&this._isValidDate(n)&&(this.model.value=n,this._updateDateTime(),this._validateMinMax(),this._checkStrictMode())},_dateFromISO:function(n){var i=this._extISORegex.exec(n)||this._basicISORegex.exec(n),c="",l="",a="",v,e,o,f,r,t,s,u,h,y;if(i){for(e=0;e=0&&!s&&(f[u].indexOf("M")>=0?t.push(parseInt(r[0])-1):t.push(parseInt(r[0]))),n=n.slice(n.indexOf(r[0])+r[0].length));return i[4]=="Z"?new Date(Date.UTC.apply(null,t)):new Date(t[0],t[1],t[2],t[3],t[4],t[5])}return new Date(n+"")},_checkLiteral:function(n){var t=n.toLowerCase();return t=="t"||t=="z"||t==":"||t=="-"?!0:!1},_validateValue:function(n){var r=t.parseDate(n,this.model.dateTimeFormat,this.model.locale),u=null;this.timePicker!=i&&(u=this._getFormat(r,this.timePicker.model.timeFormat));!r||rthis.model.maxDateTime||!t.isNullOrUndefined(this.timePicker)&&this.timePicker._ensureTimeRange(u)?(this.model.value=null,this._change("value",this.model.value),this.isValidState=!1):(this._change("value",this.model.value),this.isValidState=!0)},_validateMinMax:function(){var i,n,t;if(i=this.model.value?this._stringToObject(this.model.value):null,n=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime,t=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime,!i||!n||!t)return!1;n>t&&(this.model.minDateTime=this.model.maxDateTime);it&&(this.model.enableStrictMode?this.model.enableStrictMode&&(this.popup&&(this.datePicker.option("maxDate",this._getFormat(t,this.datePicker.model.dateFormat)),this.timePicker.option("maxTime",this._getFormat(t,this.timePicker.model.timeFormat))),this.isValidState=!1):(this._setValue(t),this.isValidState=!0));it||(this.isValidState=!0)},_checkProperties:function(){this.model.readOnly&&this._readOnly(!0);this.model.showRoundedCorner&&this._setRoundedCorner(!0);this.model.enableRTL&&this._setRtl(!0);this.model.enabled&&this._enabled(!0);this.model.enabled?this.model.enabled&&this.element.hasClass("e-disable")&&this._enabled(!0):this._enabled(!1);this.model.name=this._options.name?this.model.name:this.element.attr("name")?this.element.attr("name"):this.element[0].id;this.element.attr("name",this.model.name);this._checkStrictMode();this._checkErrorClass();this._setWaterMark()},_checkStrictMode:function(){this.model.enableStrictMode?this.model.enableStrictMode&&(this.isValidState||(this.model.value=null,this.isValidState=!1)):this.isValidState||(this.model.valuethis.model.maxDateTime?(this.element.val(this._objectToString(this.model.maxDateTime)),this.model.value=this.model.maxDateTime,this.isValidState=!0):(this.model.value="",this.element.val(""),this.isValidState=!0))},_targetFocus:function(n){n.preventDefault();this.isFocused=!0;this.wrapper.addClass("e-focus");this.wrapper.removeClass("e-error");this._isSupport||this._hiddenInput.css("display","none");this._prevDateTimeVal=this.element.val();this.model.showPopupButton||this.model.readOnly||this._showResult();this.model.showPopupButton||this._on(this.element,"click",this._elementClick);!this.model.showPopupButton&&this.model.readOnly&&this._off(this.element,"click",this._elementClick);this._trigger("focusIn",{value:this.model.value});this.wrapper.addClass("e-valid")},_targetBlur:function(){var n,i;this.isFocused=!1;this.wrapper.removeClass("e-focus");this.model.showPopupButton||this._hideResult();n=t.parseDate(this.element.val(),this.model.dateTimeFormat,this.model.locale);n&&!this.model.enableStrictMode&&(nthis.model.maxDateTime)&&(n=n0&&(t.removeClass("e-focus"),t.hasClass("e-datepicker e-popup")?n(document).off("keydown",n.proxy(this.datePicker._keyboardNavigation,this.datePicker)):t.hasClass("e-timecontainer")?n(document).off("keydown",n.proxy(this.timePicker._keyDownOnInput,this.timePicker)):t.hasClass("e-time-hours")?n(document).off("keydown",n.proxy(this._keyDownOnHours,this)):t.hasClass("e-time-minitues")?n(document).off("keydown",n.proxy(this._keyDownOnMinutes,this)):t.hasClass("e-dt-button")&&n(document).off("keydown",n.proxy(this._buttonClick,this)))},_addPrevNextFocus:function(n){var i=this._getFocusedElement(),t;i.length>0?i.hasClass("e-datepicker e-popup")?t=n?this.popup.find(".e-dt-done"):this.popup.find(".e-timecontainer"):i.hasClass("e-timecontainer")?t=n?this.popup.find(".e-datecontainer >.e-datepicker.e-popup"):this.popup.find(".e-dt-today"):i.hasClass("e-dt-today")?t=n?this.popup.find(".e-timecontainer"):this.popup.find(".e-dt-now"):i.hasClass("e-dt-now")?t=n?this.popup.find(".e-dt-today"):this.popup.find(".e-dt-done"):i.hasClass("e-dt-done")&&(t=n?this.popup.find(".e-dt-now"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup")):t=n?this.popup.find(".e-dt-done"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup");this._addFocus(t)},_getFocusedElement:function(){return this.popup.children("div").find("div.e-focus")},_keyDownOnHours:function(n){var t;if(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35){n.preventDefault&&n.preventDefault();t={row:null,col:null};t.col=this._sfTimeHour.find("tbody tr td.e-state-hover").index();t.row=this._sfTimeHour.find("tbody tr td.e-state-hover").parent().index();t.col=t.col!=-1?t.col+1:this._sfTimeHour.find("tbody tr td.e-active").index()+1;t.row!=-1?(t.row=t.row+1,this.model.timeDrillDown.showMeridian&&this._sfTimeHour.find("tbody tr td.e-state-hover").hasClass("e-hour-pm")&&(t.row=t.row+2)):(t.row=this._sfTimeHour.find("tbody tr td.e-active").parent().index()+1,this.model.timeDrillDown.showMeridian&&this._sfTimeHour.find("tbody tr td.e-active").hasClass("e-hour-pm")&&(t.row=t.row+2));var f=this._sfTimeHour.find("table")[0].className,i,r=this._sfTimeHour.find("tbody.e-timepicker-hours tr").length,u=this.model.timeDrillDown.showMeridian?6:4;i=this._changeRowCol(t,n.keyCode,r,u,"hours",n.ctrlKey);n.ctrlKey||(this._hoverHour=this._sfTimeHour.find("tbody.e-timepicker-hours tr td").index(i));n.ctrlKey||(this._sfTimeHour.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover"))}},_changeRowCol:function(t,i,r,u,f,e){var c,o,l,h={parent:null,child:null},s,y,a,v,p;switch(f){case"hours":c="tbody.e-timepicker-hours tr td.e-hour";h.parent=".e-timepicker-hours";h.child=".e-hour";l=".e-hide-hour";o=this._sfTimeHour;break;case"mins":c="tbody.e-timepicker-mins tr td.e-mins";h.parent=".e-timepicker-mins";h.child=".e-mins";l=".e-hide-mins";o=this._sfTimeMins;u=o.find("tbody"+h.parent+" tr:nth-child("+t.row+") td"+h.child).length}if(t.row<=0&&t.col<=0)return o.find(c+":not(.e-disable):first");y=this;switch(i){case 36:return o.find(c+":not(.e-disable):first");case 35:return o.find(c+":not(.e-disable):last");case 38:if(e)this._forwardNavHandler(null,o);else if(t.row>1)t.row-=1;else return this._processNextPrev(!0,o),o.find(c+":nth-child("+t.col+"):last");if(s=this._getCell(t,h,o).not(l),s.length<=0){if(s=this._findVisible(t,h,"up",o),s!==null)return s;this._processNextPrev(!0,o);s=o.find(c+":nth-child("+t.col+"):last")}return s;case 37:if(e)return this._processNextPrev(!0,o),o.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else if(t.row>1)t={row:t.row-1,col:u},f=="mins"&&(t.col=u=o.find("tbody"+h.parent+" tr:nth-child("+t.row+") td"+h.child).length);else return this._processNextPrev(!0,o),o.find(c+":not(.e-disable):last");if(s=this._getCell(t,h,o).not(l),s.length<=0){if(s=this._findVisible(t,h,"left",o),s!==null)return s;this._processNextPrev(!0,o);s=o.find(c+":not(.e-disable):last")}return s;case 39:if(e)return this._processNextPrev(!1,o),o.find("tbody tr td.e-state-hover");if(t.col2&&r.hasClass("e-time-hours")&&(f=f-2),u=r.find("tbody"+i.parent+" tr:nth-child("+f+") td"+i.child+":nth-child("+t.col+")"),this.model.timeDrillDown.showMeridian&&u.length>0&&r.hasClass("e-time-hours")&&(u=t.row<=2?n(u[0]):n(u[1])),u},_findVisible:function(n,t,i,r){for(var e,f=n.col,u=n.row,s=t.child.slice(1,t.child.length),o=0;o>=0;o++){if(e=this._getCell({row:u,col:f},t,r),e.length<=0)return null;if(e.hasClass("e-disable")||!e.is(":visible")){if((i=="right"||i=="left"?i=="right"?f++:f--:i=="down"?u++:u--,u<=0||u>r.find("tbody"+t.parent+" tr").length)||(f>r.find("tbody"+t.parent+" tr:nth-child("+u+") td").length&&(u++,f=1),f<=0&&(u--,f=r.find("tbody"+t.parent+" tr:nth-child("+u+") td").length),u<=0||u>r.find("tbody"+t.parent+" tr").length))return null}else if(e.hasClass(s))return n.col=f,n.row=u,this._getCell(n,t,r)}},_keyDownOnMinutes:function(n){var t;if(n.keyCode==37||n.keyCode==38||n.keyCode==39||n.keyCode==40||n.keyCode==13||n.keyCode==36||n.keyCode==35){n.preventDefault&&n.preventDefault();t={row:null,col:null};t.col=this._sfTimeMins.find("tbody tr td.e-state-hover").index();t.row=this._sfTimeMins.find("tbody tr td.e-state-hover").parent().index();t.col=t.col!=-1?t.col+1:this._sfTimeMins.find("tbody tr td.e-active").index()+1;t.row=t.row!=-1?t.row+1:this._sfTimeMins.find("tbody tr td.e-active").parent().index()+1;var u=this._sfTimeMins.find("table")[0].className,i,r=this._sfTimeMins.find("tbody.e-timepicker-mins tr").length;i=this._changeRowCol(t,n.keyCode,r,4,"mins",n.ctrlKey);n.ctrlKey||(this._hoverHour=this._sfTimeMins.find("tbody.e-timepicker-mins tr td").index(i));n.ctrlKey||(this._sfTimeMins.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover"))}},_valueChange:function(n){this.model.enableStrictMode?this.model.enableStrictMode&&(this._preVal!=this.element.val()||this.model.valuethis.model.maxDateTime)&&(this._updateModel(),this._raiseChangeEvent(n)):(this._preVal!=this.element.val()&&(this._preVal=this.element.val(),this._updateModel(),this._validateMinMax(),this._raiseChangeEvent(n)),this._setWaterMark())},_updateModel:function(n,r){var u,f;if(this._stopRefresh){this._stopRefresh=!1;return}u=this.element.val();u==""?(this.model.value=null,this._change("value",this.model.value),this.isValidState=!0):(f=n!=i&&n.type=="select"||this._prevDateTimeVal==this.element.val()?this.model.value:t.parseDate(u,this.model.dateTimeFormat,this.model.locale),f?(this.model.value=f,this.isValidState=!0,this._refreshPopup(r),this._specificFormat()&&this._prevDateTimeVal!=this.element.val()&&this.element.val(this._objectToString(this.model.value))):(this.model.value=null,this._change("value",this.model.value),this.isValidState=!1,this.model.enableStrictMode||this.element.val(this._objectToString(this.model.value))))},_refreshPopup:function(n){if(this.isValidState&&this.isPopupOpen){var t=this._setEmptyTime(this.model.value),i=this._setEmptyDate(this.model.value),r=this._getDate(),u=this._getTime();r&&this._compare(r,t)||this.datePicker.option("value",t);u&&this._compare(u,i)||n||this.timePicker.option("value",i)}},_buttonClick:function(n){if(n.keyCode==13){n.preventDefault();var t=this._getFocusedElement();t.hasClass("e-dt-today")?this._todayClick():t.hasClass("e-dt-now")?this._nowClick():t.hasClass("e-dt-done")&&this._doneClick()}},_todayClick:function(){if(!this.model.enabled||this.model.readOnly)return!1;this.datePicker.popup.find(".today").hasClass("e-active")&&this.datePicker.popup.children("table").hasClass("e-dp-viewdays")&&this.element.val()!=""&&this.isValidState||(this.datePicker._setCurrDate(),this._updateInput())},_nowClick:function(){var r;if(!this.model.enabled||this.model.readOnly)return!1;this.timePicker.setCurrentTime();var u=this.model.minDateTime,f=this.model.maxDateTime,n=this.datePicker.model.value,i=new Date;n=t.isNullOrUndefined(n)?new Date:n;r=new Date(n.getFullYear(),n.getMonth(),n.getDate(),i.getHours(),i.getMinutes(),i.getSeconds());rf&&this.timePicker.option("value",this.timePicker._localizeTime(f));this._updateInput()},_doneClick:function(){this._hideResult()},_iconClick:function(n){n.preventDefault();this.isFocused||t.isTouchDevice()||this.element.focus();this._showhidePopup();this.model.disableDateTimeRanges&&t.isNullOrUndefined(this.model.value)&&this._setDisabledTimeRanges(this.datePicker.model.value);this._isIE9&&this.popup.find(".e-popup-container").css("display","inline-block")},_setInitialSelection:function(){var r=this.timePicker.ul.find("li"),u,f,e,t,i,o;if(r.hasClass("e-hover")){this._calcScrollTop();return}u=this.timePicker._setEmptyDate(new Date);f=u;this.timePicker.minTime&&!this._compareTime(this._createObject(u),this.timePicker.minTime,!0)&&(f=this.timePicker.minTime);this.timePicker.maxTime&&!this._compareTime(this.timePicker.maxTime,this._createObject(u),!0)&&(f=this.timePicker.maxTime);e=r.first().html();t=(this.timePicker._parse(f)-this.timePicker._parse(e))/(this.timePicker.model.interval*6e4);t=Math.round(t);i=t==r.length?t:t+1;(i<0||i>r.length||isNaN(i))&&(i=1);o=n(this.timePicker.ul.find("li")[i-1]);o.addClass("e-hover");this._calcScrollTop()},_calcScrollTop:function(){var r=this.timePicker.ul.outerHeight(),n=this.timePicker.ul.find("li").outerHeight(),t,i;t=this.timePicker.ul.find("li.e-hover").index();i=n*t-(this.timePicker.popupList.outerHeight()-n)/2;this.timePicker.scrollerObj.setModel({scrollTop:i})},_showhidePopup:function(){if(this.model.readOnly)return!1;this.isPopupOpen?this._hideResult():this._showResult()},_showResult:function(){if((this.popup||this._renderDropdown(),this.isPopupOpen||!this.model.enabled)||(this._setRtl(this.model.enableRTL),this._setRoundedCorner(this.model.showRoundedCorner),this._trigger("beforeOpen",{element:this.popup})))return!1;this.isPopupOpen=!0;this.element.attr({"aria-expanded":"true"});this.model.value!=null?n(this.element).attr("aria-activedescendant",n(this.datePicker.popup.find(".e-active")).attr("id")):n(this.element).attr("aria-activedescendant",n(this.datePicker.popup).find(".today").attr("id"));this._setListPosition();this._checkForResponsive();var i=this;this.popup.slideDown(this.model.enableAnimation?200:0,function(){i._on(n(document),"mousedown",i._OnDocumentClick);i.model.timeDrillDown.enabled&&i._addFocus(i._dateContainer.find(".e-datepicker"));i.timePicker.model.value||i._setInitialSelection()});this._updateModel();this._updateTimeHeight();this._validateMinMax();this._on(n(window),"resize",this._OnWindowResize);this._on(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._on(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult);this._raiseEvent("open");this._initial&&(this.timePicker._refreshScroller(),this.timePicker._changeActiveEle(),this._initial=!1);this.wrapper.addClass("e-active");this._addFocus(n(this.datePicker.popup))},_hideResult:function(i){if(!i||i.type!="touchmove"&&i.type!="scroll"||!(n(i.target).parents("#"+this.popup[0].id).length>0)){var r=this;if(!this.isPopupOpen||this._trigger("beforeClose",{element:this.popup}))return!1;if(this.isPopupOpen=!1,this.element.attr({"aria-expanded":"false"}),this._removeFocus(),this._popClose&&i&&i.type!="click"){this.isPopupOpen=!0;return}this.popup.slideUp(this.model.enableAnimation?100:0,function(){r.model&&(r.model.timeDrillDown.enabled&&(r._sfTimeHour.hide(),r._sfTimeMins.hide(),r._dateContainer.show()),t.isNullOrUndefined(r.model.value)||(r._datetimeValue=new Date(r.model.value.toString())))});this._raiseEvent("close");this._off(n(document),"mousedown",this._OnDocumentClick);this._off(n(window),"resize",this._OnWindowResize);this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult);this._off(t.getScrollableParents(this.wrapper),"touchmove",this._hideResult);this.wrapper.removeClass("e-active")}},_setListPosition:function(){var r=this.wrapper,i=this._getOffset(r),s,v=n(document).scrollTop()+n(window).height()-(i.top+n(r).outerHeight()),h=i.top-n(document).scrollTop(),u=this.popup.outerHeight(),c=this.popup.outerWidth(),f=i.left,o=r.outerHeight(),l=(o-r.height())/2,y=this._getZindexPartial(),e=3,p=this.model.popupPosition,a;a=this.model.popupPosition==t.PopupPosition.Bottom?(uh?i.top+o+e:i.top-u-e)-l:(u>h?i.top+o+e:i.top-u-e)-l;s=n(document).scrollLeft()+n(window).width()-f;(this.model.enableRTL||c>s&&c0?this._addFocus(n(t.target).parents(".e-datepicker")):n(t.target).parents(".e-timecontainer").length>0?this._addFocus(n(t.target).parents(".e-timecontainer")):n(t.target).hasClass("e-dt-button")?this._addFocus(n(t.target)):n(t.target).parents(".e-time-hours").length>0?this._addFocus(n(t.target).parents(".e-time-hours")):n(t.target).parents(".e-time-minitues").length>0?this._addFocus(n(t.target).parents(".e-time-minitues")):this._removeFocus()):this._hideResult())},_OnWindowResize:function(){this._setListPosition();this._checkForResponsive();this._updateTimeHeight()},_raiseChangeEvent:function(i){var e=t.parseDate(this._prevDateTimeVal,this.model.dateTimeFormat),u=t.parseDate(this.element.val(),this.model.dateTimeFormat),f,r;+e==+u?this._prevDateTimeVal!=this.element.val()&&(r={prevDateTime:this._prevDateTimeVal,value:this.element.val(),isValidState:this.isValidState},this._prevDateTimeVal=this.element.val(),this._trigger("_change",r)):(this._preVal=this.element.val(),r={prevDateTime:this._prevDateTimeVal,value:this.element.val(),isInteraction:!i,isValidState:this.isValidState},this.timePicker&&this.timePicker.model?(f=this._getFormat(u,this.timePicker.model.timeFormat),this.timePicker._ensureTimeRange(f)?(this._prevDateTimeVal="",this.model.value=null,this.isValidState=!1):this._prevDateTimeVal=this.element.val()):this._prevDateTimeVal=this.element.val(),this._trigger("_change",r),r.value=n.trim(this.element.val())==""?null:this.element.val(),r.value=this._formatter(this.model.value,this.model.dateTimeFormat),this._trigger("change",r))},_formatter:function(n,i){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)},_raiseEvent:function(n){var i=this._previousDateUpdate();return this.element!=null&&this.model[n]?this._trigger(n,{prevDateTime:t.isNullOrUndefined(i||this._preValString)?"":i||this._preValString,value:this.element.val()}):!1},_getDateTimeFormat:function(){var n=t.preferredCulture(this.model.locale).calendar.patterns;this.model.dateTimeFormat||(this.model.dateTimeFormat=n.d+" "+n.t);this.model.timeDisplayFormat||(this.model.timeDisplayFormat=n.t)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popup)},_checkErrorClass:function(){this.isValidState?this.wrapper.removeClass("e-error"):this.wrapper.addClass("e-error")},_getDate:function(){return this.datePicker.model.value},_getTime:function(){return this._getDateObj(this.timePicker.model.value,this.timePicker.model.timeFormat)},_setEmptyTime:function(n){var t=new Date(n);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_setEmptyDate:function(n){var t=new Date(n);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_objectToString:function(n){return this._getFormat(n,this.model.dateTimeFormat)},_stringToObject:function(n){return this._getDateObj(n,this.model.dateTimeFormat)},_getFormat:function(n,i){if(n instanceof Date){var r=this._checkFormat(i);return t.format(n,r,this.model.locale)}return n},_checkFormat:function(n){var i=this,r=this._regExp();return n.replace(r,function(n){return n==="/"?t.preferredCulture(i.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},_regExp:function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},_getDateObj:function(n,i){var o,f;if(typeof n=="string"){if(o=this._checkFormat(i),f=t.parseDate(n,o,this.model.locale),f!=null)return f;if(n!=""&&n!=null){var e,r=/^\s*(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).*Z\s*$/.exec(n),u=new Date;if(r&&(u=new Date,e=+r[2],u.setUTCFullYear(r[1],e-1,r[3]),u.setUTCHours(r[4],r[5],r[6]),e!=u.getUTCMonth()+1&&u.setTime()),this._isValidDate(u))return u}else return null}else return n},_compare:function(n,t){return n&&t&&n.getTime()==t.getTime()},_isValidDate:function(n){return n&&typeof n.getTime=="function"&&isFinite(n.getTime())},_change:function(n,t){this.popup&&(this.datePicker.option(n,t),this.timePicker.option(n,t))},_changeSkin:function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popup.removeClass(this.model.cssClass).addClass(n);this._change("cssClass",n)},_localize:function(i){var u,r,f;if(this.model.locale=i,t.isNullOrUndefined(this._options.timeDisplayFormat)&&(this.model.timeDisplayFormat=""),t.isNullOrUndefined(this._options.dateTimeFormat)&&(this.model.dateTimeFormat=""),u=["AM","PM"],this._getDateTimeFormat(),this.timePicker.option("timeFormat",this.model.timeDisplayFormat),this._localizedLabels=this._getLocalizedLabels(),t.isNullOrUndefined(this._options)||(t.isNullOrUndefined(this._options.buttonText)||n.extend(this._localizedLabels.buttonText,this._options.buttonText),t.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText)),this._localizedLabelToModel(),this._buttonText(this._localizedLabels.buttonText),(this.isValidState||this.model.value instanceof Date&&this._isValidDate(this.model.value))&&this.element.val(this._objectToString(this.model.value)),this._preVal=this.element.val(),this._change("locale",i),this.model.startDay=this.datePicker.model.startDay,this._validateMeridian(),this._sfTimeHour.empty(),this._renderHourTable(),this.model.timeDrillDown.showMeridian)for(r=0;r<2;r++)f=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard[u[r]])?"":t.preferredCulture(this.model.locale).calendars.standard[u[r]][0],n("span.e-hours-meridiantxt-"+u[r].toLowerCase(),this._sfTimeHour).text(f)},_setWaterMark:function(){if(this.element!=null&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&this.element.val()==""&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||this.element.val()!=""?n(this.element).attr("placeholder",this._localizedLabels.watermarkText):this._hiddenInput.css("display","block").val(this._localizedLabels.watermarkText),!0},_localizedLabelToModel:function(){this.model.watermarkText=this._localizedLabels.watermarkText;this.model.buttonText=this._localizedLabels.buttonText},_readOnly:function(n){this.model.readOnly=n;n?this.element.attr("readonly","readonly"):this.element.prop("readonly",!1);this._change("readOnly",n)},_setRoundedCorner:function(n){n?(this.container.addClass("e-corner"),this.popup&&this.popup.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popup&&this.popup.removeClass("e-corner"));t.isNullOrUndefined(this.datePicker)||this.datePicker.option("showRoundedCorner",n);t.isNullOrUndefined(this.timePicker)||this.timePicker.option("showRoundedCorner",n)},_setRtl:function(n){n?(this.wrapper.addClass("e-rtl"),this.popup&&this.popup.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popup&&this.popup.removeClass("e-rtl"));this._change("enableRTL",n)},_enabled:function(n){n?(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable())},_showButton:function(n){this.model.showPopupButton=n;n?(this.container.addClass("e-padding"),this._renderIcon()):(this.container.removeClass("e-padding"),this.datetimeIcon.remove(),this.datetimeIcon=null)},_buttonText:function(t){n.extend(this.model.buttonText,t);this.popup.find(".e-dt-today").html(this.model.buttonText.today);this.popup.find(".e-dt-now").html(this.model.buttonText.timeNow);this.popup.find(".e-dt-done").html(this.model.buttonText.done);this.popup.find(".e-timecontainer").find(".e-header").html(this.model.buttonText.timeTitle)},_checkForResponsive:function(){if(n(window).outerWidth()>200&&n(window).outerWidth()<=500)this.popup.hasClass("e-dt-responsive")||(this.popup.addClass("e-dt-responsive"),this.timePicker.option("popupWidth",this.datePicker.popup.outerWidth()),this.timePicker.option("popupHeight",98),this.timePicker._refreshScroller(),this.timePicker._changeActiveEle());else if(this.popup.hasClass("e-dt-responsive")){this.popup.removeClass("e-dt-responsive");this.timePicker.option("popupWidth",this.model.timePopupWidth);var t=this.datePicker.popup.height()-this.popup.find(".e-header").height();this.timePicker.option("popupHeight",t);this.timePicker._refreshScroller();this.timePicker._changeActiveEle()}},enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.model.enabled=!0,this.element.prop("disabled",!1),this.wrapper.removeClass("e-disable"),this.element.removeClass("e-disable").attr("aria-disabled",!1),this._isSupport||this._hiddenInput.prop("disabled",!1),this.datetimeIcon&&this.datetimeIcon.removeClass("e-disable").attr("aria-disabled",!1),this._isIE8&&this.datetimeIcon&&this.datetimeIcon.children().removeClass("e-disable"),this.popup&&(this.popup.children("div").removeClass("e-disable").attr("aria-disabled",!1),this._change("enabled",!0)))},disable:function(){this.model.enabled&&(this.element[0].disabled=!0,this.model.enabled=!1,this.wrapper.addClass("e-disable"),this.element.addClass("e-disable").attr("aria-disabled",!0),this.element.attr("disabled","disabled"),this._isSupport||this._hiddenInput.attr("disabled","disabled"),this.datetimeIcon&&this.datetimeIcon.addClass("e-disable").attr("aria-disabled",!0),this._isIE8&&this.datetimeIcon&&this.datetimeIcon.children().addClass("e-disable"),this._hideResult(),this._change("enabled",!1),this.popup&&(this.popup.children("div").addClass("e-disable").attr("aria-disabled",!0),this.datePicker.popup.removeClass("e-disable").attr("aria-disabled",!1),this.timePicker.popup.removeClass("e-disable").attr("aria-disabled",!1)))},getValue:function(){return this._objectToString(this.model.value)},setCurrentDateTime:function(){this.model.readOnly||this._setValue(new Date)},show:function(){this._showResult()},hide:function(){this._hideResult()},_wireEvents:function(){if(this.model.allowEdit&&(this._on(this.element,"focus",this._targetFocus),this._on(this.element,"blur",this._targetBlur),this._on(this.element,"keydown",this._keyDownOnInput)),!this.model.allowEdit){this.element.attr("readonly","readonly");this.element.on("mousedown",n.proxy(this._showhidePopup,this))}},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}});t.DateTimePicker.Locale=t.DateTimePicker.Locale||{};t.DateTimePicker.Locale["default"]=t.DateTimePicker.Locale["en-US"]={watermarkText:"Select datetime",buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"}};t.PopupPosition={Bottom:"bottom",Top:"top"}}(jQuery,Syncfusion);__extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r};ejDateRangePicker=function(n){function t(i){return n.call(this),this._rootCSS="e-daterangepicker",this._isApplied=!0,this._setFirst=!1,this.PluginName="ejDateRangePicker",this.id="myDateRange",this._addToPersist=["value"],this.type="editor",this.angular={require:["?ngModel","^?form","^?ngModelOptions"],requireFormatters:!0},this._requiresID=!0,this.model=null,this.validTags=["input"],this.defaults={height:"",width:"",isResponsive:!1,value:"",cssClass:"",enabled:!0,startDate:null,endDate:null,enableTimePicker:!1,backwardSelection:!1,minDate:new Date("01/01/1900"),maxDate:new Date("12/31/2099"),ranges:null,locale:"en-US",separator:"-",watermarkText:"Select Range",dateFormat:"",timeFormat:"",showPopupButton:!0,showRoundedCorner:!1,allowEdit:!0,enablePersistence:!1,create:null,change:null,beforeClose:null,beforeOpen:null,close:null,open:null,hover:null,click:null,clear:null,destroy:null,select:null,htmlAttributes:{}},this._isIE8=ej.browserInfo().name=="msie"&&ej.browserInfo().version=="8.0"?!0:!1,this._prevValue=null,this._validState=null,t.prototype.observables=["value"],i&&(i.jquery||(i=$("#"+i)),i.length)?$(i).ejDateRangePicker().data(this.PluginName):void 0}return __extends(t,n),t.prototype.setModel=function(n,t){this.setModel(n,t)},t.prototype.option=function(n,t){this.option(n,t)},t.prototype._setModel=function(n){var t,i;for(t in n)switch(t){case"allowEdit":if(!n[t]){this.element.attr("readonly","readonly");this.element.on("mousedown",$.proxy(this._showDatePopUp,this));this.element.off("blur",$.proxy(this._onMainFocusOut,this))}break;case"startDate":i=this._validateValues(n[t],"left");i==!1?n[t]=null:(this._startEndValidation()||this.model.endDate==null||(this._resetValues(),this.model.endDate=null),this._updateValues(),this._selectedStartDate=this.model.startDate,n[t]=this.model.startDate);break;case"endDate":i=this._validateValues(n[t],"right");i==!1?n[t]=null:(this._startEndValidation()||(this._rightDP.element.parents(".e-datewidget").addClass("e-val-error"),this.model.endDate=null),this._updateValues(),n[t]=this.model.endDate);break;case"minDate":this._leftDP&&this._leftDP.option(t,n[t]);this._rightDP&&this._rightDP.option(t,n[t]);this._updateInput();break;case"maxDate":this._leftDP&&this._leftDP.option(t,n[t]);this._rightDP&&this._rightDP.option(t,n[t]);this._updateInput();break;case"enableTimePicker":this.model.enableTimePicker=n[t];n[t]?this._renderTimePicker():this._removeTimePicker();this._scrollerObj&&(this._scrollerObj.model.height=this.datePopup.height(),this._scrollerObj.refresh());break;case"backwardSelection":this.model.backwardSelection=n[t];this._mainValue();break;case"locale":this._setCulture(n[t]);n[t]=this.model.locale;break;case"separator":this.model.separator=n[t];this._mainValue();break;case"dateFormat":this._leftDP&&this._leftDP.option(t,n[t]);this._rightDP&&this._rightDP.option(t,n[t]);this.model.dateFormat=n[t];this._getDateTimeFormat();this._updateInput();break;case"timeFormat":this._leftTP&&this._leftTP.option(t,n[t]);this._rightTP&&this._rightTP.option(t,n[t]);this.model.timeFormat=n[t];this._getDateTimeFormat();this._updateInput();break;case"watermarkText":ej.isNullOrUndefined(this._options)&&(this._options={});this._options.watermarkText=this.model.watermarkText=n[t];this._localizedLabels.watermarkText=this.model.watermarkText;this._setWaterMark();break;case"cssClass":this._changeSkin(n[t]);break;case"showRoundedCorner":this._setRoundedCorner(n[t]);break;case"showPopupButton":this._renderDateIcon(n[t]);break;case"value":this.element.val(n[t]);this._onMainFocusOut();n[t]=this.model.value;break;case"height":this.wrapper.height(n[t]);break;case"width":this.wrapper.width(n[t]);break;case"enabled":n[t]?this.enable():this.disable();break;case"htmlAttributes":this._addAttr(n[t])}},t.prototype._init=function(n){this._cloneElement=this.element.clone();this._options=n;this._flagevents=!1;this._id=this.element.attr("id");this._isSupport=document.createElement("input").placeholder==undefined?!1:!0;this._startEndValidation()||(this.model.endDate=null);this.element.val()==""&&this.model.value&&this.element.val(this.model.value);this._getDateTimeFormat();this.element.val()?(this._setInitValue(),this._updateValues()):this.model.startDate!=null&&this.model.endDate!=null&&this._startEndValidation()&&(this._updateValues(),this._mainValue());this._prevStartDate=this.model.startDate;this._prevEndDate=this.model.endDate;this._createWrapper();this.renderpopup();this._setLocalizedText();this._validState==!1&&this.element.val()&&this.wrapper.addClass("e-error");this._popupOpen=!1;this._isPopScroll=!1;this.model.enabled||this.disable();this._wireEvents();this.model.startDate&&!this._selectedStartDate&&(this._selectedStartDate=this.model.startDate);this.model.endDate&&!this._selectedEndDate&&(this._selectedEndDate=this.model.endDate)},t.prototype._setInitValue=function(){var n=this.element.val().split(this.model.separator),t=ej.parseDate(n[0],this._dateTimeFormat,this.model.locale),i=ej.parseDate(n[1],this._dateTimeFormat,this.model.locale);t&&i&&(this.model.startDate=t,this.model.endDate=i);(this.model.startDatenew Date(this.model.maxDate))&&(this.model.startDate=new Date(this.model.minDate));(this.model.endDate>new Date(this.model.maxDate)||this.model.endDatenew Date(this.model.maxDate)&&(t=new Date(t.setMonth(i))),new Date(this.model.minDate).getFullYear()==new Date(this.model.maxDate).getFullYear()&&new Date(this.model.minDate).getMonth()==new Date(this.model.maxDate).getMonth()&&(t=new Date(t.setDate(new Date(this.model.minDate).getDate()))),t):new Date},t.prototype._getDateTimeFormat=function(){var n=ej.preferredCulture(this.model.locale).calendars.standard.patterns;this.model.dateFormat||(this.model.dateFormat=n.d);this.model.enableTimePicker?(this.model.timeFormat||(this.model.timeFormat=n.t),this._dateTimeFormat=this.model.dateFormat+" "+this.model.timeFormat):this._dateTimeFormat=this.model.dateFormat},t.prototype._setValues=function(){this._leftDP.option("value",this.model.startDate);this._rightDP.option("value",this.model.endDate||null);this.model.startDate&&this._setStartDate(this.model.startDate,$('.current-month[data-date="'+this.model.startDate.toDateString()+'"]'),!0);this.model.endDate&&this._setEndDate(this.model.endDate,$('.current-month[data-date="'+this.model.endDate.toDateString()+'"]'),!0);this._rangeRefresh(this._setArgs(this._leftDP.popup));this._rangeRefresh(this._setArgs(this._rightDP.popup));this._rightDP.element.parents(".e-datewidget").removeClass("e-error");this.model.enableTimePicker&&(this._leftTP.option("value",this.model.startDate),this._rightTP.option("value",this.model.endDate));this._updateRanges("left");this._updateRanges("right")},t.prototype._customSet=function(){this._selectedStartDate=this.model.startDate;this._selectedEndDate=this.model.endDate;this._resetValues();this.popup&&this.datePopup&&this._setValues();this._popupOpen||this._mainValue();this._refreshMinMax();this._setWaterMark()},t.prototype._setCulture=function(n){n=ej.preferredCulture(n).name;this.model.locale=n;this._setOption("locale",n);this._localizedLabels=this._getLocalizedLabels();this._setLocalizedText();this._updateInput()},t.prototype._setRoundedCorner=function(n){n?(this._input_innerWrapper.addClass("e-corner"),this.popup&&this.popup.addClass("e-corner")):(this._input_innerWrapper.removeClass("e-corner"),this.popup&&this.popup.removeClass("e-corner"));this._setOption("showRoundedCorner",n)},t.prototype._renderDateIcon=function(n){n?(this.dateRangeIcon=ej.buildTag("span.e-select#"+this.id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(ej.buildTag("span.e-icon e-calendar","",{},{"aria-label":"Select"}).attr(this._isIE8?{unselectable:"on"}:{})).insertAfter(this.element),this._input_innerWrapper.addClass("e-padding"),this._on(this.dateRangeIcon,"mousedown",this._showDatePopUp),this._off(this.dateRangeIcon,"click",this._showDatePopUp)):(this.dateRangeIcon&&this.dateRangeIcon.remove(),this._input_innerWrapper.removeClass("e-padding"),this._off(this.dateRangeIcon,"click",this._showDatePopUp))},t.prototype._validateValues=function(n,t,i){var e=t=="right"?this._rightDP:this._leftDP,f=t=="right"?this._rightTP:this._leftTP,r,u;if(i){if(f&&f._preVal&&f._preVal==n)return!0}else if(t=="left"&&e&&this._selectedStartDate&&this._selectedStartDate.getFullYear()==new Date(n).getFullYear()&&this._selectedStartDate.getMonth()==new Date(n).getMonth()&&this._selectedStartDate.getDate()==new Date(n).getDate()&&this._selectedStartDate.getHours()==new Date(n).getHours()&&this._selectedStartDate.getMinutes()==new Date(n).getMinutes()||t=="right"&&e&&this._selectedEndDate&&this._selectedEndDate.getFullYear()==new Date(n).getFullYear()&&this._selectedEndDate.getMonth()==new Date(n).getMonth()&&this._selectedEndDate.getDate()==new Date(n).getDate()&&this._selectedEndDate.getHours()==new Date(n).getHours()&&this._selectedEndDate.getMinutes()==new Date(n).getMinutes())return!0;if(r=n,r!=null&&typeof r=="string")t=="left"?(this.model.enableTimePicker?i?(u=ej.format(this._leftDP.model.value,this.model.dateFormat,this.model.locale),this.model.startDate=ej.parseDate(u+" "+n,this.model.dateFormat+" "+this.model.timeFormat,this.model.locale)||null):this.model.startDate=ej.parseDate(n+" "+this._leftTP.model.value,this.model.dateFormat+" "+this.model.timeFormat,this.model.locale)||null:this.model.startDate=ej.parseDate(n,this.model.dateFormat,this.model.locale)||null,this.model.startDate=this.model.startDate!=null?this.model.startDate:new Date(r)):(this.model.enableTimePicker?i?(u=ej.format(this._rightDP.model.value,this.model.dateFormat,this.model.locale),this.model.endDate=ej.parseDate(u+" "+n,this.model.dateFormat+" "+this.model.timeFormat,this.model.locale)||null):this.model.endDate=ej.parseDate(n+" "+this._rightTP.model.value,this.model.dateFormat+" "+this.model.timeFormat,this.model.locale)||null:this.model.endDate=ej.parseDate(n,this.model.dateFormat,this.model.locale)||null,this.model.endDate=this.model.endDate!=null?this.model.endDate:new Date(r));else if(n instanceof Date){if(t=="left"){if(this.model.startDate=n,isNaN(n.getDate()))return!1;typeof this._formatter(this.model.startDate,this.model.locale)!="string"&&(this.model.startDate=ej.parseDate(this._formatter(this.model.startDate,this.model.locale),this.model.dateFormat))}else if(t=="right"){if(this.model.endDate=n,isNaN(n.getDate()))return!1;typeof this._formatter(this.model.endDate,this.model.locale)!="string"&&(this.model.endDate=ej.parseDate(this._formatter(this.model.endDate,this.model.locale),this.model.dateFormat))}}else return!1;return!0},t.prototype._formatter=function(n,t){var i=this._checkFormat(t);return ej.format(n,i,this.model.locale)},t.prototype._checkFormat=function(n){var t=this,i=this._regExp();return n.replace(i,function(n){return n==="/"?ej.preferredCulture(t.model.locale).calendars.standard["/"]!=="/"?"'/'":n:n})},t.prototype._regExp=function(){return/\/dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|gg|g|"[^"]*"|'[^']*'|[/]/g},t.prototype._setArgs=function(n){var t=new Date($(n.find(".current-month")[0]).attr("data-date"));return this.args={},this.args.element=n,this.args.month=t.getMonth(),this.args.year=t.getFullYear(),this.args},t.prototype._changeSkin=function(n){this.wrapper.removeClass(this.model.cssClass).addClass(n);this.popup.removeClass(this.model.cssClass).addClass(n);this._setOption("cssClass",n)},t.prototype._renderDatePicker=function(){this.calendar_left=ej.buildTag("input.leftDate_wrapper#"+this.element[0].id+"leftDate_wrapper","",{},{type:"text"});this._leftDiv.append(this.calendar_left);this.calendar_right=ej.buildTag("input.rightDate_wrapper#"+this.element[0].id+"rightDate_wrapper","",{},{type:"text"});this._rightDiv.append(this.calendar_right);var n=this,t={displayInline:!0,showFooter:!1,watermarkText:"",enableStrictMode:!0,locale:this.model.locale,dateFormat:this.model.dateFormat,_month_Loaded:function(t){n._previousNextHandler(t)},focusOut:function(t){t.prevDate!=t.value&&(n._isApplied=!1)},enablePersistence:this.model.enablePersistence,minDate:this.model.minDate,maxDate:this.model.maxDate};this.calendar_left.ejDatePicker(t);this.calendar_left.ejDatePicker("option","layoutChange",function(){n._refreshEvents("left");n._updateRanges("left");n.popup.hasClass("e-daterange-responsive")||n._scrollerObj&&(n._scrollerObj.model.height=n.datePopup.height(),n._scrollerObj.refresh())});this._leftDP=this.calendar_left.data("ejDatePicker");this._leftDP.option("showPopupButton",!1);this._leftDP._getInternalEvents=!0;this._leftDP._DRPdisableFade=!0;this._leftDP.popup.css({position:"static",visibility:"inherit"});this.calendar_right.ejDatePicker(t);this.calendar_right.ejDatePicker("option","layoutChange",function(){n._refreshEvents("right");n._updateRanges("right");n.popup.hasClass("e-daterange-responsive")||n._scrollerObj&&(n._scrollerObj.model.height=n.datePopup.height(),n._scrollerObj.refresh())});this.calendar_left.ejDatePicker("option","_setAriaAttribute",function(t){$(n.element).attr("aria-activedescendant",t.attr("id"))});this.calendar_right.ejDatePicker("option","_setAriaAttribute",function(t){$(n.element).attr("aria-activedescendant",t.attr("id"))});this._rightDP=this.calendar_right.data("ejDatePicker");this._rightDP.option("showPopupButton",!1);this._rightDP._getInternalEvents=!0;this._rightDP._DRPdisableFade=!0;this._rightDP.popup.css({position:"static",visibility:"inherit"});this._on($(this._leftDP.sfCalendar.find("table .e-datepicker-months td")),"click",$.proxy(this._previousNextHandler,this));this._on(this._leftDP.element,"keydown",this._onKeyDown);this._on(this._rightDP.element,"keydown",this._onKeyDown)},t.prototype._renderPopup=function(){this.popup||(this.popup=ej.buildTag("div.e-daterangepicker-popup e-popup e-widget e-box"+this.model.cssClass+"#"+this.element[0].id+"_popup").css("display","none"),$("body").append(this.popup));this.datePopup=ej.buildTag("div.e-datepickers-popup");this.popup.append(this.datePopup);this._leftDiv=ej.buildTag("div.e-left-datepicker");this._rightDiv=ej.buildTag("div.e-right-datepicker");this.datePopup.append(this._leftDiv);this.datePopup.append(this._rightDiv);this._renderDatePicker();this.model.ranges&&!this._customRangePicker&&this._renderRanges();this.model.enableTimePicker&&this._renderTimePicker();this._renderButton();this._bindDateButton();this._refreshEvents("left");this._refreshEvents("right");this._updateRanges("left");this._updateRanges("right");this._setRoundedCorner(this.model.showRoundedCorner);this._addAttr(this.model.htmlAttributes);this._on(this.popup.find(".leftDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".rightDate_wrapper.e-datepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".leftTime.e-timepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this._on(this.popup.find(".rightTime.e-timepicker.e-js.e-input"),"blur",this._onPopupFocusOut);this.popup.on("mouseenter touchstart",$.proxy(function(){this._isPopScroll=!0},this));this.popup.on("mouseleave touchend",$.proxy(function(){this._isPopScroll=!1},this));this._on($(window),"resize",this._resizePopup);this._wirePopupEvents()},t.prototype._createWrapper=function(){var n;this._localizedLabels=this._getLocalizedLabels();this.element.addClass("e-input").attr({"aria-atomic":"true","aria-live":"assertive",tabindex:"0",role:"combobox","aria-expanded":"false",name:this.element.attr("name")==undefined?this._id:this.element.attr("name")});this.wrapper=ej.buildTag("span.e-daterangewidget e-widget "+this.model.cssClass);ej.isTouchDevice()||this.wrapper.addClass("e-ntouch");this._input_innerWrapper=ej.buildTag("span.e-in-wrap e-box");this.wrapper.append(this._input_innerWrapper).insertBefore(this.element);this._input_innerWrapper.append(this.element);this._input_innerWrapper.addClass("e-padding");n=this;this.culture=ej.preferredCulture(this.model.locale);this._setRoundedCorner(this.model.showRoundedCorner);this._renderDateIcon(this.model.showPopupButton);this._isSupport||(this._hiddenInput=ej.buildTag("input.e-input e-placeholder ","",{},{type:"text"}).insertAfter(this.element),this._hiddenInput.val(this._localizedLabels.watermarkText),this._hiddenInput.css("display","block"),n=this,$(this._hiddenInput).focus(function(){n.element.focus()}));this.wrapper&&(this.model.width&&this.wrapper.width(this.model.width),this.model.height&&this.wrapper.height(this.model.height));this._setWaterMark()},t.prototype._updateOnRender=function(){this.model.enableTimePicker?this._rightTime&&(this._rightTP=this._rightTime.ejTimePicker("instance"),this._updateValues()):this.calendar_right&&(this._rightDP=this.calendar_right.ejDatePicker("instance"),this._updateValues())},t.prototype._updateRangesList=function(){$(".e-dateranges-ul").find(".rangeItem.e-active").removeClass("e-active");$(".e-dateranges-ul").find(".rangeItem.e-custompic").addClass("e-active")},t.prototype._updateValues=function(){this._updateRangesList();this._getDateTimeFormat();this._startEndValidation()||this.model.startDate!=null&&this.model.endDate!=null?(this._validateValues(this.model.startDate,"left"),this._validateValues(this.model.endDate,"right"),this.popup&&this.datePopup&&this._setValues(),this._mainValue()):(this._clearRanges(),this.element.val(""));this._refreshMinMax();this._setWaterMark()},t.prototype._startEndValidation=function(){if(this.model.startDate&&this.model.endDate){var t=this.model.startDate,n=this.model.endDate;return!(n&&t>n)}return!1},t.prototype._addAttr=function(n){var t=this;$.map(n,function(n,i){var r=i.toLowerCase();r=="class"?t.wrapper.addClass(n):r=="disabled"?t.disable():r=="readOnly"?t.model.readOnly=!0:r=="style"||r=="id"?t.wrapper.attr(i,n):ej.isValidAttr(t.element[0],i)?t.element.attr(i,n):t.wrapper.attr(i,n)})},t.prototype._renderButton=function(){var n;this._buttonDiv=ej.buildTag("div.e-drpbuttons");var t=ej.buildTag("div.e-drp-button e-drp-reset e-btn e-select e-flat").attr({tabindex:"0"}),i=ej.buildTag("div.e-drp-button e-drp-apply e-disable e-btn e-select e-flat").attr({tabindex:"0"}),r=ej.buildTag("div.e-drp-button e-drp-cancel e-btn e-select e-flat").attr({tabindex:"0"});this._buttonDiv.append(t);this._buttonDiv.append(i);this._buttonDiv.append(r);this.popup.append(this._buttonDiv);this._setLocalizedText();this._on($(this._buttonDiv.find("div.e-drp-reset")),"click",this.clearRanges);n=this;this._on($(this._buttonDiv.find("div.e-drp-apply")),"click",function(){n._buttonDiv.find(".e-drp-apply").hasClass("e-disable")||(this._isApplied=!0,n._isPopScroll=!1,n._updateInput(),n._showhidePopup(),n._buttonDiv.find(".e-drp-apply").addClass("e-disable"),this._prevStartDate=this.model.startDate,this._prevEndDate=this.model.endDate,this._trigger("change",{value:this.model.value,startDate:this.model.startDate,endDate:this.model.endDate}),this._trigger("select",{startDate:this.model.startDate,endDate:this.model.endDate,value:this.model.value}))});this._on($(this._buttonDiv.find("div.e-drp-cancel")),"click",this._cancelButton)},t.prototype._setLocalizedText=function(){ej.isNullOrUndefined(this._options)||(ej.isNullOrUndefined(this._options.buttonText)||$.extend(this._localizedLabels.ButtonText,this._options.buttonText),ej.isNullOrUndefined(this._options.watermarkText)||(this._localizedLabels.watermarkText=this._options.watermarkText));this.model.buttonText=this._localizedLabels.ButtonText;this._buttonDiv&&($(this._buttonDiv.find("div.e-drp-reset")).text(this.model.buttonText.reset),$(this._buttonDiv.find("div.e-drp-apply")).text(this.model.buttonText.apply),$(this._buttonDiv.find("div.e-drp-cancel")).text(this.model.buttonText.cancel));this._customRangePicker&&this._customRangePicker.find("ul li.e-custompic").length>0&&this._customRangePicker.find("ul li.e-custompic").text(this._localizedLabels.customPicker);this._setWaterMark()},t.prototype._renderRanges=function(){var f,i,t,n,r,u;if(this._renderRangesWrapper(),this.popup.append(this._customRangePicker),this._ranges_li="",f=this,this.model.ranges)for(i=0;i"+t.label+"<\/li>"));this._ranges_li+="