text: /*
  jQWidgets v5.1.0 (2017-Aug)
  Copyright (c) 2011-2017 jQWidgets.
  License: http://jqwidgets.com/license/
  */
  !function(t){t.jqx.jqxWidget("jqxNumberInput","",{}),t.extend(t.jqx._jqxNumberInput.prototype,{defineInstance:function(){var e={value:null,decimal:0,min:-99999999,max:99999999,width:200,validationMessage:"Invalid value",height:25,textAlign:"right",readOnly:!1,promptChar:"_",decimalDigits:2,decimalSeparator:".",groupSeparator:",",groupSize:3,symbol:"",symbolPosition:"left",digits:8,negative:!1,negativeSymbol:"-",disabled:!1,inputMode:"advanced",spinButtons:!1,spinButtonsWidth:18,spinButtonsStep:1,autoValidate:!0,spinMode:"advanced",enableMouseWheel:!0,touchMode:"auto",allowNull:!0,placeHolder:"",changeType:null,template:"",rtl:!1,events:["valueChanged","textchanged","mousedown","mouseup","keydown","keyup","keypress","change"],aria:{"aria-valuenow":{name:"decimal",type:"number"},"aria-valuemin":{name:"min",type:"number"},"aria-valuemax":{name:"max",type:"number"},"aria-disabled":{name:"disabled",type:"boolean"}},invalidArgumentExceptions:["invalid argument exception"]};return this===t.jqx._jqxNumberInput.prototype?e:(t.extend(!0,this,e),e)},createInstance:function(t){var e=this.host.attr("value");void 0!=e&&(this.decimal=e),null!=this.value&&(this.decimal=this.value),this._createFromInput("jqxNumberInput"),this.render()},_createFromInput:function(e){var i=this;if("input"==i.element.nodeName.toLowerCase()){i.field=i.element,i.field.className&&(i._className=i.field.className);var s={title:i.field.title};if(i.field.value&&(i.decimal=parseFloat(i.field.value)),i.field.getAttribute("min")){var r=i.field.getAttribute("min");i.min=parseFloat(r)}if(i.field.getAttribute("step")){var a=i.field.getAttribute("step");i.spinButtonsStep=parseFloat(a)}if(i.field.getAttribute("max")){var n=i.field.getAttribute("max");i.max=parseFloat(n)}i.field.id.length?s.id=i.field.id.replace(/[^\w]/g,"_")+"_"+e:s.id=t.jqx.utilities.createId()+"_"+e;var o=t("<div></div>",s);o[0].style.cssText=i.field.style.cssText,i.width||(i.width=t(i.field).width()),i.height||(i.height=t(i.field).outerHeight()),t(i.field).hide().after(o);var h=i.host.data();if(i.host=o,i.host.data(h),i.element=o[0],i.element.id=i.field.id,i.field.id=s.id,i._className&&(i.host.addClass(i._className),t(i.field).removeClass(i._className)),i.field.tabIndex){var l=i.field.tabIndex;i.field.tabIndex=-1,i.element.tabIndex=l}}},_doTouchHandling:function(){var t=this,e=t.savedValue;if(t.parsing||(t.parsing=!0),t.parsing){t.numberInput.val()&&0==t.numberInput.val().indexOf("-")?t.setvalue("negative",!0):t.setvalue("negative",!1);for(var i=t.numberInput.val(),s=0;s<i.length-1;s++){var r=i.substring(s,s+1);if(isNaN(parseFloat(r))&&-1===t.symbol.toString().indexOf(r)&&"%"!=r&&"$"!=r&&"."!=r&&","!=r&&"-"!=r)return t.numberInput[0].value=e,void(t.parsing=!1)}t.ValueString=t.GetValueString(t.numberInput.val(),t.decimalSeparator,""!=t.decimalSeparator),t._parseDecimalInSimpleMode(),t.decimal=t.ValueString,t.getvalue("negative")&&(t.decimal="-"+t.ValueString),t.parsing=!1}},render:function(){this.host.attr({role:"spinbutton"}),this.host.attr("data-role","input"),t.jqx.aria(this),t.jqx.aria(this,"aria-multiline",!1);r=this;(this.officeMode||this.theme&&-1!=this.theme.indexOf("office"))&&18==this.spinButtonsWidth&&(this.spinButtonsWidth=15),(t.jqx.mobile.isTouchDevice()||!0===this.touchMode)&&(this.inputMode="textbox",this.spinMode="simple"),""==this.decimalSeparator&&(this.decimalSeparator=" "),this.host.addClass(this.toThemeProperty("jqx-input")),this.host.addClass(this.toThemeProperty("jqx-rc-all")),this.host.addClass(this.toThemeProperty("jqx-widget")),this.host.addClass(this.toThemeProperty("jqx-widget-content")),this.host.addClass(this.toThemeProperty("jqx-numberinput")),this.spinButtons?this._spinButtons():(this.numberInput=t("<input style='border:none;' autocomplete='off' type='textarea'/>").appendTo(this.host),this.numberInput.addClass(this.toThemeProperty("jqx-input-content")),this.numberInput.addClass(this.toThemeProperty("jqx-widget-content"))),this.numberInput.attr("placeholder",this.placeHolder);var e=this.host.attr("name");e&&this.numberInput.attr("name",e),this.host.attr("tabindex")&&(this.numberInput.attr("tabindex",this.host.attr("tabindex")),this.host.removeAttr("tabindex")),(t.jqx.mobile.isTouchDevice()||!0===this.touchMode||"textbox"==this.inputMode)&&((r=this).savedValue="",this.addHandler(this.numberInput,"focus",function(){r.savedValue=r.numberInput[0].value}),this.addHandler(this.numberInput,"change",function(){r._doTouchHandling()})),t.data(this.host[0],"jqxNumberInput").jqxNumberInput=this;r=this;this.host.parents("form").length>0&&this.addHandler(this.host.parents("form"),"reset",function(){setTimeout(function(){r.setDecimal(0)},10)}),this.propertyChangeMap.disabled=function(t,e,s,r){r?(t.numberInput.addClass(i.toThemeProperty("jqx-input-disabled")),t.numberInput.attr("disabled",!0)):(t.host.removeClass(i.toThemeProperty("jqx-input-disabled")),t.numberInput.attr("disabled",!1)),t.spinButtons&&t.host.jqxRepeatButton&&(t.upbutton.jqxRepeatButton({disabled:r}),t.downbutton.jqxRepeatButton({disabled:r}))},this.disabled&&(this.numberInput.addClass(this.toThemeProperty("jqx-input-disabled")),this.numberInput.attr("disabled",!0),this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"))),this.selectedText="",this.decimalSeparatorPosition=-1;this.element.id,this.element;var i=this;this.oldValue=this._value(),this.items=new Array;this.value;var s=this.decimal;this._initializeLiterals(),this._render(),this.setDecimal(s);var r=this;setTimeout(function(){},100),this._addHandlers(),t.jqx.utilities.resize(this.host,function(){r._render()})},refresh:function(t){t||this._render()},wheel:function(t,e){if(e.enableMouseWheel){e.changeType="mouse";var i=0;if(t||(t=window.event),t.originalEvent&&t.originalEvent.wheelDelta&&(t.wheelDelta=t.originalEvent.wheelDelta),t.wheelDelta?i=t.wheelDelta/120:t.detail&&(i=-t.detail/3),i){var s=e._handleDelta(i);return t.preventDefault&&t.preventDefault(),null!=t.originalEvent&&(t.originalEvent.mouseHandled=!0),void 0!=t.stopPropagation&&t.stopPropagation(),!!s&&(s=!1,t.returnValue=s,s)}t.preventDefault&&t.preventDefault(),t.returnValue=!1}},_handleDelta:function(t){return t<0?this.spinDown():this.spinUp(),!0},_addHandlers:function(){var e=this;this.addHandler(this.numberInput,"paste",function(i){var s=e._selection();i.preventDefault(),i.originalEvent.clipboardData?content=(i.originalEvent||i).clipboardData.getData("text/plain"):window.clipboardData&&(content=window.clipboardData.getData("Text")),this.selectedText=content,t.data(document.body,"jqxSelection",this.selectedText),"simple"!=e.inputMode?e._pasteSelectedText():e.val(content),setTimeout(function(){e._setSelectionStart(s.start)})}),this.addHandler(this.numberInput,"mousedown",function(t){return e._raiseEvent(2,t)}),this._mousewheelfunc=this._mousewheelfunc||function(t){if(!e.editcell)return e.wheel(t,e),!1},this.removeHandler(this.host,"mousewheel",this._mousewheelfunc),this.addHandler(this.host,"mousewheel",this._mousewheelfunc);var i="";this.addHandler(this.numberInput,"focus",function(s){t.data(e.numberInput,"selectionstart",e._selection().start),e.host.addClass(e.toThemeProperty("jqx-fill-state-focus")),e.spincontainer&&e.spincontainer.addClass(e.toThemeProperty("jqx-numberinput-focus")),i=e.numberInput.val(),e._savedValue=e.decimal}),this.addHandler(this.numberInput,"blur",function(s){if("simple"==e.inputMode&&e._exitSimpleInputMode(s,e,!1,i),e.autoValidate){var r=parseFloat(e.decimal);e.getvalue("negative")&&e.decimal>0&&(r=-parseFloat(e.decimal)),r>e.max&&(e._disableSetSelection=!0,e.setDecimal(e.max),e._disableSetSelection=!1),r<e.min&&(e._disableSetSelection=!0,e.setDecimal(e.min),e._disableSetSelection=!1)}return e.host.removeClass(e.toThemeProperty("jqx-fill-state-focus")),e.spincontainer&&e.spincontainer.removeClass(e.toThemeProperty("jqx-numberinput-focus")),e.numberInput.val()!=i&&(e._raiseEvent(7,s),t.jqx.aria(e,"aria-valuenow",e.decimal),e.element.value=e.decimal),!0}),this.addHandler(this.numberInput,"mouseup",function(t){return e._raiseEvent(3,t)}),this.addHandler(this.numberInput,"keydown",function(t){return e.changeType="keyboard",e._raiseEvent(4,t)}),this.addHandler(this.numberInput,"keyup",function(t){return e._raiseEvent(5,t)}),this.addHandler(this.numberInput,"keypress",function(t){return e._raiseEvent(6,t)})},focus:function(){try{this.numberInput.focus()}catch(t){}},_removeHandlers:function(){var e=this;this.removeHandler(this.numberInput,"mousedown"),t.jqx.mobile.isOperaMiniMobileBrowser()&&this.removeHandler(t(document),"click."+this.element.id,e._exitSimpleInputMode,e),this.removeHandler(this.numberInput,"paste"),this.removeHandler(this.numberInput,"focus"),this.removeHandler(this.numberInput,"blur"),this.removeHandler(this.numberInput,"mouseup"),this.removeHandler(this.numberInput,"keydown"),this.removeHandler(this.numberInput,"keyup"),this.removeHandler(this.numberInput,"keypress")},_spinButtons:function(){if(!this.host.jqxRepeatButton)throw new Error("jqxNumberInput: Missing reference to jqxbuttons.js.");this.numberInput?this.numberInput.css("float","left"):(this.numberInput=t("<input autocomplete='off' style='border: none; position: relative; float: left;' type='textarea'/>"),this.numberInput.appendTo(this.host),this.numberInput.addClass(this.toThemeProperty("jqx-input-content")),this.numberInput.addClass(this.toThemeProperty("jqx-widget-content"))),this.spincontainer&&(this.upbutton&&this.upbutton.jqxRepeatButton("destroy"),this.downbutton&&this.downbutton.jqxRepeatButton("destroy"),this.spincontainer.remove()),this.spincontainer=t('<div style="float: right; height: 100%; overflow: hidden; position: relative;"></div>'),this.rtl&&(this.spincontainer.css("float","right"),this.numberInput.css("float","right"),this.spincontainer.css("left","-1px")),this.host.append(this.spincontainer),this.upbutton=t('<div style="overflow: hidden; padding: 0px; margin-left: -1px; position: relative;"><div></div></div>'),this.spincontainer.append(this.upbutton),this.upbutton.jqxRepeatButton({overrideTheme:!0,disabled:this.disabled,roundedCorners:"top-right"}),this.downbutton=t('<div style="overflow: hidden; padding: 0px; margin-left: -1px; position: relative;"><div></div></div>'),this.spincontainer.append(this.downbutton),this.downbutton.jqxRepeatButton({overrideTheme:!0,disabled:this.disabled,roundedCorners:"bottom-right"}),this.template&&(this.upbutton.addClass(this.toThemeProperty("jqx-"+this.template)),this.downbutton.addClass(this.toThemeProperty("jqx-"+this.template)));e=this;this.downbutton.addClass(this.toThemeProperty("jqx-fill-state-normal jqx-action-button")),this.upbutton.addClass(this.toThemeProperty("jqx-fill-state-normal jqx-action-button")),this.upbutton.addClass(this.toThemeProperty("jqx-rc-tr")),this.downbutton.addClass(this.toThemeProperty("jqx-rc-br")),this.addHandler(this.downbutton,"mouseup",function(t){e.disabled||(e.downbutton.removeClass(e.toThemeProperty("jqx-fill-state-pressed")),e._downArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-down-selected")))}),this.addHandler(this.upbutton,"mouseup",function(t){e.disabled||(e.upbutton.removeClass(e.toThemeProperty("jqx-fill-state-pressed")),e._upArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-up-selected")))}),this.removeHandler(t(document),"mouseup."+this.element.id),this.addHandler(t(document),"mouseup."+this.element.id,function(t){e.upbutton.removeClass(e.toThemeProperty("jqx-fill-state-pressed")),e._upArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-up-selected")),e.downbutton.removeClass(e.toThemeProperty("jqx-fill-state-pressed")),e._downArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-down-selected"))}),this.addHandler(this.downbutton,"mousedown",function(i){if(!e.disabled)return t.jqx.browser.msie&&t.jqx.browser.version<9&&(e._inputSelection=e._selection()),e.downbutton.addClass(e.toThemeProperty("jqx-fill-state-pressed")),e._downArrow.addClass(e.toThemeProperty("jqx-icon-arrow-down-selected")),i.preventDefault(),i.stopPropagation(),!1}),this.addHandler(this.upbutton,"mousedown",function(i){if(!e.disabled)return t.jqx.browser.msie&&t.jqx.browser.version<9&&(e._inputSelection=e._selection()),e.upbutton.addClass(e.toThemeProperty("jqx-fill-state-pressed")),e._upArrow.addClass(e.toThemeProperty("jqx-icon-arrow-up-selected")),i.preventDefault(),i.stopPropagation(),!1}),this.addHandler(this.upbutton,"mouseenter",function(t){e.upbutton.addClass(e.toThemeProperty("jqx-fill-state-hover")),e._upArrow.addClass(e.toThemeProperty("jqx-icon-arrow-up-hover"))}),this.addHandler(this.upbutton,"mouseleave",function(t){e.upbutton.removeClass(e.toThemeProperty("jqx-fill-state-hover")),e._upArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-up-hover"))}),this.addHandler(this.downbutton,"mouseenter",function(t){e.downbutton.addClass(e.toThemeProperty("jqx-fill-state-hover")),e._downArrow.addClass(e.toThemeProperty("jqx-icon-arrow-down-hover"))}),this.addHandler(this.downbutton,"mouseleave",function(t){e.downbutton.removeClass(e.toThemeProperty("jqx-fill-state-hover")),e._downArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-down-hover"))}),this.upbutton.css("border-width","0px"),this.downbutton.css("border-width","0px"),this.disabled?(this.upbutton[0].disabled=!0,this.downbutton[0].disabled=!0):(this.upbutton[0].disabled=!1,this.downbutton[0].disabled=!1),this.spincontainer.addClass(this.toThemeProperty("jqx-input")),this.spincontainer.addClass(this.toThemeProperty("jqx-rc-r")),this.spincontainer.css("border-width","0px"),this.rtl?this.spincontainer.css("border-right-width","1px"):this.spincontainer.css("border-left-width","1px"),this._upArrow=this.upbutton.find("div"),this._downArrow=this.downbutton.find("div"),this._upArrow.addClass(this.toThemeProperty("jqx-icon-arrow-up")),this._downArrow.addClass(this.toThemeProperty("jqx-icon-arrow-down")),this._upArrow.addClass(this.toThemeProperty("jqx-input-icon")),this._downArrow.addClass(this.toThemeProperty("jqx-input-icon"));var e=this;this._upArrow.hover(function(){e.disabled||e._upArrow.addClass(e.toThemeProperty("jqx-icon-arrow-up-hover"))},function(){e._upArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-up-hover"))}),this._downArrow.hover(function(){e.disabled||e._downArrow.addClass(e.toThemeProperty("jqx-icon-arrow-down-hover"))},function(){e._downArrow.removeClass(e.toThemeProperty("jqx-icon-arrow-down-hover"))});var i=t.jqx.mobile.isTouchDevice(),s="click";i&&(s=t.jqx.mobile.getTouchEventName("touchstart")),i&&(this.addHandler(this.downbutton,"click",function(t){e.spinDown()}),this.addHandler(this.upbutton,"click",function(t){e.spinUp()})),this.addHandler(this.downbutton,s,function(s){return i?(s.preventDefault(),s.stopPropagation()):(0==e._selection().start&&e._setSelectionStart(e.numberInput.val().length),t.jqx.browser.msie&&t.jqx.browser.version<9&&e._setSelectionStart(e._inputSelection.start)),e.spinDown(),!1}),this.addHandler(this.upbutton,s,function(s){return i?(s.preventDefault(),s.stopPropagation()):(0==e._selection().start&&e._setSelectionStart(e.numberInput.val().length),t.jqx.browser.msie&&t.jqx.browser.version<9&&e._setSelectionStart(e._inputSelection.start)),e.spinUp(),!1})},spinDown:function(){var e=this,i=this.decimal;if("none"!=e.spinMode)if(null!=this.decimal){var s=(v=this.getvalue("negative"))?-1:0;if((t.jqx.mobile.isTouchDevice()||"textbox"==this.inputMode)&&e._doTouchHandling(),!e.disabled){var r=this._selection(),a=this.decimal;if((l=this.getDecimal())<this.min)return l=this.min,this.setDecimal(this.min),this._setSelectionStart(r.start),void this.spinDown();if(l>this.max)return l=this.max,this.setDecimal(this.max),this._setSelectionStart(r.start),void this.spinDown();e.spinButtonsStep<0&&(e.spinButtonsStep=1);var n=parseInt(e.decimal)-e.spinButtonsStep,o=s+(n=n.toString().length)<=e.digits;if("advanced"!=e.spinMode){if(l-e.spinButtonsStep>=e.min&&o){u=1;for(p=0;p<e.decimalDigits;p++)u*=10;g=u*l-u*e.spinButtonsStep;g/=u,g=this._parseDecimalValueToEditorValue(g),e.setDecimal(g)}}else{var h=this._getspindecimal(),l=(this._getSeparatorPosition(),parseFloat(h.decimal));e.spinButtonsStep<0&&(e.spinButtonsStep=1);var o=s+(n=(n=parseInt(l)-e.spinButtonsStep).toString().length)<=e.digits,u=1,d=h.decimal.indexOf(".");if(-1!=d){for(var c=h.decimal.length-d-1,u=1,p=0;p<c;p++)u*=10;-1==(d=(l=(l-=new Number(e.spinButtonsStep/u)).toFixed(c)).toString().indexOf("."))&&(l=l.toString()+".");var m=l.toString()+h.afterdecimal;(m=(m=new Number(m)).toFixed(e.decimalDigits))>=e.min&&(m=this._parseDecimalValueToEditorValue(m),e.setDecimal(m))}else if(l-e.spinButtonsStep>=e.min&&o){var g=u*l-u*e.spinButtonsStep;(m=(g/=u).toString()+h.afterdecimal)>=e.min&&(m=this._parseDecimalValueToEditorValue(m),e.setDecimal(m))}}if(void 0==m||"simple"!=this.inputMode)return this._setSelectionStart(r.start),e.savedValue=e.numberInput[0].value,i!=this.decimal&&(t.jqx.mobile.isTouchDevice()&&this._raiseEvent(0,{}),this._raiseEvent(7,{})),void t.jqx.aria(self,"aria-valuenow",this.decimal);m=this.decimal.toString();var v=this.getvalue("negative");0==s&&v?this._setSelectionStart(r.start+1):void 0==m||void 0!=a&&a.toString().length!=m.length?v?this._setSelectionStart(r.start+1):this._setSelectionStart(r.start-1):this._setSelectionStart(r.start),i!=this.decimal&&(t.jqx.mobile.isTouchDevice()&&this._raiseEvent(0,{}),this._raiseEvent(7,{})),t.jqx.aria(self,"aria-valuenow",this.decimal)}}else this.setDecimal(0)},_getspindecimal:function(){var t=this._selection(),e="",i=(this._getSeparatorPosition(),this._getVisibleItems()),s=this._getHiddenPrefixCount(),r=this.numberInput.val();this.numberInput.val().length==t.start&&0==t.length&&(this._setSelection(t.start,t.start+1),t=this._selection());for(var a="advanced"!=this.inputMode,n=0;n<t.start;n++)if(a){h=r.substring(n,n+1);(l=!isNaN(parseInt(h)))&&(e+=h),h==this.decimalSeparator&&(e+=h)}else i[n].canEdit&&i[n].character!=this.promptChar?e+=i[n].character:i[n].canEdit||-1==this.decimalSeparatorPosition||i[n]!=i[this.decimalSeparatorPosition-s]||(0==e.length&&(e="0"),e+=i[n].character);for(var o="",n=t.start;n<i.length;n++)if(a){var h=r.substring(n,n+1),l=!isNaN(parseInt(h));l&&(o+=h),h==this.decimalSeparator&&(o+=h)}else i[n].canEdit&&i[n].character!=this.promptChar?o+=i[n].character:i[n].canEdit||-1==this.decimalSeparatorPosition||i[n]!=i[this.decimalSeparatorPosition-s]||(o+=i[n].character);return{decimal:this.getvalue("negative")?"-"+this._parseDecimalValue(e).toString():this._parseDecimalValue(e).toString(),afterdecimal:this._parseDecimalValue(o)}},_parseDecimalValue:function(t){if("."!=this.decimalSeparator){var e=t.toString().indexOf(this.decimalSeparator);if(e>=0)return t.toString().substring(0,e)+"."+t.toString().substring(e+1)}return t},_parseDecimalValueToEditorValue:function(t){if("."!=this.decimalSeparator){var e=t.toString().indexOf(".");if(e>=0)return t.toString().substring(0,e)+this.decimalSeparator+t.toString().substring(e+1)}return t},spinUp:function(){var e=this,i=this.decimal;if("none"!=e.spinMode)if(null!=this.decimal){(t.jqx.mobile.isTouchDevice()||"textbox"==this.inputMode)&&e._doTouchHandling();var s=(f=this.getvalue("negative"))?-1:0;if(!e.disabled){var r=this._selection(),a=e.decimal;if((d=e.getDecimal())<this.min)return d=this.min,this.setDecimal(this.min),this._setSelectionStart(r.start),void this.spinUp();if(d>this.max)return d=this.max,this.setDecimal(this.max),this._setSelectionStart(r.start),void this.spinUp();e.spinButtonsStep<0&&(e.spinButtonsStep=1);var n=parseInt(e.decimal)+e.spinButtonsStep,o=s+(n=n.toString().length)<=e.digits;if("advanced"!=e.spinMode){if(d+e.spinButtonsStep<=e.max&&o){for(var h=1,l=0;l<e.decimalDigits;l++)h*=10;m=h*d+h*e.spinButtonsStep;m/=h,m=this._parseDecimalValueToEditorValue(m),e.setDecimal(m)}}else{var u=this._getspindecimal(),d=(this._getSeparatorPosition(),parseFloat(u.decimal));e.spinButtonsStep<0&&(e.spinButtonsStep=1);var o=s+(n=(n=parseInt(d)+e.spinButtonsStep).toString().length)<=e.digits,h=1,c=u.decimal.indexOf(".");if(-1!=c){for(var p=u.decimal.length-c-1,h=1,l=0;l<p;l++)h*=10;-1==(c=(d=(d+=new Number(e.spinButtonsStep/h)).toFixed(p)).toString().indexOf("."))&&(d=d.toString()+".");g=d.toString()+u.afterdecimal;g=(g=new Number(g)).toFixed(e.decimalDigits),(v=new Number(g).toFixed(e.decimalDigits))<=e.max?(g=this._parseDecimalValueToEditorValue(g),e.setDecimal(g)):g=void 0}else if(d+e.spinButtonsStep<=e.max&&o){var m=h*d+h*e.spinButtonsStep,g=(m/=h).toString()+u.afterdecimal,v=new Number(g).toFixed(e.decimalDigits);v<=e.max?(g=this._parseDecimalValueToEditorValue(g),f&&-1==g.indexOf("-")&&"-0"!=u.decimal&&(g="-"+g),e.setDecimal(g)):g=void 0}}if(void 0==g||"simple"!=this.inputMode)return this._setSelectionStart(r.start),e.savedValue=e.numberInput[0].value,i!=this.decimal&&(t.jqx.mobile.isTouchDevice()&&this._raiseEvent(0,{}),this._raiseEvent(7,{})),void t.jqx.aria(self,"aria-valuenow",this.decimal);g=this.decimal.toString();var f=this.getvalue("negative");-1!=s||f?void 0==g||void 0!=a&&a.toString().length!=g.length?f?this._setSelectionStart(r.start):this._setSelectionStart(1+r.start):this._setSelectionStart(r.start):this._setSelectionStart(-1+r.start),i!=this.decimal&&(t.jqx.mobile.isTouchDevice()&&this._raiseEvent(0,{}),this._raiseEvent(7,{})),t.jqx.aria(self,"aria-valuenow",this.decimal)}}else this.setDecimal(0)},_exitSimpleInputMode:function(e,i,s,r){if(void 0==i&&(i=e.data),null!=i){if(void 0==s){if(null!=e.target&&null!=i.element&&(void 0!=e.target.id&&e.target.id.toString().length>0&&i.host.find("#"+e.target.id).length>0||e.target==i.element))return;var a=i.host.offset(),n=a.left,o=a.top,h=i.host.width(),l=i.host.height(),u=t(e.target).offset();if(u.left>=n&&u.left<=n+h&&u.top>=o&&u.top<=o+l)return}if(t.jqx.mobile.isOperaMiniBrowser()&&i.numberInput.attr("readonly",!0),!i.disabled&&!i.readOnly&&null!=t.data(i.numberInput,"simpleInputMode"))return t.data(i.numberInput,"simpleInputMode",null),this._parseDecimalInSimpleMode(),!1}},_getDecimalInSimpleMode:function(){e=this.decimal;if("."!=this.decimalSeparator){var t=e.toString().indexOf(this.decimalSeparator);if(t>0)var e=e.toString().substring(0,t)+"."+e.toString().substring(t+1)}return e},_parseDecimalInSimpleMode:function(t){var e=this,i=e.getvalue("negative"),s=this.ValueString;if(void 0==s&&(s=this.GetValueString(this.numberInput.val(),this.decimalSeparator,""!=this.decimalSeparator)),"."!=this.decimalSeparator){var r=s.toString().indexOf(".");r>0&&(s=s.toString().substring(0,r)+this.decimalSeparator+s.toString().substring(r+1))}var a=i?"-":"";"left"==this.symbolPosition&&(a+=this.symbol);var n=this.digits%this.groupSize;0==n&&(n=this.groupSize);var o=s.toString();o.indexOf("-")>=0&&(o=o.substring(o.indexOf("-")+1)),a+=o,"right"==this.symbolPosition&&(a+=this.symbol),0!=t&&e.numberInput.val(a)},_enterSimpleInputMode:function(e,i){void 0==i&&(i=e.data);var s=this._selection();if(null!=i){var r=i.getvalue("negative"),a=i.decimal;r&&a>0&&(a=-a),i.numberInput.val(a),t.data(i.numberInput,"simpleInputMode",!0),t.jqx.mobile.isOperaMiniBrowser()&&i.numberInput.attr("readonly",!1),this._parseDecimalInSimpleMode(),this._setSelectionStart(s.start)}},setvalue:function(t,e){void 0!==this[t]&&("decimal"==t?this._setDecimal(e):(this[t]=e,this.propertyChangedHandler(this,t,e,e)))},getvalue:function(t){return"decimal"==t&&void 0!=this.negative&&1==this.negative?-Math.abs(this[t]):t in this?this[t]:null},_getString:function(){for(var t="",e=0;e<this.items.length;e++)t+=this.items[e].character;return t},_literal:function(t,e,i,s){return{character:t,regex:e,canEdit:i,isSeparator:s}},_initializeLiterals:function(){if("textbox"!=this.inputMode){for(var t=0,e=this.negativeSymbol.length,i=0;i<e;i++){var s=this.negativeSymbol.substring(i,i+1),r="",a=!1,n=null;n=this.negative?this._literal(s,r,a,!1):this._literal("",r,a,!1),this.items[t]=n,t++}var o=this.symbol.length;if("left"==this.symbolPosition)for(i=0;i<o;i++){var s=this.symbol.substring(i,i+1),r="",a=!1,n=this._literal(s,r,a,!1);this.items[t]=n,t++}var h=this.digits%this.groupSize;0==h&&(h=this.groupSize);for(i=0;i<this.digits;i++){var s=this.promptChar,r="\\d",a=!0,n=this._literal(s,r,a,!1);if(this.items[t]=n,t++,i<this.digits-1&&void 0!=this.groupSeparator&&this.groupSeparator.length>0){if(0==--h){h=this.groupSize;var l=this._literal(this.groupSeparator,"",!1,!1);this.items[t]=l,t++}}else i==this.digits-1&&(n.character=0)}if(this.decimalSeparatorPosition=-1,void 0!=this.decimalDigits&&this.decimalDigits>0){0==(s=this.decimalSeparator).length&&(s=".");n=this._literal(s,"",!1,!0);this.items[t]=n,this.decimalSeparatorPosition=t,t++;for(i=0;i<this.decimalDigits;i++){var r="\\d",u=this._literal(0,r,!0,!1);this.items[t]=u,t++}}if("right"==this.symbolPosition)for(i=0;i<o;i++){var s=this.symbol.substring(i,i+1),r="",a=!1,n=this._literal(s,r,a);this.items[t]=n,t++}}},_match:function(t,e){return new RegExp(e,"i").test(t)},_raiseEvent:function(e,i){var s=this.events[e],r={};if(r.owner=this,"none"==this.host.css("display"))return!0;var a=i.charCode?i.charCode:i.keyCode?i.keyCode:0,n=!0,o=this.readOnly,h=this;if((3==e||2==e)&&!this.disabled){if("simple"==this.inputMode||"textbox"==this.inputMode)return!0;this._handleMouse(i)}if(0==e){var l=this.getvalue("decimal");this.max<l||this.min>l?this.host.addClass(this.toThemeProperty("jqx-input-invalid")):(this.host.removeClass(this.toThemeProperty("jqx-input-invalid")),this.host.addClass(this.toThemeProperty("jqx-input")),this.host.addClass(this.toThemeProperty("jqx-rc-all")))}var u=new t.Event(s);u.owner=this,r.value=this.getvalue("decimal"),r.text=this.numberInput.val(),u.args=r,7==e&&(r.type=this.changeType,this.changeType=null),void 0!=s&&4!=e&&5!=e&&6!=e&&(n=this.host.trigger(u));h=this;if("textbox"==this.inputMode)return n;if("simple"!=this.inputMode){if(4==e){if(o||this.disabled)return!1;n=h._handleKeyDown(i,a)}else if(5==e)(o||this.disabled)&&(n=!1);else if(6==e){if(o||this.disabled)return!1;n=h._handleKeyPress(i,a)}}else if(4==e||5==e||6==e){if(t.jqx.mobile.isTouchDevice()||!0===this.touchMode)return!0;if(o||this.disabled)return!1;var d=String.fromCharCode(a),c=(parseInt(d),!0);if(i.ctrlKey||i.shiftKey||i.metaKey||a>=65&&a<=90&&(c=!1),6==e&&void 0!=t.jqx.browser.opera&&8==a)return!1;if(c){if(4==e&&(c=h._handleSimpleKeyDown(i,a)),189==a||45==a||109==a||173==a){var p=h._selection();4==e&&(0==h.getvalue("negative")?h.setvalue("negative",!0):h.setvalue("negative",!1),h.decimal=h.ValueString,h._parseDecimalInSimpleMode(),h._setSelectionStart(p.start),c=!1,h._raiseEvent(0,h.value),h._raiseEvent(1,h.numberInput.val()))}var m=r.ctrlKey||r.metaKey;if(!t.jqx.browser.msie){var g=i;if(m&&99==a||m&&67==a||m&&122==a||m&&90==a||m&&118==a||m&&86==a||g.shiftKey&&45==a)return(t.jqx.browser.webkit||t.jqx.browser.chrome)&&h._handleSimpleKeyDown(i,a),67==a}if(m&&97==a||m&&65==a)return!0;if(6==e&&c)return this._isSpecialKey(a)}return c}return n},GetSelectionInValue:function(t,e,s,r){var a=0;for(i=0;i<e.length&&!(i>=t);i++){var n=e.substring(i,i+1);(!isNaN(parseInt(n))||r&&e.substring(i,i+1)==s)&&a++}return a},GetSelectionLengthInValue:function(t,e,s,r){var a=0;for(i=0;i<s.length&&!(i>=t+e);i++){var n=s.substring(i,i+1),o=!isNaN(parseInt(n));(e>0&&i>=t&&o||i>=t&&s[i].toString()==r)&&a++}return a},GetInsertTypeByPositionInValue:function(t,e,i,s){var r="before",a=this.GetValueString(i,e,s);return t>this.GetDigitsToSeparator(0,a,e)&&(r="after"),r},RemoveRange:function(t,e,i,s,r,a){var n=this.digits,o=t,h=e,l=0,u=(this.decimal,this._selection(),""!=(s=this.decimalSeparator));if(0==h&&this.ValueString.length<this.decimalPossibleChars-1)return l;var d=this.GetSeparatorPositionInText(s,i);r||(d=this.GetSeparatorPositionInText(s,i)),d<0&&!u&&i.length>1&&(d=i.length),-1==d&&(d=i.length);var c=u?1:0;e<2&&1==a&&this.ValueString.length-this.decimalDigits-c==n&&t+e<d&&h++;for(var p="",m=0;m<i.length;m++)if(m<o||m>=o+h)p+=i.substring(m,m+1);else if((g=i.substring(m,m+1))!=s){g=i.substring(m,m+1);if(!(this.symbol&&""!=this.symbol&&this.symbol.indexOf(g)>=0))if(m>d)p+="0";else{var g=i.substring(m,m+1);!isNaN(parseInt(g))&&l++}}else p+=s;0==p.length&&(p="0"),r?this.numberInput.val(p):this.ValueString=p;var v=p.substring(0,1);return v==s&&isNaN(parseInt(v))&&(p="0"+p),this.ValueString=this.GetValueString(p,s,u),this.decimal=this.ValueString,this._parseDecimalInSimpleMode(),this._setSelectionStart(o),l},InsertDigit:function(t,e){"number"!=typeof this.digits&&(this.digits=parseInt(this.digits)),"number"!=typeof this.decimalDigits&&(this.decimalDigits=parseInt(this.decimalDigits));var i=1+this.digits,s=this._selection(),r=this.getvalue("negative"),a=!1;0==s.start&&""!=this.symbol&&"left"==this.symbolPosition&&(this._setSelectionStart(s.start+1),s=this._selection(),a=!0),(r&&a||r&&!a&&0==s.start)&&(this._setSelectionStart(s.start+1),s=this._selection());var n=this.numberInput.val().substring(s.start,s.start+1),o=this.numberInput.val(),h=this.decimalSeparator,l=""!=h&&this.decimalDigits>0;if(n==this.symbol&&"right"==this.symbolPosition){if(0!=this.decimalDigits)return;if(this.ValueString=this.GetValueString(o,h,l),this.ValueString.length>=i)return}this.ValueString=this.GetValueString(o,h,l),""==this.ValueString&&(this.ValueString=new Number(0).toFixed(this.decimalDigits));var u=this.ValueString;this.decimalDigits>0&&e>=u.length&&(e=u.length-1);var d="";e<u.length&&(d=u.substring(e,e+1));var c=!1;"after"==this.GetInsertTypeByPositionInValue(e,h,o,l)&&(c=!0);var p=l?1:0;d!=h&&this.ValueString.length-this.decimalDigits-p>=i-1&&(c=!0),"0"===d&&1===this.ValueString.length&&0===this.decimalDigits&&(c=!0);var m=l?1:0;if(!(!c&&this.ValueString&&this.ValueString.length>=this.digits+this.decimalDigits+m)){if(c&&d!=h){if((f=u.substring(0,e)).length==u.length&&this.ValueString.length>=this.digits+this.decimalDigits+m)return;var g=t,v="";e+1<u.length&&(v=u.substring(e+1));b=f+g+v;this.ValueString=b}else{var f=u.substring(0,e),b=f+(g=t)+(v=u.substring(e));"0"==u.substring(0,1)&&u.substring(1,2)==h&&(b=g+u.substring(1),d==h&&(this._setSelectionStart(s.start-1),s=this._selection())),this.ValueString=b}this.decimal=r?-this.ValueString:this.ValueString,this._parseDecimalInSimpleMode();var S=s.start;S+=1,this._setSelectionStart(S),this.value=this.decimal,this._raiseEvent(0,this.value),this._raiseEvent(1,this.numberInput.val())}},GetStringToSeparator:function(t,e,i){var s=this.GetSeparatorPositionInText(e,t),r=t.subString(0,s);return this.GetValueString(r,e,i)},GetSeparatorPositionInText:function(t,e){var s=-1;for(i=0;i<e.length;i++)if(e.substring(i,i+1)==t){s=i;break}return s},GetValueString:function(t,e,i){for(var s="",r=0;r<t.length;r++){var a=t.substring(r,r+1);!isNaN(parseInt(a))&&(s+=a),a==e&&(s+=e)}return s},Backspace:function(){var t=this._selection(),e=this._selection(),i=this.numberInput.val();if(0!=t.start||0!=t.length){this.isBackSpace=!0;var s=i.substring[(t.start,t.start+1)];isNaN(parseInt(s));if(t.start>0&&0==t.length){this._setSelectionStart(t.start-1);t=this._selection()}this.Delete(),this._setSelectionStart(e.start-1),this.isBackSpace=!1}},Delete:function(t){var e=this._selection(),i=this.numberInput.val();if(0===e.start&&"-"==i.substring(0,1)){this.setvalue("negative",!1);var e=this._selection(),i=this.numberInput.val()}var s=e.start,r=e.length;r=Math.max(r,1),this.ValueString=this.GetValueString(i,this.decimalSeparator,""!=this.decimalSeparator),s>this.ValueString.indexOf(this.decimalSeparator)&&this.decimalDigits>0&&s++;var a=0;this.symbol&&("left"==this.symbolPosition&&a--,this.negative&&a--),this.RemoveRange(e.start+a,r,this.ValueString,".",!1);var n=this.ValueString.substring(0,1);!isNaN(parseInt(n))||(this.ValueString="0"+this.ValueString),this.decimal=this.ValueString,this._parseDecimalInSimpleMode(),this._setSelectionStart(s),this.value=this.decimal,this._raiseEvent(0,this.value),this._raiseEvent(1,this.numberInput.val())},insertsimple:function(t){var e=this._selection(),i=this.numberInput.val();if(!(e.start==i.length&&null!=this.decimal&&this.decimalDigits>0)){this.decimal;var s=this.decimalSeparator;this.ValueString=this.GetValueString(i,s,""!=s);var r=this.GetSelectionInValue(e.start,i,s,""!=s),a=this.GetSelectionLengthInValue(e.start,e.length,i,s);this.GetDigitsToSeparator(0,this.ValueString,s);if(this.decimalDigits>0&&r>=this.ValueString.length&&r--,""==this.ValueString)return this.ValueString=new Number(0).toFixed(this.decimalDigits),this.ValueString=this.ValueString.replace(".",s),this.RemoveRange(e.start,a,this.ValueString,s,!1,!0),void this.InsertDigit(t,0,e);this.RemoveRange(e.start,a,this.ValueString,s,!1,!0),this.InsertDigit(t,r,e)}},GetDigitsToSeparator:function(t,e,s){if(void 0==s&&(s="."),e.indexOf(s)<0)return e.length;for(i=0;i<e.length;i++)if(e.substring(i,i+1)==s){t=i;break}return t},_handleSimpleKeyDown:function(e,i){var s=this._selection(),r=e.ctrlKey||e.metaKey;if((8==i||46==i)&&r)return this.setDecimal(null),!1;if(s.start>=0&&s.start<this.items.length)m=String.fromCharCode(i);if(27===i&&(this.setDecimal(this._savedValue),-1!=(o=this.GetSeparatorPositionInText(this.decimalSeparator,this.numberInput.val()))&&this._setSelectionStart(o),e.preventDefault()),this.rtl&&37==i){n=(a=e.shiftKey)?1:0;return a?this._setSelection(s.start+1-n,s.start+s.length+1):this._setSelection(s.start+1-n,s.start+1),!1}if(this.rtl&&39==i){var a=e.shiftKey,n=a?1:0;return a?this._setSelection(s.start-1,s.length+n+s.start-1):this._setSelection(s.start-1,s.start-1),!1}if(8==i)return this.Backspace(),!1;if(190==i||110==i){var o=this.GetSeparatorPositionInText(this.decimalSeparator,this.numberInput.val());return-1!=o&&this._setSelectionStart(o+1),!1}if(188==i){var h=this.numberInput.val();for(d=s.start;d<h.length;d++)if(h[d]==this.groupSeparator){this._setSelectionStart(1+d);break}return!1}if((r=e.ctrlKey||e.metaKey)&&99==i||r&&67==i){var s=this._selection(),l="",u=this.numberInput.val();if(s.start>0||s.length>0)for(var d=s.start;d<s.end;d++)l+=u.substring(d,d+1);if(t.data(document.body,"jqxSelection",l),t.jqx.browser.msie)window.clipboardData.setData("Text",l);else{var c=this,p=t('<textarea style="position: absolute; left: -1000px; top: -1000px;"/>');p.val(l),t("body").append(p),p.select(),setTimeout(function(){document.designMode="off",p.select(),p.remove(),c.focus()},100)}return this.savedText=l,!0}if(r&&122==i||r&&90==i)return!1;if(r&&118==i||r&&86==i||e.shiftKey&&45==i)return t.jqx.browser.msie&&!this.savedText&&(this.savedText=window.clipboardData.getData("Text")),null!=this.savedText&&this.savedText.length>0?this.val(this.savedText):this.val(t.data(document.body,"jqxSelection")),!1;var m=String.fromCharCode(i),g=parseInt(m);if(i>=96&&i<=105&&(g=i-96,i-=48),!isNaN(g)){c=this;return this.insertsimple(g),!1}if(46==i)return this.Delete(),!1;if(38==i)return this.spinUp(),!1;if(40==i)return this.spinDown(),!1;var v=this._isSpecialKey(i);return!t.jqx.browser.mozilla||v},_getEditRange:function(){var t=0,e=0;for(i=0;i<this.items.length;i++)if(this.items[i].canEdit){t=i;break}for(i=this.items.length-1;i>=0;i--)if(this.items[i].canEdit){e=i;break}return{start:t,end:e}},_getVisibleItems:function(){var t=new Array,e=0;for(i=0;i<this.items.length;i++)this.items[i].character.toString().length>0&&(t[e]=this.items[i],e++);return t},_hasEmptyVisibleItems:function(){var t=this._getVisibleItems();for(i=0;i<t.length;i++)if(t[i].canEdit&&t[i].character==this.promptChar)return!0;return!1},_getFirstVisibleNonEmptyIndex:function(){var t=this._getVisibleItems();for(i=0;i<t.length;i++)if(t[i].canEdit&&t[i].character!=this.promptChar)return i},_handleMouse:function(t,e){var i=this._selection();if(i.length<=1){var s=this._getFirstVisibleNonEmptyIndex();i.start<s&&this._setSelectionStart(s)}},_insertKey:function(e){this.numberInput[0].focus();var s=String.fromCharCode(e),r=parseInt(s);if(!isNaN(r)){var a=0;for(i=0;i<this.items.length;i++)0==this.items[i].character.length&&a++;var n=this._selection(),o=this;if(n.start>=0&&n.start<=this.items.length){var h=!1,l=this._getFirstVisibleNonEmptyIndex();n.start<l&&0==n.length&&(isNaN(s)&&" "!=s||(this._setSelectionStart(l),n=this._selection()));this._getFirstEditableItemIndex();var u=this._getLastEditableItemIndex(),d=this._getVisibleItems();t.each(d,function(t,e){if(!(n.start>t&&t!=d.length-1)){var i=d[t];if(t>u&&(i=d[u]),!isNaN(s)&&" "!=s&&i.canEdit){r=o._getSeparatorPosition();if(o._match(s,i.regex)){if(!h&&n.length>0){for(j=n.start+a;j<n.end+a;j++)o.items[j].canEdit&&(j>r?o.items[j].character="0":o.items[j].character=o.promptChar);S=o._getString();h=!0}var r=o._getSeparatorPosition(),l=o._hasEmptyVisibleItems();if(null==o.decimal&&(n.start=r-1,n.start<0&&(n.start=0),n.end=n.start),n.start<=r&&l){var c=t;-1==o.decimalSeparatorPosition&&n.start==r&&(c=t+1),null==o.decimal&&(c=n.start);v="";for(p=0;p<c;p++)d[p].canEdit&&d[p].character!=o.promptChar&&(v+=d[p].character);v+=s;b=o.decimal<1?1:0;for(n.start==r&&-1!=o.decimalSeparatorPosition&&(v+=o.decimalSeparator,b=0),p=c+b;p<d.length;p++)d[p].character==o.decimalSeparator&&d[p].isSeparator?v+=d[p].character:d[p].canEdit&&d[p].character!=o.promptChar&&(v+=d[p].character);"."!=o.decimalSeparator&&(v=o._parseDecimalValue(v)),v=parseFloat(v).toString(),v=(v=new Number(v)).toFixed(o.decimalDigits),"."!=o.decimalSeparator&&(v=o._parseDecimalValueToEditorValue(v)),o.setvalue("decimal",v);S=o._getString();if(n.end<r?o._setSelectionStart(n.end+b):o._setSelectionStart(n.end),n.length>=1&&o._setSelectionStart(n.end),n.length==o.numberInput.val().length){var m=o._moveCaretToDecimalSeparator(),g=o.decimalSeparatorPosition>=0?1:0;o._setSelectionStart(m-g)}}else if(n.start<r||n.start>r){if(o.numberInput.val().length==n.start&&-1!=o.decimalSeparatorPosition)return!1;if(o.numberInput.val().length==n.start&&-1==o.decimalSeparatorPosition&&!l)return!1;var v="",f=!1;for(p=0;p<t;p++)d[p].canEdit&&d[p].character!=o.promptChar&&(v+=d[p].character),d[p].character==o.decimalSeparator&&d[p].isSeparator&&(v+=d[p].character,f=!0);v+=s;var b=o.decimal<1?1:0;for(f||n.start!=r-1||(v+=o.decimalSeparator,f=!0),p=t+1;p<d.length;p++)!f&&d[p].character==o.decimalSeparator&&d[p].isSeparator?v+=d[p].character:d[p].canEdit&&d[p].character!=o.promptChar&&(v+=d[p].character);o.setvalue("decimal",v);var S=o._getString();if(o.decimalSeparatorPosition<0&&i==d[u])return o._setSelectionStart(t),!1;var _=S.indexOf(o.symbol);if(_<=(o.getvalue("negative")?1:0)&&(_=S.length),n.start<_?o._setSelectionStart(t+1):o._setSelectionStart(t),n.length,n.length==o.numberInput.val().length){m=o._moveCaretToDecimalSeparator();o._setSelectionStart(m-1)}}return!1}}}})}}},_handleKeyPress:function(e,i){var s=this._selection(),r=this,a=e.ctrlKey||e.metaKey;return!!(a&&97==i||a&&65==i)||(8==i?(s.start>0&&r._setSelectionStart(s.start),!1):46==i?(s.start<this.items.length&&r._setSelectionStart(s.start),!1):(t.jqx.browser.mozilla||45!=i&&173!=i&&109!=i&&189!=i||(0==this.getvalue("negative")?this.setvalue("negative",!0):this.setvalue("negative",!1)),t.jqx.browser.msie&&this._insertKey(i),this._isSpecialKey(i)))},_deleteSelectedText:function(){var t=this._selection(),e="",s=this._getSeparatorPosition(),r=this._getVisibleItems(),a=this._getHiddenPrefixCount();for(this.numberInput.val().length==t.start&&0==t.length&&(this._setSelection(t.start,t.start+1),t=this._selection()),i=0;i<t.start;i++)r[i].canEdit&&r[i].character!=this.promptChar?e+=r[i].character:r[i].canEdit||-1==this.decimalSeparatorPosition||r[i]!=r[this.decimalSeparatorPosition-a]||(0==e.length&&(e="0"),e+=r[i].character);for(i=t.start;i<t.end;i++)i>s&&-1!=this.decimalSeparatorPosition?r[i].canEdit&&r[i].character!=this.promptChar&&(e+="0"):r[i].canEdit||-1==this.decimalSeparatorPosition||r[i]!=r[this.decimalSeparatorPosition-a]||(0==e.length&&(e="0"),e+=r[i].character);for(i=t.end;i<r.length;i++)r[i].canEdit&&r[i].character!=this.promptChar?e+=r[i].character:r[i].canEdit||-1==this.decimalSeparatorPosition||r[i]!=r[this.decimalSeparatorPosition-a]||(0==e.length&&(e="0"),e+=r[i].character);return this.setvalue("decimal",e),t.length>0},_restoreInitialState:function(){var t=parseInt(this.decimalDigits);for(t>0&&(t+=2),k=this.items.length-1;k>this.items.length-1-t&&this.items[k];k--)this.items[k].canEdit&&this.items[k].character==this.promptChar&&(this.items[k].character=0)},clear:function(){this.setDecimal(0)},clearDecimal:function(){if("textbox"!=this.inputMode){for(var t=0;t<this.items.length;t++)this.items[t].canEdit&&(this.items[t].character=this.promptChar);this._restoreInitialState()}else this.numberInput.val()},_saveSelectedText:function(){var e=this._selection(),s="",r=this._getVisibleItems();if(e.start>0||e.length>0)for(i=e.start;i<e.end;i++)r[i].canEdit&&r[i].character!=this.promptChar?s+=r[i].character:r[i].isSeparator&&(s+=r[i].character);return t.jqx.browser.msie&&window.clipboardData.setData("Text",s),s},_pasteSelectedText:function(){var e=this._selection();if(this.selectedText=t.data(document.body,"jqxSelection"),window.clipboardData){var i=window.clipboardData.getData("Text");if(i!=this.selectedText&&i.length>0&&(this.selectedText=window.clipboardData.getData("Text"),null==this.selectedText||void 0==this.selectedText))return}e.start,this._getVisibleItems();if(null!=this.selectedText)for(var s=0;s<this.selectedText.length;s++){var r=parseInt(this.selectedText[s]);if(!isNaN(r)){var a=48+r;this._insertKey(a)}}},_getHiddenPrefixCount:function(){var t=0;if(this.negative||t++,"left"==this.symbolPosition)for(i=0;i<this.symbol.length;i++)""==this.symbol.substring(i,i+1)&&t++;return t},_getEditableItem:function(){var t=this._selection();for(i=0;i<this.items.length;i++)if(i<t.start&&this.items[i].canEdit&&this.items[i].character!=this.promptChar)return this.items[i];return null},_getEditableItems:function(){var t=new Array,e=0;for(i=0;i<this.items.length;i++)this.items[i].canEdit&&(t[e]=this.items[i],e++);return t},_getValidSelectionStart:function(t){for(i=this.items.length-1;i>=0;i--)if(this.items[i].canEdit&&this.items[i].character!=this.promptChar)return i;return-1},_getEditableItemIndex:function(t){var e=this._selection(),s=this._getHiddenPrefixCount(),r=this._getVisibleItems(),a=e.start,n=-1;for(i=0;i<a;i++)i<r.length&&r[i].canEdit&&(n=i+s);if(-1==n&&e.length>0)for(a=e.end,i=0;i<a;i++)if(i<r.length&&r[i].canEdit){n=i+s;break}return n},_getEditableItemByIndex:function(t){for(k=0;k<this.items.length;k++)if(k>t&&this.items[k].canEdit&&this.items[k].character!=this.promptChar)return k;return-1},_getFirstEditableItemIndex:function(){var t=this._getVisibleItems();for(m=0;m<t.length;m++)if(t[m].character!=this.promptChar&&t[m].canEdit&&"0"!=t[m].character)return m;return-1},_getLastEditableItemIndex:function(){var t=this._getVisibleItems();for(m=t.length-1;m>=0;m--)if(t[m].character!=this.promptChar&&t[m].canEdit)return m;return-1},_moveCaretToDecimalSeparator:function(){for(i=this.items.length-1;i>=0;i--)if(this.items[i].character==this.decimalSeparator&&this.items[i].isSeparator)return this.negative?(this._setSelectionStart(i+1),i):(this._setSelectionStart(i),i);return this.numberInput.val().length},_handleBackspace:function(){var t=this._selection(),e=this._getHiddenPrefixCount(),i=this._getEditableItemIndex()-e,s=this._getFirstVisibleNonEmptyIndex(),r=!1;if(this.negative&&(r=!0,(s>=i+1||0==t.start)&&(this.setvalue("negative",!1),0==t.length))){this._setSelectionStart(t.start-1);t=this._selection()}if(i>=0){0==t.length&&-1!=i&&this._setSelection(i,i+1);var a=t.start>this._getSeparatorPosition()+1&&this.decimalSeparatorPosition>0;a&&(t=this._selection());this._deleteSelectedText();if(t.length<1||a?this._setSelectionStart(t.start):t.length>=1&&this._setSelectionStart(t.end),t.length==this.numberInput.val().length||r){var n=this._moveCaretToDecimalSeparator();this._setSelectionStart(n-1)}}else this._setSelectionStart(t.start)},_handleKeyDown:function(e,s){var r=this._selection(),a=e.ctrlKey||e.metaKey;if((8==s||46==s)&&a)return this.setDecimal(null),!1;if(this.rtl&&37==s){o=(n=e.shiftKey)?1:0;return n?this._setSelection(r.start+1-o,r.start+r.length+1):this._setSelection(r.start+1-o,r.start+1),!1}if(this.rtl&&39==s){var n=e.shiftKey,o=n?1:0;return n?this._setSelection(r.start-1,r.length+o+r.start-1):this._setSelection(r.start-1,r.start-1),!1}if(a&&97==s||a&&65==s)return!0;if(a&&120==s||a&&88==s)return this.selectedText=this._saveSelectedText(e),t.data(document.body,"jqxSelection",this.selectedText),this._handleBackspace(),!1;if(a&&99==s||a&&67==s)return this.selectedText=this._saveSelectedText(e),t.data(document.body,"jqxSelection",this.selectedText),!1;if(a&&122==s||a&&90==s)return!1;if(a&&118==s||a&&86==s||e.shiftKey&&45==s)return this._pasteSelectedText(),!1;if(r.start>=0&&r.start<this.items.length)l=String.fromCharCode(s),this.items[r.start];if(8==s)return this._handleBackspace(),!1;if(190==s||110==s)return this._moveCaretToDecimalSeparator(),!1;if(188==s){var h=this.numberInput.val();for(i=r.start;i<h.length;i++)if(h[i]==this.groupSeparator){this._setSelectionStart(1+i);break}return!1}if(null==t.jqx.browser.msie){var l=String.fromCharCode(s),u=parseInt(l);if(s>=96&&s<=105&&(u=s-96,s-=48),!isNaN(u))return this._insertKey(s),!1}if(46==s){var d=this._getVisibleItems();if(r.start<d.length){o=0==d[r.start].canEdit?2:1;if(0==r.start&&this.negative&&(this.setvalue("negative",!1),0==r.length&&this._setSelectionStart(0),0==(r=this._selection()).length))return!1;0==r.length&&this._setSelection(r.start+o,r.start+o+r.length),this._handleBackspace(),new Number(this.decimal)<1||r.start>this._getSeparatorPosition()?this._setSelectionStart(r.end+o):r.start+1<this.decimalSeparatorPosition&&this._setSelectionStart(r.end+o)}return!1}if(38==s)return this.spinUp(),!1;if(40==s)return this.spinDown(),!1;27===s&&(this.setDecimal(this._savedValue),this._setSelectionStart(r.end),e.preventDefault());var c=this._isSpecialKey(s);return t.jqx.browser.mozilla&&(45!=s&&173!=s&&109!=s&&189!=s||(0==this.getvalue("negative")?this.setvalue("negative",!0):this.setvalue("negative",!1))),!t.jqx.browser.mozilla||c},_isSpecialKey:function(t){return 8==t||9==t||13==t||35==t||36==t||37==t||39==t||27==t||46==t},_selection:function(){try{if("selectionStart"in this.numberInput[0]){var t=this.numberInput[0],e=t.selectionEnd-t.selectionStart;return{start:t.selectionStart,end:t.selectionEnd,length:e,text:t.value}}var i=document.selection.createRange();if(null==i)return{start:0,end:t.value.length,length:0};var s=this.numberInput[0].createTextRange(),r=s.duplicate();s.moveToBookmark(i.getBookmark()),r.setEndPoint("EndToStart",s);e=i.text.length;return{start:r.text.length,end:r.text.length+i.text.length,length:e,text:i.text}}catch(t){return{start:0,end:0,length:0}}},selectAll:function(){var t=this.numberInput;setTimeout(function(){if("selectionStart"in t[0])t[0].focus(),t[0].setSelectionRange(0,t[0].value.length);else{var e=t[0].createTextRange();e.collapse(!0),e.moveEnd("character",t[0].value.length),e.moveStart("character",0),e.select()}},10)},_setSelection:function(e,i){if(1!=this._disableSetSelection&&!t.jqx.mobile.isTouchDevice()&&1!=this.touchMode)try{if("selectionStart"in this.numberInput[0])this.numberInput[0].focus(),this.numberInput[0].setSelectionRange(e,i);else{var s=this.numberInput[0].createTextRange();s.collapse(!0),s.moveEnd("character",i),s.moveStart("character",e),s.select()}}catch(t){}},_setSelectionStart:function(e){this._setSelection(e,e),t.data(this.numberInput,"selectionstart",e)},resize:function(t,e){this.width=t,this.height=e,this._render(!1)},_render:function(e){var i=parseInt(this.host.css("border-left-width")),s=parseInt(this.host.css("border-left-width")),r=parseInt(this.host.css("border-left-width")),a=parseInt(this.host.css("border-left-width"));this.numberInput.css("padding-top","0px"),this.numberInput.css("padding-bottom","0px"),this.host.height(this.height),this.host.width(this.width);var n=this.host.width(),o=this.host.height();this.numberInput.css({"border-left-width":0,"border-right-width":0,"border-bottom-width":0,"border-top-width":0}),isNaN(r)&&(r=1),isNaN(s)&&(s=1),isNaN(a)&&(a=1),isNaN(i)&&(i=1),this.numberInput.css("text-align",this.textAlign);var h=this.numberInput.css("font-size");""==h&&(h=13),this.numberInput.css("height",parseInt(h)+4+"px"),this.numberInput.css("width",n-2);var l=o-2*r-parseInt(h)-2;isNaN(l)&&(l=0),l<0&&(l=0),this.spinButtons&&this.spincontainer&&(n-=parseInt(this.spinButtonsWidth-2),t.jqx.mobile.isTouchDevice()||!0===this.touchMode?(this.spincontainer.width(2*this.spinButtonsWidth),n-=this.spinButtonsWidth,this.upbutton.height("100%"),this.downbutton.height("100%"),this.downbutton.css("float","left"),this.upbutton.css("float","right"),this.upbutton.width(this.spinButtonsWidth),this.downbutton.width(1+this.spinButtonsWidth)):(this.spincontainer.width(this.spinButtonsWidth),this.upbutton.width(this.spinButtonsWidth+2),this.downbutton.width(this.spinButtonsWidth+2),this.upbutton.height("50%"),this.downbutton.height("50%"),this.spincontainer.width(this.spinButtonsWidth)),this._upArrow.height("100%"),this._downArrow.height("100%"),this.numberInput.css("width",n-6),this.numberInput.css("margin-right","2px"));var u=l/2;t.jqx.browser.msie&&t.jqx.browser.version<8&&(u=l/4),this.numberInput.css("padding-left","0px"),this.numberInput.css("padding-right","0px"),this.numberInput.css("padding-top",Math.round(u)+"px"),this.numberInput.css("padding-bottom",Math.round(u)+"px"),void 0!=e&&1!=e||(this.numberInput.val(this._getString()),"advanced"!=this.inputMode&&this._parseDecimalInSimpleMode())},destroy:function(){this._removeHandlers(),this.host.remove()},inputValue:function(t){return void 0===t?this._value():(this.propertyChangedHandler(this,"value",this._value,t),this._refreshValue(),this)},_value:function(){return this.numberInput.val()},val:function(t){if((void 0===t||"object"==typeof t)&&null!==t)return this.getDecimal();if(null!==t){var e=t;(e=e.toString()).indexOf(this.symbol)>-1&&(e=e.replace(this.symbol,""));e=(e=function(t,e,i){var s=t;if(e==i)return t;for(var r=s.indexOf(e);-1!=r;)r=(s=s.replace(e,i)).indexOf(e);return s}(e,this.groupSeparator,"")).replace(this.decimalSeparator,".");for(var i="",s=0;s<e.length;s++){var r=e.substring(s,s+1);"-"===r&&(i+="-"),"."===r&&(i+="."),null!=r.match(/^[0-9]+$/)&&(i+=r)}e=(e=i).replace(/ /g,""),e=new Number(e),this.setDecimal(e)}else this.setDecimal(null)},getDecimal:function(){return null==this.decimal?null:("simple"==this.inputMode&&(this._parseDecimalInSimpleMode(!1),this.decimal=this._getDecimalInSimpleMode(this.decimal)),""==this.decimal?0:this.getvalue("negative")&&this.decimal>0?-parseFloat(this.decimal):parseFloat(this.decimal))},setDecimal:function(t){var e=t;if("."!=this.decimalSeparator)if(null===t)this._setDecimal(t);else{var i=t;if("number"!=typeof t){var s=(t=t.toString()).indexOf(".");if(-1!=s)i=(r=t.substring(0,s))+"."+(a=t.substring(s+1)),-1!=r.indexOf("-")&&(r=r.substring(1)),t="advanced"!=this.inputMode?r+"."+a:r+this.decimalSeparator+a;else if(-1!=(s=t.indexOf(this.decimalSeparator))){var r=t.substring(0,s),a=t.substring(s+1);i=r+"."+a,-1!=r.indexOf("-")&&(r=r.substring(1)),t="advanced"!=this.inputMode?r+"."+a:r+this.decimalSeparator+a}}i<0?this.setvalue("negative",!0):this.setvalue("negative",!1),this._setDecimal(t)}else t<0?this.setvalue("negative",!0):this.setvalue("negative",!1),null===t?this._setDecimal(t):this._setDecimal(Math.abs(t));null==e&&this.numberInput.val("")},_setDecimal:function(t){if(this.allowNull||null!=t||(this.decimal=0,t=0),null==t)return this.decimal=null,this.value=null,this.clearDecimal(),this._refreshValue(),this.decimal=null,void(this.value=null);-1!=t.toString().indexOf("e")&&(t=new Number(t).toFixed(this.decimalDigits).toString()),this.clearDecimal();var e=t.toString(),i="",s="",r=!0;0==e.length&&(e="0");for(h=0;h<e.length;h++){if("number"==typeof t){if("."==e.substring(h,h+1)){r=!1;continue}}else if(e.substring(h,h+1)==this.decimalSeparator){r=!1;continue}r?i+=e.substring(h,h+1):s+=e.substring(h,h+1)}i.length>0&&(i=parseFloat(i).toString());var a=this.digits;a<i.length&&(i=i.substr(0,a));for(var n=0,o=this._getSeparatorPosition(),h=o+=this._getHiddenPrefixCount();h>=0;h--)h<this.items.length&&this.items[h].canEdit&&n<i.length&&(this.items[h].character=i.substring(i.length-n-1,i.length-n),n++);n=0;for(h=o;h<this.items.length;h++)this.items[h].canEdit&&n<s.length&&(this.items[h].character=s.substring(n,n+1),n++);if(this._refreshValue(),"."==this.decimalSeparator)this.ValueString=new Number(t).toFixed(this.decimalDigits);else{var l=t.toString().indexOf(this.decimalSeparator);if(l>0){var u=t.toString().substring(0,l)+"."+t.toString().substring(l+1);this.ValueString=new Number(u).toFixed(this.decimalDigits)}else this.ValueString=new Number(t).toFixed(this.decimalDigits)}"advanced"!=this.inputMode&&(this._parseDecimalInSimpleMode(),this._raiseEvent(1,this.ValueString)),"textbox"==this.inputMode&&(this.decimal=this.ValueString,this.getvalue("negative")&&(this.decimal="-"+this.ValueString)),(t=this.val())<this.min||t>this.max?this.host.addClass("jqx-input-invalid"):this.host.removeClass("jqx-input-invalid")},_getSeparatorPosition:function(){var t=this._getHiddenPrefixCount();return this.decimalSeparatorPosition>0?this.decimalSeparatorPosition-t:this.items.length-t},_setTheme:function(){this.host.removeClass(),this.host.addClass(this.toThemeProperty("jqx-input")),this.host.addClass(this.toThemeProperty("jqx-rc-all")),this.host.addClass(this.toThemeProperty("jqx-widget")),this.host.addClass(this.toThemeProperty("jqx-widget-content")),this.host.addClass(this.toThemeProperty("jqx-numberinput")),this.spinButtons&&(this.downbutton.removeClass(),this.upbutton.removeClass(),this.downbutton.addClass(this.toThemeProperty("jqx-scrollbar-button-state-normal")),this.upbutton.addClass(this.toThemeProperty("jqx-scrollbar-button-state-normal")),this._upArrow.removeClass(),this._downArrow.removeClass(),this._upArrow.addClass(this.toThemeProperty("jqx-icon-arrow-up")),this._downArrow.addClass(this.toThemeProperty("jqx-icon-arrow-down"))),this.numberInput.removeClass(),this.numberInput.addClass(this.toThemeProperty("jqx-input-content"))},propertiesChangedHandler:function(t,e,i){i&&i.width&&i.height&&2==Object.keys(i).length&&t._render()},propertyChangedHandler:function(e,s,r,a){if(!(e.batchUpdate&&e.batchUpdate.width&&e.batchUpdate.height&&2==Object.keys(e.batchUpdate).length)){if("template"==s&&(e.upbutton.removeClass(e.toThemeProperty("jqx-"+e.template)),e.downbutton.removeClass(e.toThemeProperty("jqx-"+e.template)),e.upbutton.addClass(e.toThemeProperty("jqx-"+e.template)),e.downbutton.addClass(e.toThemeProperty("jqx-"+e.template))),("digits"==s||"groupSize"==s||"decimalDigits"==s)&&a<0)throw new Exception(this.invalidArgumentExceptions[0]);if("placeHolder"==s&&e.numberInput.attr("placeholder",e.placeHolder),"theme"===s&&t.jqx.utilities.setTheme(r,a,e.host),"digits"==s&&a!=r&&(e.digits=parseInt(a)),"min"!=s&&"max"!=s||(t.jqx.aria(e,"aria-value"+s,a.toString()),e._refreshValue()),"decimalDigits"==s&&a!=r&&(e.decimalDigits=parseInt(a)),"decimalSeparator"==s||"digits"==s||"symbol"==s||"symbolPosition"==s||"groupSize"==s||"groupSeparator"==s||"decimalDigits"==s||"negativeSymbol"==s){var n=e.decimal;if("decimalSeparator"==s&&""==a&&(a=" "),r!=a){o=e._selection();e.items=new Array,e._initializeLiterals(),e.value=e._getString(),e._refreshValue(),e._setDecimal(n)}}if("rtl"==s&&(e.rtl?(e.spincontainer&&(e.spincontainer.css("float","right"),e.spincontainer.css("border-right-width","1px")),e.numberInput.css("float","right")):(e.spincontainer&&(e.spincontainer.css("float","right"),e.spincontainer.css("border-right-width","1px")),e.numberInput.css("float","left"))),"spinButtons"==s&&(e.spincontainer?(a?e.spincontainer.css("display","block"):e.spincontainer.css("display","none"),e._render()):e._spinButtons()),"touchMode"===s&&(e.inputMode="textbox",e.spinMode="simple",e.render()),"negative"==s&&"advanced"==e.inputMode){var o=e._selection(),h=0;a?(e.items[0].character=e.negativeSymbol[0],h=1):(e.items[0].character="",h=-1),e._refreshValue(),e.isInitialized&&e._setSelection(o.start+h,o.end+h)}if("decimal"==s&&(e.value=a,e.setDecimal(a)),"value"===s&&(e.value=a,e.setDecimal(a),e._raiseEvent(1,a)),"textAlign"==s&&(e.textAlign=a,e._render()),"disabled"==s&&(e.numberInput.attr("disabled",a),e.disabled?e.host.addClass(e.toThemeProperty("jqx-fill-state-disabled")):e.host.removeClass(e.toThemeProperty("jqx-fill-state-disabled")),t.jqx.aria(e,"aria-disabled",a.toString())),"readOnly"==s&&(e.readOnly=a),"promptChar"==s){for(i=0;i<e.items.length;i++)e.items[i].character==e.promptChar&&(e.items[i].character=a);e.promptChar=a}"width"==s?(e.width=a,e._render()):"height"==s&&(e.height=a,e._render())}},_value:function(){return this.value},_refreshValue:function(){var t=this.value;if("textbox"!==this.inputMode){this.value=this._getString(),t=this.value;for(var e="",i=0;i<this.items.length;i++){var s=this.items[i];s.canEdit&&s.character!=this.promptChar&&(e+=s.character),i==this.decimalSeparatorPosition&&(e+=".")}this.decimal=e;var r=!1;this.oldValue!==t&&(this.oldValue=t,this._raiseEvent(0,t),r=!0),"simple"!=this.inputMode&&(this.numberInput.val(t),r&&this._raiseEvent(1,t)),null==t&&this.numberInput.val("")}}})}(jqxBaseFramework);
  
  