/*
    *
    * Wijmo Library 5.20181.462
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const wjcCore=require("wijmo/wijmo"),wjcSelfRef=require("wijmo/wijmo.input");var wjcSelf=wjcSelfRef||exports;window.wijmo=window.wijmo||{},window.wijmo.input=wjcSelf;class DropDown extends wjcCore.Control{constructor(e,t){super(e,null,!0),this._showBtn=!0,this._autoExpand=!0,this._animate=!1,this.textChanged=new wjcCore.Event,this.isDroppedDownChanging=new wjcCore.Event,this.isDroppedDownChanged=new wjcCore.Event;let s=this.getTemplate();this.applyTemplate("wj-control wj-content wj-dropdown",s,{_tbx:"input",_btn:"btn",_dropDown:"dropdown"},"input");let i=this._tbx;this._elRef=i,wjcCore.disableAutoComplete(i),this._createDropDown(),this._updateBtn(),wjcCore.removeChild(this._dropDown),wjcCore.addClass(this.hostElement,"wj-state-collapsed");let h=this._updateFocusState.bind(this);this.addEventListener(this.dropDown,"blur",h,!0),this.addEventListener(this.dropDown,"focus",h);let r=this._keydown.bind(this);this.addEventListener(this.hostElement,"keydown",r),this.addEventListener(this.dropDown,"keydown",r),this.addEventListener(i,"keypress",e=>{9787==e.keyCode&&this._altDown&&e.preventDefault()}),this.addEventListener(i,"input",()=>{this._setText(this.text,!1)}),this.addEventListener(i,"click",()=>{this._autoExpand&&this._expandSelection()}),wjcCore.isIE9()&&this.addEventListener(i,"keyup",()=>{this._setText(this.text,!1)}),this.addEventListener(this._btn,"mousedown",e=>{e.defaultPrevented||0!=e.button||setTimeout(()=>{this._btnclick(e)})}),this.addEventListener(this._dropDown,"click",e=>{e.stopPropagation()})}get text(){return this._tbx.value}set text(e){e!=this.text&&this._setText(e,!0)}get inputElement(){return this._tbx}get isReadOnly(){return this._tbx.readOnly}set isReadOnly(e){this._tbx.readOnly=wjcCore.asBoolean(e),wjcCore.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)}get isRequired(){return this._tbx.required}set isRequired(e){this._tbx.required=wjcCore.asBoolean(e)}get placeholder(){return this._tbx.placeholder}set placeholder(e){this._tbx.placeholder=e}get isDroppedDown(){let e=this._dropDown;return e&&"none"!=e.style.display}set isDroppedDown(e){if((e=wjcCore.asBoolean(e)&&!this.isDisabled&&!this.isReadOnly)!=this.isDroppedDown&&this.onIsDroppedDownChanging(new wjcCore.CancelEventArgs)){let t=this.hostElement,s=this._dropDown;if(e)s.style.minWidth||(s.style.minWidth=t.getBoundingClientRect().width+"px"),s.style.display="block",this._updateDropDown();else{let e=this.containsFocus();wjcCore.hidePopup(s),e&&(this.isTouching&&this.showDropDownButton?this.focus():this.selectAll())}this._updateFocusState(),wjcCore.toggleClass(t,"wj-state-collapsed",!this.isDroppedDown),this.onIsDroppedDownChanged()}}get dropDown(){return this._dropDown}get dropDownCssClass(){return this._cssClass}set dropDownCssClass(e){e!=this._cssClass&&(wjcCore.removeClass(this._dropDown,this._cssClass),this._cssClass=wjcCore.asString(e),wjcCore.addClass(this._dropDown,this._cssClass))}get showDropDownButton(){return this._showBtn}set showDropDownButton(e){this._showBtn=wjcCore.asBoolean(e),this._updateBtn()}get autoExpandSelection(){return this._autoExpand}set autoExpandSelection(e){this._autoExpand=wjcCore.asBoolean(e)}get isAnimated(){return this._animate}set isAnimated(e){this._animate=wjcCore.asBoolean(e)}selectAll(){this._elRef==this._tbx&&wjcCore.setSelectionRange(this._tbx,0,this.text.length),this.containsFocus()||this.focus()}onTextChanged(e){this.textChanged.raise(this,e),this._updateState()}onIsDroppedDownChanging(e){return this.isDroppedDownChanging.raise(this,e),!e.cancel}onIsDroppedDownChanged(e){this.isDroppedDownChanged.raise(this,e)}onGotFocus(e){this.isTouching||wjcCore.contains(this._dropDown,wjcCore.getActiveElement())||this.selectAll(),super.onGotFocus(e)}onLostFocus(e){this._commitText(),this.containsFocus()||(this.isDroppedDown=!1),super.onLostFocus(e)}containsFocus(){return super.containsFocus()||this.isDroppedDown&&wjcCore.contains(this._dropDown,wjcCore.getActiveElement())}dispose(){this.isDroppedDown=!1;let e=this.dropDown;if(e){let t=wjcCore.Control.getControl(e);t&&t.dispose(),wjcCore.removeChild(e)}super.dispose()}refresh(e=!0){if(super.refresh(e),this.isDroppedDown&&"none"!=getComputedStyle(this.hostElement).display){let e=wjcCore.getActiveElement();wjcCore.showPopup(this._dropDown,this.hostElement,!1,!1,null==this.dropDownCssClass),e instanceof HTMLElement&&e!=wjcCore.getActiveElement()&&e.focus()}}_handleResize(){this.isDroppedDown&&this.refresh()}_expandSelection(){let e=this._tbx,t=e.value,s=e.selectionStart,i=e.selectionEnd;if(t&&s==i){let h=this._getCharType(t,s);if(h>-1){for(;i<t.length&&this._getCharType(t,i)==h;i++);for(;s>0&&this._getCharType(t,s-1)==h;s--);s!=i&&wjcCore.setSelectionRange(e,s,i)}}}_getCharType(e,t){let s=e[t];return s>="0"&&s<="9"?0:s>="a"&&s<="z"||s>="A"&&s<="Z"?1:-1}_keydown(e){if(this._altDown=e.altKey,!e.defaultPrevented)switch(e.keyCode){case wjcCore.Key.Tab:case wjcCore.Key.Escape:case wjcCore.Key.Enter:this.isDroppedDown&&(this.isDroppedDown=!1,e.keyCode==wjcCore.Key.Tab||this.containsFocus()||this.focus(),e.preventDefault());break;case wjcCore.Key.F4:case wjcCore.Key.Up:case wjcCore.Key.Down:if((e.keyCode==wjcCore.Key.F4||e.altKey)&&wjcCore.contains(document.body,this.hostElement)){let t=this.isDroppedDown;this.isDroppedDown=!t,this.isDroppedDown==!t&&e.preventDefault()}}}_btnclick(e){e.defaultPrevented||0!=e.button||(this.isDroppedDown=!this.isDroppedDown)}_setText(e,t){null==e&&(e=""),(e=e.toString())!=this._tbx.value&&(this._tbx.value=e),e!=this._oldText&&(this._oldText=e,this.onTextChanged())}_updateBtn(){this._btn.tabIndex=-1,this._btn.style.display=this._showBtn?"":"none"}_createDropDown(){}_commitText(){}_updateDropDown(){this.isDroppedDown&&(this._commitText(),wjcCore.showPopup(this._dropDown,this.hostElement,!1,this._animate,null==this.dropDownCssClass))}}DropDown.controlTemplate='<div style="position:relative" 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" tabindex="-1"><button class="wj-btn wj-btn-default" type="button" tabindex="-1"><span class="wj-glyph-down"></span></button></span></div></div><div wj-part="dropdown" class="wj-content wj-dropdown-panel" style="display:none"></div></div>',exports.DropDown=DropDown;var DateSelectionMode;!function(e){e[e.None=0]="None",e[e.Day=1]="Day",e[e.Month=2]="Month"}(DateSelectionMode=exports.DateSelectionMode||(exports.DateSelectionMode={}));class Calendar extends wjcCore.Control{constructor(e,t){super(e),this._readOnly=!1,this._selMode=DateSelectionMode.Day,this._fmtYrMo="y",this._fmtYr="yyyy",this._fmtDayHdr="ddd",this._fmtDay="d ",this._fmtMonths="MMM",this.valueChanged=new wjcCore.Event,this.displayMonthChanged=new wjcCore.Event,this.formatItem=new wjcCore.Event,this._value=wjcCore.DateTime.newDate(),this._currMonth=this._getMonth(this._value),this._createChildren(),this.addEventListener(this.hostElement,"mouseup",this._click.bind(this)),this.addEventListener(this.hostElement,"keydown",this._keydown.bind(this)),this.initialize(t),this.refresh(!0)}get value(){return this._value}set value(e){e=wjcCore.asDate(e,!0),e=this._clamp(e),(this._valid(e)||null==e)&&(this.displayMonth=this._getMonth(e),wjcCore.DateTime.equals(this._value,e)||(this._value=e,this.invalidate(!1),this.onValueChanged()))}get min(){return this._min}set min(e){e!=this.min&&(this._min=wjcCore.asDate(e,!0),this.refresh())}get max(){return this._max}set max(e){e!=this.max&&(this._max=wjcCore.asDate(e,!0),this.refresh())}get selectionMode(){return this._selMode}set selectionMode(e){if((e=wjcCore.asEnum(e,DateSelectionMode))!=this._selMode){this._selMode=e;let t=this._monthMode();t&&(this.monthView=!1);let s=this._btnMth.querySelector(".wj-glyph-down");s&&(s.style.display=t?"none":""),this.refresh()}}get isReadOnly(){return this._readOnly}set isReadOnly(e){this._readOnly=wjcCore.asBoolean(e),wjcCore.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)}get firstDayOfWeek(){return this._fdw}set firstDayOfWeek(e){if(e!=this._fdw){if((e=wjcCore.asNumber(e,!0))&&(e>6||e<0))throw"firstDayOfWeek must be between 0 and 6 (Sunday to Saturday).";this._fdw=e,this.refresh()}}get displayMonth(){return this._currMonth}set displayMonth(e){wjcCore.DateTime.equals(this.displayMonth,e)||(e=wjcCore.asDate(e),(this.monthView?this._monthInValidRange(e):this._yearInValidRange(e))&&(this._currMonth=this._getMonth(this._clamp(e)),this.invalidate(!0),this.onDisplayMonthChanged()))}get formatYearMonth(){return this._fmtYrMo}set formatYearMonth(e){e!=this._fmtYrMo&&(this._fmtYrMo=wjcCore.asString(e),this.invalidate())}get formatDayHeaders(){return this._fmtDayHdr}set formatDayHeaders(e){e!=this._fmtDayHdr&&(this._fmtDayHdr=wjcCore.asString(e),this.invalidate())}get formatDays(){return this._fmtDay}set formatDays(e){e!=this._fmtDay&&(this._fmtDay=wjcCore.asString(e),this.invalidate())}get formatYear(){return this._fmtYr}set formatYear(e){e!=this._fmtYr&&(this._fmtYr=wjcCore.asString(e),this.invalidate())}get formatMonths(){return this._fmtMonths}set formatMonths(e){e!=this._fmtMonths&&(this._fmtMonths=wjcCore.asString(e),this.invalidate())}get showHeader(){return"none"!=this._tbHdr.style.display}set showHeader(e){this._tbHdr.style.display=wjcCore.asBoolean(e)?"":"none"}get monthView(){return"none"!=this._tbMth.style.display}set monthView(e){e!=this.monthView&&(this._tbMth.style.display=e?"":"none",this._tbYr.style.display=e?"none":"")}get itemFormatter(){return this._itemFormatter}set itemFormatter(e){e!=this._itemFormatter&&(this._itemFormatter=wjcCore.asFunction(e),this.invalidate())}get itemValidator(){return this._itemValidator}set itemValidator(e){e!=this._itemValidator&&(this._itemValidator=wjcCore.asFunction(e),this.invalidate())}onValueChanged(e){this.valueChanged.raise(this,e)}onDisplayMonthChanged(e){this.displayMonthChanged.raise(this,e)}onFormatItem(e){this.formatItem.raise(this,e)}refresh(e=!0){let t,s,i,h=this.displayMonth,r=null!=this.firstDayOfWeek?this.firstDayOfWeek:wjcCore.Globalize.getFirstDayOfWeek();super.refresh(e),this._firstDay=wjcCore.DateTime.addDays(h,-(h.getDay()-r+7)%7),wjcCore.setText(this._spMth,wjcCore.Globalize.format(h,this._fmtYrMo)),t=this._tbMth.querySelectorAll("td");for(let e=0;e<7&&e<t.length;e++)i=wjcCore.DateTime.addDays(this._firstDay,e),wjcCore.setText(t[e],wjcCore.Globalize.format(i,this._fmtDayHdr));for(let e=7;e<t.length;e++){s=t[e],i=wjcCore.DateTime.addDays(this._firstDay,e-7),wjcCore.setText(s,wjcCore.Globalize.format(i,this._fmtDay));let r=!this._valid(i);if(wjcCore.toggleClass(s,"wj-state-invalid",r),wjcCore.toggleClass(s,"wj-state-selected",this._selMode&&wjcCore.DateTime.sameDate(i,this.value)),wjcCore.toggleClass(s,"wj-day-today",wjcCore.DateTime.sameDate(i,wjcCore.DateTime.newDate())),wjcCore.toggleClass(s,"wj-day-othermonth",r||i.getMonth()!=h.getMonth()||!this._inValidRange(i)),this.itemFormatter&&this.itemFormatter(i,s),this.formatItem.hasHandlers){let t=new FormatItemEventArgs(e,i,s);this.onFormatItem(t)}}let o=this._tbMth.querySelectorAll("tr");o.length&&(i=wjcCore.DateTime.addDays(this._firstDay,28),o[o.length-2].style.display=i.getMonth()==h.getMonth()?"":"none",i=wjcCore.DateTime.addDays(this._firstDay,35),o[o.length-1].style.display=i.getMonth()==h.getMonth()?"":"none"),(t=this._tbYr.querySelectorAll("td")).length&&wjcCore.setText(t[0],wjcCore.Globalize.format(h,this._fmtYr));for(let e=1;e<t.length;e++)s=t[e],i=wjcCore.DateTime.newDate(h.getFullYear(),e-1,1),wjcCore.setText(s,wjcCore.Globalize.format(i,this._fmtMonths)),s.className="",wjcCore.toggleClass(s,"wj-state-disabled",!this._monthInValidRange(i)),wjcCore.toggleClass(s,"wj-state-selected",this._sameMonth(i,this.value))}_canChangeValue(){return!this._readOnly&&this._selMode!=DateSelectionMode.None}_valid(e){return!!wjcCore.isDate(e)&&(!!wjcCore.DateTime.sameDate(e,this._clamp(e))&&(!wjcCore.isFunction(this.itemValidator)||this.itemValidator(e)))}_inValidRange(e){return!(this.min&&e<wjcCore.DateTime.fromDateTime(this.min,e))&&!(this.max&&e>wjcCore.DateTime.fromDateTime(this.max,e))}_monthInValidRange(e){if(this.min||this.max){let t=e.getFullYear(),s=e.getMonth(),i=wjcCore.DateTime.newDate(t,s,1),h=wjcCore.DateTime.newDate(t,s+1,0);if(this.min&&this.min>h)return!1;if(this.max&&this.max<i)return!1}return!0}_yearInValidRange(e){if(this.min||this.max){let t=e.getFullYear(),s=wjcCore.DateTime.newDate(t,0),i=wjcCore.DateTime.newDate(t,11,31);if(this.min&&this.min>i)return!1;if(this.max&&this.max<s)return!1}return!0}_sameMonth(e,t){return wjcCore.isDate(e)&&wjcCore.isDate(t)&&e.getMonth()==t.getMonth()&&e.getFullYear()==t.getFullYear()}_getValidDate(e,t){if(wjcCore.isDate(e)){let s=e.getFullYear(),i=e.getMonth()+(t?0:1),h=t?1:0,r=wjcCore.DateTime.newDate(s,i,h),o=t?1:-1;for(let e=0;e<31;e++){if(this._valid(r))return r;r=wjcCore.DateTime.addDays(r,o)}}return null}_clamp(e){if(e){if(this.min){let t=wjcCore.DateTime.fromDateTime(this.min,e);e<t&&(e=t)}if(this.max){let t=wjcCore.DateTime.fromDateTime(this.max,e);e>t&&(e=t)}}return e}_createChildren(){let 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"});let t=this._createElement("tr",this._tbMth,"wj-header");for(let e=0;e<7;e++)this._createElement("td",t);for(let e=0;e<6;e++){t=this._createElement("tr",this._tbMth);for(let e=0;e<7;e++)this._createElement("td",t)}t=this._createElement("tr",this._tbYr,"wj-header"),this._createElement("td",t).setAttribute("colspan","4");for(let e=0;e<3;e++){t=this._createElement("tr",this._tbYr);for(let e=0;e<4;e++)this._createElement("td",t)}}_createElement(e,t,s){let i=document.createElement(e);return t&&t.appendChild(i),s&&wjcCore.addClass(i,s),i}_click(e){if(!e.defaultPrevented&&0==e.button){let t=!1,s=e.target;if(wjcCore.contains(this._btnMth,s)&&!this._monthMode()?(this.monthView=!this.monthView,t=!0):wjcCore.contains(this._btnPrv,s)?(this._navigate(-1),t=!0):wjcCore.contains(this._btnNxt,s)?(this._navigate(1),t=!0):wjcCore.contains(this._btnTdy,s)&&(this._navigate(0),t=!0),s&&!t&&(s=wjcCore.closest(s,"TD")))if(this.monthView){let e=this._getCellIndex(this._tbMth,s);if(e>6&&this._canChangeValue()){let s=wjcCore.DateTime.fromDateTime(wjcCore.DateTime.addDays(this._firstDay,e-7),this.value);this._inValidRange(s)&&this._valid(s)&&(this.value=s),t=!0}}else{let e=this._getCellIndex(this._tbYr,s);if(e>0){if(this.displayMonth=wjcCore.DateTime.newDate(this.displayMonth.getFullYear(),e-1,1),this._monthMode()){if(this._canChangeValue()){let e=wjcCore.DateTime.fromDateTime(this.displayMonth,this.value);this._inValidRange(e)&&(this.value=e)}}else this.monthView=!0;t=!0}}t&&(e.preventDefault(),this.focus())}}_getCellIndex(e,t){let s=e.querySelectorAll("TD");for(let e=0;e<s.length;e++)if(s[e]==t)return e;return-1}_keydown(e){if(e.defaultPrevented)return;if(e.altKey)switch(e.keyCode){case wjcCore.Key.Up:case wjcCore.Key.Down:return;case wjcCore.Key.End:return this._navigate(0),void e.preventDefault()}if(e.ctrlKey||e.metaKey||e.shiftKey)return;let t=0,s=0,i=!0;if(this.monthView)switch(e.keyCode){case wjcCore.Key.Left:t=-1;break;case wjcCore.Key.Right:t=1;break;case wjcCore.Key.Up:t=-7;break;case wjcCore.Key.Down:t=7;break;case wjcCore.Key.PageDown:s=e.altKey?12:1;break;case wjcCore.Key.PageUp:s=e.altKey?-12:-1;break;case wjcCore.Key.Home:if(this._canChangeValue()){let e=this._getValidDate(this.value,!0);e&&(this.value=wjcCore.DateTime.fromDateTime(e,this.value))}break;case wjcCore.Key.End:if(this._canChangeValue()){let e=this._getValidDate(this.value,!1);e&&(this.value=wjcCore.DateTime.fromDateTime(e,this.value))}break;default:i=!1}else switch(e.keyCode){case wjcCore.Key.Left:s=-1;break;case wjcCore.Key.Right:s=1;break;case wjcCore.Key.Up:s=-4;break;case wjcCore.Key.Down:s=4;break;case wjcCore.Key.PageDown:s=e.altKey?120:12;break;case wjcCore.Key.PageUp:s=e.altKey?-120:-12;break;case wjcCore.Key.Home:s=this.value?-this.value.getMonth():0;break;case wjcCore.Key.End:s=this.value?11-this.value.getMonth():0;break;case wjcCore.Key.Enter:this._monthMode()?i=!1:this.monthView=!0;break;default:i=!1}if(this.value&&this._canChangeValue()&&(t||s)){let e=this.value;if(e=wjcCore.DateTime.addDays(e,t),e=wjcCore.DateTime.addMonths(e,s),s&&!this._valid(e)){let t=e.getMonth();for(let s=1;s<31&&!this._valid(e);s++){let i=wjcCore.DateTime.addDays(e,+s),h=wjcCore.DateTime.addDays(e,-s);this._valid(i)&&i.getMonth()==t?e=i:this._valid(h)&&h.getMonth()==t&&(e=h)}}for(let i=0;i<31&&!this._valid(e);i++)e=wjcCore.DateTime.addDays(e,t>0||s>0?1:-1);this.value=e}i&&e.preventDefault()}_getMonth(e){return e||(e=wjcCore.DateTime.newDate()),wjcCore.DateTime.newDate(e.getFullYear(),e.getMonth(),1)}_monthMode(){return this.selectionMode==DateSelectionMode.Month}_navigate(e){let t=this.monthView,s=this.displayMonth;switch(e){case 0:let i=wjcCore.DateTime.newDate();this._canChangeValue()&&(this.value=t?wjcCore.DateTime.fromDateTime(i,this.value):this._getMonth(i)),s=this._getMonth(i);break;case 1:s=wjcCore.DateTime.addMonths(s,t?1:12);break;case-1:s=wjcCore.DateTime.addMonths(s,t?-1:-12)}this.displayMonth=s}}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"><span wj-part="span-month"></span> <span class="wj-glyph-down"></span></div><div class="wj-btn-group"><button type="button" tabindex="-1" wj-part="btn-prev" class="wj-btn wj-btn-default"><span class="wj-glyph-left"></span></button><button type="button" tabindex="-1" wj-part="btn-today" class="wj-btn wj-btn-default"><span class="wj-glyph-circle"></span></button><button type="button" tabindex="-1" wj-part="btn-next" class="wj-btn wj-btn-default"><span class="wj-glyph-right"></span></button></div></div><table wj-part="tbl-month" class="wj-calendar-month"></table><table wj-part="tbl-year" class="wj-calendar-year" style="display:none"></table></div>',exports.Calendar=Calendar;class ColorPicker extends wjcCore.Control{constructor(e,t){super(e),this._hsb=[.5,1,1],this._alpha=1,this.valueChanged=new wjcCore.Event;let s=this.getTemplate();this.applyTemplate("wj-control wj-content wj-colorpicker",s,{_eSB:"div-sb",_eHue:"div-hue",_eAlpha:"div-alpha",_ePreview:"div-pv",_ePal:"div-pal",_eText:"div-text"}),this._palette="#FFF,#000, #F00,#FFC000,#FFFF00,#92D050,#00B050,#00B0F0,#0070C0,#7030A0".split(","),this._updatePalette(),this._eHue.style.backgroundImage="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD4CAIAAACi6hsPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAGvSURBVDhPXdBPaM9xHMfxz4pWaxcmtoOhpdXSVpiyHWxqmVpDjaU5rK34XfypjTJ/p+ZPay6jhsOsRrKwaJElf9IQq03WIkv4FeMwMq221tfje1ByeFzfvd7PEKWGEKWTQRZLySWfVRRTQjmVbKWGOhLsZT+HaeY0bbTTQSfdXOcWffTzmAFeMcwoYyT5ygS/mA5hNgphip98J8kHRnnNSwZ4yH1uc4OrdHGR87RximYO0cgedlLLdqqoYAPrWMtKVrCcJSxiPmnMJUQp/Bsyk2xyyKOAQooopYwKtlDNDur5G7SBJo7RQiv/B+2hl3s84CkvGGKEOOYnxolj/mYmhBmDJ5ngCx95xxsGecYj4pB3iENeoZMO2mmlhaMcpIE4ZII6aqhmM3HMMkooopB88sghm0wySCeVlCjMCVFIYx4LWUwOeRSwhmLWU84mqqihll3sppEmjnOSs5zjEl1c4yZ99POE5wwxwns+840fTDFLFKaZZIJxkozxlmEGGSC+GF++Sy89dHOZC8Rr4lVnOMERDrCPBPXEX22jko2UEn+/mnxyWUYWC0gnNUQh/AEc0HJs6cex0gAAAABJRU5ErkJggg==)",this._eHue.style.backgroundSize="contain",navigator.appVersion.indexOf("MSIE 9")>-1&&(this._eSB.children[0].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff,endColorstr=#00ffffff,GradientType=1)",this._eSB.children[1].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ff000000,GradientType=0)"),s=ColorPicker._tplCursor,this._cSB=wjcCore.createElement(s),this._cHue=wjcCore.createElement(s),this._cHue.style.width="100%",this._cAlpha=wjcCore.createElement(s),this._cAlpha.style.height="100%",this._eSB.appendChild(this._cSB),this._eHue.appendChild(this._cHue),this._eAlpha.appendChild(this._cAlpha),this.addEventListener(this.hostElement,"mousedown",e=>{document.addEventListener("mousemove",i),document.addEventListener("mouseup",h),this._mouseDown(e)});let i=e=>{this._mouseMove(e)},h=e=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",h),this._mouseUp(e)};this.addEventListener(this.hostElement,"click",e=>{let t=e.target;if(t&&"DIV"==t.tagName&&wjcCore.contains(this._ePal,t)){let e=t.style.backgroundColor;e&&(this.value=new wjcCore.Color(e).toString())}}),this.value="#ffffff",this.initialize(t),this._updatePanels()}get showAlphaChannel(){return"none"!=this._eAlpha.parentElement.style.display}set showAlphaChannel(e){this._eAlpha.parentElement.style.display=wjcCore.asBoolean(e)?"":"none"}get showColorString(){return"none"!=this._eText.style.display}set showColorString(e){this._eText.style.display=wjcCore.asBoolean(e)?"":"none"}get value(){return this._value}set value(e){if(e!=this.value){this._value=wjcCore.asString(e),this._eText.innerText=this._value;let t=new wjcCore.Color(this._value),s=t.getHsb();this._hsb[0]==s[0]&&this._hsb[1]==s[1]&&this._hsb[2]==s[2]&&this._alpha==t.a||(0==s[2]?(s[0]=this._hsb[0],s[1]=this._hsb[1]):0==s[1]&&(s[0]=this._hsb[0]),this._hsb=s,this._alpha=t.a,this.onValueChanged())}}get palette(){return this._palette}set palette(e){e=wjcCore.asArray(e);for(let t=0;t<e.length&&t<this._palette.length;t++){let s=wjcCore.asString(e[t]);this._palette[t]=s}this._updatePalette()}onValueChanged(e){this._updatePanels(),this.valueChanged.raise(this,e)}_mouseDown(e){this._htDown=this._getTargetPanel(e),this._htDown&&(e.preventDefault(),this.focus(),this._mouseMove(e))}_mouseMove(e){if(this._htDown){let t=this._htDown.getBoundingClientRect();this._htDown==this._eHue?(this._hsb[0]=wjcCore.clamp((e.clientY-t.top)/t.height,0,.99),this._updateColor()):this._htDown==this._eSB?(this._hsb[1]=wjcCore.clamp((e.clientX-t.left)/t.width,0,1),this._hsb[2]=wjcCore.clamp(1-(e.clientY-t.top)/t.height,0,1),this._updateColor()):this._htDown==this._eAlpha&&(this._alpha=wjcCore.clamp((e.clientX-t.left)/t.width,0,1),this._updateColor())}}_mouseUp(e){this._htDown=null}_updateColor(){let e=wjcCore.Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],this._alpha);this.value=e.toString(),this._updatePanels()}_updatePalette(){let e=new wjcCore.Color("#fff"),t=new wjcCore.Color("#000");this._ePal.innerHTML="";for(let s=0;s<this._palette.length;s++){let i=wjcCore.createElement('<div style="float:left;width:10%;box-sizing:border-box;padding:1px">'),h=new wjcCore.Color(this._palette[s]),r=h.getHsb();i.appendChild(this._makePalEntry(h,4));for(let s=0;s<5;s++){if(0==r[1]){let i=.1*s+(r[2]>.5?.05:.55);h=wjcCore.Color.interpolate(e,t,i)}else h=wjcCore.Color.fromHsb(r[0],.1+.2*s,1-.1*s);i.appendChild(this._makePalEntry(h,0))}this._ePal.appendChild(i)}}_makePalEntry(e,t){let s=document.createElement("div");return wjcCore.setCss(s,{cursor:"pointer",backgroundColor:e.toString(),marginBottom:t||""}),s.innerHTML="&nbsp",s}_updatePanels(){let e=wjcCore.Color.fromHsb(this._hsb[0],1,1,1),t=wjcCore.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)+"%"}_getTargetPanel(e){let t=e.target;return wjcCore.contains(this._eSB,t)?this._eSB:wjcCore.contains(this._eHue,t)?this._eHue:wjcCore.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>',exports.ColorPicker=ColorPicker;class ListBox extends wjcCore.Control{constructor(e,t){super(e),this._pathDisplay=new wjcCore.Binding(null),this._pathValue=new wjcCore.Binding(null),this._pathChecked=new wjcCore.Binding(null),this._html=!1,this._checkedItems=[],this._itemRole="option",this._search="",this.selectedIndexChanged=new wjcCore.Event,this.itemsChanged=new wjcCore.Event,this.loadingItems=new wjcCore.Event,this.loadedItems=new wjcCore.Event,this.itemChecked=new wjcCore.Event,this.checkedItemsChanged=new wjcCore.Event,this.formatItem=new wjcCore.Event,this.applyTemplate("wj-control wj-content wj-listbox",null,null);let s=this.hostElement;wjcCore.setAttribute(s,"role","listbox",!0),"SELECT"==this._orgTag&&this._initFromSelect(this.hostElement),this.addEventListener(s,"click",this._click.bind(this)),this.addEventListener(s,"keydown",this._keydown.bind(this)),this.addEventListener(s,"keypress",this._keypress.bind(this)),this.addEventListener(s,"wheel",e=>{s.scrollHeight>s.offsetHeight&&(e.deltaY<0&&0==s.scrollTop||e.deltaY>0&&s.scrollTop+s.offsetHeight>=s.scrollHeight)&&(e.preventDefault(),e.stopPropagation())}),this._tabIndex=s.tabIndex,this.initialize(t)}refresh(e=!0){super.refresh(e),!this.displayMemberPath&&this.checkedMemberPath||this._populateList()}get itemsSource(){return this._items}set itemsSource(e){this._items!=e&&(this._cv&&(this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this),this._cv=null),this._items=e,this._cv=wjcCore.asCollectionView(e),null!=this._cv&&(this._cv.currentChanged.addHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)),this._populateList(),this.onItemsChanged(),this.onSelectedIndexChanged())}get collectionView(){return this._cv}get isContentHtml(){return this._html}set isContentHtml(e){e!=this._html&&(this._html=wjcCore.asBoolean(e),this._populateList())}get itemFormatter(){return this._itemFormatter}set itemFormatter(e){e!=this._itemFormatter&&(this._itemFormatter=wjcCore.asFunction(e),this._populateList())}get displayMemberPath(){return this._pathDisplay.path}set displayMemberPath(e){e!=this.displayMemberPath&&(this._pathDisplay.path=wjcCore.asString(e),this._populateList())}get selectedValuePath(){return this._pathValue.path}set selectedValuePath(e){this._pathValue.path=wjcCore.asString(e)}get checkedMemberPath(){return this._pathChecked.path}set checkedMemberPath(e){e!=this.checkedMemberPath&&(this._pathChecked.path=wjcCore.asString(e),this._populateList())}get itemRole(){return this._itemRole}set itemRole(e){e!=this.itemRole&&(this._itemRole=wjcCore.asString(e),this._populateList())}getDisplayValue(e){let t=null;e>-1&&wjcCore.hasItems(this._cv)&&(t=this._cv.items[e],this.displayMemberPath&&(t=this._pathDisplay.getValue(t)));let s=null!=t?t.toString():"";return this.itemFormatter&&(s=this.itemFormatter(e,s)),s}getDisplayText(e){let t=this.hostElement.children,s=e>-1&&e<t.length?t[e]:null;return null!=s?s.textContent:""}isItemEnabled(e){if(!this.getDisplayText(e))return!1;var t=this.hostElement.children[e];return!(!t||t.hasAttribute("disabled")||wjcCore.hasClass(t,"wj-state-disabled"))}get selectedIndex(){return this._cv?this._cv.currentPosition:-1}set selectedIndex(e){this._cv&&this._cv.moveCurrentToPosition(wjcCore.asNumber(e))}get selectedItem(){return this._cv?this._cv.currentItem:null}set selectedItem(e){this._cv&&this._cv.moveCurrentTo(e)}get selectedValue(){let e=this.selectedItem;return e&&this.selectedValuePath&&(e=this._pathValue.getValue(e)),e}set selectedValue(e){let t=this.selectedValuePath,s=-1;if(this._cv){for(let i=0;i<this._cv.items.length;i++){let h=this._cv.items[i],r=t?this._pathValue.getValue(h):h;if(r===e||wjcCore.DateTime.equals(r,e)){s=i;break}}this.selectedIndex=s}}get maxHeight(){let e=this.hostElement;return e?parseFloat(e.style.maxHeight):null}set maxHeight(e){let t=this.hostElement;t&&(t.style.maxHeight=wjcCore.asNumber(e)+"px")}showSelection(){let e,t=this.selectedIndex,s=this.hostElement,i=s.children;for(let s=0;s<i.length;s++)e=i[s],wjcCore.toggleClass(e,"wj-state-selected",s==t),wjcCore.setAttribute(e,"tabindex",s==t?this._tabIndex:-1);if(t>-1&&t<i.length){let h=(e=i[t]).getBoundingClientRect(),r=s.getBoundingClientRect();h.bottom>r.bottom?s.scrollTop+=h.bottom-r.bottom:h.top<r.top&&(s.scrollTop-=r.top-h.top)}t>-1&&this.containsFocus()&&(e=i[t])instanceof HTMLElement&&!wjcCore.contains(e,wjcCore.getActiveElement())&&e.focus(),wjcCore.setAttribute(s,"tabindex",t<0?this._tabIndex:-1)}getItemChecked(e){let t=this._cv.items[e];if(wjcCore.isObject(t)&&this.checkedMemberPath)return this._pathChecked.getValue(t);let s=this._getCheckbox(e);return!!s&&s.checked}setItemChecked(e,t){this._setItemChecked(e,t,!0)}toggleItemChecked(e){this.setItemChecked(e,!this.getItemChecked(e))}get checkedItems(){if(this._checkedItems.splice(0,this._checkedItems.length),this._cv)for(let e=0;e<this._cv.items.length;e++)this.getItemChecked(e)&&this._checkedItems.push(this._cv.items[e]);return this._checkedItems}set checkedItems(e){let t=this._cv,s=this.hostElement,i=wjcCore.asArray(e,!1);if(t&&i){let e=t.currentPosition,h=s.scrollTop;for(let e=0;e<t.items.length;e++){let s=t.items[e];this._setItemChecked(e,i.indexOf(s)>-1,!1)}t.moveCurrentToPosition(e),s.scrollTop=h,this.onCheckedItemsChanged()}}onSelectedIndexChanged(e){this.selectedIndexChanged.raise(this,e)}onItemsChanged(e){this.itemsChanged.raise(this,e)}onLoadingItems(e){this.loadingItems.raise(this,e)}onLoadedItems(e){this.loadedItems.raise(this,e)}onItemChecked(e){this.itemChecked.raise(this,e)}onCheckedItemsChanged(e){this.checkedItemsChanged.raise(this,e)}onFormatItem(e){this.formatItem.raise(this,e)}_setItemChecked(e,t,s=!0){let i=this._cv.items[e];if(wjcCore.isObject(i)){let e=wjcCore.tryCast(this._cv,"IEditableCollectionView");this._pathChecked.getValue(i)!=t&&(this._checking=!0,e?(e.editItem(i),this._pathChecked.setValue(i,t),e.commitEdit()):(this._pathChecked.setValue(i,t),this._cv.refresh()),this._checking=!1)}let h=this._getCheckbox(e);if(h){h.checked=t;let e=wjcCore.closest(h,".wj-listbox-item");e&&wjcCore.toggleClass(e,"wj-state-checked",t)}s&&(this.onItemChecked(),this.onCheckedItemsChanged())}_cvCollectionChanged(e,t){this._checking||(this._populateList(),this.onItemsChanged())}_cvCurrentChanged(e,t){this._checking||(this.showSelection(),this.onSelectedIndexChanged())}_populateList(){let e=this.hostElement;if(e){let t=this.containsFocus();if(this.onLoadingItems(),e.innerHTML="",this._cv){let t=document.createDocumentFragment();for(let e=0;e<this._cv.items.length;e++){let s=this.getDisplayValue(e);1!=this._html&&(s=wjcCore.escapeHtml(s));let i=!1;this.checkedMemberPath&&(s='<label><input tabindex="-1" type="checkbox"'+((i=this._pathChecked.getValue(this._cv.items[e]))?" checked":"")+"> "+s+"</label>");let h=document.createElement("div"),r="wj-listbox-item";if(h.innerHTML=s,wjcCore.hasClass(h.firstChild,"wj-separator")&&(r+=" wj-separator"),i&&(r+=" wj-state-checked"),h.className=r,wjcCore.setAttribute(h,"role",this.itemRole?this.itemRole:null),this.formatItem.hasHandlers){let t=new FormatItemEventArgs(e,this._cv.items[e],h);this.onFormatItem(t)}t.appendChild(h)}e.appendChild(t)}0==e.children.length&&e.appendChild(document.createElement("div")),t&&!this.containsFocus()&&this.focus(),this.showSelection(),this.onLoadedItems()}}_click(e){if(!e.defaultPrevented){let t=this.hostElement.children;for(let s=0;s<t.length;s++)if(wjcCore.contains(t[s],e.target)){this.selectedIndex=s;break}let s=this.selectedIndex;if(this.checkedMemberPath&&s>-1){let i=this._getCheckbox(s);i==e.target&&(t[s].focus(),this.setItemChecked(s,i.checked))}}}_keydown(e){let t=this.selectedIndex;this.hostElement.children;if(!e.defaultPrevented){if(65==e.keyCode&&(e.ctrlKey||e.metaKey)&&this.checkedMemberPath&&wjcCore.hasItems(this.collectionView))return this.checkedItems=this.getItemChecked(0)?[]:this.collectionView.items,void e.preventDefault();if(!(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey))switch(e.keyCode){case wjcCore.Key.Down:e.preventDefault(),this._selectNext();break;case wjcCore.Key.Up:e.preventDefault(),this._selectPrev();break;case wjcCore.Key.Home:e.preventDefault(),this._selectFirst();break;case wjcCore.Key.End:e.preventDefault(),this._selectLast();break;case wjcCore.Key.PageDown:e.preventDefault(),this._selectNextPage();break;case wjcCore.Key.PageUp:e.preventDefault(),this._selectPrevPage();break;case wjcCore.Key.Space:if(this.checkedMemberPath&&t>-1){let s=this._getCheckbox(t);s&&this.isItemEnabled(t)&&(this.setItemChecked(t,!s.checked),e.preventDefault())}}}}_keypress(e){if(!e.defaultPrevented&&!(e.target instanceof HTMLInputElement)&&(e.charCode>32||32==e.charCode&&this._search)){e.preventDefault(),this._search+=String.fromCharCode(e.charCode).toLowerCase(),this._toSearch&&clearTimeout(this._toSearch),this._toSearch=setTimeout(()=>{this._toSearch=null,this._search=""},ListBox._AUTOSEARCH_DELAY);let t=this._findNext();t<0&&this._search.length>1&&(this._search=this._search[this._search.length-1],t=this._findNext()),t>-1&&(this.selectedIndex=t)}}_selectNext(){let e=this.hostElement.children.length;for(let t=this.selectedIndex+1;t<e;t++)if(this.isItemEnabled(t))return this.selectedIndex=t,!0;return!1}_selectPrev(){for(let e=this.selectedIndex-1;e>=0;e--)if(this.isItemEnabled(e))return this.selectedIndex=e,!0;return!1}_selectFirst(){let e=this.hostElement.children.length;for(let t=0;t<e;t++)if(this.isItemEnabled(t))return this.selectedIndex=t,!0;return!1}_selectLast(){for(let e=this.hostElement.children.length-1;e>=0;e--)if(this.isItemEnabled(e))return this.selectedIndex=e,!0;return!1}_selectNextPage(){let e=this.hostElement,t=e.offsetHeight,s=e.children,i=0;for(let e=this.selectedIndex+1;e<this._cv.items.length;e++){let h=s[e].scrollHeight;if(i+h>t&&this.isItemEnabled(e))return this.selectedIndex=e,!0;i+=h}return this._selectLast()}_selectPrevPage(){let e=this.hostElement,t=e.offsetHeight,s=e.children,i=0;for(let e=this.selectedIndex-1;e>0;e--){let h=s[e].scrollHeight;if(i+h>t&&this.isItemEnabled(e))return this.selectedIndex=e,!0;i+=h}return this._selectFirst()}_findNext(){if(this.hostElement){let e=this.hostElement.childElementCount,t=this.selectedIndex;(t<0||1==this._search.length)&&t++;for(let s=0;s<e;s++){let i=(t+s)%e;if(0==this.getDisplayText(i).trim().toLowerCase().indexOf(this._search)&&this.isItemEnabled(i))return i}}return-1}_getCheckbox(e){let t=this.hostElement;return t&&e>-1&&e<t.children.length?t.children[e].querySelector("input[type=checkbox]"):null}_initFromSelect(e){let t=e.children,s=[],i=-1;for(let h=0;h<t.length;h++){let r=t[h];"OPTION"==r.tagName&&(r.hasAttribute("selected")&&(i=s.length),r.innerHTML?s.push({hdr:r.innerHTML,val:r.getAttribute("value"),cmdParam:r.getAttribute("cmd-param")}):s.push({hdr:'<div class="wj-separator"/>'}),e.removeChild(r),h--)}s&&(this.displayMemberPath="hdr",this.selectedValuePath="val",this.itemsSource=s,this.selectedIndex=i)}}ListBox._AUTOSEARCH_DELAY=600,exports.ListBox=ListBox;class FormatItemEventArgs extends wjcCore.EventArgs{constructor(e,t,s){super(),this._index=wjcCore.asNumber(e),this._data=t,this._item=wjcCore.asType(s,HTMLElement)}get index(){return this._index}get data(){return this._data}get item(){return this._item}}exports.FormatItemEventArgs=FormatItemEventArgs;class ComboBox extends DropDown{constructor(e,t){super(e),this._editable=!1,this._delKey=0,this._composing=!1,this._pathHdr=new wjcCore.Binding(null),this._bsCollapse=!0,this.itemsSourceChanged=new wjcCore.Event,this.selectedIndexChanged=new wjcCore.Event;let s=this.hostElement;wjcCore.addClass(s,"wj-combobox");let i=this._tbx,h=wjcCore.getUniqueId(s.id+"_dropdown");this.dropDown.id=h,wjcCore.setAttribute(i,"role","combobox"),wjcCore.setAttribute(i,"aria-autocomplete","both"),wjcCore.setAttribute(i,"aria-owns",h),wjcCore.setAttribute(this._btn,"aria-controls",h),wjcCore.setAttribute(this.dropDown,"aria-expanded",!1),this.autoExpandSelection=!1,this.addEventListener(this._tbx,"compositionstart",()=>{this._composing=!0}),this.addEventListener(this._tbx,"compositionend",()=>{this._composing=!1,setTimeout(()=>{this._setText(this.text,!0)})}),this.addEventListener(s,"wheel",e=>{if(!e.defaultPrevented&&!this.isDroppedDown&&!this.isReadOnly&&this.containsFocus()&&this.selectedIndex>-1){let t=wjcCore.clamp(-e.deltaY,-1,1);this.selectedIndex=wjcCore.clamp(this.selectedIndex-t,0,this.collectionView.items.length-1),e.preventDefault()}}),"SELECT"==this._orgTag&&this._lbx._initFromSelect(s),this._lbx.loadedItems.addHandler(()=>{this.selectedIndex>-1&&(this.selectedIndex=this._lbx.selectedIndex)}),this.isRequired=!0,this.initialize(t)}get itemsSource(){return this._lbx.itemsSource}set itemsSource(e){this._lbx.itemsSource!=e&&(this._lbx.itemsSource=e,this.onItemsSourceChanged()),this._updateBtn()}get collectionView(){return this._lbx.collectionView}get displayMemberPath(){return this._lbx.displayMemberPath}set displayMemberPath(e){this._lbx.displayMemberPath=e;let t=this.getDisplayText();this.text!=t&&this._setText(t,!0)}get headerPath(){return this._pathHdr.path}set headerPath(e){this._pathHdr.path=wjcCore.asString(e);let t=this.getDisplayText();this.text!=t&&this._setText(t,!0)}get selectedValuePath(){return this._lbx.selectedValuePath}set selectedValuePath(e){this._lbx.selectedValuePath=e}get isContentHtml(){return this._lbx.isContentHtml}set isContentHtml(e){if(e!=this.isContentHtml){this._lbx.isContentHtml=wjcCore.asBoolean(e);let t=this.getDisplayText();this.text!=t&&this._setText(t,!0)}}get itemFormatter(){return this._lbx.itemFormatter}set itemFormatter(e){this._lbx.itemFormatter=wjcCore.asFunction(e),this.selectedIndex=this._lbx.selectedIndex}get formatItem(){return this.listBox.formatItem}get selectedIndex(){return this._lbx.selectedIndex}set selectedIndex(e){e!=this.selectedIndex&&(this._lbx.selectedIndex=e),e=this.selectedIndex;let t=this.getDisplayText(e);this.text!=t&&this._setText(t,!0)}get selectedItem(){return this._lbx.selectedItem}set selectedItem(e){this._lbx.selectedItem=e}get selectedValue(){return this._lbx.selectedValue}set selectedValue(e){this._lbx.selectedValue=e}get isEditable(){return this._editable}set isEditable(e){this._editable=wjcCore.asBoolean(e)}get maxDropDownHeight(){return this._lbx.maxHeight}set maxDropDownHeight(e){this._lbx.maxHeight=wjcCore.asNumber(e)}get maxDropDownWidth(){let e=this._dropDown;return parseInt(e.style.maxWidth)}set maxDropDownWidth(e){this._dropDown.style.maxWidth=wjcCore.asNumber(e)+"px"}getDisplayText(e=this.selectedIndex){if(this.headerPath&&e>-1&&wjcCore.hasItems(this.collectionView)){let t=this.collectionView.items[e],s=t?this._pathHdr.getValue(t):null;return s=null!=s?s.toString():"",this.isContentHtml&&(this._cvt||(this._cvt=document.createElement("div")),this._cvt.innerHTML=s,s=this._cvt.textContent),s.trim()}return this._lbx.getDisplayText(e).trim()}indexOf(e,t){let s=this.collectionView;if(wjcCore.hasItems(s)&&null!=e){let i=this.selectedIndex;if(t&&e==this.getDisplayText(i))return i;e=e.toString().toLowerCase();for(let i=0;i<s.items.length;i++)if(this.listBox.isItemEnabled(i)){let s=this.getDisplayText(i).toLowerCase();if(t){if(s==e)return i}else if(e&&0==s.indexOf(e))return i}}return-1}get listBox(){return this._lbx}onItemsSourceChanged(e){this.itemsSourceChanged.raise(this,e)}onSelectedIndexChanged(e){this._updateBtn(),this.selectedIndexChanged.raise(this,e)}refresh(e=!0){super.refresh(e),wjcCore.hasItems(this.collectionView)&&(this._lbx.refresh(),this.selectedIndex>-1&&(this.selectedIndex=this._lbx.selectedIndex))}onLostFocus(e){this._composing&&(this._composing=!1,this._setText(this.text,!0)),this.isEditable&&this.isRequired&&!this.text&&wjcCore.hasItems(this.collectionView)&&(this.selectedIndex=0),super.onLostFocus(e)}onIsDroppedDownChanging(e){return this.isDroppedDown||wjcCore.hasItems(this.collectionView)?super.onIsDroppedDownChanging(e):(e.cancel=!0,!1)}onIsDroppedDownChanged(e){super.onIsDroppedDownChanged(e),this.isDroppedDown&&(this._lbx.showSelection(),this.isTouching||this.selectAll()),wjcCore.setAttribute(this.dropDown,"aria-expanded",this.isDroppedDown)}_updateBtn(){let e=this.collectionView;this._btn.style.display=this._showBtn&&null!=e?"":"none",wjcCore.enable(this._btn,wjcCore.hasItems(e))}_btnclick(e){super._btnclick(e),this.isTouching||this._elRef!=this._tbx||this.selectAll()}_createDropDown(){this._lbx||(this._lbx=new ListBox(this._dropDown)),this._lbx.maxHeight=200,this._lbx.selectedIndexChanged.addHandler(()=>{this._updateBtn();let e=this._lbx.selectedIndex,t=this._lbx.hostElement.children,s=e>-1&&e<t.length?t[e].id:null;wjcCore.setAttribute(this._tbx,"aria-activedescendant",s&&s.length?s:null),this.selectedIndex=e,this.onSelectedIndexChanged()}),this._lbx.itemsChanged.addHandler(()=>{this._updateBtn()}),this.addEventListener(this._dropDown,"click",this._dropDownClick.bind(this))}_dropDownClick(e){e.defaultPrevented||e.target!=this._dropDown&&(this.isDroppedDown=!1)}_setText(e,t){if(this._composing)return;if(this._settingText)return;this._settingText=!0,null==e&&(e=""),e=e.toString();let s=this.selectedIndex,i=this.collectionView,h=this._getSelStart(),r=-1,o=!0;if(this.isEditable&&(!this._delKey&&this.containsFocus()||(t=!0,o=!1)),s=this.indexOf(e,t),o&&(s<0&&t&&(s=this.indexOf(e,!1)),s<0&&h>0&&(s=this.indexOf(e.substr(0,h),!1))),s<0&&!this.isEditable&&wjcCore.hasItems(i)&&(this.isRequired||e)){let t=this._oldText||"";s=Math.max(0,this.indexOf(t,!1));for(let s=0;s<e.length&&s<t.length;s++)if(e[s]!=t[s]){h=s;break}}s>-1&&(r=h,e=this.getDisplayText(s)),e!=this._tbx.value&&(this._tbx.value=e),r>-1&&this.containsFocus()&&!this.isTouching&&this._updateInputSelection(r),i&&i.moveCurrentToPosition(s),this._delKey=0,this._settingText=!1,super._setText(e,t)}_findNext(e,t){if(this.collectionView){e=e.toLowerCase();let s,i,h=this.collectionView.items.length;for(let r=1;r<=h;r++)if(s=(this.selectedIndex+r*t+h)%h,(i=this.getDisplayText(s).toLowerCase())&&0==i.indexOf(e)&&(!this.dropDown.children[s]||this.listBox.isItemEnabled(s)))return s}return this.selectedIndex}_keydown(e){if(super._keydown(e),e.defaultPrevented||this.isReadOnly)return;if(e.altKey)return;if(!wjcCore.hasItems(this.collectionView))return;if(this._elRef!=this._tbx)return;this._delKey=0;let t=this._getSelStart();switch(e.keyCode){case wjcCore.Key.Back:if(this._bsCollapse&&!this.isEditable){let e=this._getSelEnd();t>0&&e==this._tbx.value.length&&wjcCore.hasItems(this.collectionView)&&this._setSelRange(t-1,e)}this._delKey=e.keyCode;break;case wjcCore.Key.Delete:this._delKey=e.keyCode;break;case wjcCore.Key.Up:case wjcCore.Key.Down:t==this.text.length&&(t=0),this.selectedIndex=this._findNext(this.text.substr(0,t),e.keyCode==wjcCore.Key.Up?-1:1),this._setSelRange(t,this.text.length),e.preventDefault()}}_updateInputSelection(e){this._elRef==this._tbx&&this._setSelRange(e,this._tbx.value.length)}_getSelStart(){return this._tbx&&this._tbx.value?this._tbx.selectionStart:0}_getSelEnd(){return this._tbx&&this._tbx.value?this._tbx.selectionEnd:0}_setSelRange(e,t){let s=this._tbx;this._elRef==s&&wjcCore.setSelectionRange(s,e,t)}}exports.ComboBox=ComboBox;class AutoComplete extends ComboBox{constructor(e,t){super(e),this._cssMatch="wj-autocomplete-match",this._minLength=2,this._maxItems=6,this._itemCount=0,this._delay=500,this._query="",this._inCallback=!1,this._srchProps=[],wjcCore.addClass(this.hostElement,"wj-autocomplete"),this._bsCollapse=!1,this.isEditable=!0,this.isRequired=!1,this.isContentHtml=!0,this.listBox.formatItem.addHandler(this._formatListItem,this),this._itemsSourceFnCallBackBnd=this._itemSourceFunctionCallback.bind(this),this.initialize(t)}get minLength(){return this._minLength}set minLength(e){this._minLength=wjcCore.asNumber(e,!1,!0)}get maxItems(){return this._maxItems}set maxItems(e){this._maxItems=wjcCore.asNumber(e,!1,!0)}get delay(){return this._delay}set delay(e){this._delay=wjcCore.asNumber(e,!1,!0)}get searchMemberPath(){return this._srchProp}set searchMemberPath(e){this._srchProp=wjcCore.asString(e),this._srchProps=e?e.trim().split(/\s*,\s*/):[]}get itemsSourceFunction(){return this._itemsSourceFn}set itemsSourceFunction(e){this._itemsSourceFn=wjcCore.asFunction(e),wjcCore.isFunction(this._itemsSourceFn)&&this.itemsSourceFunction(this.text,this.maxItems,this._itemsSourceFnCallBackBnd)}get cssMatch(){return this._cssMatch}set cssMatch(e){this._cssMatch=wjcCore.asString(e)}_keydown(e){if(!e.defaultPrevented&&this.isDroppedDown)switch(e.keyCode){case wjcCore.Key.Up:case wjcCore.Key.Down:this.selectAll()}super._keydown(e)}_setText(e){if(!this._inCallback){if(!e&&this.selectedIndex>-1&&(this.selectedIndex=-1),e!=this._oldText&&(this._tbx.value!=e&&(this._tbx.value=e),this._oldText=e,this.onTextChanged(),!e&&this.collectionView))return this._rxHighlight=null,this.collectionView.filter=this._query=null,void(this.isDroppedDown=!1);this._toSearch&&clearTimeout(this._toSearch),e!=this.getDisplayText()&&(this._toSearch=setTimeout(()=>{this._toSearch=null;let e=this.text.trim().toLowerCase();if(e.length>=this._minLength&&e!=this._query){this._query=e,e=e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");let t=wjcCore.escapeHtml(e);this._rxMatch=new RegExp("(?=.*"+e.replace(/ /g,")(?=.*")+")","ig"),this._rxHighlight=this.isContentHtml?new RegExp("("+t.replace(/ /g,"|")+")(?![^<]*>|[^<>]* </)","ig"):new RegExp("("+t.replace(/ /g,"|")+")","ig"),this.itemsSourceFunction?this.itemsSourceFunction(e,this.maxItems,this._itemsSourceFnCallBackBnd):this._updateItems()}},this._delay))}}_itemSourceFunctionCallback(e){this._inCallback=!0;let t=wjcCore.asCollectionView(e);t&&t.moveCurrentToPosition(-1),this.itemsSource=t,this._inCallback=!1,this.containsFocus()&&(this.isDroppedDown=!0,this.refresh())}onIsDroppedDownChanged(e){if(this.isDroppedDownChanged.raise(this,e),this.containsFocus()&&!this.isDroppedDown&&!this.isTouching&&null==this.selectedItem){let e=this.text.length;wjcCore.setSelectionRange(this._tbx,e)}this._query=""}_updateItems(){let 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;let t=e.items.length;this.isDroppedDown=t>0&&this.containsFocus(),0!=t||this.isEditable||(this.selectedIndex=-1),this.refresh()}}_filter(e){if(this._itemCount>=this._maxItems)return!1;let t=this._getItemText(e,!1);if(this._srchProps)for(let s=0;s<this._srchProps.length;s++)t+="\0"+e[this._srchProps[s]];return this.isContentHtml&&(t=t.replace(/<[^>]*>/g,"")),!!t.match(this._rxMatch)&&(this._itemCount++,!0)}_getItemText(e,t){let s=e?e.toString():"",i=t&&this.headerPath?this._pathHdr:this._lbx._pathDisplay;return i&&(s=null!=(s=i.getValue(e))?s.toString():""),s}_formatListItem(e,t){if(this._cssMatch&&this._rxHighlight){let e='<span class="'+this._cssMatch+'">$1</span>';t.item.innerHTML=t.item.innerHTML.replace(this._rxHighlight,e)}}}exports.AutoComplete=AutoComplete;class Menu extends ComboBox{constructor(e,t){super(e),this.itemClicked=new wjcCore.Event;let s=this.hostElement,i=this._tbx;wjcCore.addClass(s,"wj-menu"),i.style.display="none";this._hdr=this._elRef=wjcCore.createElement('<div wj-part="header" class="wj-form-control" style="cursor:default"/>'),i.parentElement.insertBefore(this._hdr,this._tbx);var h=this._orgOuter.match(/tabindex="?(-?\d+)"?/i);h&&(s.tabIndex=parseInt(h[1])),this.isRequired=!1,wjcCore.setAttribute(s,"role","menubar",!0),wjcCore.setAttribute(i,"role",null),wjcCore.setAttribute(i,"aria-autocomplete",null),wjcCore.setAttribute(i,"aria-owns",null),wjcCore.setAttribute(this.dropDown,"role","menu"),this.listBox.itemRole="menuitem","SELECT"==this._orgTag&&(this.header=s.getAttribute("header"),this._lbx.itemsSource&&(this.commandParameterPath="cmdParam")),this.isContentHtml=!0,this.maxDropDownHeight=500,this.addEventListener(this._hdr,"click",e=>{e.defaultPrevented||(this._isButton?(this.isDroppedDown=!1,this._raiseCommand()):this.isDroppedDown=!this.isDroppedDown)}),this.listBox.lostFocus.addHandler(()=>{this.containsFocus()||(this.isDroppedDown=!1)}),this.initialize(t)}get header(){return this._hdr.innerHTML}set header(e){this._hdr.innerHTML=wjcCore.asString(e)}get command(){return this._command}set command(e){this._command=e}get commandPath(){return this._cmdPath}set commandPath(e){this._cmdPath=wjcCore.asString(e)}get commandParameterPath(){return this._cmdParamPath}set commandParameterPath(e){this._cmdParamPath=wjcCore.asString(e)}get isButton(){return this._isButton}set isButton(e){this._isButton=wjcCore.asBoolean(e)}get owner(){return this._owner}set owner(e){this._owner=wjcCore.asType(e,HTMLElement,!0),this._enableDisableItems()}show(e){if(!this.isDroppedDown){let t=this.dropDown;this.selectedIndex=-1,this.onIsDroppedDownChanging(new wjcCore.CancelEventArgs)&&(this.owner&&(t[wjcCore.Control._OWNR_KEY]=this.owner),wjcCore.showPopup(t,e),this.onIsDroppedDownChanged(),t.focus())}}hide(){this.isDroppedDown&&this.onIsDroppedDownChanging(new wjcCore.CancelEventArgs)&&(wjcCore.hidePopup(this.dropDown),this.onIsDroppedDownChanged())}onItemClicked(e){this.itemClicked.raise(this,e)}refresh(e=!0){super.refresh(e),this._enableDisableItems()}onIsDroppedDownChanged(e){super.onIsDroppedDownChanged(e),this.isDroppedDown?(this._closing=!0,this._defaultItem=this.selectedItem,this.isRequired=!1,this.selectedIndex=-1,this._enableDisableItems(),this._closing=!1,this.dropDown.focus()):this.selectedItem||(this.selectedItem=this._defaultItem)}_keydown(e){e.defaultPrevented||e.keyCode==wjcCore.Key.Enter&&(this.isDroppedDown?this.getDisplayText(this.selectedIndex)&&this._raiseCommand():(this.isDroppedDown=!0,e.preventDefault())),super._keydown(e)}_dropDownClick(e){e.defaultPrevented||e.target==this.dropDown||this.getDisplayText(this.selectedIndex)&&this._raiseCommand(),super._dropDownClick(e)}_raiseCommand(e){let t=this.selectedItem,s=this._getCommand(t);if(s){let e=this._cmdParamPath?t[this._cmdParamPath]:null;if(!this._canExecuteCommand(s,e))return;this._executeCommand(s,e)}this.onItemClicked(e)}_getCommand(e){let t=e&&this.commandPath?e[this.commandPath]:null;return t||this.command}_executeCommand(e,t){e&&!wjcCore.isFunction(e)&&(e=e.executeCommand),wjcCore.isFunction(e)&&e(t)}_canExecuteCommand(e,t){if(e){let s=e.canExecuteCommand;if(wjcCore.isFunction(s))return s(t)}return!0}_enableDisableItems(){if(this.collectionView&&(this.command||this.commandPath)){let e=this.collectionView.items;for(let t=0;t<e.length;t++){let s=this._getCommand(e[t]),i=this.commandParameterPath?e[t][this.commandParameterPath]:null;if(s){let e=this._lbx.hostElement.children[t];wjcCore.toggleClass(e,"wj-state-disabled",!this._canExecuteCommand(s,i))}}}}}exports.Menu=Menu,wjcCore.culture.MultiSelect=window.wijmo.culture.MultiSelect||{itemsSelected:"{count:n0} items selected",selectAll:"Select All"};class MultiSelect extends ComboBox{constructor(e,t){super(e),this._maxHdrItems=2,this._readOnly=!1,this._hdrFmt=wjcCore.culture.MultiSelect.itemsSelected,this.checkedItemsChanged=new wjcCore.Event,wjcCore.addClass(this.hostElement,"wj-multiselect"),this._tbx.readOnly=!0,this.checkedMemberPath=null,this.addEventListener(this.inputElement,"click",()=>{this.isDroppedDown=!this.isDroppedDown}),this.addEventListener(this._selectAll,"click",e=>{wjcCore.hasItems(this.collectionView)&&e.target==this._selectAllCheckbox&&(this.checkedItems=e.target.checked?this.collectionView.items:[])}),this.removeEventListener(this.dropDown,"click"),this._updateHeader(),this.listBox.itemsChanged.addHandler(()=>{this._updateHeader()}),this.listBox.checkedItemsChanged.addHandler(()=>{this._updateHeader(),this.onCheckedItemsChanged()}),this.initialize(t)}get showSelectAllCheckbox(){return""==this._selectAll.style.display}set showSelectAllCheckbox(e){this._selectAll.style.display=wjcCore.asBoolean(e)?"":"none"}get selectAllLabel(){return this._selectAllLabel}set selectAllLabel(e){e!=this._selectAllLabel&&(this._selectAllLabel=wjcCore.asString(e),this.refresh())}get checkedMemberPath(){let e=this.listBox.checkedMemberPath;return e!=MultiSelect._DEF_CHECKED_PATH?e:null}set checkedMemberPath(e){e=wjcCore.asString(e),this.listBox.checkedMemberPath=e||MultiSelect._DEF_CHECKED_PATH}get maxHeaderItems(){return this._maxHdrItems}set maxHeaderItems(e){this._maxHdrItems!=e&&(this._maxHdrItems=wjcCore.asNumber(e),this._updateHeader())}get headerFormat(){return this._hdrFmt}set headerFormat(e){e!=this._hdrFmt&&(this._hdrFmt=wjcCore.asString(e),this._updateHeader())}get headerFormatter(){return this._hdrFormatter}set headerFormatter(e){e!=this._hdrFormatter&&(this._hdrFormatter=wjcCore.asFunction(e),this._updateHeader())}get checkedItems(){return this.listBox.checkedItems}set checkedItems(e){this.listBox.checkedItems=wjcCore.asArray(e)}onCheckedItemsChanged(e){this.checkedItemsChanged.raise(this,e)}_createDropDown(){this._selectAll=wjcCore.createElement('<div class="wj-listbox-item wj-header wj-select-all" tabindex="0" style="display:none"><label><input type="checkbox"> <span></span></label></div>',this._dropDown),this._selectAllCheckbox=this._selectAll.querySelector("input[type=checkbox]"),this._selectAllSpan=this._selectAll.querySelector("label>span"),wjcCore.setText(this._selectAllSpan,wjcCore.culture.MultiSelect.selectAll);let e=wjcCore.createElement('<div style="width:100%;border:none"></div>',this._dropDown);this._lbx=new ListBox(e),super._createDropDown(),wjcCore.addClass(this.dropDown,"wj-control wj-listbox")}get isReadOnly(){return this._readOnly}set isReadOnly(e){this._readOnly=wjcCore.asBoolean(e),wjcCore.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)}refresh(e=!0){super.refresh(e),this._updateHeader(),this._selectAllSpan&&wjcCore.setText(this._selectAllSpan,this._selectAllLabel||wjcCore.culture.MultiSelect.selectAll)}onIsDroppedDownChanged(e){super.onIsDroppedDownChanged(e),this.isDroppedDown&&this.containsFocus()&&setTimeout(()=>{this.listBox.focus()},200)}_setText(e,t){}_keydown(e){super._keydown(e),!e.defaultPrevented&&wjcCore.hasItems(this.collectionView)&&e.keyCode>32&&(this.isDroppedDown=!0)}_updateHeader(){let e=this.checkedItems;if(wjcCore.isFunction(this._hdrFormatter))this.inputElement.value=this._hdrFormatter();else{let t="";if(e.length>0)if(e.length<=this._maxHdrItems){if(this.displayMemberPath){let t=new wjcCore.Binding(this.displayMemberPath);e=e.map(e=>t.getValue(e))}t=e.join(", ")}else t=wjcCore.format(this.headerFormat,{count:e.length});this.inputElement.value=t}let t=null,s=this.collectionView;wjcCore.hasItems(s)&&(0==e.length?t=!1:e.length==s.items.length&&(t=!0)),this._selectAllCheckbox.indeterminate=null==t,null!=t&&(this._selectAllCheckbox.checked=t),this._updateState()}}MultiSelect._DEF_CHECKED_PATH="$checked",exports.MultiSelect=MultiSelect;class MultiAutoComplete extends AutoComplete{constructor(e,t){super(e),this._selItems=[],this._lastInputValue="",this._selPath=new wjcCore.Binding(null),this._notAddItm=!1,this.selectedItemsChanged=new wjcCore.Event,wjcCore.addClass(this.hostElement,"wj-multi-autocomplete"),this.showDropDownButton=!1,this.initialize(t),this._wjTpl=this.hostElement.querySelector(".wj-template"),this._wjInput=this.hostElement.querySelector(".wj-input"),this.addEventListener(this.hostElement,"keyup",this._keyup.bind(this),!0),this.addEventListener(window,"resize",this._adjustInputWidth.bind(this)),this.addEventListener(this._tbx,"focus",()=>{this._itemOff()}),this._addHelperInput(),this._initSeltems(),this.listBox.itemsChanged.addHandler(()=>this.selectedIndex=-1),this._refreshHeader()}set showDropDownButton(e){this._showBtn=!1}get maxSelectedItems(){return this._maxtems}set maxSelectedItems(e){this._maxtems!=e&&(this._maxtems=wjcCore.asNumber(e,!0),this._updateMaxItems(),this._refreshHeader(),this._clearSelIndex())}get selectedMemberPath(){return this._selPath.path}set selectedMemberPath(e){(e=wjcCore.asString(e))!==this.selectedMemberPath&&(this._selPath.path=e,this._initSeltems(),this._refreshHeader(),this.onSelectedItemsChanged())}get selectedItems(){return this._selItems}set selectedItems(e){if(this._selItems=wjcCore.asArray(e),this.selectedMemberPath&&""!==this.selectedMemberPath&&this._selItems)for(let e=0;e<this._selItems.length;e++){let t=this._selItems[e];this._setSelItem(t,!1)}this._updateMaxItems(),this.onSelectedItemsChanged(),this._refreshHeader(),this._clearSelIndex()}onSelectedItemsChanged(e){this.selectedItemsChanged.raise(this,e)}onIsDroppedDownChanged(e){!this.isDroppedDown&&this.selectedIndex>-1&&!this._notAddItm&&this._addItem(!0),this._notAddItm=!1,super.onIsDroppedDownChanged(e)}refresh(e=!0){super.refresh(e),this._initSeltems(),this.isDroppedDown||this._refreshHeader()}_keydown(e){if(!this.isReadOnly){if(!e.defaultPrevented)switch(e.keyCode){case wjcCore.Key.Back:this._lastInputValue=this._tbx.value;break;case wjcCore.Key.Enter:this._itemOff(),this._addItem(!0),wjcCore.isIE&&wjcCore.setSelectionRange(this._tbx,0,0);break;case wjcCore.Key.Tab:this.isDroppedDown?(this._addItem(!1),this._tbx.value="",this._lbx.selectedIndex=-1,e.preventDefault()):this._updateFocus();break;case wjcCore.Key.Space:if(""!==this._tbx.value)return;this.isDroppedDown||this._tbx.disabled||(this.isDroppedDown=!0,this._clearSelIndex());break;case wjcCore.Key.Escape:this.isDroppedDown&&(this._notAddItm=!0);break;case wjcCore.Key.Left:this._itemOn(!this.rightToLeft);break;case wjcCore.Key.Right:this._itemOn(!!this.rightToLeft);break;case wjcCore.Key.Up:case wjcCore.Key.Down:let t=wjcCore.getActiveElement();if(e.altKey){if(this._tbx==t)return this.isDroppedDown=!this.isDroppedDown,this.isDroppedDown||this._tbx.focus(),void e.preventDefault()}else if(this._tbx!==t)return;default:if(e.keyCode===wjcCore.Key.Back||e.keyCode===wjcCore.Key.Delete)return;this._itemOff(),null!=this._maxtems&&this._selItems.length>=this._maxtems&&e.preventDefault()}this._tbx.disabled||super._keydown(e)}}_updateState(){super._updateState(),this._wjTpl&&(wjcCore.hasClass(this.hostElement,"wj-state-focused")||this._itemOff())}_keyup(e){if(!this.isReadOnly&&!e.defaultPrevented)switch(e.keyCode){case wjcCore.Key.Back:0===this._tbx.value.length&&0===this._lastInputValue.length&&this._delItem(!1);break;case wjcCore.Key.Delete:this._delItem(!0)}}_addHelperInput(){let 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}_refreshHeader(){let e=this.hostElement.querySelectorAll(".wj-token");for(let t=0;t<e.length;t++)this._wjTpl.removeChild(e[t]);let t=this.selectedItems;if(t&&0!==t.length){for(let e=0;e<t.length;e++)this._insertToken(t[e]);this._wjInput.style.cssFloat=this.rightToLeft?"right":"left",this._adjustInputWidth()}}_insertToken(e){let t=this._getItemText(e,!0);this.isContentHtml?(this._cvt||(this._cvt=document.createElement("div")),this._cvt.innerHTML=t,t=this._cvt.textContent.trim()):t=wjcCore.escapeHtml(t),this._wjTpl.insertBefore(this._createItem(t),this._wjInput)}_updateMaxItems(){null!=this._maxtems&&this._selItems&&this._selItems.length>this._maxtems&&(this._selItems=this._selItems.slice(0,this._maxtems))}_updateFocus(){let e=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);e?(wjcCore.removeClass(e,MultiAutoComplete._clsActive),setTimeout(()=>{this._tbx.focus()})):(this._clearSelIndex(),wjcCore.removeClass(this.hostElement,"wj-state-focused"))}_addItem(e){this.selectedItems.indexOf(this.selectedItem)>-1?this._clearSelIndex():this.selectedIndex>-1&&(this._updateSelItems(this.selectedItem,!0),this._refreshHeader(),e&&this._clearSelIndex(),this._disableInput(!0))}_delItem(e){let t,s,i=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive),h=!1;e&&!i||(i?(s=this._getItemIndex(i))>-1&&(t=this._selItems[s],h=!0):this._selItems.length>0&&(t=this._selItems[this._selItems.length-1],h=!0),h&&(this._updateSelItems(t,!1),this._refreshHeader(),this._clearSelIndex(),this._disableInput(!1)),this._tbx.focus())}_updateSelItems(e,t){if(t){if(this._selItems&&0!==this._selItems.length||(this._selItems=[]),null!=this._maxtems&&this._selItems.length>=this._maxtems)return;this._selItems.push(e)}else{let t=this._selItems.indexOf(e);this._selItems.splice(t,1)}this._hasSelectedMemeberPath()&&this._setSelItem(e,t),this.onSelectedItemsChanged()}_createItem(e){let t=document.createElement("div"),s=document.createElement("span"),i=document.createElement("a");return t.appendChild(s),t.appendChild(i),t.className="wj-token",s.className="wj-token-label",s.innerHTML=e,i.className="wj-token-close",i.href="#",i.tabIndex=-1,i.text="×",t.style.cssFloat=this.rightToLeft?"right":"left",this.addEventListener(t,"click",e=>{this._helperInput.focus();let s=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);s&&wjcCore.removeClass(s,MultiAutoComplete._clsActive),wjcCore.addClass(t,MultiAutoComplete._clsActive),e.stopPropagation(),e.preventDefault()}),this.addEventListener(i,"click",e=>{if(this.isReadOnly)return;let s=this._getItemIndex(t);if(s>-1){let e=this._selItems[s];this._updateSelItems(e,!1)}this._wjTpl.removeChild(t),this._adjustInputWidth(),this._disableInput(!1),this._tbx.focus(),e.stopPropagation(),e.preventDefault()}),t}_itemOn(e){let t,s,i,h=wjcCore.getActiveElement();if((this._tbx!=h||0===this._tbx.value.length)&&0!==(t=this._wjTpl.querySelectorAll(".wj-token")).length)if(s=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive),i=this._getItemIndex(s),e){if(0===i)return;-1===i?(wjcCore.addClass(t[t.length-1],MultiAutoComplete._clsActive),this._helperInput.focus()):(wjcCore.removeClass(s,MultiAutoComplete._clsActive),wjcCore.addClass(t[i-1],MultiAutoComplete._clsActive),this._helperInput.focus())}else if(!e){if(-1===i)return;i!==t.length-1?(wjcCore.removeClass(s,MultiAutoComplete._clsActive),wjcCore.addClass(t[i+1],MultiAutoComplete._clsActive),this._helperInput.focus()):(wjcCore.removeClass(s,MultiAutoComplete._clsActive),this._tbx.focus())}}_itemOff(){let e=this._wjTpl.querySelector("."+MultiAutoComplete._clsActive);e&&wjcCore.removeClass(e,MultiAutoComplete._clsActive)}_initSeltems(){if(this.selectedMemberPath&&""!==this.selectedMemberPath){let e=this.itemsSource;if(this._selItems.splice(0,this._selItems.length),e)for(let t=0;t<e.sourceCollection.length;t++)this._getSelItem(t)&&this._selItems.push(e.sourceCollection[t])}}_getSelItem(e){let t=this.itemsSource.sourceCollection[e];return!(!wjcCore.isObject(t)||!this.selectedMemberPath)&&this._selPath.getValue(t)}_setSelItem(e,t){this.itemsSource;wjcCore.isObject(e)&&this._selPath.getValue(e)!=t&&this._selPath.setValue(e,t)}_clearSelIndex(){this.selectedIndex=-1}_hasSelectedMemeberPath(){return this.selectedMemberPath&&""!==this.selectedMemberPath}_disableInput(e){null!=this._maxtems&&(this._selItems.length<this._maxtems?(this._tbx.disabled=!1,this._tbx.focus()):(this._tbx.disabled=!0,this.hostElement.focus()))}_adjustInputWidth(){this._tbx.style.width="60px";let e,t=wjcCore.getElementRect(this.hostElement),s=wjcCore.getElementRect(this._tbx),i=getComputedStyle(this._tbx),h=parseInt(i.paddingLeft,10),r=parseInt(i.paddingRight,10);e=this.rightToLeft?s.left+s.width-t.left-h-r-8:t.left+t.width-s.left-h-r-8,this._tbx.style.width=e+"px"}_getItemIndex(e){let t=this.hostElement.querySelectorAll(".wj-token");for(let s=0;s<t.length;s++)if(e===t[s])return s;return-1}}MultiAutoComplete._clsActive="wj-token-active",exports.MultiAutoComplete=MultiAutoComplete;var PopupTrigger;!function(e){e[e.None=0]="None",e[e.Click=1]="Click",e[e.Blur=2]="Blur",e[e.ClickOrBlur=3]="ClickOrBlur"}(PopupTrigger=exports.PopupTrigger||(exports.PopupTrigger={}));class Popup extends wjcCore.Control{constructor(e,t){super(e,null,!0),this._showTrigger=PopupTrigger.Click,this._hideTrigger=PopupTrigger.Blur,this._fadeIn=!0,this._fadeOut=!0,this._removeOnHide=!0,this._visible=!1,this._ownerClickBnd=this._ownerClick.bind(this),this._ownerMousedownBnd=this._ownerMouseDown.bind(this),this.showing=new wjcCore.Event,this.shown=new wjcCore.Event,this.hiding=new wjcCore.Event,this.hidden=new wjcCore.Event;let s=this.hostElement;wjcCore.addClass(s,"wj-control wj-content wj-popup"),s.getAttribute("tabindex")||(s.tabIndex=0),wjcCore.hidePopup(s,!1),this.addEventListener(s,"compositionstart",e=>{this._composing=!0}),this.addEventListener(s,"compositionend",e=>{this._composing=!1}),this.addEventListener(s,"keydown",e=>{if(!e.defaultPrevented){if(e.keyCode!=wjcCore.Key.Escape||this._composing||(e.preventDefault(),this.hide()),e.keyCode==wjcCore.Key.Enter){let t=this.dialogResultEnter;t&&(e.preventDefault(),this._validateAndHide(t))}e.keyCode==wjcCore.Key.Tab&&this.modal&&(e.preventDefault(),wjcCore.moveFocus(s,e.shiftKey?-1:1))}}),this.addEventListener(s,"click",e=>{if(e.target instanceof HTMLElement){let t=e.target.className.match(/\bwj-hide[\S]*\b/);t&&t.length>0&&(e.preventDefault(),e.stopPropagation(),this.hide(t[0]))}}),this.addEventListener(document,"wheel",e=>{if(this.isVisible&&this._modal){for(let t=e.target;t&&t!=document.body;t=t.parentElement)if(t.scrollHeight>t.clientHeight)return;e.preventDefault(),e.stopPropagation()}}),this.initialize(t)}get owner(){return this._owner}set owner(e){let t=this._owner;t&&(this.removeEventListener(t,"mousedown"),this.removeEventListener(t,"click")),(t=this._owner=null!=e?wjcCore.getElement(e):null)&&(this.addEventListener(t,"mousedown",this._ownerMousedownBnd,!0),this.addEventListener(t,"click",this._ownerClickBnd,!0))}get content(){return this.hostElement.firstElementChild}set content(e){e!=this.content&&(this.hostElement.innerHTML="",e instanceof HTMLElement&&this.hostElement.appendChild(e))}get showTrigger(){return this._showTrigger}set showTrigger(e){this._showTrigger=wjcCore.asEnum(e,PopupTrigger)}get hideTrigger(){return this._hideTrigger}set hideTrigger(e){this._hideTrigger=wjcCore.asEnum(e,PopupTrigger)}get fadeIn(){return this._fadeIn}set fadeIn(e){this._fadeIn=wjcCore.asBoolean(e)}get fadeOut(){return this._fadeOut}set fadeOut(e){this._fadeOut=wjcCore.asBoolean(e)}get removeOnHide(){return this._removeOnHide}set removeOnHide(e){this._removeOnHide=wjcCore.asBoolean(e)}get modal(){return this._modal}set modal(e){this._modal=wjcCore.asBoolean(e)}get isDraggable(){return this._draggable}set isDraggable(e){this._draggable=wjcCore.asBoolean(e)}get dialogResult(){return this._result}set dialogResult(e){this._result=e}get dialogResultEnter(){return this._resultEnter}set dialogResultEnter(e){this._resultEnter=e}get isVisible(){let e=this.hostElement;return this._visible&&null!=e&&e.offsetHeight>0}show(e,t){if(!this.isVisible){let s=this.hostElement;this.dialogResult=null,this._callback=null,this._hideAnim&&(clearInterval(this._hideAnim),this._hideAnim=null);let i=new wjcCore.CancelEventArgs;this.onShowing(i)&&(null!=e&&(this.modal=wjcCore.asBoolean(e)),null!=t&&(this._callback=wjcCore.asFunction(t)),wjcCore.showPopup(s,this._owner,!1,this._fadeIn,!1),this._modal&&this._showBackdrop(),this._composing=!1,this._visible=!0,this.onShown(i),this.modal&&this.addEventListener(window,"focus",()=>{this.containsFocus()||wjcCore.moveFocus(s,0)}),this._makeDraggable(this._draggable),setTimeout(()=>{if(!this.isTouching){let e=s.querySelector("input[autofocus]");e&&e.clientHeight>0&&!e.disabled&&e.tabIndex>-1&&!wjcCore.closest(e,"[disabled],.wj-state-disabled")?(e.focus(),e.select()):wjcCore.moveFocus(s,0)}this.containsFocus()||(s.tabIndex=0,s.focus())},200))}}hide(e){if(this._makeDraggable(!1),this.isVisible){wjcCore.isUndefined(e)||(this.dialogResult=e);let t=new wjcCore.CancelEventArgs;if(this.onHiding(t)){let e=this.hostElement.querySelectorAll(".wj-control.wj-dropdown");for(let t=0;t<e.length;t++){let s=wjcCore.Control.getControl(e[t]);s instanceof DropDown&&(s.isDroppedDown=!1)}this._bkdrop&&wjcCore.hidePopup(this._bkdrop,this.removeOnHide,this.fadeOut),this._hideAnim=wjcCore.hidePopup(this.hostElement,this.removeOnHide,this.fadeOut),this._visible=!1,this.removeEventListener(window,"focus"),this.containsFocus()&&wjcCore.getActiveElement().blur(),setTimeout(()=>{this._updateState(),this.onHidden(t),this._callback&&this._callback(this)})}}}onShowing(e){return this.showing.raise(this,e),!e.cancel}onShown(e){this.shown.raise(this,e)}onHiding(e){return this.hiding.raise(this,e),!e.cancel}onHidden(e){this.hidden.raise(this,e)}dispose(){this.owner=null,super.dispose()}onLostFocus(e){this.isVisible&&this._hideTrigger&PopupTrigger.Blur&&(this.containsFocus()||this.hide()),super.onLostFocus(e)}refresh(e=!0){if(super.refresh(e),this.isVisible&&!this._refreshing){this._refreshing=!0;let e=wjcCore.getActiveElement(),t=this._owner?this._owner.getBoundingClientRect():null;wjcCore.showPopup(this.hostElement,t),this._modal&&e instanceof HTMLElement&&e!=wjcCore.getActiveElement()&&e.focus(),this._refreshing=!1}}_makeDraggable(e){let t,s,i=this.hostElement,h=i?i.querySelector(".wj-dialog-header"):null,r=document,o="mouseup",n="touchend",a=e=>{i&&wjcCore.contains(h,e.target)&&(t=new wjcCore.Point(i.offsetLeft,i.offsetTop),s=wjcCore.mouseToPage(e),["mousemove",o,"touchmove",n].forEach(e=>{this.removeEventListener(r,e)}),["mousemove","touchmove"].forEach(e=>{this.addEventListener(r,e,l)}),[o,n].forEach(e=>{this.addEventListener(r,e,c)}))},l=e=>{let h=wjcCore.mouseToPage(e);wjcCore.setCss(i,{left:Math.max(t.x+(h.x-s.x),50-i.offsetWidth),top:Math.max(t.y+(h.y-s.y),0)}),this._dragged=!0},c=e=>{["mousemove",o,"touchmove",n].forEach(e=>{this.removeEventListener(r,e)})};["mousedown","touchstart"].forEach(e=>{this.removeEventListener(r,e)}),this._dragged=!1,h&&(wjcCore.setCss(h,{touchAction:e?"none":""}),e&&["mousedown","touchstart"].forEach(e=>{this.addEventListener(r,e,a)}))}_handleResize(){this.isVisible&&!this._dragged&&this.refresh()}_ownerClick(e){this.isVisible?this._hideTrigger&PopupTrigger.Click&&this.hide():this._showTrigger&PopupTrigger.Click&&(this._wasVisible||this.show())}_ownerMouseDown(e){this._wasVisible=this.isVisible}_showBackdrop(){this._bkdrop||(this._bkdrop=document.createElement("div"),this._bkdrop.tabIndex=-1,wjcCore.addClass(this._bkdrop,"wj-popup-backdrop"),this.addEventListener(this._bkdrop,"mousedown",e=>{e.preventDefault(),e.stopPropagation(),this.hostElement.focus(),this.hideTrigger&PopupTrigger.Blur&&this.hide()})),this._bkdrop.style.display="";let e=this.hostElement;e.parentElement.insertBefore(this._bkdrop,e)}_validateAndHide(e){let t=this.hostElement.querySelector(":invalid");t?t.focus():this.hide(e)}}exports.Popup=Popup;class InputDate extends DropDown{constructor(e,t){if(super(e),this._format="d",this.valueChanged=new wjcCore.Event,wjcCore.addClass(this.hostElement,"wj-inputdate"),this._msk=new wjcCore._MaskProvider(this._tbx),wjcCore.isIE9()||(this.inputType="tel"),this._tbx.type.match(/date/i)&&(this.inputType=""),this.addEventListener(this.hostElement,"wheel",e=>{if(!e.defaultPrevented&&!this.isDroppedDown&&this.containsFocus()&&null!=this.value&&this._canChangeValue()){let t=wjcCore.clamp(-e.deltaY,-1,1);this.value=this.selectionMode==DateSelectionMode.Month?wjcCore.DateTime.addMonths(this.value,t):wjcCore.DateTime.addDays(this.value,t),this.selectAll(),e.preventDefault()}}),this.value=wjcCore.DateTime.newDate(),"INPUT"==this._orgTag){let e=this._tbx.getAttribute("value");e&&(this.value=wjcCore.Globalize.parseDate(e,"yyyy-MM-dd"))}this.isRequired=!0,this.initialize(t)}get value(){return this._value}set value(e){if(wjcCore.DateTime.equals(this._value,e))this._tbx.value=wjcCore.Globalize.format(e,this.format);else{let t=!this.isRequired||null==e&&null==this.value;e=wjcCore.asDate(e,t),e=this._clamp(e),this._isValidDate(e)?(this._tbx.value=e?wjcCore.Globalize.format(e,this.format):"",e==this._value||wjcCore.DateTime.equals(this._value,e)||(this._value=e,this.onValueChanged())):this._tbx.value=e?wjcCore.Globalize.format(this.value,this.format):"",this.text!=this._oldText&&(this._oldText=this.text,this.onTextChanged())}}get text(){return this._tbx.value}set text(e){e!=this.text&&(this._setText(e,!0),this._commitText())}get selectionMode(){return this.calendar.selectionMode}set selectionMode(e){this.calendar.selectionMode=e}get min(){return this._calendar.min}set min(e){this._calendar.min=wjcCore.asDate(e,!0)}get max(){return this._calendar.max}set max(e){this._calendar.max=wjcCore.asDate(e,!0)}get format(){return this._format}set format(e){e!=this.format&&(this._format=wjcCore.asString(e),this._tbx.value=wjcCore.Globalize.format(this.value,this.format))}get mask(){return this._msk.mask}set mask(e){this._msk.mask=wjcCore.asString(e)}get calendar(){return this._calendar}get inputElement(){return this._tbx}get inputType(){return this._tbx.type}set inputType(e){this._tbx.type=wjcCore.asString(e)}get itemValidator(){return this._calendar.itemValidator}set itemValidator(e){e!=this.itemValidator&&(this._calendar.itemValidator=wjcCore.asFunction(e),this.invalidate())}get itemFormatter(){return this.calendar.itemFormatter}set itemFormatter(e){e!=this.itemFormatter&&(this.calendar.itemFormatter=wjcCore.asFunction(e))}onValueChanged(e){this.valueChanged.raise(this,e)}refresh(e=!0){super.refresh(e),this.isDroppedDown=!1,this._msk&&this._msk.refresh(),this._calendar&&this._calendar.refresh(),this._tbx.value=wjcCore.Globalize.format(this.value,this.format)}onIsDroppedDownChanged(e){super.onIsDroppedDownChanged(e),this.isDroppedDown&&(this._calChanged=!1,this.dropDown.focus())}_createDropDown(){this._calendar=new Calendar(this._dropDown),this._calendar.valueChanged.addHandler(()=>{this.value=wjcCore.DateTime.fromDateTime(this._calendar.value,this.value),this._calChanged=!0}),this.addEventListener(this._dropDown,"click",e=>{this._calChanged&&!wjcCore.closest(e.target,".wj-calendar-header")?this.isDroppedDown=!1:"btn-today"==e.target.getAttribute("wj-part")&&(this.isDroppedDown=!1)})}_updateDropDown(){this._commitText();let e=this._calendar;e.value=this.value,e.min=this.min,e.max=this.max,this.selectionMode!=DateSelectionMode.Month&&(e.monthView=!0);let t=getComputedStyle(this.hostElement);this._dropDown.style.minWidth=18*parseFloat(t.fontSize)+"px",this._calendar.refresh(),super._updateDropDown()}_keydown(e){if(!(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey))switch(e.keyCode){case wjcCore.Key.Enter:this._commitText(),this.selectAll();break;case wjcCore.Key.Escape:this.text=wjcCore.Globalize.format(this.value,this.format),this.selectAll();break;case wjcCore.Key.Up:case wjcCore.Key.Down:if(!this.isDroppedDown&&this.value&&this._canChangeValue()){let t=e.keyCode==wjcCore.Key.Up?1:-1,s=this.selectionMode==DateSelectionMode.Month?wjcCore.DateTime.addMonths(this.value,t):wjcCore.DateTime.addDays(this.value,t);this.value=wjcCore.DateTime.fromDateTime(s,this.value),this.selectAll(),e.preventDefault()}}super._keydown(e)}_canChangeValue(){return!this.isReadOnly&&this.selectionMode!=DateSelectionMode.None}_clamp(e){return this.calendar._clamp(e)}_commitText(){let e=this._tbx.value;if(e||this.isRequired){let t=wjcCore.Globalize.parseDate(e,this.format,this.value);t?this.value=wjcCore.DateTime.fromDateTime(t,this.value):this._tbx.value=wjcCore.Globalize.format(this.value,this.format)}else this.value=null}_isValidDate(e){if(e){if(this._clamp(e)!=e)return!1;if(this.itemValidator&&!this.itemValidator(e))return!1}return!0}}exports.InputDate=InputDate;class InputTime extends ComboBox{constructor(e,t){if(super(e),this._format="t",this.valueChanged=new wjcCore.Event,wjcCore.addClass(this.hostElement,"wj-inputtime"),this._value=wjcCore.DateTime.newDate(),this._msk=new wjcCore._MaskProvider(this._tbx),wjcCore.isIE9()||(this._tbx.type="tel"),"INPUT"==this._orgTag){let e=this._tbx.getAttribute("value");e&&(this.value=wjcCore.Globalize.parseDate(e,"HH:mm:ss"))}this.step=15,this.autoExpandSelection=!0,this.initialize(t)}get inputElement(){return this._tbx}get inputType(){return this._tbx.type}set inputType(e){this._tbx.type=wjcCore.asString(e)}get value(){return this._value}set value(e){(e=wjcCore.asDate(e,!this.isRequired))&&(null!=this._min&&this._getTime(e)<this._getTime(this._min)&&(e=wjcCore.DateTime.fromDateTime(e,this._min)),null!=this._max&&this._getTime(e)>this._getTime(this._max)&&(e=wjcCore.DateTime.fromDateTime(e,this._max))),this._setText(e?wjcCore.Globalize.format(e,this.format):"",!0),this.selectedItem&&this.selectedItem.value&&(e=wjcCore.DateTime.fromDateTime(e,this.selectedItem.value)),e==this._value||wjcCore.DateTime.equals(e,this._value)||(this._value=e,this.onValueChanged())}get text(){return this._tbx.value}set text(e){e!=this.text&&(this._setText(e,!0),this._commitText())}get min(){return this._min}set min(e){this._min=wjcCore.asDate(e,!0),this.isDroppedDown=!1,this._updateItems()}get max(){return this._max}set max(e){this._max=wjcCore.asDate(e,!0),this.isDroppedDown=!1,this._updateItems()}get step(){return this._step}set step(e){this._step=wjcCore.asNumber(e,!0),this.isDroppedDown=!1,this._updateItems()}get format(){return this._format}set format(e){e!=this.format&&(this._format=wjcCore.asString(e),this._tbx.value=wjcCore.Globalize.format(this.value,this.format),wjcCore.hasItems(this.collectionView)&&this._updateItems())}get mask(){return this._msk.mask}set mask(e){this._msk.mask=wjcCore.asString(e)}onValueChanged(e){this.valueChanged.raise(this,e)}onItemsSourceChanged(e){super.onItemsSourceChanged(e),this._hasCustomItems=null!=this.itemsSource}_updateInputSelection(e){if(this._delKey)super._updateInputSelection(e);else{let t=this._tbx.value;for(;e<t.length&&!t[e].match(/[a-z0-9]/i);)e++;wjcCore.setSelectionRange(this._tbx,e,this._tbx.value.length)}}refresh(e=!0){super.refresh(e),this.isDroppedDown=!1,this._msk.refresh(),this._tbx.value=wjcCore.Globalize.format(this.value,this.format),this._updateItems()}onSelectedIndexChanged(e){if(this.selectedIndex>-1&&!this._settingText){let e=this.value?this.value:wjcCore.DateTime.newDate(),t=null!=this.selectedItem.value?this.selectedItem.value:wjcCore.Globalize.parseDate(this.text,this.format,this.value);this.value=wjcCore.DateTime.fromDateTime(e,t)}super.onSelectedIndexChanged(e)}_updateItems(){if(this._hasCustomItems)return;let e=[],t=wjcCore.DateTime.newDate(0,0,0,0,0),s=wjcCore.DateTime.newDate(0,0,0,23,59,59);if(this.min&&t.setHours(this.min.getHours(),this.min.getMinutes(),this.min.getSeconds()),this.max&&s.setHours(this.max.getHours(),this.max.getMinutes(),this.max.getSeconds()),wjcCore.isNumber(this.step)&&this.step>0)for(let i=t;i<=s;i=wjcCore.DateTime.addMinutes(i,this.step))e.push({value:i,text:wjcCore.Globalize.format(i,this.format)});let i=this.value;this._settingText=!0,this.displayMemberPath="text",this.selectedValuePath="text",this.itemsSource=e,this._hasCustomItems=!1,this._settingText=!1,this.value=i}_getTime(e){return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds()}_keydown(e){if(super._keydown(e),!e.defaultPrevented)switch(e.keyCode){case wjcCore.Key.Enter:this.isDroppedDown||(this._commitText(),this.selectAll());break;case wjcCore.Key.Escape:this.text=wjcCore.Globalize.format(this.value,this.format),this.selectAll()}}_commitText(){if(this.text||this.isRequired){let e=this.value?wjcCore.Globalize.format(this.value,this.format):null;if(this.text!=e){let t=this.selectedItem&&this.selectedItem.value?this.selectedItem.value:wjcCore.Globalize.parseDate(this.text,this.format,this.value);t?this.value=wjcCore.DateTime.fromDateTime(this.value,t):this.text=e}}else this.value=null}}exports.InputTime=InputTime;class InputDateTime extends InputDate{constructor(e,t){super(e),wjcCore.addClass(this.hostElement,"wj-inputdatetime"),this._btnTm=this.hostElement.querySelector('[wj-part="btn-tm"]'),this._format="g",this._inputTime=new InputTime(document.createElement("div"),{isDroppedDownChanging:(e,t)=>{this._hadFocus=this.containsFocus()},isDroppedDownChanged:(e,t)=>{!e.isDroppedDown&&this._hadFocus&&this._tbx.focus()},valueChanged:(e,t)=>{this.value=wjcCore.DateTime.fromDateTime(this.value,e.value)}});let s=this._inputTime.dropDown,i=this._keydown.bind(this);this.addEventListener(s,"keydown",i,!0),this.addEventListener(s,"blur",()=>{this._updateFocusState()},!0),this.addEventListener(this._btn,"mousedown",e=>{this._setDropdown(this.calendar.hostElement)}),this.addEventListener(this._btnTm,"mousedown",e=>{this._inputTime.dropDownCssClass=this.dropDownCssClass,this._setDropdown(s),setTimeout(()=>{this._btnclick(e)})}),this.initialize(t)}get timeMin(){return this._inputTime.min}set timeMin(e){this._inputTime.min=e}get timeMax(){return this._inputTime.max}set timeMax(e){this._inputTime.max=e}get timeFormat(){return this._inputTime.format}set timeFormat(e){this._inputTime.format=e}get timeStep(){return this._inputTime.step}set timeStep(e){this._inputTime.step=e}get inputTime(){return this._inputTime}dispose(){this._setDropdown(this.calendar.hostElement),super.dispose(),this._inputTime.dispose()}refresh(e=!0){this._setDropdown(this.calendar.hostElement),this._inputTime.refresh(),super.refresh(e)}_updateBtn(){super._updateBtn(),this._btnTm&&(this._btnTm.tabIndex=this._btn.tabIndex,this._btnTm.parentElement.style.display=this._btn.style.display)}_clamp(e){return e&&(this.min&&e<this.min&&(e=this.min),this.max&&e>this.max&&(e=this.max)),e}_commitText(){let e=this._tbx.value;if(e||this.isRequired){let t=wjcCore.Globalize.parseDate(e,this.format,this.value);t?this.value=t:this._tbx.value=wjcCore.Globalize.format(this.value,this.format)}else this.value=null}_setDropdown(e){this._dropDown!=e&&(this.isDroppedDown&&(this.isDroppedDown=!1),this._dropDown=e)}_updateDropDown(){let e=this._inputTime;this._dropDown==e.dropDown?(this._commitText(),super._updateDropDown(),e.isRequired=this.isRequired,e.value=this.value,this.isDroppedDown&&e.listBox.showSelection()):super._updateDropDown()}}InputDateTime.controlTemplate='<div style="position:relative" 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" tabindex="-1"><button wj-part="btn" class="wj-btn wj-btn-default" type="button" tabindex="-1"><span class="wj-glyph-calendar"></span></button><button wj-part="btn-tm" class="wj-btn wj-btn-default" type="button" tabindex="-1"><span class="wj-glyph-clock"></span></button></span></div></div><div wj-part="dropdown" class="wj-content wj-dropdown-panel" style="display:none"></div></div>',exports.InputDateTime=InputDateTime;class InputNumber extends wjcCore.Control{constructor(e,t){super(e),this._showBtn=!0,this._readOnly=!1,this.textChanged=new wjcCore.Event,this.valueChanged=new wjcCore.Event;let s=this.hostElement;wjcCore.setAttribute(s,"role","spinbutton",!0);let i=this.getTemplate();this.applyTemplate("wj-control wj-content wj-inputnumber",i,{_tbx:"input",_btnUp:"btn-inc",_btnDn:"btn-dec"},"input"),this._tbx.type.match(/number/i)&&(this.inputType="");let h=this._tbx;h.autocomplete="off",h.spellcheck=!1,this._updateSymbols(),this.addEventListener(this._tbx,"compositionstart",()=>{this._composing=!0}),this.addEventListener(this._tbx,"compositionend",()=>{this._composing=!1,setTimeout(()=>{let e=this.text;this._oldText.indexOf(this._chrPct)>-1&&e.indexOf(this._chrPct)<0&&(e+=this._chrPct),this._setText(e)})}),this.addEventListener(h,"keypress",this._keypress.bind(this)),this.addEventListener(h,"keydown",this._keydown.bind(this)),this.addEventListener(h,"input",this._input.bind(this));let r=this._clickSpinner.bind(this);this.addEventListener(this._btnUp,"click",r),this.addEventListener(this._btnDn,"click",r),this._rptUp=new wjcCore._ClickRepeater(this._btnUp.querySelector("button")),this._rptDn=new wjcCore._ClickRepeater(this._btnDn.querySelector("button")),this.addEventListener(s,"wheel",e=>{if(!e.defaultPrevented&&!this.isReadOnly&&this.containsFocus()){let t=wjcCore.clamp(-e.deltaY,-1,1);this._increment((this.step||1)*t),setTimeout(()=>this.selectAll()),e.preventDefault()}}),this.value=0,this.isRequired=!0,this.initialize(t)}get inputElement(){return this._tbx}get inputType(){return this._tbx.type}set inputType(e){this._tbx.type=wjcCore.asString(e)}get value(){return this._value}set value(e){if(e!=this._value)if(null==(e=wjcCore.asNumber(e,!this.isRequired||null==e&&null==this._value)))this._setText("");else if(!isNaN(e)){let t=wjcCore.Globalize.format(e,this.format);this._setText(t)}}get isRequired(){return this._tbx.required}set isRequired(e){this._tbx.required=wjcCore.asBoolean(e)}get isReadOnly(){return this._readOnly}set isReadOnly(e){this._readOnly=wjcCore.asBoolean(e),this.inputElement.readOnly=this._readOnly,wjcCore.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)}get min(){return this._min}set min(e){this._min=wjcCore.asNumber(e,!0)}get max(){return this._max}set max(e){this._max=wjcCore.asNumber(e,!0)}get step(){return this._step}set step(e){this._step=wjcCore.asNumber(e,!0),this._updateBtn()}get format(){return this._format}set format(e){e!=this.format&&(this._format=wjcCore.asString(e),this.refresh())}get text(){return this._tbx.value}set text(e){e!=this.text&&(this._oldText=null,this._setText(e))}get placeholder(){return this._tbx.placeholder}set placeholder(e){this._tbx.placeholder=e}get showSpinner(){return this._showBtn}set showSpinner(e){this._showBtn=wjcCore.asBoolean(e),this._updateBtn()}get repeatButtons(){return!this._rptUp.disabled}set repeatButtons(e){this._rptUp.disabled=this._rptDn.disabled=!wjcCore.asBoolean(e)}selectAll(){let e=this._tbx;wjcCore.setSelectionRange(e,0,e.value.length)}onTextChanged(e){this.textChanged.raise(this,e),this._updateState()}onValueChanged(e){this._updateAria(),this.valueChanged.raise(this,e)}dispose(){this._rptUp.element=null,this._rptDn.element=null,super.dispose()}onGotFocus(e){this.isTouching||(this._tbx.focus(),this.selectAll()),super.onGotFocus(e)}onLostFocus(e){this._composing&&(this._composing=!1,this._setText(this.text));let t=this._clamp(this.value),s=wjcCore.Globalize.format(t,this.format);this._setText(s),super.onLostFocus(e)}refresh(e=!0){super.refresh(e),this._updateSymbols();let t=wjcCore.Globalize.format(this.value,this.format);this._setText(t)}_updateSymbols(){let e=wjcCore.culture.Globalize.numberFormat,t=this.format?this.format.match(/([a-z])(\d*)(,*)(.*)/i):null;this._chrDec=e["."]||".",this._chrNeg=e["-"]||"-",this._chrPls=e["+"]||"+",this._chrPct=e["%"]||"%",this._chrCur=t&&t[4]?t[4]:e.currency.symbol||"$",this._fmtSpc=t&&t[1]?t[1].toLowerCase():"n",this._fmtPrc=t&&t[2]?parseInt(t[2]):null,this._rxSym=new RegExp("^[%+\\-() \\"+this._chrDec+"\\"+this._chrCur+"\\"+this._chrNeg+"\\"+this._chrPls+"\\"+this._chrPct+"]*$"),this._rxNeg=new RegExp("(\\-|\\(|\\"+this._chrNeg+")")}_clamp(e){return wjcCore.clamp(e,this.min,this.max)}_isNumeric(e,t){let s=e==this._chrDec||e>="0"&&e<="9",i="x"==this._fmtSpc;return!s&&i&&(s=e>="a"&&e<="f"||e>="A"&&e<="F"),s||t||i||(s=e==this._chrPls||e==this._chrNeg||"("==e||")"==e),s}_getInputRange(e){let t=[0,0],s=this.text,i=!1;for(let h=0;h<s.length;h++)this._isNumeric(s[h],e)&&(i||(t[0]=h,i=!0),t[1]=h+1);return t}_flipSign(){let e=this._getSelStartDigits();this.value*=-1,this._setSelStartDigits(e)}_getSelStartDigits(){let e=0,t=this._tbx.selectionStart,s=this._tbx.value;for(let i=0;i<s.length&&i<t;i++)this._isNumeric(s[i],!0)&&e++;return e}_setSelStartDigits(e){let t=this._tbx.value;for(let s=0;s<t.length&&e>=0;s++)if(this._isNumeric(t[s],!0)){if(!e){wjcCore.setSelectionRange(this._tbx,s);break}e--}else if(!e){wjcCore.setSelectionRange(this._tbx,s);break}}_increment(e){if(e){let t=this._clamp(wjcCore.isNumber(this.value)?this.value+e:0),s=wjcCore.Globalize.format(t,this.format,!1,!1);this._setText(s)}}_updateBtn(){let e=this.showSpinner&&!!this.step,t=e;wjcCore.setCss([this._btnUp,this._btnDn],{display:e?"":"none"}),wjcCore.toggleClass(this.hostElement,"wj-input-show-spinner",e),wjcCore.enable(this._btnUp,t),wjcCore.enable(this._btnDn,t),this._updateAria()}_setText(e){if(this._composing)return;let t=this._tbx,s=this._rxNeg.test(e),i=this._delKey;if(e&&this._rxSym.test(e)&&(e=this.isRequired||!i?"0":""),this._delKey=!1,i&&0==this.value&&!this.isRequired&&(e=""),!e){if(!this.isRequired)return t.value="",null!=this._value&&(this._value=null,this.onValueChanged()),this._oldText&&(this._oldText=e,this.onTextChanged()),void this._updateBtn();e="0"}let h=this._format||(e.indexOf(this._chrDec)>-1?"n2":"n0"),r=wjcCore.Globalize.parseFloat(e,h);if(isNaN(r))return void(t.value=this._oldText);let o=wjcCore.Globalize.format(r,h,!1);s&&r>=0&&!i&&(o=this._chrNeg+o),null!=this._fmtPrc&&"g"!=this._fmtSpc||!i&&t.value.match(/\.0?$/)&&(o=e+("0"==e?this._chrDec:"")),t.value!=o&&("g"==this._fmtSpc&&t.value.match(o+"0*")&&this.containsFocus()&&t.selectionStart==t.value.length&&(o=t.value),t.value=o,r=wjcCore.Globalize.parseFloat(o,this.format)),r!=this._value&&(this._value=r,this.onValueChanged()),this.text!=this._oldText&&(this._oldText=this.text,this.onTextChanged()),this._updateBtn()}_keypress(e){if(!(e.defaultPrevented||this._composing||this.isReadOnly)&&e.charCode&&!e.ctrlKey&&!e.metaKey){let t=this._tbx,s=String.fromCharCode(e.charCode);if(this._isNumeric(s,!1)){let s=this._getInputRange(!0),i=t.selectionStart,h=t.selectionEnd;if(i<s[0]&&h<t.value.length&&(h=Math.max(h,s[0]),wjcCore.setSelectionRange(t,s[0],h)),i>=s[1]){let s=null!=this._fmtPrc?this._fmtPrc:2,h=t.value.indexOf(this._chrDec);h>-1&&i-h>s&&e.preventDefault()}}else e.preventDefault();switch(s){case"-":case this._chrNeg:this.min>=0?this.value<0&&this._flipSign():this.value&&t.selectionStart==t.selectionEnd?this._flipSign():this._clamp(-1)<0&&(t.value=this._chrNeg,wjcCore.setSelectionRange(t,1)),e.preventDefault();break;case"+":case this._chrPls:this.value<0&&this._flipSign(),e.preventDefault();break;case this._chrDec:if(0==this._fmtPrc)e.preventDefault();else{let i=t.value.indexOf(s);i>-1&&(t.selectionStart<=i&&i++,wjcCore.setSelectionRange(t,i),e.preventDefault())}}}}_keydown(e){if(this._delKey=!1,e.defaultPrevented||this._composing)return;let t=this._tbx,s=t.value,i=t.selectionStart,h=t.selectionEnd;switch(e.keyCode){case 65:e.ctrlKey&&(setTimeout(()=>{this.selectAll()}),e.preventDefault());break;case wjcCore.Key.Up:case wjcCore.Key.Down:this.step&&!this.isReadOnly&&(this._increment(this.step*(e.keyCode==wjcCore.Key.Up?1:-1)),setTimeout(()=>{this.selectAll()}),e.preventDefault());break;case wjcCore.Key.Back:if(this._delKey=!0,h-i<2&&!this.isReadOnly){let i=s[h-1];i!=this._chrDec&&i!=this._chrPct&&")"!=i||(setTimeout(()=>{h=i==this._chrPct?this._getInputRange(!0)[1]:h-1,wjcCore.setSelectionRange(t,h)}),e.preventDefault())}break;case wjcCore.Key.Delete:if(this._delKey=!0,h-i<2&&!this.isReadOnly)if("0"==s&&1==i)wjcCore.setSelectionRange(t,0);else{let h=s[i];h!=this._chrDec&&h!=this._chrPct||(setTimeout(()=>{wjcCore.setSelectionRange(t,i+1)}),e.preventDefault())}}}_input(e){this._composing||setTimeout(()=>{let e=this._tbx,t=e.value,s=t.indexOf(this._chrDec),i=e.selectionStart,h=this._getSelStartDigits();if("p"==this._fmtSpc&&t.length&&t.indexOf(this._chrPct)<0&&(t+=this._chrPct),this._setText(t),this.containsFocus()){let r=e.value,o=r.indexOf(this._chrDec),n=this._getInputRange(!0);if(t==this._chrNeg+this._chrDec&&o>-1)return void wjcCore.setSelectionRange(e,o+1);if(t[0]==this._chrNeg&&r[0]!=this._chrNeg)return void(1==r.length?wjcCore.setSelectionRange(e,1):this._setSelStartDigits(h));t?t==this._chrDec&&o>-1?i=o+1:i<=s&&o>-1||s<0&&o<0?i+=r.length-t.length:s<0&&o>-1&&(i=o):i=o>-1?o:n[1],i=wjcCore.clamp(i,n[0],n[1]),wjcCore.setSelectionRange(e,i)}})}_clickSpinner(e){e.defaultPrevented||this.isReadOnly||!this.step||(this._increment(this.step*(wjcCore.contains(this._btnUp,e.target)?1:-1)),this.isTouching||setTimeout(()=>this.selectAll()))}_updateAria(){let e=this.hostElement;e&&(wjcCore.setAttribute(e,"aria-valuemin",this.min),wjcCore.setAttribute(e,"aria-valuemax",this.max),wjcCore.setAttribute(e,"aria-valuenow",this.value))}}InputNumber.controlTemplate='<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" type="button" 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" type="button" tabindex="-1">+</button></span></div></div>',exports.InputNumber=InputNumber;class InputMask extends wjcCore.Control{constructor(e,t){super(e),this.valueChanged=new wjcCore.Event;let s=this.getTemplate();if(this.applyTemplate("wj-control wj-content wj-inputmask",s,{_tbx:"input"},"input"),"INPUT"==this._orgTag){let e=this._tbx.getAttribute("value");e&&(this.value=e)}this._msk=new wjcCore._MaskProvider(this._tbx),this.isRequired=!0,this.initialize(t),this.addEventListener(this._tbx,"input",()=>{setTimeout(()=>{this.onValueChanged()})})}get inputElement(){return this._tbx}get value(){return this._tbx.value}set value(e){e!=this.value&&(this._tbx.value=wjcCore.asString(e),e=this._msk._applyMask(),this._tbx.value=e,this.onValueChanged())}get rawValue(){return this._msk.getRawValue()}set rawValue(e){e!=this.rawValue&&(this.value=wjcCore.asString(e))}get mask(){return this._msk.mask}set mask(e){let t=this.value;this._msk.mask=wjcCore.asString(e),this.value!=t&&this.onValueChanged()}get promptChar(){return this._msk.promptChar}set promptChar(e){let t=this.value;this._msk.promptChar=e,this.value!=t&&this.onValueChanged()}get placeholder(){return this._tbx.placeholder}set placeholder(e){this._tbx.placeholder=e}get maskFull(){return this._msk.maskFull}get isRequired(){return this._tbx.required}set isRequired(e){this._tbx.required=wjcCore.asBoolean(e)}get isReadOnly(){return this._tbx.readOnly}set isReadOnly(e){this._tbx.readOnly=wjcCore.asBoolean(e),wjcCore.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)}selectAll(){let e=this._msk.getMaskRange();wjcCore.setSelectionRange(this._tbx,e[0],e[1]+1)}onValueChanged(e){this.value!=this._oldValue&&(this._oldValue=this.value,this.valueChanged.raise(this,e)),this._updateState()}_updateState(){super._updateState();let e=!this._pristine&&this._tbx.value&&!this.maskFull;wjcCore.toggleClass(this.hostElement,"wj-state-invalid",e)}dispose(){this._msk.input=null,super.dispose()}refresh(e=!0){super.refresh(e),this._msk.refresh()}onGotFocus(e){super.onGotFocus(e),this.selectAll()}}InputMask.controlTemplate='<div class="wj-input"><div class="wj-input-group"><input wj-part="input" class="wj-form-control"/></div></div>',exports.InputMask=InputMask;class InputColor extends DropDown{constructor(e,t){super(e),this.valueChanged=new wjcCore.Event,wjcCore.addClass(this.hostElement,"wj-inputcolor"),this._tbx.style.paddingLeft="24px";this._ePreview=wjcCore.createElement('<div class="wj-inputcolorbox" style="position:absolute;left:6px;top:6px;width:12px;bottom:6px;border:1px solid black"></div>',this.hostElement.firstElementChild),"INPUT"==this._orgTag&&(this._tbx.type="",this._commitText()),this.value="#ffffff",this.isRequired=!0,this.initialize(t),this.addEventListener(this._colorPicker.hostElement,"click",e=>{let t=e.target;t&&"DIV"==t.tagName&&(wjcCore.closest(t,'[wj-part="div-pal"]')||wjcCore.closest(t,'[wj-part="div-pv"]'))&&t.style.backgroundColor&&(this.isDroppedDown=!1)})}get value(){return this._value}set value(e){e!=this.value&&(!e&&this.isRequired||(this.text=wjcCore.asString(e)))}get text(){return this._tbx.value}set text(e){e!=this.text&&(this._setText(wjcCore.asString(e),!0),this._commitText())}get showAlphaChannel(){return this._colorPicker.showAlphaChannel}set showAlphaChannel(e){this._colorPicker.showAlphaChannel=e}get palette(){return this._colorPicker.palette}set palette(e){this._colorPicker.palette=e}get colorPicker(){return this._colorPicker}onValueChanged(e){this.valueChanged.raise(this,e)}_createDropDown(){this._colorPicker=new ColorPicker(this._dropDown),wjcCore.setCss(this._dropDown,{minWidth:420,minHeight:200}),this._colorPicker.valueChanged.addHandler(()=>{this.value=this._colorPicker.value})}_keydown(e){if(!e.defaultPrevented)switch(e.keyCode){case wjcCore.Key.Enter:this._commitText(),this.selectAll();break;case wjcCore.Key.Escape:this.text=this.value,this.selectAll()}super._keydown(e)}_commitText(){if(this.value!=this.text){if(!this.isRequired&&!this.text)return this._value=this.text,void(this._ePreview.style.backgroundColor="");wjcCore.Color.fromString(this.text)?(this._colorPicker.value=this.text,this._value=this._colorPicker.value,this._ePreview.style.backgroundColor=this.value,this.onValueChanged()):this.text=this._value?this._value:""}}}exports.InputColor=InputColor;