@mescius/wijmo.input 5.20232.939

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es5-esm.js ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+
14
+ var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{_addCultureInfo,culture,setAriaLabel,disableAutoComplete,isIE,isIE9,asBoolean,asString,asEnum,setSelectionRange,contains,getActiveElement,setAttribute,showPopup,hidePopup,hasClass,addClass,removeClass,toggleClass,removeChild,Control,Key,Event,EventArgs,CancelEventArgs,tryCast,createElement,hasItems,isObject,isString,asArray,asFunction,asNumber,asType,asCollectionView,closest,escapeHtml,toPlainText,setCss,Binding,Rect,DateTime,assert,isFirefox,getUniqueId,isNumber,enable,isFunction,escapeRegExp,setText,isDate,isBoolean,asDate,asInt,Globalize,_ClickRepeater,CollectionView,format,clamp,Color,_MaskProvider,isEdge,setChecked,Point,isArray,getElementRect,PopupPosition,moveFocus,getElement,isUndefined,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.input";_addCultureInfo("InputNumber",{ariaLabels:{incVal:"Increase Value",decVal:"Decrease Value"}});var InputNumber=function(e){__extends(InputNumber,e);function InputNumber(t,i){var n=e.call(this,t)||this;n._value=null;n._min=null;n._max=null;n._format="";n._step=null;n._showBtn=!0;n._readOnly=!1;n._handleWheel=!0;n._oldText="";n._fromKb=!0;n.textChanged=new Event;n.valueChanged=new Event;var o=n.hostElement;setAttribute(o,"role","spinbutton",!0);var s=n.getTemplate();n.applyTemplate("wj-control wj-content wj-inputnumber",s,{_tbx:"input",_btnUp:"btn-inc",_btnDn:"btn-dec"},"input");var r=culture.InputNumber.ariaLabels;setAriaLabel(n._btnUp.querySelector("button"),r.incVal);setAriaLabel(n._btnDn.querySelector("button"),r.decVal);n._tbx.type.match(/number/i)&&(n.inputType="");var a=n._tbx;a.autocomplete="off";a.spellcheck=!1;n._updateSymbols();var l=n.addEventListener.bind(n);l(a,"keypress",n._keypress.bind(n));l(a,"keydown",n._keydown.bind(n));l(a,"input",n._input.bind(n));l(a,"blur",(function(){n.text!=n._oldText&&n._setText(n.text)}));l(a,"paste",(function(){n._fromKb=!1}));l(a,"compositionstart",(function(){n._composing=!0}));l(a,"compositionend",(function(){n._composing=!1;setTimeout((function(){var e=n.text,t=n._oldText,i=n._chrPct;t&&t.indexOf(i)>-1&&e.indexOf(i)<0&&(e+=i);n._setText(e)}))}));var h=n._clickSpinner.bind(n);l(n._btnUp,"click",h);l(n._btnDn,"click",h);n._rptUp=new _ClickRepeater(n._btnUp.querySelector("button"));n._rptDn=new _ClickRepeater(n._btnDn.querySelector("button"));l(a,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!e.ctrlKey&&n._isEditable()&&n.containsFocus()){var t=clamp(-e.deltaY,-1,1);n._increment((n.step||1)*t);setTimeout((function(){return n.selectAll()}));e.preventDefault()}}));n.value=0;n.isRequired=!0;n.initialize(i);return n}Object.defineProperty(InputNumber.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this._value)if(null==(e=asNumber(e,!this.isRequired||null==e&&null==this._value)))this._setText("");else if(!isNaN(e)){var t=Globalize.format(e,this.format);this._setText(t)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);this.inputElement.readOnly=this._readOnly;toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"min",{get:function(){return this._min},set:function(e){if(e!=this._min){this._min=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"max",{get:function(){return this._max},set:function(e){if(e!=this._max){this._max=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"step",{get:function(){return this._step},set:function(e){this._step=asNumber(e,!0);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._oldText=null;this._setText(e)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"showSpinner",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});InputNumber.prototype.selectAll=function(){var e=this._tbx;setSelectionRange(e,0,e.value.length)};InputNumber.prototype.clamp=function(e){return clamp(e,this.min,this.max)};InputNumber.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};InputNumber.prototype.onValueChanged=function(e){this._updateAria();this.valueChanged.raise(this,e)};InputNumber.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;e.prototype.dispose.call(this)};InputNumber.prototype.onGotFocus=function(t){this._oldValue=this.value;if(!this.isTouching){this._tbx.focus();this.selectAll()}e.prototype.onGotFocus.call(this,t)};InputNumber.prototype.onLostFocus=function(t){if(this._composing){this._composing=!1;this._setText(this.text)}if(this._isEditable()){var i=this.clamp(this.value);if(i==this.value||this.onInvalidInput(new CancelEventArgs)){var n=Globalize.format(i,this.format);this._setText(n)}}e.prototype.onLostFocus.call(this,t)};InputNumber.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._updateSymbols();var i=Globalize.format(this.value,this.format);this._setText(i)}};InputNumber.prototype._isEditable=function(){return!this.isReadOnly&&!this.isDisabled};InputNumber.prototype._updateSymbols=function(){var e=culture.Globalize.numberFormat,t=Globalize._parseNumericFormat(this.format);this._chrDec=e["."]||".";this._chrTho=e[","]||",";this._chrNeg=e["-"]||"-";this._chrPls=e["+"]||"+";this._chrPct=e["%"]||"%";this._chrCur=t.curr||e.currency.symbol||"$";this._fmtSpc=t.spec;this._fmtPrc=t.prec;this._rxSym=new RegExp("^[%+\\-() \\"+this._chrDec+"\\"+this._chrCur+"\\"+this._chrNeg+"\\"+this._chrPls+"\\"+this._chrPct+"]*$");this._rxNeg=new RegExp("^\\s*(\\-|\\"+this._chrNeg+")|([^e](\\-|\\"+this._chrNeg+")|\\()")};InputNumber.prototype._isNumeric=function(e,t){var i=e==this._chrDec||e>="0"&&e<="9",n="x"==this._fmtSpc;!i&&n&&(i=e>="a"&&e<="f"||e>="A"&&e<="F");i||t||n||(i=e==this._chrPls||e==this._chrNeg||"("==e||")"==e);return i};InputNumber.prototype._getInputRange=function(e){for(var t=[0,0],i=this.text,n=!1,o=0;o<i.length;o++)if(this._isNumeric(i[o],e)){if(!n){t[0]=o;n=!0}t[1]=o+1}return t};InputNumber.prototype._flipSign=function(){var e=this._getSelStartDigits();this.value*=-1;this._setSelStartDigits(e)};InputNumber.prototype._getSelStartDigits=function(){for(var e=0,t=this._tbx.selectionStart,i=this._tbx.value,n=0;n<i.length&&n<t;n++)this._isNumeric(i[n],!0)&&e++;return e};InputNumber.prototype._setSelStartDigits=function(e){for(var t=this._tbx.value,i=0;i<t.length&&e>=0;i++)if(this._isNumeric(t[i],!0)){if(!e){setSelectionRange(this._tbx,i);break}e--}else if(!e){setSelectionRange(this._tbx,i);break}};InputNumber.prototype._increment=function(e){if(e){var t=this.clamp(isNumber(this.value)?this.value+e:0),i=Globalize.format(t,this.format,!1,!1);this._setText(i)}};InputNumber.prototype._updateBtn=function(){var e=this.showSpinner&&!!this.step,t=e;setCss([this._btnUp,this._btnDn],{display:e?"":"none"});toggleClass(this.hostElement,"wj-input-show-spinner",e);enable(this._btnUp,t);enable(this._btnDn,t);this._updateAria()};InputNumber.prototype._setText=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=!1);if(!this._composing){var n=this._tbx,o=this._chrDec,s=this._rxNeg.test(e),r=this._delKey,a=this.containsFocus();e&&this._rxSym.test(e)&&a&&(e=this.isRequired||!r?(s?"-0":"0")+(e.indexOf(o)>-1?o:""):"");this._delKey=!1;r&&0==this.value&&!this.isRequired&&(e="");if(!e){if(!this.isRequired||i){n.value="";if(null!=this._value){this._value=null;this.onValueChanged()}if(this._oldText){this._oldText=e;this.onTextChanged()}this._updateBtn();return}e="0"}var l=e.indexOf(o),h=this._format||(l>-1?"n2":"n0"),u=Globalize.parseFloat(e,h);isFinite(u)||(u=this.clamp(u));if(isNaN(u))this.onInvalidInput(new CancelEventArgs)?n.value=this._oldText:this.focus();else{var c=a&&l>-1?2:null,p=Globalize.format(u,h,!1,t,c);s&&u>=0&&!r&&(p=this._chrNeg+p);a&&l>-1&&"g"==this._fmtSpc&&0!=this._fmtPrc&&(p=e).indexOf(o)<0&&(p+=o);if(n.value!=p){n.value=p;u=Globalize.parseFloat(p,h)}if(u!=this._value){this._value=u;this.onValueChanged()}if(this.text!=this._oldText){this._oldText=this.text;this.onTextChanged()}this._updateBtn();this._updateState()}}};InputNumber.prototype._keypress=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()&&e.charCode&&!e.ctrlKey&&!e.metaKey&&e.keyCode!=Key.Enter){var t=this._tbx,i=String.fromCharCode(e.charCode);if(this._isNumeric(i,!1)){var n=t.maxLength;if(n>-1&&t.value.length>=n&&t.selectionEnd==t.selectionStart){e.preventDefault();return}var o=this._getInputRange(!0),s=t.selectionStart,r=t.selectionEnd;if(s<o[0]&&r<t.value.length){r=Math.max(r,o[0]);setSelectionRange(t,o[0],r)}if(s>=o[1]){var a=null!=this._fmtPrc?this._fmtPrc:2,l=t.value.indexOf(this._chrDec);l>-1&&s-l>a&&e.preventDefault()}}else e.preventDefault();switch(i){case"-":case this._chrNeg:if(this.clamp(-1)>=0)this.value<0&&this._flipSign();else if(this.value&&t.selectionStart==t.selectionEnd)this._flipSign();else if(this.clamp(-1)<0){t.value=this._chrNeg;setSelectionRange(t,1)}e.preventDefault();break;case"+":case this._chrPls:this.value<0&&this._flipSign();e.preventDefault();break;case".":case this._chrDec:if(0==this._fmtPrc)e.preventDefault();else{var h=t.value.indexOf(this._chrDec);if(h>-1){t.selectionStart<=h&&h++;setSelectionRange(t,h);e.preventDefault()}}}if(!e.defaultPrevented&&isIE()){var u=t.value;if((s=t.selectionStart)==(r=t.selectionEnd)){t.value=u.substr(0,s)+i+u.substr(r);setSelectionRange(t,s+1);e.preventDefault();this._input()}}}};InputNumber.prototype._keydown=function(e){var t=this;this._delKey=!1;if(!e.defaultPrevented&&!this._composing){var i=hasClass(this._tbx,"wj-grid-ime");if(!i||e.keyCode==Key.Back||e.keyCode==Key.Delete){var n=this._tbx,o=n.value,s=n.selectionStart,r=n.selectionEnd;switch(e.keyCode){case 65:if(e.ctrlKey){setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Up:case Key.Down:if(this.step&&this._isEditable()){this._increment(this.step*(e.keyCode==Key.Up?1:-1));setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Back:this._delKey=!0;if(r-s<2&&this._isEditable()){var a=o[r-1];if(a==this._chrDec||a==this._chrPct||a==this._chrTho||")"==a){setTimeout((function(){r=a==t._chrPct?t._getInputRange(!0)[1]:r-1;setSelectionRange(n,r)}));e.preventDefault()}}break;case Key.Delete:this._delKey=!0;if(r-s<2&&this._isEditable())if("0"==o&&1==s)setSelectionRange(n,0);else{var l=o[s];if(l==this._chrDec||l==this._chrPct){setTimeout((function(){setSelectionRange(n,s+1)}));e.preventDefault()}}break;case Key.Escape:this.value=this._oldValue;this.selectAll()}i&&this._delKey&&this._isEditable()&&this._setText(null,!1,!0)}}};InputNumber.prototype._input=function(){var e=this;this._composing?this._fromKb=!0:setTimeout((function(){var t=e._tbx,i=t.value,n=i.indexOf(e._chrDec),o=t.selectionStart,s=e._getSelStartDigits();"p"==e._fmtSpc&&i.length&&i.indexOf(e._chrPct)<0&&(i+=e._chrPct);e._setText(i,e._fromKb);e._fromKb=!0;if(e.containsFocus()){var r=t.value,a=r.indexOf(e._chrDec),l=e._getInputRange(!0);if(i==e._chrNeg+e._chrDec&&a>-1){setSelectionRange(t,a+1);return}if(i[0]==e._chrNeg&&r[0]!=e._chrNeg){1==r.length?setSelectionRange(t,1):e._setSelStartDigits(s);return}i?i==e._chrDec&&a>-1?o=a+1:o<=n&&a>-1||n<0&&a<0?o+=r.length-i.length:n<0&&a>-1&&(o=a):o=a>-1?a:l[1];o=clamp(o,l[0],l[1]);setSelectionRange(t,o)}}))};InputNumber.prototype._clickSpinner=function(e){var t=this;if(!e.defaultPrevented&&this._isEditable()&&this.step){this._increment(this.step*(contains(this._btnUp,e.target)?1:-1));if(!this.isTouching){Control.sharedState.InvalidScroll=isEdge();setTimeout((function(){return t.selectAll()}))}}};InputNumber.prototype._updateAria=function(){var e=this.hostElement;if(e){setAttribute(e,"aria-valuemin",this.min);setAttribute(e,"aria-valuemax",this.max);setAttribute(e,"aria-valuenow",this.value);enable(this._btnDn,null==this.min||this.value>this.min);enable(this._btnUp,null==this.max||this.value<this.max)}};InputNumber.controlTemplate='<div class="wj-template"><div class="wj-input"><div class="wj-input-group"><span wj-part="btn-dec" class="wj-input-group-btn" tabindex="-1"><button class="wj-btn wj-btn-default" tabindex="-1">-</button></span><input type="tel" wj-part="input" class="wj-form-control wj-numeric"/><span wj-part="btn-inc" class="wj-input-group-btn" tabindex="-1"><button class="wj-btn wj-btn-default" tabindex="-1">+</button></span></div></div></div>';return InputNumber}(Control);export{InputNumber};var InputMask=function(e){__extends(InputMask,e);function InputMask(t,i){var n=e.call(this,t)||this;n._fullEdit=!1;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate("wj-control wj-content wj-inputmask",o,{_tbx:"input"},"input");if("INPUT"==n._orgTag){var s=n._tbx.getAttribute("value");s&&(n.value=s)}n._msk=new _MaskProvider(n._tbx);n.isRequired=!0;n.initialize(i);n.addEventListener(n._tbx,"input",(function(){n.onValueChanged()}));n.addEventListener(n._tbx,"blur",n._commitText.bind(n));n.addEventListener(n._tbx,"keydown",(function(e){e.keyCode==Key.Enter&&n._commitText()}));return n}Object.defineProperty(InputMask.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"value",{get:function(){return this._tbx.value},set:function(e){if(e!=this.value){this._tbx.value=asString(e);e=this._msk._applyMask();this._tbx.value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"rawValue",{get:function(){return this._msk.getRawValue()},set:function(e){e!=this.rawValue&&(this.value=asString(e))},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"mask",{get:function(){return this._msk.mask||""},set:function(e){var t=this.value;this._msk.mask=asString(e);this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"promptChar",{get:function(){return this._msk.promptChar},set:function(e){var t=this.value;this._msk.promptChar=e;this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"overwriteMode",{get:function(){return this._msk.overwriteMode},set:function(e){this._msk.overwriteMode=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"maskFull",{get:function(){return this._msk.maskFull},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0});InputMask.prototype.selectAll=function(){var e=this._msk.getMaskRange();setSelectionRange(this._tbx,e[0],e[1]+1)};InputMask.prototype.onValueChanged=function(e){if(this.value!=this._oldValue){this._oldValue=this.value;this.valueChanged.raise(this,e)}this._updateState()};InputMask.prototype._commitText=function(){(this.rawValue||this.isRequired)&&(this.maskFull||this.onInvalidInput(new CancelEventArgs));this._updateState()};InputMask.prototype.dispose=function(){this._msk.input=null;e.prototype.dispose.call(this)};InputMask.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._msk.refresh()};InputMask.prototype._isGridImeEnabled=function(){var e=this._tbx.closest(".wj-flexgrid");return!(!e||!e["$WJ-CTRL"]._imeHdl)};InputMask.prototype.onGotFocus=function(t){e.prototype.onGotFocus.call(this,t);this._isGridImeEnabled()&&!this._fullEdit||this.selectAll()};InputMask.controlTemplate='<div class="wj-input"><div class="wj-input-group"><input wj-part="input" class="wj-form-control"/></div></div>';return InputMask}(Control);export{InputMask};var ColorPicker=function(e){__extends(ColorPicker,e);function ColorPicker(t,i){var n=e.call(this,t)||this;n._hsb=[.5,1,1];n._alpha=1;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate("wj-control wj-content wj-colorpicker",o,{_eSB:"div-sb",_eHue:"div-hue",_eAlpha:"div-alpha",_ePreview:"div-pv",_ePal:"div-pal",_eText:"div-text"});n._palette="#FFF,#000,#F00,#FFC000,#FFFF00,#92D050,#00B050,#00B0F0,#0070C0,#7030A0".split(",");n._updatePalette();n._eHue.style.backgroundImage="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD4CAIAAACi6hsPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAGvSURBVDhPXdBPaM9xHMfxz4pWaxcmtoOhpdXSVpiyHWxqmVpDjaU5rK34XfypjTJ/p+ZPay6jhsOsRrKwaJElf9IQq03WIkv4FeMwMq221tfje1ByeFzfvd7PEKWGEKWTQRZLySWfVRRTQjmVbKWGOhLsZT+HaeY0bbTTQSfdXOcWffTzmAFeMcwoYyT5ygS/mA5hNgphip98J8kHRnnNSwZ4yH1uc4OrdHGR87RximYO0cgedlLLdqqoYAPrWMtKVrCcJSxiPmnMJUQp/Bsyk2xyyKOAQooopYwKtlDNDur5G7SBJo7RQiv/B+2hl3s84CkvGGKEOOYnxolj/mYmhBmDJ5ngCx95xxsGecYj4pB3iENeoZMO2mmlhaMcpIE4ZII6aqhmM3HMMkooopB88sghm0wySCeVlCjMCVFIYx4LWUwOeRSwhmLWU84mqqihll3sppEmjnOSs5zjEl1c4yZ99POE5wwxwns+840fTDFLFKaZZIJxkozxlmEGGSC+GF++Sy89dHOZC8Rr4lVnOMERDrCPBPXEX22jko2UEn+/mnxyWUYWC0gnNUQh/AEc0HJs6cex0gAAAABJRU5ErkJggg==)";n._eHue.style.backgroundSize="contain";if(navigator.appVersion.indexOf("MSIE 9")>-1){n._eSB.children[0].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff,endColorstr=#00ffffff,GradientType=1)";n._eSB.children[1].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ff000000,GradientType=0)"}o=ColorPicker._tplCursor;n._cSB=createElement(o);n._cHue=createElement(o);n._cHue.style.width="100%";n._cAlpha=createElement(o);n._cAlpha.style.height="100%";n._eSB.appendChild(n._cSB);n._eHue.appendChild(n._cHue);n._eAlpha.appendChild(n._cAlpha);var s=n.addEventListener.bind(n),r=n.removeEventListener.bind(n),a=document;s(n.hostElement,"mousedown",(function(e){s(a,"mousemove",mouseMove);s(a,"mouseup",mouseUp);n._mouseDown(e)}));s(n.hostElement,"touchstart",(function(e){s(a,"touchmove",mouseMove);s(a,"touchend",mouseUp);n._mouseDown(e)}));var mouseMove=function(e){n._mouseMove(e)},mouseUp=function(e){r(a,"mousemove",mouseMove);r(a,"mouseup",mouseUp);r(a,"touchmove",mouseMove);r(a,"touchend",mouseUp);n._mouseUp(e)};s(n.hostElement,"click",(function(e){var t=e.target;if(t&&"DIV"==t.tagName&&contains(n._ePal,t)){var i=t.style.backgroundColor;i&&(n.value=new Color(i).toString())}}));n.value="#ffffff";n.initialize(i);n._updatePanels();return n}Object.defineProperty(ColorPicker.prototype,"showAlphaChannel",{get:function(){return"none"!=this._eAlpha.parentElement.style.display},set:function(e){this._eAlpha.parentElement.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showColorString",{get:function(){return"none"!=this._eText.style.display},set:function(e){this._eText.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this.value){e=(e=asString(e)).trim();var t=Color.fromString(e);if(t){this._value=e;this._eText.innerText=e;var i=t.getHsb();if(this._hsb[0]!=i[0]||this._hsb[1]!=i[1]||this._hsb[2]!=i[2]||this._alpha!=t.a){if(0==i[2]){i[0]=this._hsb[0];i[1]=this._hsb[1]}else 0==i[1]&&(i[0]=this._hsb[0]);this._hsb=i;this._alpha=t.a;this._updatePanels();this.onValueChanged()}}}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"palette",{get:function(){return this._palette},set:function(e){if((e=(e=asArray(e)).slice(0,10)).every((function(e){return null!=Color.fromString(e)}))){this._palette=e;this._updatePalette()}},enumerable:!0,configurable:!0});ColorPicker.prototype.onValueChanged=function(e){this._updatePanels();this.valueChanged.raise(this,e)};ColorPicker.prototype._mouseDown=function(e){this._htDown=this._getTargetPanel(e);if(this._htDown){e.preventDefault();this.focus();this._mouseMove(e)}};ColorPicker.prototype._mouseMove=function(e){var t=e.touches?e.touches[0]:e,i=this._htDown;if(i){var n=i.getBoundingClientRect(),o=this._hsb;if(i==this._eHue)o[0]=clamp((t.clientY-n.top)/n.height,0,.99);else if(i==this._eSB){o[1]=clamp((t.clientX-n.left)/n.width,0,1);o[2]=clamp(1-(t.clientY-n.top)/n.height,0,1)}else i==this._eAlpha&&(this._alpha=clamp((t.clientX-n.left)/n.width,0,1));this._updateColor()}};ColorPicker.prototype._mouseUp=function(e){this._htDown=null};ColorPicker.prototype._updateColor=function(){var e=Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],this._alpha);this.value=e.toString();this._updatePanels()};ColorPicker.prototype._updatePalette=function(){var e=new Color("#fff"),t=new Color("#000");this._ePal.innerHTML="";for(var i=0;i<this._palette.length;i++){var n=createElement('<div style="float:left;width:10%;box-sizing:border-box;padding:1px">'),o=new Color(this._palette[i]),s=o.getHsb();n.appendChild(this._makePalEntry(o,4));for(var r=0;r<5;r++){if(0==s[1]){var a=.1*r+(s[2]>.5?.05:.55);o=Color.interpolate(e,t,a)}else o=Color.fromHsb(s[0],.1+.2*r,1-.1*r);n.appendChild(this._makePalEntry(o,0))}this._ePal.appendChild(n)}};ColorPicker.prototype._makePalEntry=function(e,t){var i=document.createElement("div");setCss(i,{cursor:"pointer",backgroundColor:e.toString(),marginBottom:t||""});i.innerHTML="&nbsp";return i};ColorPicker.prototype._updatePanels=function(){var e=Color.fromHsb(this._hsb[0],1,1,1),t=Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],1);this._eSB.style.backgroundColor=e.toString();this._eAlpha.style.background="linear-gradient(to right, transparent 0%, "+t.toString()+" 100%)";navigator.appVersion.indexOf("MSIE 9")>-1&&(this._eAlpha.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr="+t.toString()+", GradientType = 1)");this._ePreview.style.backgroundColor=this.value;this._cHue.style.top=(100*this._hsb[0]).toFixed(0)+"%";this._cSB.style.left=(100*this._hsb[1]).toFixed(0)+"%";this._cSB.style.top=(100-100*this._hsb[2]).toFixed(0)+"%";this._cAlpha.style.left=(100*this._alpha).toFixed(0)+"%"};ColorPicker.prototype._getTargetPanel=function(e){var t=e.target;return contains(this._eSB,t)?this._eSB:contains(this._eHue,t)?this._eHue:contains(this._eAlpha,t)?this._eAlpha:null};ColorPicker.controlTemplate='<div style="position:relative;width:100%;height:100%"><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-pal"><div style="float:left;width:10%;box-sizing:border-box;padding:2px"><div style="background-color:black;width:100%">&nbsp;</div><div style="height:6px"></div></div></div><div wj-part="div-text" style="position:absolute;bottom:0px;display:none"></div></div><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-sb" class="wj-colorbox" style="float:left;width:89%;height:89%"><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to right, white 0%,transparent 100%)"></div><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to top, black 0%,transparent 100%)"></div></div><div style="float:left;width:1%;height:89%"></div><div style="float:left;width:10%;height:89%"><div wj-part="div-hue" class="wj-colorbox"></div></div><div style="float:left;width:89%;height:1%"></div><div style="float:left;width:89%;height:10%"><div style="width:100%;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAAcSURBVBhXY/iPBBYgAWpKQGkwgMqDAdUk/v8HAM7Mm6GatDUYAAAAAElFTkSuQmCC)"><div wj-part="div-alpha" class="wj-colorbox"></div></div></div><div style="float:left;width:1%;height:10%"></div><div style="float:left;width:10%;height:10%"><div wj-part="div-pv" class="wj-colorbox" style="position:static"></div></div></div></div>';ColorPicker._tplCursor='<div style="position:absolute;left:50%;top:50%;width:7px;height:7px;transform:translate(-50%,-50%);border:2px solid #f0f0f0;border-radius:50px;box-shadow:0px 0px 4px 2px #0f0f0f"></div>';return ColorPicker}(Control);export{ColorPicker};var CollectionViewNavigator=function(e){__extends(CollectionViewNavigator,e);function CollectionViewNavigator(t,i){var n=e.call(this,t)||this;n._view=null;n._byPage=!1;n._fmt="{current:n0} / {count:n0}";var o=n.getTemplate();n.applyTemplate("wj-control wj-content wj-pager wj-collectionview-navigator",o,{_btnFirst:"btn-first",_btnPrev:"btn-prev",_txtCurr:"txt-curr",_btnNext:"btn-next",_btnLast:"btn-last"},"input");n._rptNext=new _ClickRepeater(n._btnNext.querySelector("button"));n._rptPrev=new _ClickRepeater(n._btnPrev.querySelector("button"));n.addEventListener(n.hostElement,"click",n._click.bind(n));n.initialize(i);n._update();return n}Object.defineProperty(CollectionViewNavigator.prototype,"cv",{get:function(){return this._view},set:function(e){if(e!=this._view){var t=this._view;if(t){t.collectionChanged.removeHandler(this._collectionChanged);t.currentChanged.removeHandler(this._currentChanged)}t=this._view=asType(e,"ICollectionView",!0);this._update();if(t){t.collectionChanged.addHandler(this._collectionChanged,this);t.currentChanged.addHandler(this._currentChanged,this)}}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"byPage",{get:function(){return this._byPage},set:function(e){if(e!=this._byPage){this._byPage=asBoolean(e);this._update()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"headerFormat",{get:function(){return this._fmt},set:function(e){if(e!=this._fmt){this._fmt=asString(e);this._update()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"repeatButtons",{get:function(){return!this._rptNext.disabled},set:function(e){this._rptNext.disabled=this._rptPrev.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});CollectionViewNavigator.prototype._update=function(){var e=this._view,t=this._byPage,i=e?t?e.pageIndex:e.currentPosition:0,n=e?t?e.pageCount:e.itemCount:0;enable(this._btnFirst,e&&i>0);enable(this._btnPrev,e&&i>0);enable(this._txtCurr,null!=e);enable(this._btnNext,e&&i<n-1);enable(this._btnLast,e&&i<n-1);this._txtCurr.value=format(this._fmt,{current:e?i+1:0,count:e?n:0,currentItem:e?e.currentPosition+1:0,itemCount:e?e.itemCount:0,currentPage:e?e.pageIndex+1:0,pageCount:e?e.pageCount:0})};CollectionViewNavigator.prototype._currentChanged=function(){this._update()};CollectionViewNavigator.prototype._collectionChanged=function(){this._update()};CollectionViewNavigator.prototype._click=function(e){var t=e.target,i=this._view,n=this._byPage;if(i){contains(this._btnFirst,t)?n?i.moveToFirstPage():i.moveCurrentToFirst():contains(this._btnPrev,t)?n?i.moveToPreviousPage():i.moveCurrentToPrevious():contains(this._btnNext,t)?n?i.moveToNextPage():i.moveCurrentToNext():contains(this._btnLast,t)&&(n?i.moveToLastPage():i.moveCurrentToLast());e.preventDefault()}};CollectionViewNavigator.controlTemplate='<div class="wj-input-group"><span wj-part="btn-first" class="wj-input-group-btn"><button class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-step-backward"></span></button></span><span wj-part="btn-prev" class="wj-input-group-btn"> <button class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-left"></span> </button></span><input wj-part="txt-curr" class="wj-form-control" readonly><span wj-part="btn-next" class="wj-input-group-btn"><button class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-right"></span></button></span><span wj-part="btn-last" class="wj-input-group-btn"><button class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-step-forward"></span></button></span></div>';return CollectionViewNavigator}(Control);export{CollectionViewNavigator};var ListBox=function(e){__extends(ListBox,e);function ListBox(t,i){var n=e.call(this,t,null,!0)||this;n._cv=null;n._itemFormatter=null;n._pathDisplay=new Binding("");n._pathValue=new Binding("");n._pathChecked=new Binding("");n._html=!1;n._shGroups=!1;n._checkedItems=[];n._itemRole="option";n._caseSensitive=!1;n._addMode=!1;n._vThreshold=ListBox._VTHRESH;n._isVirtual=!1;n._children=[];n._clientHeight=-1;n._itemHeight=30;n._itemsAbove=-1;n._itemsBelow=-1;n._eSizer=document.createElement("div");n._ePadTop=document.createElement("div");n._ePadBot=document.createElement("div");n._checking=!1;n._ignoredItemChangedEvents=!1;n._search="";n._fmtItemHandlers=0;n._itemCount=0;n._oldSel=null;n._container=null;n._oldSelectedIndex=-1;n.selectedIndexChanged=new Event;n.itemsChanged=new Event;n.loadingItems=new Event;n.loadedItems=new Event;n.itemChecked=new Event;n.checkedItemsChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n.applyTemplate("wj-control wj-content wj-listbox",null,null);var o=n.hostElement;setAttribute(o,"role","listbox",!0);"SELECT"==n._orgTag&&n._initFromSelect(n.hostElement);n.addEventListener(o,"click",n._click.bind(n));n.addEventListener(o,"keydown",n._keydown.bind(n));n.addEventListener(o,"keypress",n._keypress.bind(n));n.addEventListener(o,"wheel",(function(e){if(o.scrollHeight>o.offsetHeight&&(e.deltaY<0&&0==o.scrollTop||e.deltaY>0&&o.scrollTop+o.offsetHeight>=o.scrollHeight)){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation()}}));[n._eSizer,n._ePadTop,n._ePadBot].forEach((function(e){e.tabIndex=-1;setAttribute(e,"aria-hidden",!0);setCss(e,{pointerEvents:"none",opacity:"0"})}));n.initialize(i);n._updateViewRange();n.hostElement.addEventListener("scroll",(function(e){n._updateViewRange()}));return n}Object.defineProperty(ListBox.prototype,"itemsSource",{get:function(){return this._items},set:function(e){if(this._items!=e){if(this._cv){this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this);this._cv=null}this._items=e;this._cv=asCollectionView(e);if(null!=this._cv){this._cv.currentChanged.addHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)}this._populateList();this.onItemsChanged();this.onSelectedIndexChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"virtualizationThreshold",{get:function(){return this._vThreshold},set:function(e){if(e!=this._vThreshold){var t=this._getVirtual();this._vThreshold=asNumber(e,!1,!0);t!=this._getVirtual()&&this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"showGroups",{get:function(){return this._shGroups},set:function(e){if(e!=this._shGroups){this._shGroups=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"isContentHtml",{get:function(){return this._html},set:function(e){if(e!=this._html){this._html=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"displayMemberPath",{get:function(){return this._pathDisplay.path},set:function(e){if(e!=this.displayMemberPath){this._pathDisplay.path=asString(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValuePath",{get:function(){return this._pathValue.path},set:function(e){this._pathValue.path=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"checkedMemberPath",{get:function(){return this._pathChecked.path},set:function(e){if(e!=this.checkedMemberPath){this._pathChecked.path=asString(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"caseSensitiveSearch",{get:function(){return this._caseSensitive},set:function(e){this._caseSensitive=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemRole",{get:function(){return this._itemRole},set:function(e){if(e!=this.itemRole){this._itemRole=asString(e);this._populateList()}},enumerable:!0,configurable:!0});ListBox.prototype.getDisplayValue=function(e){var t=null;if(e>-1&&hasItems(this._cv)){t=this._cv.items[e];this.displayMemberPath&&(t=this._pathDisplay.getValue(t))}var i=null!=t?t.toString():"";this._itemFormatter&&(i=this._itemFormatter(e,i));return i};ListBox.prototype.getDisplayText=function(e){var t=this._getChild(e);return null!=t?t.textContent:""};ListBox.prototype.isItemEnabled=function(e){var t=this._getChild(e);return null!=t&&!t.hasAttribute("disabled")&&!hasClass(t,"wj-state-disabled")&&!hasClass(t,"wj-separator")};Object.defineProperty(ListBox.prototype,"selectedIndex",{get:function(){return this._cv?this._cv.currentPosition:-1},set:function(e){if(this._cv){this._oldSelectedIndex=this._cv.currentPosition;this._cv.moveCurrentToPosition(asNumber(e))}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedItem",{get:function(){return this._cv?this._cv.currentItem:null},set:function(e){this._cv&&this._cv.moveCurrentTo(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValue",{get:function(){var e=this.selectedItem;e&&this.selectedValuePath&&(e=this._pathValue.getValue(e));return e},set:function(e){var t=this._cv,i=t?t.items:null,n=this.selectedValuePath,o=-1;if(i){for(var s=0;s<i.length;s++){var r=i[s],a=n?this._pathValue.getValue(r):r;if(a===e||DateTime.equals(a,e)){o=s;break}if(this.isContentHtml&&isString(a)&&a.indexOf("<")>-1&&toPlainText(a)===e){o=s;break}}this.selectedIndex=o}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"maxHeight",{get:function(){var e=this.hostElement,t=e?parseFloat(e.style.maxHeight):null;return isNaN(t)?null:t},set:function(e){var t=this.hostElement;if(t){e=asNumber(e,!0);t.style.maxHeight=null==e?"":e+"px"}},enumerable:!0,configurable:!0});ListBox.prototype.showSelection=function(e){void 0===e&&(e=this.containsFocus());var t=this.hostElement,i=this._children,n=this._getSelectedElement(!1),o=new Rect(0,0,0,0);if(n!=this._oldSel){this._updateItemAttributes(n,!0);this._updateItemAttributes(this._oldSel,!1);this._oldSel=n}n instanceof HTMLElement?o=this._getBoundingClientRect(n):this._children.length>0&&(o=this._getBoundingClientRect(this._getChild(0)));var s=this._getBoundingClientRect(t),r=0;if(this._shGroups){r=this._itemHeight;if(!this._isVirtual){var a=i[0];a.offsetHeight&&hasClass(a,"wj-header")&&(r=a.offsetHeight)}}o.bottom>s.bottom?t.scrollTop+=o.bottom-s.bottom:o.top<s.top+r&&(t.scrollTop-=s.top+r-o.top);this._updateViewRange();n=this._getSelectedElement(!0);if(e){(n&&!contains(n,getActiveElement())?n:t).focus()}t.tabIndex=n?-1:this._orgTabIndex};ListBox.prototype.loadList=function(){this._populateList()};ListBox.prototype.getItemChecked=function(e){var t=this._cv.items[e],i=this._pathChecked;if(isObject(t)&&i.path)return i.getValue(t);var n=this._getCheckbox(e);return!!n&&n.checked};ListBox.prototype.setItemChecked=function(e,t){this._setItemChecked(e,t,!0)};ListBox.prototype.toggleItemChecked=function(e){this.setItemChecked(e,!this.getItemChecked(e))};Object.defineProperty(ListBox.prototype,"checkedItems",{get:function(){return this._checkedItems},set:function(e){e=Array.from(new Set(e));var t=asArray(e,!1);if(!this._arrayEquals(t,this._checkedItems)){this._updateCheckedList(t);if(!this._arrayEquals(t,this._checkedItems)){this._checkedItems=t;this.onCheckedItemsChanged()}}},enumerable:!0,configurable:!0});ListBox.prototype.indexOf=function(e){return(e=closest(e,".wj-listbox-item"))?e[ListBox._DIDX_KEY]:-1};ListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};ListBox.prototype.onItemsChanged=function(e){this.itemsChanged.raise(this,e)};ListBox.prototype.onLoadingItems=function(e){this.loadingItems.raise(this,e)};ListBox.prototype.onLoadedItems=function(e){this.loadedItems.raise(this,e)};ListBox.prototype.onItemChecked=function(e){this.itemChecked.raise(this,e)};ListBox.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};ListBox.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};ListBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){var i=this._cv?this._cv.items.length:0,n=this.formatItem.handlerCount;if(i!=this._itemCount||n!=this._fmtItemHandlers){this._fmtItemHandlers=n;this._populateList()}else this._updateViewRange()}};ListBox.prototype._updateCheckedList=function(e){var t=this,i=this._cv,n=this._pathChecked,o=new Map;if(n&&i){var s=i.sourceCollection;if(s&&s.length){isObject(s[0])||(n=null);e.forEach((function(e){return o.set(e,!0)}));this._checking=!0;var r=[];s.forEach((function(e){var t=o.has(e);t&&r.push(e);n&&n.setValue(e,t)}));this._checking=!1;e=r}i.items.forEach((function(e,i){t._setItemChecked(i,o.has(e),!1)}))}};ListBox.prototype._getBoundingClientRect=function(e){if(!e.offsetHeight){var t=this.indexOf(e),i=this.hostElement;if(t>-1&&i){t=this._getElementIndex(t);var n=i.getBoundingClientRect();return new Rect(0,n.top-i.scrollTop+t*this._itemHeight,n.width,this._itemHeight)}}return Rect.fromBoundingRect(e.getBoundingClientRect())};ListBox.prototype._updateItemAttributes=function(e,t){if(e){var i=this.checkedMemberPath?this._getCheckbox(this.indexOf(e)):null,n=i?i.checked:null;toggleClass(e,"wj-state-selected",t);setAttribute(e,"aria-selected",this._getAriaSelected(t,n));e.tabIndex=t?this._orgTabIndex:-1}};ListBox.prototype._getCheckedItems=function(){var e=this,t=this._cv,i=this._pathChecked,n=[];t&&i&&i.path&&(n=t.sourceCollection.filter((function(n,o){if(t.filter&&!t.filter(n))return!!e._addMode&&i.getValue(n);if(isObject(n))return i.getValue(n);var s=t.items[o]==n?o:t.items.indexOf(n);return e.getItemChecked(s)})));return n};ListBox.prototype._arrayEquals=function(e,t){if(e==t)return!0;if(!e||!t||e.length!=t.length)return!1;for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0};ListBox.prototype._getChild=function(e){e=this._getElementIndex(e);return this._children[e]};ListBox.prototype._getElementIndex=function(e){if(this._shGroups)for(var t=this._children,i=0;i<=e&&i<t.length;i++){var n=t[i];hasClass(n,"wj-header")&&e++}return e};ListBox.prototype._setItemChecked=function(e,t,i){void 0===i&&(i=!0);var n=this._cv.items[e],o=this._pathChecked,s=!1,r=this.selectedIndex,a=this._checking;if(isObject(n)&&o.path){if(!!o.getValue(n)!=t){var l=tryCast(this._cv,"IEditableCollectionView");s=!0;this._checking=!0;if(l){l.editItem(n);o.setValue(n,t);l.commitEdit()}else{o.setValue(n,t);l.refresh()}this._checking=a}}else if(i){var h=this._checkedItems.indexOf(n);(t&&h<0||!t&&h>=0)&&(s=!0)}var u=this._getCheckbox(e);if(u){u.checked=t;var c=closest(u,".wj-listbox-item");if(c){toggleClass(c,"wj-state-checked",t);setAttribute(c,"aria-selected",!!t||null)}}if(i){if(s){this._checkedItems=this._checkedItemsUpdate(n,t);this.onItemChecked();this.onCheckedItemsChanged()}r!=this.selectedIndex&&this.onSelectedIndexChanged()}return s};ListBox.prototype._checkedItemsUpdate=function(e,t){var i=this._cv.sourceCollection,n=this._checkedItems,o=0;if(t){for(var s=0;s<i.length;s++){var r=i[s];if(r===n[o]&&o<n.length)o++;else if(r===e)return n.slice(0,o).concat([e]).concat(n.slice(o))}return n}var a=n.indexOf(e);return n.slice(0,a).concat(n.slice(a+1))};ListBox.prototype._cvCollectionChanged=function(){if(!this._checking){this._populateList();this.onItemsChanged()}};ListBox.prototype._cvCurrentChanged=function(){if(!this._checking){this.showSelection();this._ignoredItemChangedEvents||this.onSelectedIndexChanged()}};ListBox.prototype._populateList=function(){var e=this.hostElement,t=this._cv;this._itemCount=t?t.items.length:0;this._isVirtual=this._getVirtual();this._oldSel=null;this._itemsAbove=-1;this._itemsBelow=-1;if(e){var i=this.containsFocus(),n=void 0;this.onLoadingItems();var o=this._children=[];e.textContent="";if(t){var s=0,r=void 0,a=[];if(this._shGroups&&t.groups&&t.groups.length){n={};for(var l=0;l<t.groups.length;l++){var h=t.groups[l];n[s]=h;r=this._createHeaderItem(h);a.push(r);for(var u=0;u<h.items.length;u++,s++){r=this._createItem(s);a.push(r)}}}else for(u=0;u<t.items.length;u++,s++){r=this._createItem(s);a.push(r)}var c=this._isVirtual?document.createElement("div"):e,p=0;c.innerHTML=a.join("");for(u=0;u<c.children.length;u++){var d=c.children[u];p==t.currentPosition&&(this._oldSel=d);d[ListBox._DIDX_KEY]=d.className.indexOf("wj-header")<0?p++:-1;o.push(d)}}if(this.formatItem.hasHandlers&&t){s=0;var f=t.items;for(d=new FormatItemEventArgs(0,null,null),u=0;u<o.length;u++){d._item=o[u];if(this._shGroups&&hasClass(d._item,"wj-header")){d._index=-1;d._data=n[s]}else{d._index=s;d._data=f[s++]}this.onFormatItem(d)}}if(this._isVirtual){var _=this._getCanvasContext(),m=null,g=0;for(u=0;u<o.length;u++){r=o[u];var b=_.measureText(r.textContent);if(b.width>g){m=r;g=b.width}}if(m){var y=!1,v=e.style.display,x=e.style.position;if(!e.parentElement){y=!0;(this._container||document.body).appendChild(e);setCss(e,{display:"",position:"absolute"})}e.appendChild(m);var w=m.style.whiteSpace;m.style.whiteSpace="nowrap";this._ePadTop.style.width=m.offsetWidth+"px";this._itemHeight=m.offsetHeight||this._itemHeight;m.style.whiteSpace=w;this._eSizer.style.height=o.length*this._itemHeight+"px";e.appendChild(this._eSizer);this._clientHeight=e.clientHeight;removeChild(this._eSizer);if(y){removeChild(e);setCss(e,{display:v,position:x})}removeChild(m)}else this._ePadTop.style.width="";this._updateViewRange()}this.checkedItems=this._getCheckedItems();var C=this._getSelectedElement(!0);if(i){(C||e).focus()}else C&&this.showSelection();e.tabIndex=C?-1:this._orgTabIndex;this.onLoadedItems()}};ListBox.prototype._getCanvasContext=function(){var e=document.createElement("canvas").getContext("2d"),t=getComputedStyle(this.hostElement);t.fontSize&&t.fontFamily&&(e.font=t.fontSize+" "+t.fontFamily.split(",")[0]);return e};ListBox.prototype._getVirtual=function(){if(this._itemCount<=this._vThreshold)return!1;var e=this.hostElement;if(e){var t=getComputedStyle(e);if(parseInt(t.columnCount)>1||t.display.indexOf("flex")>-1||t.display.indexOf("grid")>-1)return!1}return!0};ListBox.prototype._getMaxSupportedCssHeight=function(){var e=265e5;isIE()?e=15e5:isFirefox()&&(e=175e5);return e};ListBox.prototype._updateViewRange=function(){var e=this.hostElement,t=this._itemHeight,i=this._children;if(!(e&&e.parentElement&&this._isVirtual&&i))return!1;var n=e.scrollTop;assert(t*i.length<this._getMaxSupportedCssHeight(),"The number of items ("+i.length+") exceeds the maximum number of items ("+Math.floor(this._getMaxSupportedCssHeight()/t)+") allowed for this browser.");var o=Math.max(e.clientHeight,this._clientHeight),s=Math.floor(n/t),r=Math.min(i.length,Math.ceil((n+o)/t)-s),a=Math.max(0,i.length-s-r);if(s==this._itemsAbove&&a==this._itemsBelow)return!1;this._itemsAbove=s;this._itemsBelow=a;var l=document.createDocumentFragment(),h=this.containsFocus();this._ePadTop.style.height=s*t+"px";l.appendChild(this._ePadTop);if(this.showGroups&&!hasClass(i[s],"wj-header"))for(var u=s;u>=0;u--)if(hasClass(i[u],"wj-header")){l.appendChild(i[u]);break}for(u=s;u<=s+r&&u<i.length;u++)l.appendChild(i[u]);this._ePadBot.style.height=a*t+"px";l.appendChild(this._ePadBot);e.textContent="";e.appendChild(l);var c=(s+r+a)*t-e.scrollHeight;this._ePadBot.style.height=this._ePadBot.offsetHeight-c+"px";var p=this._getSelectedElement(!0);if(h){(p||e).focus({preventScroll:!0})}e.tabIndex=p?-1:this._orgTabIndex;return!0};ListBox.prototype._getSelectedElement=function(e){var t=this.selectedIndex,i=this._getElementIndex(t),n=i>-1?this._children[i]:null;e&&n&&!n.offsetHeight&&(n=null);return n};ListBox.prototype._handleResize=function(){this._updateViewRange()};ListBox.prototype._createItem=function(e){var t=this._cv.items[e],i=e==this._cv.currentPosition,n=this.getDisplayValue(e);1!=this._html&&(n=escapeHtml(n));var o=null;if(this.checkedMemberPath){o=!1;isObject(t)?o=!!this._pathChecked.getValue(t):this._checkedItems&&(o=this._checkedItems.indexOf(t)>-1);n='<label><input type="checkbox" tabindex="-1"'+(o?" checked":"")+"><span></span> "+n+"</label>"}var s="wj-listbox-item";i&&(s+=" wj-state-selected");o&&(s+=" wj-state-checked");if(this._html){var r=["wj-separator","wj-state-disabled"];if(n.indexOf(r[0])>-1||n.indexOf(r[1])>-1){var a=createElement(n);r.forEach((function(e){hasClass(a,e)&&(s+=" "+e)}))}}return'<div class="'+s+'" role="'+this.itemRole+'" '+(this._getAriaSelected(i,o)?'aria-selected="true" ':"")+'tabindex="'+(i&&!this.isDisabled?this._orgTabIndex:-1)+'">'+n+"</div>"};ListBox.prototype._getAriaSelected=function(e,t){return!!(null!=t?t:e)||null};ListBox.prototype._createHeaderItem=function(e){return'<div class="wj-listbox-item wj-header wj-state-disabled" role="presentation" tabindex="-1">'+escapeHtml(e.name)+"</div>"};ListBox.prototype._click=function(e){if(0==e.button&&!e.defaultPrevented){var t=this.indexOf(e.target);if(t>-1){this.selectedIndex=t;if(this.checkedMemberPath){var i=this._getCheckbox(t),n=closest(i,".wj-listbox-item");if(e.target==i||e.target==n){n.focus({preventScroll:!0});this.setItemChecked(t,i.checked)}}else{(n=closest(e.target,".wj-listbox-item")).focus({preventScroll:!0})}}}};ListBox.prototype._keydown=function(e){var t=this.selectedIndex;if(!e.defaultPrevented){if(65==e.keyCode&&(e.ctrlKey||e.metaKey)){var i=this.collectionView;if(this.checkedMemberPath&&hasItems(i)){this.checkedItems=this.checkedItems.length!=i.items.length?i.items:[];e.preventDefault();return}}if(!(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey))switch(e.keyCode){case Key.Down:e.preventDefault();this._selectNext();break;case Key.Up:e.preventDefault();this._selectPrev();break;case Key.Home:e.preventDefault();this._selectFirst();break;case Key.End:e.preventDefault();this._selectLast();break;case Key.PageDown:e.preventDefault();this._selectNextPage();break;case Key.PageUp:e.preventDefault();this._selectPrevPage();break;case Key.Space:if(this.checkedMemberPath&&t>-1){var n=this._getCheckbox(t);if(n&&this.isItemEnabled(t)){this.setItemChecked(t,!n.checked);e.preventDefault()}}}}};ListBox.prototype._keypress=function(e){var t=this;if(!e.defaultPrevented&&!(e.target instanceof HTMLInputElement)&&(e.charCode>32||32==e.charCode&&this._search)){e.preventDefault();this._search+=String.fromCharCode(e.charCode);this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){t._toSearch=null;t._search=""}),Control._SEARCH_DELAY);var i=this._findNext();if(i<0&&this._search.length>1){this._search=this._search[this._search.length-1];i=this._findNext()}i>-1&&(this.selectedIndex=i)}};ListBox.prototype._selectNext=function(){for(var e=this.selectedIndex+1;e<this._children.length;e++)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectPrev=function(){for(var e=this.selectedIndex-1;e>=0;e--)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectFirst=function(){for(var e=0;e<this._children.length;e++)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectLast=function(){for(var e=this._children.length-1;e>=0;e--)if(this.isItemEnabled(e)){this.selectedIndex=e;return!0}return!1};ListBox.prototype._selectNextPage=function(){var e=this.hostElement.offsetHeight,t=this._children,i=this._cv?this._cv.items.length:0,n=0;if(e>0)for(var o=this.selectedIndex+1;o<i;o++){var s=t[o].scrollHeight||this._itemHeight;if(n+s>e&&this.isItemEnabled(o)){this.selectedIndex=o;return!0}n+=s}return this._selectLast()};ListBox.prototype._selectPrevPage=function(){var e=this.hostElement.offsetHeight,t=this._children,i=0;if(e>0)for(var n=this.selectedIndex-1;n>0;n--){var o=t[n].scrollHeight||this._itemHeight;if(i+o>e&&this.isItemEnabled(n)){this.selectedIndex=n;return!0}i+=o}return this._selectFirst()};ListBox.prototype._findNext=function(){if(this.hostElement){var e=this._children.length,t=this.selectedIndex;(t<0||1==this._search.length)&&t++;var i=this._search,n=this.caseSensitiveSearch;n||(i=i.toLowerCase());for(var o=0;o<e;o++){var s=(t+o)%e;if(this.isItemEnabled(s)){var r=this.getDisplayText(s).trim();n||(r=r.toLowerCase());if(0==r.indexOf(i))return s}}}return-1};ListBox.prototype._getCheckbox=function(e){var t=this._children;e=this._getElementIndex(e);return this.hostElement&&e>-1&&e<t.length?t[e].querySelector("input[type=checkbox]"):null};ListBox.prototype._initFromSelect=function(e){for(var t=e.children,i=[],n=-1,o=0;o<t.length;o++){var s=t[o];if("OPTION"==s.tagName){s.hasAttribute("selected")&&(n=i.length);s.innerHTML?i.push({hdr:s.innerHTML,val:s.getAttribute("value"),cmdParam:s.getAttribute("cmd-param")}):i.push({hdr:'<div class="wj-separator"></div>'});e.removeChild(s);o--}}if(i){this.displayMemberPath="hdr";this.selectedValuePath="val";this.itemsSource=i;this.selectedIndex=n}};ListBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};ListBox.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};ListBox.prototype._updateTabIndex=function(){var e=this.hostElement,t=this._getSelectedElement(!0);if(t){t.tabIndex=this.isDisabled?-1:this._orgTabIndex;e.tabIndex=-1}else e.tabIndex=this.isDisabled?-1:this._orgTabIndex};ListBox._DIDX_KEY="$WJ-DIDX";ListBox._VTHRESH=Number.MAX_VALUE/2;return ListBox}(Control);export{ListBox};var FormatItemEventArgs=function(e){__extends(FormatItemEventArgs,e);function FormatItemEventArgs(t,i,n){var o=e.call(this)||this;o._index=asNumber(t);o._data=i;o._item=asType(n,HTMLElement,!0);return o}Object.defineProperty(FormatItemEventArgs.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0});Object.defineProperty(FormatItemEventArgs.prototype,"item",{get:function(){return this._item},enumerable:!0,configurable:!0});return FormatItemEventArgs}(EventArgs);export{FormatItemEventArgs};_addCultureInfo("MultiSelectListBox",{filterPlaceholder:"Filter",selectAll:"Select All"});var MultiSelectListBox=function(e){__extends(MultiSelectListBox,e);function MultiSelectListBox(t,i){var n=e.call(this,t)||this;n._selectAllLabel=null;n._filterPlaceholder=null;n._filterText="";n._checkOnFilter=!0;n._delay=Control._SEARCH_DELAY;n.checkedItemsChanged=new Event;n.selectedIndexChanged=new Event;var o=n.getTemplate();n.applyTemplate("wj-control wj-content wj-multiselectlistbox",o,{_selectAll:"select-all",_filter:"filter",_lbHost:"list-box"});n._selectAll.style.display="none";n._filter.style.display="none";n._lbx=new ListBox(n._lbHost,{checkedMemberPath:MultiSelectListBox._DEF_CHECKED_PATH,loadedItems:function(){return n._updateCheckAllCheckbox()},checkedItemsChanged:function(e){return n.onCheckedItemsChanged(e)},selectedIndexChanged:function(){return n.onSelectedIndexChanged()}});n._cbSelectAll=n._selectAll.querySelector("input[type=checkbox]");n._spSelectAll=n._selectAll.querySelector("label>span");var s=culture.MultiSelectListBox;setText(n._spSelectAll,s.selectAll);n._filter.placeholder=s.filterPlaceholder;n.initialize(i);n.addEventListener(n._filter,"input",(function(){if(n._filter.value!=n._filterText){n._filterText=n._filter.value;n._toSearch&&clearTimeout(n._toSearch);n._toSearch=setTimeout((function(){n._toSearch=null;n._applyFilter()}),n.delay)}}));n.addEventListener(n._cbSelectAll,"click",(function(e){var t=n._lbx.collectionView;hasItems(t)&&(n.checkedItems=e.target.checked?t.items:[])}));n.addEventListener(n.hostElement,"keydown",(function(e){var t=n.showFilterInput?n._filter:null,i=n._lbx;if(t&&e.keyCode==Key.F3){setSelectionRange(t,0,t.value.length);e.preventDefault()}if(getActiveElement()==t){var o=!e.altKey;switch(e.keyCode){case Key.Escape:case Key.F4:o=!1}o&&e.stopPropagation()}if(!i.containsFocus())switch(e.keyCode){case Key.Up:case Key.Down:n._lbx.focus();var s=i.selectedIndex+(e.keyCode==Key.Up?-1:1);i.selectedIndex=Math.max(0,s);e.preventDefault()}}),!0);n.hostElement.tabIndex=-1;n._lbx.tabOrder=n._orgTabIndex;return n}Object.defineProperty(MultiSelectListBox.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(e){this._lbx.itemsSource=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"virtualizationThreshold",{get:function(){return this._lbx.virtualizationThreshold},set:function(e){this._lbx.virtualizationThreshold=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(e){this._lbx.displayMemberPath=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(e){this._lbx.isContentHtml=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"caseSensitiveSearch",{get:function(){return this._lbx.caseSensitiveSearch},set:function(e){this._lbx.caseSensitiveSearch=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"delay",{get:function(){return this._delay},set:function(e){this._delay=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showGroups",{get:function(){return this._lbx.showGroups},set:function(e){this._lbx.showGroups=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkOnFilter",{get:function(){return this._checkOnFilter},set:function(e){if(e!=this.checkOnFilter){this._checkOnFilter=asBoolean(e);this.checkedItems=[]}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(e){this._lbx.selectedIndex=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showFilterInput",{get:function(){return""==this._filter.style.display},set:function(e){if(e!=this.showFilterInput){this._filter.style.display=asBoolean(e)?"":"none";if(!this.showFilterInput){this._filter.value="";this._applyFilter()}}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"filterInputPlaceholder",{get:function(){return this._filterPlaceholder},set:function(e){if(e!=this._filterPlaceholder){this._filterPlaceholder=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"showSelectAllCheckbox",{get:function(){return""==this._selectAll.style.display},set:function(e){this._selectAll.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"selectAllLabel",{get:function(){return this._selectAllLabel},set:function(e){if(e!=this._selectAllLabel){this._selectAllLabel=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkedMemberPath",{get:function(){var e=this.listBox.checkedMemberPath;return e!=MultiSelectListBox._DEF_CHECKED_PATH?e:null},set:function(e){e=asString(e);this.listBox.checkedMemberPath=e||MultiSelectListBox._DEF_CHECKED_PATH},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelectListBox.prototype,"checkedItems",{get:function(){return this.listBox.checkedItems},set:function(e){this.listBox.checkedItems=asArray(e)},enumerable:!0,configurable:!0});MultiSelectListBox.prototype.onCheckedItemsChanged=function(e){var t=this;this._updateCheckAllCheckbox();this.checkedItemsChanged.raise(this,e);"object"==typeof e._items[0]&&(this.checkedMemberPath||MultiSelectListBox._DEF_CHECKED_PATH)in e._items[0]&&setTimeout((function(){t._lbx._updateCheckedList(t.checkedItems)}),0)};MultiSelectListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};MultiSelectListBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){var i=culture.MultiSelectListBox;this._filter.placeholder=null!=this._filterPlaceholder?this._filterPlaceholder:i.filterPlaceholder;this._spSelectAll&&setText(this._spSelectAll,null!=this._selectAllLabel?this._selectAllLabel:i.selectAll);this._updateCheckAllCheckbox()}};MultiSelectListBox.prototype.dispose=function(){this.listBox.dispose();e.prototype.dispose.call(this)};MultiSelectListBox.prototype._applyFilter=function(){var e=this,t=this._lbx,i=t.collectionView,n=this._filter.value,o=n?new RegExp(escapeRegExp(n),t.caseSensitiveSearch?"":"i"):null,s=this.displayMemberPath,r=s?new Binding(s):null,a=this.checkOnFilter?null:this.checkedItems;i.filter=function(t){if(null!=o){if(a&&a.indexOf(t)>-1)return!0;r&&(t=r.getValue(t));e.isContentHtml&&(t=toPlainText(t));return null!=t&&o.test(t.toString())}return!0};t.selectedIndex=Math.max(0,t.selectedIndex);this._checkOnFilter&&(this.checkedItems=o?i.items:[])};MultiSelectListBox.prototype._updateCheckAllCheckbox=function(){var e=this._lbx.collectionView,t=this._cbSelectAll;if(hasItems(e)){var i=e.items.length,n=this.checkedItems.length;setChecked(t,n==i||0!=n&&null);t.disabled=!1}else{setChecked(t,!1);t.checked=!1;t.disabled=!0}};MultiSelectListBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this.hostElement.tabIndex=-1;this.isDisabled?this._lbx.tabOrder=-1:this._lbx.tabOrder=this._orgTabIndex};MultiSelectListBox.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._lbx.tabOrder=e};MultiSelectListBox.prototype.tryForceClearDelayAndFilter=function(){var e=this;if(this._toSearch){var t=this._delay;this._filterText=this._filter.value;this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout((function(){e._toSearch=null;e._applyFilter()}),0);this._delay=t}};MultiSelectListBox.prototype.onLostFocus=function(){this.tryForceClearDelayAndFilter();e.prototype.onLostFocus.call(this)};MultiSelectListBox._DEF_CHECKED_PATH="$checked";MultiSelectListBox.controlTemplate='<div class="wj-template wj-listbox"><input wj-part="filter" class="wj-form-control" tabindex="-1"><div wj-part="select-all" class="wj-header wj-select-all wj-listbox-item"><label><input type="checkbox" tabindex="-1"> <span></span></label></div><div wj-part="list-box"/></div>';return MultiSelectListBox}(Control);export{MultiSelectListBox};_addCultureInfo("Calendar",{ariaLabels:{calendar:"Calendar",monthView:"Month View",yearView:"Year View",prvMo:"Previous Month",today:"Select Today",nxtMo:"Next Month",prvYr:"Previous Year",currMo:"Current Month",nxtYr:"Next Year"}});export var DateSelectionMode;!function(e){e[e.None=0]="None";e[e.Day=1]="Day";e[e.Month=2]="Month";e[e.Range=3]="Range"}(DateSelectionMode||(DateSelectionMode={}));export var ShowMonthPicker;!function(e){e[e.None=0]="None";e[e.FirstMonth=1]="FirstMonth";e[e.LastMonth=2]="LastMonth";e[e.FirstAndLastMonths=3]="FirstAndLastMonths";e[e.AllMonths=4]="AllMonths";e[e.Outside=5]="Outside"}(ShowMonthPicker||(ShowMonthPicker={}));var Calendar=function(e){__extends(Calendar,e);function Calendar(t,i){var n=e.call(this,t)||this;n._yrPicker=!0;n._mtPicker=ShowMonthPicker.FirstMonth;n._wksBefore=0;n._wksAfter=0;n._rngMin=0;n._rngMax=0;n._min=null;n._max=null;n._readOnly=!1;n._handleWheel=!0;n._fdw=null;n._selMode=DateSelectionMode.Day;n._tmYrHidden=0;n._fmtYrMo="y";n._fmtYr="yyyy";n._fmtDayHdr="ddd";n._fmtDay="d ";n._fmtMonths="MMM";n.valueChanged=new Event;n.rangeEndChanged=new Event;n.rangeChanged=new Event;n.displayMonthChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n._value=n._rngEnd=DateTime.newDate();n._month=n._getMonth(n._value);n._cals=[n];n._createChildren();n._createYearPicker();var o=n.hostElement,s=n.addEventListener.bind(n);s(o,"keydown",n._keydown.bind(n));s(o,"click",n._click.bind(n));n._rptUp=new _ClickRepeater(n._btnPrv);n._rptDn=new _ClickRepeater(n._btnNxt);n.addEventListener(o,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!n.isReadOnly&&n.containsFocus()){e.deltaY<0?n._btnPrv.click():n._btnNxt.click();e.preventDefault()}}));n.initialize(i);n.refresh(!0);return n}Object.defineProperty(Calendar.prototype,"value",{get:function(){return this._value},set:function(e){if(e!==this._value){this._clearingRangeEnd=!DateTime.equals(this._value,e);this.rangeEnd=null;this._clearingRangeEnd=!1;e=asDate(e,!0);e=this._clamp(e);if(this._valid(e)||null==e){this.ensureVisible(e||new Date);if(!DateTime.equals(this._value,e)){this._value=e;this.invalidate(!1);this.onValueChanged()}}if(!this.value){var t=this.min,i=this.max,n=this.displayMonth;i&&i<n?this.ensureVisible(i):t&&t>n&&this.ensureVisible(t)}}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeEnd",{get:function(){return this._rngEnd},set:function(e){e=asDate(e,!0);if((e=this._clamp(e))&&this._value&&this._rngMode()){e<this._value&&(e=this._value);var t=this._rngMin,i=this._rngMax;if(t&&t>0||i&&i>0){var n=this._value,o=Math.ceil((e.getTime()-n.getTime())/864e5)+1;t&&t>0&&o<t&&(e=DateTime.addDays(n,t-1));i&&i>0&&o>i&&(e=DateTime.addDays(n,i-1))}}if((this._valid(e)||null==e)&&!DateTime.equals(this._rngEnd,e)){this._rngEnd=e;this.ensureVisible(e);this.invalidate(!1);this._clearingRangeEnd||this.onRangeEndChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeMin",{get:function(){return this._rngMin},set:function(e){if((e=asNumber(e,!0,!0))!=this._rngMin){this._rngMin=e;this._syncProp(this,"rangeMin");this._rngMode()&&this._rngEnd&&(this.rangeEnd=this._rngEnd)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"rangeMax",{get:function(){return this._rngMax},set:function(e){if((e=asNumber(e,!0,!0))!=this._rngMax){this._rngMax=e;this._syncProp(this,"rangeMax");this._rngMode()&&this._rngEnd&&(this.rangeEnd=this._rngEnd)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"min",{get:function(){return this._min},set:function(e){if((e=asDate(e,!0))!=this.min){this._min=e;this._syncProp(this,"min");this.refresh();!this.value&&e&&e>this.displayMonth&&this.ensureVisible(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"max",{get:function(){return this._max},set:function(e){if((e=asDate(e,!0))!=this.max){this._max=e;this._syncProp(this,"max");this.refresh();!this.value&&e&&e<this.displayMonth&&this.ensureVisible(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"selectionMode",{get:function(){return this._selMode},set:function(e){var t=DateSelectionMode;if((e=asEnum(e,t))!=this._selMode){this._selMode=e;this._mthMode()&&(this.monthView=!1);this._rngEnd=e==t.Range?this._value:null;this.refresh();this._syncProp(this,"selectionMode")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly);this._syncProp(this,"isReadOnly")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e);this._syncProp(this,"handleWheel")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e);this._syncProp(this,"repeatButtons")},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showYearPicker",{get:function(){return this._yrPicker},set:function(e){if(e!=this._yrPicker){this._yrPicker=asBoolean(e);this._syncProp(this,"showYearPicker")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showMonthPicker",{get:function(){return this._mtPicker},set:function(e){if(e!=this._mtPicker){var t=ShowMonthPicker;isBoolean(e)&&(e=e?t.FirstMonth:t.None);this._mtPicker=asEnum(e,t);toggleClass(this.hostElement,"wj-btns-outside",this._getShowMonthPicker()==t.Outside);this.refresh();this._syncProp(this,"showMonthPicker")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"firstDayOfWeek",{get:function(){return this._fdw},set:function(e){if(e!=this._fdw){if((e=asNumber(e,!0))&&(e>6||e<0))throw"firstDayOfWeek must be between 0 and 6 (Sunday to Saturday).";this._fdw=e;this.refresh();this._syncProp(this,"firstDayOfWeek")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"displayMonth",{get:function(){return this._month},set:function(e){e=asDate(e);e=this._getMonth(e);var t=this._getDisplayMonthRange();t.to&&e>t.to&&(e=t.to);t.from&&e<t.from&&(e=t.from);if(!DateTime.equals(this.displayMonth,e)){this._month=e;this.invalidate(!0);this.onDisplayMonthChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"monthCount",{get:function(){var e=this.hostElement;return e?e.querySelectorAll(".wj-calendar").length+1:0},set:function(e){var t=this,i=this.hostElement;if(e!=this.monthCount&&i){var n=i.querySelectorAll(".wj-calendar");e=asInt(e,!1);assert(e>0,"monthCount must be >= 1.");assert(1==e||!closest(i.parentElement,".wj-calendar"),"Only top-level calendars can set monthCount.");for(var o=0;o<n.length;o++){var s=n[o];removeChild(s);this._getCalendar(s).dispose()}this._cals=[this];for(o=1;o<e;o++){(s=new Calendar(document.createElement("div"),{itemFormatter:this.itemFormatter,itemValidator:this.itemValidator,formatItem:function(e,i){return t.onFormatItem(i)}}))._selMode=this._selMode;s._value=this._value;s._rngEnd=this._rngEnd;for(var r in this)if(!/^(_.*|constructor|displayMonth|monthCount|hostElement|rightToLeft|isUpdating|isTouching)$/.test(r)){var a=this[r];isFunction(a)||a instanceof Event||(s[r]=a)}this._cals.push(s);i.appendChild(s.hostElement)}toggleClass(i,"wj-calendar-multimonth",e>1);this._syncProp(this,"displayMonth")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatYearMonth",{get:function(){return this._fmtYrMo},set:function(e){if(e!=this._fmtYrMo){this._fmtYrMo=asString(e);this._syncProp(this,"formatYearMonth");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatDayHeaders",{get:function(){return this._fmtDayHdr},set:function(e){if(e!=this._fmtDayHdr){this._fmtDayHdr=asString(e);this._syncProp(this,"formatDayHeaders");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatDays",{get:function(){return this._fmtDay},set:function(e){if(e!=this._fmtDay){this._fmtDay=asString(e);this._syncProp(this,"formatDays");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatYear",{get:function(){return this._fmtYr},set:function(e){if(e!=this._fmtYr){this._fmtYr=asString(e);this._syncProp(this,"formatYear");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"formatMonths",{get:function(){return this._fmtMonths},set:function(e){if(e!=this._fmtMonths){this._fmtMonths=asString(e);this._syncProp(this,"formatMonths");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"showHeader",{get:function(){return"none"!=this._tbHdr.style.display},set:function(e){if(e!=this.showHeader){this._tbHdr.style.display=asBoolean(e)?"":"none";this._syncProp(this,"showHeader")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"monthView",{get:function(){return"none"!=this._tbMth.style.display},set:function(e){if(e!=this.monthView){this._tbMth.style.display=e?"":"none";this._tbYr.style.display=e?"none":"";this.refresh();var t=culture.Calendar.ariaLabels;setAriaLabel(this._btnPrv,e?t.prvMo:t.prvYr);setAriaLabel(this._btnTdy,e?t.today:t.currMo);setAriaLabel(this._btnNxt,e?t.nxtMo:t.nxtYr);setAriaLabel(this._btnMth,e?t.monthView:t.yearView);this._syncProp(this,"monthView")}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"weeksBefore",{get:function(){return this._wksBefore},set:function(e){if(e!=this._wksBefore){this._wksBefore=Math.floor(asNumber(e,!1,!0));this._syncProp(this,"weeksBefore");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"weeksAfter",{get:function(){return this._wksAfter},set:function(e){if(e!=this._wksAfter){this._wksAfter=Math.floor(asNumber(e,!1,!0));this._syncProp(this,"weeksAfter");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._syncProp(this,"itemFormatter");this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Calendar.prototype,"itemValidator",{get:function(){return this._itemValidator},set:function(e){if(e!=this._itemValidator){this._itemValidator=asFunction(e);this._syncProp(this,"itemValidator");this.invalidate()}},enumerable:!0,configurable:!0});Calendar.prototype.hitTest=function(e){var t=e instanceof MouseEvent?e.target:e instanceof Element?e:null;assert(null!=t,"MouseEvent or Element expected");return t?t[Calendar._DATE_KEY]:null};Calendar.prototype.ensureVisible=function(e){if(null!=e){var t=this._getCalendars(),i=t.indexOf(this),n=t[0],o=t[t.length-1];e<n.displayMonth?this.displayMonth=DateTime.addMonths(this._getMonth(e),i):e>o.displayMonth&&(this.displayMonth=DateTime.addMonths(this._getMonth(e),i-t.length+1))}};Calendar.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e);this._syncProp(this,"value")};Calendar.prototype.onRangeEndChanged=function(e){this.rangeEndChanged.raise(this,e);this._syncProp(this,"rangeEnd");this._value&&this._rngEnd&&this.onRangeChanged(e)};Calendar.prototype.onRangeChanged=function(e){this.rangeChanged.raise(this,e)};Calendar.prototype.onDisplayMonthChanged=function(e){this.displayMonthChanged.raise(this,e);this._syncProp(this,"displayMonth")};Calendar.prototype.onFormatItem=function(e){this.formatItem.raise(this,e)};Calendar.prototype._containsFocusImpl=function(t){return e.prototype._containsFocusImpl.call(this,t)||this._lbYears._containsFocusImpl(t)};Calendar.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;this._lbYears.dispose();e.prototype.dispose.call(this)};Calendar.prototype.refresh=function(t){void 0===t&&(t=!0);var i=this.hostElement,n=this.containsFocus();if(i){e.prototype.refresh.call(this,t);t&&this._updateContent();this._updateSelection();var o=this._getDisplayMonthRange(),s=this.displayMonth;enable(this._btnPrv,null==o.from||s>o.from);enable(this._btnNxt,null==o.to||s<o.to);if(n){var r=(this.monthView?this._tbMth:this._tbYr).querySelector("td.wj-state-selected")||i;r&&r.focus()}var a=this._getCalendars();a.length>1&&this==a[0]&&a.forEach((function(e,i){i>0&&e.refresh(t)}))}};Calendar.prototype._getShowMonthPicker=function(){var e=ShowMonthPicker,t=this._getCalendars(),i=t.indexOf(this),n=this.showMonthPicker;switch(n){case e.FirstMonth:case e.Outside:return 0==i?n:0;case e.LastMonth:return i==t.length-1?n:0;case e.FirstAndLastMonths:return 0==i||i==t.length-1?n:0;case e.AllMonths:return n}return 0};Calendar.prototype._getDisplayMonthRange=function(){var e={from:null,to:null};if(this.min||this.max){var t=this._getCalendars(),i=t.indexOf(this),n=this._mthMode()?DateTime.addYears:DateTime.addMonths;this.min&&(e.from=n(this._getMonth(this.min),i));this.max&&(e.to=n(this._getMonth(this.max),i-t.length+1))}return e};Calendar.prototype._getCalendar=function(e){return Control.getControl(e)};Calendar.prototype._getCalendars=function(){var e=closest(this.hostElement,".wj-calendar-multimonth");return(e?this._getCalendar(e):this)._cals};Calendar.prototype._syncProp=function(e,t){var i=this;if(!this._syncing){var n=this._getCalendars();if(n&&n.length>1){var o=e[t],s=this._mthMode()?DateTime.addYears:DateTime.addMonths;"displayMonth"==t&&(o=s(o,-n.indexOf(e)));n[0].deferUpdate((function(){i._syncing=!0;n.forEach((function(n,r){if(n!=e){var a=n.displayMonth;n[t]="displayMonth"==t?s(o,r):o;if("value"==t){n.displayMonth=a;i._rngMode()&&(n.rangeEnd=null)}}}));i._syncing=!1}))}}};Calendar.prototype._updateContent=function(){var e=this.displayMonth,t=Globalize.format,i=DateTime,n=this._getShowMonthPicker();setText(this._spMth,t(e,this._fmtYrMo));var o=this._btnMth.querySelector(".wj-glyph-down");o&&(o.style.display=this._mthMode()||!n?"none":"");var s=closest(this._btnTdy,".wj-btn-group");s&&(s.style.display=n?"":"none");for(var r=null!=this._fdw?this._fdw:Globalize.getFirstDayOfWeek(),a=i.addDays(e,-(e.getDay()-r+7)%7),l=i.monthLast(e),h=this._tbMth.querySelectorAll("td"),u=0;u<7&&u<h.length;u++){var c=i.addDays(a,u);setText(h[u],t(c,this._fmtDayHdr))}var p=this._tbMth.querySelectorAll("tr");for(u=1;u<p.length;u++)removeChild(p[u]);var d=i.addDays(a,-7*this._wksBefore);for(u=0;u<this._wksBefore;u++)d=this._addWeek(d,"wj-week-before");for(;d<=l;)d=this._addWeek(d);for(u=0;u<this._wksAfter;u++)d=this._addWeek(d,"wj-week-after");(h=this._tbYr.querySelectorAll("td")).length&&setText(h[0],t(e,this._fmtYr));for(u=1;u<h.length;u++){d=i.newDate(e.getFullYear(),u-1,1);var f=h[u],_=!this._monthInValidRange(d);f[Calendar._DATE_KEY]=d;setText(f,t(d,this._fmtMonths));toggleClass(f,"wj-state-disabled",_);setAriaLabel(f,Globalize.format(d,"MMMM yyyy"))}};Calendar.prototype._updateSelection=function(){for(var e=Calendar._DATE_KEY,t=DateTime,i=this._tbMth.querySelectorAll("td"),n=7;n<i.length;n++){var o=(u=i[n])[e],s=this.value,r=this.rangeEnd,a=this._selMode&&null!=s&&t.sameDate(o,s),l=this._selMode&&null!=s&&t.sameDate(o,r),h=this._selMode&&null!=s&&o>s&&null!=r&&o<=r;toggleClass(u,"wj-state-selected",a);toggleClass(u,"wj-state-multi-selected",h);toggleClass(u,"wj-state-last-selected",l);setAttribute(u,"aria-selected",!!a||null);this._customizeCell(n,o,u)}i=this._tbYr.querySelectorAll("td");for(n=0;n<i.length;n++){var u;o=(u=i[n])[e],a=this._sameMonth(o,this.value);toggleClass(u,"wj-state-selected",a);setAttribute(u,"aria-selected",!!a||null)}};Calendar.prototype._addWeek=function(e,t){for(var i=this._createElement("tr",this._tbMth,t),n=DateTime,o=0;o<7;o++){var s=this._createElement("td",i),r=n.addDays(e,o);s[Calendar._DATE_KEY]=r;setText(s,Globalize.format(r,this._fmtDay));setAriaLabel(s,Globalize.format(r,"D"));var a=!1,l=!1,h=r.getDay(),u=r.getMonth()!=this.displayMonth.getMonth();isDate(r)&&DateTime.sameDate(r,this._clamp(r))||(l=!0);isFunction(this.itemValidator)&&(a=!this.itemValidator(r));toggleClass(s,"wj-day-today",n.sameDate(r,n.newDate()));toggleClass(s,"wj-day-weekend",0==h||6==h);toggleClass(s,"wj-day-othermonth",u||!this._inValidRange(r)||l);toggleClass(s,"wj-state-invalid",a)}return n.addDays(e,7)};Calendar.prototype._customizeCell=function(e,t,i){isFunction(this.itemFormatter)&&this.itemFormatter(t,i);if(this.formatItem.hasHandlers){var n=new FormatItemEventArgs(e,t,i);this.onFormatItem(n)}};Calendar.prototype._canChangeValue=function(){return!this._readOnly&&this._selMode!=DateSelectionMode.None};Calendar.prototype._valid=function(e){return!(!isDate(e)||!DateTime.sameDate(e,this._clamp(e)))&&(!isFunction(this.itemValidator)||this.itemValidator(e))};Calendar.prototype._inValidRange=function(e){var t=DateTime.fromDateTime;return!(this.min&&e<t(this.min,e))&&!(this.max&&e>t(this.max,e))};Calendar.prototype._monthInValidRange=function(e){if(this.min||this.max){var t=e.getFullYear(),i=e.getMonth(),n=DateTime,o=n.newDate(t,i,1),s=n.newDate(t,i+1,0);if(this.min&&this.min>s)return!1;if(this.max&&this.max<o)return!1}return!0};Calendar.prototype._sameMonth=function(e,t){return isDate(e)&&isDate(t)&&e.getMonth()==t.getMonth()&&e.getFullYear()==t.getFullYear()};Calendar.prototype._getValidDate=function(e,t){if(isDate(e))for(var i=e.getFullYear(),n=e.getMonth()+(t?0:1),o=t?1:0,s=DateTime,r=s.newDate(i,n,o),a=t?1:-1,l=0;l<31;l++){if(this._valid(r))return r;r=s.addDays(r,a)}return null};Calendar.prototype._clamp=function(e){if(e){var t=DateTime.fromDateTime;if(this.min){var i=t(this.min,e);e<i&&(e=i)}if(this.max){var n=t(this.max,e);e>n&&(e=n)}}return e};Calendar.prototype._createChildren=function(){var e=this.getTemplate();this.applyTemplate("wj-control wj-calendar",e,{_tbHdr:"tbl-header",_btnMth:"btn-month",_spMth:"span-month",_btnPrv:"btn-prev",_btnTdy:"btn-today",_btnNxt:"btn-next",_tbMth:"tbl-month",_tbYr:"tbl-year"});this._tbYr.style.display="none";var t=culture.Calendar.ariaLabels;setAriaLabel(this._tbMth,t.calendar);setAriaLabel(this._tbYr,t.calendar);setAriaLabel(this._btnPrv,t.calendar);setAriaLabel(this._btnMth,t.monthView);setAriaLabel(this._btnPrv,t.prvMo);setAriaLabel(this._btnTdy,t.today);setAriaLabel(this._btnNxt,t.nxtMo);for(var i=this._createElement("tr",this._tbMth,"wj-header"),n=0;n<7;n++)this._createElement("td",i);i=this._createElement("tr",this._tbYr,"wj-header");this._createElement("td",i).setAttribute("colspan","4");for(var o=0;o<3;o++){i=this._createElement("tr",this._tbYr);for(var s=0;s<4;s++)this._createElement("td",i)}};Calendar.prototype._createYearPicker=function(){var e=this,t=this.hostElement,i=this._createElement("div",null,"wj-dropdown-panel wj-yearpicker");i.tabIndex=this._orgTabIndex;this._lbYears=new ListBox(i,{lostFocus:function(t){hidePopup(i);e._tmYrHidden=Date.now();e.removeEventListener(window,"touchstart");if(t.selectedIndex>-1){var n=DateTime.clone(e.displayMonth);n.setFullYear(t.selectedIndex+t.itemsSource[0]);e.displayMonth=n}}});this.addEventListener(i,"keydown",(function(i){switch(i.keyCode){case Key.Enter:t.focus();break;case Key.Escape:e._lbYears.selectedIndex=-1;t.focus()}i.defaultPrevented&&i.stopPropagation()}));this.addEventListener(i,"click",(function(e){t.focus()}))};Calendar.prototype._createElement=function(e,t,i){var n=document.createElement(e);i&&addClass(n,i);t&&t.appendChild(n);return n};Calendar.prototype._click=function(e){var t=this;if(!e.defaultPrevented&&0==e.button){var i=!1,n=e.target;if(contains(this._btnMth,n)&&!this._mthMode()&&this._getShowMonthPicker()){this.monthView=!this.monthView;i=!0}else if(contains(this._btnPrv,n)){this._navigate(-1);i=!0}else if(contains(this._btnNxt,n)){this._navigate(1);i=!0}else if(contains(this._btnTdy,n)){this._navigate(0);i=!0}if(n&&!i&&this._yrPicker&&contains(this._tbYr,n)&&closest(n,".wj-header")){if(Date.now()-this._tmYrHidden<600){e.preventDefault();return}for(var o=this.displayMonth.getFullYear(),s=this.min?this.min.getFullYear():o-100,r=this.max?this.max.getFullYear():o+100,a=[],l=s;l<=r;l++)a.push(l);var h=this._lbYears,u=h.hostElement,c=closest(n,".wj-header"),p=this.hostElement,d=closest(p,".wj-inputdate-dropdown")||p;h.itemsSource=a;h.selectedIndex=o-a[0];setAttribute(u,"dir",this.rightToLeft?"rtl":null);setCss(u,{minWidth:"",width:c.offsetWidth});showPopup(u,c,!1,!1,d);requestAnimationFrame((function(){h.showSelection(!0)}));this.addEventListener(window,"touchstart",(function(e){if(!contains(u,e.target)){hidePopup(u);t._tmYrHidden=Date.now();t.removeEventListener(window,"touchstart")}}));e.preventDefault();return}if(n&&!i){var f=closest(n,"td");if(f){var _=this.hitTest(f),m=DateTime.fromDateTime;if(this.monthView){if(_&&this._canChangeValue()){var g=m(_,this._value);this._inValidRange(g)&&this._valid(g)&&(this._rngMode()&&this.value&&!this.rangeEnd&&g>=this.value?this.rangeEnd=g:this.value=g);i=!0}}else if(_){this.displayMonth=_;if(this._mthMode()){if(this._canChangeValue()){g=m(this.displayMonth,this.value);this._inValidRange(g)&&(this.value=g)}}else this.monthView=!0;i=!0}}}if(i){e.preventDefault();this.focus()}}};Calendar.prototype._keydown=function(e){if(!e.defaultPrevented){if(e.altKey)switch(e.keyCode){case Key.Up:case Key.Down:return;case Key.End:this._navigate(0);e.preventDefault();return}if(!(e.ctrlKey||e.metaKey||e.shiftKey&&!this._rngMode())){var t=this._getKeyCode(e),i=0,n=0,o=!0;if(this.monthView)switch(t){case Key.Left:i=-1;break;case Key.Right:i=1;break;case Key.Up:i=-7;break;case Key.Down:i=7;break;case Key.PageDown:n=e.altKey?12:1;break;case Key.PageUp:n=e.altKey?-12:-1;break;case Key.Home:case Key.End:if(this._canChangeValue()&&!e.shiftKey){var s=this.value||this.displayMonth;if(a=this._getValidDate(s,t==Key.Home)){this.value=DateTime.fromDateTime(a,this.value);this._rngEnd=null}}break;default:o=!1}else switch(t){case Key.Left:n=-1;break;case Key.Right:n=1;break;case Key.Up:n=-4;break;case Key.Down:n=4;break;case Key.PageDown:n=e.altKey?120:12;break;case Key.PageUp:n=e.altKey?-120:-12;break;case Key.Home:n=this.value?-this.value.getMonth():0;break;case Key.End:n=this.value?11-this.value.getMonth():0;break;case Key.Enter:this._mthMode()?o=!1:this.monthView=!0;break;default:o=!1}if(this._canChangeValue()&&(i||n)){var r=e.shiftKey&&null!=this.rangeEnd?this.rangeEnd:this.value,a=DateTime;if(r){r=a.addDays(r,i);r=a.addMonths(r,n)}else r=this._getValidDate(new Date,!0);if(n&&!this._valid(r)){s=r.getMonth();for(var l=1;l<31&&!this._valid(r);l++){var h=a.addDays(r,+l),u=a.addDays(r,-l);this._valid(h)&&h.getMonth()==s?r=h:this._valid(u)&&u.getMonth()==s&&(r=u)}}for(l=0;l<31&&!this._valid(r);l++)r=a.addDays(r,i>0||n>0?1:-1);e.shiftKey&&r>this.value?this.rangeEnd=r:this.value=r}o&&e.preventDefault()}}};Calendar.prototype._getMonth=function(e){var t=DateTime;e=e||t.newDate();return t.newDate(e.getFullYear(),e.getMonth(),1)};Calendar.prototype._mthMode=function(){return this.selectionMode==DateSelectionMode.Month};Calendar.prototype._rngMode=function(){return this.selectionMode==DateSelectionMode.Range};Calendar.prototype._navigate=function(e){var t=this.monthView,i=this.displayMonth,n=DateTime;switch(e){case 0:var o=n.newDate();this._canChangeValue()&&(this.value=t?n.fromDateTime(o,this.value):this._getMonth(o));i=this._getMonth(o);break;case 1:i=n.addMonths(i,t?1:12);break;case-1:i=n.addMonths(i,t?-1:-12)}this.displayMonth=i};Calendar.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this._lbYears.tabOrder=this._orgTabIndex};Calendar._DATE_KEY="$WJ-DATE";Calendar.controlTemplate='<div class="wj-content wj-calendar-outer"><div wj-part="tbl-header" class="wj-calendar-header"><div wj-part="btn-month" class="wj-month-select" role="button"><span wj-part="span-month"></span> <span class="wj-glyph-down"></span></div><div class="wj-btn-group"><button wj-part="btn-prev" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-left"></span></button><button wj-part="btn-today" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-circle"></span></button><button wj-part="btn-next" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-right"></span></button></div></div><table wj-part="tbl-month" class="wj-calendar-month" role="grid"></table><table wj-part="tbl-year" class="wj-calendar-year" role="grid"></table></div>';return Calendar}(Control);export{Calendar};_addCultureInfo("DropDown",{ariaLabels:{tgl:"Toggle Dropdown"}});export var ClickAction;!function(e){e[e.Select=0]="Select";e[e.Open=1]="Open";e[e.Toggle=2]="Toggle"}(ClickAction||(ClickAction={}));var _Edges,DropDown=function(e){__extends(DropDown,e);function DropDown(t,i){var n=e.call(this,t)||this;n._clickAction=ClickAction.Select;n._showBtn=!0;n._autoExpand=!0;n._animate=!1;n._internalSettingText=!1;n._oldText="";n.textChanged=new Event;n.isDroppedDownChanging=new Event;n.isDroppedDownChanged=new Event;var o,s=n.getTemplate();n.applyTemplate("wj-control wj-content wj-dropdown",s,{_tbx:"input",_btn:"btn",_dropDown:"dropdown"},"input");n.hostElement&&n.hostElement.id&&(o=n.hostElement.id);o&&n._dropDown&&n._dropDown.setAttribute("dropdown-id",o);n._dropDown.style.display="none";var r=culture.DropDown.ariaLabels;setAriaLabel(n._btn.querySelector("button"),r.tgl);var a=n._elRef=n._tbx;disableAutoComplete(a);n._createDropDown();n._updateBtn();var l=n.hostElement;addClass(l,"wj-state-collapsed");n.addEventListener(window,"resize",(function(){n.isDroppedDown&&n.invalidate()}));var h=n.dropDown,u=n.addEventListener.bind(n),c=n._updateFocusState.bind(n);u(h,"blur",c,!0);u(h,"focus",c);var p=n._keydown.bind(n);u(l,"keydown",p);u(h,"keydown",p);var d=n._keypress.bind(n);u(l,"keypress",d,!0);u(h,"keypress",d,!0);u(a,"input",n._input.bind(n));u(a,"blur",(function(){n._commitText(!0)}),!0);u(a,"click",(function(){n._autoExpand&&n._expandSelection()}));u(a,"mousedown",(function(e){switch(n._clickAction){case ClickAction.Open:if(!n.isDroppedDown){e.preventDefault();n.focus();n.isDroppedDown=!0}break;case ClickAction.Toggle:e.preventDefault();n.focus();n.isDroppedDown=!n.isDroppedDown}}));u(n._btn,"mousedown",(function(e){n._btnclick(e)}));removeChild(h);isIE()&&n._elRef==n._tbx&&u(l,"mouseup",(function(e){if(!e.defaultPrevented&&0==e.button&&hasClass(e.target,"wj-btn")){var t=getActiveElement();t&&t!=e.target&&setTimeout((function(){t.focus()}))}}));isIE9()&&u(a,"keyup",(function(){n._setText(n.text,!1)}));u(h,"click",n._dropDownClick.bind(n));return n}Object.defineProperty(DropDown.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._setText(e,!0);this._commitText()}},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly);this.isReadOnly&&this._toogleDropDown(!1)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean("boolean"==typeof e?e:this.isRequired)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"clickAction",{get:function(){return this._clickAction},set:function(e){this._clickAction=asEnum(e,ClickAction)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isDroppedDown",{get:function(){var e=this._dropDown;return e&&"none"!=e.style.display},set:function(e){var t=this.hostElement,i=this._dropDown,n=this.containsFocus();if(t&&i){e=asBoolean(e)&&!this.isDisabled&&!this.isReadOnly&&t.offsetWidth>0;this.isDroppedDown&&!e&&this.isDisabled&&(e=this.isDroppedDown);if(e!=this.isDroppedDown&&this.onIsDroppedDownChanging(new CancelEventArgs)){this._toogleDropDown(e);n&&(this.isTouching&&this.showDropDownButton?t.focus():this.selectAll());this._updateFocusState();toggleClass(t,"wj-state-collapsed",!this.isDroppedDown);this.onIsDroppedDownChanged()}}},enumerable:!0,configurable:!0});DropDown.prototype._toogleDropDown=function(e){var t=this,i=this.hostElement,n=this._dropDown;if(e){this._minWidthDropdown=n.style.minWidth;n.style.display="";this._updateDropDown();this.addEventListener(window,"touchstart",(function(e){for(var n=Control._touching,o=e.target;o;){if(o==i)return;o=o[Control._OWNR_KEY]||o.parentNode}Control._touching=!0;t.isDroppedDown=!1;Control._touching=n}))}else{this.removeEventListener(window,"touchstart");hidePopup(n);n.style.minWidth=this._minWidthDropdown}};Object.defineProperty(DropDown.prototype,"dropDown",{get:function(){return this._dropDown},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"dropDownCssClass",{get:function(){return this._cssClass},set:function(e){if(e!=this._cssClass){removeClass(this._dropDown,this._cssClass);this._cssClass=asString(e);addClass(this._dropDown,this._cssClass)}},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"showDropDownButton",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"autoExpandSelection",{get:function(){return this._autoExpand},set:function(e){this._autoExpand=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(DropDown.prototype,"isAnimated",{get:function(){return this._animate},set:function(e){this._animate=asBoolean(e)},enumerable:!0,configurable:!0});DropDown.prototype.selectAll=function(){var e=this._tbx;this._elRef==e&&setSelectionRange(e,0,this.text.length);this.containsFocus()||this.focus()};DropDown.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};DropDown.prototype.onIsDroppedDownChanging=function(e){this.isDroppedDownChanging.raise(this,e);return!e.cancel};DropDown.prototype.onIsDroppedDownChanged=function(e){this.isDroppedDownChanged.raise(this,e)};DropDown.prototype.onGotFocus=function(t){this.isTouching||contains(this._dropDown,getActiveElement())||this.selectAll();e.prototype.onGotFocus.call(this,t)};DropDown.prototype.onLostFocus=function(t){this._commitText();this.isDroppedDown=!1;e.prototype.onLostFocus.call(this,t)};DropDown.prototype._containsFocusImpl=function(t){return e.prototype._containsFocusImpl.call(this,t)||this.isDroppedDown&&contains(this._dropDown,t)};DropDown.prototype.dispose=function(){this.isDroppedDown=!1;var t=this._dropDown;if(t){this._dropDown=null;removeChild(t);var i=Control.getControl(t);i&&i.dispose()}e.prototype.dispose.call(this)};DropDown.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);var i=this.hostElement;if(i&&i.offsetHeight&&this.isDroppedDown){var n=getActiveElement();this.isAnimated&&""!=this._dropDown.style.opacity||showPopup(this._dropDown,i,!1,!1,null==this.dropDownCssClass);n instanceof HTMLElement&&n!=getActiveElement()&&n.focus()}};DropDown.prototype._handleResize=function(){this.isDroppedDown&&this.refresh()};DropDown.prototype._dropDownClick=function(e){e.stopPropagation()};DropDown.prototype._expandSelection=function(){var e=this._tbx,t=e.value,i=e.selectionStart,n=e.selectionEnd;if(t&&i==n){var o=this._getCharType(t,i);if(o>-1){for(;n<t.length&&this._getCharType(t,n)==o;n++);for(;i>0&&this._getCharType(t,i-1)==o;i--);i!=n&&setSelectionRange(e,i,n)}}};DropDown.prototype._getCharType=function(e,t){var i=e[t];return i>="0"&&i<="9"?0:i>="a"&&i<="z"||i>="A"&&i<="Z"?1:-1};DropDown.prototype._keydown=function(e){if(!e.defaultPrevented&&!this._isHiddenEditor()){switch(e.keyCode){case Key.Tab:case Key.Escape:case Key.Enter:if(this.isDroppedDown){this.isDroppedDown=!1;e.keyCode==Key.Tab||this.containsFocus()||this.focus();e.preventDefault()}break;case Key.F4:case Key.Up:case Key.Down:if(e.keyCode==Key.F4||e.altKey){var t=this.hostElement;if(t&&t.offsetHeight){this.isDroppedDown=!this.isDroppedDown;e.preventDefault()}}}if(!e.defaultPrevented&&e.keyCode==Key.Escape&&isIE()){var i=this._tbx;if(e.target==i){var n=i.value;i.value=n+" ";i.value=n}}}};DropDown.prototype._isHiddenEditor=function(){return hasClass(this._tbx,"wj-grid-ime")};DropDown.prototype._keypress=function(e){"AltLeft"!=e.code&&"AltRight"!=e.code||e.preventDefault()};DropDown.prototype._input=function(e){this._setText(this.text,!1)};DropDown.prototype._btnclick=function(e){if(!e.defaultPrevented&&0==e.button){e.preventDefault();this.isTouching?this._containsFocus()||this.hostElement.focus():this.focus();this.isDroppedDown=!this.isDroppedDown}};DropDown.prototype._setText=function(e,t,i,n){var o=!1;if((e=(e||"").toString())!=this._tbx.value){this._tbx.value=e;if(i||!e){this.onTextChanged();o=!0}}if(e!=this._oldText){this._oldText=e;this._internalSettingText||o||this.onTextChanged()}n&&(this._tbx.value=this._tbx.value.trim());this._updateState()};DropDown.prototype._updateBtn=function(){this._btn.style.display=this._showBtn?"":"none"};DropDown.prototype._createDropDown=function(){};DropDown.prototype._commitText=function(e){};DropDown.prototype._updateDropDown=function(){if(this.isDroppedDown){this._commitText();var e=this.dropDown;setAttribute(e,"dir",this.rightToLeft?"rtl":null);showPopup(e,this.hostElement,!1,this._animate,null==this.dropDownCssClass)}};DropDown.controlTemplate='<div class="wj-template"><div class="wj-input"><div class="wj-input-group wj-input-btn-visible"><input wj-part="input" type="text" class="wj-form-control"><span wj-part="btn" class="wj-input-group-btn"><button class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-down"></span></button></span></div></div><div wj-part="dropdown" class="wj-content wj-dropdown-panel"></div></div>';return DropDown}(Control);export{DropDown};export var PopupTrigger;!function(e){e[e.None=0]="None";e[e.ClickOwner=1]="ClickOwner";e[e.ClickPopup=2]="ClickPopup";e[e.Click=3]="Click";e[e.BlurOwner=4]="BlurOwner";e[e.BlurPopup=8]="BlurPopup";e[e.Blur=12]="Blur";e[e.ClickOrBlur=15]="ClickOrBlur";e[e.DownOwner=16]="DownOwner";e[e.DownPopup=32]="DownPopup";e[e.Down=48]="Down";e[e.EnterOwner=64]="EnterOwner";e[e.EnterPopup=128]="EnterPopup";e[e.Enter=192]="Enter";e[e.LeaveOwner=256]="LeaveOwner";e[e.LeavePopup=512]="LeavePopup";e[e.Leave=768]="Leave"}(PopupTrigger||(PopupTrigger={}));!function(e){e[e.None=0]="None";e[e.Left=1]="Left";e[e.Top=2]="Top";e[e.Right=4]="Right";e[e.Bottom=8]="Bottom";e[e.LeftTop=3]="LeftTop";e[e.RightTop=6]="RightTop";e[e.RightBottom=12]="RightBottom";e[e.LeftBottom=9]="LeftBottom"}(_Edges||(_Edges={}));var Popup=function(e){__extends(Popup,e);function Popup(t,i){var n=e.call(this,t)||this;n._owner=null;n._modal=!1;n._position=PopupPosition.BelowLeft;n._showTrigger=PopupTrigger.ClickOwner;n._hideTrigger=PopupTrigger.Blur;n._hideAnim=[];n._fadeIn=!0;n._fadeOut=!0;n._removeOnHide=!0;n._draggable=!1;n._resizable=!1;n._result=null;n._resultEnter=null;n._resultSubmit=null;n._callback=null;n._visible=!1;n._ownerClickBnd=n._ownerClick.bind(n);n._ownerDownBnd=n._ownerDown.bind(n);n._ownerBlurBnd=n._ownerBlur.bind(n);n._ownerEnterBnd=n._ownerEnter.bind(n);n._ownerLeaveBnd=n._ownerLeave.bind(n);n._mousedownBnd=n._mousedown.bind(n);n._mousemoveBnd=n._mousemove.bind(n);n._mousedragBnd=n._mousedrag.bind(n);n._mouseupBnd=n._mouseup.bind(n);n._hideBnd=n.hide.bind(n);n._lastShow=0;n.showing=new Event;n.shown=new Event;n.hiding=new Event;n.hidden=new Event;n.resizing=new Event;n.resized=new Event;n.dragging=new Event;n.dragged=new Event;n.sizeChanging=new Event;n.sizeChanged=new Event;n.positionChanging=new Event;n.positionChanged=new Event;var o=n.hostElement;addClass(o,"wj-control wj-content wj-popup");o.getAttribute("tabindex")||(o.tabIndex=0);hidePopup(o,!1);var s=n.addEventListener.bind(n);s(o,"compositionstart",(function(){n._composing=!0}));s(o,"compositionend",(function(){n._composing=!1}));s(window,"resize",(function(){!n.isVisible||n._dragged||n.isTouching||n.invalidate()}));s(o,"keydown",(function(e){if(!e.defaultPrevented){if(e.keyCode==Key.Escape&&!n._composing){e.preventDefault();n.hide()}if(e.keyCode==Key.Enter&&!n._composing){var t=n.dialogResultEnter;if(t){e.preventDefault();n._validateAndHide(t)}}if(e.keyCode==Key.Tab&&n.modal){e.preventDefault();moveFocus(o,e.shiftKey?-1:1)}}}));s(o,"click",(function(e){var t=e.target;if(t instanceof HTMLElement){if(t instanceof HTMLButtonElement&&"submit"==t.type){var i=n.hostElement,o=n.dialogResultSubmit;if(i instanceof HTMLFormElement&&o&&i.reportValidity()){e.preventDefault();n.hide(o)}}var s=t.className.match(/\bwj-hide[\S]*\b/);if(s&&s.length>0){e.preventDefault();e.stopPropagation();n.hide(s[0])}}}));var r=n._toggle.bind(n),a=PopupTrigger;n.addEventListener(o,"click",(function(e){n._ignoreClick||r(e,a.ClickPopup)}),!0);n.addEventListener(o,"mousedown",(function(e){n._ignoreClick=!1;r(e,a.DownPopup)}),!0);n.addEventListener(o,"mouseenter",(function(e){e.target==o&&r(e,a.EnterPopup)}),!0);n.addEventListener(o,"mouseleave",(function(e){e.target==o&&r(e,a.LeavePopup)}),!0);n.addEventListener(o,"blur",(function(e){n.containsFocus()||r(e,a.BlurPopup)}),!0);s(document,"wheel",(function(e){if(n.isVisible&&n._modal){for(var t=e.target;t&&t!=document.body;t=t.parentElement)if(t.scrollHeight>t.clientHeight)return;e.preventDefault()}}));n.initialize(i);return n}Object.defineProperty(Popup.prototype,"owner",{get:function(){return this._owner},set:function(e){var t=this._owner;if(t){this.removeEventListener(t,"click");this.removeEventListener(t,"mousedown");this.removeEventListener(t,"mouseenter");this.removeEventListener(t,"mouseleave");this.removeEventListener(t,"blur")}if(t=this._owner=null!=e?getElement(e):null){this.addEventListener(t,"click",this._ownerClickBnd,!0);this.addEventListener(t,"mousedown",this._ownerDownBnd,!0);this.addEventListener(t,"mouseenter",this._ownerEnterBnd,!0);this.addEventListener(t,"mouseleave",this._ownerLeaveBnd,!0);this.addEventListener(t,"blur",this._ownerBlurBnd,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"position",{get:function(){return this._position},set:function(e){this._position=asEnum(e,PopupPosition)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"content",{get:function(){return this.hostElement.firstElementChild},set:function(e){if(e!=this.content){this.hostElement.innerHTML="";e instanceof HTMLElement&&this.hostElement.appendChild(e)}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"showTrigger",{get:function(){return this._showTrigger},set:function(e){this._showTrigger=asEnum(e,PopupTrigger)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"hideTrigger",{get:function(){return this._hideTrigger},set:function(e){this._hideTrigger=asEnum(e,PopupTrigger)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(e){this._fadeIn=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(e){this._fadeOut=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"removeOnHide",{get:function(){return this._removeOnHide},set:function(e){if((e=asBoolean(e))!=this.removeOnHide){this._removeOnHide=e;if(!this.isVisible){var t=this.hostElement;if(e)removeChild(t);else if(t&&document.body){t.style.display="none";document.body.appendChild(t)}}}},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"modal",{get:function(){return this._modal},set:function(e){this._modal=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isDraggable",{get:function(){return this._draggable},set:function(e){this._draggable=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isResizable",{get:function(){return this._resizable},set:function(e){this._resizable=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResult",{get:function(){return this._result},set:function(e){this._result=e},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResultEnter",{get:function(){return this._resultEnter},set:function(e){this._resultEnter=e},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"dialogResultSubmit",{get:function(){return this._resultSubmit},set:function(e){this._resultSubmit=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Popup.prototype,"isVisible",{get:function(){var e=this.hostElement;return this._visible&&null!=e&&e.offsetHeight>0},enumerable:!0,configurable:!0});Popup.prototype.show=function(e,t){var i=this;this._lastShow=Date.now();if(!this.isVisible){var n=this.hostElement;this.dialogResult=null;this._callback=null;this._oldFocus=null;this._myFocus=null;this._hideAnim.forEach((function(e){clearInterval(e)}));if(this._hideAnim.length>0){this._hideAnim.length=0;if(this._bkDrop){hidePopup(this._bkDrop,this.removeOnHide);this._bkDrop.style.opacity=""}hidePopup(n,this.removeOnHide);n.style.opacity=""}var o=new CancelEventArgs;if(this.onShowing(o)){null!=e&&(this.modal=asBoolean(e));null!=t&&(this._callback=asFunction(t));this._oldFocus=getActiveElement();showPopup(n,this._owner,this._position,this._fadeIn,!1,this._hideBnd);this._modal&&this._showBackdrop();this._composing=!1;this._visible=!0;this.onShown(o);this._clearTimeouts();if(this.modal){this.addEventListener(window,"focus",(function(){if(!i.containsFocus()){var e=i._myFocus;e&&e.offsetHeight?e.focus():moveFocus(n,0)}}));this.addEventListener(n,"focusin",(function(){var e=getActiveElement();e&&contains(n,e)&&(e.tabIndex>-1||!i._myFocus)&&(i._myFocus=e)}))}this._resized=this._dragged=this._ignoreClick=!1;this._handleDragResize(!0);this.addEventListener(window,"touchstart",(function(e){i._hideTrigger&PopupTrigger.Blur&&!contains(n,e.target,!0)&&i.hide()}));setTimeout((function(){i.addEventListener(window,"click",(function(e){i._hideTrigger&PopupTrigger.BlurPopup&&i.isDisabled&&!contains(n,e.target,!0)&&i.hide()}))}));setTimeout((function(){if(!i.isDisabled&&!i.containsFocus()&&!i.isTouching){var e=n.querySelector("[autofocus]");if(e&&e.clientHeight>0&&!e.disabled&&e.tabIndex>-1&&!closest(e,"[disabled],.wj-state-disabled")){e.focus();isFunction(e.select)&&e.select()}else moveFocus(n,0)}if(!i.isDisabled&&!i.containsFocus()){n.tabIndex=0;n.focus()}}),100)}}};Popup.prototype.hide=function(e){var t=this;this.removeEventListener(window,"touchstart");this.removeEventListener(window,"click");if(this.isVisible){isUndefined(e)||(this.dialogResult=e);var i=new CancelEventArgs,n=this.hostElement;if(this.onHiding(i)){this._handleDragResize(!1);for(var o=this.containsFocus()?this._oldFocus:null,s=n.querySelectorAll(".wj-control.wj-dropdown"),r=0;r<s.length;r++){var a=Control.getControl(s[r]);a instanceof DropDown&&(a.isDroppedDown=!1)}var l=this.removeOnHide,h=this.fadeOut;setTimeout((function(){t._updateState();t.onHidden(i);t._callback&&t._callback(t);if(t.hideTrigger&PopupTrigger.LeavePopup){var e=Control.getControl(closest(t.owner,".wj-popup"));if(e instanceof Popup&&0!=(e.hideTrigger&PopupTrigger.Leave)){var n=Popup._evtHover,o=n?document.elementFromPoint(n.clientX,n.clientY):null,s=Control.getControl(closest(o,".wj-popup"));s instanceof Popup&&!s.isVisible&&(o=null);o&&contains(e.hostElement,o,!0)||e.hide()}}}),Control._FOCUS_INTERVAL+50);this._bkDrop&&this._hideAnim.push(hidePopup(this._bkDrop,l,h));this._hideAnim.push(hidePopup(n,l,h));this._visible=!1;this._oldFocus=null;this._myFocus=null;this.removeEventListener(window,"focus");this.removeEventListener(n,"focusin");this.containsFocus()&&getActiveElement().blur();this._clearTimeouts();!this.isVisible&&o&&o.offsetHeight&&o.focus()}}};Popup.prototype.onShowing=function(e){this.showing.raise(this,e);return!e.cancel};Popup.prototype.onShown=function(e){this.shown.raise(this,e)};Popup.prototype.onHiding=function(e){this.hiding.raise(this,e);return!e.cancel};Popup.prototype.onHidden=function(e){this._wasVisible=!1;this.hidden.raise(this,e)};Popup.prototype.onResizing=function(e){this.resizing.raise(this,e);return!e.cancel};Popup.prototype.onResized=function(e){this.resized.raise(this,e)};Popup.prototype.onDragging=function(e){this.dragging.raise(this,e);return!e.cancel};Popup.prototype.onDragged=function(e){this.dragged.raise(this,e)};Popup.prototype.onSizeChanging=function(e){this.sizeChanging.raise(this,e);return!e.cancel};Popup.prototype.onSizeChanged=function(e){this.sizeChanged.raise(this,e)};Popup.prototype.onPositionChanging=function(e){this.positionChanging.raise(this,e);return!e.cancel};Popup.prototype.onPositionChanged=function(e){this.positionChanged.raise(this,e)};Popup.prototype.onLostFocus=function(t){e.prototype.onLostFocus.call(this,t);if(this._hideTrigger&PopupTrigger.BlurPopup&&!this.containsFocus()){var i=document.createEvent("Event");i.initEvent("blur",!0,!0);this._toggle(i,PopupTrigger.BlurPopup)}};Popup.prototype.dispose=function(){this.owner=null;e.prototype.dispose.call(this)};Popup.prototype.refresh=function(t){void 0===t&&(t=!0);var i=this.hostElement;e.prototype.refresh.call(this,t);if(this.isVisible&&!this._refreshing&&i){this._refreshing=!0;for(var n=getActiveElement(),o=this._owner?this._owner.getBoundingClientRect():null,s=[],r=i.querySelectorAll(".wj-dropdown"),a=0;a<r.length;a++){var l=Control.getControl(r[a]);if(l instanceof DropDown&&l.isDroppedDown){s.push(l);l.dropDown.style.display="none"}}showPopup(i,o,this._position);s.forEach((function(e){e.dropDown.style.display="";e._updateDropDown()}));this._modal&&n instanceof HTMLElement&&n!=getActiveElement()&&n.focus();this._refreshing=!1}};Popup.prototype._clearTimeouts=function(){if(this._toShow){clearTimeout(this._toShow);this._toShow=null}if(this._toHideLeave){clearTimeout(this._toHideLeave);this._toHideLeave=null}if(this._toHideBlur){clearTimeout(this._toHideBlur);this._toHideBlur=null}};Popup.prototype._handleDragResize=function(e){var t=this.hostElement,i=this._draggable?this._getHeaderElement():null,n=this.addEventListener.bind(this),o=this.removeEventListener.bind(this),s=this._mousemoveBnd,r=this._mousedownBnd;if(e){n(t,"mousemove",s);n(t,"mousedown",r);n(t,"touchstart",r);i&&(i.style.touchAction="none")}else{this._mousedownEvt=null;this._rcBounds=null;o(t,"mousemove",s);o(t,"mousedown",r);o(t,"touchstart",r);o(document,"mousemove",this._mousedragBnd);o(document,"mouseup",this._mouseupBnd);i&&(i.style.touchAction="")}};Popup.prototype._mousemove=function(e){if(!this._mousedownEvt){var t=this.hostElement,i=this._getEdges(t,e),n="",o=_Edges;this._edges=i;this._resizable&&(i==o.LeftTop||i==o.RightBottom?n="nwse-resize":i==o.LeftBottom||i==o.RightTop?n="nesw-resize":i==o.Left||i==o.Right?n="ew-resize":i!=o.Top&&i!=o.Bottom||(n="ns-resize"));this._draggable&&!n&&this._getClosestHeader(e.target)&&(n="move");t.style.cursor=n}};Popup.prototype._mousedown=function(e){if(!e.defaultPrevented){var t=e.touches&&e.touches.length>0?e.touches[0]:e;this._edges=this._getEdges(this.hostElement,t);if(this._edges||this._draggable&&this._getClosestHeader(e.target)){var i=new CancelEventArgs;if(this._edges?this.onResizing(i):this.onDragging(i)){this._mousedownEvt=t;this._rcBounds=this.hostElement.getBoundingClientRect();var n=this.addEventListener.bind(this),o=document,s=this._mousedragBnd,r=this._mouseupBnd;n(o,"mousemove",s);n(o,"touchmove",s);n(o,"mouseup",r);n(o,"touchend",r)}}this._ignoreClick=!1}};Popup.prototype._mouseup=function(){this._mousedownEvt=null;this._rcBounds=null;var e=this.removeEventListener.bind(this),t=document,i=this._mousedragBnd,n=this._mouseupBnd;e(t,"mousemove",i);e(t,"touchmove",i);e(t,"mouseup",n);e(t,"touchend",n);this._resized?this.onResized():this._dragged&&this.onDragged();this._resized=this._dragged=this._ignoreClick=!1};Popup.prototype._mousedrag=function(e){if(!e.defaultPrevented){var t=this.hostElement,i=this._mousedownEvt,n=e.touches&&e.touches.length>0?e.touches[0]:e,o=n.clientX-i.clientX,s=n.clientY-i.clientY,r=this._rcBounds,a=this._edges,l=Popup._SZ_MIN,h=Rect.fromBoundingRect(r);if(a){var u=window.getComputedStyle(t),c=parseInt(u.getPropertyValue("min-width"))||l,p=parseInt(u.getPropertyValue("min-height"))||l;if(a&_Edges.Left){var d=h.right-c;h.left=Math.min(h.left+o,d);h.width=Math.max(h.width-o,c)}else a&_Edges.Right&&(h.width=Math.max(h.width+o,c));if(a&_Edges.Top){var f=h.bottom-p;h.top=Math.min(h.top+s,f);h.height=Math.max(h.height-s,p)}else a&_Edges.Bottom&&(h.height=Math.max(h.height+s,p));if(this.onSizeChanging(new PopupBoundsChangingEventArgs(h))){setCss(t,{left:h.left+window.scrollX,top:h.top+window.scrollY,width:h.width,height:h.height,transform:"none"});this._resized=this._dragged=this._ignoreClick=!0;this.onSizeChanged()}if(!window.ResizeObserver)for(var _=this.hostElement.children,m=0;m<_.length;m++)Control.invalidateAll(_[m])}else if(this._draggable&&(this._dragged||Math.abs(o)+Math.abs(s)>Popup._DRAG_THRESHOLD)){h.left=Math.max(r.left+o+(n.pageX-n.clientX),50-r.width);h.top=Math.max(r.top+s+(n.pageY-n.clientY),0);if(this.onPositionChanging(new PopupBoundsChangingEventArgs(h))){setCss(t,{left:h.left,top:h.top});this._dragged=this._ignoreClick=!0;this.onPositionChanged()}}}};Popup.prototype._getEdges=function(e,t){var i=0;if(this._resizable){var n=e.getBoundingClientRect(),o=Popup._SZ_EDGE;t.clientX-n.left<o&&(i|=_Edges.Left);t.clientY-n.top<o&&(i|=_Edges.Top);n.right-t.clientX<o&&(i|=_Edges.Right);n.bottom-t.clientY<o&&(i|=_Edges.Bottom)}return i};Popup.prototype._ownerClick=function(e){this._toggle(e,PopupTrigger.ClickOwner)};Popup.prototype._ownerDown=function(e){this._wasVisible=this.isVisible;this._toggle(e,PopupTrigger.DownOwner)};Popup.prototype._ownerBlur=function(e){contains(this._owner,getActiveElement())||this._toggle(e,PopupTrigger.BlurOwner)};Popup.prototype._ownerEnter=function(e){e.target==this._owner&&this._toggle(e,PopupTrigger.EnterOwner)};Popup.prototype._ownerLeave=function(e){e.target==this._owner&&this._toggle(e,PopupTrigger.LeaveOwner)};Popup.prototype._toggle=function(e,t){var i=this;e instanceof MouseEvent&&(Popup._evtHover=e);if(!("mouseenter"==e.type&&Date.now()-this._lastShow<300||e.defaultPrevented)){var n=0!=(this._hideTrigger&t),o=0!=(this._showTrigger&t),s=PopupTrigger;(n||o)&&this._clearTimeouts();n&&this.isVisible&&(t&s.Leave?this._toHideLeave=setTimeout((function(){var e=Popup._evtHover,t=e?document.elementFromPoint(e.clientX,e.clientY):null;t&&contains(i.hostElement,t,!0)||i.hide()}),Control._LEAVE_DELAY):t&s.Blur?this._toHideBlur=setTimeout((function(){i.containsFocus()||contains(i._owner,getActiveElement())||i.hide()}),Control._FOCUS_INTERVAL+50):this.hide());o&&t!=s.ClickPopup&&(this._wasVisible||(t&s.Enter?this._toShow=setTimeout((function(){i.show()}),Control._HOVER_DELAY):this.show()))}};Popup.prototype._getHeaderElement=function(){var e=this.hostElement;return e.querySelector(".wj-dialog-header")||e.querySelector(".modal-header")};Popup.prototype._getClosestHeader=function(e){return closest(e,".wj-dialog-header")||closest(e,".modal-header")};Popup.prototype._showBackdrop=function(){var e=this;if(!this._bkDrop){this._bkDrop=document.createElement("div");this._bkDrop.tabIndex=-1;addClass(this._bkDrop,"wj-popup-backdrop");this.addEventListener(this._bkDrop,"mousedown",(function(t){t.preventDefault();t.stopPropagation();e.hostElement.focus();e.hideTrigger&PopupTrigger.Blur&&e.hide()}))}setCss(this._bkDrop,{zIndex:Control._POPUP_ZINDEX,display:""});var t=this.hostElement;t.parentElement.insertBefore(this._bkDrop,t)};Popup.prototype._validateAndHide=function(e){var t=this.hostElement;if(t instanceof HTMLFormElement)t.reportValidity()&&this.hide(e);else{var i=this.hostElement.querySelector(":invalid");i?i.focus():this.hide(e)}};Popup._DRAG_THRESHOLD=6;Popup._SZ_EDGE=10;Popup._SZ_MIN=40;return Popup}(Control);export{Popup};var PopupBoundsChangingEventArgs=function(e){__extends(PopupBoundsChangingEventArgs,e);function PopupBoundsChangingEventArgs(t){var i=e.call(this)||this;i._rc=t;return i}Object.defineProperty(PopupBoundsChangingEventArgs.prototype,"bounds",{get:function(){return this._rc},enumerable:!0,configurable:!0});return PopupBoundsChangingEventArgs}(CancelEventArgs);export{PopupBoundsChangingEventArgs};var InputDate=function(e){__extends(InputDate,e);function InputDate(t,i){var n=e.call(this,t)||this;n._fmt="d";n._sep=" - ";n._rngs=null;n._showCal=!1;n._clsOnSel=!0;n._handleWheel=!0;n._clicked=!1;n._rangeChanged=!1;n._textInitialized=!1;n.valueChanged=new Event;n.rangeEndChanged=new Event;n.rangeChanged=new Event;addClass(n.hostElement,"wj-inputdate");n._msk=new _MaskProvider(n._tbx);isIE9()||(n.inputType="tel");n._tbx.type.match(/^(tel|text|)$/i)||(n.inputType="text");n.addEventListener(n.hostElement,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!n.isDroppedDown&&n.containsFocus()&&null!=n.value&&n._canChangeValue()){var t=clamp(-e.deltaY,-1,1),i=n.value;n.value=n.selectionMode==DateSelectionMode.Month?DateTime.addMonths(i,t):DateTime.addDays(i,t);n.selectAll();e.preventDefault()}}));var o=n._lbx=new ListBox(document.createElement("div"),{displayMemberPath:"name",selectedIndexChanged:function(e){var t=e.selectedItem,i=DateTime.fromDateTime,o=DateTime.sameDate;if(t&&t.from&&t.to){if(!o(t.from,n.value)||!o(t.to,n.rangeEnd)){var s=n.value;n.value=i(t.from,s);n.rangeEnd=i(t.to,s)}n._selectAll()}else n._cal.hostElement.style.display=""}}),s=n._cal=new Calendar(document.createElement("div")),r=n._dropDown;addClass(r,"wj-inputdate-dropdown");r.appendChild(o.hostElement);r.appendChild(s.hostElement);n.addEventListener(r,"click",(function(){n._clicked=!0;setTimeout((function(){n._clicked=!1}),50)}),!0);if("INPUT"==n._orgTag){var a=n._tbx.getAttribute("value");a&&(s.value=s.rangeEnd=Globalize.parseDate(a,"yyyy-MM-dd"))}n.isRequired=!0;n._tbx.value=n._oldText=n._getText();n.initialize(i);if(n._textInitialized&&n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n._commitText();n.onTextChanged();n._textInitialized=!1}n._updateState();s.valueChanged.addHandler((function(e,t){n._refreshText();n.onValueChanged(t);n._closeOnChange()}));s.rangeEndChanged.addHandler((function(e,t){if(s._rngMode()){n.onRangeEndChanged(t);n._closeOnChange();s._clearingRangeEnd||n._refreshText()}}));s.hostElement.addEventListener("click",(function(e){if(s.selectionMode&&!s._rngMode()){var t=e.target,i=s.hitTest(t);if(DateTime.sameDate(n.value,i)||closest(t,"[wj-part=btn-today]")){n._closeOnChange();n._refreshText()}}}));return n}Object.defineProperty(InputDate.prototype,"value",{get:function(){return this._cal.value},set:function(e){this._cal.value=e;(this.text||this.isRequired)&&this._refreshText()},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeEnd",{get:function(){return this._cal.rangeEnd},set:function(e){this._cal.rangeEnd=e;(this.text||this.isRequired)&&this._refreshText()},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeMin",{get:function(){return this._cal.rangeMin},set:function(e){this._cal.rangeMin=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"rangeMax",{get:function(){return this._cal.rangeMax},set:function(e){this._cal.rangeMax=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"text",{get:function(){return this._tbx.value},set:function(e){var t=(e||"").toString();if(t!=this.text){t!=this._tbx.value&&(this._tbx.value=t);t!=this._oldText&&(this._oldText=t);this._commitText();this.onTextChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"format",{get:function(){return this._fmt},set:function(e){if(e!=this.format){this._fmt=asString(e);this._refreshText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"separator",{get:function(){return this._sep},set:function(e){if(e!=this._sep){this._sep=asString(e,!1);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"mask",{get:function(){return this._msk.mask},set:function(e){this._msk.mask=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"closeOnSelection",{get:function(){return this._clsOnSel},set:function(e){this._clsOnSel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){e=asBoolean(e);this._handleWheel=e;e||(this.calendar.handleWheel=e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"predefinedRanges",{get:function(){return this._rngs},set:function(e){if(this._rngs!=e){assert(null==e||isObject(e),"Object expected");this._rngs=e;this._lbx.itemsSource=this._getRanges(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"alwaysShowCalendar",{get:function(){return this._showCal},set:function(e){this._showCal=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"min",{get:function(){return this._cal.min},set:function(e){this._cal.min=asDate(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"max",{get:function(){return this._cal.max},set:function(e){this._cal.max=asDate(e,!0)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"repeatButtons",{get:function(){return this._cal.repeatButtons},set:function(e){this._cal.repeatButtons=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showYearPicker",{get:function(){return this._cal.showYearPicker},set:function(e){this._cal.showYearPicker=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showMonthPicker",{get:function(){return this._cal.showMonthPicker},set:function(e){this._cal.showMonthPicker=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"showHeader",{get:function(){return this._cal.showHeader},set:function(e){this._cal.showHeader=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"weeksBefore",{get:function(){return this._cal.weeksBefore},set:function(e){this._cal.weeksBefore=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"weeksAfter",{get:function(){return this._cal.weeksAfter},set:function(e){this._cal.weeksAfter=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"selectionMode",{get:function(){return this._cal.selectionMode},set:function(e){if(e!=this.selectionMode){this._cal.selectionMode=e;this._refreshText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"monthCount",{get:function(){return this._cal.monthCount},set:function(e){this._cal.monthCount=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"calendar",{get:function(){return this._cal},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){e.match(/^(tel|text|)$/i)?this._tbx.type=asString(e):console.warn("invalid input type '"+e+"', don't use any input types other than 'tel' or 'text'")},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"itemValidator",{get:function(){return this._cal.itemValidator},set:function(e){if(e!=this.itemValidator){this._cal.itemValidator=asFunction(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(InputDate.prototype,"itemFormatter",{get:function(){return this._cal.itemFormatter},set:function(e){this._cal.itemFormatter=asFunction(e)},enumerable:!0,configurable:!0});InputDate.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputDate.prototype.onRangeEndChanged=function(e){this.rangeEndChanged.raise(this,e);this.rangeEnd&&(this.isDroppedDown?this._rangeChanged=!0:this.onRangeChanged(e))};InputDate.prototype.onRangeChanged=function(e){this._rangeChanged=!1;this.rangeChanged.raise(this,e)};InputDate.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._msk&&this._msk.refresh();this._cal&&this._cal.refresh();this._refreshText()}};InputDate.prototype.onIsDroppedDownChanging=function(t){if(this.isDroppedDown){(n=this._cal)._rngMode()&&n.value&&!n.rangeEnd&&(n.rangeEnd=n.value)}else{var i=this._lbx,n=this._cal,o=i.collectionView,s=i.hostElement.style,r=n.hostElement.style;if(n._rngMode()&&hasItems(o)){var a=this._updateRangeSelection();s.display="";r.display=!this._showCal&&a&&a.from&&o.items.some((function(e){return!e.to}))?"none":""}else{s.display="none";r.display=""}n._mthMode()||(n.monthView=!0)}return e.prototype.onIsDroppedDownChanging.call(this,t)};InputDate.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);var i=this.containsFocus();if(this.isDroppedDown){i&&(this._tryFocus(this._cal)||this._tryFocus(this._lbx)||this.dropDown.focus());this._lbx.showSelection();this._cal.refresh()}else{this._commitText();this._rangeChanged&&this.onRangeChanged()}};InputDate.prototype._updateDropDown=function(){this._commitText();var t=getComputedStyle(this.hostElement);this._dropDown.style.minWidth=18*parseFloat(t.fontSize)+"px";this._cal.refresh();e.prototype._updateDropDown.call(this)};InputDate.prototype._keydown=function(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)){if(this._isHiddenEditor())return;switch(t.keyCode){case Key.Enter:this.isDroppedDown?this._refreshText():this._commitText();break;case Key.Escape:this.text=this._getText();this.selectAll();break;case Key.Tab:if(this._cal._rngMode()){var i=this._tbx,n=this._sep,o=i.value,s=o.indexOf(n);if(s>-1){var r=o.length,a=i.selectionStart,l=i.selectionEnd,h=null;i.selectionEnd<=s&&!t.shiftKey?h=0==a&&0==l:t.shiftKey&&i.selectionStart>=s+n.length&&(h=a<r||l<r);if(null!=h){h?setSelectionRange(i,0,s):setSelectionRange(i,s+n.length,r);t.preventDefault()}}}break;case Key.Up:case Key.Down:if(!this.isDroppedDown&&this.value&&this._canChangeValue()){var u=t.keyCode==Key.Up?1:-1,c=this.selectionMode==DateSelectionMode.Month?DateTime.addMonths(this.value,u):DateTime.addDays(this.value,u);this.value=this._fromDateTime(c);this.selectAll();t.preventDefault()}}}e.prototype._keydown.call(this,t)};InputDate.prototype._expandSelection=function(){if(this._cal._rngMode()){var t=this._tbx,i=t.value,n=t.selectionStart,o=t.selectionEnd,s=this._sep,r=i.indexOf(s);r>-1&&n==o&&(o<=r?setSelectionRange(t,0,r):n>=r+s.length&&setSelectionRange(t,r+s.length,t.value.length))}else e.prototype._expandSelection.call(this)};InputDate.prototype._refreshText=function(){var e=this._getText();if(e!=this.text||e!==this._oldText){this._tbx.value=this._oldText=e;this.onTextChanged()}};InputDate.prototype._selectAll=function(){this.isDroppedDown||!this.containsFocus()||this.isTouching||this.selectAll()};InputDate.prototype._closeOnChange=function(){var e=this;if(this._clsOnSel&&this._clicked){var t=this._cal;(!t._rngMode()||t.value&&t.rangeEnd)&&setTimeout((function(){e.isDroppedDown=!1}))}};InputDate.prototype._tryFocus=function(e){var t=e.hostElement;if(t&&t.offsetHeight){t.focus();return!0}return!1};InputDate.prototype._clamp=function(e){return this._cal._clamp(e)};InputDate.prototype._getText=function(){var e=Globalize.format,t=this._fmt,i=e(this.value,t);this._cal._rngMode()&&i&&(i+=this._sep+e(this.rangeEnd,t));return i};InputDate.prototype._commitText=function(e){var t=this._tbx.value;if(t!=this._getText()){var i=!1,n=this._fmt,o=this._cal,s=Globalize.parseDate;if(t||this.isRequired)if(o._rngMode()){var r=t.split(this._sep);if(2==r.length&&r[0]){if(l=s(r[0],n,this.value)){var a=s(r[1],n,this.value);o.value=this._fromDateTime(l);o.rangeEnd=a&&a>=l?this._fromDateTime(a):l;i=!0}}}else{var l;if(l=s(t,n,this.value)){this.value=this._fromDateTime(l);i=!0}}else{this.value=this.rangeEnd=null;i=!0}(i||!this._containsFocus()&&this.onInvalidInput(new CancelEventArgs))&&(this.text=this._getText())}e||this._selectAll()};InputDate.prototype._fromDateTime=function(e){return DateTime.fromDateTime(e,this.value)};InputDate.prototype._canChangeValue=function(){return!this.isReadOnly&&!this.isDisabled&&this.selectionMode!=DateSelectionMode.None};InputDate.prototype._isValidDate=function(e){if(e){if(this._clamp(e)!=e)return!1;if(this.itemValidator&&!this.itemValidator(e))return!1}return!0};InputDate.prototype._getRanges=function(e){var t=[];if(isObject(e))for(var i in e){var n=e[i];t.push({name:i,from:n?n[0]:null,to:n?n[1]:null})}return new CollectionView(t,{currentItem:null})};InputDate.prototype._updateRangeSelection=function(){var e=this._lbx,t=-1;if(hasItems(e.collectionView))for(var i=this._lbx.collectionView.items,n=DateTime.sameDate,o=0;o<i.length;o++){var s=i[o];if(s.from){if(n(s.from,this.value)&&n(s.to,this.rangeEnd)){t=o;break}}else t=o}e.selectedIndex=t;return e.selectedItem};InputDate.prototype._copy=function(e,t){if("text"===e){var i=(t||"").toString();if(i!==this.text){this._tbx.value=i;this._textInitialized=!0}return!0}return!1};return InputDate}(DropDown);export{InputDate};var InputDateRange=function(e){__extends(InputDateRange,e);function InputDateRange(t,i){var n=e.call(this,t,{selectionMode:DateSelectionMode.Range,showMonthPicker:"Outside",monthCount:2})||this;addClass(n.hostElement,"wj-inputdaterange");n._tbx.value=n._oldText=n._getText();n.initialize(i);if(n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n._commitText()}return n}Object.defineProperty(InputDateRange.prototype,"selectionMode",{get:function(){return this.calendar.selectionMode},set:function(e){e=asEnum(e,DateSelectionMode);assert(e==DateSelectionMode.Range,'InputDateRange.selectionMode must be "Range"');this.calendar.selectionMode=e},enumerable:!0,configurable:!0});return InputDateRange}(InputDate);export{InputDateRange};var InputColor=function(e){__extends(InputColor,e);function InputColor(t,i){var n=e.call(this,t)||this;n._textInitialized=!1;n.valueChanged=new Event;addClass(n.hostElement,"wj-inputcolor");n._ePreview=createElement('<div class="wj-inputcolorbox"></div>',n.hostElement.firstElementChild);if("INPUT"==n._orgTag){n._tbx.type="";n._commitText()}n.value="#ffffff";n.isRequired=!0;n._tbx.value=n._oldText=n.value;n.initialize(i);if(n._textInitialized&&n._tbx.value!==n._oldText){n._oldText=n._tbx.value;n.onTextChanged();n._commitText();n._textInitialized=!1}n.addEventListener(n._colorPicker.hostElement,"click",(function(e){var t=e.target;if(t&&"DIV"==t.tagName&&(closest(t,'[wj-part="div-pal"]')||closest(t,'[wj-part="div-pv"]'))){t.style.backgroundColor&&(n.isDroppedDown=!1)}}));return n}Object.defineProperty(InputColor.prototype,"value",{get:function(){return this._value},set:function(e){this.text=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if((e=asString(e))!=this.text&&(e||!this.isRequired)&&(!e||Color.fromString(e))){this._setText(e,!0);this._commitText()}},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"showAlphaChannel",{get:function(){return this._colorPicker.showAlphaChannel},set:function(e){this._colorPicker.showAlphaChannel=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"showColorString",{get:function(){return this._colorPicker.showColorString},set:function(e){this._colorPicker.showColorString=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"palette",{get:function(){return this._colorPicker.palette},set:function(e){this._colorPicker.palette=e},enumerable:!0,configurable:!0});Object.defineProperty(InputColor.prototype,"colorPicker",{get:function(){return this._colorPicker},enumerable:!0,configurable:!0});InputColor.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputColor.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);this.isDroppedDown&&!this.isTouching&&this.selectAll()};InputColor.prototype._createDropDown=function(){var e=this;this._colorPicker=new ColorPicker(this._dropDown);setCss(this._dropDown,{minWidth:420,minHeight:200});this._colorPicker.valueChanged.addHandler((function(){e.value=e._colorPicker.value}))};InputColor.prototype._keydown=function(t){if(!t.defaultPrevented)switch(t.keyCode){case Key.Enter:this._commitText();this.selectAll();break;case Key.Escape:this.text=this.value;this.selectAll()}e.prototype._keydown.call(this,t)};InputColor.prototype._commitText=function(){if(this._value!=this.text){if(!this.isRequired&&!this.text){this._value=this.text;this._ePreview.style.backgroundColor="";this.onValueChanged();return}if(Color.fromString(this.text.replace(/\s+/g,""))){if(this.text&&this.text!==this.text.replace(/\s+/g,"")){this.text=this.text.replace(/\s+/g,"");return}var e=this._colorPicker;e.value=this.text;this._value=e.value;this._ePreview.style.backgroundColor=this.value;this.onValueChanged()}else this.onInvalidInput(new CancelEventArgs)&&(this.text=this._value?this._value:"")}};InputColor.prototype._copy=function(e,t){if("text"===e){var i=(t||"").toString();if(i!==this.text){this._tbx.value=i;this._textInitialized=!0}return!0}return!1};return InputColor}(DropDown);export{InputColor};var ComboBox=function(e){__extends(ComboBox,e);function ComboBox(t,i){var n=e.call(this,t)||this;n._editable=!1;n._trimText=!0;n._handleWheel=!0;n._delKey=0;n._draggingText=!1;n._pathHdr=new Binding(null);n._bsCollapse=!0;n._fmtItemHandlers=0;n._emptyValueAction=!1;n._oldIndexToBeRestoredOnBlur=null;n._restoreComboboxTbxVal=!1;n._isWheel=!1;n.itemsSourceChanged=new Event;n.selectedIndexChanged=new Event;var o=n.hostElement;addClass(o,"wj-combobox");n.dropDown.id=getUniqueId(o.id+"_dropdown");n.autoExpandSelection=!1;var s=n._tbx;n.addEventListener(s,"compositionstart",(function(){n._composing=!0}));n.addEventListener(s,"compositionend",(function(){n._composing=!1;n._setText(n.text,!0)}));n.addEventListener(s,"drag",(function(){n._draggingText=!0}));n.addEventListener(o,"wheel",n._wheel.bind(n));"SELECT"==n._orgTag&&n._lbx._initFromSelect(o);var r=n._lbx;r.loadedItems.addHandler((function(e){n.selectedIndex>-1&&(n.selectedIndex=r.selectedIndex)}));n.isRequired=!0;n.initialize(i);return n}Object.defineProperty(ComboBox.prototype,"itemsSource",{get:function(){return this._lbx.itemsSource},set:function(e){if(this._lbx.itemsSource!=e){this._lbx.itemsSource=e;this.onItemsSourceChanged()}this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"collectionView",{get:function(){return this._lbx.collectionView},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"virtualizationThreshold",{get:function(){return this._lbx.virtualizationThreshold},set:function(e){this._lbx.virtualizationThreshold=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"showGroups",{get:function(){return this._lbx.showGroups},set:function(e){this._lbx.showGroups=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"displayMemberPath",{get:function(){return this._lbx.displayMemberPath},set:function(e){this._lbx.displayMemberPath=e;var t=this.getDisplayText();this.text!=t&&this._setText(t,!0)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"headerPath",{get:function(){return this._pathHdr.path},set:function(e){this._pathHdr.path=asString(e);var t=this.getDisplayText();this.text!=t&&this._setText(t,!0)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedValuePath",{get:function(){return this._lbx.selectedValuePath},set:function(e){this._lbx.selectedValuePath=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"isContentHtml",{get:function(){return this._lbx.isContentHtml},set:function(e){if(e!=this.isContentHtml){this._lbx.isContentHtml=asBoolean(e);var t=this.getDisplayText();this.text!=t&&this._setText(t,!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"caseSensitiveSearch",{get:function(){return this._lbx.caseSensitiveSearch},set:function(e){this._lbx.caseSensitiveSearch=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"trimText",{get:function(){return this._trimText},set:function(e){if(e!=this._trimText){this._trimText=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"itemFormatter",{get:function(){return this._lbx.itemFormatter},set:function(e){this._lbx.itemFormatter=asFunction(e);this.selectedIndex=this._lbx.selectedIndex},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"formatItem",{get:function(){return this._lbx.formatItem},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedIndex",{get:function(){return this._lbx.selectedIndex},set:function(e){e!=this.selectedIndex&&isNumber(e)&&(this._lbx.selectedIndex=e);var t=this._lbx._oldSelectedIndex!=this.selectedIndex;e=this.selectedIndex;var i=this.getDisplayText(e);if(this.text!=i||t){var n=this._internalSettingText;this._internalSettingText=this._lbx._ignoredItemChangedEvents;this._setText(i,!0);""!=this.text&&(this._emptyValueAction=!1);this._internalSettingText=n}},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedItem",{get:function(){return this._lbx.selectedItem},set:function(e){this._lbx.selectedItem=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"selectedValue",{get:function(){return this.collectionView?this._lbx.selectedValue:this.text},set:function(e){this.collectionView?this._lbx.selectedValue=e:null!=e&&(this.text=e.toString())},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"isEditable",{get:function(){return this._editable},set:function(e){this._editable=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"maxDropDownHeight",{get:function(){return this._lbx.maxHeight},set:function(e){this._lbx.maxHeight=e},enumerable:!0,configurable:!0});Object.defineProperty(ComboBox.prototype,"maxDropDownWidth",{get:function(){var e=this._dropDown,t=e?parseInt(e.style.maxWidth):null;return isNaN(t)?null:t},set:function(e){var t=this._dropDown.style;e=asNumber(e,!0);t.maxWidth=null==e?"":e+"px";t.minWidth=""},enumerable:!0,configurable:!0});ComboBox.prototype.getDisplayText=function(e,t){void 0===e&&(e=this.selectedIndex);void 0===t&&(t=this._trimText);var i,n=this.collectionView;if(this.headerPath&&e>-1&&hasItems(n)){var o=n.items[e];i=null!=(i=o?this._pathHdr.getValue(o):null)?i.toString():"";this.isContentHtml&&(i=toPlainText(i))}else i=this._lbx.getDisplayText(e);return t?i.trim():i};ComboBox.prototype.indexOf=function(e,t,i){void 0===i&&(i=!1);var n=this.collectionView,o=this.caseSensitiveSearch;if(hasItems(n)&&null!=e){e=e.toString();o||(e=e.toLowerCase());if(this._trimText&&!i){-1!==this.indexOf(e,!1,!0)||(e=e.trim())}var s=this.selectedIndex,r=this.getDisplayText(s);if(t){o||(r=r.toLowerCase());if(e==r)return s}else if(!e&&""==r)return s;for(var a=0;a<n.items.length;a++)if(this._lbx.isItemEnabled(a)){r=this.getDisplayText(a);this.trimText&&(r=r.trim());o||(r=r.toLowerCase());if(t){if(r==e&&!1===this._emptyValueAction)return a}else if(e&&0==r.indexOf(e)||!e&&""==r&&!1===this._emptyValueAction)return a}}return-1};Object.defineProperty(ComboBox.prototype,"listBox",{get:function(){return this._lbx},enumerable:!0,configurable:!0});ComboBox.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)};ComboBox.prototype.onSelectedIndexChanged=function(e){this._updateBtn();this.selectedIndexChanged.raise(this,e)};ComboBox.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement&&hasItems(this.collectionView)){this._lbx.refresh();this.selectedIndex>-1&&(this.selectedIndex=this._lbx.selectedIndex)}};ComboBox.prototype.onLostFocus=function(t,i,n){this._trimText&&(this.text=this.text.trim());if(this._composing){this._composing=!1;this._setText(this.text,!0)}if((!this.text&&this.isRequired||n)&&hasItems(this.collectionView)){void 0!==i&&(this.selectedIndex=-1!==i?i:0);null!==this._oldIndexToBeRestoredOnBlur?this.selectedIndex=-1!==this._oldIndexToBeRestoredOnBlur?this._oldIndexToBeRestoredOnBlur:0:null==this.collectionView.currentItem&&(this.selectedIndex=0)}var o=this.text,s=this.collectionView?this.collectionView.items.length:0;e.prototype.onLostFocus.call(this,t);var r=this.collectionView?this.collectionView.items.length:0;this._trySelectionUpdateOnItemsSourceChanged(r!==s,o)};ComboBox.prototype.onIsDroppedDownChanging=function(t){if(!this.isDroppedDown&&!this._hasItems()){t.cancel=!0;return!1}return e.prototype.onIsDroppedDownChanging.call(this,t)};ComboBox.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.isDroppedDown){this._fmtItemHandlers=this.formatItem.handlerCount;this._lbx.showSelection()}this._updateAria()};ComboBox.prototype._trySelectionUpdateOnItemsSourceChanged=function(e,t){if(e&&t){var i=this.indexOf(t,!0);i<0&&(i=this.indexOf(t,!1));this.selectedIndex=i}};ComboBox.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateBtn()};ComboBox.prototype._updateBtn=function(){var t=this.collectionView,i=this._tbx,n=this._hasItems();e.prototype._updateBtn.call(this);this._btn.style.display=this._showBtn&&null!=t?"":"none";enable(this._btn,n&&!this.isDisabled);setAttribute(i,"role",n?"combobox":null);setAttribute(i,"aria-autocomplete",n?"both":null);this._updateAria()};ComboBox.prototype._hasItems=function(){return hasItems(this.collectionView)};ComboBox.prototype._updateAria=function(){var e=this._tbx,t=this.isDroppedDown,i=this.dropDown?this.dropDown.id:null,n=i&&hasItems(this.collectionView);setAttribute(e,"aria-owns",n&&t?i:null);setAttribute(e,"aria-expanded",n?t:null)};ComboBox.prototype._createDropDown=function(){var e=this;if(!this._lbx){this._lbx=new ListBox(this._dropDown);this._lbx._container=this.hostElement}this._lbx.maxHeight=200;this._lbx.selectedIndexChanged.addHandler((function(){e._updateBtn();var t=e._lbx.selectedIndex,i=e._lbx.hostElement.children,n=t>-1&&t<i.length?i[t].id:null;setAttribute(e._tbx,"aria-activedescendant",n&&n.length?n:null);e.selectedIndex=t;e.onSelectedIndexChanged()}));this._lbx.itemsChanged.addHandler((function(){e._updateBtn()}))};ComboBox.prototype._wheel=function(e){this._isWheel=!0;if(this.handleWheel&&!e.defaultPrevented&&!this.isDroppedDown&&!this.isReadOnly&&this.containsFocus()&&this.selectedIndex>-1){var t=this._findNext("",e.deltaY>0?1:-1);t>-1&&(this.selectedIndex=t);e.preventDefault()}this._isWheel=!1};ComboBox.prototype._dropDownClick=function(t){t.defaultPrevented||t.target!=this._dropDown&&(this.isDroppedDown=!1);this._restoreComboboxTbxVal&&(this._tbx.value=this.getDisplayText(this.selectedIndex));e.prototype._dropDownClick.call(this,t)};ComboBox.prototype._setText=function(t,i){if(!this._composing&&!this._settingText){this._settingText=!0;if(this.containsFocus()){var n=this.formatItem.handlerCount;if(this._fmtItemHandlers!=n){this._fmtItemHandlers=n;this._lbx.loadList()}}t=[null,void 0,NaN].includes(t)?"":t.toString();var o=this.selectedIndex,s=this.collectionView,r=this._getSelStart(),a=-1,l=!0;if(this.isEditable&&(this._delKey||this._getSelEnd()<t.length||!this.containsFocus())){i=!0;l=!1}o=this.indexOf(t,i);if(l){o<0&&i&&(o=this.indexOf(t,!1));o<0&&r>0&&(o=this.indexOf(t.substr(0,r),!1));if(!i){var h=this.indexOf(t,!0);h>-1&&o>-1&&h!=o&&(o=h)}}o<0&&this._delKey&&(o=this.indexOf(t,i));if(o<0&&!this.isEditable&&hasItems(s)&&(t&&this.isRequired||this.containsFocus()&&(t||this.isRequired))){var u=this._oldText||"";o=Math.max(0,this.indexOf(u,!1));r=0;for(var c=0;c<t.length&&c<u.length;c++)if(t[c]!=u[c]){r=c;break}}if((!this._delKey||!this.isEditable||this._delKey&&this.isEditable&&t==this.getDisplayText(o))&&(!this._pristine||this._pristine&&!this.isEditable)||this._isWheel||this._delKey&&""==t&&o>-1){if(o>-1){a=r;t=this.getDisplayText(o)}var p=this._tbx;t!=p.value&&(p.value=t);a>-1&&this.containsFocus()&&!this.isTouching&&this._updateInputSelection(a)}if(s){if(!t||this.trimText&&""==t.trim()&&!this.containsFocus()&&this.isEditable)if(o>-1)this._oldIndexToBeRestoredOnBlur=o;else{this._oldIndexToBeRestoredOnBlur=this.indexOf(this._oldText,!0);this._oldIndexToBeRestoredOnBlur=this._oldIndexToBeRestoredOnBlur<0?this.indexOf(this._oldText,!1):this._oldIndexToBeRestoredOnBlur}this._restoreComboboxTbxVal=t&&o>-1;s.moveCurrentToPosition(o)}this.containsFocus()||this.isEditable||this.isRequired||t!=t.trim()||!this.trimText||(this._tbx.value=this.getDisplayText(o,this.trimText));!this.containsFocus()&&o>-1&&this.isEditable&&(t=this.getDisplayText(o,this.trimText));!this.containsFocus()&&o<0&&!this.isEditable&&!this.isRequired&&(t="");var d=!1;!t&&o<0&&this.isRequired&&!this.containsFocus()&&(d=!0);this.trimText&&!this.containsFocus()&&this.isEditable&&(this.isRequired&&""==t.trim()?d=!0:t=t.trim());if(d){this.selectedIndex=this._oldIndexToBeRestoredOnBlur;this.selectedIndex<0&&(this.selectedIndex=0)}var f=!this.containsFocus()&&!this.isRequired&&!this.isEditable&&this.trimText;f&&(this._tbx.value=this.getDisplayText(o,!0));this._delKey=0;this._settingText=!1;e.prototype._setText.call(this,d?this.getDisplayText(this.selectedIndex):t,i,d,f)}};ComboBox.prototype._findNext=function(e,t,i){void 0===i&&(i=this.selectedIndex);var n=this.collectionView,o=n?n.items.length:0,s=this._lbx,r=this.caseSensitiveSearch;if(n&&o&&t){r||(e=e.toLowerCase());for(var a=i+t;a>-1&&a<o;a+=t){var l=this.getDisplayText(a);r||(l=l.toLowerCase());if(0==l.indexOf(e)){if(!this.dropDown.children[a]||s.isItemEnabled(a))return a}}}return i};ComboBox.prototype._keydown=function(t){e.prototype._keydown.call(this,t);if(!t.defaultPrevented&&!this.isReadOnly&&!t.altKey&&hasItems(this.collectionView)&&this._elRef==this._tbx&&!this._isHiddenEditor()){this._delKey=0;var i=this._getSelStart(),n=this._getSelEnd();switch(t.keyCode){case Key.Back:case Key.Delete:case 88:if(!t.ctrlKey&&!t.metaKey&&88==t.keyCode)break;if(this._bsCollapse&&!this.isEditable&&i>0&&n==this._tbx.value.length&&hasItems(this.collectionView)){this._setSelRange(i-1,n);i-=1}this._delKey=t.keyCode;break;case Key.Up:case Key.Down:i==this.text.length&&(i=0);this.selectedIndex=this._findNext(this.text.substr(0,i),t.keyCode==Key.Up?-1:1);this._setSelRange(i,this.text.length);t.preventDefault();break;case Key.PageUp:this._lbx._selectPrevPage();this.selectAll();t.preventDefault();break;case Key.PageDown:this._lbx._selectNextPage();this.selectAll();t.preventDefault()}this.text.length>0&&["Backspace","Delete","x"].includes(t.key)&&0===i&&n===this.text.length||this._delKey&&1===this.text.length?this._emptyValueAction=!0:this._composing||(this._emptyValueAction=!1)}};ComboBox.prototype._input=function(e){this._draggingText&&(""===this.text?this._emptyValueAction=!0:this._emptyValueAction=!1);this._setText(this.text,!1);""!=this.text&&(this._emptyValueAction=!1);this._draggingText=!1};ComboBox.prototype._updateInputSelection=function(e){var t=this._tbx;this._elRef==t&&this._setSelRange(e,t.value.length)};ComboBox.prototype._getSelStart=function(){var e=this._tbx;return e&&e.value?e.selectionStart:0};ComboBox.prototype._getSelEnd=function(){var e=this._tbx;return e&&e.value?e.selectionEnd:0};ComboBox.prototype._setSelRange=function(e,t){var i=this._tbx;this._elRef!=i||i.readOnly||setSelectionRange(i,e,t)};return ComboBox}(DropDown);export{ComboBox};_addCultureInfo("MultiSelect",{itemsSelected:"{count:n0} items selected",selectAll:"Select All"});var MultiSelect=function(e){__extends(MultiSelect,e);function MultiSelect(t,i){var n=e.call(this,t)||this;n._maxHdrItems=2;n._readOnly=!1;n._hdrFmt=null;n.checkedItemsChanged=new Event;addClass(n.hostElement,"wj-multiselect");n._tbx.readOnly=!0;n.checkedMemberPath=null;n.removeEventListener(n.dropDown,"click");n._lbx.itemsChanged.addHandler((function(){n._updateHeader(!1)}));n._lbx.checkedItemsChanged.addHandler((function(){n._updateHeader(!1);n.onCheckedItemsChanged()}));n.clickAction=ClickAction.Toggle;n.initialize(i);return n}Object.defineProperty(MultiSelect.prototype,"showSelectAllCheckbox",{get:function(){return this._msLbx.showSelectAllCheckbox},set:function(e){this._msLbx.showSelectAllCheckbox=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"showFilterInput",{get:function(){return this._msLbx.showFilterInput},set:function(e){this._msLbx.showFilterInput=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"delay",{get:function(){return this._msLbx.delay},set:function(e){this._msLbx.delay=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"caseSensitiveSearch",{get:function(){return this._msLbx.caseSensitiveSearch},set:function(e){this._msLbx.caseSensitiveSearch=e},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"filterInputPlaceholder",{get:function(){return this._msLbx.filterInputPlaceholder},set:function(e){this._msLbx.filterInputPlaceholder=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkOnFilter",{get:function(){return this._msLbx.checkOnFilter},set:function(e){if(e!=this.checkOnFilter){this._msLbx.checkOnFilter=asBoolean(e);this.checkedItems=[]}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"selectAllLabel",{get:function(){return this._msLbx.selectAllLabel},set:function(e){this._msLbx.selectAllLabel=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkedMemberPath",{get:function(){return this._msLbx.checkedMemberPath},set:function(e){this._msLbx.checkedMemberPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"maxHeaderItems",{get:function(){return this._maxHdrItems},set:function(e){if(this._maxHdrItems!=e){this._maxHdrItems=asNumber(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"headerFormat",{get:function(){return this._hdrFmt},set:function(e){if(e!=this._hdrFmt){this._hdrFmt=asString(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"headerFormatter",{get:function(){return this._hdrFormatter},set:function(e){if(e!=this._hdrFormatter){this._hdrFormatter=asFunction(e);this._updateHeader()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiSelect.prototype,"checkedItems",{get:function(){return this._msLbx.checkedItems},set:function(e){this._msLbx.checkedItems=null==e?[]:asArray(e);this._updateHeader()},enumerable:!0,configurable:!0});MultiSelect.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};MultiSelect.prototype.dispose=function(){this._lbx.dispose();e.prototype.dispose.call(this)};MultiSelect.prototype.onIsDroppedDownChanged=function(t){var i=this;e.prototype.onIsDroppedDownChanged.call(this,t);setTimeout((function(){if(i.isDroppedDown&&i.containsFocus())if(i.showFilterInput&&!i.isTouching)i._msLbx._filter.focus();else{var e=i.listBox;if(e.selectedIndex<0){var t=0,n=e.checkedItems;n.length&&(t=e.collectionView.items.indexOf(n[0]));e.selectedIndex=Math.max(0,t)}e.showSelection(!0);e.focus()}}))};MultiSelect.prototype.onLostFocus=function(){this._msLbx.onLostFocus();this.isDroppedDown=!1;e.prototype.onLostFocus.call(this)};MultiSelect.prototype._createDropDown=function(){var t=createElement("<div></div>",this._dropDown);this._msLbx=new MultiSelectListBox(t);this._lbx=this._msLbx.listBox;e.prototype._createDropDown.call(this)};Object.defineProperty(MultiSelect.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0});MultiSelect.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._updateHeader()};MultiSelect.prototype._setText=function(e,t){};MultiSelect.prototype._keydown=function(t){e.prototype._keydown.call(this,t);hasClass(this._tbx,"wj-grid-ime")||!t.defaultPrevented&&hasItems(this.collectionView)&&t.keyCode>32&&(this.isDroppedDown=!0)};MultiSelect.prototype._hasItems=function(){var e=this.collectionView,t=e?e.sourceCollection:null;return hasItems(e)||t&&t.length&&this.showFilterInput};MultiSelect.prototype._updateHeader=function(e){void 0===e&&(e=!0);var t="";if(isFunction(this._hdrFormatter))t=this._hdrFormatter(this);else{var i=this.checkedItems,n=[];if(this.displayMemberPath){var o=new Binding(this.displayMemberPath);n=i.reduce((function(e,t){e.find((function(e){return o.getValue(e)===o.getValue(t)}))||e.push(t);return e}),[]);i=n}if(i.length>0)if(i.length<=this._maxHdrItems){if(this.headerPath){var s=new Binding(this.headerPath);i=i.map((function(e){return s.getValue(e)}))}else if(this.displayMemberPath){var r=new Binding(this.displayMemberPath);i=i.map((function(e){return r.getValue(e)}))}this.isContentHtml&&(i=i.map((function(e){return toPlainText(e)})));this.trimText&&(i=i.map((function(e){return e?e.toString().trim():""})));t=i.join(", ")}else t=format(this.headerFormat||culture.MultiSelect.itemsSelected,{count:i.length})}var a=this.inputElement;if(t!=a.value){a.value=t;this.onTextChanged()}e&&this._lbx._updateCheckedList(this.checkedItems);this._updateState()};MultiSelect._DEF_CHECKED_PATH="$checked";return MultiSelect}(ComboBox);export{MultiSelect};var Menu=function(e){__extends(Menu,e);function Menu(t,i){var n=e.call(this,t)||this;n._closing=!1;n._cmd=null;n._cmdPath=null;n._cmdParamPath=null;n._subPath=null;n._owner=null;n._isButton=!1;n._openOnHover=!1;n._closeOnLeave=!0;n._subMenu=null;n._hoverEnterBnd=n._hoverEnter.bind(n);n._hoverLeaveBnd=n._hoverLeave.bind(n);n._hoverOverBnd=n._hoverOver.bind(n);n.itemClicked=new Event;var o=n.hostElement,s=n._tbx,r=n._lbx,a=n.dropDown;addClass(o,"wj-menu");s.style.display="none";n._hdr=n._elRef=createElement('<div wj-part="header" class="wj-form-control"/>');s.parentElement.insertBefore(n._hdr,n._tbx);o.tabIndex=n.isDisabled?-1:n._orgTabIndex;n.isRequired=!1;setAttribute(o,"role","menubar",!0);setAttribute(s,"role",null);setAttribute(s,"aria-autocomplete",null);setAttribute(s,"aria-owns",null);setAttribute(a,"role","menu");r.itemRole="menuitem";if("SELECT"==n._orgTag){n.header=o.getAttribute("header");n._lbx.itemsSource&&(n.commandParameterPath="cmdParam")}n.isContentHtml=!0;n.maxDropDownHeight=500;n.addEventListener(n._hdr,"click",(function(e){if(!e.defaultPrevented){n._clearHover(e);if(n._isButton){n.isDroppedDown=!1;n._raiseCommand()}else n.isDroppedDown=!n.isDroppedDown}}));r.lostFocus.addHandler((function(){n.containsFocus()||(n.isDroppedDown=!1)}));addClass(a,"wj-menu-items");r.formatItem.addHandler(n._formatMenuItem.bind(n));n.initialize(i);return n}Object.defineProperty(Menu.prototype,"header",{get:function(){return this._hdr.innerHTML},set:function(e){this._hdr.innerHTML=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"command",{get:function(){return this._cmd},set:function(e){this._cmd=e},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"commandPath",{get:function(){return this._cmdPath},set:function(e){this._cmdPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"commandParameterPath",{get:function(){return this._cmdParamPath},set:function(e){this._cmdParamPath=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"subItemsPath",{get:function(){return this._subPath},set:function(e){if(e!=this._subPath){this._subPath=e;this.refresh(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"openOnHover",{get:function(){return this._openOnHover},set:function(e){this._openOnHover=asBoolean(e);this._updateHoverEvents()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"closeOnLeave",{get:function(){return this._closeOnLeave},set:function(e){this._closeOnLeave=asBoolean(e);this._updateHoverEvents()},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"isButton",{get:function(){return this._isButton},set:function(e){this._isButton=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Menu.prototype,"owner",{get:function(){return this._owner},set:function(e){this._owner=asType(e,HTMLElement,!0);this._enableDisableItems()},enumerable:!0,configurable:!0});Menu.prototype.show=function(e){if(!this.isDroppedDown){var t=this._lbx._ignoredItemChangedEvents;this._lbx._ignoredItemChangedEvents=!0;this.selectedIndex=-1;this._lbx._ignoredItemChangedEvents=t;if(this.onIsDroppedDownChanging(new CancelEventArgs)){var i=this.dropDown,n=this.owner;!n&&e instanceof MouseEvent&&(n=e.target);n instanceof HTMLElement&&(i[Control._OWNR_KEY]=n);if(e instanceof MouseEvent&&this.openOnHover&&this.closeOnLeave){e=new Point(e.pageX-pageXOffset-2,e.pageY-pageYOffset-2)}showPopup(i,e,!1,this.isAnimated);this.onIsDroppedDownChanged();i.focus()}}};Menu.prototype.hide=function(){if(this.isDroppedDown&&this.onIsDroppedDownChanging(new CancelEventArgs)){hidePopup(this.dropDown);this.onIsDroppedDownChanged()}};Menu.prototype.onItemClicked=function(e){this.itemClicked.raise(this,e)};Menu.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._enableDisableItems()};Menu.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.isDroppedDown){this._closing=!0;var i=this._lbx._ignoredItemChangedEvents;this._lbx._ignoredItemChangedEvents=!0;this._defaultItem=this.selectedItem;this.isRequired=!1;this.selectedIndex=-1;this._enableDisableItems();this._closing=!1;this._lbx._ignoredItemChangedEvents=i;this.dropDown.focus()}else{if(!this.selectedItem){var n=this._lbx._checking;this._lbx._checking=!0;this.selectedItem=this._defaultItem;this._lbx._checking=n}var o=this._subMenu;o&&(o.isDroppedDown=!1)}};Menu.prototype._updateHoverEvents=function(){var e=this.hostElement,t=this.dropDown,i=this.addEventListener.bind(this),n=this.removeEventListener.bind(this),o="mouseleave";n(e,"mouseenter",this._hoverEnterBnd);n(e,o,this._hoverLeaveBnd);n(t,"mouseover",this._hoverOverBnd);n(t,o,this._hoverLeaveBnd);if(this._openOnHover){i(e,"mouseenter",this._hoverEnterBnd);i(t,"mouseover",this._hoverOverBnd);if(this._closeOnLeave){i(e,o,this._hoverLeaveBnd);i(t,o,this._hoverLeaveBnd)}}};Menu.prototype._getSubItems=function(e){var t=this.subItemsPath,i=e&&t?e[t]:null;return isArray(i)&&i.length?i:null};Menu.prototype._formatMenuItem=function(e,t){var i=t.item;if(this._getSubItems(t.data))addClass(i,"wj-subitems");else if("-"==i.innerHTML){i.innerHTML="";addClass(i,"wj-separator")}};Menu.prototype._keydown=function(t){if(!t.defaultPrevented){var i=this._getKeyCode(t);if(this.isDroppedDown)switch(i){case Key.Enter:case Key.Right:if(this._showSubMenu()){t.preventDefault();return}break;case Key.Left:var n=Control.getControl(this.owner);if(n instanceof Menu){var o=n.dropDown,s=n.selectedIndex;(s>-1?o.children[s]:o).focus();t.preventDefault();return}}if(i==Key.Enter)if(this.isDroppedDown)this.selectedIndex>-1&&this._raiseCommand();else{this.isDroppedDown=!0;t.preventDefault()}}e.prototype._keydown.call(this,t)};Menu.prototype._dropDownClick=function(t){if(!t.defaultPrevented&&t.target!=this.dropDown){this._clearHover(t);if(this._showSubMenu()){t.preventDefault();return}this.selectedIndex>-1&&this._raiseCommand()}e.prototype._dropDownClick.call(this,t)};Menu.prototype._showSubMenu=function(){var e=this,t=this._getSubItems(this.selectedItem);if(!t)return null;var i=this.dropDown.children[this.selectedIndex].getBoundingClientRect(),n=new Point(i.right,i.top);if(0==i.height)return null;var o=this.rightToLeft||"rtl"==this.dropDown.getAttribute("dir");o&&(n.x=i.left);var s=this._subMenu;s&&(s.isDroppedDown=!1);s=new Menu(document.createElement("div"),{owner:this.hostElement,itemsSource:t,itemClicked:function(t,i){e.itemClicked.raise(t,i)},formatItem:function(t,i){e.formatItem.raise(t,i)}});var r=this.collectionView,a=s.collectionView;r&&r.filter&&a&&!a.filter&&(a.filter=r.filter);"displayMemberPath,selectedValuePath,isContentHtml,command,commandPath,commandParameterPath,maxDropDownWidth,maxDropDownHeight,dropDownCssClass,isAnimated,subItemsPath,openOnHover,closeOnLeave".split(",").forEach((function(t){s[t]=e[t]}));var l=s.dropDown;setAttribute(l,"dir",o?"rtl":null);s.show(n);l[Control._OWNR_KEY]=this.dropDown;l.focus();return s};Menu.prototype._raiseCommand=function(e){var t=this.selectedItem,i=this._getSubItems(t),n=this._getCommand(t);if(n&&!i){var o=this._getCommandParm(t);if(!this._canExecuteCommand(n,o))return;this._executeCommand(n,o)}var s=this.headerPath;if(s){var r=new Binding(s).getValue(t);r=null==r?"":r.toString();this.header=this.isContentHtml?r:escapeHtml(r)}this.onItemClicked(e);if(this.containsFocus()){for(var a=this;a&&a.owner;){var l=Control.getControl(a.owner);if(!(l instanceof Menu))break;a=l}var h=a.owner;!h&&a.dropDown&&(h=a.dropDown[Control._OWNR_KEY]);a.isDroppedDown=!1;a.focus();if(!a.containsFocus()&&h instanceof HTMLElement&&h.offsetHeight)if(isIE){var u=document.documentElement,c=u.scrollLeft,p=u.scrollTop;h.focus();u.scrollLeft=c,u.scrollTop=p}else h.focus()}};Menu.prototype._getCommand=function(e){var t=e&&this._cmdPath?e[this._cmdPath]:null;return t||this._cmd};Menu.prototype._getCommandParm=function(e){var t=this._cmdParamPath;return e&&t?e[t]:e};Menu.prototype._executeCommand=function(e,t){e&&!isFunction(e)&&(e=e.executeCommand);isFunction(e)&&e(t)};Menu.prototype._canExecuteCommand=function(e,t){if(e){var i=e.canExecuteCommand;if(isFunction(i))return i(t)}return!0};Menu.prototype._enableDisableItems=function(){if(this.collectionView&&(this._cmd||this._cmdPath))for(var e=this.collectionView.items,t=0;t<e.length;t++){var i=e[t],n=this._getCommand(i);if(n){var o=this._lbx.hostElement.children[t],s=this._getCommandParm(i);toggleClass(o,"wj-state-disabled",!this._canExecuteCommand(n,s))}}};Menu.prototype._clearHover=function(e){this._toHover&&clearTimeout(this._toHover);this._toHover=null;Menu._evtHover=e};Menu.prototype._isTargetDisabled=function(e){return hasClass(e.target,"wj-state-disabled")};Menu.prototype._hoverEnter=function(e){var t=this;this._clearHover(e);this._toHover=setTimeout((function(){t._toHover=null;t.isDroppedDown=!0}),Control._HOVER_DELAY)};Menu.prototype._hoverOver=function(e){var t=this;this._clearHover(e);this._toHover=setTimeout((function(){t._toHover=null;var i=t.listBox.indexOf(e.target);if(i>-1&&!hasClass(e.target,"wj-state-disabled")){t.selectedIndex=i;t._subMenu=t._showSubMenu()}}),Control._HOVER_DELAY)};Menu.prototype._hoverLeave=function(e){var t=this;this._clearHover(e);this.isDroppedDown&&(this._toHover=setTimeout((function(){var i=(e=Menu._evtHover)?document.elementFromPoint(e.clientX,e.clientY):null,n=closest(i,".wj-listbox.wj-menu-items"),o=t._subMenu;if(!n&&!contains(t.hostElement,i,!0)){t.isDroppedDown=!1;o&&(o.isDroppedDown=!1)}}),Control._LEAVE_DELAY))};Menu.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this.hostElement.tabIndex=this.isDisabled?-1:this._orgTabIndex};Menu.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.hostElement.tabIndex=this.isDisabled?-1:this._orgTabIndex};return Menu}(ComboBox);export{Menu};var InputTime=function(e){__extends(InputTime,e);function InputTime(t,i){var n=e.call(this,t)||this;n._format="t";n.valueChanged=new Event;addClass(n.hostElement,"wj-inputtime");n.isEditable=!0;n._value=DateTime.newDate();n._min=n._max=null;n._msk=new _MaskProvider(n._tbx);isIE9()||(n._tbx.type="tel");if("INPUT"==n._orgTag){var o=n._tbx.getAttribute("value");o&&(n.value=Globalize.parseDate(o,"HH:mm:ss"))}n.step=15;n.autoExpandSelection=!0;n.initialize(i);n._commitText();return n}Object.defineProperty(InputTime.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"value",{get:function(){return this._value},set:function(e){(e=asDate(e,!this.isRequired))&&(e=this._clamp(e));this._setText(e?Globalize.format(e,this.format):"",!0);this.selectedItem&&this.selectedItem.value&&(e=DateTime.fromDateTime(e,this.selectedItem.value));if(e!=this._value&&!DateTime.equals(e,this._value)){this._value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text&&(this.text||!this.isRequired)){this._setText(e,!0);this._commitText()}!this.text&&this.isRequired&&(this.selectedIndex=this._oldIndexToBeRestoredOnBlur<0?0:this._oldIndexToBeRestoredOnBlur)},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"min",{get:function(){return this._min},set:function(e){this._min=asDate(e,!0);this.isDroppedDown=!1;this._updateItems()},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"max",{get:function(){return this._max},set:function(e){this._max=asDate(e,!0);this.isDroppedDown=!1;this._updateItems()},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"step",{get:function(){return this._step},set:function(e){if(e!=this.step){this._step=asNumber(e,!0);this.isDroppedDown=!1;this._updateItems()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this._tbx.value=Globalize.format(this.value,this.format);hasItems(this.collectionView)&&this._updateItems()}},enumerable:!0,configurable:!0});Object.defineProperty(InputTime.prototype,"mask",{get:function(){return this._msk.mask},set:function(e){this._msk.mask=asString(e)},enumerable:!0,configurable:!0});InputTime.prototype.onLostFocus=function(){e.prototype.onLostFocus.call(this)};InputTime.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};InputTime.prototype.onItemsSourceChanged=function(t){e.prototype.onItemsSourceChanged.call(this,t);this._hasCustomItems=null!=this.itemsSource};InputTime.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._msk.refresh();this._tbx.value=Globalize.format(this.value,this.format);this._updateItems()}};InputTime.prototype.onSelectedIndexChanged=function(t){if(this.selectedIndex>-1&&!this._settingText){var i=this.value?this.value:DateTime.newDate(),n=null!=this.selectedItem.value?this.selectedItem.value:Globalize.parseDate(this.text,this.format,this.value);this.value=DateTime.fromDateTime(i,n)}e.prototype.onSelectedIndexChanged.call(this,t)};InputTime.prototype._clamp=function(e){null!=this._min&&this._getTime(e)<this._getTime(this._min)&&(e=DateTime.fromDateTime(e,this._min));null!=this._max&&this._getTime(e)>this._getTime(this._max)&&(e=DateTime.fromDateTime(e,this._max));return e};InputTime.prototype._wheel=function(t){if(!t.defaultPrevented&&!this.isDroppedDown&&!this.isReadOnly&&this.containsFocus()&&this.selectedIndex<0&&this.value&&isNumber(this.step)&&this.step>0){var i=DateTime.addMinutes(this.value,this.step*clamp(t.deltaY,-1,1));this.value=this._clamp(i);this.selectAll();t.preventDefault()}e.prototype._wheel.call(this,t)};InputTime.prototype._updateInputSelection=function(t){if(this._delKey)e.prototype._updateInputSelection.call(this,t);else{for(var i=this._tbx.value;t<i.length&&!i[t].match(/[a-z0-9]/i);)t++;setSelectionRange(this._tbx,t,this._tbx.value.length)}};InputTime.prototype._updateItems=function(){if(!this._hasCustomItems){var e=[],t=new Date(2020,0),i=new Date(2020,0,1,23,59,59),n=this.step;this.min&&t.setHours(this.min.getHours(),this.min.getMinutes(),this.min.getSeconds());this.max&&i.setHours(this.max.getHours(),this.max.getMinutes(),this.max.getSeconds());if(isNumber(n)&&n>=1)for(var o=t;o<=i;o=DateTime.addMinutes(o,n))e.push({value:o,text:Globalize.format(o,this.format)});var s=this.value;this._settingText=!0;this.displayMemberPath="text";this.selectedValuePath="text";this.itemsSource=e;this._hasCustomItems=!1;this._settingText=!1;!s&&this.isRequired||(this.value=s)}};InputTime.prototype._getTime=function(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()};InputTime.prototype._keydown=function(t){e.prototype._keydown.call(this,t);if(!t.defaultPrevented)switch(t.keyCode){case Key.Enter:if(!this.isDroppedDown){this._commitText();this.selectAll()}break;case Key.Escape:this.text=Globalize.format(this.value,this.format);this.selectAll()}};InputTime.prototype._commitText=function(){if(this.text||this.isRequired){var e=this.value?Globalize.format(this.value,this.format):"";if(this.text!=e){var t=this.selectedItem&&this.selectedItem.value?this.selectedItem.value:Globalize.parseDate(this.text,this.format,this.value);t?(DateTime.sameTime(t,this._clamp(t))||this.onInvalidInput(new CancelEventArgs))&&(this.value=DateTime.fromDateTime(this.value,t)):this.onInvalidInput(new CancelEventArgs)&&(this.text=e)}}else this.value=null};InputTime.prototype._copy=function(e,t){if("text"===e){(t||"").toString()!==this.text&&this._setText(t,!0);return!0}return!1};return InputTime}(ComboBox);export{InputTime};_addCultureInfo("InputDateTime",{ariaLabels:{tglDate:"Toggle Calendar",tglTime:"Toggle Time List"}});var InputDateTime=function(e){__extends(InputDateTime,e);function InputDateTime(t,i){var n=e.call(this,t)||this;addClass(n.hostElement,"wj-inputdatetime");var o=culture.InputDateTime.ariaLabels;setAriaLabel(n._btn,o.tglDate);setAriaLabel(n._btnTm,o.tglTime);n.value=new Date;n.format="g";n._inputTime=new InputTime(document.createElement("div"),{valueChanged:function(e){var t=n.rangeEnd;n.value=DateTime.fromDateTime(n.value,e.value);n.calendar._rngMode()&&t&&(n.rangeEnd=DateTime.fromDateTime(t,e.value))},isDroppedDownChanged:function(e){e.listBox.containsFocus()&&n.inputElement.focus();n._selectAll()}});var s=n.addEventListener.bind(n);n._btnTm=n.hostElement.querySelector('[wj-part="btn-tm"]');s(n._btnTm,"mousedown",(function(e){n._btnclick(e)}));n._ddDate=n._dropDown;var r=n._ddTime=n._inputTime.dropDown;s(r,"keydown",n._keydown.bind(n),!0);s(r,"blur",(function(){n._updateFocusState()}),!0);s(r,"click",(function(e){e.defaultPrevented||e.target!=r&&n.hostElement.focus()}),!0);n.initialize(i);n._commitText();return n}Object.defineProperty(InputDateTime.prototype,"timeMin",{get:function(){return this._inputTime.min},set:function(e){this._inputTime.min=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeMax",{get:function(){return this._inputTime.max},set:function(e){this._inputTime.max=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeFormat",{get:function(){return this._inputTime.format},set:function(e){this._inputTime.format=e},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"timeStep",{get:function(){return this._inputTime.step},set:function(e){this._inputTime.step=e;this._btnTm.style.display=isNumber(e)&&e>0?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(InputDateTime.prototype,"inputTime",{get:function(){return this._inputTime},enumerable:!0,configurable:!0});InputDateTime.prototype._fromDateTime=function(e){return e};InputDateTime.prototype._btnclick=function(t){var i=closest(t.target,"button")==this._btn?this._ddDate:this._ddTime;this._setDropdown(i);e.prototype._btnclick.call(this,t)};InputDateTime.prototype.dispose=function(){this._setDropdown(this._ddDate);e.prototype.dispose.call(this);this._inputTime.dispose()};InputDateTime.prototype.refresh=function(t){void 0===t&&(t=!0);this._inputTime.refresh();e.prototype.refresh.call(this,t)};InputDateTime.prototype._updateBtn=function(){e.prototype._updateBtn.call(this);if(this._btnTm){this._btnTm.tabIndex=this._btn.tabIndex;this._btnTm.parentElement.style.display=this._btn.style.display}};InputDateTime.prototype._setDropdown=function(e){if(this._dropDown==e)return!1;this.isDroppedDown&&(this.isDroppedDown=!1);var t=this.dropDownCssClass;this.dropDownCssClass="";this._dropDown=e;this.dropDownCssClass=t;return!0};InputDateTime.prototype._updateDropDown=function(){var t=this._inputTime;if(this._dropDown==t.dropDown){this._commitText();e.prototype._updateDropDown.call(this);t.isRequired=this.isRequired&&null!=this.value;t.value=this.value;this.isDroppedDown&&t.listBox.showSelection()}else e.prototype._updateDropDown.call(this)};InputDateTime.controlTemplate='<div class="wj-template"><div class="wj-input"><div class="wj-input-group wj-input-btn-visible"><input wj-part="input" type="text" class="wj-form-control"/><span class="wj-input-group-btn"><button wj-part="btn" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-calendar"></span></button><button wj-part="btn-tm" class="wj-btn wj-btn-default" tabindex="-1"><span class="wj-glyph-clock"></span></button></span></div></div><div wj-part="dropdown" class="wj-content wj-dropdown-panel"></div></div>';return InputDateTime}(InputDate);export{InputDateTime};var AutoComplete=function(e){__extends(AutoComplete,e);function AutoComplete(t,i){var n=e.call(this,t)||this;n._cssMatch="wj-state-match";n._minLength=2;n._maxItems=6;n._itemCount=0;n._beginsWith=!1;n._delay=Control._SEARCH_DELAY;n._query="";n._inCallback=!1;n._srchProps=[];n._oldSelectedIndex=-1;addClass(n.hostElement,"wj-autocomplete");n._bsCollapse=!1;n.isEditable=!0;n.isRequired=!1;n.listBox.formatItem.addHandler(n._formatListItem,n);n._itemsSourceFnCallbackBnd=n._itemSourceFunctionCallback.bind(n);n.initialize(i);return n}Object.defineProperty(AutoComplete.prototype,"minLength",{get:function(){return this._minLength},set:function(e){this._minLength=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"beginsWithSearch",{get:function(){return this._beginsWith},set:function(e){this._beginsWith=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"maxItems",{get:function(){return this._maxItems},set:function(e){this._maxItems=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"delay",{get:function(){return this._delay},set:function(e){this._delay=asNumber(e,!1,!0)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"searchMemberPath",{get:function(){return this._srchProp},set:function(e){this._srchProp=asString(e);this._srchProps=e?e.trim().split(/\s*,\s*/):[]},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"itemsSourceFunction",{get:function(){return this._itemsSourceFn},set:function(e){this._itemsSourceFn=asFunction(e);isFunction(this._itemsSourceFn)&&this.itemsSourceFunction(this.text,this.maxItems,this._itemsSourceFnCallbackBnd)},enumerable:!0,configurable:!0});Object.defineProperty(AutoComplete.prototype,"cssMatch",{get:function(){return this._cssMatch},set:function(e){this._cssMatch=asString(e)},enumerable:!0,configurable:!0});AutoComplete.prototype.onSelectedIndexChanged=function(t){this._settingText||e.prototype.onSelectedIndexChanged.call(this,t)};AutoComplete.prototype._keydown=function(t){if(!t.defaultPrevented&&this.isDroppedDown)switch(t.keyCode){case Key.Up:case Key.Down:this.selectAll()}e.prototype._keydown.call(this,t)};AutoComplete.prototype._setText=function(e){var t=this;this.trimText&&!this.containsFocus()&&"string"==typeof e&&(e=e.trim());if(this._composing&&e!=this._oldText){this._oldText=e;this.onTextChanged()}if(!this._inCallback&&!this._settingText){this._toSearch||(this._oldSelectedIndex=this.selectedIndex);if(this.selectedIndex>-1&&this.getDisplayText()!=e){this._settingText=!0;this.selectedIndex=-1;this._settingText=!1}this._toSearch&&clearTimeout(this._toSearch);if(e!=this._oldText){"string"!=typeof e&&(e="");var i=this._tbx,n=this._tbx.selectionStart;i.value!=e&&(i.value=e);this._isWheel&&this.containsFocus()&&this._updateInputSelection(n);this._oldText=e;this.onTextChanged();var o=this.collectionView;if(!e&&o){(this._query||this.selectedIndex<0)&&(this.isDroppedDown=!1);this._query=this._rxHighlight=null;o.filter=null;var s=this.itemsSourceFunction;if(isFunction(s)){this.isDroppedDown=!1;s(this._query,this.maxItems,this._itemsSourceFnCallbackBnd)}if(this.isRequired&&!this.containsFocus()){var r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}-1==this.selectedIndex&&-1!=this._oldSelectedIndex&&this.onSelectedIndexChanged();return}}if(e!=this.getDisplayText()){if(!this.containsFocus()&&this.trimText)if(this.isRequired&&!this.text.trim().length){r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}else this._tbx.value=this._tbx.value.trim();if(!this.containsFocus()&&e.length<this.minLength)return;if(!this.containsFocus()&&(!e||this.trimText&&!this.text.trim().length||this.indexOf(e,!0)<0&&this.indexOf(e,!1)<0)&&this.isRequired&&!this.isEditable){r=this._oldSelectedIndex>-1?this._oldSelectedIndex:0;this.selectedIndex=r}else if(!this.containsFocus()&&e&&this.indexOf(e,!0)<0&&this.indexOf(e,!1)<0&&!this.isRequired&&!this.isEditable){this._tbx.value="";this.selectedIndex=-1;this.onSelectedIndexChanged()}else this._toSearch=setTimeout((function(){t._toSearch=null;var i=t.text;if(i.trim().length>=t._minLength&&i!=t._query){t._query=i.trim();i=escapeRegExp(i);var n=escapeHtml(i.trim()),o=t.caseSensitiveSearch?"":"i";t._beginsWith||(o+="g");t._rxSrch=t._beginsWith?new RegExp("^"+i+".*",o):new RegExp("(?=.*"+i.replace(/ /g,")(?=.*")+")",o);t._rxHighlight=t._beginsWith?new RegExp("^"+i,o):new RegExp("("+n.replace(/\s+/g,"|")+")",o);var s=t.itemsSourceFunction;isFunction(s)?s(t._query,t.maxItems,t._itemsSourceFnCallbackBnd):t._updateItems()}!e.trim().length&&!t.isEditable&&t.indexOf(e,!0)<0&&(t.selectedIndex=-1);-1==t.selectedIndex&&-1!=t._oldSelectedIndex&&t.onSelectedIndexChanged()}),this._delay)}}};AutoComplete.prototype.onLostFocus=function(t){var i=!1;if(this.isRequired&&!this.isEditable&&this.text){if(this.text.length<this.minLength)return;i=!0;var n=this.indexOf(this.text,!0);n<0&&(n=this.indexOf(this.text,!1));n>-1&&(this._oldSelectedIndex=n);n<0&&(this._oldSelectedIndex=0)}if(this._toSearch){clearTimeout(this._toSearch);var o=this._delay;this._delay=0;this._setText(this.text);this.delay=o}e.prototype.onLostFocus.call(this,t,this._oldSelectedIndex,i)};AutoComplete.prototype._itemSourceFunctionCallback=function(e){this._inCallback=!0;var t=asCollectionView(e||[]);t.moveCurrentToPosition(-1);this.itemsSource=t;this._inCallback=!1;if(this.containsFocus()){var i=this._tbx,n=i.selectionStart,o=i.selectionEnd,s=this.collectionView;this.isDroppedDown=null!=s&&s.items.length>0;setSelectionRange(i,n,o);this.refresh()}};AutoComplete.prototype.onIsDroppedDownChanged=function(t){e.prototype.onIsDroppedDownChanged.call(this,t);if(this.containsFocus()&&!this.isTouching){var i=this.collectionView;if(this.selectedIndex<0&&i){var n=i.items,o=this.text;1==n.length&&n[0]==o?this.selectedIndex=0:setSelectionRange(this._tbx,o.length)}}this._query=""};AutoComplete.prototype._updateItems=function(){var e=this.collectionView;if(e){this._inCallback=!0;e.beginUpdate();this._itemCount=0;e.filter=this._filter.bind(this);e.moveCurrentToPosition(-1);e.endUpdate();this._inCallback=!1;var t=e.items.length,i=this._tbx,n=i.selectionStart,o=i.selectionEnd;this.text.trim()||(t=0);this.isDroppedDown=t>0&&this.containsFocus();t||this.isEditable||(this.selectedIndex=-1);if(1==t&&this.selectedIndex<0){var s=this._getItemText(e.items[0],!1),r=i.value;if(!this.caseSensitiveSearch){s=s.toLowerCase();r=r.toLowerCase()}(s==r||this.trimText&&s.trim()==r)&&(this.selectedIndex=0)}this.isDroppedDown&&setSelectionRange(i,n,o);this.refresh()}};AutoComplete.prototype._filter=function(e){if(this._itemCount>=this._maxItems&&this._query)return!1;var t=[this._getItemText(e,!1)];this._srchProps&&this._srchProps.forEach((function(i){var n=e[i];null!=n&&t.push(n)}));this.isContentHtml&&(t=t.map((function(e){return e.replace(/(<[^>]*>|&[^;]*;)/g,"")})));for(var i=0;i<t.length;i++)if(this._rxSrch.test(t[i])){this._itemCount++;return!0}return!1};AutoComplete.prototype._getItemText=function(e,t){var i=e?e.toString():"",n=t&&this.headerPath?this._pathHdr:this._lbx._pathDisplay;n&&(i=null!=(i=n.getValue(e))?i.toString():"");return i};AutoComplete.prototype._formatListItem=function(e,t){var i=this;this._cssMatch&&this._rxHighlight&&this._query&&(t.item.innerHTML=t.item.innerHTML.replace(this._rxHighlight,(function(e,t,n,o){return i._enclosed(o,n,"<",">")||i._enclosed(o,n,"&",";")?e:'<span class="'+i._cssMatch+'">'+e+"</span>"})))};AutoComplete.prototype._enclosed=function(e,t,i,n){for(var o=t;o>=0&&e[o]!=n;o--)if(e[o]==i)for(var s=t;s<e.length&&e[s]!=i;s++)if(e[s]==n)return!0;return!1};AutoComplete.prototype._wheel=function(t){e.prototype._wheel.call(this,t)};return AutoComplete}(ComboBox);export{AutoComplete};var MultiAutoComplete=function(e){__extends(MultiAutoComplete,e);function MultiAutoComplete(t,i){var n=e.call(this,t)||this;n._selItems=[];n._maxSelItems=null;n._lastInputValue="";n._selPath=new Binding(null);n._notAddItm=!1;n.selectedItemsChanged=new Event;addClass(n.hostElement,"wj-multi-autocomplete");n._wjTpl=n.hostElement.querySelector(".wj-template");n._wjInput=n.hostElement.querySelector(".wj-input");n.showDropDownButton=!1;n.initialize(i);n.addEventListener(n.hostElement,"keyup",n._keyup.bind(n),!0);n.addEventListener(window,"resize",n._adjustInputWidth.bind(n));n.addEventListener(n._tbx,"focus",(function(){n._itemOff()}));n._addHelperInput();n._initSeltems();n.listBox.itemsChanged.addHandler((function(){return n.selectedIndex=-1}));n._refreshHeader();n._updateTabIndex();return n}Object.defineProperty(MultiAutoComplete.prototype,"showDropDownButton",{set:function(e){this._showBtn=!1},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"maxSelectedItems",{get:function(){return this._maxSelItems},set:function(e){if(this._maxSelItems!=e){this._maxSelItems=asNumber(e,!0);this._updateMaxItems();this._refreshHeader();this._clearSelIndex()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"selectedMemberPath",{get:function(){return this._selPath.path},set:function(e){if((e=asString(e))!==this.selectedMemberPath){this._selPath.path=e;this._initSeltems();this._refreshHeader();this.onSelectedItemsChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(MultiAutoComplete.prototype,"selectedItems",{get:function(){return this._selItems},set:function(e){e=Array.from(new Set(e));var t=this._selItems===e;t||null==this._selItems||null==e||this._selItems.length!==e.length||(t=this._selItems.every((function(t,i){return t===e[i]})));this._selItems=asArray(e);if(!t){if(this.selectedMemberPath&&""!==this.selectedMemberPath&&this._selItems)for(var i=0;i<this._selItems.length;i++){var n=this._selItems[i];this._setSelItem(n,!1)}this._updateMaxItems();this.onSelectedItemsChanged();this._refreshHeader();this._clearSelIndex()}},enumerable:!0,configurable:!0});MultiAutoComplete.prototype.onSelectedItemsChanged=function(e){this.selectedItemsChanged.raise(this,e)};MultiAutoComplete.prototype.onIsDroppedDownChanged=function(t){!this.isDroppedDown&&this.selectedIndex>-1&&!this._notAddItm&&this._addItem(!0);this._notAddItm=!1;e.prototype.onIsDroppedDownChanged.call(this,t)};MultiAutoComplete.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._initSeltems();this.isDroppedDown||this._refreshHeader()}};MultiAutoComplete.prototype._keydown=function(t){if(!this.isReadOnly){if(!t.defaultPrevented)switch(t.keyCode){case Key.Back:this._lastInputValue=this._tbx.value;break;case Key.Enter:this._itemOff();this._addItem(!0);isIE()&&setSelectionRange(this._tbx,this._tbx.textContent.length,this._tbx.textContent.length);break;case Key.Tab:if(this.isDroppedDown){this._addItem(!1);this._tbx.value="";this._lbx.selectedIndex=-1;this.isDroppedDown=!1;this.containsFocus()||this.focus();t.preventDefault()}else this._updateFocus();break;case Key.Space:if(""!==this._tbx.value)return;if(!this.isDroppedDown&&!this._tbx.disabled){this.isDroppedDown=!0;this._clearSelIndex()}break;case Key.Escape:this.isDroppedDown&&(this._notAddItm=!0);break;case Key.Left:this._itemOn(!this.rightToLeft);break;case Key.Right:this._itemOn(!!this.rightToLeft);break;case Key.Up:case Key.Down:var i=getActiveElement();if(t.altKey){if(this._tbx==i){this.isDroppedDown=!this.isDroppedDown;this.isDroppedDown||this._tbx.focus();t.preventDefault();return}}else if(this._tbx!==i)return;default:if(t.keyCode===Key.Back||t.keyCode===Key.Delete)return;this._itemOff();null!=this._maxSelItems&&this._selItems.length>=this._maxSelItems&&t.preventDefault()}this._tbx.disabled||e.prototype._keydown.call(this,t)}};MultiAutoComplete.prototype._updateState=function(){e.prototype._updateState.call(this);this._wjTpl&&(hasClass(this.hostElement,"wj-state-focused")||this._itemOff())};MultiAutoComplete.prototype._keyup=function(e){if(!this.isReadOnly&&!e.defaultPrevented)switch(e.keyCode){case Key.Back:0===this._tbx.value.length&&0===this._lastInputValue.length&&this._delItem(!1);break;case Key.Delete:this._delItem(!0)}};MultiAutoComplete.prototype._addHelperInput=function(){var e=document.createElement("input");e.type="text";e.tabIndex=-1;e.className="wj-token-helper";e.readOnly=!0;this._wjTpl.insertBefore(e,this._wjInput);this._helperInput=e};MultiAutoComplete.prototype._refreshHeader=function(){for(var e=this.hostElement.querySelectorAll(".wj-token"),t=0;t<e.length;t++)this._wjTpl.removeChild(e[t]);var i=this.selectedItems;if(i&&0!==i.length){for(t=0;t<i.length;t++)this._insertToken(i[t]);this._wjInput.style.cssFloat=this.rightToLeft?"right":"left";this._adjustInputWidth()}else{this._wjInput.style.cssFloat=this.rightToLeft?"right":"left";this._adjustInputWidth()}};MultiAutoComplete.prototype._insertToken=function(e){var t=this._getItemText(e,!0);this.isContentHtml||(t=escapeHtml(t));this._wjTpl.insertBefore(this._createItem(t),this._wjInput)};MultiAutoComplete.prototype._updateMaxItems=function(){null!=this._maxSelItems&&this._selItems&&this._selItems.length>this._maxSelItems&&(this._selItems=this._selItems.slice(0,this._maxSelItems))};MultiAutoComplete.prototype._updateFocus=function(){var e=this,t=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);if(t){removeClass(t,MultiAutoComplete._clsActive);setTimeout((function(){e._tbx.focus()}))}else this._clearSelIndex()};MultiAutoComplete.prototype._addItem=function(e){if(this.selectedItems.indexOf(this.selectedItem)>-1)this._clearSelIndex();else if(this.selectedIndex>-1){this._updateSelItems(this.selectedItem,!0);this._refreshHeader();e&&this._clearSelIndex();this._disableInput(!0)}};MultiAutoComplete.prototype._delItem=function(e){var t,i,n=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive),o=!1;if(!e||n){if(n){if((i=this._getItemIndex(n))>-1){t=this._selItems[i];o=!0}}else if(this._selItems.length>0){t=this._selItems[this._selItems.length-1];o=!0}if(o){this._updateSelItems(t,!1);this._refreshHeader();this._clearSelIndex();this._disableInput(!1)}this._tbx.focus()}};MultiAutoComplete.prototype._updateSelItems=function(e,t){if(t){this._selItems&&0!==this._selItems.length||(this._selItems=[]);if(null!=this._maxSelItems&&this._selItems.length>=this._maxSelItems)return;this._selItems.push(e)}else{var i=this._selItems.indexOf(e);this._selItems.splice(i,1)}this._hasSelectedMemeberPath()&&this._setSelItem(e,t);this.onSelectedItemsChanged()};MultiAutoComplete.prototype._createItem=function(e){var t=this,i=document.createElement("div"),n=document.createElement("span"),o=document.createElement("a");i.appendChild(n);i.appendChild(o);i.className="wj-token";n.className="wj-token-label";n.innerHTML=e;o.className="wj-token-close";o.href="#";o.tabIndex=-1;o.text="×";i.style.cssFloat=this.rightToLeft?"right":"left";this.addEventListener(i,"click",(function(e){t._helperInput.focus();var n=t._wjTpl.querySelector("."+MultiAutoComplete._clsActive);n&&removeClass(n,MultiAutoComplete._clsActive);addClass(i,MultiAutoComplete._clsActive);e.stopPropagation();e.preventDefault()}));this.addEventListener(o,"click",(function(e){if(!t.isReadOnly){var n=t._getItemIndex(i);if(n>-1){var o=t._selItems[n];t._updateSelItems(o,!1)}t._wjTpl.removeChild(i);t._adjustInputWidth();t._disableInput(!1);t._tbx.focus();e.stopPropagation();e.preventDefault()}}));return i};MultiAutoComplete.prototype._itemOn=function(e){var t,i,n,o=getActiveElement();if((this._tbx!=o||0===this._tbx.value.length)&&0!==(t=this._wjTpl.querySelectorAll(".wj-token")).length){i=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);n=this._getItemIndex(i);if(e){if(0===n)return;if(-1===n){addClass(t[t.length-1],MultiAutoComplete._clsActive);this._helperInput.focus()}else{removeClass(i,MultiAutoComplete._clsActive);addClass(t[n-1],MultiAutoComplete._clsActive);this._helperInput.focus()}}else if(!e){if(-1===n)return;if(n!==t.length-1){removeClass(i,MultiAutoComplete._clsActive);addClass(t[n+1],MultiAutoComplete._clsActive);this._helperInput.focus()}else{removeClass(i,MultiAutoComplete._clsActive);this._tbx.focus()}}}};MultiAutoComplete.prototype._itemOff=function(){var e=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);e&&removeClass(e,MultiAutoComplete._clsActive)};MultiAutoComplete.prototype._initSeltems=function(){if(this.selectedMemberPath){this._selItems.splice(0,this._selItems.length);var e=this.collectionView;if(e)for(var t=0;t<e.sourceCollection.length;t++)this._getSelItem(t)&&this._selItems.push(e.sourceCollection[t])}};MultiAutoComplete.prototype._getSelItem=function(e){var t=this.collectionView,i=t?t.sourceCollection[e]:null;return!(!isObject(i)||!this.selectedMemberPath)&&this._selPath.getValue(i)};MultiAutoComplete.prototype._setSelItem=function(e,t){this.itemsSource;isObject(e)&&this._selPath.getValue(e)!=t&&this._selPath.setValue(e,t)};MultiAutoComplete.prototype._clearSelIndex=function(){this.selectedIndex=-1};MultiAutoComplete.prototype._hasSelectedMemeberPath=function(){return this.selectedMemberPath&&""!==this.selectedMemberPath};MultiAutoComplete.prototype._disableInput=function(e){if(null!=this._maxSelItems)if(this._selItems.length<this._maxSelItems){this._tbx.disabled=!1;this._tbx.focus()}else{this._tbx.disabled=!0;this.hostElement.focus()}};MultiAutoComplete.prototype._adjustInputWidth=function(){this._tbx.style.width="60px";var e,t=getElementRect(this.hostElement),i=getElementRect(this._tbx),n=getComputedStyle(this._tbx),o=parseInt(n.paddingLeft,10),s=parseInt(n.paddingRight,10);e=this.rightToLeft?i.left+i.width-t.left-o-s-8:t.left+t.width-i.left-o-s-8;this._tbx.style.width=e+"px"};MultiAutoComplete.prototype._getItemIndex=function(e){for(var t=this.hostElement.querySelectorAll(".wj-token"),i=0;i<t.length;i++)if(e===t[i])return i;return-1};MultiAutoComplete.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};MultiAutoComplete.prototype._setTabOrder=function(e){this._orgTabIndex=e;this._updateTabIndex()};MultiAutoComplete.prototype._updateTabIndex=function(){var e=this.hostElement;this._tbx.tabIndex=this.isDisabled?-1:this._orgTabIndex;e.tabIndex=-1};MultiAutoComplete._clsActive="wj-token-active";return MultiAutoComplete}(AutoComplete);export{MultiAutoComplete};_registerModule("wijmo.input",selfModule);