/*
    *
    * Wijmo Library 5.20183.550
    * 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/
    *
    */
function _getFocusableElements(t){let e=[],s=t.querySelectorAll("input,select,textarea,button,a,div");for(let t=0;t<s.length;t++){let i=s[t];if(i.offsetHeight>0&&i.tabIndex>-1&&!i.disabled&&!closest(i,"[disabled],.wj-state-disabled")){if(i instanceof HTMLAnchorElement&&!i.hasAttribute("href"))continue;if(isIE()&&!i.hasAttribute("tabindex")){if(i instanceof HTMLDivElement)continue;let t=Control.getControl(closest(i,".wj-flexgrid"));if(t&&0==t.keyActionTab)continue}!Control.getControl(i)&&_getFocusableElements(i).length||e.push(i)}}return e}function _hidePopup(t,e){t.style.display="none",e&&t.parentElement&&setTimeout(()=>{"none"==t.style.display&&(removeChild(t),isFunction(e)&&e())},Control._FOCUS_INTERVAL+1);let s=t[Control._SCRL_KEY];s instanceof Control&&s.dispose(),delete t[Control._SCRL_KEY],delete t[Control._OWNR_KEY]}function _isjQueryDialog(t){let e=window.jQuery,s=isFunction(e)?e(t):null;return s&&isFunction(s.dialog)&&hasClass(t,"ui-dialog")}function _getControlCode(t){return t._getProductInfo().split(",")[0]}function _getControlName(t){return t._getProductInfo().split(",")[1]}function _checkLicense(t,e,s){let i=culture.Licensing||_licStr,n=null;s?_checkExpiration(t,s)?_checkVersion(t,s)?_checkDomain(t,s)?_checkProductCode(t,s)?_checkEval(t,s)&&(n=i.evl):n=i.prd:n=i.dmn:n=i.ver:n=i.exp:n=e?i.lic:i.mss,n&&_addWme(t,n+="<br/><br/>"+i.ctc,s)}function _checkProductCode(t,e){let s=_getControlCode(t);if(s&&s.length>=4)for(let t=0;t<e.Prd.length;t++)if(e.Prd[t].C.indexOf(s)>-1)return!0;return!1}function _checkExpiration(t,e){if(e.Exp){let t=e.Exp,s=new Date(parseInt(t.substr(0,4))||0,parseInt(t.substr(4,2))-1||0,parseInt(t.substr(6,2))||0);if(Math.ceil((s.valueOf()-Date.now())/864e5)<=0)return!1}return!0}function _checkVersion(t,e){let s=e.Anl?e.Anl.ver:null,i=getVersion();return!s||!i||parseInt(s.replace("v",""))+10>=parseInt(i.split(".")[1])}function _checkDomain(t,e){if(_isLocalHost()||!e.Dms)return!0;let s=location.hostname,i=e.Dms.split(","),n=!1;for(let t=0;t<i.length;t++){let e=i[t];if(n=e&&0==e.lastIndexOf("*.",0),(e=n?e.slice(2):e)==s)return!0;if(n){let t=s.indexOf("."+e);if(t>0&&t==s.length-e.length-1)return!0}}return!1}function _checkEval(t,e){return!!e&&e.Evl}function _isLocalHost(){let t=atob("Xih8bG9jYWxob3N0fGZpZGRsZS5qc2hlbGwubmV0fHJ1bi5wbG5rci5jb3xzLmNvZGVwZW4uaW98bnVsbC5qc2Jpbi5jb218MTI3LjAuMC4xKSQ="),e=new RegExp(t,"i");return location.hostname.match(e)}function _addWme(t,e,s){if(e=_getMessage(t,e,s),!_codes[" "]&&!_isLocalHost()&&!_checkEval(t,s)){_codes[" "]=!0;let t=culture.Licensing||_licStr,s=createElement('<div style="position:fixed;background:rgba(0,0,0,0.3);left:0;top:0;width:100%;height:100%;font-family: sans-serif;z-index:10000;"><div style="position:relative;background:white;width:450px;padding:36pt;left:50%;top:50%;transform:translate(-50%,-50%)"><div><p style="font-size:150%;font-weight:bold">'+t.hdr+"</p><p>"+e+'</p></div><div style="text-align:right;margin-top:24pt"><button style="border:none;background:rgba(158,158,158,.2);padding:8px 16px">'+t.cls+"</button></div></div></div>",document.body);s.addEventListener("click",t=>{t.target instanceof HTMLButtonElement&&removeChild(s)})}if(!Control._wme){let s=createElement('<div><a href="'+_getWmeHref()+'" target="_blank" rel="noopener">'+_getMessage(t)+"</a></div>"),i={position:"fixed",display:"block",visibility:"visible",background:"rgba(240,240,240,.9)",padding:"8px 12px",margin:"6px",fontFamily:"sans-serif",fontSize:"14pt",fontWeight:"bold",zIndex:1e4,opacity:.8,height:"auto",width:"auto",transform:"none"};switch(Math.round(100*Math.random())%3){case 0:i.right=i.bottom=0;break;case 1:i.left=i.bottom=0;break;case 2:i.right=i.top=0}setCss(s,i),document.body.appendChild(s),Control._wme=s,(new Tooltip).setTooltip(s,e)}}function _getWmeHref(){return"ja"==culture.Globalize.name?"https://www.grapecity.co.jp/developer/support/wijmo-license":"https://www.grapecity.com/en/licensing/wijmo"}function _getMessage(t,e,s){(!e||e.trim().length<15)&&(e=(culture.Licensing||_licStr).evl),(!e||e.trim().length<15)&&(e=atob("V2lqbW8gRXZhbHVhdGlvbiBWZXJzaW9uICh7dmVyc2lvbn0p"));let i=null;if(s&&s.Exp){let t=s.Exp;i=new Date(parseInt(t.substr(0,4))||0,parseInt(t.substr(4,2))-1||0,parseInt(t.substr(6,2))||0)}return e=format(e,{version:getVersion(),domain:location.hostname,control:_getControlName(t),licVer:s&&s.Anl?"5."+s.Anl.ver.replace("v","")+".*":null,licDomain:s?s.Dms:null,expDate:i})}function _attorn(t,e,s,i){let n=parseKeyData(t,e.algorithmCode);if(!n)return i();let r=n.licData,o=n.prefix+"#"+e.algorithmCode;if(tripleHash(o+JSON.stringify(r.D))!=r.H)return i();let a=window.msCrypto||window.crypto,l=a?a.subtle:null;if(!l||!location.protocol.match(/^https/i))return s(r.D);let h={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},c={alg:"RS256",e:"AQAB",kty:"RSA",n:str64ToJwkBase64(e.publicKey)};c=window.msCrypto?str2ArrayBuffer(JSON.stringify(c)):c;try{asPromise(l.importKey("jwk",c,h,!1,["verify"])).then(t=>{let e=o+arrayBuffer2Str(str64ToArrayBuffer(str64EncodeUnicode(JSON.stringify(r.D))));asPromise(l.verify(h,t,str64ToArrayBuffer(r.S),str2ArrayBuffer(e))).then(t=>t?s(r.D):i())},()=>s(r.D))}catch(t){return s(r.D)}}function parseKeyData(t,e){try{e="#"+e;let s=t.indexOf(e);if(s>-1)return{prefix:t.substring(0,s),licData:JSON.parse(decode(t.substr(s+e.length)))}}catch(t){}return null}function decode(t){if(!t)return"";let e=unshiftString(t);e=reverseString(e);let s=Math.ceil(e.length/2);return e=e.substr(s)+e.substr(0,s),e=e.replace("#","="),e=e.replace("&","=="),str64DecodeUnicode(e)}function unshiftString(t){let e=t.split("");for(let t=e.length-5;t>=0;t--)swapArrayElements(e,t+1,t+3,unshiftChar),swapArrayElements(e,t,t+2,unshiftChar);return e.join("")}function swapArrayElements(t,e,s,i){t.length>1&&t.splice(s,1,i(t.splice(e,1,i(t[s]))[0]))}function shiftChar(t,e){let s=t.charCodeAt(0);return s>=65&&s<=90?t.toLowerCase():s>=97&&s<=122?t.toUpperCase():s>=48&&s<=57?String.fromCharCode(48+(s-48+10+e)%10):t}function unshiftChar(t){return shiftChar(t,-1)}function reverseString(t){return t.split("").reverse().join("")}function str64DecodeUnicode(t){return decodeURIComponent(Array.prototype.map.call(atob(t),t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}function arrayBuffer2Str(t){return String.fromCharCode.apply(null,new uint8Array(t))}function str64ToArrayBuffer(t){let e=atob(t),s=e.length,i=new uint8Array(s);for(let t=0;t<s;t++)i[t]=e.charCodeAt(t);return i.buffer}function str64EncodeUnicode(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16))))}function str64ToJwkBase64(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")}function str2ArrayBuffer(t){let e=new ArrayBuffer(t.length),s=new uint8Array(e);for(let e=0,i=t.length;e<i;e++)s[e]=t.charCodeAt(e);return e}function tripleHash(t){let e=0,s=5381,i=0;for(let n=t.length-1;n>=0;n--){let r=t.charCodeAt(n);e=r+(e<<6)+(e<<16)-e,s=r+((s<<5)+s),i=r+((i<<5)-i),i&=i}let n=e^s^i;return n<0&&(n=~n),n.toString(16).toUpperCase()}function asPromise(t){return"oncomplete"in t&&(t.then=((e,s)=>{t.resolve=e,t.reject=s}),t.oncomplete=(e=>{t.resolve(t.result)}),t.onerror=(e=>{t.reject()})),t}var __glob="undefined"!=typeof window?window:self;import*as wjcSelfRef from"wijmo/wijmo";var wjcSelf=wjcSelfRef||exports,_globalCulture=__glob.wijmo&&__glob.wijmo.culture;__glob.wijmo=wjcSelf,culture=_globalCulture;var _VERSION="5.20183.550";export function getVersion(){return _VERSION};export function setLicenseKey(t){Control._licKey=t};export var Key;!function(t){t[t.Back=8]="Back",t[t.Tab=9]="Tab",t[t.Enter=13]="Enter",t[t.Escape=27]="Escape",t[t.Space=32]="Space",t[t.PageUp=33]="PageUp",t[t.PageDown=34]="PageDown",t[t.End=35]="End",t[t.Home=36]="Home",t[t.Left=37]="Left",t[t.Up=38]="Up",t[t.Right=39]="Right",t[t.Down=40]="Down",t[t.Delete=46]="Delete",t[t.F1=112]="F1",t[t.F2=113]="F2",t[t.F3=114]="F3",t[t.F4=115]="F4",t[t.F5=116]="F5",t[t.F6=117]="F6",t[t.F7=118]="F7",t[t.F8=119]="F8",t[t.F9=120]="F9",t[t.F10=121]="F10",t[t.F11=122]="F11",t[t.F12=123]="F12"}(Key||(Key={}));export var DataType;!function(t){t[t.Object=0]="Object",t[t.String=1]="String",t[t.Number=2]="Number",t[t.Boolean=3]="Boolean",t[t.Date=4]="Date",t[t.Array=5]="Array"}(DataType||(DataType={}));export function tryCast(t,e){return null==t?null:isString(e)?isFunction(t.implementsInterface)&&t.implementsInterface(e)?t:null:t instanceof e?t:null};export function isPrimitive(t){return isString(t)||isNumber(t)||isBoolean(t)||isDate(t)};export function isString(t){return"string"==typeof t};export function isNullOrWhiteSpace(t){return null==t||t.replace(/\s/g,"").length<1};export function isNumber(t){return"number"==typeof t};export function isInt(t){return isNumber(t)&&t==Math.round(t)};export function isBoolean(t){return"boolean"==typeof t};export function isFunction(t){return"function"==typeof t};export function isUndefined(t){return void 0===t};export function isDate(t){return(t instanceof Date||"[object Date]"===Object.prototype.toString.call(t))&&!isNaN(t.getTime())};export function isArray(t){return t instanceof Array||Array.isArray(t)||"[object Array]"===Object.prototype.toString.call(t)};export function isObject(t){return null!=t&&"object"==typeof t&&!isDate(t)&&!isArray(t)};export function isEmpty(t){for(var e in t)return!1;return!0};export function getUniqueId(t){let e=t;for(let s=0;null!=document.getElementById(e);s++)e=t+s;return e};export function mouseToPage(t){if(t instanceof Point)return t;if(t.touches&&t.touches.length>0&&(t=t.touches[0]),isNumber(t.clientX)&&isNumber(t.clientY))return new Point(t.clientX+pageXOffset,t.clientY+pageYOffset);throw"Mouse or touch event expected."};export function getType(t){return isNumber(t)?DataType.Number:isBoolean(t)?DataType.Boolean:isDate(t)?DataType.Date:isString(t)?DataType.String:isArray(t)?DataType.Array:DataType.Object};export function changeType(t,e,s){if(null!=t){if(isString(t))switch(e){case DataType.Number:let i=Globalize.parseFloat(t,s);return isNaN(i)?t:i;case DataType.Date:let n=Globalize.parseDate(t,s);return n||s||!t||(n=new Date(t)),n&&isFinite(n.getTime())?n:t;case DataType.Boolean:switch(t.toLowerCase()){case"true":return!0;case"false":return!1}return t}if(e==DataType.String)return Globalize.format(t,s)}return t};export function toFixed(t,e,s){if(s){let s=t.toString(),i=s.indexOf(".");s.indexOf("e")<0&&i>-1&&(s=s.substr(0,i+1+e),t=parseFloat(s))}else{let s=t.toFixed(e);t=parseFloat(s)}return t};export function format(t,e,s){if((t=asString(t)).match(/\{.*"count".*:.*"when".*:.*\}/))try{let s=JSON.parse(t);if(isString(s.count)){let i=e[s.count],n=s.when;if(isNumber(i)&&isObject(n)){let e=n[i]||n.other;isString(e)&&(t=e)}}}catch(t){}return t.replace(/\{(.*?)(:(.*?))?\}/g,function(t,i,n,r){let o=t;return i&&"{"!=i[0]&&e&&(o=e[i],r&&(o=Globalize.format(o,r)),s&&(o=s(e,i,r,o))),null==o?"":o})};export function clamp(t,e,s){return null!=t&&(null!=s&&t>s&&(t=s),null!=e&&t<e&&(t=e)),t};export function copy(t,e){if(e)for(let s in e)if("_"!=s[0]){assert(s in t,'Unknown property "'+s+'".');let i=e[s];t._copy&&t._copy(s,i)||(t[s]instanceof Event?isFunction(i)&&t[s].addHandler(i):!isObject(i)||"undefined"!=typeof Element&&i instanceof Element||!t[s]||"itemsSource"==s?t[s]=i:copy(t[s],i))}};export function assert(t,e){if(!t)throw e="** Assertion failed in Wijmo: "+e,console.error(e),e};export function _deprecated(t,e){console.error('** WARNING: "'+t+'" has been deprecated; please use "'+e+'" instead.')};export function asString(t,e=!0){return assert(e&&null==t||isString(t),"String expected."),t};export function asNumber(t,e=!1,s=!1){if(assert(e&&null==t||isNumber(t),"Number expected."),s&&t&&t<0)throw"Positive number expected.";return t};export function asInt(t,e=!1,s=!1){if(assert(e&&null==t||isInt(t),"Integer expected."),s&&t&&t<0)throw"Positive integer expected.";return t};export function asBoolean(t,e=!1){return assert(e&&null==t||isBoolean(t),"Boolean expected."),t};export function asDate(t,e=!1){if(isString(t)){let e=changeType(t,DataType.Date,"r");isDate(e)&&(t=e)}return assert(e&&null==t||isDate(t),"Date expected."),t};export function asFunction(t,e=!0){return assert(e&&null==t||isFunction(t),"Function expected."),t};export function asArray(t,e=!0){return assert(e&&null==t||isArray(t),"Array expected."),t};export function asType(t,e,s=!1){return t=tryCast(t,e),assert(s||null!=t,e+" expected."),t};export function asEnum(t,e,s=!1){if(null==t&&s)return null;let i=e[t];return assert(null!=i,'Invalid enum value: "'+t+'"'),isNumber(i)?i:t};export function asCollectionView(t,e=!0){if(null==t&&e)return null;let s=tryCast(t,"ICollectionView");return null!=s?s:(isArray(t)||assert(!1,"Array or ICollectionView expected."),new CollectionView(t))};export function hasItems(t){return null!=t&&null!=t.items&&t.items.length>0};export function toHeaderCase(t){return t&&t.length?t[0].toUpperCase()+t.substr(1).replace(/([a-z])([A-Z])/g,"$1 $2"):""};export function escapeHtml(t){return isString(t)&&(t=t.replace(/[&<>"'\/]/g,function(t){return _ENTITYMAP[t]})),t};const _ENTITYMAP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};export function hasClass(t,e){if(t&&e){if(t instanceof HTMLElement&&t.classList&&!isIE9())return t.classList.contains(e);if(t.getAttribute){let s=new RegExp("(\\s|^)"+e+"(\\s|$)");return t&&s.test(t.getAttribute("class"))}}return!1};export function addClass(t,e){if(t&&e){if(t instanceof HTMLElement&&t.classList&&!isIE9()){if(e.indexOf(" ")<0)t.classList.add(e);else{let s=e.split(" ");for(let e=0;e<s.length;e++)t.classList.add(s[e])}return}if(t.setAttribute){let s=e.split(" ");for(let e=0;e<s.length;e++){let i=s[e];if(!hasClass(t,i)){let e=t.getAttribute("class");t.setAttribute("class",e?e+" "+i:i)}}}}};export function removeClass(t,e){if(t&&e){if(t instanceof HTMLElement&&t.classList&&!isIE9()){if(e.indexOf(" ")<0)t.classList.remove(e);else{let s=e.split(" ");for(let e=0;e<s.length;e++)t.classList.remove(s[e])}return}if(t.setAttribute){let s=e.split(" ");for(let e=0;e<s.length;e++){let i=s[e];if(hasClass(t,i)){let e=new RegExp("((\\s|^)"+i+"(\\s|$))","g"),s=t.getAttribute("class");(s=s.replace(e," ").replace(/ +/g," ").trim())?t.setAttribute("class",s):t.removeAttribute("class")}}}}};export function toggleClass(t,e,s){null==s&&(s=!hasClass(t,e)),s?addClass(t,e):removeClass(t,e)};export function setAttribute(t,e,s,i){t&&(null!=s?i&&t.getAttribute(e)||t.setAttribute(e,s.toString()):t.removeAttribute(e))};export function setAriaLabel(t,e){setAttribute(t,"aria-label",e)};export function setSelectionRange(t,e,s=e){if(assert(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement,"INPUT or TEXTAREA element expected"),contains(document.body,t)&&!t.disabled&&t.offsetHeight)try{return t.setSelectionRange(asNumber(e),asNumber(s),isIE()?null:"backward"),t.focus(),!0}catch(t){}return!1};export function disableAutoComplete(t){"autocomplete,autocorrect,autocapitalize,spellcheck".split(",").forEach(e=>{t.setAttribute(e,"spellcheck"==e?"false":"off")})};export function removeChild(t){return t&&t.parentNode?t.parentNode.removeChild(t):null};export function getActiveElement(){let t=document.activeElement;if(t){let e=t.shadowRoot;e&&e.activeElement&&(t=e.activeElement)}return t};export function moveFocus(t,e){let s=_getFocusableElements(t),i=0;if(e){let t=s.indexOf(getActiveElement());t>-1&&(i=(t+e+s.length)%s.length)}if(i<s.length){let t=s[i];return t.focus(),t instanceof HTMLInputElement&&t.select(),!0}return!1};export function getElement(t){return t instanceof Element?t:isString(t)?document.querySelector(t):t&&t.jquery?t[0]:null};export function createElement(t,e){let s=document.createElement("div");return s.innerHTML=t,1==s.children.length&&(s=s.children[0]),e&&(e=getElement(e)).appendChild(s),s};export function setText(t,e){t.textContent=e||""};export function contains(t,e){for(let s=e;s&&t;){if(s===t)return!0;s=s.parentNode||s.host}return!1};export function closest(t,e){let s=t?t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector:null;if(s)for(;t;t=t.parentNode)if(t instanceof Element&&s.call(t,e))return t;return null};export function closestClass(t,e){return closest(t,"."+e)};export function enable(t,e){let s=!e;toggleClass(t,"wj-state-disabled",s),setAttribute(t,"disabled",s?"true":null);let i=t.querySelectorAll("input");for(let t=0;t<i.length;t++){let s=i[t];e?s.removeAttribute("disabled"):s.setAttribute("disabled","true")}};export function getElementRect(t){let e=t.getBoundingClientRect();return new Rect(e.left+pageXOffset,e.top+pageYOffset,e.width,e.height)};export function setCss(t,e){if(assert(isObject(e),"css parameter should be an object"),t instanceof Array)for(let s=0;s<t.length;s++)setCss(t[s],e);else if(t&&t.style){let s=t.style;for(let t in e){let i=e[t];"number"==typeof i&&t.match(/width|height|left|top|right|bottom|size|padding|margin'/i)&&(i+="px"),s[t]!==i&&(s[t]=i.toString())}}};export function animate(t,e,s){null==e&&(e=Control._ANIM_DEF_DURATION),null==s&&(s=Control._ANIM_DEF_STEP),t=asFunction(t),e=asNumber(e,!1,!0),s=asNumber(s,!1,!0);let i,n=Date.now(),r=setInterval(()=>{let s=Math.min(1,(Date.now()-n)/e);s=Math.sin(s*Math.PI/2),s*=s,i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=null,t(s)}),s>=1&&clearInterval(r)},s);return r};export class Point{constructor(t=0,e=0){this.x=asNumber(t),this.y=asNumber(e)}equals(t){return t instanceof Point&&this.x==t.x&&this.y==t.y}clone(){return new Point(this.x,this.y)}};export class Size{constructor(t=0,e=0){this.width=asNumber(t),this.height=asNumber(e)}equals(t){return t instanceof Size&&this.width==t.width&&this.height==t.height}clone(){return new Size(this.width,this.height)}};export class Rect{constructor(t,e,s,i){this.left=asNumber(t),this.top=asNumber(e),this.width=asNumber(s),this.height=asNumber(i)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}equals(t){return t instanceof Rect&&this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height}clone(){return new Rect(this.left,this.top,this.width,this.height)}static fromBoundingRect(t){return null!=t.left?new Rect(t.left,t.top,t.width,t.height):null!=t.x?new Rect(t.x,t.y,t.width,t.height):void assert(!1,"Invalid source rectangle.")}static union(t,e){let s=Math.min(t.left,e.left),i=Math.min(t.top,e.top),n=Math.max(t.right,e.right),r=Math.max(t.bottom,e.bottom);return new Rect(s,i,n-s,r-i)}static intersection(t,e){let s=Math.max(t.left,e.left),i=Math.max(t.top,e.top),n=Math.min(t.right,e.right),r=Math.min(t.bottom,e.bottom);return new Rect(s,i,n-s,r-i)}contains(t){if(t instanceof Point)return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom;if(t instanceof Rect){let e=t;return e.left>=this.left&&e.right<=this.right&&e.top>=this.top&&e.bottom<=this.bottom}assert(!1,"Point or Rect expected.")}inflate(t,e){return new Rect(this.left-t,this.top-e,this.width+2*t,this.height+2*e)}};export class DateTime{static addDays(t,e){return DateTime.newDate(t.getFullYear(),t.getMonth(),t.getDate()+e)}static addMonths(t,e){return DateTime.newDate(t.getFullYear(),t.getMonth()+e,t.getDate())}static addYears(t,e){return DateTime.newDate(t.getFullYear()+e,t.getMonth(),t.getDate())}static addHours(t,e){return DateTime.newDate(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours()+e)}static addMinutes(t,e){return DateTime.newDate(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes()+e)}static addSeconds(t,e){return DateTime.newDate(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()+e)}static sameDate(t,e){return isDate(t)&&isDate(e)&&t.getFullYear()==e.getFullYear()&&t.getMonth()==e.getMonth()&&t.getDate()==e.getDate()}static sameTime(t,e){return isDate(t)&&isDate(e)&&t.getHours()==e.getHours()&&t.getMinutes()==e.getMinutes()&&t.getSeconds()==e.getSeconds()}static equals(t,e){return isDate(t)&&isDate(e)&&t.getTime()==e.getTime()}static fromDateTime(t,e){return t||e?(t||(t=e),e||(e=t),DateTime.newDate(t.getFullYear(),t.getMonth(),t.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())):null}static toFiscal(t,e){let s=culture.Globalize.calendar;return isArray(s.fiscalYearOffsets)?DateTime.addMonths(t,-s.fiscalYearOffsets[e?0:1]):t}static fromFiscal(t,e){let s=culture.Globalize.calendar;return isArray(s.fiscalYearOffsets)?DateTime.addMonths(t,+s.fiscalYearOffsets[e?0:1]):t}static newDate(t,e,s,i,n,r,o){if(null==t||null==e||null==s){let i=new Date;null==t&&(t=i.getFullYear()),null==e&&(e=i.getMonth()),null==s&&(s=i.getDate())}null==i&&(i=0),null==n&&(n=0),null==r&&(r=0),null==o&&(o=0);let a=new Date(t,e,s,i,n,r,o),l=a.getFullYear();return t<100&&l>=1900&&a.setFullYear(a.getFullYear()-1900),a}static clone(t){return DateTime.fromDateTime(t,t)}};export function httpRequest(t,e){e||(e={});let s=e.method?asString(e.method).toUpperCase():"GET",i=null==e.async||asBoolean(e.async),n=e.data;if(null!=n&&"GET"==s){let e=[];for(let t in n){let s=n[t];isDate(s)&&(s=s.toJSON()),e.push(t+"="+s)}e.length&&(t+=(t.indexOf("?")<0?"?":"&")+e.join("&")),n=null}let r=new XMLHttpRequest;r.URL_DEBUG=t;let o=!1;if(null==n||isString(n)||(o=isObject(n),n=JSON.stringify(n)),r.onload=function(){4==r.readyState&&(r.status<300?e.success&&asFunction(e.success)(r):e.error&&asFunction(e.error)(r),e.complete&&asFunction(e.complete)(r))},r.onerror=function(){if(!isFunction(e.error))throw"HttpRequest Error: "+r.status+" "+r.statusText;e.error(r)},r.open(s,t,i,e.user,e.password),e.user&&e.password&&r.setRequestHeader("Authorization","Basic "+btoa(e.user+":"+e.password)),o&&r.setRequestHeader("Content-Type","application/json"),e.requestHeaders)for(let t in e.requestHeaders)r.setRequestHeader(t,e.requestHeaders[t]);return isNumber(e.timeout)&&(r.timeout=e.timeout),isFunction(e.beforeSend)&&e.beforeSend(r),r.send(n),r};export var culture="undefined"!=typeof window&&window.wijmo.culture||{Globalize:{numberFormat:{".":".",",":",","-":"-","+":"+","%":"%",percent:{pattern:["-n %","n %"]},currency:{decimals:2,symbol:"$",pattern:["($n)","$n"]}},calendar:{"/":"/",":":":",firstDay:0,days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],am:["AM","A"],pm:["PM","P"],eras:["A.D.","B.C."],patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",t:"h:mm tt",T:"h:mm:ss tt",M:"MMMM d",m:"MMMM d",Y:"MMMM, yyyy",y:"MMMM, yyyy",g:"M/d/yyyy h:mm tt",G:"M/d/yyyy h:mm:ss tt",s:'yyyy"-"MM"-"dd"T"HH":"mm":"ss',o:'yyyy"-"MM"-"dd"T"HH":"mm":"ss"."fffffffK',O:'yyyy"-"MM"-"dd"T"HH":"mm":"ss"."fffffffK',U:"dddd, MMMM dd, yyyy h:mm:ss tt"},fiscalYearOffsets:[-3,-3]}}};export class Globalize{static format(t,e,s,i){return isString(t)?t:isNumber(t)?(e=e||(t==Math.round(t)?"n0":"n2"),Globalize.formatNumber(t,e,s,i)):isDate(t)?(e=e||"d",Globalize.formatDate(t,e)):null!=t?t.toString():""}static formatNumber(t,e,s,i){t=asNumber(t),e=asString(e);let n,r=culture.Globalize.numberFormat,o=e?e.match(/([a-z])(\d*)(,*)(.*)/i):null,a=o?o[1].toLowerCase():"n",l=o&&o[2]?parseInt(o[2]):"c"==a?r.currency.decimals:t==Math.round(t)?0:2,h=o&&o[3]?3*o[3].length:0,c=r["."]||".",u=r[","]||",",d=r["-"]||"-";if(h&&(t/=Math.pow(10,h)),"d"==a||"x"==a){for(n=Math.round(Math.abs(t)).toString("d"==a?10:16);n.length<l;)n="0"+n;return t<0&&(n=d+n),e&&"X"==e[0]&&(n=n.toUpperCase()),n}if("p"==a&&(t=toFixed(t=Globalize._mul100(t),l,i)),i&&"p"!=a&&(t=toFixed(t,l,!0)),n="c"==a||"p"==a?Globalize._toFixedStr(Math.abs(t),l):Globalize._toFixedStr(t,l),(s||"g"==a)&&n.indexOf(".")>-1&&(n=(n=n.replace(/(\.[0-9]*?)0+$/g,"$1")).replace(/\.$/,"")),"."!=c&&(n=n.replace(".",c)),"-"!=d&&(n=n.replace("-",d)),u&&("n"==a||"c"==a||"p"==a)){let t=n.indexOf(c),e=/\B(?=(\d\d\d)+(?!\d))/g;n=t>-1?n.substr(0,t).replace(e,u)+n.substr(t):n.replace(e,u)}if("c"==a){let e=r.currency.pattern[t<0?0:1],s=o&&o[4]?o[4]:r.currency.symbol;"​"==s&&(s=""),n=e.replace("n",n).replace("$",s)}if("p"==a){let e=r.percent.pattern[t<0?0:1],s=r["%"]||"%";n=e.replace("n",n),"%"!=s&&(n=n.replace("%",s)),"-"!=d&&t<0&&(n=n.replace("-",d))}return n}static formatDate(t,e){switch(t=asDate(t),e){case"r":case"R":return t.toUTCString();case"u":return t.toISOString().replace(/\.\d{3}/,"")}e=Globalize._expandFormat(e);let s=Globalize._parseDateFormat(e),i="";for(let n=0;n<s.length;n++)i+=Globalize._formatDatePart(t,e,s[n]);return i}static parseInt(t,e){return Math.round(Globalize.parseFloat(t,e))}static parseFloat(t,e){let s=culture.Globalize.numberFormat,i=s["-"]||"-",n=s["%"]||"%",r=t.indexOf(i)>-1||t.indexOf("(")>-1&&t.indexOf(")")>-1?-1:1,o=t.indexOf(n)>-1?.01:1,a=e?e.match(/,+/):null,l=a?3*a[0].length:0,h=0;if(!e||"x"!=e[0]&&"X"!=e[0]){let e=s["."]||".",i=new RegExp("[^\\d\\"+e+"]","g");t=t.replace(i,"").replace(e,"."),h=parseFloat(t)}else t=t.replace(/[^0-9a-f]+.*$/gi,""),h=parseInt(t,16);return h*r*o*Math.pow(10,l)}static parseDate(t,e,s){if(!(t=asString(t)))return null;if("u"==e)return new Date(t);let i;if("R"==e||"r"==e){let e=/(([0-9]+)\-([0-9]+)\-([0-9]+))?\s?(([0-9]+):([0-9]+)(:([0-9]+))?)?/,s=t.match(e);return s[1]||s[5]?(i=s[1]?new Date(parseInt(s[2]),parseInt(s[3])-1,parseInt(s[4])):new Date,s[5]&&(i.setHours(parseInt(s[6])),i.setMinutes(parseInt(s[7])),i.setSeconds(s[8]?parseInt(s[9]):0))):i=new Date(t),isNaN(i.getTime())?null:i}e=Globalize._expandFormat(e||"d");let n,r,o,a,l,h,c=culture.Globalize.calendar,u=Globalize._CJK,d=new RegExp("(\\"+c["/"]+")|(\\"+c[":"]+")|(\\d+)|(["+u+"\\.]{2,})|(["+u+"]+)","gi"),g=t.match(d),p=Globalize._parseDateFormat(e),_=0,f=-1,m=0,C=1,b=0,y=0,w=0,v=0,x=-1;if(!(g&&g.length&&p&&p.length))return null;for(let t=0;t<p.length&&g;t++){let e=t-_,s=e>-1&&e<g.length?g[e]:"",i=p[t].length;switch(p[t]){case"EEEE":case"EEE":case"EE":case"E":case"eeee":case"eee":case"ee":case"e":h=p[t];case"yyyy":case"yyy":case"yy":case"y":i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),f=parseInt(s),l=4==s.length;break;case"MMMM":case"MMM":a=!0;let u=s.toLowerCase();m=-1;for(let t=0;t<12;t++)if(0==c.months[t].toLowerCase().indexOf(u)){m=t;break}if(m>-1)break;case"MM":case"M":a=!0,i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),m=parseInt(s)-1;break;case"dddd":case"ddd":n=!0;break;case"dd":case"d":i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),C=parseInt(s),r=!0;break;case"hh":case"h":i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),b=12==(b=parseInt(s))?0:b;break;case"HH":i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),b=parseInt(s);break;case"H":b=parseInt(s);break;case"mm":case"m":i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),y=parseInt(s);break;case"ss":case"s":i>1&&s.length>i&&(g[e]=s.substr(i),s=s.substr(0,i),_++),w=parseInt(s);break;case"fffffff":case"FFFFFFF":case"ffffff":case"FFFFFF":case"fffff":case"FFFFF":case"ffff":case"FFFF":case"fff":case"FFF":case"ff":case"FF":case"f":case"F":v=parseInt(s)/Math.pow(10,i-3);break;case"tt":case"t":s=s.toUpperCase(),b<12&&c.pm.indexOf(s)>-1&&(b+=12);break;case"q":case"Q":case"u":case"U":o=!0;break;case"ggg":case"gg":case"g":x=c.eras.length>1?Globalize._getEra(s,c):-1;break;case"/":case":":if(s&&s!=c[p[t]])return null;break;case"K":break;default:Globalize._unquote(p[t]).trim()!=s.trim()&&_++}}if(a&&r&&(isNaN(b)&&(b=0),isNaN(y)&&(y=0),isNaN(w)&&(w=0)),m<0||m>11||isNaN(m)||C<1||C>31||isNaN(C)||b<0||b>24||isNaN(b)||y<0||y>60||isNaN(y)||w<0||w>60||isNaN(w))return null;if(h){if(!a)return null;let t=culture.Globalize.calendar;if(isArray(t.fiscalYearOffsets)){let e="E"==h[0],s=m-t.fiscalYearOffsets[e?0:1];f+=s>11?-1:s<0?1:0}}if(n&&!r)return null;if(o&&!a)return null;if(f<0)f=isDate(s)?s.getFullYear():(new Date).getFullYear();else if(x>-1)f=f+c.eras[x].start.getFullYear()-1;else if(f<100&&!l){let t=isNumber(c.twoDigitYearMax)?c.twoDigitYearMax:2029;t>99&&(f+=f+2e3<=t?2e3:1900)}return C>new Date(f,m+1,0).getDate()?null:(i=DateTime.newDate(f,m,C,b,y+0,w,v),isNaN(i.getTime())?null:i)}static getFirstDayOfWeek(){let t=culture.Globalize.calendar.firstDay;return t||0}static getNumberDecimalSeparator(){let t=culture.Globalize.numberFormat["."];return t||"."}static _toFixedStr(t,e){let s=t.toString(),i=s.indexOf("."),n=e-(s.length-i)+1;return t&&e<14&&(t+=1e-14*(t>0?1:-1)),s.indexOf("e")<0&&i>-1&&n>=0?s+Array(n+1).join("0"):t.toFixed(e)}static _unquote(t){return t.length>1&&t[0]==t[t.length-1]&&("'"==t[0]||'"'==t[0])?t.substr(1,t.length-2):t}static _parseDateFormat(t){if(t in Globalize._dateFormatParts)return Globalize._dateFormatParts[t];let e,s,i=[];if(t)for(e=0;e>-1&&e<t.length;e++){let n=t[e];if(("'"==n||'"'==n)&&(s=t.indexOf(n,e+1))>-1)i.push(t.substring(e,s+1)),e=s;else if("\\"==n&&e<t.length-1)e++,i.push('"'+t[e]+'"');else{for(s=e+1;s<t.length&&t[s]==n;s++);i.push(t.substring(e,s)),e=s-1}}return Globalize._dateFormatParts[t]=i,i}static _formatDatePart(t,e,s){let i,n=culture.Globalize.calendar,r=0,o=0,a=0,l=s.length;switch(s){case"yyyy":case"yyy":case"yy":case"y":case"EEEE":case"EEE":case"EE":case"E":case"eeee":case"eee":case"ee":case"e":o=(i="E"==s[0]?DateTime.toFiscal(t,!0):"e"==s[0]?DateTime.toFiscal(t,!1):t).getFullYear(),n.eras.length>1&&e.indexOf("g")>-1&&(r=Globalize._getEra(t,n))>-1&&(o=o-n.eras[r].start.getFullYear()+1);let h=s.length<3?o%100:3==s.length?o%1e3:o;return Globalize._zeroPad(h,s.length);case"MMMMM":return n.monthsAbbr[t.getMonth()][0];case"MMMM":return n.months[t.getMonth()];case"MMM":return n.monthsAbbr[t.getMonth()];case"MM":case"M":return Globalize._zeroPad(t.getMonth()+1,l);case"dddd":return n.days[t.getDay()];case"ddd":return n.daysAbbr[t.getDay()];case"dd":return Globalize._zeroPad(t.getDate(),2);case"d":return t.getDate().toString();case"hh":case"h":return Globalize._zeroPad(Globalize._h12(t),l);case"HH":case"H":return Globalize._zeroPad(t.getHours(),l);case"mm":case"m":return Globalize._zeroPad(t.getMinutes(),l);case"ss":case"s":return Globalize._zeroPad(t.getSeconds(),l);case"fffffff":case"FFFFFFF":case"ffffff":case"FFFFFF":case"fffff":case"FFFFF":case"ffff":case"FFFF":case"fff":case"FFF":case"ff":case"FF":case"f":case"F":return a=t.getMilliseconds()*Math.pow(10,l-3),"f"==s[0]?Globalize._zeroPad(a,l):a.toFixed(0);case"tt":return t.getHours()<12?n.am[0]:n.pm[0];case"t":return t.getHours()<12?n.am[1]:n.pm[1];case"q":case"Q":return(Math.floor(t.getMonth()/3)+1).toString();case"u":case"U":return i=DateTime.toFiscal(t,"U"==s),(Math.floor(i.getMonth()/3)+1).toString();case"ggg":case"gg":case"g":if(n.eras.length>1&&(r=Globalize._getEra(t,n))>-1){let t=n.eras[r];return"ggg"==s?t.name:"gg"==s?t.name[0]:t.symbol}return n.eras[0];case":":case"/":return n[s];case"K":let c=t.toString().match(/(\+|\-)(\d{2})(\d{2})/);return c?c[1]+c[2]+c[3]:"";case"zzz":case"zz":case"z":let u,d=-t.getTimezoneOffset();switch(s){case"zzz":u=Globalize.format(d/60,"d2",!1,!0)+n[":"]+Globalize.format(d%60,"d2",!1,!0);break;case"zz":u=Globalize.format(d/60,"d2",!1,!0);break;case"z":u=Globalize.format(d/60,"d",!1,!0)}return d>=0?"+"+u:u}return l>1&&s[0]==s[l-1]&&('"'==s[0]||"'"==s[0])?s.substr(1,l-2):s}static _getEra(t,e){if(isDate(t)){for(let s=0;s<e.eras.length;s++)if(t>=e.eras[s].start)return s}else if(isString(t))for(let s=0;s<e.eras.length;s++)if(e.eras[s].name&&(0==e.eras[s].name.indexOf(t)||0==e.eras[s].symbol.indexOf(t)))return s;return-1}static _expandFormat(t){let e=culture.Globalize.calendar.patterns[t];return e||t}static _zeroPad(t,e){let s=t.toFixed(0),i=e-s.length+1;return i>0?Array(i).join("0")+s:s}static _h12(t){let e=culture.Globalize.calendar,s=t.getHours();return e.am&&e.am[0]&&0==(s%=12)&&(s=12),s}static _mul100(t){let e=t.toString(),s=e.indexOf(".");return e.indexOf("e")>-1?100*t:(s<0?e+="00":(s+=2,e=(e=e.replace(".","")+"00").substr(0,s)+"."+e.substr(s)),parseFloat(e))}};Globalize._CJK="a-z"+"u00c0-u017fu3000-u30ffu4e00-u9faf".replace(/u/g,"\\u")+"u1100-u11ffu3130-u318fua960-ua97fuac00-ud7afud7b0-ud7ff".replace(/u/g,"\\u"),Globalize._dateFormatParts={};export function _updateCulture(){culture=window.wijmo.culture};export function _addCultureInfo(t,e){culture[t]=window.wijmo.culture[t]||e};export class Binding{constructor(t){this.path=t}get path(){return this._path}set path(t){this._path=t,this._parts=t?t.split("."):[];for(let t=0;t<this._parts.length;t++){let e=this._parts[t],s=e.indexOf("[");s>-1&&(this._parts[t]=e.substr(0,s),this._parts.splice(++t,0,parseInt(e.substr(s+1))))}this._key=1==this._parts.length?this._parts[0]:null}getValue(t){if(t){if(this._key)return t[this._key];if(this._path&&this._path in t)return t[this._path];for(let e=0;e<this._parts.length&&t;e++)t=t[this._parts[e]]}return t}setValue(t,e){if(t){if(this._path in t)return void(t[this._path]=e);for(let e=0;e<this._parts.length-1;e++)if(null==(t=t[this._parts[e]]))return;t[this._parts[this._parts.length-1]]=e}}};class EventHandler{constructor(t,e){this.handler=t,this.self=e}}export class Event{constructor(){this._handlers=[]}addHandler(t,e){t=asFunction(t),this._handlers.push(new EventHandler(t,e))}removeHandler(t,e){t=asFunction(t);for(let s=0;s<this._handlers.length;s++){let i=this._handlers[s];if((i.handler==t||null==t)&&(i.self==e||null==e)&&(this._handlers.splice(s,1),t&&e))break}}removeAllHandlers(){this._handlers.length=0}raise(t,e=EventArgs.empty){for(let s=0;s<this._handlers.length;s++){let i=this._handlers[s];i.handler.call(i.self,t,e)}}get hasHandlers(){return this._handlers.length>0}get handlerCount(){return this._handlers.length}};export class EventArgs{};EventArgs.empty=new EventArgs;export class CancelEventArgs extends EventArgs{constructor(){super(...arguments),this.cancel=!1}};export class PropertyChangedEventArgs extends EventArgs{constructor(t,e,s){super(),this._name=t,this._oldVal=e,this._newVal=s}get propertyName(){return this._name}get oldValue(){return this._oldVal}get newValue(){return this._newVal}};export class RequestErrorEventArgs extends CancelEventArgs{constructor(t,e){super(),this._xhr=t,this._msg=e}get request(){return this._xhr}get message(){return this._msg}set message(t){this._msg=t}};export var controlBaseClass="undefined"!=typeof window&&window["wj-control-is-element"]?HTMLElement:Object;var __isES6Mode=!1;try{let t=class{};t.prototype=Array.prototype,__isES6Mode=t.prototype!==Array.prototype}catch(t){__isES6Mode=!0}var __callSuper=__isES6Mode||controlBaseClass!==Object;export class ControlBase extends controlBaseClass{constructor(){__callSuper&&super()}};export class Control extends ControlBase{constructor(t,e=null,s=!1){super(),this._listeners=[],this._pristine=!0,this._focus=!1,this._updating=0,this._fullUpdate=!1,this.gotFocus=new Event,this.lostFocus=new Event,this.refreshing=new Event,this.refreshed=new Event,this._updateWme(),assert(null==Control.getControl(t),"Element is already hosting a control.");let i=getElement(t);assert(null!=i,"Cannot find the host element."),this._orgTabIndex=i.hasAttribute("tabindex")?i.tabIndex:0,this._orgOuter=i.outerHTML,this._orgTag=i.tagName,this._orgAtts=i.attributes,"INPUT"!=i.tagName&&"SELECT"!=i.tagName||(i=this._replaceWithDiv(i)),this._e=i,i[Control._CTRL_KEY]=this;let n=this.addEventListener.bind(this);if(1==s){this._szCtl=new Size(i.offsetWidth,i.offsetHeight);let t=this._handleResize.bind(this);n(window,"resize",t)}let r=this._handleFocusBlur.bind(this);n(i,"focus",r,!0),n(i,"blur",r,!0);let o=this._handleDisabled.bind(this);if(n(i,"mousedown",o,!0),n(i,"mouseup",o,!0),n(i,"click",o,!0),n(i,"dblclick",o,!0),n(i,"wheel",o,getEventOptions(!0,!0)),n(i,"keydown",t=>{this.isDisabled&&t.keyCode!=Key.Tab&&t.preventDefault()}),null==Control._touching&&(Control._touching=!1,"ontouchstart"in window||"onpointerdown"in window)){let t=document.body,e=t.addEventListener.bind(t),s=this._handleTouchStart,i=this._handleTouchEnd,n=getEventOptions(!0,!0);"ontouchstart"in window?(e("touchstart",s,n),e("touchend",i,n),e("touchcancel",i,n),e("touchleave",i,n)):"onpointerdown"in window&&(e("pointerdown",s,n),e("pointerup",i,n),e("pointerout",i,n),e("pointercancel",i,n),e("pointerleave",i,n))}}getTemplate(){for(let t=Object.getPrototypeOf(this);t;t=Object.getPrototypeOf(t)){let e=t.constructor.controlTemplate;if(e)return e}return null}applyTemplate(t,e,s,i){let n=this._e;t&&addClass(n,t);let r=null;e&&(r=createElement(e,n));let o=n.querySelectorAll("a.wj-btn");for(l=0;l<o.length;l++){let t=o[l];setAttribute(t,"role","button",!0),setAttribute(t,"href","",!0),setAttribute(t,"draggable",!1,!0)}let a=n.querySelectorAll("button");for(var l=0;l<a.length;l++)setAttribute(a[l],"type","button",!0);let h=n.querySelectorAll("input"),c=1==h.length?h[0]:null;if(c){let t=Control._rxInputAtts;this._copyAttributes(c,n.attributes,t),this._copyAttributes(c,this._orgAtts,t)}if(c&&n.id){let t=n;for(;t.parentElement;)t=t.parentElement;let e=t.querySelector('label[for="'+n.id+'"]');if(e instanceof HTMLLabelElement){let t=getUniqueId(n.id+"_input");c.id=t,e.htmlFor=t}}if(c){let t=document.createEvent("HTMLEvents"),e=c.value;t.initEvent("change",!0,!1),this.addEventListener(c,"input",()=>{this._pristine=!1,e=c.value},!0),this.gotFocus.addHandler(()=>{e=c.value}),this.lostFocus.addHandler(()=>{this._pristine&&(this._pristine=!1,this._updateState()),e!=c.value&&c.dispatchEvent(t)})}if(c?n.tabIndex=-1:n.getAttribute("tabindex")||(n.tabIndex=0),this._updateState(),s)for(let t in s){let e=s[t];if(this[t]=r.querySelector('[wj-part="'+e+'"]'),null==this[t]&&r.getAttribute("wj-part")==e&&(this[t]=r),null==this[t])throw'Missing template part: "'+e+'"';if(e==i){let e="name",s=n.attributes[e];s&&s.value&&this[t].setAttribute(e,s.value),e="accesskey",(s=n.attributes[e])&&s.value&&(this[t].setAttribute(e,s.value),n.removeAttribute(e))}}return r}dispose(){if(!this._e)return;let t=this._e.querySelectorAll(".wj-control");for(let e=0;e<t.length;e++){let s=Control.getControl(t[e]);s&&s.dispose()}this._toInv&&(clearTimeout(this._toInv),this._toInv=null),this.removeEventListener();for(let t in this)if(t.length>2&&0==t.indexOf("on")){let e=this[t[2].toLowerCase()+t.substr(3)];e instanceof Event&&e.removeAllHandlers()}let e=this.collectionView;if(e instanceof CollectionView)for(let t in e){let s=e[t];s instanceof Event&&s.removeHandler(null,this)}this._e.parentNode&&(this._e.outerHTML=this._orgOuter),this._e[Control._CTRL_KEY]=null,this._e=this._orgOuter=this._orgTag=null}static getControl(t){let e=getElement(t);return e?asType(e[Control._CTRL_KEY],Control,!0):null}get hostElement(){return this._e}get rightToLeft(){return null==this._rtlDir&&(this._rtlDir=!!this._e&&"rtl"==getComputedStyle(this._e).direction),this._rtlDir}focus(){let t=this._e;t&&(t.tabIndex>=0||!moveFocus(t,0))&&t.focus()}containsFocus(){let t=this._e,e=getActiveElement();if(!t)return!1;for(let s=e;s;){if(s==t)return!0;s=s[Control._OWNR_KEY]||s.parentNode}return!1}invalidate(t=!0){this._rtlDir=null,this._fullUpdate=this._fullUpdate||t,this._toInv&&(clearTimeout(this._toInv),this._toInv=null),this.isUpdating||(this._toInv=setTimeout(()=>{this.refresh(this._fullUpdate),this._toInv=null},Control._REFRESH_INTERVAL))}refresh(t=!0){this.isUpdating||(this.onRefreshing(),setTimeout(()=>{this.onRefreshed()})),!this.isUpdating&&this._toInv&&(clearTimeout(this._toInv),this._toInv=null,this._fullUpdate=!1),this._updateState(),this._updateWme()}static invalidateAll(t){if(t||(t=document.body),t.children)for(let e=0;e<t.children.length;e++)Control.invalidateAll(t.children[e]);let e=Control.getControl(t);e&&e.invalidate()}static refreshAll(t){if(t||(t=document.body),t.children)for(let e=0;e<t.children.length;e++)Control.refreshAll(t.children[e]);let e=Control.getControl(t);e&&e.refresh()}static disposeAll(t){let e=Control.getControl(t);if(e)e.dispose();else if(t.children)for(let e=0;e<t.children.length;e++)Control.disposeAll(t.children[e])}beginUpdate(){this._updating++}endUpdate(){this._updating--,this._updating<=0&&this.invalidate()}get isUpdating(){return this._updating>0}deferUpdate(t){try{this.beginUpdate(),t()}finally{this.endUpdate()}}get isTouching(){return Control._touching}get isDisabled(){return this._e&&null!=this._e.getAttribute("disabled")}set isDisabled(t){if((t=asBoolean(t,!0))!=this.isDisabled){let e=this._e;e&&(enable(e,!t),e.tabIndex=this.isDisabled?-1:this._orgTabIndex)}}initialize(t){t&&copy(this,t)}addEventListener(t,e,s,i,n){if(t){null==i&&(i=!1),isBoolean(i)&&null==n&&e.match(/touch|wheel/)&&(n=!1);let r=isBoolean(i)&&isBoolean(n)?getEventOptions(i,n):i;t.addEventListener(e,s,r),this._listeners.push({target:t,type:e,fn:s,capture:i})}}removeEventListener(t,e,s,i){let n=0;for(let r=0;r<this._listeners.length;r++){let o=this._listeners[r];null!=t&&t!=o.target||null!=e&&e!=o.type||(null==s||s==o.fn||s&&o.fn&&s.toString()==o.fn.toString())&&(null!=i&&i!=o.capture||(o.target.removeEventListener(o.type,o.fn,o.capture),this._listeners.splice(r,1),r--,n++))}return n}onGotFocus(t){this.gotFocus.raise(this,t)}onLostFocus(t){this.lostFocus.raise(this,t)}onRefreshing(t){this.refreshing.raise(this,t)}onRefreshed(t){this.refreshed.raise(this,t)}_getProductInfo(){return"B0C3,Control"}_updateWme(){let t=window.wijmo._updateWme;isFunction(t)&&t(this,Control._licKey)}_hasPendingUpdates(){return null!=this._toInv}_handleResize(){if(this._e.parentElement){let t=new Size(this._e.offsetWidth,this._e.offsetHeight);t.equals(this._szCtl)||(this._szCtl=t,this.invalidate())}}_handleFocusBlur(){this._toFocus||(this._toFocus=setTimeout(()=>{this._toFocus=null,this._updateFocusState()},Control._FOCUS_INTERVAL))}_updateFocusState(){setTimeout(()=>{let t=EventArgs.empty,e=document.body.querySelectorAll(".wj-state-focused");for(let s=0;s<e.length;s++){let i=Control.getControl(e[s]);i&&i._focus&&!i.containsFocus()&&(removeClass(i._e,"wj-state-focus"),i._focus=!1,i._updateState(),i.onLostFocus(t))}let s=getActiveElement();if(s){let e=!0;for(let i=s;i;){let s=Control.getControl(i);s&&!s._focus&&s.containsFocus()&&(e&&(addClass(i,"wj-state-focus"),e=!1),s._focus=!0,s._updateState(),s.onGotFocus(t)),i=i[Control._OWNR_KEY]||i.parentNode}}})}_updateState(){let t=this.hostElement;if(t){toggleClass(t,"wj-state-focused",this._focus),this._rtlDir="rtl"==getComputedStyle(t).direction,toggleClass(t,"wj-rtl",this._rtlDir);let e=t.querySelector("input");if(e instanceof HTMLInputElement){toggleClass(t,"wj-state-empty",0==e.value.length),toggleClass(t,"wj-state-readonly",e.readOnly);let s=e.validationMessage;toggleClass(t,"wj-state-invalid",!this._pristine&&null!=s&&s.length>0)}}}_handleTouchStart(t){null!=t.pointerType&&"touch"!=t.pointerType||(Control._toTouch&&(clearTimeout(Control._toTouch),Control._toTouch=null),Control._touching=!0)}_handleTouchEnd(t){null!=t.pointerType&&"touch"!=t.pointerType||(Control._toTouch=setTimeout(function(){Control._toTouch=null,Control._touching=!1},900))}_handleDisabled(t){(this.isDisabled||closest(t.target,".wj-state-disabled"))&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())}_replaceWithDiv(t){let e=document.createElement("div");return t.parentElement.replaceChild(e,t),e.innerHTML=t.innerHTML,this._copyAttributes(e,t.attributes,/id|style|class/i),e}_copyAttributes(t,e,s){if(t)for(let i=0;i<e.length;i++){let n=e[i].name;n.match(s)&&t.setAttribute(n,e[i].value)}}_getKeyCode(t){let e=t.keyCode;if(this.rightToLeft)switch(e){case Key.Right:e=Key.Left;break;case Key.Left:e=Key.Right}return e}};Control._REFRESH_INTERVAL=10,Control._FOCUS_INTERVAL=0,Control._ANIM_DEF_DURATION=400,Control._ANIM_DEF_STEP=35,Control._CLICK_DELAY=800,Control._CLICK_REPEAT=75,Control._CLIPBOARD_DELAY=100,Control._POPUP_ZINDEX=1500,Control._SEARCH_DELAY=600,Control._HOVER_DELAY=300,Control._DRAG_SCROLL_EDGE=15,Control._DRAG_SCROLL_STEP=10,Control._CTRL_KEY="$WJ-CTRL",Control._OWNR_KEY="$WJ-OWNR",Control._SCRL_KEY="$WJ-SCRL",Control._rxInputAtts=/name|tabindex|placeholder|autofocus|autocomplete|autocorrect|autocapitalize|spellcheck|readonly|minlength|maxlength|pattern|type|aria-.+/i;export var Aggregate;!function(t){t[t.None=0]="None",t[t.Sum=1]="Sum",t[t.Cnt=2]="Cnt",t[t.Avg=3]="Avg",t[t.Max=4]="Max",t[t.Min=5]="Min",t[t.Rng=6]="Rng",t[t.Std=7]="Std",t[t.Var=8]="Var",t[t.StdPop=9]="StdPop",t[t.VarPop=10]="VarPop",t[t.CntAll=11]="CntAll",t[t.First=12]="First",t[t.Last=13]="Last"}(Aggregate||(Aggregate={}));export function getAggregate(t,e,s){let i=0,n=0,r=0,o=0,a=null,l=null,h=null,c=s?new Binding(s):null;if((t=asEnum(t,Aggregate))==Aggregate.CntAll)return e.length;for(let s=0;s<e.length;s++){let u=e[s];if(c&&(u=c.getValue(u)),t==Aggregate.First)return u;null!=u&&(i++,(null==a||u<a)&&(a=u),(null==l||u>l)&&(l=u),h=u,isNumber(u)&&!isNaN(u)?(n++,r+=u,o+=u*u):isBoolean(u)&&(n++,1==u&&(r++,o++)))}let u=0==n?0:r/n;switch(t){case Aggregate.Avg:return u;case Aggregate.Cnt:return i;case Aggregate.Max:return l;case Aggregate.Min:return a;case Aggregate.Rng:return l-a;case Aggregate.Sum:return r;case Aggregate.VarPop:return n<=1?0:o/n-u*u;case Aggregate.StdPop:return n<=1?0:Math.sqrt(o/n-u*u);case Aggregate.Var:return n<=1?0:(o/n-u*u)*n/(n-1);case Aggregate.Std:return n<=1?0:Math.sqrt((o/n-u*u)*n/(n-1));case Aggregate.Last:return h}throw"Invalid aggregate type."};export var NotifyCollectionChangedAction;!function(t){t[t.Add=0]="Add",t[t.Remove=1]="Remove",t[t.Change=2]="Change",t[t.Reset=3]="Reset"}(NotifyCollectionChangedAction||(NotifyCollectionChangedAction={}));export class NotifyCollectionChangedEventArgs extends EventArgs{constructor(t=NotifyCollectionChangedAction.Reset,e=null,s=-1){super(),this.action=t,this.item=e,this.index=s}};NotifyCollectionChangedEventArgs.reset=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);export class SortDescription{constructor(t,e){this._bnd=new Binding(t),this._asc=e}get property(){return this._bnd.path}get ascending(){return this._asc}};export class PageChangingEventArgs extends CancelEventArgs{constructor(t){super(),this.newPageIndex=t}};export class GroupDescription{groupNameFromItem(t,e){return""}namesMatch(t,e){return t===e}};export class PropertyGroupDescription extends GroupDescription{constructor(t,e){super(),this._bnd=new Binding(t),this._converter=e}get propertyName(){return this._bnd.path}groupNameFromItem(t,e){return this._converter?this._converter(t,this.propertyName):this._bnd.getValue(t)}namesMatch(t,e){return t===e}};export class ArrayBase extends Array{constructor(){canChangePrototype?this.length=0:super()}};var canChangePrototype=!0;try{ArrayBase.prototype=Array.prototype,canChangePrototype=ArrayBase.prototype===Array.prototype}catch(t){canChangePrototype=!1}var symb="undefined"!=typeof window?window.Symbol:null;!canChangePrototype&&symb&&symb.species&&Object.defineProperty(ArrayBase,symb.species,{get:function(){return Array},enumerable:!1,configurable:!1});export class ObservableArray extends ArrayBase{constructor(t){if(super(),this._updating=0,this.collectionChanged=new Event,t){t=asArray(t),this._updating++;for(let e=0;e<t.length;e++)this.push(t[e]);this._updating--}}push(...t){let e=this.length;for(let s=0;t&&s<t.length;s++)e=super.push(t[s]),this._updating||this._raiseCollectionChanged(NotifyCollectionChangedAction.Add,t[s],e-1);return e}pop(){let t=super.pop();return this._raiseCollectionChanged(NotifyCollectionChangedAction.Remove,t,this.length),t}splice(t,e,s){let i,n=NotifyCollectionChangedAction;return e&&s?(i=super.splice(t,e,s),1==e?this._raiseCollectionChanged(n.Change,s,t):this._raiseCollectionChanged(),i):s?(i=super.splice(t,0,s),this._raiseCollectionChanged(n.Add,s,t),i):(i=super.splice(t,e),1==e?this._raiseCollectionChanged(n.Remove,i[0],t):this._raiseCollectionChanged(),i)}slice(t,e){return super.slice(t,e)}indexOf(t,e){return super.indexOf(t,e)}sort(t){let e=super.sort(t);return this._raiseCollectionChanged(),e}insert(t,e){this.splice(t,0,e)}remove(t){let e=this.indexOf(t);return e>-1&&(this.removeAt(e),!0)}removeAt(t){this.splice(t,1)}setAt(t,e){t>this.length&&(this.length=t),this.splice(t,1,e)}clear(){this.length&&this.splice(0,this.length)}beginUpdate(){this._updating++}endUpdate(){this._updating>0&&(this._updating--,0==this._updating&&this._raiseCollectionChanged())}get isUpdating(){return this._updating>0}deferUpdate(t){try{this.beginUpdate(),t()}finally{this.endUpdate()}}implementsInterface(t){return"INotifyCollectionChanged"==t}onCollectionChanged(t=NotifyCollectionChangedEventArgs.reset){this.isUpdating||this.collectionChanged.raise(this,t)}_raiseCollectionChanged(t=NotifyCollectionChangedAction.Reset,e,s){if(!this.isUpdating){let i=new NotifyCollectionChangedEventArgs(t,e,s);this.onCollectionChanged(i)}}};export class CollectionView{constructor(t,e){this._idx=-1,this._srtDsc=new ObservableArray,this._grpDesc=new ObservableArray,this._newItem=null,this._edtItem=null,this._pgSz=0,this._pgIdx=0,this._updating=0,this._stableSort=!1,this._nullsFirst=!1,this._canFilter=!0,this._canGroup=!0,this._canSort=!0,this._canAddNew=!0,this._canCancelEdit=!0,this._canRemove=!0,this._canChangePage=!0,this._trackChanges=!1,this._chgAdded=new ObservableArray,this._chgRemoved=new ObservableArray,this._chgEdited=new ObservableArray,this.collectionChanged=new Event,this.sourceCollectionChanging=new Event,this.sourceCollectionChanged=new Event,this.currentChanged=new Event,this.currentChanging=new Event,this.pageChanged=new Event,this.pageChanging=new Event,this._srtDsc.collectionChanged.addHandler(()=>{this._srtDsc.forEach(t=>{assert(t instanceof SortDescription,"sortDescriptions array must contain SortDescription objects.")}),this.canSort&&this.refresh()}),this._grpDesc.collectionChanged.addHandler(()=>{this._grpDesc.forEach(t=>{assert(t instanceof GroupDescription,"groupDescriptions array must contain GroupDescription objects.")}),this.canGroup&&(this.currentEditItem||this.currentAddItem?this.commitEdit():this.refresh())}),this.sourceCollection=t||new ObservableArray,e&&(this.beginUpdate(),copy(this,e),this.endUpdate())}_copy(t,e){switch(t){case"sortDescriptions":this.sortDescriptions.clear();let s=asArray(e);for(let t=0;t<s.length;t++){let e=s[t];isString(e)&&(e=new SortDescription(e,!0)),this.sortDescriptions.push(e)}return!0;case"groupDescriptions":this.groupDescriptions.clear();let i=asArray(e);for(let t=0;t<i.length;t++){let e=i[t];isString(e)&&(e=new PropertyGroupDescription(e)),this.groupDescriptions.push(e)}return!0;case"currentItem":return this.currentItem=e,!0}return!1}get newItemCreator(){return this._itemCreator}set newItemCreator(t){this._itemCreator=asFunction(t)}get sortConverter(){return this._srtCvt}set sortConverter(t){t!=this._srtCvt&&(this._srtCvt=asFunction(t,!0))}get sortComparer(){return this._srtCmp}set sortComparer(t){t!=this._srtCmp&&(this._srtCmp=asFunction(t,!0))}get useStableSort(){return this._stableSort}set useStableSort(t){this._stableSort=asBoolean(t)}get sortNullsFirst(){return this._nullsFirst}set sortNullsFirst(t){this._nullsFirst=asBoolean(t)}getAggregate(t,e,s){return getAggregate(t,s?this._pgView:this._view,e)}get trackChanges(){return this._trackChanges}set trackChanges(t){this._trackChanges=asBoolean(t)}get itemsAdded(){return this._chgAdded}get itemsRemoved(){return this._chgRemoved}get itemsEdited(){return this._chgEdited}clearChanges(){this._chgAdded.clear(),this._chgRemoved.clear(),this._chgEdited.clear()}implementsInterface(t){switch(t){case"ICollectionView":case"IEditableCollectionView":case"IPagedCollectionView":case"INotifyCollectionChanged":return!0}return!1}get getError(){return this._getError}set getError(t){this._getError!=t&&(this._getError=asFunction(t),this._raiseCollectionChanged())}onCollectionChanged(t=NotifyCollectionChangedEventArgs.reset){t.action!=NotifyCollectionChangedAction.Change||this._committing||this._canceling||t.item==this.currentEditItem||t.item==this.currentAddItem||this._trackItemChanged(t.item),this.collectionChanged.raise(this,t)}_raiseCollectionChanged(t=NotifyCollectionChangedAction.Reset,e,s){let i=new NotifyCollectionChangedEventArgs(t,e,s);this.onCollectionChanged(i)}_notifyItemChanged(t){let e=new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Change,t,this.items.indexOf(t));this.onCollectionChanged(e)}onSourceCollectionChanging(t){return this.sourceCollectionChanging.raise(this,t),!t.cancel}onSourceCollectionChanged(t){this.sourceCollectionChanged.raise(this,t)}get canFilter(){return this._canFilter}set canFilter(t){this._canFilter=asBoolean(t)}get canGroup(){return this._canGroup}set canGroup(t){this._canGroup=asBoolean(t)}get canSort(){return this._canSort}set canSort(t){this._canSort=asBoolean(t)}get currentItem(){return this._pgView&&this._idx>-1&&this._idx<this._pgView.length?this._pgView[this._idx]:null}set currentItem(t){this.moveCurrentTo(t)}get currentPosition(){return this._idx}set currentPosition(t){this.moveCurrentToPosition(asNumber(t))}get filter(){return this._filter}set filter(t){this._filter!=t&&(this._filter=asFunction(t),this.canFilter&&this.refresh())}get groupDescriptions(){return this._grpDesc}get groups(){return this._groups}get isEmpty(){return!this._pgView||!this._pgView.length}get sortDescriptions(){return this._srtDsc}get sourceCollection(){return this._src}set sourceCollection(t){if(t!=this._src){if(!this.onSourceCollectionChanging(new CancelEventArgs))return;let e=this.currentPosition;this.commitEdit(),null!=this._ncc&&this._ncc.collectionChanged.removeHandler(this._sourceChanged),this._src=asArray(t,!1),this._ncc=tryCast(this._src,"INotifyCollectionChanged"),this._ncc&&this._ncc.collectionChanged.addHandler(this._sourceChanged,this),this.clearChanges(),this.refresh(),this.moveCurrentToFirst(),this.onSourceCollectionChanged(),this.currentPosition<0&&e>-1&&this.onCurrentChanged()}}_sourceChanged(t,e){this._updating<=0&&this.refresh()}contains(t){return this._pgView.indexOf(t)>-1}moveCurrentTo(t){return this.moveCurrentToPosition(this._pgView.indexOf(t))}moveCurrentToFirst(){return this.moveCurrentToPosition(0)}moveCurrentToLast(){return this.moveCurrentToPosition(this._pgView.length-1)}moveCurrentToPrevious(){return this._idx>0&&this.moveCurrentToPosition(this._idx-1)}moveCurrentToNext(){return this.moveCurrentToPosition(this._idx+1)}moveCurrentToPosition(t){if(t>=-1&&t<this._pgView.length&&t!=this._idx){let e=new CancelEventArgs;if(this.onCurrentChanging(e)){let e=this._pgView[t];this._edtItem&&e!=this._edtItem?this.commitEdit():this._newItem&&e!=this._newItem&&this.commitNew(),this._idx=t,this.onCurrentChanged()}}return this._idx==t}refresh(){this._newItem||this._edtItem?this._pendingRefresh=!0:this._updating<=0&&(this._performRefresh(),this.onCollectionChanged())}_performRefresh(){if(this._updating>0)return;this._pendingRefresh=!1;let t=this.currentItem;this._view=this._src?this._performFilter(this._src):[],this.canSort&&this._srtDsc.length>0&&(this._view==this._src&&(this._view=this._src.slice()),this._performSort(this._view)),this._groups=this.canGroup?this._createGroups(this._view):null,this._fullGroups=this._groups,this._groups&&(this._view=this._mergeGroupItems(this._groups)),this._pgIdx=clamp(this._pgIdx,0,this.pageCount-1),this._pgView=this._getPageView(),this._groups&&this.pageCount>1&&(this._groups=this._createGroups(this._pgView),this._mergeGroupItems(this._groups));let e=this._pgView.indexOf(t);e<0&&(e=Math.min(this._idx,this._pgView.length-1)),this._idx=e,this._digest=this._getGroupsDigest(this.groups),this.currentItem!==t&&this.onCurrentChanged()}_performSort(t){if(this._stableSort){let e=t.map(function(t,e){return{item:t,index:e}}),s=this._compareItems();e.sort(function(t,e){let i=s(t.item,e.item);return 0==i?t.index-e.index:i});for(let s=0;s<t.length;s++)t[s]=e[s].item}else t.sort(this._compareItems())}_compareItems(){let t=this._srtDsc,e=this._srtCvt,s=this._srtCmp,i=this._nullsFirst?-1:1,n=!0,r=0;return function(o,a){for(let l=0;l<t.length;l++){let h=t[l],c=h._bnd.getValue(o),u=h._bnd.getValue(a);if(e&&(c=e(h,o,c,n),u=e(h,a,u,!1),n=!1),s&&null!=(r=s(c,u)))return h.ascending?+r:-r;if(c!==c&&(c=null),u!==u&&(u=null),null!=c&&null==u)return-1*i;if(null==c&&null!=u)return 1*i;if("string"==typeof c&&"string"==typeof u){let t=CollectionView._collator;if(t){if(0!=(r=t.compare(c,u)))return h.ascending?+r:-r;continue}let e=c.toLowerCase(),s=u.toLowerCase();e!=s&&(c=e,u=s)}if(0!=(r=c<u?-1:c>u?1:0))return h.ascending?+r:-r}return 0}}_performFilter(t){return this.canFilter&&this._filter?t.filter(this._filter,this):t}onCurrentChanged(t=EventArgs.empty){this.currentChanged.raise(this,t)}onCurrentChanging(t){return this.currentChanging.raise(this,t),!t.cancel}get items(){return this._pgView}beginUpdate(){this._updating++}endUpdate(){this._updating--,this._updating<=0&&this.refresh()}get isUpdating(){return this._updating>0}deferUpdate(t){try{this.beginUpdate(),t()}finally{this.endUpdate()}}get canAddNew(){return this._canAddNew}set canAddNew(t){this._canAddNew=asBoolean(t)}get canCancelEdit(){return this._canCancelEdit}set canCancelEdit(t){this._canCancelEdit=asBoolean(t)}get canRemove(){return this._canRemove}set canRemove(t){this._canRemove=asBoolean(t)}get currentAddItem(){return this._newItem}get currentEditItem(){return this._edtItem}get isAddingNew(){return null!=this._newItem}get isEditingItem(){return null!=this._edtItem}editItem(t){t!=this._edtItem&&this.moveCurrentTo(t)&&(this.commitEdit(),this._edtItem=t,this._edtClone={},this._extend(this._edtClone,this._edtItem))}commitEdit(){let t=this._edtItem,e=this._edtClone;if(null!=t){this._committing=!0;let s=this._sameContent(t,e),i=this._pendingRefresh;this._edtItem=null,this._edtClone=null;let n=this._pgView.indexOf(t),r=this._digest;this._performRefresh(),s||this._trackItemChanged(t),this._pgView.indexOf(t)!=n||r!=this._digest||i?this._raiseCollectionChanged():this._raiseCollectionChanged(NotifyCollectionChangedAction.Change,t,n),this.commitNew(),this._committing=!1}}cancelEdit(){let t=this._edtItem;if(null!=t){if(this._edtItem=null,!this.canCancelEdit)return void assert(!1,"cannot cancel edits (canCancelEdit == false).");let e=this._src.indexOf(t);e>=0&&this._edtClone&&(this._extend(this._src[e],this._edtClone),this._edtClone=null,this._canceling=!0,this._raiseCollectionChanged(NotifyCollectionChangedAction.Change,t,e),this._canceling=!1,this._pendingRefresh&&(this._performRefresh(),this._raiseCollectionChanged()))}}addNew(){if(arguments.length>0&&assert(!1,"addNew does not take any parameters, it creates the new items."),this.commitEdit(),!this.canAddNew)return assert(!1,"cannot add items (canAddNew == false)."),null;let t=null,e=this.sourceCollection;if(null!=(t=this.newItemCreator?this.newItemCreator():e&&e.length?new e[0].constructor:{})){if(this._newItem=t,this._updating++,this._src.push(t),this._updating--,this._pgView!=this._src&&this._pgView.push(t),this.groups&&this.groups.length){let e=this.groups[this.groups.length-1];for(e.items.push(t);e.groups&&e.groups.length;)(e=e.groups[e.groups.length-1]).items.push(t)}this._raiseCollectionChanged(NotifyCollectionChangedAction.Add,t,this._pgView.length-1),this.moveCurrentTo(t)}return this._newItem}commitNew(){let t=this._newItem;if(null!=t){this._newItem=null;let e=this._pgView.indexOf(t),s=this._digest;if(this._performRefresh(),this._trackChanges){let e=this._chgEdited.indexOf(t);e>-1&&this._chgEdited.removeAt(e),this._chgAdded.indexOf(t)<0&&this._chgAdded.push(t)}this._pgView.indexOf(t)==e&&s==this._digest?this._raiseCollectionChanged(NotifyCollectionChangedAction.Change,t,e):this._raiseCollectionChanged()}}cancelNew(){let t=this._newItem;null!=t&&this.remove(t)}remove(t){let e=t==this._newItem;if(e&&(this._newItem=null),t==this._edtItem&&this.cancelEdit(),!this.canRemove)return void assert(!1,"cannot remove items (canRemove == false).");let s=this._src.indexOf(t);if(s>-1){let i=this.currentItem;this._updating++,this._src.splice(s,1),this._updating--;let n=this._digest;if(this._performRefresh(),this._trackChanges){let s=this._chgAdded.indexOf(t);s>-1&&this._chgAdded.removeAt(s);let i=this._chgEdited.indexOf(t);i>-1&&this._chgEdited.removeAt(i),this._chgRemoved.indexOf(t)<0&&!e&&s<0&&this._chgRemoved.push(t)}let r=this.sortDescriptions.length>0,o=this.pageSize>0&&this._pgIdx>-1;r||o||n!=this._getGroupsDigest(this.groups)?this._raiseCollectionChanged():this._raiseCollectionChanged(NotifyCollectionChangedAction.Remove,t,s),this.currentItem!==i&&this.onCurrentChanged()}}removeAt(t){t=asInt(t),this.remove(this._pgView[t])}_trackItemChanged(t){if(this._trackChanges){let e=this.sourceCollection;if(e&&e.indexOf(t)>-1){let e=this._chgEdited.indexOf(t),s=NotifyCollectionChangedAction.Change;if(e<0&&this._chgAdded.indexOf(t)<0)this._chgEdited.push(t);else if(e>-1){let i=new NotifyCollectionChangedEventArgs(s,t,e);this._chgEdited.onCollectionChanged(i)}else if((e=this._chgAdded.indexOf(t))>-1){let i=new NotifyCollectionChangedEventArgs(s,t,e);this._chgAdded.onCollectionChanged(i)}}}}_extend(t,e){for(let s in e)t[s]=e[s]}_sameContent(t,e){assert(null!=e&&null!=t,"Two objects expected");for(let s in e)if(!this._sameValue(t[s],e[s]))return!1;for(let s in t)if(!this._sameValue(t[s],e[s]))return!1;return!0}_sameValue(t,e){return t===e||DateTime.equals(t,e)}get canChangePage(){return this._canChangePage}set canChangePage(t){this._canChangePage=asBoolean(t)}get isPageChanging(){return!1}get itemCount(){return this._pgView.length}get pageIndex(){return this._pgIdx}get pageSize(){return this._pgSz}set pageSize(t){t!=this._pgSz&&(this._pgSz=asInt(t),this.refresh())}get totalItemCount(){return this._view.length}get pageCount(){return this.pageSize?Math.ceil(this.totalItemCount/this.pageSize):1}moveToFirstPage(){return this.moveToPage(0)}moveToLastPage(){return this.moveToPage(this.pageCount-1)}moveToPreviousPage(){return this.moveToPage(this.pageIndex-1)}moveToNextPage(){return this.moveToPage(this.pageIndex+1)}moveToPage(t){let e=clamp(t,0,this.pageCount-1);if(e!=this._pgIdx){this.canChangePage||assert(!1,"cannot change pages (canChangePage == false).");let t=new PageChangingEventArgs(e);this.onPageChanging(t)&&(this._pgIdx=e,this._pgView=this._getPageView(),this._idx=0,this.groupDescriptions&&0!=this.groupDescriptions.length?this.refresh():this.onCollectionChanged(),this.onPageChanged())}return this._pgIdx==t}onPageChanged(t=EventArgs.empty){this.pageChanged.raise(this,t)}onPageChanging(t){return this.pageChanging.raise(this,t),!t.cancel}_getFullGroup(t){let e=this._getGroupByPath(this._fullGroups,t.level,t._path);return null!=e&&(t=e),t}_getGroupByPath(t,e,s){for(let i=0;i<t.length;i++){let n=t[i];if(n.level==e&&n._path==s)return n;if(n.level<e&&0==s.indexOf(n._path)&&null!=(n=this._getGroupByPath(n.groups,e,s)))return n}return null}_getPageView(){if(this.pageSize<=0||this._pgIdx<0)return this._view;let t=this._pgSz*this._pgIdx,e=Math.min(t+this._pgSz,this._view.length);return this._view.slice(t,e)}_createGroups(t){if(!this._grpDesc||!this._grpDesc.length)return null;let e=[],s={},i=null;for(let n=0;n<t.length;n++){let r=t[n],o=e,a=this._grpDesc.length,l="";for(let t=0;t<a;t++){let e=this._grpDesc[t],n=e.groupNameFromItem(r,t),h=t==a-1;!(i=s[l])&&isPrimitive(n)&&(i={},s[l]=i);let c=this._getGroup(e,o,i,n,t,h);l+="/"+n,c._path=l,h&&c.items.push(r),o=c.groups}}return e}_getGroupsDigest(t){let e="";for(let s=0;null!=t&&s<t.length;s++){let i=t[s];e+="{"+i.name+":"+(i.items?i.items.length:"*"),i.groups.length>0&&(e+=",",e+=this._getGroupsDigest(i.groups)),e+="}"}return e}_mergeGroupItems(t){let e=[];for(let s=0;s<t.length;s++){let i=t[s];if(!i._isBottomLevel){let t=this._mergeGroupItems(i.groups);for(let e=0,s=t.length;e<s;e++)i._items.push(t[e])}for(let t=0,s=i._items.length;t<s;t++)e.push(i._items[t])}return e}_getGroup(t,e,s,i,n,r){let o;if(s&&isPrimitive(i)){if(o=s[i])return o}else for(let s=0;s<e.length;s++)if(t.namesMatch(e[s].name,i))return e[s];let a=new CollectionViewGroup(t,i,n,r);return e.push(a),s&&(s[i]=a),a}};CollectionView._collator="undefined"!=typeof window&&window.Intl?new Intl.Collator:null;export class CollectionViewGroup{constructor(t,e,s,i){this._gd=t,this._name=e,this._level=s,this._isBottomLevel=i,this._groups=[],this._items=[]}get name(){return this._name}get level(){return this._level}get isBottomLevel(){return this._isBottomLevel}get items(){return this._items}get groups(){return this._groups}get groupDescription(){return this._gd}getAggregate(t,e,s){let i=tryCast(s,CollectionView);return getAggregate(t,(i?i._getFullGroup(this):this).items,e)}};export class Tooltip{constructor(t){this._showAutoTipBnd=this._showAutoTip.bind(this),this._hideAutoTipBnd=this._hideAutoTip.bind(this),this._html=!0,this._gap=6,this._showAtMouse=!1,this._showDelay=500,this._hideDelay=0,this._tips=[],this.popup=new Event,copy(this,t)}setTooltip(t,e){t=getElement(t),e=this._getContent(e);let s=this._indexOf(t);s>-1&&(this._detach(t),this._tips.splice(s,1)),e&&(this._attach(t),this._tips.push({element:t,content:e}))}getTooltip(t){t=getElement(t);let e=this._tips;for(let s=0;s<e.length;s++)if(e[s].element==t)return e[s].content;return null}show(t,e,s){t=getElement(t),e=this._getContent(e),s||(s=Rect.fromBoundingRect(t.getBoundingClientRect()));let i=Tooltip._eTip;i||(addClass(i=Tooltip._eTip=document.createElement("div"),"wj-tooltip"),i.style.visibility="none"),this._setContent(e);let n=new TooltipEventArgs(e);this.onPopup(n),n.content&&!n.cancel&&(document.body.appendChild(i),this._setContent(n.content),i.style.minWidth="",showPopup(i,s=new Rect(s.left-(i.offsetWidth-s.width)/2,s.top-this.gap,i.offsetWidth,s.height+2*this.gap),!0),document.addEventListener("mousedown",this._hideAutoTipBnd))}hide(){let t=Tooltip._eTip;t&&(removeChild(t),t.innerHTML=""),document.removeEventListener("mousedown",this._hideAutoTipBnd)}dispose(){this._tips.forEach(t=>{this._detach(t.element)}),this._tips.splice(0,this._tips.length)}get isVisible(){let t=Tooltip._eTip;return null!=t&&null!=t.parentElement&&t.offsetWidth>0}get isContentHtml(){return this._html}set isContentHtml(t){this._html=asBoolean(t)}get gap(){return this._gap}set gap(t){this._gap=asNumber(t)}get showAtMouse(){return this._showAtMouse}set showAtMouse(t){this._showAtMouse=asBoolean(t)}get showDelay(){return this._showDelay}set showDelay(t){this._showDelay=asInt(t)}get hideDelay(){return this._hideDelay}set hideDelay(t){this._hideDelay=asInt(t)}onPopup(t){return this.popup&&this.popup.raise(this,t),!t.cancel}_indexOf(t){for(let e=0;e<this._tips.length;e++)if(this._tips[e].element==t)return e;return-1}_attach(t){t.addEventListener("mouseenter",this._showAutoTipBnd),t.addEventListener("mouseleave",this._hideAutoTipBnd),t.addEventListener("click",this._showAutoTipBnd)}_detach(t){t.removeEventListener("mouseenter",this._showAutoTipBnd),t.removeEventListener("mouseleave",this._hideAutoTipBnd),t.removeEventListener("click",this._showAutoTipBnd)}_showAutoTip(t){if(t.defaultPrevented)return;if("click"==t.type&&!Control._touching)return void this._hideAutoTip(t);let e="mouseenter"==t.type?this._showDelay:0,s=this._hideDelay;this._clearTimeouts(),this._toShow=setTimeout(()=>{let e=this._indexOf(t.target);if(e>-1){let i=this._tips[e],n=this._showAtMouse?new Rect(t.clientX,t.clientY,0,0):null;this.show(i.element,i.content,n),s>0&&(this._toHide=setTimeout(()=>{this.hide()},s))}},e)}_hideAutoTip(t){this._clearTimeouts(),this.hide()}_clearTimeouts(){this._toShow&&(clearTimeout(this._toShow),this._toShow=null),this._toHide&&(clearTimeout(this._toHide),this._toHide=null)}_getContent(t){if((t=asString(t))&&"#"==t[0]){let e=getElement(t);e&&(t=e.innerHTML)}return t}_setContent(t){let e=Tooltip._eTip;e&&(this.isContentHtml?e.innerHTML=t:e.textContent=t)}};class ElementContent{}export class TooltipEventArgs extends CancelEventArgs{constructor(t){super(),this._content=asString(t)}get content(){return this._content}set content(t){this._content=asString(t)}};export class Color{constructor(t){this._r=0,this._g=0,this._b=0,this._a=1,t&&this._parse(t)}get r(){return this._r}set r(t){this._r=clamp(asNumber(t),0,255)}get g(){return this._g}set g(t){this._g=clamp(asNumber(t),0,255)}get b(){return this._b}set b(t){this._b=clamp(asNumber(t),0,255)}get a(){return this._a}set a(t){this._a=clamp(asNumber(t),0,1)}equals(t){return t instanceof Color&&this.r==t.r&&this.g==t.g&&this.b==t.b&&this.a==t.a}toString(){let t=Math.round(100*this.a);return t>99?"#"+((1<<24)+(this.r<<16)+(this.g<<8)+this.b).toString(16).slice(1):"rgba("+this.r+","+this.g+","+this.b+","+t/100+")"}static fromRgba(t,e,s,i=1){let n=new Color(null);return n.r=Math.round(clamp(asNumber(t),0,255)),n.g=Math.round(clamp(asNumber(e),0,255)),n.b=Math.round(clamp(asNumber(s),0,255)),n.a=clamp(asNumber(i),0,1),n}static fromHsb(t,e,s,i=1){let n=Color._hsbToRgb(clamp(asNumber(t),0,1),clamp(asNumber(e),0,1),clamp(asNumber(s),0,1));return Color.fromRgba(n[0],n[1],n[2],i)}static fromHsl(t,e,s,i=1){let n=Color._hslToRgb(clamp(asNumber(t),0,1),clamp(asNumber(e),0,1),clamp(asNumber(s),0,1));return Color.fromRgba(n[0],n[1],n[2],i)}static fromString(t){let e=new Color(null);return e._parse(asString(t))?e:null}getHsb(){return Color._rgbToHsb(this.r,this.g,this.b)}getHsl(){return Color._rgbToHsl(this.r,this.g,this.b)}static interpolate(t,e,s){s=clamp(asNumber(s),0,1);let i=Color._rgbToHsl(t.r,t.g,t.b),n=Color._rgbToHsl(e.r,e.g,e.b),r=1-s,o=t.a*r+e.a*s,a=[i[0]*r+n[0]*s,i[1]*r+n[1]*s,i[2]*r+n[2]*s],l=Color._hslToRgb(a[0],a[1],a[2]);return Color.fromRgba(l[0],l[1],l[2],o)}static toOpaque(t,e){if(1==(t=isString(t)?Color.fromString(t):asType(t,Color)).a)return t;e=null==e?Color.fromRgba(255,255,255,1):isString(e)?Color.fromString(e):asType(e,Color);let s=t.a,i=1-s;return Color.fromRgba(t.r*s+e.r*i,t.g*s+e.g*i,t.b*s+e.b*i)}_parse(t){if("transparent"==(t=t.toLowerCase()))return this._r=this._g=this._b=this._a=0,!0;if(t&&0!=t.indexOf("#")&&0!=t.indexOf("rgb")&&0!=t.indexOf("hsl")){let e=document.createElement("div");e.style.color=t;let s=e.style.color;s==t&&((s=window.getComputedStyle(e).color)||(document.body.appendChild(e),s=window.getComputedStyle(e).color,removeChild(e))),t=s.toLowerCase()}if(0==t.indexOf("#"))return 4==t.length?(this.r=parseInt(t[1]+t[1],16),this.g=parseInt(t[2]+t[2],16),this.b=parseInt(t[3]+t[3],16),this.a=1,!0):7==t.length&&(this.r=parseInt(t.substr(1,2),16),this.g=parseInt(t.substr(3,2),16),this.b=parseInt(t.substr(5,2),16),this.a=1,!0);if(0==t.indexOf("rgb")){let e=t.indexOf("("),s=t.indexOf(")");if(e>-1&&s>-1){let i=t.substr(e+1,s-(e+1)).split(",");if(i.length>2)return this.r=parseInt(i[0]),this.g=parseInt(i[1]),this.b=parseInt(i[2]),this.a=i.length>3?parseFloat(i[3]):1,!0}}if(0==t.indexOf("hsl")){let e=t.indexOf("("),s=t.indexOf(")");if(e>-1&&s>-1){let i=t.substr(e+1,s-(e+1)).split(",");if(i.length>2){let t=parseInt(i[0])/360,e=parseInt(i[1]),s=parseInt(i[2]);i[1].indexOf("%")>-1&&(e/=100),i[2].indexOf("%")>-1&&(s/=100);let n=Color._hslToRgb(t,e,s);return this.r=n[0],this.g=n[1],this.b=n[2],this.a=i.length>3?parseFloat(i[3]):1,!0}}}return!1}static _hslToRgb(t,e,s){assert(t>=0&&t<=1&&e>=0&&e<=1&&s>=0&&s<=1,"bad HSL values");let i,n,r;if(0==e)i=n=r=s;else{let o=s<.5?s*(1+e):s+e-s*e,a=2*s-o;i=Color._hue2rgb(a,o,t+1/3),n=Color._hue2rgb(a,o,t),r=Color._hue2rgb(a,o,t-1/3)}return[Math.round(255*i),Math.round(255*n),Math.round(255*r)]}static _hue2rgb(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t}static _rgbToHsl(t,e,s){assert(t>=0&&t<=255&&e>=0&&e<=255&&s>=0&&s<=255,"bad RGB values"),t/=255,e/=255,s/=255;let i,n,r=Math.max(t,e,s),o=Math.min(t,e,s),a=(r+o)/2;if(r==o)i=n=0;else{let l=r-o;switch(n=a>.5?l/(2-r-o):l/(r+o),r){case t:i=(e-s)/l+(e<s?6:0);break;case e:i=(s-t)/l+2;break;case s:i=(t-e)/l+4}i/=6}return[i,n,a]}static _rgbToHsb(t,e,s){assert(t>=0&&t<=255&&e>=0&&e<=255&&s>=0&&s<=255,"bad RGB values");let i=Color._rgbToHsl(t,e,s);return Color._hslToHsb(i[0],i[1],i[2])}static _hsbToRgb(t,e,s){let i=Color._hsbToHsl(t,e,s);return Color._hslToRgb(i[0],i[1],i[2])}static _hsbToHsl(t,e,s){assert(t>=0&&t<=1&&e>=0&&e<=1&&s>=0&&s<=1,"bad HSB values");let i=clamp(s*(2-e)/2,0,1),n=1-Math.abs(2*i-1),r=clamp(n>0?s*e/n:e,0,1);return assert(!isNaN(i)&&!isNaN(r),"bad conversion to HSL"),[t,r,i]}static _hslToHsb(t,e,s){assert(t>=0&&t<=1&&e>=0&&e<=1&&s>=0&&s<=1,"bad HSL values");let i=clamp(1==s?1:(2*s+e*(1-Math.abs(2*s-1)))/2,0,1),n=clamp(i>0?2*(i-s)/i:e,0,1);return assert(!isNaN(i)&&!isNaN(n),"bad conversion to HSB"),[t,n,i]}};export class Clipboard{static copy(t){Clipboard._copyPaste(asString(t),null)}static paste(t){Clipboard._copyPaste(null,asFunction(t))}static _copyPaste(t,e){let s=getActiveElement(),i=closest(s,".wj-control");for(;i&&Control.getControl(i);)i=i.parentElement;if(i=i||document.body){let n=createElement('<textarea class="wj-clipboard" style="position:fixed;opacity:0"/>',i),r=!1;n.onkeydown=(t=>{t.preventDefault()}),n.onchange=(t=>{t.stopImmediatePropagation()}),isString(t)?(n.value=t,n.select(),document.execCommand("copy")&&(r=!0)):(n.select(),isFunction(e)&&document.execCommand("paste")&&(e(n.value),r=!0)),setTimeout(()=>{s.focus(),removeChild(n),!r&&isFunction(e)&&e(n.value)},Control._CLIPBOARD_DELAY)}}};export function showPopup(t,e,s,i,n=!0){let r=document.body;if(e instanceof HTMLElement){if(!contains(document.body,e))return;for(let t=e;t;t=t.parentElement)if("DIALOG"==t.tagName||_isjQueryDialog(t)||"fixed"==getComputedStyle(t).position){r=t;break}}setCss(t,{display:"",opacity:"0",position:"fixed",left:0,top:0,transform:""}),t.offsetHeight&&t.offsetWidth&&t.parentElement==r||r.lastChild!=t&&r.appendChild(t);let o=document.body,a=new Point(o.scrollLeft||pageXOffset,o.scrollTop||pageYOffset),l=document.documentElement,h=l.clientWidth/window.innerWidth;if(r!=o||h>1.005){let e=r==o?l:t.offsetParent||r;if(e==o&&(e=r),e){let t=e.getBoundingClientRect();a=new Point(e.scrollLeft-t.left,e.scrollTop-t.top)}}let c=getComputedStyle(r);if(a.x-=parseFloat(c.borderLeftWidth),a.y-=parseFloat(c.borderTopWidth),e instanceof HTMLElement&&n){let s=n instanceof HTMLElement?n:e,i=getComputedStyle(s);1==new Color(i.backgroundColor).a&&setCss(t,{color:i.color,backgroundColor:i.backgroundColor,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontStyle:i.fontStyle})}Control.refreshAll(t);let u=getComputedStyle(t),d=parseFloat(u.marginTop)+parseFloat(u.marginBottom),g=parseFloat(u.marginLeft)+parseFloat(u.marginRight),p=new Size(t.offsetWidth+g,t.offsetHeight+d),_=hasClass(t,"wj-rtl")||"rtl"==t.getAttribute("dir"),f=new Point,m=null,C=l.clientWidth,b=l.clientHeight;if(e&&null!=e.clientX&&null!=e.clientY&&null!=e.pageX&&null!=e.pageY)e.clientX<=0&&e.clientY<=0&&e.target?m=e.target.getBoundingClientRect():(f.x=e.pageX-pageXOffset,f.y=e.pageY-pageYOffset,_&&(f.x-=p.width));else if(e instanceof Point)f=e,_&&(f.x-=p.width);else if(e instanceof HTMLElement)m=e.getBoundingClientRect();else if(e&&null!=e.top&&null!=e.left)m=e;else{if(null!=e)throw"Invalid ref parameter.";f.x=(C-p.width)/2,f.y=Math.round((b-p.height)/2*.7)}let y=parseFloat(u.minWidth);if(m){y=Math.max(y,m.width),!isIE()||e&&"TR"==e.tagName||(y-=t.offsetWidth-(t.clientWidth+parseInt(u.borderLeftWidth)+parseInt(u.borderRightWidth))),f.x=m.left;let i=m.top,n=b-m.bottom;f.y=s?i>p.height||i>n?m.top-p.height:m.bottom:n>p.height||n>i?m.bottom:m.top-p.height}f.y+p.height>b-20&&(f.y=Math.max(0,b-20-p.height)),f.x+p.width>C-20&&(f.x=Math.max(0,C-20-p.width)),f.x=Math.max(0,f.x)+a.x,f.y=Math.max(0,f.y)+a.y;let w={position:"absolute",opacity:i?"0":"",minWidth:y,zIndex:Control._POPUP_ZINDEX};0==a.x?(w.left=f.x,w.top=f.y):w.transform=format("translate({x}px, {y}px)",f),e instanceof HTMLElement&&(t[Control._OWNR_KEY]=e);let v=null;i&&(v=animate(e=>{t.style.opacity=e<1?e.toString():""})),setCss(t,w);let x=e instanceof MouseEvent?e.target:e;if(x instanceof HTMLElement&&x.parentElement!=document.body){let s=Date.now(),i=x.getBoundingClientRect(),n=new Control(document.createElement("div"));t[Control._SCRL_KEY]=n,n.addEventListener(document,"scroll",r=>{if(r.target!=t.parentElement&&Date.now()-s>100&&contains(document,x)&&!contains(t,r.target)&&(r.target!=document||null!=e&&"fixed"==t.style.position)){let e=x.getBoundingClientRect(),s=Math.abs(e.left-i.left),r=Math.abs(e.top-i.top);(s>1||r>1)&&(_hidePopup(t,!0),n.dispose())}},!0)}return v};export function hidePopup(t,e=!0,s=!1){let i=null;return s?i=animate(function(s){t.style.opacity=(1-s).toString(),1==s&&(_hidePopup(t,e),t.style.opacity="")}):_hidePopup(t,e),i};export class PrintDocument{constructor(t){this._copyCss=!0,null!=t&&copy(this,t)}get title(){return this._title}set title(t){this._title=asString(t)}get copyCss(){return this._copyCss}set copyCss(t){this._copyCss=asBoolean(t)}addCSS(t){this._css||(this._css=[]),this._css.push(t)}append(t){let e=this._getDocument(),s=e.body,i=!1;if(s)if(isString(t))s.appendChild(createElement(t));else if(t instanceof Node){let e=this._cloneNode(t);s.appendChild(e)}else i=!0;else if(isString(t))e.write(t);else if(t instanceof HTMLElement){let s=this._cloneNode(t);e.write(s.outerHTML)}else i=!0;i&&assert(!1,"child parameter should be an HTML node or an HTML string.")}print(){this._iframe&&(this._close(),setTimeout(()=>{var t=this._iframe.contentWindow,e="onafterprint"in t&&!isFirefox();e&&(t.onafterprint=(()=>{removeChild(this._iframe),this._iframe=null})),document.queryCommandSupported("print")?t.document.execCommand("print",!1,null):(t.focus(),t.print()),e||(removeChild(this._iframe),this._iframe=null)},100))}_cloneNode(t){let e=t.cloneNode(!0);return t instanceof HTMLElement&&e instanceof HTMLElement&&["select","textarea"].forEach(s=>{var i=t.querySelectorAll(s),n=e.querySelectorAll(s);for(let t=0;t<i.length;t++)n[t].value=i[t].value}),e}_getDocument(){return this._iframe||(this._iframe=document.createElement("iframe"),addClass(this._iframe,"wj-printdocument"),setCss(this._iframe,{position:"fixed",left:1e4,top:1e4}),document.body.appendChild(this._iframe),this._iframe.contentDocument.write('<body style="position:static"/>')),this._iframe.contentDocument}_close(){let t=this._getDocument();if(t.close(),t.title=null!=this.title?this.title:document.title,t.title&&t.title.trim()||(t.title=" "),this._copyCss){let t=document.head.querySelectorAll("link");for(let e=0;e<t.length;e++){let s=t[e];if(s.href.match(/\.css$/i)&&s.rel.match(/stylesheet/i)){let t=httpRequest(s.href,{async:!1});this._addStyle(t.responseText)}}let e=document.head.querySelectorAll("STYLE");for(let t=0;t<e.length;t++)this._addStyle(e[t].textContent)}if(this._css)for(let e=0;e<this._css.length;e++){let s=t.createElement("style"),i=httpRequest(this._css[e],{async:!1});s.textContent=i.responseText,t.head.appendChild(s)}}_addStyle(t){let e=this._getDocument(),s=e.createElement("style");s.textContent=t,e.head.appendChild(s)}};var theLic="The Wijmo license in this application ",_licStr={evl:"Wijmo Evaluation Version ({version})",prd:theLic+"is not valid for the <b>{control}</b> control.",ver:theLic+"is not valid for the version in use. The license version is <b>{licVer}</b>; the product version is <b>{version}</b>.",dmn:theLic+"is not valid for the current domain. The license domain is <b>{licDomain}</b>; the current domain is <b>{domain}</b>.",exp:theLic+"has expired. The license expiration date is <b>{expDate:d}</b>.",lic:theLic+"is invalid.",mss:theLic+"is not set.",ctc:'Please <a target="_blank" rel="noopener" href="https://www.grapecity.com/en/licensing/wijmo">create a license</a> or contact GrapeCity: <a href="mailto:us.sales@grapecity.com">us.sales@grapecity.com</a>.',hdr:"Wijmo License",cls:"CLOSE"},_codes={};export function _updateWme(t,e){let s=Control._wme;if(!(s&&contains(document.body,s)&&s.offsetWidth&&s.offsetHeight))if(e){let s=_getControlCode(t);_codes[s]||(_codes[s]=!0,_attorn(e,{algorithmCode:"B0",publicKey:"l6/zrbWoSbcLFwEetFh38rH3ErBZE9H+Cqix3R+wTlfA1wD5B+lUcCQn+EJ60I4RGrm0x1sFjkiLWwB0jAn6BWZv0W4WbqAKriOdeoivxDp1Wmjs3qkEDhvbsjPtfvwx2BHil6o+/tDrdMJQSGs18WZm2PoQLQuL+9VhZ4FNRHUQU3Jtioke/OZEGHJOdYVwvCGalzBad6QFOiVbDBQPePpS3++GJzOxN8SN/7lyS5/IdKiy3WJRaVGkB370+HbN6hKraDfUgReLX26yxRaKC/5aWnGAJ2NnWLoGyAGRcwT9dVjo4bcAZNrrA0U9JVKQxaSskhdv2p49XzJkltXx5w=="},s=>{_checkLicense(t,e,s)},()=>{_checkLicense(t,e,null)}),setTimeout(()=>{delete _codes[s]},50))}else _checkLicense(t,null,null)};var uint8Array="undefined"==typeof window?null:window.Uint8Array||window.TypedArray;export class _MaskProvider{constructor(t,e=null,s="_"){this._promptChar="_",this._mskArr=[],this._full=!0,this._hbInput=this._input.bind(this),this._hbKeyDown=this._keydown.bind(this),this._hbKeyPress=this._keypress.bind(this),this._hbCompositionStart=this._compositionstart.bind(this),this._hbCompositionEnd=this._compositionend.bind(this),this.mask=asString(e),this.input=t,this.promptChar=asString(s,!1),this._connect(!0),this._evtInput=document.createEvent("HTMLEvents"),this._evtInput.initEvent("input",!0,!1)}get input(){return this._tbx}set input(t){this._connect(!1),this._tbx=t,this._connect(!0)}get mask(){return this._msk}set mask(t){t!=this._msk&&(this._msk=asString(t,!0),this._parseMask(),this._valueChanged())}get promptChar(){return this._promptChar}set promptChar(t){t!=this._promptChar&&(this._promptChar=asString(t,!1),assert(1==this._promptChar.length,"promptChar must be a string with length 1."),this._valueChanged())}get maskFull(){return this._full}getMaskRange(){return this._mskArr.length?[this._firstPos,this._lastPos]:[0,this._tbx.value.length-1]}getRawValue(){let t=this._tbx?this._tbx.value:"";if(!this.mask)return t;let e="";for(let s=0;s<this._mskArr.length&&s<t.length;s++)this._mskArr[s].literal||t[s]==this._promptChar||(e+=t[s]);return e}refresh(){this._parseMask(),this._valueChanged()}_input(t){this._composing?t.stopImmediatePropagation():setTimeout(()=>{this._valueChanged()})}_keydown(t){if(t.keyCode==Key.Back){let e=this._tbx.selectionStart,s=this._tbx.selectionEnd;if(e<=this._firstPos&&s==e)return t.preventDefault(),void(this._backSpace=!1)}this._backSpace=t.keyCode==Key.Back}_keypress(t){t.ctrlKey||t.metaKey||t.altKey||this._composing||!this._preventKey(t.charCode)||t.preventDefault()}_compositionstart(t){this._composing=!0}_compositionend(t){this._composing&&(this._composing=!1,setTimeout(()=>{let t=this._tbx;t&&(this._valueChanged()||setSelectionRange(t,t.value.length),t.dispatchEvent(this._evtInput))}))}_preventKey(t){if(t&&this._mskArr.length){let e=this._tbx,s=e.selectionStart,i=String.fromCharCode(t);if(s<this._firstPos&&setSelectionRange(e,s=this._firstPos),s>=this._mskArr.length)return!0;let n=this._mskArr[s];if(n.literal)this._validatePosition(s);else if(n.wildCard!=i&&!this._isCharValid(n.wildCard,i))return!0}return!1}_connect(t){let e=this._tbx;e&&(assert(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,"INPUT or TEXTAREA element expected."),t?(this._autoComplete=e.autocomplete,this._spellCheck=e.spellcheck,e.autocomplete="off",e.spellcheck=!1,e.addEventListener("input",this._hbInput,!0),e.addEventListener("keydown",this._hbKeyDown,!0),e.addEventListener("keypress",this._hbKeyPress,!0),e.addEventListener("compositionstart",this._hbCompositionStart,!0),e.addEventListener("compositionend",this._hbCompositionEnd,!0),e.addEventListener("blur",this._hbCompositionEnd,!0),this._valueChanged()):(e.autocomplete=this._autoComplete,e.spellcheck=this._spellCheck,e.removeEventListener("input",this._hbInput),e.removeEventListener("keydown",this._hbKeyDown,!0),e.removeEventListener("keypress",this._hbKeyPress,!0),e.removeEventListener("compositionstart",this._hbCompositionStart,!0),e.removeEventListener("compositionend",this._hbCompositionEnd,!0),e.removeEventListener("blur",this._hbCompositionEnd,!0)))}_valueChanged(){if(!this._tbx||!this._msk)return!1;let t=this._tbx,e=t.value.length<2,s=t.selectionStart,i=s>0?t.value[s-1]:"",n=t.value;t.value=this._applyMask(),e&&(s=this._firstPos+1);let r=s>0?t.value[s-1]:"";return s>0&&r==this._promptChar&&i!=this.promptChar&&s--,s==n.length&&(s=this._matchEnd),this._validatePosition(s),n!=t.value}_applyMask(){this._full=!0,this._matchEnd=0;let t=this._tbx.value;if(!this._msk)return t;if(!t&&!this._tbx.required)return t;let e="",s=0,i=this._promptChar;t=this._handleVagueLiterals(t);for(let n=0;n<this._mskArr.length;n++){let r=this._mskArr[n],o=r.literal;if(o&&o==t[s]&&s++,r.wildCard){if(o=i,t){let n=s;for(;n<t.length;n++)if(this._isCharValid(r.wildCard,t[n])){switch(o=t[n],r.charCase){case">":o=o.toUpperCase();break;case"<":o=o.toLowerCase()}o!=i&&(this._matchEnd=e.length+1);break}s=n+1}o==i&&(this._full=!1)}e+=o}return e}_handleVagueLiterals(t){if(t.length>this._mskArr.length+1)return t;let e=t.length-this._mskArr.length;if(0!=e&&t.length>1){let s=-1,i=this._tbx,n=i==getActiveElement()?i.selectionStart:i.value.length;for(let t=Math.max(0,n-e);t<this._mskArr.length;t++)if(this._mskArr[t].vague){s=t;break}if(s>-1)if(e<0){let i=Array(1-e).join(this._promptChar),n=s+e;n>-1&&(t=t.substr(0,n)+i+t.substr(n))}else{for(;s>0&&this._mskArr[s-1].literal;)s--;t=t.substr(0,s)+t.substr(s+e)}}return t}_isCharValid(t,e){let s=this._promptChar;switch(t){case"0":return e>="0"&&e<="9"||e==s;case"9":return e>="0"&&e<="9"||" "==e||e==s;case"#":return e>="0"&&e<="9"||" "==e||"+"==e||"-"==e||e==s;case"L":return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==s;case"l":return e>="a"&&e<="z"||e>="A"&&e<="Z"||" "==e||e==s;case"A":return e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z"||e==s;case"a":return e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z"||" "==e||e==s;case"９":return e>="０"&&e<="９"||e==s;case"Ｊ":case"Ｇ":return!("Ｇ"==t&&_MaskProvider._X_DBCS_BIG_HIRA.indexOf(e)>-1)&&(e>="ぁ"&&e<="ゖ"||e==s);case"Ｋ":case"Ｎ":return!("Ｎ"==t&&_MaskProvider._X_DBCS_BIG_KATA.indexOf(e)>-1)&&(e>="ァ"&&e<="ヺ"||e==s);case"Ｚ":return e<="!"||e>="ÿ"||e==s;case"H":return e>="!"&&e<="ÿ"||e==s;case"K":case"N":return!("N"==t&&_MaskProvider._X_SBCS_BIG_KATA.indexOf(e)>-1)&&(e>="ｦ"&&e<="ﾟ"||e==s)}return!1}_validatePosition(t){let e=this._mskArr;if(this._backSpace)for(;t>0&&t<e.length&&e[t-1].literal;)t--;if(0==t||!this._backSpace)for(;t<e.length&&e[t].literal;)t++;getActiveElement()==this._tbx&&setSelectionRange(this._tbx,t),this._backSpace=!1}_parseMask(){this._mskArr=[],this._firstPos=-1,this._lastPos=-1;let t,e=this._msk,s="|";for(let i=0;e&&i<e.length;i++)switch(e[i]){case"0":case"9":case"#":case"A":case"a":case"L":case"l":case"９":case"Ｊ":case"Ｇ":case"Ｋ":case"Ｎ":case"Ｚ":case"K":case"N":case"H":this._firstPos<0&&(this._firstPos=this._mskArr.length),this._lastPos=this._mskArr.length,this._mskArr.push(new _MaskElement(e[i],s));break;case".":case",":case":":case"/":case"$":switch(e[i]){case".":case",":t=culture.Globalize.numberFormat[e[i]];break;case":":case"/":t=culture.Globalize.calendar[e[i]];break;case"$":t=culture.Globalize.numberFormat.currency.symbol}for(let e=0;e<t.length;e++)this._mskArr.push(new _MaskElement(t[e]));break;case"<":case">":case"|":s=e[i];break;case"\\":i<e.length-1&&i++,this._mskArr.push(new _MaskElement(e[i]));break;default:this._mskArr.push(new _MaskElement(e[i]))}for(let t=0;t<this._mskArr.length;t++){let e=this._mskArr[t];if(e.literal)for(let s=0;s<t;s++){let t=this._mskArr[s];if(t.wildCard&&this._isCharValid(t.wildCard,e.literal)){e.vague=!0;break}}}}};_MaskProvider._X_DBCS_BIG_HIRA="ぁぃぅぇぉっゃゅょゎゕゖ",_MaskProvider._X_DBCS_BIG_KATA="ァィゥェォッャュョヮヵヶ",_MaskProvider._X_SBCS_BIG_KATA="ｧｨｩｪｫｬｭｮｯ";export class _MaskElement{constructor(t,e){e?(this.wildCard=t,this.charCase=e):this.literal=t}};export class _ClickRepeater{constructor(t){this._isDown=!1,this._mousedownBnd=this._mousedown.bind(this),this._mouseupBnd=this._mouseup.bind(this),this._clickBnd=this._click.bind(this),this.element=t,this._connect(!0)}get element(){return this._e}set element(t){this._connect(!1),this._e=asType(t,HTMLElement,!0),this._connect(!0)}get disabled(){return this._disabled}set disabled(t){this._disabled=asBoolean(t)}_connect(t){if(this._e){t?this._e.addEventListener("mousedown",this._mousedownBnd):this._e.removeEventListener("mousedown",this._mousedownBnd)}}_clearTimeouts(){this._toRepeat&&(clearInterval(this._toRepeat),this._toRepeat=null),this._toDelay&&(clearInterval(this._toDelay),this._toDelay=null)}_mousedown(t){this._isDown&&this._mouseup(null),this._disabled||(this._isDown=!0,_ClickRepeater._stopEvents.forEach(t=>{document.addEventListener(t,this._mouseupBnd)}),this._clearTimeouts(),this._toDelay=setTimeout(()=>{this._isDown&&(this._click(),this._toRepeat=setTimeout(this._clickBnd,Control._CLICK_REPEAT))},Control._CLICK_DELAY))}_mouseup(t){this._isDown&&t&&"mouseup"==t.type&&t.preventDefault(),_ClickRepeater._stopEvents.forEach(t=>{document.removeEventListener(t,this._mouseupBnd)}),this._clearTimeouts(),this._isDown=!1}_click(){this._clearTimeouts(),this._e&&(this._e.click(),this._isDown&&(this._toRepeat=setTimeout(this._clickBnd,Control._CLICK_REPEAT)))}};_ClickRepeater._stopEvents=["mouseup","mouseout","keydown"];const _isMobile=null!=navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i);export function isMobile(){return _isMobile};const _isFF=null!=navigator.userAgent.match(/Firefox\//);export function isFirefox(){return _isFF};const _isSafari=null!=navigator.userAgent.match(/^((?!chrome|android).)*safari/i);export function isSafari(){return _isSafari};const _isEdge=null!=navigator.userAgent.match(/Edge\//);export function isEdge(){return _isEdge};const _isIE=null!=navigator.userAgent.match(/MSIE |Trident\/|Edge\//);export function isIE(){return _isIE};let _isIE9=!1;export function isIE9(){return _isIE9};let _isIE10=!1;export function isIE10(){return _isIE10};let _supportsPassive=!1;"undefined"!=typeof document&&document.addEventListener("test",t=>{},{get passive(){return _supportsPassive=!0,!0}});export function getEventOptions(t,e){return _supportsPassive?{capture:t,passive:e}:t};var _supportsFocusOptions=!1;"undefined"!=typeof document&&document.createElement("div").focus({get preventScroll(){return _supportsFocusOptions=!0,!0}});export function supportsFocusOptions(){return _supportsFocusOptions};export function _startDrag(t,e){t.effectAllowed=e,isFirefox()&&t.setData("text","")};if("undefined"!=typeof document&&document.doctype&&(navigator.appVersion.indexOf("MSIE 10")>-1&&(_isIE10=!0),navigator.appVersion.indexOf("MSIE 9")>-1&&(_isIE9=!0,document.addEventListener("mousemove",function(t){if(1==t.which){let e=closest(t.target,".wj-control");if(e&&!e.style.cursor)for(let e=t.target;e;e=e.parentElement)if(e.attributes&&e.attributes.draggable)return e.dragDrop(),!1}}))),"undefined"!=typeof window){let t="requestAnimationFrame";if(!window[t]){let e=0;window[t]=function(t){let s=Date.now(),i=16-(s-e),n=i>0?i:0;return e=s+n,setTimeout(function(){t(e)},n)},window.cancelAnimationFrame=clearTimeout}if(!window.atob){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e=new RegExp("[^"+t+"]");window.atob=function(s){let i,n,r,o,a=[],l=0,h=s.length;if(e.test(s)||/=/.test(s)&&(/=[^=]/.test(s)||/={3}/.test(s)))throw new Error("Invalid base64 data");for(h%4>0&&(h=(s+=Array(4-h%4+1).join("=")).length);l<h;){for(n=[],o=l;l<o+4;)n.push(t.indexOf(s.charAt(l++)));for(r=[((i=(n[0]<<18)+(n[1]<<12)+((63&n[2])<<6)+(63&n[3]))&255<<16)>>16,64===n[2]?-1:(65280&i)>>8,64===n[3]?-1:255&i],o=0;o<3;++o)(r[o]>=0||0===o)&&a.push(String.fromCharCode(r[o]))}return a.join("")},window.btoa=function(e){let s,i,n=[],r=0,o=e.length;for(;r<o;)s=((i=[e.charCodeAt(r++),e.charCodeAt(r++),e.charCodeAt(r++)])[0]<<16)+((i[1]||0)<<8)+(i[2]||0),n.push(t.charAt((s&63<<18)>>18),t.charAt((258048&s)>>12),t.charAt(isNaN(i[1])?64:(4032&s)>>6),t.charAt(isNaN(i[2])?64:63&s));return n.join("")}}}