@easyquery/enterprise 7.2.3-rc01 → 7.2.3-rc03

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see easyquery.enterprise.min.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("easyqueryCore")):"function"==typeof define&&define.amd?define("easyqueryEnterprise",["easyqueryCore"],e):"object"==typeof exports?exports.easyqueryEnterprise=e(require("easyqueryCore")):t.easyqueryEnterprise=e(t.easyqueryCore)}(window,(function(__WEBPACK_EXTERNAL_MODULE__0__){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(module,__webpack_exports__,__webpack_require__){"use strict";var browserUtils;__webpack_require__.d(__webpack_exports__,"a",(function(){return browserUtils})),function(browserUtils){var _isFirefox=null,_isIE=null;function IsIE(){if(null===_isIE){var t=navigator.userAgent;_isIE=t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1}return _isIE}function IsEdge(){return!IsIE()&&eval("!!window.StyleMedia")}function IsFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.IsIE=IsIE,browserUtils.IsEdge=IsEdge,browserUtils.IsFirefox=IsFirefox;var _detectedIsMobileMode=!1,_isMobileMode=void 0,detectIsMobileMode=function(){var t=isMobileMode();_detectedIsMobileMode=window.matchMedia("only screen and (max-width: 840px)").matches||window.matchMedia("only screen and (max-height: 420px)").matches;var e=isMobileMode();e!==t&&mobileModeChangeHandler&&mobileModeChangeHandler(e)},mobileModeChangeHandler;function isMobileMode(){return void 0!==_isMobileMode?_isMobileMode:_detectedIsMobileMode}function setIsMobileMode(t){var e=isMobileMode();_isMobileMode=t;var n=isMobileMode();n!==e&&mobileModeChangeHandler&&mobileModeChangeHandler(n)}function onMobileModeChanged(t){mobileModeChangeHandler=t}function getMobileCssClass(){return isMobileMode()?"k-mobile":null}detectIsMobileMode(),window.addEventListener("resize",(function(){return detectIsMobileMode()})),browserUtils.isMobileMode=isMobileMode,browserUtils.setIsMobileMode=setIsMobileMode,browserUtils.onMobileModeChanged=onMobileModeChanged,browserUtils.getMobileCssClass=getMobileCssClass}(browserUtils||(browserUtils={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"EqServerAggregatesCalculator",(function(){return qt})),n.d(e,"QueryEx",(function(){return y})),n.d(e,"QueryColumnEx",(function(){return g})),n.d(e,"ConditionEx",(function(){return p})),n.d(e,"DataModelEx",(function(){return C})),n.d(e,"EqServerQueryStorage",(function(){return v}));var i=n(0),r=[45,128,231];Math.trunc=Math.trunc||function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)};var o={__kt:0,ck:function(t){if(t&&t.length)try{for(var e=function(t){for(var e=function(t){var e=t;switch((e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")).length%4){case 0:break;case 2:e+="==";break;case 3:e+="="}return window.atob(e)}(t),n=e.length,i=new Uint8Array(n),r=0;r<n;r++)i[r]=e.charCodeAt(r);return i}(t.slice(0,t.length-12)),n=t.slice(t.length-12),i=!1,u=0,c=r;u<c.length;u++){var d=l(c[u]);if(n[0]===d[0]&&n[2]===d[1]){i=!0;break}}i||(o.__kt=-1);if(n[8]!=a(9,19))return void(o.__kt=-2);if(n[1]!=a(e[3]))return;if(o.__kt=n[3]!=a(e[5])?2:3,2===o.__kt){var h=""+function(t){for(var e=0,n=0;n<t.length;++n)e+=s.indexOf(t[n])*Math.pow(s.length,t.length-n-1);return e}(n.substring(4,6)+n.substring(10)),p=new Date(2e3+Number.parseInt(h.substring(0,2)),Number.parseInt(h.substring(2,4))-1,Number.parseInt(h.substring(4)),0,0,0,0);Date.now()>p.getTime()&&(o.__kt=1)}}catch(t){}else this.__kt=-3}};function a(t,e){return void 0===e&&(e=20),String.fromCharCode(65+t%e)}var s="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";function l(t){for(var e="";t>0;)e=s[t%s.length]+e,t/=s.length;return e}var u,c,d,h=(u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u(t,e)},function(t,e){function n(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.readOnly=!1,e.parameterized=!1,e.inJoin=!1,e}return h(e,t),e.prototype.isReadOnly=function(){return this.readOnly||this.getParent()&&this.getParent().isReadOnly()},e.prototype.setReadOnly=function(t){this.readOnly=t||this.getParent()&&this.getParent().isReadOnly(),this.conditions&&this.conditions.forEach((function(e){e.setReadOnly(t)}))},e.prototype.isParameterized=function(){return this.parameterized},e.prototype.setParameterized=function(t){this.parameterized=t},e.prototype.isInJoin=function(){return this.inJoin},e.prototype.setInJoin=function(t){this.inJoin=t},e.prototype.loadFromData=function(e,n){if(t.prototype.loadFromData.call(this,e,n),!(o.__kt<=1)&&(void 0!==n.readOnly&&this.setReadOnly(n.readOnly),void 0!==n.inJoin&&this.setInJoin(n.inJoin),void 0!==n.parameterized&&this.setParameterized(n.parameterized),n.conds))for(var i=0;i<n.conds.length;i++){var r=this.query.createCondition();r.loadFromData(e,n.conds[i]),this.conditions.push(r),r.setParent(this)}},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);if(o.__kt<=1)return e;if(this.isReadOnly()&&(e.readOnly=this.isReadOnly()),this.isParameterized()&&(e.parameterized=this.isParameterized()),this.isInJoin()&&(e.inJoin=this.isInJoin()),this.tag==i.CondTag.Group){e.conds=[];for(var n=0;n<this.conditions.length;n++)e.conds.push(this.conditions[n].saveToData())}return e},e}(i.Condition),f=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.readOnly=!1,e}return f(e,t),e.prototype.isReadOnly=function(){return this.readOnly},e.prototype.setReadOnly=function(t){this.readOnly=t},e.prototype.loadFromData=function(e,n){t.prototype.loadFromData.call(this,e,n),o.__kt<=2||n&&void 0!==n.readOnly&&(this.readOnly=n.readOnly)},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return o.__kt<=2||this.isReadOnly()&&(e.readOnly=this.isReadOnly()),e},e}(i.QueryColumn),m=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),y=function(t){function e(e){return t.call(this,e)||this}return m(e,t),e.prototype.isEx=function(){return o.__kt>1},e.prototype.createSubQuery=function(){return new e(this.model)},e.prototype.createCondition=function(e){return void 0===e&&(e=i.CondTag.Simple),o.__kt<=1?t.prototype.createCondition.call(this,e):new p(this,e)},e.prototype.createColumn=function(e){return void 0===e&&(e=!1),o.__kt<=1?t.prototype.createColumn.call(this,e):new g(this,e)},e.prototype.addConditionGroup=function(e,n){if(void 0===n&&(n=!0),o.__kt<=1)return t.prototype.addConditionGroup.call(this,e,n);var r=e.parent||this.getRootCondition(),a=e.linking||(r.linkType===i.LinkType.All?i.LinkType.Any:i.LinkType.All),s=this.createCondition(i.CondTag.Group);if(s.linkType=a,n){var l=this.getModel(),u=l.getFirstUICAttr(),c=l.getDefaultOperatorForAttr(u),d=this.createSimpleConditionObject(u,c,"");s.addCondition(d)}return r.addCondition(s),s},e.prototype.addExtraConditionGroup=function(e,n){return void 0===n&&(n=!0),e.parent=e.parent||this.extraConditions,o.__kt<=1?t.prototype.addExtraConditionGroup.call(this,e,n):this.addConditionGroup(e)},e}(i.Query),v=function(){function t(t){this.context=t}return t.prototype.init=function(){},t.prototype.newQuery=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=this.context.getModel(),i=t.modelId||(n?n.getId():"");t.queryId&&e.setId(t.queryId),t.name&&e.setName(t.name),t.description&&e.setDescription(t.description);var r={query:e.toJSONData()};t.data&&(r.data=t.data);var o=this.context.resolveEndpoint("NewQuery",{modelId:i});return this.context.getServices().getHttpClient().post(o,r).then((function(t){return t.query}))},t.prototype.getQueryList=function(t){var e=(t=t||{}).modelId||this.context.getModel().getId(),n=this.context.resolveEndpoint("GetQueryList",{modelId:e});return this.context.getServices().getHttpClient().get(n).then((function(t){return t.queries?t.queries:Promise.reject({message:"Wrong response format"})}))},t.prototype.loadQuery=function(t){t=t||{};var e=this.context.getModel(),n=this.context.getQuery(),i=t.modelId||e.getId(),r=t.queryId||n.getId(),o=this.context.resolveEndpoint("GetQuery",{modelId:i,queryId:r});return this.context.getServices().getHttpClient().get(o).then((function(t){return t.query}))},t.prototype.saveQuery=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=t.queryId||e.getId();t.queryId&&e.setId(t.queryId);var i=t.modelId||e.getModel().getId();t.queryId&&e.setId(t.queryId);var r={query:e.toJSONData()};t.data&&(r.data=t.data);var o=this.context.resolveEndpoint("SaveQuery",{modelId:i,queryId:n});return this.context.getServices().getHttpClient().put(o,r).then((function(t){return t.query}))},t.prototype.removeQuery=function(t){t=t||{};var e=this.context.getQuery(),n=t.modelId||e.getModel().getId(),i=t.queryId||e.getId(),r={modelId:n,queryId:i};t.data&&(r.data=t.data);var o=this.context.resolveEndpoint("RemoveQuery",{modelId:n,queryId:i});return this.context.getServices().getHttpClient().delete(o,r).getPromise()},t}(),b=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e.prototype.buildQueryPath=function(e){if(o.__kt<=1)return t.prototype.buildQueryPath.call(this,e);if(this.mainEntity)return t.prototype.buildQueryPath.call(this,e);var n=this.getEntitiesInQuery(e);if(0==n.length)throw Error("Cannon build path. Path is empty");for(var r=new i.Tree(n[0]),a=1;a<n.length;a++){var s=n[a];if(!r.contains(s)){var l=this.findPath(r.value,s);if(null==l)throw Error("Unable to build query. Cannot build path.");r=this.addPathToTree(r,l[0]===r.value?l.slice(1):l)}}return r.setParents(),r},e.prototype.addPathToTree=function(t,e){if(0!=e.length){for(var n=!1,r=0,o=t.childs;r<o.length;r++){var a=o[r];if(a.value===e[0]){n=!0,e.length>1&&(a=this.addPathToTree(a,e.slice(1)));break}}if(!n)if(this.findLink(t.value,e[0])){var s=new i.Tree(e[0]);t.addChild(s),e.length>1&&(s=this.addPathToTree(s,e.slice(1)))}else{if(t.parent)throw Error("Unable to build query. Cannot build path.");var l=new i.Tree(t);(t=new i.Tree(e[0])).addChild(l),e.length>1&&(t=this.addPathToTree(t,e.slice(1)))}return t}},e.prototype.findPath=function(t,e){var n=[],i=[],r=[],o=[],a=!1;for(n.push(t),i.push(n),o.push(t);!a;){r=[];for(var s=0,l=i;s<l.length;s++){var u=l[s];if(a=this.checkPath(u,e,r,o)){u.push(e),n=u;break}}if(i=[],!a){if(0==r.length)return null;for(var c=0,d=r;c<d.length;c++){u=d[c];i.push(u)}}}return n},e.prototype.checkPath=function(t,e,n,i){for(var r=t[t.length-1],o=0,a=this.getLinksByEntity(r);o<a.length;o++){var s=a[o],l=null;if((l=s.entityFrom==r?s.entityTo:s.entityFrom)==e)return n=[],!0;if(t.indexOf(l)<0&&i.indexOf(l)<0){i.push(l);var u=new Array;(u=u.concat(t)).push(l),n.push(u)}}return!1},e.prototype.createQuery=function(){return new y(this)},e}(i.DataModel),w=function(){function t(t){this.context=t,this.levelsTotals=[],this.prevRow=null,this.aggrContainer=new i.EqAggregatesContainer(t)}return t.prototype.getAggrContainer=function(){return this.aggrContainer},t.prototype.initObjects=function(){var t=this;this.aggrSettings=this.context.getQuery().getAggregationSettings(),this.groups=this.aggrSettings.getGroups(),this.aggregates=this.aggrSettings.getAggregates(),this.aggrColIds=this.aggrSettings.getAggregates().map((function(t){return t.colId})),this.aggrCols=this.context.resultTable.columns.getItems().filter((function(e){return t.aggrColIds.indexOf(e.id)>=0})),this.levelsTotals=[],this.prevRow=null},t.prototype.createColumnAggregatesObject=function(){return{sum:0,min:Number.MAX_VALUE,max:Number.MIN_VALUE}},t.prototype.calculate=function(t){this.initObjects(),this.aggrContainer.clear(),(t=t||{}).maxLevel=t.maxLevel>=0?t.maxLevel:0;for(var e=this.groups.length+1,n=0;n<e;n++){var i={count:0,columns:{}};this.resetLevelTotals(i),this.levelsTotals.push(i)}var r=this.context.resultTable.getCachedRows();if(r.length>0){for(var o=0,a=r;o<a.length;o++){var s=a[o];this.processDataRow(s)}for(n=1;n<e;n++)this.flushLevelTotals(n);this.aggrSettings.hasGrandTotals()&&this.flushLevelTotals(0)}return Promise.resolve()},t.prototype.resetLevelTotals=function(t){for(var e=0,n=this.aggrCols;e<n.length;e++){var i=n[e];t.columns[i.id]=this.createColumnAggregatesObject()}t.count=0},t.prototype.processDataRow=function(t){var e=this.checkLevelChange(t);if(e>=0)for(var n=e;n<this.levelsTotals.length;n++)this.flushLevelTotals(n);this.aggrSettings.hasGrandTotals()&&this.updateLevelTotals(0,t);for(var i=1,r=0,o=this.groups;r<o.length;r++){o[r];this.updateLevelTotals(i,t),i++}this.prevRow=t},t.prototype.checkLevelChange=function(t){if(null==this.prevRow)return-1;for(var e=0;e<this.groups.length;e++)for(var n=0,i=this.groups[e].columns;n<i.length;n++){var r=i[n],o=t.getValue(r),a=this.prevRow.getValue(r);if(!this.aggrSettings.compareValues(a,o))return e+1}return-1},t.prototype.flushLevelTotals=function(t){for(var e=this.levelsTotals[t],n=t>0?this.groups[t-1]:null,i=this.aggrSettings.buildGroupKey(n,this.prevRow),r={},o=0,a=this.aggregates;o<a.length;o++){var s=a[o],l=e.columns[s.colId];switch(s.funcId){case"SUM":r[s.colId]=l.sum;break;case"AVG":r[s.colId]=l.sum/e.count;break;case"COUNT":case"CNTDST":r[s.colId]=e.count;break;case"MIN":r[s.colId]=l.min;break;case"MAX":r[s.colId]=l.max}}this.aggrSettings.hasRecordCount()&&(r[this.aggrSettings.COUNT_FIELD_NAME]=e.count),this.aggrContainer.updateAggregateData(t,i,r),this.resetLevelTotals(e)},t.prototype.updateLevelTotals=function(t,e){var n=this.levelsTotals[t];n.count+=1;for(var i=0,r=this.aggregates;i<r.length;i++){var o=r[i],a=e.getValue(o.colId),s=n.columns[o.colId];s.sum+=a,a<s.min&&(s.min=a),a>s.max&&(s.max=a)}},t.prototype.needRecalculation=function(){return!0},t.prototype.reset=function(){},t}();!function(t){t[t.Unknown=0]="Unknown",t[t.String=1]="String",t[t.Byte=2]="Byte",t[t.Word=3]="Word",t[t.Int32=4]="Int32",t[t.Int64=5]="Int64",t[t.Bool=6]="Bool",t[t.Float=7]="Float",t[t.Currency=8]="Currency",t[t.BCD=9]="BCD",t[t.Date=10]="Date",t[t.Time=11]="Time",t[t.DateTime=12]="DateTime",t[t.Autoinc=13]="Autoinc",t[t.Memo=14]="Memo",t[t.Blob=15]="Blob",t[t.FixedChar=16]="FixedChar",t[t.Guid=17]="Guid",t[t.Geometry=18]="Geometry",t[t.Geography=19]="Geography"}(c||(c={})),function(t){t[t.Data=0]="Data",t[t.Virtual=1]="Virtual",t[t.Lookup=2]="Lookup"}(d||(d={}));var D,x="Unknown",E="EDIT",T="DATETIME";!function(t){t.Trace="TRACE",t.Options="OPTIONS",t.Get="GET",t.Put="PUT",t.Post="POST",t.Delete="DELETE"}(D||(D={}));var I,S,k=function(){function t(t,e){this.xhr=t,this.method=e.method,this.url=e.url,this.headers=e.headers,this.queryParams=e.queryParams,this.data=e.data}return t.prototype.setHeader=function(t,e){this.headers[t]=e},t.prototype.setQueryParam=function(t,e){this.queryParams[t]=e},t.prototype.getXMLHttpRequest=function(){return this.xhr},t.prototype.getResponseHeaders=function(){if(this.xhr.readyState==this.xhr.HEADERS_RECEIVED){for(var t={},e=0,n=this.xhr.getAllResponseHeaders().trim().split(/[\r\n]+/);e<n.length;e++){var i=n[e].split(": "),r=i.shift(),o=i.join(": ");t[r]=o}return t}return{}},t.prototype.open=function(){var t=this;if(this.xhr.readyState===this.xhr.UNSENT){var e=this.url;for(var n in this.queryParams&&Object.keys(this.queryParams).length>0&&(e+=encodeURI("?"+Object.keys(this.queryParams).map((function(e){return e+"="+t.queryParams[e]})).join("&"))),this.xhr.open(this.method,e,!0),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.headers)this.xhr.setRequestHeader(n,this.headers[n])}},t.prototype.abort=function(){this.xhr.abort()},t}();function M(t,e){for(var n="",i=0;i<e;i++)n+=t;return n}!function(t){var e,n={shortDateFormat:"MM/dd/yyyy",longDateFormat:"dd MMM, yyyy",editDateFormat:"MM/dd/yyyy",shortTimeFormat:"HH:mm",editTimeFormat:"HH:mm",longTimeFormat:"HH:mm:ss",shortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],shortWeekDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longWeekDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],decimalSeparator:".",currency:"USD"},i={localeId:"en-US",englishName:"English",displayName:"English",texts:{ButtonOK:"OK",ButtonCancel:"Cancel",Yes:"Yes",No:"No",True:"True",False:"False"},settings:n},r={"en-US":i},o=[];function a(t){for(var e=0,n=o;e<n.length;e++){(0,n[e])(t)}}function s(){return e.localeId}function l(t){var n=r[t];n?S.assignDeep(e,n):(e.englishName=t,e.displayName=t,e.texts=S.assignDeep({},i.texts)),e.localeId=t}function u(){return e.settings}function d(t){e.settings||(e.settings=S.assignDeep({},n)),e.settings=S.assignDeep(e.settings,t)}function h(t,n){a(n);var o=e;t&&(n.localeId||(n.localeId=t),(o=r[t])||(o=S.assignDeep({},i),r[t]=o)),S.assignDeep(o,n)}function p(){var t,n,i,r,o,a,s="object"==typeof navigator?navigator.language:void 0;t=s,n=new Date(2020,5,7,19,34,56,88),i=n.toLocaleDateString(t,{year:"numeric",month:"numeric",day:"numeric"}),r=n.toLocaleTimeString(t,{hour:"numeric",minute:"numeric",second:"numeric"}),o=i.replace("07","dd").replace("7","d").replace("06","MM").replace("6","M").replace("2020","yyyy").replace("20","yy"),a=r.replace("19","HH").replace("07","hh").replace("7","h").replace("34","mm").replace("56","ss").replace("PM","tt"),e.settings||(e.settings={}),d({shortDateFormat:o,shortTimeFormat:a})}function f(t){var e,n=u();switch(t){case c.Date:e=n.shortDateFormat;break;case c.Time:e=n.shortTimeFormat;break;default:e=n.shortDateFormat+" "+n.shortTimeFormat}return e}function g(t){var e,n=u();switch(t){case c.Date:e=n.longDateFormat;break;case c.Time:e=n.longTimeFormat;break;default:e=n.longDateFormat+" "+n.longTimeFormat}return e}t.addMapper=function(t){o.push(t)},t.getLocales=function(){var t=[];for(var e in r)t.push({locale:e,englishName:r[e].englishName,displayName:r[e].displayName});return t.sort((function(t,e){return t.englishName>e.englishName?1:t.englishName===e.englishName?0:-1}))},t.getCurrentLocale=s,t.setLocale=function(t){console.warn("This method is deprecated. Use setCurrentLocale instead"),l(t)},t.setCurrentLocale=l,t.getText=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=e.texts,r="";if(t&&t.length)for(var o=t.length,a=0;a<o&&"object"==typeof(r=i[t[a]]);a++)i=r;return r},t.getLocaleSettings=u,t.getOneLocaleSetting=function(t){return e.settings[t]},t.getShortMonthName=function(t){var e=u();if(t>0&&t<13)return e.shortMonthNames[t-1];throw"Wrong month number: "+t},t.getLongMonthName=function(t){var e=u();if(t>0&&t<13)return e.longMonthNames[t-1];throw"Wrong month number: "+t},t.getShortWeekDayName=function(t){var e=u();if(t>0&&t<8)return e.shortWeekDayNames.length>=t?e.shortWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.getLongWeekDayName=function(t){var e=u();if(t>0&&t<8)return e.longWeekDayNames.length>=t?e.longWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.updateLocaleSettings=d,t.updateLocaleTexts=function(t){"object"==typeof t?(a({localeId:e.localeId,texts:t}),S.assignDeep(e.texts,t)):console.error("Wrong parameter type in updateLocaleTexts function call.The first parameter (localeId) is not necessary. Use updateLocaleTexts(texts) instead")},t.updateDefaultTexts=function(t){for(var n in r){var i=r[n];i.texts=S.assignDeep({},t,i.texts)}e.texts=S.assignDeep({},t,e.texts)},t.updateLocaleInfo=h,t.addLocale=function(t,e){h(t,e)},t.resetLocales=function(){e||(e=S.assignDeep({},i),p())},t.dateTimeToStr=function(t,e,n){return n?"d"==n?n=f(c.Date):"D"==n?n=g(c.Date):"f"==n?n=f(c.DateTime):"F"==n&&(n=g(c.DateTime)):n=f(e),S.dateTimeToStr(t,n)},t.numberToStr=function(e,n){if(n&&n.length>0){var i=n.charAt(0).toUpperCase();if("S"===i)return function(e,n){if(!m[n]){var i=n.split("|").filter((function(t){return t.length>0})).map((function(t){return t.split("=")}));if(m[n]={},i.length>0)if(i[0].length>1)for(var r=0,o=i;r<o.length;r++){var a=o[r];m[n][Number.parseInt(a[1])]=a[0]}else i.forEach((function(t,e){m[n][e]=t[0]}))}var s=m[n];if(void 0!==s[e]){a=s[e];return t.getText(a)||a}return e.toString()}(e,n.slice(1));if(["D","F","C"].indexOf(i)>=0){var r=s();return e.toLocaleString(r,function(t){var e=u(),n=t[0].toUpperCase(),i=t.length>1?Number.parseInt(t.slice(1)):"D"==n?1:2;switch(n){case"D":return{style:"decimal",useGrouping:!1,minimumIntegerDigits:i};case"C":return{style:"currency",currency:e.currency,minimumFractionDigits:i};default:return{style:"decimal",minimumFractionDigits:i,maximumFractionDigits:i}}}(n))}return function(t,e){for(var n=t.toString(),i="",r=n.length-1,o=e.length-1;o>=0;o--){var a=e.charAt(o);"#"===a||"0"===a?r>=0?(i+=n.charAt(r),r--):"0"===a&&(i+=0):i+=a}return i.split("").reverse().join("")}(Math.trunc(e),n)}var o=u();return S.numberToStr(e,o.decimalSeparator)},t.booleanToStr=function(e,n){if(n&&n.length>0&&"S"===n.charAt(0).toUpperCase()){var i=n.slice(1).split("|");if(i.length>1){var r=i[e?1:0];return t.getText(r)||r}}return""+e};var m={}}(I||(I={})),function(t){t.getAllDataTypes=function(){return Object.values(c).filter((function(t){return"number"==typeof t}))},t.getDateDataTypes=function(){return[c.Time,c.Date,c.DateTime]},t.getStringDataTypes=function(){return[c.String,c.Memo,c.FixedChar]};var e=[c.Byte,c.Word,c.Int32,c.Int64,c.Float,c.Currency,c.Autoinc];t.getNumericDataTypes=function(){return e};var n=[c.Byte,c.Word,c.Int32,c.Int64,c.Autoinc];function i(t,e,n){e||(e={});for(var o=0,a=n;o<a.length;o++){var s=a[o];if(s)for(var l in s)if(s.hasOwnProperty(l)){var u=s[l];null!==u&&"object"==typeof u?t.has(u)?e[l]=t.get(u):Array.isArray(u)?(e[l]=r(u),t.set(u,e[l])):(void 0!==e[l]&&null!=e[l]||(e[l]=Object.create(Object.getPrototypeOf(u))),t.set(u,e[l]),i(t,e[l],[u])):e[l]=u}}return e}function r(t){for(var e=[],n=0,i=t;n<i.length;n++){var r=i[n];e.push(r)}return e}t.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var i=0;i<e.length;i++){var r=e[i];if(r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t},t.assignDeep=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return i(new WeakMap,t,e)},t.getIfDefined=function(t,e){return void 0!==t?t:e},t.IsDefinedAndNotNull=function(t){return null!=t},t.copyArrayTo=function(t,e){for(var n=t.length,i=e.length,r=0;r<n&&r<i;r++)e[r]=t[r]},t.createArrayFrom=r,t.findItemById=function(t,e){for(var n=t.length,i=0;i<n;i++)if(t[i].id===e)return t[i];return null},t.findItemIndexById=function(t,e){for(var n=t.length,i=0;i<n;i++)if(t[i].id===e)return i;return-1},t.indexOfArrayItem=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=t.length,i=0;i<n;i++)if(e==t[i])return i;return-1},t.moveArrayItem=function(t,e,n){if(e>=t.length)throw"Index out of bounds: "+e;n>=t.length&&(n=t.length-1);var i=t.splice(e,1)[0];t.splice(n,0,i)},t.removeArrayItem=function(t,e){var n=t.indexOf(e);if(-1!=n)return t.splice(n,1)[0]},t.insertArrayItem=function(t,e,n){t.splice(e,0,n)},t.fillArray=function(t,e,n,i){void 0===n&&(n=0);for(var r=t.length>>>0,o=n>>0,a=o<0?Math.max(r+o,0):Math.min(o,r),s=void 0===i?r:i>>0,l=s<0?Math.max(r+s,0):Math.min(s,r);a<l;)t[a]=e,a++;return t},t.shiftToFitWindow=function(t,e){var n=document.getElementsByTagName("body")[0],i=window.innerWidth||document.documentElement.clientWidth||n.clientWidth,r=t+e,o=0;return r>i&&t+(o=i-r-10)<0&&(o=10-t),o},t.isObject=function(t){return null!==t&&("function"==typeof t||"object"==typeof t)},t.isNumericType=function(t){return e.indexOf(t)>=0},t.isIntType=function(t){return n.indexOf(t)>=0},t.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},t.areCompatibleDataTypes=function(t,e){return void 0===t||void 0===e||t==c.Unknown||e==c.Unknown||t==e||t==c.Date&&e==c.DateTime||t==c.DateTime&&e==c.Date},t.isPropSet=function(t,e){return t[e]||t[e.toLowerCase()]||t[e.toUpperCase()]};var o="0123456789abcdefghijklmnopqrstuvwxyz";function a(t,e){var n=t.length;if(n>e){var i=n/e,r="";r+=t[0];for(var o=i,a=void 0,s=1;s<n;s++)a=t[s],s+1>o&&(r+=a,o+=i);return r}return t}function s(t,e,n){return t.substr(0,e)+n+t.substr(e+n.length)}function l(t,e){return Math.floor(Math.random()*(e-t))+t}function u(t){var e=parseInt(t);if(isNaN(e))throw'"'+t+'" is not a valid number';return e}t.generateId=function(t){t||(t="easy");var e=t.length>4?function(t,e){var n=t.split("-"),i=1,r=e;n.length<e&&(i=e/n.length,r=n.length);for(var o="",s=0;s<r;s++)o+=a(n[s],i);return o}(t,4):t;e&&e.length>0&&(e+="-");var n=M("",2),i=o.length-1;return n=s(n,0,o[l(0,i)]),e+(n=s(n,1,o[l(0,i)]))+function(t){var e=36,n=14,i=M("",n),r=t;do{i=s(i,n--,o[r%e]),r=Math.floor(r/=e)}while(r>0);return a=i.trim(),a.split("").reverse().join("");var a}(621355968e9+1e4*(new Date).getTime()-0x8d60e562e627800)},t.strToDateTime=function(t,e){if(!t||0==t.length)return new Date;var n=t.replace(/[^a-zA-Z0-9_]/g,"-"),i=e.replace(/[^a-zA-Z0-9_]/g,"-").split("-"),r=n.split("-"),o=i.indexOf("MM"),a=i.indexOf("dd"),s=i.indexOf("yyyy"),l=i.indexOf("HH"),c=i.indexOf("mm"),d=i.indexOf("ss"),h=new Date;try{var p=s>-1&&s<r.length?u(r[s]):h.getFullYear(),f=o>-1&&o<r.length?u(r[o])-1:h.getMonth()-1;if(f>11)throw"";var g=a>-1&&a<r.length?u(r[a]):h.getDate();if(g>function(t,e){return new Date(e,t+1,0).getDate()}(f,p))throw"";var m=l>-1&&l<r.length?u(r[l]):0;if(m>23)throw"";var y=c>-1&&c<r.length?u(r[c]):0;if(y>59)throw"";var v=d>-1&&d<r.length?u(r[d]):0;if(v>59)throw"";return new Date(p,f,g,m,y,v)}catch(e){throw t+" is not a valid date."}},t.strToTime=function(t){var e=t.split(":");try{var n=e.length>0?u(e[0]):0;if(n>23)throw"";var i=e.length>1?u(e[1]):0;if(i>59)throw"";var r=e.length>1?u(e[1]):0;if(r>59)throw"";return new Date(0,0,0,n,i,r)}catch(e){throw t+" is not a valid time."}};var d=/\[([^\]]+)]|y{2,4}|M{1,4}|d{1,2}|H{1,2}|h{1,2}|m{2}|s{2}|t{2}/g;t.dateTimeToStr=function(t,e){var n=t.getFullYear().toString(),i=t.getMonth()+1,r=t.getDate(),o=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),l=o%12||12,u=o>11,c={yyyy:n,yy:n.substring(n.length-2),MMMM:I.getLongMonthName(i),MMM:I.getShortMonthName(i),MM:i<10?"0"+i:i.toString(),M:i.toString(),dd:r<10?"0"+r:r.toString(),d:r.toString(),HH:o<10?"0"+o:o.toString(),H:o.toString(),hh:l<10?"0"+l:l.toString(),h:l.toString(),tt:u?"PM":"AM",mm:a<10?"0"+a:a.toString(),ss:s<10?"0"+s:s.toString()};return e.replace(d,(function(t,e){return e||c[t]}))},t.numberToStr=function(t,e){return e=e||I.getLocaleSettings().decimalSeparator,t.toString().replace(".",e)}}(S||(S={}));var O,P=function(){function t(t,e){this.request=t,this.promise=e}return t.prototype.getPromise=function(){return this.promise},t.prototype.getRequest=function(){return this.request},t.prototype.then=function(t,e){return this.promise.then(t,e)},t.prototype.catch=function(t){return this.promise.catch(t)},t.prototype.finally=function(t){return this.promise.finally(t)},t}(),R=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),A=function(){return A=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},A.apply(this,arguments)},_=function(t){function e(e,n){var i=t.call(this,n)||this;return i.status=e,i}return R(e,t),e}(Error),L=function(){function t(){this.defaultHeaders={},this.customPayload=void 0}return Object.defineProperty(t.prototype,"responseBody",{get:function(){return this._responseBody},enumerable:!0,configurable:!0}),t.prototype.get=function(t,e){return this.send(D.Get,t,null,e)},t.prototype.post=function(t,e,n){return this.send(D.Post,t,e,n)},t.prototype.put=function(t,e,n){return this.send(D.Put,t,e,n)},t.prototype.delete=function(t,e,n){return this.send(D.Delete,t,e,n)},t.prototype.send=function(e,n,i,r){var o=this,a=(r=r||{}).dataType||"json",s=r.contentType||"form-data"!==a?"application/json":null;i&&"form-data"!=a&&this.customPayload&&(i.data=S.assignDeep(i.data||{},this.customPayload));var l=new("onload"in new XMLHttpRequest?XMLHttpRequest:window.XDomainRequest),u={method:e,url:n,headers:A(A({},this.defaultHeaders),r.headers||{}),queryParams:r.queryParams||{},data:i};s&&(u.headers["Content-Type"]=s);var c=new k(l,u);this.beforeEachRequest&&(console.warn("HttpClient: 'beforeEachRequest' is deprecated and will be removed in future updates.\n Use 'onRequest' instead"),this.beforeEachRequest(c)),this.onRequest&&this.onRequest(c);var d=c.data&&"string"!=typeof c.data&&"json"==a?JSON.stringify(c.data):c.data;return c.open(),new P(c,new Promise((function(e,i){r.responseType&&(l.responseType=r.responseType),l.onerror=function(t){i(new _(l.status,l.responseText))},l.onreadystatechange=function(){if(4==l.readyState){var r=l.getResponseHeader("Content-Type")||"",a=l.status;if(0===a)i(new _(a,"Network error or the request was aborted"));else if(a>=200&&a<400){var s="arraybuffer"===l.responseType||"blob"===l.responseType?l.response:0==r.indexOf("application/json")?JSON.parse(l.responseText):l.responseText;o._responseBody=s,o.onResponse&&o.onResponse(l),e(s)}else{("arraybuffer"===l.responseType||"blob"===l.responseType?t.decodeArrayBuffer(l.response):Promise.resolve(l.responseText)).then((function(t){var e=0==r.indexOf("application/json")?JSON.parse(t):t;o._responseBody=e;var s=e.message||(404==a?"No such endpoint: "+n:e);i(new _(a,s))}))}}},l.send(d)})))},t.decodeArrayBuffer=function(t){var e=new FileReader;return new Promise((function(n){e.onloadend=function(){e.readyState==FileReader.DONE&&n(e.result)},e.readAsText(new Blob([t]))}))},t}(),N=function(){function t(t){this.isEditable=!0,this.name="",this.caption="",this.description="",this.parent=t,this.attributes=new Array,this.subEntities=new Array}return t.prototype.loadFromData=function(t,e){if(e){if(this.id=e.id,this.name=e.name,this.captionPlural=e.namePlur,this.caption=e.name,this.description=e.desc,void 0!==e.ied&&(this.isEditable=e.ied),this.subEntities=new Array,e.ents)for(var n=0;n<e.ents.length;n++){var i=t.createEntity(this);i.loadFromData(t,e.ents[n]),this.subEntities.push(i)}if(this.attributes=new Array,e.attrs)for(n=0;n<e.attrs.length;n++){var r=t.createEntityAttr(this);r.loadFromData(t,e.attrs[n]),this.attributes.push(r)}}},t.prototype.scan=function(t,e){var n={stop:!1},i=function(r){if(e&&e(r,n),r.attributes)for(var o=r.attributes.length,a=0;a<o&&!n.stop;a++){var s=r.attributes[a];if(t&&t(s,n),n.stop)return}if(r.subEntities){var l=r.subEntities.length;for(a=0;a<l&&!n.stop;a++)i(r.subEntities[a])}};i(this)},t.prototype.getFirstPrimaryAttr=function(){return this.getPrimaryAttrs()[0]},t.prototype.getPrimaryAttrs=function(){return this.attributes.filter((function(t){return t.isPrimaryKey}))},t}(),F=function(){function t(t){this.id="",this.caption="{Unrecognized attribute}",this.dataType=c.String,this.size=0,this.isPrimaryKey=!1,this.isForeignKey=!1,this.isNullable=!0,this.showOnView=!0,this.isEditable=!0,this.showOnCreate=!0,this.showOnEdit=!0,this.showInLookup=!1,this.lookupAttr="",this.expr="",this.entity=t,this.kind=d.Data}return t.prototype.loadFromData=function(t,e){if(e){this.id=e.id,this.description=e.desc,this.caption=e.cptn,this.dataType=e.dtype,this.isPrimaryKey=e.ipk,this.isForeignKey=e.ifk,this.size=e.size,this.lookupAttr=e.lattr,this.lookupEntity=e.lent,this.dataAttr=e.dattr,this.lookupDataAttr=e.ldattr;var n=S.getDateDataTypes().indexOf(this.dataType);this.defaultValue=e.defVal&&n?new Date(e.defVal):e.defVal,this.isNullable=S.getIfDefined(e.nul,this.isNullable),this.isEditable=S.getIfDefined(e.ied,this.isEditable),this.showOnView=S.getIfDefined(e.ivis||e.sov,this.showOnView),this.showOnCreate=S.getIfDefined(e.soc,this.showOnCreate),this.showOnEdit=S.getIfDefined(e.soe,this.showOnEdit),this.showInLookup=S.getIfDefined(e.sil,this.showInLookup),this.kind=e.kind,this.displayFormat=e.dfmt,e.udata&&(this.userData=e.udata),e.edtr&&(this.defaultEditor=t.getEditorById(e.edtr)||t.createValueEditor())}},t}(),B=function(){function t(){this.id="",this.tag=x,this.resType=c.Unknown,this.defValue=""}return t.prototype.loadFromData=function(t){t&&(this.id=t.id,this.tag=t.tag,this.defValue=t.defval,this.resType=t.rtype,this.accept=t.accept,this.multiline=t.multiline,t.subType&&(this.resType=t.subType),t.name&&(this.name=t.name),t.values&&(this.values=t.values))},t.prototype.getValueText=function(t){var e="";if(!this.values)return e;if(Array.isArray(t))for(var n=0,i=this.values;n<i.length;n++){var r=i[n];t.indexOf(r.id)>=0&&(e+=r.text+",")}else for(var o=0,a=this.values;o<a.length;o++){(r=a[o]).id===t&&(e+=r.text+",")}return e&&(e=e.substring(0,e.length-1)),e},t}(),q=(function(){function t(){this.mainEntity=null,this.id="__none",this.name="Empty model",this.rootEntity=this.createEntity(),this.displayFormats=new Map}t.prototype.getMainEntity=function(){return this.mainEntity},t.prototype.createEntity=function(t){return new N(t)},t.prototype.createEntityAttr=function(t){return new F(t)},t.prototype.createValueEditor=function(){return new B},t.prototype.loadFromJSON=function(t){var e=JSON.parse(t);this.loadFromData(e)},t.prototype.loadFromData=function(t){if(this.id=t.id,this.name=t.name,this.version=t.vers,this.editors=new Array,t.editors)for(var e=0;e<t.editors.length;e++){var n=this.createValueEditor();n.loadFromData(t.editors[e]),this.editors.push(n)}if(this.rootEntity.loadFromData(this,t.entroot),this.displayFormats=new Map,t.displayFormats)for(var i in t.displayFormats){var r=c[i],o=t.displayFormats[i]||new Array;this.displayFormats.set(r,o)}},t.prototype.getDisplayFormats=function(){return this.displayFormats},t.prototype.getDisplayFormatsForType=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t):[]},t.prototype.getDefaultFormat=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t).filter((function(t){return t.isdef}))[0]:null},t.prototype.setData=function(t){"string"==typeof t?this.loadFromJSON(t):this.loadFromData(t)},t.prototype.isEmpty=function(){return 0===this.rootEntity.subEntities.length&&0===this.rootEntity.attributes.length},t.prototype.getId=function(){return this.id},t.prototype.getName=function(){return this.name},t.prototype.getRootEntity=function(){return this.rootEntity},t.prototype.getEditorById=function(t){for(var e=0,n=this.editors;e<n.length;e++){var i=n[e];if(i.id===t)return i}return null},t.prototype.getAttributeById=function(t){var e=this.getEntityAttrById(this.getRootEntity(),t);return e||null},t.prototype.checkAttrProperty=function(t,e){var n=this.getAttributeById(t);if(n){if(void 0===n[e])throw"No such property: "+e;return!!n[e]||!!n.lookupAttr&&(t=n.lookupAttr,(n=this.getAttributeById(t))&&n[e])}return!1},t.prototype.getEntityAttrById=function(t,e){var n,i;if(t.attributes){var r=t.attributes.length;for(n=0;n<r;n++)if(t.attributes[n].id==e)return t.attributes[n]}if(t.subEntities){var o=t.subEntities.length;for(n=0;n<o;n++)if(i=this.getEntityAttrById(t.subEntities[n],e))return i}return null},t.prototype.listByEntityWithFilter=function(t,e){var n,i=new Array,r=null;if(t.subEntities)for(var o=t.subEntities.length,a=0;a<o;a++){if(r=t.subEntities[a],!e||e(r,null))(n=I.getText("Entities",r.name))||(n=r.caption),(c=S.assign(this.createEntity(),{id:r.name,text:n,items:[],isEntity:!0})).items=this.listByEntityWithFilter(r,e),c.items.length>0&&i.push(c)}var s=null;if(t.attributes)for(var l=t.attributes.length,u=0;u<l;u++)if(s=t.attributes[u],!e||e(t,s)){(n=I.getText("Attributes",s.id))||(n=s.caption);var c=S.assign(this.createEntity(),{id:s.id,text:n,dataType:s.dataType});i.push(c)}return i},t.prototype.listByEntity=function(t,e,n){e=e||{};var i,r=[],o=[],a=null;if(t.subEntities)for(var s=t.subEntities.length,l=0;l<s;l++)if(a=t.subEntities[l],!n||n(a,null)){i=I.getText("Entities",a.name)||a.caption;var u=S.assign(this.createEntity(),{id:a.name,text:i,items:[],isEntity:!0,description:a.description}),c=S.assign({},e);c.includeRootData=!1,u.items=this.listByEntity(a,c,n),u.items.length>0&&r.push(u)}var d=null;if(t.attributes)for(var h=t.attributes.length,p=0;p<h;p++)d=t.attributes[p],n&&!n(t,d)||(i=I.getText("Attributes",d.id)||d.caption,o.push(S.assign(this.createEntityAttr(t),{id:d.id,text:i,dataType:d.dataType,lookupAttr:d.lookupAttr,description:d.description})));var f,g=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(r.sort(g),o.sort(g)),f=e.attrPlacement&&0!=e.attrPlacement?o.concat(r):r.concat(o),2==e.attrPlacement&&f.sort(g),e.includeRootData?((i=I.getText("Entities",t.name))||(i=t.caption),{id:t.name,text:i,items:f}):f},t.prototype.clear=function(){this.rootEntity=this.createEntity(),this.editors=[],this.version=""},t.prototype.addDefaultValueEditors=function(){this.addOrUpdateValueEditor("_DTE",E,c.String).defValue="",this.addOrUpdateValueEditor("_DPDE",T,c.DateTime),this.addOrUpdateValueEditor("_DPTE",T,c.DateTime)},t.prototype.addOrUpdateValueEditor=function(t,e,n){var i=S.findItemById(this.editors,t);return i||((i=this.createValueEditor()).id=t,this.editors.push(i)),i.tag=e,i.resType=n,i},t.prototype.getEntitiesTree=function(t,e){return this.listByEntity(this.getRootEntity(),t,e)},t.prototype.getEntitiesTreeWithFilter=function(t){return this.listByEntityWithFilter(this.getRootEntity(),t)},t.prototype.getFullEntityPathByAttr=function(t,e){return e=e||" ",this.getEntityPathByAttr(this.getRootEntity(),t,e,!0)},t.prototype.getEntityPathByAttr=function(t,e,n,i){if(!t)return"";n=n||" ";var r="";if(t.caption&&!i){var o=I.getText("Entities",t.caption);r=o||t.caption}if(t.attributes)for(var a=t.attributes.length,s=0;s<a;s++)if(t.attributes[s].id==e)return r;if(t.subEntities){var l=t.subEntities.length;for(s=0;s<l;s++){var u=t.subEntities[s],c=this.getEntityPathByAttr(u,e,n,!1);if(""!==c)return""!==r&&(c=r+n+c),c}}return""},t.prototype.getAttributeText=function(t,e){var n=I.getText("Attributes",t.id);if(n||(n=t.caption),!e)return n;var i=this.getFullEntityPathByAttr(t.id," ");return(i?e.replace(new RegExp("{attr}","g"),n).replace(new RegExp("{entity}","g"),i):n).trim()},t.prototype.runThroughEntities=function(t,e){this.getRootEntity().scan(t,e)},t.prototype.getFirstAttributeByFilter=function(t){var e=null;return this.runThroughEntities((function(n,i){t(n)&&(i.stop=!0,e=n)}),null),e}}(),function(){return q=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},q.apply(this,arguments)});!function(){function t(t){this.colStore=t,this.aggregates=[],this.groups=[],this.useGrandTotals=!1,this.useRecordCount=!1,this._caseSensitiveGroups=!1,this.COUNT_FIELD_NAME="GRPRECCNT"}Object.defineProperty(t.prototype,"caseSensitiveGroups",{get:function(){return this._caseSensitiveGroups},set:function(t){this._caseSensitiveGroups=t,this.updateCompareProc()},enumerable:!0,configurable:!0}),t.prototype.updateCompareProc=function(){this.compareValues=this._caseSensitiveGroups?this.strictCompare:this.caseInsensitiveCompare},t.prototype.addGroup=function(t){var e=t.columns||this.colStore.getColumnIds(t.from,t.to);if(!this.colStore.validateColumns(e))throw"Invalid columns: "+e;if(this.hasColumnsInUse(e))throw"Can't add same columns to different groups/aggregates";return this.groups.push(q({columns:e},t)),this},t.prototype.addAggregateColumn=function(t,e){var n="string"==typeof t?t:this.colStore.getColumnIds(t,t)[0];if(this.hasColumnsInUse([n])||!this.colStore.validateAggregate(n,e))throw"Invalid aggregation function for the column: "+n;return this.aggregates.push({colId:n,funcId:e}),this},t.prototype.addGrandTotals=function(){return this.useGrandTotals=!0,this},t.prototype.addCounts=function(){return this.useRecordCount=!0,this},t.prototype.getGroups=function(){var t=this,e=[];return this.groups.map((function(n){return e=e.concat(n.columns),q(q({},n),{columns:Array.from(e),aggregates:Array.from(t.aggregates)})}))},t.prototype.getInternalGroups=function(){return this.groups},t.prototype.lastGroup=function(){var t=this.getGroups();return t[t.length-1]},t.prototype.getAggregates=function(){return this.aggregates},t.prototype.hasAggregates=function(){return this.aggregates.length>0},t.prototype.hasGroups=function(){return this.groups.length>0},t.prototype.hasGrandTotals=function(){return this.useGrandTotals},t.prototype.hasRecordCount=function(){return this.useRecordCount},t.prototype.isEmpty=function(){return!(this.hasAggregates()||this.hasGroups()||this.hasAggregates()||this.hasRecordCount())},t.prototype.drop=function(){console.warn('"drop()" method is obsolete. Use "clear()" instead'),this.clear()},t.prototype.clear=function(){return this.groups=[],this.aggregates=[],this.useGrandTotals=!1,this.useRecordCount=!1,this.caseSensitiveGroups=!1,this},t.prototype.hasColumnsInUse=function(t){for(var e=0,n=this.groups;e<n.length;e++){if(n[e].columns.filter((function(e){return t.indexOf(e)>=0})).length>0)return!0}for(var i=0,r=this.aggregates;i<r.length;i++){var o=r[i];if(t.indexOf(o.colId)>=0)return!0}return!1},t.prototype.needAggrCalculation=function(){return(this.hasAggregates()||this.hasRecordCount())&&(this.hasGrandTotals()||this.hasGroups())},t.prototype.saveToData=function(){return{groups:Array.from(this.groups),ugt:this.useGrandTotals,urc:this.useRecordCount,csg:this.caseSensitiveGroups,aggregates:Array.from(this.aggregates)}},t.prototype.loadFromData=function(t){t&&(void 0!==t.ugt&&(this.useGrandTotals=t.ugt),void 0!==t.urc&&(this.useRecordCount=t.urc),void 0!==t.csg&&(this.caseSensitiveGroups=t.csg),t.groups&&(this.groups=Array.from(t.groups)),t.aggregates&&(this.aggregates=Array.from(t.aggregates)))},t.prototype.buildGroupKey=function(t,e){var n=!this.caseSensitiveGroups,i={};if(t)for(var r=0,o=t.columns;r<o.length;r++){var a=o[r],s=e.getValue(a);n&&"string"==typeof s&&(s=s.toLowerCase()),i[a]=s}return i},t.prototype.strictCompare=function(t,e){return t===e},t.prototype.caseInsensitiveCompare=function(t,e){return("string"==typeof t?t.toLowerCase():t)===("string"==typeof e?e.toLowerCase():e)}}();!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(O||(O={}));var H,z=function(t){if(!t)throw Error("Options are required");if(!t.id)throw Error("Field Id is required");if(!t.label)throw Error("Label is required");this.id=t.id,this.type=S.getIfDefined(t.type,c.String),this.label=t.label,this.originAttrId=t.originAttrId,this.isAggr=t.isAggr||!1,this.displayFormat=t.dfmt,this.groupFooterColumnTemplate=t.gfct,this.style=t.style||{},this.description=t.description,this.calculatedWidth=0},G=function(){function t(){this.items=[],this.mapper={},this._dateColumnIdx=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),t.prototype.add=function(t){var e;e=t instanceof z?t:new z(t);var n=this.items.length;return this.items.push(e),this.mapper[e.id]=n,[c.Date,c.DateTime,c.Time].indexOf(e.type)>=0&&this._dateColumnIdx.push(n),n},t.prototype.updateDateColumnIdx=function(){this._dateColumnIdx=this.getItems().filter((function(t){return[c.Date,c.DateTime,c.Time].indexOf(t.type)>=0})).map((function(t,e){return e}))},t.prototype.put=function(t,e){t>=0&&t<this.count&&(this.items[t]=e,this.updateDateColumnIdx())},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&(S.moveArrayItem(this.items,n,e),this.updateDateColumnIdx())},t.prototype.get=function(t){return t>=0&&t<this.count?this.items[t]:null},t.prototype.getIndex=function(t){return this.mapper[t]},t.prototype.getItems=function(){return this.items},t.prototype.getDateColumnIndexes=function(){return this._dateColumnIdx},t.prototype.removeAt=function(t){var e=this.get(t);this.items.splice(t,1);var n=this._dateColumnIdx.indexOf(t);n>=0&&this._dateColumnIdx.splice(n,1),delete this.mapper[e.id]},t.prototype.clear=function(){this.items=[],this._dateColumnIdx=[],this.mapper={}},t}(),j=function(){function t(t,e){this.columns=t,this.values=e}return t.prototype.toArray=function(){return Array.from(this.values)},t.prototype.size=function(){return this.values.length},t.prototype.getValue=function(t){var e;if("string"==typeof t){if(void 0===(e=this.columns.getIndex(t)))throw new RangeError("No column with id '"+t+"'")}else e=t;if(e>=this.values.length)throw new RangeError("Out of range: "+e);return this.values[e]},t.prototype.setValue=function(t,e){var n;if("string"==typeof t){if(void 0===(n=this.columns.getIndex(t)))throw new RangeError("No column with id '"+t+"'")}else n=t;if(n>=this.values.length)throw new RangeError("Out of range: "+n);this.values[n]=e},t}(),V=function(){function t(t){if(this._chunkSize=1e3,this._elasticChunks=!1,this.cachedRows=[],this.total=0,this.loader=null,this.needTotal=!0,this.isInMemory=!1,t=t||{},this._chunkSize=t.chunkSize||this._chunkSize,this._elasticChunks=t.elasticChunks||this._elasticChunks,this.loader=t.loader,void 0!==t.inMemory&&(this.isInMemory=t.inMemory),this.isInMemory&&(this.needTotal=!1),this._columns=new G,this.onUpdate=t.onUpdate,t.columns)for(var e=0,n=t.columns;e<n.length;e++){var i=n[e];this._columns.add(i)}if(t.rows)for(var r=0,o=t.rows;r<o.length;r++){var a=o[r],s=this.createRow(a);this.addRow(s)}this.needTotal=!this._elasticChunks}return Object.defineProperty(t.prototype,"columns",{get:function(){return this._columns},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chunkSize",{get:function(){return this._chunkSize},set:function(t){this._chunkSize=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"elasticChunks",{get:function(){return this._elasticChunks},set:function(t){this._elasticChunks=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!0,configurable:!0}),t.prototype.getRows=function(t){var e=this,n=0,i=this._chunkSize;t&&("page"in t?(n=t.pageSize*(t.page-1),i=t.pageSize):(n=t.offset,i=t.limit));var r=n+i;if(!this.needTotal&&!this.elasticChunks){if(n>=this.total)return Promise.resolve([]);r>this.total&&(r=this.total)}if(this.isInMemory&&r>this.cachedRows.length&&(r=this.cachedRows.length),r<=this.cachedRows.length)return Promise.resolve(this.cachedRows.slice(n,r));if(!this.loader)throw"Loader is not defined. Can't get the rows from "+n+" to "+r;var o=this.needTotal;this.needTotal&&(this.needTotal=!1);var a=this.cachedRows.length,s=r-a;return s<this._chunkSize&&(s=this._chunkSize),this.loader.loadChunk({offset:a,limit:s,needTotal:o}).then((function(t){(o&&(e.total=t.total),Array.prototype.push.apply(e.cachedRows,t.table.getCachedRows()),r>e.cachedRows.length&&(r=e.cachedRows.length),e.elasticChunks)&&(t.table.getCachedCount()<s&&(e.total=e.cachedRows.length));return e.fireUpdated(),e.cachedRows.slice(n,r)}))},t.prototype.getRow=function(t){return this.getRows({offset:t,limit:1}).then((function(t){return t.length>0?t[0]:null}))},t.prototype.getTotal=function(){return this.total},t.prototype.setTotal=function(t){this.total=t,this.needTotal=!1},t.prototype.getCachedCount=function(){return this.cachedRows.length},t.prototype.clear=function(){this.columns.clear(),this.cachedRows=[],this.total=0,this.needTotal=!this._elasticChunks,this.fireUpdated()},t.prototype.createRow=function(t){var e=this,n=this._columns.getDateColumnIndexes(),i=new Array(this._columns.count),r=t instanceof j?function(e){return t.getValue(e)}:function(e){return t[e]};return t&&this.columns.getItems().forEach((function(t){var o=r(t.id),a=e.columns.getIndex(t.id);i[a]=n.indexOf(a)>=0?e.mapDate(o,t.type):o})),new j(this._columns,i)},t.prototype.mapDate=function(t,e){if(t){var n=new Date(t);return isNaN(n.getTime())&&e==c.Time&&(n=S.strToTime(t)),n}return null},t.prototype.addRow=function(t){var e;if(Array.isArray(t)){var n=t,i=this._columns.getDateColumnIndexes();if(i.length>0)for(var r=0,o=i;r<o.length;r++){var a=o[r];n[a]&&(n[a]=this.mapDate(n[a],this._columns.get(a).type))}e=new j(this._columns,n)}else e=this.createRow(t);this.cachedRows.push(e);var s=this.getCachedCount();return s>this.total&&(this.total=s),e},t.prototype.getCachedRows=function(){return this.cachedRows},t.prototype.totalIsKnown=function(){return this.elasticChunks?this.getCachedCount()===this.total:!this.needTotal},t.prototype.fireUpdated=function(){this.onUpdate&&this.onUpdate(this)},t}(),U=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},t}(),W=function(){function t(t){this.silentMode=0,this.events=new Array,this.source=t}return t.prototype.subscribe=function(t,e){var n=this.getEventRecByType(t),i={id:U.newGuid(),callback:e};return n?n.eventCallbacks.push(i):(n={type:t,eventCallbacks:new Array(i)},this.events.push(n)),i.id},t.prototype.unsubscribe=function(t,e){var n=this.getEventRecByType(t);if(n){var i=-1;for(i=0;i<n.eventCallbacks.length&&n.eventCallbacks[i].id!==e;i++);i>=0&&n.eventCallbacks.splice(i,1)}},t.prototype.fire=function(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=!1),!this.silentMode||i){var r=this.getEventRecByType(t);if(r){var o={type:t,source:this.source,data:e},a=function(){for(var t=0,e=r.eventCallbacks;t<e.length;t++){e[t].callback(o)}};n>0?setTimeout(a,n):a()}}},t.prototype.enterSilentMode=function(){this.silentMode++},t.prototype.exitSilentMode=function(){this.silentMode&&this.silentMode--},t.prototype.isSilent=function(){return this.silentMode>0},t.prototype.getEventRecByType=function(t){for(var e=0,n=this.events;e<n.length;e++){var i=n[e];if(i.type==t)return i}return null},t}();!function(t){t.renderLiquidTemplate=function(t,e){var n=t;if(e)for(var i in e){var r=new RegExp("{{"+i+"}}","g");n=n.replace(r,e[i])}return n}}(H||(H={})),I.resetLocales(),"function"!=typeof Object.values&&(Object.values=function(t){return Object.keys(t).map((function(e){return t[e]}))}),"function"!=typeof Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)});n(1);function Y(t){var e={x:0,y:0};if(null!==t){var n=function(t){var e,n={top:0,right:0,bottom:0,left:0,width:0,height:0};try{e=t.getBoundingClientRect()}catch(t){e=n}var i=document.body,r=document.documentElement,o=function(){var t=document.body,e=document.documentElement;return{top:window.pageYOffset||e.scrollTop||t.scrollTop,left:window.pageXOffset||e.scrollLeft||t.scrollLeft}}(),a=o.top,s=o.left,l=r.clientTop||i.clientTop||0,u=r.clientLeft||i.clientLeft||0,c=e.top+a-l,d=e.left+s-u;return{top:Math.round(c),left:Math.round(d)}}(t);e={x:n.left,y:n.top}}return e}var Q=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),J=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i},K=function(){function t(t,e){this.element="string"==typeof t?document.createElement(t):t,e&&this.element.parentElement!==e&&e.appendChild(this.element)}return t.prototype.addChild=function(t,e){var n=tt(t,this.element);return e&&e(n),this},t.prototype.addChildElement=function(t){return t&&this.element.appendChild(t),this},t.prototype.attr=function(t,e){return this.element.setAttribute(t,e),this},t.prototype.id=function(t){return this.attr("id",t)},t.prototype.focus=function(){return this.element.focus(),this},t.prototype.title=function(t){return this.attr("title",t)},t.prototype.data=function(t,e){return void 0===e&&(e=null),null===e?(this.element.removeAttribute("data-"+t),this):this.attr("data-"+t,e)},t.prototype.show=function(){return this.removeStyle("display")},t.prototype.hide=function(t){return void 0===t&&(t=!0),t?this.setStyle("display","none"):this},t.prototype.visible=function(t){return void 0===t&&(t=!0),t?this.setStyle("visibility","visible"):this.setStyle("visibility","hidden")},t.prototype.isVisible=function(){return!!(this.element.offsetWidth||this.element.offsetHeight||this.element.getClientRects().length)},t.prototype.addClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var i=J(t.trim().split(" "),e),r=0;r<i.length;r++)this.element.classList.add(i[r]);return this},t.prototype.removeClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var i=J(t.trim().split(" "),e),r=0;r<i.length;r++)this.element.classList.remove(i[r]);return this},t.prototype.toggleClass=function(t,e){return void 0===e&&(e=void 0),t&&this.element.classList.toggle(t,e),this},t.prototype.on=function(t,e){for(var n=t.split(" "),i=0;i<n.length;i++)this.element.addEventListener(n[i],e);return this},t.prototype.off=function(t,e){for(var n=t.split(" "),i=0;i<n.length;i++)this.element.removeEventListener(n[i],e);return this},t.prototype.setStyle=function(t,e){return this.element.style.setProperty(t,e),this},t.prototype.removeStyle=function(t){return this.element.style.removeProperty(t),this},t.prototype.text=function(t){return this.element.innerText=t,this},t.prototype.html=function(t){return this.element.innerHTML=t,this},t.prototype.clear=function(){var t=this.element;this.element=document.createElement(this.element.tagName),t.replaceWith(this.element)},t.prototype.addText=function(t){var e=document.createTextNode(t);return this.element.appendChild(e),this},t.prototype.addHtml=function(t){return this.element.innerHTML+=t,this},t.prototype.toDOM=function(){return this.element},t.prototype.appendTo=function(t){return t&&t.appendChild(this.element),this},t}(),X=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"textarea",n)||this}return Q(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.rows=function(t){return this.element.rows=t,this},e.prototype.cols=function(t){return this.element.cols=t,this},e.prototype.value=function(t){return this.element.value=t,this},e}(K),Z=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"input",n)||this}return Q(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.type=function(t){return this.element.type=t,this},e.prototype.size=function(t){return this.element.size=t,this},e.prototype.value=function(t){return t instanceof Date?this.element.valueAsDate=t:"number"==typeof t?this.element.valueAsNumber=t:this.element.value=t,this},e.prototype.mask=function(t){return function(t,e){var n={9:"[0-9]",a:"[a-z]"},i=e.split(""),r=function(e){if("focus"!==e.type||""===t.value){var r=[],o=t.selectionStart;i.forEach((function(e,i){if(n[e]){var o=new RegExp(n[e],"i").test(t.value.charAt(i));r.push(o?t.value.charAt(i):"_")}else r.push(e)})),t.value=r.join(""),t.selectionStart=t.selectionEnd=o}};t.addEventListener("keydown",(function(e){if(8===e.keyCode||46===e.keyCode){e.preventDefault();var r=[],o=t.selectionStart;if(0==o)return;for(var a=o,s=!0,l=i.length-1;l>=0;l--){var u=i[l];if(n[u]){var c=new RegExp(n[u],"i").test(t.value.charAt(l));c&&l!=o-1&&(s=!1),l===o-1&&a--,r.push(c&&l!=o-1?t.value.charAt(l):"_")}else l===a-1&&a--,o-1===l&&o--,r.push(u)}t.value=s?"":r.reverse().join(""),t.selectionStart=t.selectionEnd=a<0?0:a;var d=document.createEvent("Event");d.initEvent("input",!0,!0),t.dispatchEvent(d)}})),t.addEventListener("keypress",(function(e){var r=String.fromCharCode(e.charCode);if(r){e.preventDefault();var o=[],a=t.selectionStart,s=a;i.forEach((function(e,i){if(n[e]){var l=i!=a?t.value.charAt(i):r,u=new RegExp(n[e],"i").test(l);o.push(u?l:"_"),u&&a===i&&s++}else o.push(e),s===i&&s++,a===i&&a++})),t.value=o.join(""),t.selectionStart=t.selectionEnd=s;var l=document.createEvent("Event");l.initEvent("input",!0,!0),t.dispatchEvent(l)}})),t.addEventListener("input",r),t.addEventListener("focus",r)}(this.element,t),this},e}(K),$=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"select",n)||this}return Q(e,t),e.prototype.addOption=function(t){var e=document.createElement("option");return"string"==typeof t?(e.value=t,e.innerHTML=t):(e.value=t.value,e.innerHTML=t.title||t.value,e.selected=t.selected||!1),this.element.appendChild(e),this},e.prototype.value=function(t){return this.element.value=t,this},e}(K);function tt(t,e){return"div"===t||t instanceof HTMLDivElement||"span"===t||t instanceof HTMLSpanElement||"a"===t||t instanceof HTMLAnchorElement||"button"===t||t instanceof HTMLButtonElement||"img"===t||t instanceof HTMLImageElement?new K(t,e):"input"===t||t instanceof HTMLInputElement?new Z(t instanceof HTMLInputElement?t:null,e):"textarea"===t||t instanceof HTMLTextAreaElement?new X(t instanceof HTMLTextAreaElement?t:null,e):"select"===t||t instanceof HTMLSelectElement?new $(t instanceof HTMLSelectElement?t:null,e):new K(t,e)}var et,nt="undefined"!=typeof TouchEvent;!function(t){t.None="none",t.Allow="allow",t.Forbid="forbid"}(et||(et={}));var it,rt=function(t,e,n){this.dropEffect=et.Allow,this.pageX=0,this.pageY=0,this.item=t,this.dragImage=e,this.data=t.data,this.sourceEvent=n,n&&n instanceof MouseEvent&&(this.pageX=n.pageX,this.pageY=n.pageY),n&&nt&&n instanceof TouchEvent&&n.touches[0]&&(this.pageX=n.touches[0].pageX,this.pageY=n.touches[0].pageY)},ot=function(t){t&&t instanceof MouseEvent&&(this.x=t.pageX,this.y=t.pageY),t&&nt&&t instanceof TouchEvent&&t.touches[0]&&(this.x=t.touches[0].pageX,this.y=t.touches[0].pageY)},at=new(function(){function t(){this.delta=5,this.draggableItem=null,this.dragImage=null,this.finishedSuccessfully=!1,this.mouseDownPosition=null,this.containerDescriptors=[],this.containerDescriptorIndex=-1,this.dropEffect=et.None,this.classPrefix="eqjs-drop",this.DRAG_DISABLED_ATTR="drag-disabled"}return t.prototype.registerDraggableItem=function(t){var e=this,n=t.element;if(!n)throw Error("Element in draggle item is null or undefined");n.ondragstart=function(){return!1};var i=function(t){if(!n.hasAttribute(e.DRAG_DISABLED_ATTR)){t.preventDefault(),t instanceof MouseEvent&&t.stopPropagation();var i=new ot(t);(Math.abs(i.x-e.mouseDownPosition.x)>e.delta||Math.abs(i.y-e.mouseDownPosition.y)>e.delta)&&o(t)}},r=function(t){e.mouseMoveDragListener(t)},o=function(o){o.preventDefault(),o.stopPropagation(),n.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),e.finishedSuccessfully=!1,t.beforeDragStart&&t.beforeDragStart(),e.dragImage=tt("div").setStyle("position","absolute").setStyle("z-index","65530").toDOM(),document.body.appendChild(e.dragImage),e.dragImage.appendChild(n.cloneNode(!0)),t.renderer&&t.renderer(e.dragImage),e.dropEffect=et.None,e.updateCusror(e.dropEffect),e.updateImageClass(e.dropEffect),e.draggableItem={element:n,scope:t.scope,data:t.data},e.updateDragItemPosition(o);var a=new rt(e.draggableItem,e.dragImage,o);a.dropEffect=e.dropEffect,t.onDragStart&&t.onDragStart(a),e.dropEffect!==a.dropEffect&&(e.dropEffect=a.dropEffect,e.updateImageClass(e.dropEffect)),document.addEventListener("mousemove",r,!0),document.addEventListener("touchmove",r,!0)},a=function(t){nt&&t instanceof TouchEvent&&t.preventDefault(),e.mouseDownPosition=new ot(t),n.addEventListener("mousemove",i),n.addEventListener("touchmove",i),document.addEventListener("mouseup",s),document.addEventListener("touchend",s)};n.addEventListener("mousedown",a),n.addEventListener("touchstart",a);var s=function(t){e.mouseDownPosition=null,n.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),document.removeEventListener("mousemove",r,!0),document.removeEventListener("touchmove",r,!0),e.draggableItem&&l(t)},l=function(n){try{if(e.containerDescriptorIndex>=0){var i=e.containerDescriptors[e.containerDescriptorIndex],r={element:i.element,scopes:i.scopes,data:i.data},o=new rt(e.draggableItem,e.dragImage,n);try{r.scopes.indexOf(e.draggableItem.scope)>=0&&e.dropEffect===et.Allow&&(e.finishedSuccessfully=!0,i.onDrop&&i.onDrop(r,o))}finally{i.onDragLeave&&i.onDragLeave(r,o)}}}finally{try{var a=new rt(e.draggableItem,e.dragImage,n);a.data.finishedSuccessfully=e.finishedSuccessfully,t.onDragEnd&&t.onDragEnd(a)}finally{e.draggableItem=null,e.dragImage&&e.dragImage.parentElement&&e.dragImage.parentElement.removeChild(e.dragImage),e.dragImage=null,e.finishedSuccessfully=!1,document.removeEventListener("mouseup",s),document.removeEventListener("touchend",s)}}}},t.prototype.registerDropContainer=function(t){if(!t.element)throw Error("Element in drop container is null or undefined");this.containerDescriptors.push(t)},t.prototype.removeDropContainer=function(t){var e=this.containerDescriptors.filter((function(e){return e===t||e.element==t}));if(e)for(var n=0,i=e;n<i.length;n++){var r=i[n];S.removeArrayItem(this.containerDescriptors,r)}},t.prototype.mouseMoveDragListener=function(t){if(t instanceof MouseEvent&&t.preventDefault(),t.stopPropagation(),this.updateDragItemPosition(t),-1==this.containerDescriptorIndex){for(var e=0;e<this.containerDescriptors.length;e++){var n=this.containerDescriptors[e];if(this.detectDragEnterEvent(n.element,t)){this.containerDescriptorIndex=e;break}}this.containerDescriptorIndex>=0&&this.dragEnterEvent(t)}else{n=this.containerDescriptors[this.containerDescriptorIndex];this.detectDragLeaveEvent(n.element,t)&&(this.dragLeaveEvent(t),this.containerDescriptorIndex=-1)}if(this.containerDescriptorIndex>=0){var i={element:(n=this.containerDescriptors[this.containerDescriptorIndex]).element,scopes:n.scopes,data:n.data};if(i.scopes.indexOf(this.draggableItem.scope)>=0){var r=new rt(this.draggableItem,this.dragImage,t);r.dropEffect=this.dropEffect,n.onDragOver&&n.onDragOver(i,r)}}},t.prototype.updateCusror=function(t){switch(t){case et.Allow:this.setCursorStyle(this.dragImage,"grabbing");break;case et.Forbid:this.setCursorStyle(this.dragImage,"no-drop");break;default:this.setCursorStyle(this.dragImage,"grabbing")}},t.prototype.updateImageClass=function(t){switch(this.dragImage.classList.remove(this.classPrefix+"-allow"),this.dragImage.classList.remove(this.classPrefix+"-forbid"),this.dragImage.classList.remove(this.classPrefix+"-none"),t){case et.Allow:this.dragImage.classList.add(this.classPrefix+"-allow");break;case et.None:this.dragImage.classList.add(this.classPrefix+"-none");break;case et.Forbid:this.dragImage.classList.add(this.classPrefix+"-forbid");break;default:this.dragImage.classList.add(this.classPrefix+"-none")}},t.prototype.setCursorStyle=function(t,e){if(t){t.style.cursor=e;for(var n=0;n<t.children.length;n++)this.setCursorStyle(t.children[n],e)}},t.prototype.updateDragItemPosition=function(t){if(this.dragImage){var e=new ot(t);this.dragImage.style.top=e.y-this.dragImage.offsetHeight/2+"px",this.dragImage.style.left=e.x-this.dragImage.offsetWidth/2+"px"}},t.prototype.dragEnterEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var i=new rt(this.draggableItem,this.dragImage,t);i.dropEffect=et.Allow,e.onDragEnter&&e.onDragEnter(n,i),this.dropEffect=i.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}else this.dropEffect!==et.Forbid&&(this.dropEffect=et.None,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect))},t.prototype.dragLeaveEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var i=new rt(this.draggableItem,this.dragImage,t);i.dropEffect=et.None,e.onDragLeave&&e.onDragLeave(n,i),this.dropEffect=i.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}},t.prototype.detectDragEnterEvent=function(t,e){var n=Y(t),i=new ot(e);return!(i.y<n.y||i.y>n.y+t.offsetHeight)&&!(i.x<n.x||i.x>n.x+t.offsetWidth)},t.prototype.detectDragLeaveEvent=function(t,e){var n=Y(t),i=new ot(e);return!(i.y>n.y&&i.y<n.y+t.offsetHeight&&i.x>n.x&&i.x<n.x+t.offsetWidth)},t}());!function(t){t[t.Always=0]="Always",t[t.Once=1]="Once",t[t.Never=2]="Never"}(it||(it={}));var st,lt=/{0:(.*?)}/g;!function(t){t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.DATETIME=3]="DATETIME",t[t.BOOL=4]="BOOL"}(st||(st={}));var ut,ct=function(t,e,n,i){var r=t?t.toString().replace(/\n/g,"↵ "):"";n.innerText=r,n.title=r,e.align==ut.NONE&&n.classList.add("keg-cell-value-align-left")},dt=function(t,e,n,i){var r=(t||"").toString();"number"==typeof t&&(r=e.dataColumn&&e.dataColumn.displayFormat&&lt.test(e.dataColumn.displayFormat)?e.dataColumn.displayFormat.replace(lt,(function(e,n){return I.numberToStr(t,n)})):t.toLocaleString()),n.innerText=r,n.title=r,e.align==ut.NONE&&n.classList.add("keg-cell-value-align-right")},ht=function(t,e,n,i){var r="[object Date]"===Object.prototype.toString.call(t),o=(t||"").toString();if(r)if(e.dataColumn&&e.dataColumn.displayFormat&&lt.test(e.dataColumn.displayFormat))o=e.dataColumn.displayFormat.replace(lt,(function(n,i){return I.dateTimeToStr(t,e.type,i)}));else{var a=I.getCurrentLocale(),s={hour:"numeric",minute:"numeric",second:"numeric"};switch(e.type){case c.Date:o=t.toLocaleDateString(a);break;case c.Time:o=t.toLocaleTimeString(a,s);break;case c.DateTime:o=t.toLocaleDateString(a)+" "+t.toLocaleTimeString(a,s)}}n.innerText=o,n.title=o,e.align==ut.NONE&&n.classList.add("keg-cell-value-align-right")},pt=function(t,e,n,i){if(e.dataColumn&&e.dataColumn.displayFormat&&lt.test(e.dataColumn.displayFormat)){var r=e.dataColumn.displayFormat.replace(lt,(function(e,n){return I.booleanToStr(t,n)}));return ct(r,e,n)}n.classList.add("keg-cell-value-bool"),n.classList.add("keg-"+(t?"cell-value-true":"cell-value-false"))},ft=function(){function t(t){this.renderers={},this.defaultRenderers={},this.registerRenderer("StringDefault",ct),this.setDefaultRenderer(st.STRING,ct),this.registerRenderer("NumberDefault",dt),this.setDefaultRenderer(st.NUMBER,dt),this.registerRenderer("DateTimeDefault",ht),this.setDefaultRenderer(st.DATETIME,ht),this.registerRenderer("BoolDefault",pt),this.setDefaultRenderer(st.BOOL,pt)}return t.prototype.getDefaultRenderer=function(t){var e=this.getCellType(t);return this.defaultRenderers[st[e]]},t.prototype.getDefaultRendererByType=function(t){return this.defaultRenderers[st[t]]},t.prototype.setDefaultRenderer=function(t,e){e&&(this.defaultRenderers[st[t]]=e)},t.prototype.getRenderer=function(t){return this.renderers[t]},t.prototype.registerRenderer=function(t,e){this.renderers[t]=e},t.prototype.getCellType=function(t){switch(t){case c.Autoinc:case c.Byte:case c.Word:case c.Currency:case c.Float:case c.Int32:case c.Int64:return st.NUMBER;case c.Date:case c.DateTime:case c.Time:return st.DATETIME;case c.Bool:return st.BOOL;default:return st.STRING}},t}();!function(t){t[t.NONE=1]="NONE",t[t.LEFT=2]="LEFT",t[t.CENTER=3]="CENTER",t[t.RIGHT=4]="RIGHT"}(ut||(ut={}));var gt,mt=function(){function t(t,e,n){void 0===n&&(n=!1),this._label=null,this._description=null,this.align=ut.NONE,this.isVisible=!0,this.isRowNum=!1,this.dataColumn=t,this.grid=e;var i=e.options.columnWidths||{};t?(t.style.alignment&&(this.align=function(t){switch(t){case O.Left:return ut.LEFT;case O.Center:return ut.CENTER;case O.Right:return ut.RIGHT;default:return ut.NONE}}(t.style.alignment)),this.width=i&&i[this.type]?i[this.type].default:250,this.cellRenderer=this.grid.cellRendererStore.getDefaultRenderer(t.type),this._description=t.description):n&&(this.isRowNum=!0,this.width=i&&i.rowNumColumn?i.rowNumColumn.default:60,this._label="",this.cellRenderer=this.grid.cellRendererStore.getDefaultRendererByType(st.NUMBER)),e&&e.options&&e.options.onGetCellRenderer&&(this.cellRenderer=e.options.onGetCellRenderer(this,this.cellRenderer)||this.cellRenderer)}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label?this._label:this.isRowNum?"":this.dataColumn.label},set:function(t){this._label=this.label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._description},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.dataColumn?this.dataColumn.type:null},enumerable:!0,configurable:!0}),t}(),yt=function(){function t(t,e){this.items=[],this.grid=e,this.sync(t)}return t.prototype.sync=function(t,e){void 0===e&&(e=!0),this.clear();var n=new mt(null,this.grid,!0);if(this.add(n),e||(n.isVisible=!1),t)for(var i=0,r=t.getItems();i<r.length;i++){var o=r[i],a=new mt(o,this.grid);this.grid.options.onSyncGridColumn&&this.grid.options.onSyncGridColumn(a),this.add(a)}},Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),t.prototype.add=function(t){var e=this.items.length;return this.items.push(t),e},t.prototype.put=function(t,e){t>=0&&t<this.items.length&&(this.items[t]=e)},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&S.moveArrayItem(this.items,n,e)},t.prototype.get=function(t){return t>=0&&t<this.items.length?this.items[t]:null},t.prototype.getItems=function(){return this.items},t.prototype.removeAt=function(t){this.get(t);this.items.splice(t,1)},t.prototype.clear=function(){this.items=[]},t}(),vt=function(){return vt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},vt.apply(this,arguments)},bt=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i},Ct=(function(){function t(t){if(this.cssPrefix="keg",this.pagination={page:1,pageSize:30,total:0},this.paginationOptions={maxButtonCount:10,useBootstrap:!1},this.defaultDataGridOptions={slot:null,dataTable:null,fixHeightOnFirstRender:!1,syncGridColumns:!0,useRowNumeration:!0,allowDragDrop:!1,aggregates:{settings:null,calculator:null},paging:{enabled:!0,pageSize:30,pageSizeItems:[20,30,50,100,200]},columnWidths:{autoResize:it.Always,stringColumns:{min:100,max:500,default:250},numberColumns:{min:60,default:120},boolColumns:{min:50,default:80},dateColumns:{min:80,default:200},otherColumns:{min:100,max:500,default:250},rowNumColumn:{min:40,default:60}},showPlusButton:!1,viewportRowsCount:null,showActiveRow:!0},this.rowsOnPagePromise=null,this.containerInitialHeight=0,this.firstRender=!0,this.prevRowTotals=null,this.landingIndex=-1,this.landingSlot=tt("div").addClass(this.cssPrefix+"-col-landing-slot").addChildElement(tt("div").toDOM()).toDOM(),this._activeRowIndex=-1,t&&t.paging&&(t.paging=S.assign(this.defaultDataGridOptions.paging,t.paging)),this.options=this.mergeOptions(t),this.processColumnWidthsOptions(),!this.options.slot)throw Error('"slot" parameter is required to initialize EasyDataGrid');if(!this.options.dataTable)throw Error('"dataTable" parameter is required to initialize EasyDataGrid');this.dataTable=t.dataTable,this.eventEmitter=new W(this),this.cellRendererStore=new ft(t),this.columns=new yt(this.dataTable.columns,this),this.setSlot(this.options.slot),this.init(this.options)}t.prototype.mergeOptions=function(t){var e=S.assignDeep({},this.defaultDataGridOptions.columnWidths,t.columnWidths),n=S.assignDeep({},this.defaultDataGridOptions.paging,t.paging),i=S.assign({},this.defaultDataGridOptions,t);return i.columnWidths=e,i.paging=n,i},t.prototype.processColumnWidthsOptions=function(){var t=this.options.columnWidths;if(t){S.getStringDataTypes().forEach((function(e){t[e]=vt(vt({},t.stringColumns),t[e])})),S.getNumericDataTypes().forEach((function(e){t[e]=vt(vt({},t.numberColumns),t[e])})),t[c.Bool]=vt(vt({},t.boolColumns),t[c.Bool]),S.getDateDataTypes().forEach((function(e){t[e]=vt(vt({},t.dateColumns),t[e])}));var e=bt(S.getStringDataTypes(),S.getNumericDataTypes(),S.getDateDataTypes(),[c.Bool]);S.getAllDataTypes().forEach((function(n){n in e||(t[n]=vt(vt({},t.otherColumns),t[n]))})),t[c.Unknown]=t.otherColumns}},t.prototype.setSlot=function(t){if("string"==typeof t){if(t.length)if("#"===t[0])this.slot=document.getElementById(t.substring(1));else{if("."!==t[0])throw Error("Unrecognized slot parameter (Must be id, class or HTMLElement): "+t);var e=document.getElementsByClassName(t.substring(1));e.length&&(this.slot=e[0])}}else this.slot=t},t.prototype.init=function(t){var e=this;t.onInit&&this.addEventListener("init",t.onInit),t.onRowClick&&this.addEventListener("rowClick",t.onRowClick),t.onRowDbClick&&this.addEventListener("rowDbClick",t.onRowDbClick),t.onPlusButtonClick&&this.addEventListener("plusButtonClick",t.onPlusButtonClick),t.onColumnChanged&&this.addEventListener("columnChanged",t.onColumnChanged),t.onColumnDeleted&&this.addEventListener("columnDeleted",t.onColumnDeleted),t.onColumnMoved&&this.addEventListener("columnMoved",t.onColumnMoved),t.onPageChanged&&this.addEventListener("pageChanged",t.onPageChanged),t.onActiveRowChanged&&this.addEventListener("activeRowChanged",t.onActiveRowChanged),this.addEventListener("pageChanged",(function(t){return e.activeRowIndex=-1})),S.assignDeep(this.paginationOptions,t.pagination),this.pagination.pageSize=this.options.paging.pageSize||this.pagination.pageSize,this.options.allowDragDrop&&at.registerDropContainer({element:this.slot,scopes:["gridColumnMove"],onDragEnter:function(t,n){e.slot.classList.add("eqjs-drophover"),e.showLandingSlot(n.pageX,n.pageY)},onDragOver:function(t,n){e.showLandingSlot(n.pageX,n.pageY)},onDragLeave:function(t,n){n.dropEffect=et.Forbid,e.slot.classList.remove("eqjs-drophover"),e.hideLandingSlot()},onDrop:function(t,n){e.dataTable.columns.move(n.data.column,e.landingIndex),e.refresh(),e.fireEvent({type:"columnMoved",columnId:n.data.column.id,newIndex:e.landingIndex})}}),this.refresh(),this.fireEvent("init")},t.prototype.fireEvent=function(t){"string"==typeof t?this.eventEmitter.fire(t):this.eventEmitter.fire(t.type,t)},t.prototype.setData=function(t){this.dataTable=t,this.clear(),this.refresh()},t.prototype.getData=function(){return this.dataTable},t.prototype.getColumns=function(){return this.columns},t.prototype.destroy=function(){this.slot.innerHTML=""},t.prototype.refresh=function(){this.clearDOM(),this.render()},t.prototype.clearDOM=function(){this.slot.innerHTML=""},t.prototype.clear=function(){this.pagination.page=1,this.clearDOM()},t.prototype.render=function(){var t=this;if(this.hasData()||this.options.showPlusButton){this.containerInitialHeight=this.slot.clientHeight,this.rootDiv=document.createElement("div"),this.rootDiv.style.width="100%",this.rootDiv.classList.add(this.cssPrefix+"-root"),this.columns.sync(this.dataTable.columns,this.options.useRowNumeration),this.renderHeader(),this.rootDiv.appendChild(this.headerDiv),this.renderBody(),this.rootDiv.appendChild(this.bodyDiv),this.renderFooter(),this.rootDiv.appendChild(this.footerDiv);var e=document.createElement("div");e.classList.add(this.cssPrefix+"-container"),e.appendChild(this.rootDiv),this.slot.appendChild(e);var n=this.options.columnWidths.autoResize!==it.Never;this.rowsOnPagePromise?this.rowsOnPagePromise.then((function(){return t.updateHeight()})).then((function(){t.firstRender=!1,t.rowsOnPagePromise=null})):setTimeout((function(){t.updateHeight().then((function(){t.firstRender=!1,n&&t.resizeColumns()}))}),100)}},t.prototype.updateHeight=function(){var t=this;return new Promise((function(e){if(t.options.viewportRowsCount){var n=t.bodyCellContainerDiv.firstElementChild,i=(n?n.offsetHeight:36)*t.options.viewportRowsCount;return tt(t.bodyViewportDiv).setStyle("height",i+"px"),void setTimeout((function(){var n=t.bodyViewportDiv.offsetHeight-t.bodyViewportDiv.clientHeight;i+=n,tt(t.bodyViewportDiv).setStyle("height",i+"px"),e()}),100)}t.containerInitialHeight,e()})).then((function(){t.options.fixHeightOnFirstRender&&t.firstRender&&(t.slot.style.height=t.slot.offsetHeight+"px")}))},t.prototype.getContainerWidth=function(){return this.columns.getItems().filter((function(t){return t.isVisible})).map((function(t){return t.width})).reduce((function(t,e){return t+e}))},t.prototype.renderHeader=function(){var t=this;this.headerDiv=tt("div").addClass(this.cssPrefix+"-header").toDOM(),this.headerViewportDiv=tt("div",this.headerDiv).addClass(this.cssPrefix+"-header-viewport").toDOM(),this.headerCellContainerDiv=tt("div",this.headerViewportDiv).addClass(this.cssPrefix+"-header-cell-container").toDOM(),this.headerRowDiv=tt("div",this.headerCellContainerDiv).addClass(this.cssPrefix+"-header-row").toDOM(),this.columns.getItems().forEach((function(e,n){if(e.isVisible){var i=t.renderColumnHeader(e,n);t.headerRowDiv.appendChild(i),e.isRowNum&&tt(i).addChildElement(t.renderHeaderButtons())}}));var e=this.getContainerWidth();tt(this.headerCellContainerDiv).setStyle("width",e+"px")},t.prototype.hasData=function(){return this.dataTable.columns.count>0},t.prototype.renderColumnHeader=function(t,e){var n=this,i=tt("div").addClass(this.cssPrefix+"-header-cell").data("col-idx",""+e).setStyle("width",t.width+"px");t.dataColumn&&i.data("col-id",""+t.dataColumn.id);var r=i.toDOM();return tt("div",r).addClass(this.cssPrefix+"-header-cell-resize"),t.isRowNum||tt("div",r).addClass(this.cssPrefix+"-header-cell-label").text(t.label),t.description&&tt("div",r).addClass("question-mark").title(t.description),this.options.allowDragDrop&&at.registerDraggableItem({element:r,scope:"gridColumnMove",data:{column:t},renderer:function(e){e.innerHTML="";var i=document.createElement("div");i.innerText=t.label,e.classList.add(n.cssPrefix+"-sortable-helper"),e.appendChild(i)},onDragStart:function(t){t.dropEffect=et.Allow}}),r},t.prototype.renderBody=function(){var t=this;this.bodyDiv=tt("div").addClass(this.cssPrefix+"-body").toDOM(),this.bodyViewportDiv=tt("div",this.bodyDiv).addClass(this.cssPrefix+"-body-viewport").attr("tabIndex","0").toDOM(),this.bodyCellContainerDiv=tt("div",this.bodyViewportDiv).addClass(this.cssPrefix+"-cell-container").toDOM();var e=this.canShowAggregates();this.dataTable&&(this.showProgress(),this.rowsOnPagePromise=this.getRowsToRender().then((function(n){t.pagination.total=t.dataTable.getTotal(),t.hideProgress(),t.bodyCellContainerDiv.innerHTML="",t.prevRowTotals=null;var i=0;if(n.length){var r=e?t.options.aggregates.settings.getGroups():[];i=n.length<t.pagination.pageSize?n.length:t.pagination.pageSize,n.forEach((function(n,o){if(e&&t.updateTotalsState(r,n),o<i){var a=t.renderRow(n,o);t.bodyCellContainerDiv.appendChild(a)}}));var o=t.options.aggregates&&t.options.aggregates.showGrandTotalsOnEachPage;if(e&&(t.isLastPage()||o)){var a=new j(t.dataTable.columns,new Array(t.dataTable.columns.count));t.updateTotalsState(r,a,!0)}}if(t.options.columnWidths.autoResize!==it.Never)t.resizeColumns();else{var s=t.getContainerWidth();tt(t.bodyCellContainerDiv).setStyle("width",s+"px")}return i})).catch((function(t){return console.error(t),0}))),this.bodyViewportDiv.addEventListener("scroll",(function(e){tt(t.headerViewportDiv).setStyle("margin-left","-"+t.bodyViewportDiv.scrollLeft+"px")})),this.bodyViewportDiv.addEventListener("keydown",this.onViewportKeydown.bind(this))},t.prototype.isLastPage=function(){return this.dataTable.elasticChunks?this.dataTable.totalIsKnown()&&this.pagination.page*this.pagination.pageSize>=this.pagination.total:this.pagination.page*this.pagination.pageSize>=this.pagination.total},t.prototype.canShowAggregates=function(){if(!this.options||!this.options.aggregates||!this.options.aggregates.settings)return!1;var t=this.options.aggregates.settings;return(t.hasAggregates()||t.hasRecordCount())&&(t.hasGroups()||t.hasGrandTotals())},t.prototype.updateTotalsState=function(t,e,n){void 0===n&&(n=!1);var i=this.options.aggregates.settings;if(this.prevRowTotals&&i.hasGroups()){for(var r=-1,o=1;o<=t.length;o++){for(var a=0,s=t[o-1].columns;a<s.length;a++){var l=s[a];if(!i.compareValues(this.prevRowTotals.getValue(l),e.getValue(l))){r=o;break}}if(-1!==r)break}if(-1!==r)for(o=t.length;o>=r;o--){var u=new j(this.dataTable.columns,this.prevRowTotals.toArray()),c=this.renderTotalsRow(o,u);this.bodyCellContainerDiv.appendChild(c)}}if(n&&i.hasGrandTotals()&&i.hasAggregates()){c=this.renderTotalsRow(0,e);this.bodyCellContainerDiv.appendChild(c)}this.prevRowTotals=e},t.prototype.applyGroupColumnTemplate=function(t,e,n){var i=t.replace(/{{\s*GroupValue\s*}}/g,e?"<span>"+e+"</span>":"-");return i=i.replace(/{{\s*GroupCount\s*}}/g,n?"<span>"+n+"</span>":"-")},t.prototype.renderTotalsRow=function(t,e){var n=this,i=this.options.aggregates.settings,r=t>0?i.getGroups()[t-1]:{columns:[],aggregates:i.getAggregates()},o=tt("div").addClass(this.cssPrefix+"-row").addClass(this.cssPrefix+"-row-totals").addClass(this.cssPrefix+"-totals-lv"+t).data("totals-level",""+t).attr("tabindex","-1").toDOM();this.columns.getItems().forEach((function(t,i){if(t.isVisible){var a="",s=t.isRowNum?-1:n.dataTable.columns.getIndex(t.dataColumn.id);!t.isRowNum&&t.dataColumn&&r.columns.indexOf(t.dataColumn.id)>=0&&(a=e.getValue(s)),s==n.dataTable.columns.count-1&&(a=". . . . . ."),o.appendChild(n.renderCell(t,i,a,o))}}));var a=this.options.aggregates.calculator.getAggrContainer(),s=i.getAggregates().map((function(t){return t.colId})),l=i.buildGroupKey(r,e);return a.getAggregateData(t,l).then((function(a){for(var l=0,u=s;l<u.length;l++){var c=u[l];e.setValue(c,a[c])}o.innerHTML="",n.columns.getItems().forEach((function(l,u){if(l.isVisible){var c="",d=l.isRowNum?-1:n.dataTable.columns.getIndex(l.dataColumn.id);if(!l.isRowNum){var h=!1;if(l.dataColumn){var p=r.columns.indexOf(l.dataColumn.id),f=s.indexOf(l.dataColumn.id);h=t>0?p==r.columns.length-1:0==d,(p>=0||f>=0)&&(c=e.getValue(d))}var g="";if(t>0&&!(g=l.dataColumn.groupFooterColumnTemplate)&&i.hasRecordCount()&&h&&(g="{{GroupValue}} ({{GroupCount}})"),g)c=n.renderCell(l,u,c,o).firstChild.innerHTML,c=n.applyGroupColumnTemplate(g,c,a[i.COUNT_FIELD_NAME])}var m=n.renderCell(l,u,c,o);o.appendChild(m)}}))})).catch((function(t){return console.error(t)})),o},t.prototype.onViewportKeydown=function(t){if(this.options.showActiveRow){var e=this.bodyCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-row").length,n=void 0;switch(t.key){case"ArrowLeft":case"ArrowRight":break;case"ArrowUp":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?e-1:this.activeRowIndex-1,this.activeRowIndex=n>=0?n:0;break;case"ArrowDown":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?0:this.activeRowIndex+1,this.activeRowIndex=n<e?n:e-1}}},t.prototype.ensureRowVisibility=function(t){var e="number"==typeof t?this.getDataRow(t):t;if(e){var n=e.getBoundingClientRect(),i=this.bodyViewportDiv.getBoundingClientRect(),r=n.top-i.top,o=n.bottom-i.top,a=this.bodyViewportDiv.clientHeight,s=window.innerHeight||document.documentElement.clientHeight;if(r>0&&o<=a&&n.top>0&&n.bottom<s)return;r<0?this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+r:o>a&&(this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+o-a),(n=e.getBoundingClientRect()).top<0?document.documentElement.scrollTop=document.documentElement.scrollTop+n.top:n.bottom>s&&(document.documentElement.scrollTop=document.documentElement.scrollTop+n.bottom-s)}},t.prototype.getRowsToRender=function(){return!1===this.options.paging.enabled?Promise.resolve(this.dataTable.getCachedRows()):this.dataTable.getRows({offset:(this.pagination.page-1)*this.pagination.pageSize,limit:this.pagination.pageSize+1}).catch((function(t){return console.error(t),[]}))},t.prototype.renderFooter=function(){var t=this;this.footerDiv=tt("div").addClass(this.cssPrefix+"-footer").toDOM(),this.rowsOnPagePromise&&this.rowsOnPagePromise.then((function(e){t.footerDiv.innerHTML="",t.footerPaginateDiv=t.renderPageNavigator(),t.footerDiv.appendChild(t.footerPaginateDiv);var n=t.renderPageInfoBlock(e);t.footerDiv.appendChild(n)}))},t.prototype.renderPageInfoBlock=function(t){var e=tt("div").addClass(this.cssPrefix+"-page-info").toDOM();if(this.dataTable.getTotal()>0){var n=t?(this.pagination.page-1)*this.pagination.pageSize+1:0,i=t?n+t-1:0,r=this.dataTable.getTotal().toString();if(this.dataTable.elasticChunks)this.dataTable.getCachedCount()!==this.dataTable.getTotal()&&(r="?");e.innerHTML=I.getText("GridPageInfo").replace("{FirstPageRecordNum}","<span>"+n.toString()+"</span>").replace("{LastPageRecordNum}","<span>"+i.toString()+"</span>").replace("{Total}","<span>"+r+"</span>")}return e},t.prototype.showProgress=function(){},t.prototype.hideProgress=function(){},t.prototype.getLocalIndexByGlobal=function(t){return this.pagination?t%this.pagination.pageSize:t},t.prototype.getGlobalIndexByLocal=function(t){return this.pagination?(this.pagination.page-1)*this.pagination.pageSize+t:t},t.prototype.renderRow=function(t,e){var n=this,i=this.getGlobalIndexByLocal(e),r=tt("div").addClass(this.cssPrefix+"-row").addClass(this.cssPrefix+"-row-"+(e%2==1?"odd":"even")).data("row-idx",""+i).attr("tabindex","-1").on("click",(function(i){n.activeRowIndex=e,n.fireEvent({type:"rowClick",row:t,rowIndex:e,sourceEvent:i})})).on("dblclick",(function(i){n.fireEvent({type:"rowDbClick",row:t,rowIndex:e,sourceEvent:i})}));0==e&&r.addClass(this.cssPrefix+"-row-first");var o=r.toDOM();return this.options.showActiveRow&&e==this.activeRowIndex&&r.addClass(this.cssPrefix+"-row-active"),this.columns.getItems().forEach((function(e,r){if(e.isVisible){var a=e.isRowNum?-1:n.dataTable.columns.getIndex(e.dataColumn.id),s=e.isRowNum?i+1:t.getValue(a);o.appendChild(n.renderCell(e,r,s,o))}})),o},t.prototype.renderCell=function(t,e,n,i){var r=tt("div").addClass(this.cssPrefix+"-cell").data("col-idx",""+e).attr("tabindex","-1").setStyle("width",t.width+"px");t.align==ut.LEFT?r.addClass(this.cssPrefix+"-cell-align-left"):t.align==ut.RIGHT?r.addClass(this.cssPrefix+"-cell-align-right"):t.align==ut.CENTER&&r.addClass(this.cssPrefix+"-cell-align-center");var o=r.toDOM(),a=o.appendChild(tt("div").addClass(this.cssPrefix+"-cell-value").toDOM());return t.cellRenderer&&t.cellRenderer(n,t,a,i),o},t.prototype.setPage=function(t){this.pagination.page=t,this.fireEvent({type:"pageChanged",page:t}),this.refresh(),this.bodyViewportDiv.focus()},t.prototype.renderPageNavigator=function(){var t=this,e=document.createElement("div");e.className=this.cssPrefix+"-pagination-wrapper";var n=this.dataTable.getTotal();if(this.options.paging&&this.options.paging.enabled&&n>0){var i=this.paginationOptions.useBootstrap?"":this.cssPrefix+"-",r=function(e){var n=e.target;if(n.hasAttribute("data-page")){var i=parseInt(n.getAttribute("data-page"));t.setPage(i)}},o=function(e,n,o,a,s){var l=document.createElement("li");if(l.className=i+"page-item",!a){s&&(l.className+=" active");var u=document.createElement("a");return u.setAttribute("href","javascript:void(0)"),u.innerHTML=n||e.toString(),u.setAttribute("data-page",""+e),u.className=i+"page-link",u.addEventListener("click",r),l.appendChild(u),l}var c=document.createElement("span");if(c.setAttribute("aria-hidden","true"),c.className=i+"page-link",o)l.className+=" disabled";else{if(t.paginationOptions.useBootstrap)(c=document.createElement("a")).setAttribute("href","javascript:void(0)"),c.setAttribute("data-page",""+e);else{var d=document.createElement("a");d.setAttribute("href","javascript:void(0)"),d.setAttribute("data-page",""+e),c=d}c.className=i+"page-link",c.addEventListener("click",r)}return c.innerHTML=n,l.appendChild(c),l};if(this.dataTable.elasticChunks){var a=this.pagination.page||1;(l=document.createElement("ul")).className=i+"pagination";var s=o(a-1,"&laquo;",1==a,!0,!1);l.appendChild(s),s=o(a+1,"&raquo;",this.isLastPage(),!0,!1),l.appendChild(s),e.appendChild(l)}else if(this.pagination.total>this.pagination.pageSize){a=this.pagination.page||1;var l,u=Math.ceil(this.pagination.total/this.pagination.pageSize)||1,c=this.paginationOptions.maxButtonCount||10,d=a-1,h=d-d%c+1,p=h+c-1;p>u&&(p=u),(l=document.createElement("ul")).className=i+"pagination";s=o(h-1,"&laquo;",1==h,!0,!1);l.appendChild(s);for(var f=h;f<=p;f++)s=o(f,f.toString(),!1,!1,f==a),l.appendChild(s);s=o(p+1,"&raquo;",p==u,!0,!1),l.appendChild(s),e.appendChild(l)}if(this.options.paging.allowPageSizeChange){var g=document.createElement("div");g.className=this.cssPrefix+"-page-sizes";var m=document.createElement("div");m.className="kfrm-select "+this.cssPrefix+"-page-sizes-select",g.appendChild(m);var y=document.createElement("select"),v=this.options.paging.pageSizeItems||[],b=new Set(v);b.add(this.options.paging.pageSize||20),Array.from(b).forEach((function(t){var e=document.createElement("option");e.value=t.toString(),e.text=t.toString(),y.appendChild(e)})),y.value=(this.pagination.pageSize||20).toString(),m.appendChild(y),y.addEventListener("change",(function(e){var n=parseInt(e.target.value);t.pagination.pageSize=n,t.pagination.page=1,t.refresh()}));var C=document.createElement("div");C.className=this.cssPrefix+"-page-sizes-label",g.appendChild(C);var w=document.createElement("span");w.innerText=I.getText("GridItemsPerPage"),C.appendChild(w),e.appendChild(g)}}return e},t.prototype.addEventListener=function(t,e){return this.eventEmitter.subscribe(t,(function(t){return e(t.data)}))},t.prototype.removeEventListener=function(t,e){this.eventEmitter.unsubscribe(t,e)},t.prototype.renderHeaderButtons=function(){var t=this;return this.options.showPlusButton?tt("div").addClass(this.cssPrefix+"-header-btn-plus").title(this.options.plusButtonTitle||"Add").addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.fireEvent({type:"plusButtonClick",sourceEvent:e})}))})).toDOM():tt("span").addText("#").toDOM()},t.prototype.showLandingSlot=function(t,e){for(var n=this.headerRowDiv.querySelectorAll("[class*="+this.cssPrefix+"-table-col]"),i=[],r=1;r<n.length;r++){var o=n[r];"none"!==o.style.display&&i.push(o)}if(0===i.length)return this.landingIndex=0,void this.headerRowDiv.appendChild(this.landingSlot);var a=Y(this.landingSlot);if(!(t>=a.x&&t<=a.x+this.landingSlot.offsetWidth)){for(var s=this.landingIndex,l=0,u=i;l<u.length;l++){var c=u[l],d=Y(c),h=c.offsetWidth;t>d.x&&t<d.x+h&&(s=parseInt(c.getAttribute("data-col-idx"))-1)}s!=this.landingIndex&&(this.landingIndex=s,this.landingIndex<i.length?this.headerRowDiv.insertBefore(this.landingSlot,i[this.landingIndex]):this.headerRowDiv.appendChild(this.landingSlot))}},t.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},Object.defineProperty(t.prototype,"activeRowIndex",{get:function(){return this._activeRowIndex},set:function(t){if(t!==this._activeRowIndex){var e=this._activeRowIndex;this._activeRowIndex=t,this.updateActiveRow(),this.fireEvent({type:"activeRowChanged",oldValue:e,newValue:this.activeRowIndex,rowIndex:this.getGlobalIndexByLocal(this.activeRowIndex)})}},enumerable:!0,configurable:!0}),t.prototype.updateActiveRow=function(){var t=this;if(this.options.showActiveRow){this.bodyCellContainerDiv.querySelectorAll("[class*="+this.cssPrefix+"-row-active]").forEach((function(e){e.classList.remove(t.cssPrefix+"-row-active")}));var e=this.getActiveRow();e&&(e.classList.add(this.cssPrefix+"-row-active"),this.ensureRowVisibility(this.activeRowIndex))}},t.prototype.getActiveRow=function(){return this.getDataRow(this.activeRowIndex)},t.prototype.getDataRow=function(t){var e=Array.from(this.bodyCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-row:not(."+this.cssPrefix+"-row-totals)"));return t>=0&&t<e.length?e[t]:null},t.prototype.focus=function(){this.bodyViewportDiv.focus()},t.prototype.resizeColumns=function(){if(this.options.columnWidths.autoResize!==it.Never){var t=this.bodyCellContainerDiv.style.width;this.bodyCellContainerDiv.style.visibility="hidden",this.bodyCellContainerDiv.style.width="1px",this.headerRowDiv.style.width="1px";for(var e=0,n=this.columns.getItems(),i=this.headerCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-header-cell"),r=0,o=function(t){var o=n[t];if(!o.isVisible)return"continue";var s=a.options.columnWidths.autoResize!==it.Always&&o.dataColumn?o.dataColumn.calculatedWidth:0,l=a.bodyCellContainerDiv.querySelectorAll("."+a.cssPrefix+'-cell[data-col-idx="'+t+'"] > .'+a.cssPrefix+"-cell-value"),u=0;if(s>0)e+=s,o.width=s,l.forEach((function(t){t.parentElement.style.width=s+"px"})),i[r].style.width=s+"px";else if(0==l.length&&(i[r].style.width=null,i[r].style.whiteSpace="nowrap"),u=i[r].offsetWidth,l.length>0){l.forEach((function(t){t.parentElement.style.width=null;var e=t.parentElement.offsetWidth;e>u&&(u=e)})),u+=3;var c=o.isRowNum?a.options.columnWidths.rowNumColumn.max||500:a.options.columnWidths[o.dataColumn.type].max||2e3,d=o.isRowNum?a.options.columnWidths.rowNumColumn.min||0:a.options.columnWidths[o.dataColumn.type].min||20;u>c&&(u=c),u<d&&(u=d),S.isNumericType(o.type)&&(u=Math.round(1.3*u)),e+=u,o.width=u,l.forEach((function(t){t.parentElement.style.width=u+"px"})),i[r].style.width=u+"px",o.dataColumn&&(o.dataColumn.calculatedWidth=u)}else e+=u;r++},a=this,s=0;s<this.columns.count;s++)o(s);e>0?(this.bodyCellContainerDiv.style.width=e+"px",this.headerCellContainerDiv.style.width=e+"px"):(this.bodyCellContainerDiv.style.width=t,this.headerCellContainerDiv.style.width=t),this.bodyCellContainerDiv.style.visibility=null,this.headerRowDiv.removeAttribute("style")}}}(),function(){function t(t,e){this.slot=t,this.options=e||{},this.options.yearRange||(this.options.yearRange="c-10:c+10")}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-cal"},enumerable:!0,configurable:!0}),t.prototype.setDate=function(t){this.currentDate=new Date(t)},t.prototype.getDate=function(){return new Date(this.currentDate)},t.prototype.dateChanged=function(t){this.options.onDateChanged&&this.options.onDateChanged(this.currentDate,t)},t}()),wt=function(){function t(t){this.calendar=null,this.timePicker=null,this.options=t,this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp"},enumerable:!0,configurable:!0}),t.prototype.setDateTime=function(t){this.currentDateTime=new Date(t),this.calendar&&this.calendar.setDate(this.currentDateTime),this.timePicker&&this.timePicker.setTime(this.currentDateTime)},t.prototype.getDateTime=function(){return new Date(this.currentDateTime)},t.prototype.render=function(){var t=this;this.options.showCalendar&&(this.calendar=this.createCalendar({yearRange:this.options.yearRange,showDateTimeInput:this.options.showDateTimeInput,timePickerIsUsed:this.options.showTimePicker,oneClickDateSelection:this.options.oneClickDateSelection,onDateChanged:function(e,n){t.currentDateTime=e,t.timePicker&&t.timePicker.setTime(t.currentDateTime),t.options.showTimePicker&&t.dateTimeChanged(),n&&t.apply(t.currentDateTime)}}),this.calendar&&this.calendar.render()),this.options.showTimePicker&&(this.timePicker=this.createTimePicker({onTimeChanged:function(e){t.currentDateTime.setHours(e.getHours()),t.currentDateTime.setMinutes(e.getMinutes()),t.calendar&&t.calendar.setDate(t.currentDateTime),t.dateTimeChanged()}}),this.timePicker&&this.timePicker.render()),this.setDateTime(new Date)},t.prototype.createCalendar=function(t){return null},t.prototype.createTimePicker=function(t){return null},t.prototype.show=function(t){this.options.beforeShow&&this.options.beforeShow();var e=Y(t||document.body);this.slot.style.top=e.y+t.clientHeight+"px",this.slot.style.left=e.x+"px"},t.prototype.apply=function(t){this.options.onApply&&this.options.onApply(t),this.destroy()},t.prototype.cancel=function(){this.options.onCancel&&this.options.onCancel(),this.destroy()},t.prototype.destroy=function(){this.slot&&this.slot.parentElement&&this.slot.parentElement.removeChild(this.slot)},t.prototype.dateTimeChanged=function(){this.options.onDateTimeChanged&&this.options.onDateTimeChanged(this.currentDateTime)},t}(),Dt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),xt=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.daysOfWeek=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i.calendarBody=null,i.isManualInputChanging=!1;for(var r=0;r<i.daysOfWeek.length;r++)i.daysOfWeek[r]=I.getShortWeekDayName(r+1);for(r=0;r<i.months.length;r++)i.months[r]=I.getLongMonthName(r+1);return i}return Dt(e,t),e.prototype.setDate=function(e){t.prototype.setDate.call(this,e),this.selectedMonth=this.currentDate.getMonth(),this.selectedYear=this.currentDate.getFullYear(),this.rerenderMonth()},e.prototype.render=function(){var t=this,e=tt("div",this.slot).addClass(this.cssPrefix+"-header");this.options.showDateTimeInput?e.addChildElement(this.renderManualDateInput()):e.addChild("span",(function(e){return t.headerTextElem=e.toDOM()})),tt(this.slot).addChildElement(this.renderCalendarButtons()),this.calendarBody=tt("div",this.slot).addClass(this.cssPrefix+"-body").toDOM()},e.prototype.getInputDateFormat=function(){var t=I.getLocaleSettings();return this.options.timePickerIsUsed?t.editDateFormat+" "+t.editTimeFormat:t.editDateFormat},e.prototype.renderManualDateInput=function(){var t=this,e=this.getInputDateFormat(),n=tt("input").attr("placeholder",e).addClass(this.cssPrefix+"-header-input");return n.mask(e.replace("yyyy","9999").replace("MM","99").replace("dd","99").replace("HH","99").replace("mm","99").replace("ss","99")).on("input",(function(i){n.removeClass("error");try{t.isManualInputChanging=!0;var r=S.strToDateTime(t.manualInputElem.value,e);t.currentDate=r,t.jump(t.currentDate.getFullYear(),t.currentDate.getMonth()),t.dateChanged(!1)}catch(t){n.addClass("error")}finally{t.isManualInputChanging=!1}})).on("keydown",(function(e){13===e.keyCode&&(e.preventDefault(),e.stopPropagation(),t.manualInputElem.className.indexOf("error")<0&&!t.isManualInputChanging&&t.dateChanged(!0))})).on("focus",(function(){setTimeout((function(){t.manualInputElem.selectionStart=0,t.manualInputElem.selectionEnd=0}),50)})),this.manualInputElem=n.toDOM(),this.manualInputElem},e.prototype.updateDisplayedDateValue=function(){if(this.manualInputElem){if(!this.isManualInputChanging){var t=this.getInputDateFormat();this.manualInputElem.value=S.dateTimeToStr(this.currentDate,t),this.manualInputElem.focus()}}else if(this.headerTextElem){var e=I.getCurrentLocale();this.headerTextElem.innerText=this.currentDate.toLocaleString("en"==e?void 0:e,{year:"numeric",month:"long",day:"numeric"})}},e.prototype.renderCalendarButtons=function(){var t=this;return tt("nav").addClass(this.cssPrefix+"-nav").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-prev").on("click",(function(){t.prev()})).addChild("span",(function(t){return t.html("&lsaquo;")}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-selectors").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-month").addChild("select",(function(e){e.on("change",(function(){t.jump(t.selectedYear,parseInt(t.selectMonthElem.value))}));for(var n=function(n){e.addChild("option",(function(e){return e.attr("value",n.toString()).text(t.months[n])}))},i=0;i<t.months.length;i++)n(i);t.selectMonthElem=e.toDOM()}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-year").addChild("select",(function(e){return t.selectYearElem=e.on("change",(function(){t.jump(parseInt(t.selectYearElem.value),t.selectedMonth)})).toDOM()}))}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-next").on("click",(function(){t.next()})).addChild("span",(function(t){return t.html("&rsaquo;")}))})).toDOM()},e.prototype.prev=function(){this.selectedYear=0===this.selectedMonth?this.selectedYear-1:this.selectedYear,this.selectedMonth=0===this.selectedMonth?11:this.selectedMonth-1,this.rerenderMonth()},e.prototype.next=function(){this.selectedYear=11===this.selectedMonth?this.selectedYear+1:this.selectedYear,this.selectedMonth=(this.selectedMonth+1)%12,this.rerenderMonth()},e.prototype.rerenderSelectYear=function(){var t=/c-(\d*):c\+(\d*)/g.exec(this.options.yearRange),e=0,n=1;null!==t&&(e=parseInt(t[1]),n=parseInt(t[2])),this.selectYearElem.innerHTML="";for(var i=0;i<=e+n;i++){var r=document.createElement("option"),o=this.selectedYear-e+i;r.value=o.toString(),r.innerText=o.toString(),this.selectYearElem.appendChild(r)}},e.prototype.jump=function(t,e){this.selectedYear=t,this.selectedMonth=e,this.rerenderMonth()},e.prototype.rerenderMonth=function(){var t=this;this.updateDisplayedDateValue(),this.rerenderSelectYear();var e=new Date(this.selectedYear,this.selectedMonth).getDay(),n=new Date(this.selectedYear,this.selectedMonth+1,0).getDate();this.calendarBody.innerHTML="",this.selectYearElem.value=this.selectedYear.toString(),this.selectMonthElem.value=this.selectedMonth.toString(),this.daysOfWeek.forEach((function(e,n){tt("div",t.calendarBody).addClass(t.cssPrefix+"-weekday").addClass(0==n||6==n?t.cssPrefix+"-weekend":"").text(e)}));for(var i=0;i<e;i++)tt("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty");for(var r=new Date,o=1;o<=n;o++){var a=tt("div",this.calendarBody).addClass(this.cssPrefix+"-day").attr("data-date",o.toString()).text(o.toString()).on("click",(function(e){t.currentDate.setFullYear(t.selectedYear),t.currentDate.setMonth(t.selectedMonth),t.currentDate.setDate(parseInt(e.target.getAttribute("data-date"))),t.dateChanged(t.options.oneClickDateSelection)}));o===r.getDate()&&this.selectedYear===r.getFullYear()&&this.selectedMonth===r.getMonth()&&a.addClass(this.cssPrefix+"-day-current"),o===this.currentDate.getDate()&&this.selectedYear===this.currentDate.getFullYear()&&this.selectedMonth===this.currentDate.getMonth()&&a.addClass(this.cssPrefix+"-day-selected");var s=(e+o-1)%7;0!=s&&6!=s||a.addClass(this.cssPrefix+"-weekend")}var l=(e+n)%7,u=0==l?0:7-l;for(i=0;i<u;i++)tt("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty")},e.prototype.dateChanged=function(e){t.prototype.dateChanged.call(this,e),this.rerenderMonth()},e}(Ct),Et=function(){function t(t,e){this.slot=t,this.options=e||{}}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-tp"},enumerable:!0,configurable:!0}),t.prototype.setTime=function(t){this.currentTime=new Date(t)},t.prototype.getTime=function(){return new Date(this.currentTime)},t.prototype.timeChanged=function(){this.options.onTimeChanged&&this.options.onTimeChanged(this.currentTime)},t}(),Tt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),It=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tt(e,t),e.prototype.setTime=function(e){t.prototype.setTime.call(this,e),this.updateDisplayedTime(),this.hoursInput.valueAsNumber=e.getHours(),this.minutesInput.valueAsNumber=e.getMinutes()},e.prototype.render=function(){var t=this;tt("div",this.slot).addClass(this.cssPrefix+"-time").addChild("span",(function(e){return t.timeText=e.toDOM()})).toDOM();var e=tt("div",this.slot).addClass(this.cssPrefix+"-sliders");return e.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-time-row").title("Hours").addChild("input",(function(e){return t.hoursInput=e.addClass(t.cssPrefix+"-input-hours").type("range").attr("min","0").attr("max","23").attr("step","1").on("input",(function(e){t.currentTime.setHours(t.hoursInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),e.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-time-row").title("Minutes").addChild("input",(function(e){return t.minutesInput=e.addClass(t.cssPrefix+"-input-minutes").type("range").attr("min","0").attr("max","59").attr("step","1").on("input",(function(e){t.currentTime.setMinutes(t.minutesInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),this.slot},e.prototype.updateDisplayedTime=function(){var t=I.getCurrentLocale(),e=this.currentTime.toLocaleString("en"==t?void 0:t,{hour:"numeric",minute:"numeric"});this.timeText.innerText=e},e}(Et),St=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}St(e,t),e.prototype.render=function(){var e=this,n=tt("div",document.body).addClass(""+this.cssPrefix).attr("tabIndex","0").setStyle("position","absolute").setStyle("top","-1000px").setStyle("left","-1000px").on("keydown",(function(t){return 27===t.keyCode?e.cancel():13===t.keyCode&&e.apply(e.getDateTime()),!1}));this.options.zIndex&&n.setStyle("z-index",""+this.options.zIndex),this.slot=n.toDOM(),t.prototype.render.call(this),this.renderButtons(),this.globalMouseDownHandler=function(t){var n=window.event||t;n.srcElement||n.target;return!e.slot.contains(n.target)&&(document.removeEventListener("mousedown",e.globalMouseDownHandler,!0),e.cancel()),!0}},e.prototype.renderButtons=function(){var t=this,e=tt("div",this.slot).addClass(this.cssPrefix+"-buttons").addChild("button",(function(e){return t.nowButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-now").text(I.getText("ButtonNow")).on("click",(function(){return t.setDateTime(new Date),t.dateTimeChanged(),!1})).toDOM()}));!this.options.showTimePicker&&this.options.oneClickDateSelection||e.addChild("button",(function(e){return t.submitButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-apply").text(I.getText("ButtonApply")).on("click",(function(){return t.apply(t.getDateTime()),!1})).toDOM()})),e.addChild("button",(function(e){return t.submitButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-cancel").text(I.getText("ButtonCancel")).on("click",(function(){return t.cancel(),!1})).toDOM()}))},e.prototype.createCalendar=function(t){return this.calendarSlot=tt("div",this.slot).addClass(this.cssPrefix+"-cal").toDOM(),new xt(this.calendarSlot,t)},e.prototype.createTimePicker=function(t){return this.timePickerSlot=tt("div",this.slot).addClass(this.cssPrefix+"-tp").toDOM(),new It(this.timePickerSlot,t)},e.prototype.show=function(e){var n=this;if(this.options.showDateTimeInput){this.options.beforeShow&&this.options.beforeShow();var i=Y(e||document.body),r=Y(e?e.parentElement||e:document.body);this.slot.style.top=r.y+"px",this.slot.style.left=i.x+"px"}else t.prototype.show.call(this,e),this.slot.focus();setTimeout((function(){document.addEventListener("mousedown",n.globalMouseDownHandler,!0)}),1)}}(wt);!function(t){t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(gt||(gt={}));var kt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Mt=function(){function t(){}return t.prototype.openConfirm=function(t,e,n){var i=this,r={title:t,closable:!1,submitable:!0,cancelable:!0,body:'<div id="kdlg-dialog-confirm">'+e+"</div>"};return n?(r.onSubmit=function(){n(!0)},r.onCancel=function(){n(!1)},void this.open(r)):new Promise((function(t){r.onSubmit=function(){t(!0)},r.onCancel=function(){t(!1)},i.open(r)}))},t.prototype.openPrompt=function(t,e,n,i){var r=this,o={title:t,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,body:'<div id="kdlg-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="kdlg-dialog-form-input" id="kdlg-dialog-form-content">'+e+'</label>\n <input type="text" name="'+'kdlg-dialog-form-input" id="'+'kdlg-dialog-form-input" />\n </div>\n </div>',arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");n&&(t.value=n),t.focus()}},a=function(t){var e=document.getElementById("kdlg-dialog-form-input"),n=e.value;return n&&n.replace(/\s/g,"").length>0?(t(n),!0):(e.classList.add("eqjs-invalid"),!1)};return i?(o.onSubmit=function(){return a(i)},o.onCancel=function(){i("")},void this.open(o)):new Promise((function(t){o.onSubmit=function(){return a(t)},o.onCancel=function(){t("")},r.open(o)}))},t.prototype.open=function(t,e){var n=this,i=new Ot(t,e),r=t.onDestroy;return t.onDestroy=function(t){n.untrack(t),r&&r(t)},i.open(),this.track(i),i},t.prototype.createSet=function(t){return new Rt(t,this)},t.prototype.untrack=function(e){var n=t.openDialogs.indexOf(e);n>=0&&t.openDialogs.splice(n,1)},t.prototype.track=function(e){t.openDialogs.push(e)},t.prototype.openProgress=function(t){var e=this,n=new Pt(t),i=t.onDestroy;return t.onDestroy=function(t){e.untrack(t),i&&i(t)},n.open(),this.track(n),n},t.prototype.getAllDialogs=function(){return Array.from(t.openDialogs)},t.prototype.closeAllDialogs=function(){for(var e=0,n=Array.from(t.openDialogs);e<n.length;e++){n[e].close()}},t.openDialogs=[],t}(),Ot=function(){function t(t,e){var n=this;this.options=t,this.submitHandler=function(t){return(!n.options.onSubmit||!1!==n.options.onSubmit(n,t))&&(n.destroy(),!0)},this.cancelHandler=function(){n.options.onCancel&&n.options.onCancel(n),n.destroy()},this.keydownHandler=function(t){return 13!=t.keyCode||!n.isActiveDialog()||(t.preventDefault(),t.stopPropagation(),!n.submitHandler())||(window.removeEventListener("keydown",n.keydownHandler,!1),!1)},this.dialogId=S.generateId("dlg"),this.data=e,this.slot=tt("div",document.body).attr("tab-index","-1").data("dialog-id",this.dialogId).addClass("kdlg-modal","is-active").focus().addChild("div",(function(t){return t.addClass("kdlg-modal-background")})).addChild("div",(function(i){return n.windowElement=i.addClass("kdlg-modal-window").addChild("header",(function(e){n.headerElement=e.addClass("kdlg-header").addChild("p",(function(e){return e.addClass("kdlg-header-title").addText(t.title)})).toDOM(),!1!==t.closable&&e.addChild("button",(function(t){return t.addClass("kdlg-modal-close").on("click",(function(){n.cancelHandler()})).focus()}))})).addChild("div",(function(t){t.addClass("kdlg-alert-container"),n.alertElement=t.toDOM()})).addChild("section",(function(i){if(n.bodyElement=i.addClass("kdlg-body").toDOM(),"string"==typeof t.body){var r=H.renderLiquidTemplate(t.body,e);i.addHtml(r)}else i.addChildElement(t.body)})).addChild("footer",(function(e){var i=null;i=t.footerAlignment&&t.footerAlignment==gt.Center?"align-center":"align-right",n.footerElement=e.addClass("kdlg-footer").toDOM(),e.addClass(i),!1!==t.submitable&&(e.addChild("button",(function(e){e.id(n.dialogId+"-btn-submit").addClass("kfrm-button","is-info").addText(t.submitButtonText||I.getText("ButtonOK")),t.recaptchaSiteKey?(e.data("sitekey",t.recaptchaSiteKey),e.addClass("g-recaptcha"),e.on("click",(function(e){grecaptcha?grecaptcha.ready((function(){grecaptcha.execute(t.recaptchaSiteKey,{action:"submit"}).then((function(t){n.submitHandler(t)}))})):n.submitHandler()}))):e.on("click",(function(t){n.submitHandler()})),e.focus()})),!1!==t.cancelable&&e.addChild("button",(function(e){return e.id(n.dialogId+"-btn-cancel").addClass("kfrm-button").addText(t.cancelButtonText||I.getText("ButtonCancel")).on("click",(function(t){n.cancelHandler()}))})))})).toDOM()})).toDOM()}return t.prototype.getData=function(){return this.data},t.prototype.getRootElement=function(){return this.slot},t.prototype.getSubmitButtonElement=function(){return document.getElementById(this.dialogId+"-btn-submit")},t.prototype.getCancelButtonElement=function(){return document.getElementById(this.dialogId+"-btn-cancel")},t.prototype.open=function(){var t=this;this.options.beforeOpen&&this.options.beforeOpen(this),tt(this.slot).show(),this.options.arrangeParents&&this.arrangeParents(!0);var e=this.slot.querySelector(".kdlg-modal-window");this.options.height&&(e.style.height="string"==typeof this.options.height?this.options.height:this.options.height+"px"),this.options.width&&(e.style.width="string"==typeof this.options.width?this.options.width:this.options.width+"px"),this.options.submitOnEnter&&window.addEventListener("keydown",this.keydownHandler,!1),this.slot.querySelectorAll("input").forEach((function(e){return e.addEventListener("input",(function(){t.clearAlert(),t.options.onInput&&t.options.onInput(t)}))})),this.options.onShow&&this.options.onShow(this)},t.prototype.submit=function(){this.submitHandler()},t.prototype.cancel=function(){this.cancelHandler()},t.prototype.close=function(){this.destroy()},t.prototype.disableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!0}))},t.prototype.enableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!1}))},t.prototype.showAlert=function(t,e,n){var i=tt("div").addClass("kdlg-alert "+(e||"")).addChild("span",(function(t){return t.addClass("kdlg-alert-closebtn").text("×").on("click",(function(t){var e=t.target.parentElement;e.parentElement.removeChild(e)}))})).addText(t).toDOM();!0===n&&this.clearAlert(),this.alertElement.appendChild(i)},t.prototype.clearAlert=function(){this.alertElement.innerHTML=""},t.prototype.destroy=function(){document.querySelectorAll('[data-dialog-id="'+this.dialogId+'"]').length<=0||(this.options.arrangeParents&&this.arrangeParents(!1),document.body.removeChild(this.slot),this.options.submitOnEnter&&window.removeEventListener("keydown",this.keydownHandler,!1),this.options.onDestroy&&this.options.onDestroy(this))},t.prototype.isActiveDialog=function(){var t=document.documentElement.querySelectorAll(".kdlg-modal");return t[t.length-1]===this.slot},t.prototype.arrangeParents=function(t){for(var e=document.documentElement.querySelectorAll(".kdlg-modal-window"),n=0;n<e.length-1;n++)if(t){var i=0==n?20:40*n+20;tt(e[n]).setStyle("margin-top",i+"px").setStyle("margin-left",i+"px")}else tt(e[n]).removeStyle("margin-top").removeStyle("margin-left")},t}(),Pt=function(t){function e(e,n){var i,r,o=this,a=tt("div").addChild("div",(function(t){return i=t.text(e.content||"").toDOM()})).addChild("div",(function(t){t.addClass("kdlg-progress-line").addChild("div",(function(t){r=t.addClass("fill").toDOM(),e.determinated?t.setStyle("width","0%"):t.addClass("indeterminate")}))})).toDOM();return(o=t.call(this,{title:e.title,body:a,beforeOpen:e.beforeOpen,onSubmit:e.onSubmit,width:e.width,height:e.height,submitable:!1,cancelable:!1,closable:!1,onDestroy:e.onDestroy},n)||this).contentElement=i,o.progressElement=r,o}return kt(e,t),e.prototype.updateContent=function(t){this.contentElement.innerText=t},e.prototype.updateProgress=function(t){var e=this;t=this.in01(t),this.progressElement.style.width=100*t+"%",1===t&&setTimeout((function(){e.submit()}),500)},e.prototype.in01=function(t){return t>1?1:t<0?0:t},e}(Ot),Rt=function(){function t(t,e){this.options=t,this.dialogService=e,this.currentDialog=null,this.currentIndex=0,this.options=t,this.dialogService=e}return t.prototype.getCurrent=function(){return this.currentDialog},t.prototype.openNext=function(t){return this.open(this.currentIndex+1,t)},t.prototype.openPrev=function(t){return this.open(this.currentIndex-1,t)},t.prototype.open=function(t,e){if(t<0?this.currentIndex=0:t>=this.options.length?this.currentIndex=this.options.length-1:this.currentIndex=t,this.currentDialog)try{this.currentDialog.close()}catch(t){}var n=this.options[this.currentIndex];return this.currentDialog=this.dialogService.open(n,e),this.currentDialog},t.prototype.close=function(){this.currentDialog&&(this.currentDialog.close(),this.currentDialog=null)},t}();I.updateDefaultTexts({GridPageInfo:"{FirstPageRecordNum} - {LastPageRecordNum} of {Total} records",GridItemsPerPage:"items per page",ButtonOK:"OK",ButtonCancel:"Cancel",ButtonApply:"Apply",ButtonNow:"Now",LblTotal:"Total"});new Mt;function At(t){return!t||""===t.trim()}var _t,Lt="https://korzh.com/api/license",Nt=function(){function t(t){this.http=new L,this.context=t}return t.prototype.show=function(){var t=this,e=new Mt;this.dialogSet=e.createSet([{closable:!1,cancelable:!1,submitOnEnter:!0,title:"No license key for EasyQuery",body:this.buildStartPage(),submitButtonText:"Submit",onInput:this.validateForm.bind(this),onSubmit:this.startPageOnSubmit.bind(this)},{closable:!1,cancelable:!1,submitOnEnter:!0,title:"Please check your inbox",body:this.buildCodePage(),submitButtonText:"Get License Key",onInput:this.validateForm.bind(this),onSubmit:this.codePageOnSubmit.bind(this)},{closable:!1,cancelable:!1,submitable:!1,title:"Success",body:this.buildSuccessPage()},{closable:!1,cancelable:!1,submitable:!1,title:"Failure",body:this.buildFailurePage()}]);var n=this.dialogSet.open(0);setTimeout((function(){t.validateForm(n);var e=document.getElementById("eqAuthEmail");e&&e.focus()}),200)},t.prototype.isValidForm=function(t){var e=t.querySelector("#eqAuthEmail");if(e)return!At(e.value)&&e.value.toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);var n=t.querySelector("#eqAuthCode");return!n||!At(n.value)&&!isNaN(+n.value)&&n.value==n.value.trim()&&6===n.value.length},t.prototype.validateForm=function(t){t.getSubmitButtonElement().disabled=!this.isValidForm(t.getRootElement())},t.prototype.addInputField=function(t,e){t.addChild("label",(function(t){return t.attr("for",e.id).addHtml(e.label+" "+(e.required?'<sup style="color: red">*</sup>':"")+": ")})).addChild("input",(function(t){t.id(e.id),t.name(e.name||e.id),t.type(e.type||"text"),void 0!==e.value&&t.value(e.value),e.onInput&&t.on("input",e.onInput)}))},t.prototype.buildStartPage=function(){var t,e=tt("div");return e.addChild("div",(function(t){return t.html('<div style="font-size:1.2em">The EasyQuery license key is either absent, invalid or was issued for a different version of the library.</div><div style="font-size:1.2em">Please fill out the form to obtain a valid trial license key.</div>')})),e.addClass("kfrm-form").addChild("div",(function(e){t=e,e.addClass("kfrm-fields label-above"),e.addClass("kfrm-break-20")})),this.addInputField(t,{id:"eqAuthEmail",name:"email",label:"Email",required:!0}),this.addInputField(t,{id:"eqAuthName",name:"contactName",label:"Name (optional)",required:!1}),e.addChild("div",(function(t){return t.html('<div style="margin-top:20px;font-size:0.9em">* By clicking Submit, you agree with Korzh.com <a href="https://korzh.com/terms-of-use">Terms of use</a> and <a href="https://korzh.com/privacy">Privacy policy</a>.</div><div style="font-size:0.9em">You also agree to receive email messages from Korzh.com. This consent may be revoked at any time.</div>')})),e.toDOM()},t.prototype.buildCodePage=function(){var t,e=tt("div");return e.addChild("div",(function(t){return t.html('<div style="font-size:1.2em">We sent a confirmation code to <strong>{{email}}</strong>.</div><div style="font-size:1.2em">Please find it in the email and enter to the text box below</div>')})),e.addClass("kfrm-form").addChild("div",(function(e){t=e,e.addClass("kfrm-fields label-above"),e.addClass("kfrm-break-20")})),this.addInputField(t,{id:"eqAuthCode",name:"code",label:"Confirmation code",required:!0}),e.addChild("div",(function(t){return t.html('<div style="margin-top:20px;font-size:0.9em">NB: Don\'t forget to check your SPAM folder if the message does not arrive within the next 5 minutes, and mark it as "Not Spam" if it\'s found there.</div>')})),e.toDOM().outerHTML},t.prototype.buildSuccessPage=function(){var t=tt("div");return t.addChild("div",(function(t){return t.html('<div style="font-size:1.2em">You have successfully completed the registration process.</div><div style="font-size:1.2em">Please restart your web application to get the key applied.</div>')})),t.toDOM()},t.prototype.buildFailurePage=function(){var t=tt("div");return t.addChild("div",(function(t){return t.html("{{message}}")})),t.toDOM().outerHTML},t.prototype.startPageOnSubmit=function(t){var e=this,n=document.getElementById("eqAuthEmail"),r=document.getElementById("eqAuthName"),o=n.value,a=r.value;return t.disableButtons(),this.http.post(i.equtils.combinePath(Lt,"get-code"),{email:o,name:a,data:{ptag:this.context.backendInfo.type,apptype:this.context.backendInfo.subType}},{dataType:"json"}).then((function(t){if(0!==t.status)throw new Error(t.message);var n=e.dialogSet.openNext({email:o});setTimeout((function(){e.validateForm(n);var t=document.getElementById("eqAuthCode");t&&t.focus()}),200)})).catch((function(e){t.showAlert(e.message,"error",!0),t.enableButtons()})),!1},t.prototype.codePageOnSubmit=function(t){var e=this,n=document.getElementById("eqAuthCode").value;return t.disableButtons(),this.http.post(i.equtils.combinePath(Lt,"get-key"),{token:n,ptag:this.context.backendInfo.type,version:"7.2"},{dataType:"json"}).then((function(t){switch(t.status){case 0:var n=i.equtils.combinePath(e.context.getBaseEndpoint(),"lck");e.http.post(n,{version:"7.2",key:t.key},{dataType:"json"}).then((function(t){return e.dialogSet.openNext()}));break;case 2:e.dialogSet.open(3,{message:'<div style="font-size:1.2em">Your trial license for EasyQuery has expired.</div><div style="font-size:1.2em">Please <a href="https://korzh.com/support">contact us</a> if you want to extend the trial period.</div>'});break;case 3:e.dialogSet.open(3,{message:'<div style="font-size:1.2em">Your purchased license for EasyQuery has expired.</div><div style="font-size:1.2em">You need to <a href="https://korzh.com/account">renew the subscription</a> to get a valid license.</div>'});break;default:throw new Error(t.message)}})).catch((function(e){t.showAlert(e.message,"error",!0),t.enableButtons()})),!1},t}();function Ft(){_t&&(_t.style.right="-400px",setTimeout((function(){_t.parentNode.removeChild(_t)}),5e3))}i.EqContext.prototype.setLicenseKeyEndpoint=function(t){console.warn("This method is deprecated and will be ignored.\n The main EasyQuery endpoint (set via useEndpoint() function) is used to get the license since version 7.0.\n So, you can simply remove this function call")},i.EqContext.prototype.useEnterprise=function(t){var e=this,n=function(t,n){if(o.ck(t),o.__kt>1){var i=e.getServices();i.registerDataModelResolver((function(t){return new C})),i.registerQueryResolver((function(t){return new y(t.getModel())})),i.registerQueryStorageResolver((function(t){return new v(t)})),i.registerAggregatesCalculator((function(t){return new w(t)})),2===o.__kt&&(console.warn("EasyQuery.JS is working in the TRIAL MODE!\nPlease order a license (https://korzh.com/eq) to get a proper product key."),function(){(_t=document.createElement("div")).style.position="fixed",_t.style.bottom="0",_t.style.right="-400px",_t.style.width="400px",_t.style.height="100px",_t.style.color="grey",_t.style.textAlign="center",_t.style.opacity="0.7",_t.style.font="bold 1em Trebuchet MS, Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif",_t.style.transition="right 3s ease-out";var t=document.createElement("div"),e=document.createElement("span");e.innerText="EasyQuery",e.style.color="#3A94D4",e.style.lineHeight="50px",t.appendChild(e);var n=document.createElement("span");n.innerText="by Korzh.com",n.style.marginLeft="10px",t.appendChild(n),_t.appendChild(t);var i=document.createElement("div");i.innerText="FOR TRIAL USE ONLY",i.style.fontSize="1.2em",i.style.fontWeight="1000",_t.appendChild(i),document.body.appendChild(_t)}(),setTimeout((function(){_t&&(_t.style.right="0"),setTimeout(Ft,6e3)}),3e3))}else{if(n)!function(t){var e,n,i,r;switch(t.__kt){case 1:e="EasyQuery trial has expired",n='Your trial period for EasyQuery has expired. \n\tYou can send a request to <a href="https://korzh.com/account">extend your trial</a> or <a href="https://korzh.com/easyquery/licensing">buy a license</a> to get rid of all limitations.',i="Buy a license",r="https://korzh.com/easyquery/licensing";break;case-3:e="No license key for EasyQuery",n='Please <a href="https://korzh.com/easyquery#get-started">register for a trial</a> \n\tor <a href="https://korzh.com/easyquery/licensing">purchase a license</a> to get a proper product key. <br />\n\tIf you already have a key, please follow <a href="https://korzh.com/easyquery/docs/getting-started/product-key">this guide</a> to apply it.',i="Register trial",r="https://korzh.com/easyquery#get-started";break;default:e="Invalid key for EasyQuery!",n='The EasyQuery product key is either invalid or was issued for a different version of the library.\n The version you are using now is 7.2,\n\tso please <a href="https://korzh.com/account">login to your account</a> to get a proper key for version 7.2.',i="Get key",r="https://korzh.com/account"}var o=(new Mt).open({closable:!1,cancelable:!1,submitable:!1,title:e,body:n}).getRootElement().querySelector("footer");tt(o).removeClass("align-right").setStyle("justify-content","center").addChild("button",(function(t){return t.addClass("kfrm-button","is-info").addText(i).on("click",(function(t){window.location.href=r}))})),1==t.__kt&&tt(o).addChild("button",(function(t){return t.addClass("kfrm-button").addText("Extend trial").on("click",(function(t){window.location.href="https://korzh.com/account"}))}))}(o);else new Nt(e).show()}};if("string"==typeof t)n(t,!0);else{if("function"!=typeof t)throw new Error("Wrong type of 'keyOrInitCallback' parameter. It must be a string with a license key or a callback function.");var r=this.getServices().getHttpClient(),a=i.equtils.combinePath(this.getBaseEndpoint(),"lck2");r.get(a).then((function(i){n(i.key.split("").reverse().join(""),!1),e.useBackend({type:i.backendType,subType:i.appType}),t()})).catch((function(o){a=i.equtils.combinePath(e.getBaseEndpoint(),"lck"),r.get(a).then((function(e){n(e.split("").reverse().join(""),!1),t()})).catch((function(t){return e.throwError({action:"LCK",sourceError:t})}))}))}};var Bt=function(){return Bt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Bt.apply(this,arguments)},qt=function(){function t(t){this.context=t,this._needRecalculation=!0,this.aggrContainer=new i.EqAggregatesContainer(t)}return t.prototype.getAggrContainer=function(){return this.aggrContainer},t.prototype.calculate=function(t){this._needRecalculation=!1,this.aggrContainer.clear(),(t=t||{}).maxLevel=t.maxLevel>=0?t.maxLevel:0;var e=[],n=this.context.createQuery();n.loadFromData(this.context.getQuery().toJSONData());for(var r=this.context.getQuery().getAggregationSettings(),o=r.getAggregates(),a=r.getAggregates().map((function(t){return t.colId})),s=n.getColumns().filter((function(t){return a.indexOf(t.id)>=0})),l=function(t){n.changeColumnType(t,i.ExprTag.AggregateFunction,{funcId:o.filter((function(e){return e.colId==t.id}))[0].funcId})},u=0,c=s;u<c.length;u++){l(C=c[u])}for(var d=n.getColumns().filter((function(t){return t.expr.tag!==i.ExprTag.AggregateFunction})),h=0,p=d;h<p.length;h++){(C=p[h]).setHidden(!0)}if(r.hasRecordCount()){(C=n.createColumn()).caption=r.COUNT_FIELD_NAME,C._id=r.COUNT_FIELD_NAME;var f=new i.Expression(C);f.tag=i.ExprTag.CustomSql,f.sql="COUNT(*)",f.baseAttrId=null,C.expr=f,n.getColumns().push(C)}r.hasGrandTotals()&&e.push(this.processLevel({query:n,level:0,groupName:"Grand Totals",resultObtainedCallback:t.resultObtained,errorOccurredCallback:t.errorOccurred}));for(var g=r.getGroups(),m=1;m<=g.length;m++){for(var y=g[m-1],v=0,b=d;v<b.length;v++){var C;(C=b[v]).setHidden(y.columns.indexOf(C.id)<0)}e.push(this.processLevel({query:n,level:m,groupName:y.name,resultObtainedCallback:t.resultObtained,errorOccurredCallback:t.errorOccurred}))}return Promise.all(e).then((function(){})).catch((function(t){return console.error(t)}))},t.prototype.processLevel=function(t){var e=this,n=this.context.getServices().getDataFetcher(),i={aux:!0,query:t.query};return this.context.debugMode&&(i.debug="Fetching group data. Group: '"+t.groupName+"', level: "+t.level),n.fetchData(i).then((function(n){for(var i=new V({elasticChunks:!0}),r=n.resultSet,o=0,a=r.cols;o<a.length;o++){var s=a[o];i.columns.add(s)}for(var l=0,u=r.rows;l<u.length;l++){var c=u[l];i.addRow(c)}var d=e.buildLevelData(t.level,i);e.aggrContainer.setAggregateData(t.level,d),t.resultObtainedCallback&&t.resultObtainedCallback(n,t.level)})).catch((function(e){t.errorOccurredCallback&&t.errorOccurredCallback(Bt(Bt({},e),{level:t.level}))}))},t.prototype.buildLevelData=function(t,e){var n=this.context.getQuery().getAggregationSettings(),i=t>0?n.getGroups()[t-1].columns:[],r=n.getAggregates().map((function(t){return t.colId}));n.hasRecordCount()&&r.push(n.COUNT_FIELD_NAME);for(var o=new Map,a=0,s=e.getCachedRows();a<s.length;a++){for(var l=s[a],u={},c={},d=0,h=i;d<h.length;d++){var p=h[d];if(e.columns.getIndex(p)>=0){var f=l.getValue(p);n.caseSensitiveGroups||"string"!=typeof f||(f=f.toLowerCase()),u[p]=f}}for(var g=0,m=r;g<m.length;g++){var y=m[g];c[y]=l.getValue(y)}o.set(JSON.stringify(u),c)}return o},t.prototype.needRecalculation=function(){return this._needRecalculation},t.prototype.reset=function(){this._needRecalculation=!0},t}()}])}));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("easyqueryCore")):"function"==typeof define&&define.amd?define("easyqueryEnterprise",["easyqueryCore"],e):"object"==typeof exports?exports.easyqueryEnterprise=e(require("easyqueryCore")):t.easyqueryEnterprise=e(t.easyqueryCore)}(window,(function(__WEBPACK_EXTERNAL_MODULE__0__){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(module,__webpack_exports__,__webpack_require__){"use strict";var browserUtils;__webpack_require__.d(__webpack_exports__,"a",(function(){return browserUtils})),function(browserUtils){var _isFirefox=null,_isIE=null;function IsIE(){if(null===_isIE){var t=navigator.userAgent;_isIE=t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1}return _isIE}function IsEdge(){return!IsIE()&&eval("!!window.StyleMedia")}function IsFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.IsIE=IsIE,browserUtils.IsEdge=IsEdge,browserUtils.IsFirefox=IsFirefox;var _detectedIsMobileMode=!1,_isMobileMode=void 0,detectIsMobileMode=function(){var t=isMobileMode();_detectedIsMobileMode=window.matchMedia("only screen and (max-width: 840px)").matches||window.matchMedia("only screen and (max-height: 420px)").matches;var e=isMobileMode();e!==t&&mobileModeChangeHandler&&mobileModeChangeHandler(e)},mobileModeChangeHandler;function isMobileMode(){return void 0!==_isMobileMode?_isMobileMode:_detectedIsMobileMode}function setIsMobileMode(t){var e=isMobileMode();_isMobileMode=t;var n=isMobileMode();n!==e&&mobileModeChangeHandler&&mobileModeChangeHandler(n)}function onMobileModeChanged(t){mobileModeChangeHandler=t}function getMobileCssClass(){return isMobileMode()?"k-mobile":null}detectIsMobileMode(),window.addEventListener("resize",(function(){return detectIsMobileMode()})),browserUtils.isMobileMode=isMobileMode,browserUtils.setIsMobileMode=setIsMobileMode,browserUtils.onMobileModeChanged=onMobileModeChanged,browserUtils.getMobileCssClass=getMobileCssClass}(browserUtils||(browserUtils={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"EqServerAggregatesCalculator",(function(){return qt})),n.d(e,"QueryEx",(function(){return y})),n.d(e,"QueryColumnEx",(function(){return g})),n.d(e,"ConditionEx",(function(){return p})),n.d(e,"DataModelEx",(function(){return C})),n.d(e,"EqServerQueryStorage",(function(){return v}));var i=n(0),r=[45,128,231];Math.trunc=Math.trunc||function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)};var o={__kt:0,ck:function(t){if(t&&t.length)try{for(var e=function(t){for(var e=function(t){var e=t;switch((e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")).length%4){case 0:break;case 2:e+="==";break;case 3:e+="="}return window.atob(e)}(t),n=e.length,i=new Uint8Array(n),r=0;r<n;r++)i[r]=e.charCodeAt(r);return i}(t.slice(0,t.length-12)),n=t.slice(t.length-12),i=!1,u=0,c=r;u<c.length;u++){var d=l(c[u]);if(n[0]===d[0]&&n[2]===d[1]){i=!0;break}}i||(o.__kt=-1);if(n[8]!=a(9,19))return void(o.__kt=-2);if(n[1]!=a(e[3]))return;if(o.__kt=n[3]!=a(e[5])?2:3,2===o.__kt){var h=""+function(t){for(var e=0,n=0;n<t.length;++n)e+=s.indexOf(t[n])*Math.pow(s.length,t.length-n-1);return e}(n.substring(4,6)+n.substring(10)),p=new Date(2e3+Number.parseInt(h.substring(0,2)),Number.parseInt(h.substring(2,4))-1,Number.parseInt(h.substring(4)),0,0,0,0);Date.now()>p.getTime()&&(o.__kt=1)}}catch(t){}else this.__kt=-3}};function a(t,e){return void 0===e&&(e=20),String.fromCharCode(65+t%e)}var s="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";function l(t){for(var e="";t>0;)e=s[t%s.length]+e,t/=s.length;return e}var u,c,d,h=(u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u(t,e)},function(t,e){function n(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.readOnly=!1,e.parameterized=!1,e.inJoin=!1,e}return h(e,t),e.prototype.isReadOnly=function(){return this.readOnly||this.getParent()&&this.getParent().isReadOnly()},e.prototype.setReadOnly=function(t){this.readOnly=t||this.getParent()&&this.getParent().isReadOnly(),this.conditions&&this.conditions.forEach((function(e){e.setReadOnly(t)}))},e.prototype.isParameterized=function(){return this.parameterized},e.prototype.setParameterized=function(t){this.parameterized=t},e.prototype.isInJoin=function(){return this.inJoin},e.prototype.setInJoin=function(t){this.inJoin=t},e.prototype.loadFromData=function(e,n){if(t.prototype.loadFromData.call(this,e,n),!(o.__kt<=1)&&(void 0!==n.readOnly&&this.setReadOnly(n.readOnly),void 0!==n.inJoin&&this.setInJoin(n.inJoin),void 0!==n.parameterized&&this.setParameterized(n.parameterized),n.conds))for(var i=0;i<n.conds.length;i++){var r=this.query.createCondition();r.loadFromData(e,n.conds[i]),this.conditions.push(r),r.setParent(this)}},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);if(o.__kt<=1)return e;if(this.isReadOnly()&&(e.readOnly=this.isReadOnly()),this.isParameterized()&&(e.parameterized=this.isParameterized()),this.isInJoin()&&(e.inJoin=this.isInJoin()),this.tag==i.CondTag.Group){e.conds=[];for(var n=0;n<this.conditions.length;n++)e.conds.push(this.conditions[n].saveToData())}return e},e}(i.Condition),f=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.readOnly=!1,e}return f(e,t),e.prototype.isReadOnly=function(){return this.readOnly},e.prototype.setReadOnly=function(t){this.readOnly=t},e.prototype.loadFromData=function(e,n){t.prototype.loadFromData.call(this,e,n),o.__kt<=2||n&&void 0!==n.readOnly&&(this.readOnly=n.readOnly)},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return o.__kt<=2||this.isReadOnly()&&(e.readOnly=this.isReadOnly()),e},e}(i.QueryColumn),m=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),y=function(t){function e(e){return t.call(this,e)||this}return m(e,t),e.prototype.isEx=function(){return o.__kt>1},e.prototype.createSubQuery=function(){return new e(this.model)},e.prototype.createCondition=function(e){return void 0===e&&(e=i.CondTag.Simple),o.__kt<=1?t.prototype.createCondition.call(this,e):new p(this,e)},e.prototype.createColumn=function(e){return void 0===e&&(e=!1),o.__kt<=1?t.prototype.createColumn.call(this,e):new g(this,e)},e.prototype.addConditionGroup=function(e,n){if(void 0===n&&(n=!0),o.__kt<=1)return t.prototype.addConditionGroup.call(this,e,n);var r=e.parent||this.getRootCondition(),a=e.linking||(r.linkType===i.LinkType.All?i.LinkType.Any:i.LinkType.All),s=this.createCondition(i.CondTag.Group);if(s.linkType=a,n){var l=this.getModel(),u=l.getFirstUICAttr(),c=l.getDefaultOperatorForAttr(u),d=this.createSimpleConditionObject(u,c,"");s.addCondition(d)}return r.addCondition(s),s},e.prototype.addExtraConditionGroup=function(e,n){return void 0===n&&(n=!0),e.parent=e.parent||this.extraConditions,o.__kt<=1?t.prototype.addExtraConditionGroup.call(this,e,n):this.addConditionGroup(e)},e}(i.Query),v=function(){function t(t){this.context=t}return t.prototype.init=function(){},t.prototype.newQuery=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=this.context.getModel(),i=t.modelId||(n?n.getId():"");t.queryId&&e.setId(t.queryId),t.name&&e.setName(t.name),t.description&&e.setDescription(t.description);var r={query:e.toJSONData()};t.data&&(r.data=t.data);var o=this.context.resolveEndpoint("NewQuery",{modelId:i});return this.context.getServices().getHttpClient().post(o,r).then((function(t){return t.query}))},t.prototype.getQueryList=function(t){var e=(t=t||{}).modelId||this.context.getModel().getId(),n=this.context.resolveEndpoint("GetQueryList",{modelId:e});return this.context.getServices().getHttpClient().get(n).then((function(t){return t.queries?t.queries:Promise.reject({message:"Wrong response format"})}))},t.prototype.loadQuery=function(t){t=t||{};var e=this.context.getModel(),n=this.context.getQuery(),i=t.modelId||e.getId(),r=t.queryId||n.getId(),o=this.context.resolveEndpoint("GetQuery",{modelId:i,queryId:r});return this.context.getServices().getHttpClient().get(o).then((function(t){return t.query}))},t.prototype.saveQuery=function(t){var e=(t=t||{}).query||this.context.getQuery(),n=t.queryId||e.getId();t.queryId&&e.setId(t.queryId);var i=t.modelId||e.getModel().getId();t.queryId&&e.setId(t.queryId);var r={query:e.toJSONData()};t.data&&(r.data=t.data);var o=this.context.resolveEndpoint("SaveQuery",{modelId:i,queryId:n});return this.context.getServices().getHttpClient().put(o,r).then((function(t){return t.query}))},t.prototype.removeQuery=function(t){t=t||{};var e=this.context.getQuery(),n=t.modelId||e.getModel().getId(),i=t.queryId||e.getId(),r={modelId:n,queryId:i};t.data&&(r.data=t.data);var o=this.context.resolveEndpoint("RemoveQuery",{modelId:n,queryId:i});return this.context.getServices().getHttpClient().delete(o,r).getPromise()},t}(),b=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e.prototype.buildQueryPath=function(e){if(o.__kt<=1)return t.prototype.buildQueryPath.call(this,e);if(this.mainEntity)return t.prototype.buildQueryPath.call(this,e);var n=this.getEntitiesInQuery(e);if(0==n.length)throw Error("Cannon build path. Path is empty");for(var r=new i.Tree(n[0]),a=1;a<n.length;a++){var s=n[a];if(!r.contains(s)){var l=this.findPath(r.value,s);if(null==l)throw Error("Unable to build query. Cannot build path.");r=this.addPathToTree(r,l[0]===r.value?l.slice(1):l)}}return r.setParents(),r},e.prototype.addPathToTree=function(t,e){if(0!=e.length){for(var n=!1,r=0,o=t.childs;r<o.length;r++){var a=o[r];if(a.value===e[0]){n=!0,e.length>1&&(a=this.addPathToTree(a,e.slice(1)));break}}if(!n)if(this.findLink(t.value,e[0])){var s=new i.Tree(e[0]);t.addChild(s),e.length>1&&(s=this.addPathToTree(s,e.slice(1)))}else{if(t.parent)throw Error("Unable to build query. Cannot build path.");var l=new i.Tree(t);(t=new i.Tree(e[0])).addChild(l),e.length>1&&(t=this.addPathToTree(t,e.slice(1)))}return t}},e.prototype.findPath=function(t,e){var n=[],i=[],r=[],o=[],a=!1;for(n.push(t),i.push(n),o.push(t);!a;){r=[];for(var s=0,l=i;s<l.length;s++){var u=l[s];if(a=this.checkPath(u,e,r,o)){u.push(e),n=u;break}}if(i=[],!a){if(0==r.length)return null;for(var c=0,d=r;c<d.length;c++){u=d[c];i.push(u)}}}return n},e.prototype.checkPath=function(t,e,n,i){for(var r=t[t.length-1],o=0,a=this.getLinksByEntity(r);o<a.length;o++){var s=a[o],l=null;if((l=s.entityFrom==r?s.entityTo:s.entityFrom)==e)return n=[],!0;if(t.indexOf(l)<0&&i.indexOf(l)<0){i.push(l);var u=new Array;(u=u.concat(t)).push(l),n.push(u)}}return!1},e.prototype.createQuery=function(){return new y(this)},e}(i.DataModel),w=function(){function t(t){this.context=t,this.levelsTotals=[],this.prevRow=null,this.aggrContainer=new i.EqAggregatesContainer(t)}return t.prototype.getAggrContainer=function(){return this.aggrContainer},t.prototype.initObjects=function(){var t=this;this.aggrSettings=this.context.getQuery().getAggregationSettings(),this.groups=this.aggrSettings.getGroups(),this.aggregates=this.aggrSettings.getAggregates(),this.aggrColIds=this.aggrSettings.getAggregates().map((function(t){return t.colId})),this.aggrCols=this.context.resultTable.columns.getItems().filter((function(e){return t.aggrColIds.indexOf(e.id)>=0})),this.levelsTotals=[],this.prevRow=null},t.prototype.createColumnAggregatesObject=function(){return{sum:0,min:Number.MAX_VALUE,max:Number.MIN_VALUE}},t.prototype.calculate=function(t){this.initObjects(),this.aggrContainer.clear(),(t=t||{}).maxLevel=t.maxLevel>=0?t.maxLevel:0;for(var e=this.groups.length+1,n=0;n<e;n++){var i={count:0,columns:{}};this.resetLevelTotals(i),this.levelsTotals.push(i)}var r=this.context.resultTable.getCachedRows();if(r.length>0){for(var o=0,a=r;o<a.length;o++){var s=a[o];this.processDataRow(s)}for(n=1;n<e;n++)this.flushLevelTotals(n);this.aggrSettings.hasGrandTotals()&&this.flushLevelTotals(0)}return Promise.resolve()},t.prototype.resetLevelTotals=function(t){for(var e=0,n=this.aggrCols;e<n.length;e++){var i=n[e];t.columns[i.id]=this.createColumnAggregatesObject()}t.count=0},t.prototype.processDataRow=function(t){var e=this.checkLevelChange(t);if(e>=0)for(var n=e;n<this.levelsTotals.length;n++)this.flushLevelTotals(n);this.aggrSettings.hasGrandTotals()&&this.updateLevelTotals(0,t);for(var i=1,r=0,o=this.groups;r<o.length;r++){o[r];this.updateLevelTotals(i,t),i++}this.prevRow=t},t.prototype.checkLevelChange=function(t){if(null==this.prevRow)return-1;for(var e=0;e<this.groups.length;e++)for(var n=0,i=this.groups[e].columns;n<i.length;n++){var r=i[n],o=t.getValue(r),a=this.prevRow.getValue(r);if(!this.aggrSettings.compareValues(a,o))return e+1}return-1},t.prototype.flushLevelTotals=function(t){for(var e=this.levelsTotals[t],n=t>0?this.groups[t-1]:null,i=this.aggrSettings.buildGroupKey(n,this.prevRow),r={},o=0,a=this.aggregates;o<a.length;o++){var s=a[o],l=e.columns[s.colId];r[s.colId]=this.applyAggrFunc(s.funcId,l,e)}this.aggrSettings.hasRecordCount()&&(r[this.aggrSettings.COUNT_FIELD_NAME]=e.count),this.aggrContainer.updateAggregateData(t,i,r),this.resetLevelTotals(e)},t.prototype.applyAggrFunc=function(t,e,n){switch(t){case"SUM":return e.sum;case"AVG":return e.sum/n.count;case"COUNT":case"CNTDST":return n.count;case"MIN":return e.min;case"MAX":return e.max}},t.prototype.updateLevelTotals=function(t,e){var n=this.levelsTotals[t];n.count+=1;for(var i=0,r=this.aggregates;i<r.length;i++){var o=r[i],a=e.getValue(o.colId),s=n.columns[o.colId];s.sum+=a,a<s.min&&(s.min=a),a>s.max&&(s.max=a)}},t.prototype.needRecalculation=function(){return!0},t.prototype.reset=function(){},t}();!function(t){t[t.Unknown=0]="Unknown",t[t.String=1]="String",t[t.Byte=2]="Byte",t[t.Word=3]="Word",t[t.Int32=4]="Int32",t[t.Int64=5]="Int64",t[t.Bool=6]="Bool",t[t.Float=7]="Float",t[t.Currency=8]="Currency",t[t.BCD=9]="BCD",t[t.Date=10]="Date",t[t.Time=11]="Time",t[t.DateTime=12]="DateTime",t[t.Autoinc=13]="Autoinc",t[t.Memo=14]="Memo",t[t.Blob=15]="Blob",t[t.FixedChar=16]="FixedChar",t[t.Guid=17]="Guid",t[t.Geometry=18]="Geometry",t[t.Geography=19]="Geography"}(c||(c={})),function(t){t[t.Data=0]="Data",t[t.Virtual=1]="Virtual",t[t.Lookup=2]="Lookup"}(d||(d={}));var D,x="Unknown",E="EDIT",T="DATETIME";!function(t){t.Trace="TRACE",t.Options="OPTIONS",t.Get="GET",t.Put="PUT",t.Post="POST",t.Delete="DELETE"}(D||(D={}));var I,S,k=function(){function t(t,e){this.xhr=t,this.method=e.method,this.url=e.url,this.headers=e.headers,this.queryParams=e.queryParams,this.data=e.data}return t.prototype.setHeader=function(t,e){this.headers[t]=e},t.prototype.setQueryParam=function(t,e){this.queryParams[t]=e},t.prototype.getXMLHttpRequest=function(){return this.xhr},t.prototype.getResponseHeaders=function(){if(this.xhr.readyState==this.xhr.HEADERS_RECEIVED){for(var t={},e=0,n=this.xhr.getAllResponseHeaders().trim().split(/[\r\n]+/);e<n.length;e++){var i=n[e].split(": "),r=i.shift(),o=i.join(": ");t[r]=o}return t}return{}},t.prototype.open=function(){var t=this;if(this.xhr.readyState===this.xhr.UNSENT){var e=this.url;for(var n in this.queryParams&&Object.keys(this.queryParams).length>0&&(e+=encodeURI("?"+Object.keys(this.queryParams).map((function(e){return e+"="+t.queryParams[e]})).join("&"))),this.xhr.open(this.method,e,!0),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.headers)this.xhr.setRequestHeader(n,this.headers[n])}},t.prototype.abort=function(){this.xhr.abort()},t}();function M(t,e){for(var n="",i=0;i<e;i++)n+=t;return n}!function(t){var e,n={shortDateFormat:"MM/dd/yyyy",longDateFormat:"dd MMM, yyyy",editDateFormat:"MM/dd/yyyy",shortTimeFormat:"HH:mm",editTimeFormat:"HH:mm",longTimeFormat:"HH:mm:ss",shortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],shortWeekDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longWeekDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],decimalSeparator:".",currency:"USD"},i={localeId:"en-US",englishName:"English",displayName:"English",texts:{ButtonOK:"OK",ButtonCancel:"Cancel",Yes:"Yes",No:"No",True:"True",False:"False"},settings:n},r={"en-US":i},o=[];function a(t){for(var e=0,n=o;e<n.length;e++){(0,n[e])(t)}}function s(){return e.localeId}function l(t){var n=r[t];n?S.assignDeep(e,n):(e.englishName=t,e.displayName=t,e.texts=S.assignDeep({},i.texts)),e.localeId=t}function u(){return e.settings}function d(t){e.settings||(e.settings=S.assignDeep({},n)),e.settings=S.assignDeep(e.settings,t)}function h(t,n){a(n);var o=e;t&&(n.localeId||(n.localeId=t),(o=r[t])||(o=S.assignDeep({},i),r[t]=o)),S.assignDeep(o,n)}function p(){var t,n,i,r,o,a,s="object"==typeof navigator?navigator.language:void 0;t=s,n=new Date(2020,5,7,19,34,56,88),i=n.toLocaleDateString(t,{year:"numeric",month:"numeric",day:"numeric"}),r=n.toLocaleTimeString(t,{hour:"numeric",minute:"numeric",second:"numeric"}),o=i.replace("07","dd").replace("7","d").replace("06","MM").replace("6","M").replace("2020","yyyy").replace("20","yy"),a=r.replace("19","HH").replace("07","hh").replace("7","h").replace("34","mm").replace("56","ss").replace("PM","tt"),e.settings||(e.settings={}),d({shortDateFormat:o,shortTimeFormat:a})}function f(t){var e,n=u();switch(t){case c.Date:e=n.shortDateFormat;break;case c.Time:e=n.shortTimeFormat;break;default:e=n.shortDateFormat+" "+n.shortTimeFormat}return e}function g(t){var e,n=u();switch(t){case c.Date:e=n.longDateFormat;break;case c.Time:e=n.longTimeFormat;break;default:e=n.longDateFormat+" "+n.longTimeFormat}return e}t.addMapper=function(t){o.push(t)},t.getLocales=function(){var t=[];for(var e in r)t.push({locale:e,englishName:r[e].englishName,displayName:r[e].displayName});return t.sort((function(t,e){return t.englishName>e.englishName?1:t.englishName===e.englishName?0:-1}))},t.getCurrentLocale=s,t.setLocale=function(t){console.warn("This method is deprecated. Use setCurrentLocale instead"),l(t)},t.setCurrentLocale=l,t.getText=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=e.texts,r="";if(t&&t.length)for(var o=t.length,a=0;a<o&&"object"==typeof(r=i[t[a]]);a++)i=r;return r},t.getLocaleSettings=u,t.getOneLocaleSetting=function(t){return e.settings[t]},t.getShortMonthName=function(t){var e=u();if(t>0&&t<13)return e.shortMonthNames[t-1];throw"Wrong month number: "+t},t.getLongMonthName=function(t){var e=u();if(t>0&&t<13)return e.longMonthNames[t-1];throw"Wrong month number: "+t},t.getShortWeekDayName=function(t){var e=u();if(t>0&&t<8)return e.shortWeekDayNames.length>=t?e.shortWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.getLongWeekDayName=function(t){var e=u();if(t>0&&t<8)return e.longWeekDayNames.length>=t?e.longWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.updateLocaleSettings=d,t.updateLocaleTexts=function(t){"object"==typeof t?(a({localeId:e.localeId,texts:t}),S.assignDeep(e.texts,t)):console.error("Wrong parameter type in updateLocaleTexts function call.The first parameter (localeId) is not necessary. Use updateLocaleTexts(texts) instead")},t.updateDefaultTexts=function(t){for(var n in r){var i=r[n];i.texts=S.assignDeep({},t,i.texts)}e.texts=S.assignDeep({},t,e.texts)},t.updateLocaleInfo=h,t.addLocale=function(t,e){h(t,e)},t.resetLocales=function(){e||(e=S.assignDeep({},i),p())},t.dateTimeToStr=function(t,e,n){return n?"d"==n?n=f(c.Date):"D"==n?n=g(c.Date):"f"==n?n=f(c.DateTime):"F"==n&&(n=g(c.DateTime)):n=f(e),S.dateTimeToStr(t,n)},t.numberToStr=function(e,n){if(n&&n.length>0){var i=n.charAt(0).toUpperCase();if("S"===i)return function(e,n){if(!m[n]){var i=n.split("|").filter((function(t){return t.length>0})).map((function(t){return t.split("=")}));if(m[n]={},i.length>0)if(i[0].length>1)for(var r=0,o=i;r<o.length;r++){var a=o[r];m[n][Number.parseInt(a[1])]=a[0]}else i.forEach((function(t,e){m[n][e]=t[0]}))}var s=m[n];if(void 0!==s[e]){a=s[e];return t.getText(a)||a}return e.toString()}(e,n.slice(1));if(["D","F","C"].indexOf(i)>=0){var r=s();return e.toLocaleString(r,function(t){var e=u(),n=t[0].toUpperCase(),i=t.length>1?Number.parseInt(t.slice(1)):"D"==n?1:2;switch(n){case"D":return{style:"decimal",useGrouping:!1,minimumIntegerDigits:i};case"C":return{style:"currency",currency:e.currency,minimumFractionDigits:i};default:return{style:"decimal",minimumFractionDigits:i,maximumFractionDigits:i}}}(n))}return function(t,e){for(var n=t.toString(),i="",r=n.length-1,o=e.length-1;o>=0;o--){var a=e.charAt(o);"#"===a||"0"===a?r>=0?(i+=n.charAt(r),r--):"0"===a&&(i+=0):i+=a}return i.split("").reverse().join("")}(Math.trunc(e),n)}var o=u();return S.numberToStr(e,o.decimalSeparator)},t.booleanToStr=function(e,n){if(n&&n.length>0&&"S"===n.charAt(0).toUpperCase()){var i=n.slice(1).split("|");if(i.length>1){var r=i[e?1:0];return t.getText(r)||r}}return""+e};var m={}}(I||(I={})),function(t){t.getAllDataTypes=function(){return Object.values(c).filter((function(t){return"number"==typeof t}))},t.getDateDataTypes=function(){return[c.Time,c.Date,c.DateTime]},t.getStringDataTypes=function(){return[c.String,c.Memo,c.FixedChar]};var e=[c.Byte,c.Word,c.Int32,c.Int64,c.Float,c.Currency,c.Autoinc];t.getNumericDataTypes=function(){return e};var n=[c.Byte,c.Word,c.Int32,c.Int64,c.Autoinc];function i(t,e,n){e||(e={});for(var o=0,a=n;o<a.length;o++){var s=a[o];if(s)for(var l in s)if(s.hasOwnProperty(l)){var u=s[l];null!==u&&"object"==typeof u?t.has(u)?e[l]=t.get(u):Array.isArray(u)?(e[l]=r(u),t.set(u,e[l])):(void 0!==e[l]&&null!=e[l]||(e[l]=Object.create(Object.getPrototypeOf(u))),t.set(u,e[l]),i(t,e[l],[u])):e[l]=u}}return e}function r(t){for(var e=[],n=0,i=t;n<i.length;n++){var r=i[n];e.push(r)}return e}t.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var i=0;i<e.length;i++){var r=e[i];if(r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t},t.assignDeep=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return i(new WeakMap,t,e)},t.getIfDefined=function(t,e){return void 0!==t?t:e},t.IsDefinedAndNotNull=function(t){return null!=t},t.copyArrayTo=function(t,e){for(var n=t.length,i=e.length,r=0;r<n&&r<i;r++)e[r]=t[r]},t.createArrayFrom=r,t.findItemById=function(t,e){for(var n=t.length,i=0;i<n;i++)if(t[i].id===e)return t[i];return null},t.findItemIndexById=function(t,e){for(var n=t.length,i=0;i<n;i++)if(t[i].id===e)return i;return-1},t.indexOfArrayItem=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=t.length,i=0;i<n;i++)if(e==t[i])return i;return-1},t.moveArrayItem=function(t,e,n){if(e>=t.length)throw"Index out of bounds: "+e;n>=t.length&&(n=t.length-1);var i=t.splice(e,1)[0];t.splice(n,0,i)},t.removeArrayItem=function(t,e){var n=t.indexOf(e);if(-1!=n)return t.splice(n,1)[0]},t.insertArrayItem=function(t,e,n){t.splice(e,0,n)},t.fillArray=function(t,e,n,i){void 0===n&&(n=0);for(var r=t.length>>>0,o=n>>0,a=o<0?Math.max(r+o,0):Math.min(o,r),s=void 0===i?r:i>>0,l=s<0?Math.max(r+s,0):Math.min(s,r);a<l;)t[a]=e,a++;return t},t.shiftToFitWindow=function(t,e){var n=document.getElementsByTagName("body")[0],i=window.innerWidth||document.documentElement.clientWidth||n.clientWidth,r=t+e,o=0;return r>i&&t+(o=i-r-10)<0&&(o=10-t),o},t.isObject=function(t){return null!==t&&("function"==typeof t||"object"==typeof t)},t.isNumericType=function(t){return e.indexOf(t)>=0},t.isIntType=function(t){return n.indexOf(t)>=0},t.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},t.areCompatibleDataTypes=function(t,e){return void 0===t||void 0===e||t==c.Unknown||e==c.Unknown||t==e||t==c.Date&&e==c.DateTime||t==c.DateTime&&e==c.Date},t.isPropSet=function(t,e){return t[e]||t[e.toLowerCase()]||t[e.toUpperCase()]};var o="0123456789abcdefghijklmnopqrstuvwxyz";function a(t,e){var n=t.length;if(n>e){var i=n/e,r="";r+=t[0];for(var o=i,a=void 0,s=1;s<n;s++)a=t[s],s+1>o&&(r+=a,o+=i);return r}return t}function s(t,e,n){return t.substr(0,e)+n+t.substr(e+n.length)}function l(t,e){return Math.floor(Math.random()*(e-t))+t}function u(t){var e=parseInt(t);if(isNaN(e))throw'"'+t+'" is not a valid number';return e}t.generateId=function(t){t||(t="easy");var e=t.length>4?function(t,e){var n=t.split("-"),i=1,r=e;n.length<e&&(i=e/n.length,r=n.length);for(var o="",s=0;s<r;s++)o+=a(n[s],i);return o}(t,4):t;e&&e.length>0&&(e+="-");var n=M("",2),i=o.length-1;return n=s(n,0,o[l(0,i)]),e+(n=s(n,1,o[l(0,i)]))+function(t){var e=36,n=14,i=M("",n),r=t;do{i=s(i,n--,o[r%e]),r=Math.floor(r/=e)}while(r>0);return a=i.trim(),a.split("").reverse().join("");var a}(621355968e9+1e4*(new Date).getTime()-0x8d60e562e627800)},t.strToDateTime=function(t,e){if(!t||0==t.length)return new Date;var n=t.replace(/[^a-zA-Z0-9_]/g,"-"),i=e.replace(/[^a-zA-Z0-9_]/g,"-").split("-"),r=n.split("-"),o=i.indexOf("MM"),a=i.indexOf("dd"),s=i.indexOf("yyyy"),l=i.indexOf("HH"),c=i.indexOf("mm"),d=i.indexOf("ss"),h=new Date;try{var p=s>-1&&s<r.length?u(r[s]):h.getFullYear(),f=o>-1&&o<r.length?u(r[o])-1:h.getMonth()-1;if(f>11)throw"";var g=a>-1&&a<r.length?u(r[a]):h.getDate();if(g>function(t,e){return new Date(e,t+1,0).getDate()}(f,p))throw"";var m=l>-1&&l<r.length?u(r[l]):0;if(m>23)throw"";var y=c>-1&&c<r.length?u(r[c]):0;if(y>59)throw"";var v=d>-1&&d<r.length?u(r[d]):0;if(v>59)throw"";return new Date(p,f,g,m,y,v)}catch(e){throw t+" is not a valid date."}},t.strToTime=function(t){var e=t.split(":");try{var n=e.length>0?u(e[0]):0;if(n>23)throw"";var i=e.length>1?u(e[1]):0;if(i>59)throw"";var r=e.length>1?u(e[1]):0;if(r>59)throw"";return new Date(0,0,0,n,i,r)}catch(e){throw t+" is not a valid time."}};var d=/\[([^\]]+)]|y{2,4}|M{1,4}|d{1,2}|H{1,2}|h{1,2}|m{2}|s{2}|t{2}/g;t.dateTimeToStr=function(t,e){var n=t.getFullYear().toString(),i=t.getMonth()+1,r=t.getDate(),o=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),l=o%12||12,u=o>11,c={yyyy:n,yy:n.substring(n.length-2),MMMM:I.getLongMonthName(i),MMM:I.getShortMonthName(i),MM:i<10?"0"+i:i.toString(),M:i.toString(),dd:r<10?"0"+r:r.toString(),d:r.toString(),HH:o<10?"0"+o:o.toString(),H:o.toString(),hh:l<10?"0"+l:l.toString(),h:l.toString(),tt:u?"PM":"AM",mm:a<10?"0"+a:a.toString(),ss:s<10?"0"+s:s.toString()};return e.replace(d,(function(t,e){return e||c[t]}))},t.numberToStr=function(t,e){return e=e||I.getLocaleSettings().decimalSeparator,t.toString().replace(".",e)}}(S||(S={}));var O,P=function(){function t(t,e){this.request=t,this.promise=e}return t.prototype.getPromise=function(){return this.promise},t.prototype.getRequest=function(){return this.request},t.prototype.then=function(t,e){return this.promise.then(t,e)},t.prototype.catch=function(t){return this.promise.catch(t)},t.prototype.finally=function(t){return this.promise.finally(t)},t}(),R=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),A=function(){return A=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},A.apply(this,arguments)},_=function(t){function e(e,n){var i=t.call(this,n)||this;return i.status=e,i}return R(e,t),e}(Error),L=function(){function t(){this.defaultHeaders={},this.customPayload=void 0}return Object.defineProperty(t.prototype,"responseBody",{get:function(){return this._responseBody},enumerable:!0,configurable:!0}),t.prototype.get=function(t,e){return this.send(D.Get,t,null,e)},t.prototype.post=function(t,e,n){return this.send(D.Post,t,e,n)},t.prototype.put=function(t,e,n){return this.send(D.Put,t,e,n)},t.prototype.delete=function(t,e,n){return this.send(D.Delete,t,e,n)},t.prototype.send=function(e,n,i,r){var o=this,a=(r=r||{}).dataType||"json",s=r.contentType||"form-data"!==a?"application/json":null;i&&"form-data"!=a&&this.customPayload&&(i.data=S.assignDeep(i.data||{},this.customPayload));var l=new("onload"in new XMLHttpRequest?XMLHttpRequest:window.XDomainRequest),u={method:e,url:n,headers:A(A({},this.defaultHeaders),r.headers||{}),queryParams:r.queryParams||{},data:i};s&&(u.headers["Content-Type"]=s);var c=new k(l,u);this.beforeEachRequest&&(console.warn("HttpClient: 'beforeEachRequest' is deprecated and will be removed in future updates.\n Use 'onRequest' instead"),this.beforeEachRequest(c)),this.onRequest&&this.onRequest(c);var d=c.data&&"string"!=typeof c.data&&"json"==a?JSON.stringify(c.data):c.data;return c.open(),new P(c,new Promise((function(e,i){r.responseType&&(l.responseType=r.responseType),l.onerror=function(t){i(new _(l.status,l.responseText))},l.onreadystatechange=function(){if(4==l.readyState){var r=l.getResponseHeader("Content-Type")||"",a=l.status;if(0===a)i(new _(a,"Network error or the request was aborted"));else if(a>=200&&a<400){var s="arraybuffer"===l.responseType||"blob"===l.responseType?l.response:0==r.indexOf("application/json")?JSON.parse(l.responseText):l.responseText;o._responseBody=s,o.onResponse&&o.onResponse(l),e(s)}else{("arraybuffer"===l.responseType||"blob"===l.responseType?t.decodeArrayBuffer(l.response):Promise.resolve(l.responseText)).then((function(t){var e=0==r.indexOf("application/json")?JSON.parse(t):t;o._responseBody=e;var s=e.message||(404==a?"No such endpoint: "+n:e);i(new _(a,s))}))}}},l.send(d)})))},t.decodeArrayBuffer=function(t){var e=new FileReader;return new Promise((function(n){e.onloadend=function(){e.readyState==FileReader.DONE&&n(e.result)},e.readAsText(new Blob([t]))}))},t}(),N=function(){function t(t){this.isEditable=!0,this.name="",this.caption="",this.description="",this.parent=t,this.attributes=new Array,this.subEntities=new Array}return t.prototype.loadFromData=function(t,e){if(e){if(this.id=e.id,this.name=e.name,this.captionPlural=e.namePlur,this.caption=e.name,this.description=e.desc,void 0!==e.ied&&(this.isEditable=e.ied),this.subEntities=new Array,e.ents)for(var n=0;n<e.ents.length;n++){var i=t.createEntity(this);i.loadFromData(t,e.ents[n]),this.subEntities.push(i)}if(this.attributes=new Array,e.attrs)for(n=0;n<e.attrs.length;n++){var r=t.createEntityAttr(this);r.loadFromData(t,e.attrs[n]),this.attributes.push(r)}}},t.prototype.scan=function(t,e){var n={stop:!1},i=function(r){if(e&&e(r,n),r.attributes)for(var o=r.attributes.length,a=0;a<o&&!n.stop;a++){var s=r.attributes[a];if(t&&t(s,n),n.stop)return}if(r.subEntities){var l=r.subEntities.length;for(a=0;a<l&&!n.stop;a++)i(r.subEntities[a])}};i(this)},t.prototype.getFirstPrimaryAttr=function(){return this.getPrimaryAttrs()[0]},t.prototype.getPrimaryAttrs=function(){return this.attributes.filter((function(t){return t.isPrimaryKey}))},t}(),F=function(){function t(t){this.id="",this.caption="{Unrecognized attribute}",this.dataType=c.String,this.size=0,this.isPrimaryKey=!1,this.isForeignKey=!1,this.isNullable=!0,this.showOnView=!0,this.isEditable=!0,this.showOnCreate=!0,this.showOnEdit=!0,this.showInLookup=!1,this.lookupAttr="",this.expr="",this.entity=t,this.kind=d.Data}return t.prototype.loadFromData=function(t,e){if(e){this.id=e.id,this.description=e.desc,this.caption=e.cptn,this.dataType=e.dtype,this.isPrimaryKey=e.ipk,this.isForeignKey=e.ifk,this.size=e.size,this.lookupAttr=e.lattr,this.lookupEntity=e.lent,this.dataAttr=e.dattr,this.lookupDataAttr=e.ldattr;var n=S.getDateDataTypes().indexOf(this.dataType);this.defaultValue=e.defVal&&n?new Date(e.defVal):e.defVal,this.isNullable=S.getIfDefined(e.nul,this.isNullable),this.isEditable=S.getIfDefined(e.ied,this.isEditable),this.showOnView=S.getIfDefined(e.ivis||e.sov,this.showOnView),this.showOnCreate=S.getIfDefined(e.soc,this.showOnCreate),this.showOnEdit=S.getIfDefined(e.soe,this.showOnEdit),this.showInLookup=S.getIfDefined(e.sil,this.showInLookup),this.kind=e.kind,this.displayFormat=e.dfmt,e.udata&&(this.userData=e.udata),e.edtr&&(this.defaultEditor=t.getEditorById(e.edtr)||t.createValueEditor())}},t}(),B=function(){function t(){this.id="",this.tag=x,this.resType=c.Unknown,this.defValue=""}return t.prototype.loadFromData=function(t){t&&(this.id=t.id,this.tag=t.tag,this.defValue=t.defval,this.resType=t.rtype,this.accept=t.accept,this.multiline=t.multiline,t.subType&&(this.resType=t.subType),t.name&&(this.name=t.name),t.values&&(this.values=t.values))},t.prototype.getValueText=function(t){var e="";if(!this.values)return e;if(Array.isArray(t))for(var n=0,i=this.values;n<i.length;n++){var r=i[n];t.indexOf(r.id)>=0&&(e+=r.text+",")}else for(var o=0,a=this.values;o<a.length;o++){(r=a[o]).id===t&&(e+=r.text+",")}return e&&(e=e.substring(0,e.length-1)),e},t}(),q=(function(){function t(){this.mainEntity=null,this.id="__none",this.name="Empty model",this.rootEntity=this.createEntity(),this.displayFormats=new Map}t.prototype.getMainEntity=function(){return this.mainEntity},t.prototype.createEntity=function(t){return new N(t)},t.prototype.createEntityAttr=function(t){return new F(t)},t.prototype.createValueEditor=function(){return new B},t.prototype.loadFromJSON=function(t){var e=JSON.parse(t);this.loadFromData(e)},t.prototype.loadFromData=function(t){if(this.id=t.id,this.name=t.name,this.version=t.vers,this.editors=new Array,t.editors)for(var e=0;e<t.editors.length;e++){var n=this.createValueEditor();n.loadFromData(t.editors[e]),this.editors.push(n)}if(this.rootEntity.loadFromData(this,t.entroot),this.displayFormats=new Map,t.displayFormats)for(var i in t.displayFormats){var r=c[i],o=t.displayFormats[i]||new Array;this.displayFormats.set(r,o)}},t.prototype.getDisplayFormats=function(){return this.displayFormats},t.prototype.getDisplayFormatsForType=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t):[]},t.prototype.getDefaultFormat=function(t){return this.displayFormats.has(t)?this.displayFormats.get(t).filter((function(t){return t.isdef}))[0]:null},t.prototype.setData=function(t){"string"==typeof t?this.loadFromJSON(t):this.loadFromData(t)},t.prototype.isEmpty=function(){return 0===this.rootEntity.subEntities.length&&0===this.rootEntity.attributes.length},t.prototype.getId=function(){return this.id},t.prototype.getName=function(){return this.name},t.prototype.getRootEntity=function(){return this.rootEntity},t.prototype.getEditorById=function(t){for(var e=0,n=this.editors;e<n.length;e++){var i=n[e];if(i.id===t)return i}return null},t.prototype.getAttributeById=function(t){var e=this.getEntityAttrById(this.getRootEntity(),t);return e||null},t.prototype.checkAttrProperty=function(t,e){var n=this.getAttributeById(t);if(n){if(void 0===n[e])throw"No such property: "+e;return!!n[e]||!!n.lookupAttr&&(t=n.lookupAttr,(n=this.getAttributeById(t))&&n[e])}return!1},t.prototype.getEntityAttrById=function(t,e){var n,i;if(t.attributes){var r=t.attributes.length;for(n=0;n<r;n++)if(t.attributes[n].id==e)return t.attributes[n]}if(t.subEntities){var o=t.subEntities.length;for(n=0;n<o;n++)if(i=this.getEntityAttrById(t.subEntities[n],e))return i}return null},t.prototype.listByEntityWithFilter=function(t,e){var n,i=new Array,r=null;if(t.subEntities)for(var o=t.subEntities.length,a=0;a<o;a++){if(r=t.subEntities[a],!e||e(r,null))(n=I.getText("Entities",r.name))||(n=r.caption),(c=S.assign(this.createEntity(),{id:r.name,text:n,items:[],isEntity:!0})).items=this.listByEntityWithFilter(r,e),c.items.length>0&&i.push(c)}var s=null;if(t.attributes)for(var l=t.attributes.length,u=0;u<l;u++)if(s=t.attributes[u],!e||e(t,s)){(n=I.getText("Attributes",s.id))||(n=s.caption);var c=S.assign(this.createEntity(),{id:s.id,text:n,dataType:s.dataType});i.push(c)}return i},t.prototype.listByEntity=function(t,e,n){e=e||{};var i,r=[],o=[],a=null;if(t.subEntities)for(var s=t.subEntities.length,l=0;l<s;l++)if(a=t.subEntities[l],!n||n(a,null)){i=I.getText("Entities",a.name)||a.caption;var u=S.assign(this.createEntity(),{id:a.name,text:i,items:[],isEntity:!0,description:a.description}),c=S.assign({},e);c.includeRootData=!1,u.items=this.listByEntity(a,c,n),u.items.length>0&&r.push(u)}var d=null;if(t.attributes)for(var h=t.attributes.length,p=0;p<h;p++)d=t.attributes[p],n&&!n(t,d)||(i=I.getText("Attributes",d.id)||d.caption,o.push(S.assign(this.createEntityAttr(t),{id:d.id,text:i,dataType:d.dataType,lookupAttr:d.lookupAttr,description:d.description})));var f,g=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(r.sort(g),o.sort(g)),f=e.attrPlacement&&0!=e.attrPlacement?o.concat(r):r.concat(o),2==e.attrPlacement&&f.sort(g),e.includeRootData?((i=I.getText("Entities",t.name))||(i=t.caption),{id:t.name,text:i,items:f}):f},t.prototype.clear=function(){this.rootEntity=this.createEntity(),this.editors=[],this.version=""},t.prototype.addDefaultValueEditors=function(){this.addOrUpdateValueEditor("_DTE",E,c.String).defValue="",this.addOrUpdateValueEditor("_DPDE",T,c.DateTime),this.addOrUpdateValueEditor("_DPTE",T,c.DateTime)},t.prototype.addOrUpdateValueEditor=function(t,e,n){var i=S.findItemById(this.editors,t);return i||((i=this.createValueEditor()).id=t,this.editors.push(i)),i.tag=e,i.resType=n,i},t.prototype.getEntitiesTree=function(t,e){return this.listByEntity(this.getRootEntity(),t,e)},t.prototype.getEntitiesTreeWithFilter=function(t){return this.listByEntityWithFilter(this.getRootEntity(),t)},t.prototype.getFullEntityPathByAttr=function(t,e){return e=e||" ",this.getEntityPathByAttr(this.getRootEntity(),t,e,!0)},t.prototype.getEntityPathByAttr=function(t,e,n,i){if(!t)return"";n=n||" ";var r="";if(t.caption&&!i){var o=I.getText("Entities",t.caption);r=o||t.caption}if(t.attributes)for(var a=t.attributes.length,s=0;s<a;s++)if(t.attributes[s].id==e)return r;if(t.subEntities){var l=t.subEntities.length;for(s=0;s<l;s++){var u=t.subEntities[s],c=this.getEntityPathByAttr(u,e,n,!1);if(""!==c)return""!==r&&(c=r+n+c),c}}return""},t.prototype.getAttributeText=function(t,e){var n=I.getText("Attributes",t.id);if(n||(n=t.caption),!e)return n;var i=this.getFullEntityPathByAttr(t.id," ");return(i?e.replace(new RegExp("{attr}","g"),n).replace(new RegExp("{entity}","g"),i):n).trim()},t.prototype.runThroughEntities=function(t,e){this.getRootEntity().scan(t,e)},t.prototype.getFirstAttributeByFilter=function(t){var e=null;return this.runThroughEntities((function(n,i){t(n)&&(i.stop=!0,e=n)}),null),e}}(),function(){return q=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},q.apply(this,arguments)});!function(){function t(t){this.colStore=t,this.aggregates=[],this.groups=[],this.useGrandTotals=!1,this.useRecordCount=!1,this._caseSensitiveGroups=!1,this.COUNT_FIELD_NAME="GRPRECCNT"}Object.defineProperty(t.prototype,"caseSensitiveGroups",{get:function(){return this._caseSensitiveGroups},set:function(t){this._caseSensitiveGroups=t,this.updateCompareProc()},enumerable:!0,configurable:!0}),t.prototype.updateCompareProc=function(){this.compareValues=this._caseSensitiveGroups?this.strictCompare:this.caseInsensitiveCompare},t.prototype.addGroup=function(t){var e=t.columns||this.colStore.getColumnIds(t.from,t.to);if(!this.colStore.validateColumns(e))throw"Invalid columns: "+e;if(this.hasColumnsInUse(e))throw"Can't add same columns to different groups/aggregates";return this.groups.push(q({columns:e},t)),this},t.prototype.addAggregateColumn=function(t,e){var n="string"==typeof t?t:this.colStore.getColumnIds(t,t)[0];if(this.hasColumnsInUse([n])||!this.colStore.validateAggregate(n,e))throw"Invalid aggregation function for the column: "+n;return this.aggregates.push({colId:n,funcId:e}),this},t.prototype.addGrandTotals=function(){return this.useGrandTotals=!0,this},t.prototype.addCounts=function(){return this.useRecordCount=!0,this},t.prototype.getGroups=function(){var t=this,e=[];return this.groups.map((function(n){return e=e.concat(n.columns),q(q({},n),{columns:Array.from(e),aggregates:Array.from(t.aggregates)})}))},t.prototype.getInternalGroups=function(){return this.groups},t.prototype.lastGroup=function(){var t=this.getGroups();return t[t.length-1]},t.prototype.getAggregates=function(){return this.aggregates},t.prototype.hasAggregates=function(){return this.aggregates.length>0},t.prototype.hasGroups=function(){return this.groups.length>0},t.prototype.hasGrandTotals=function(){return this.useGrandTotals},t.prototype.hasRecordCount=function(){return this.useRecordCount},t.prototype.isEmpty=function(){return!(this.hasAggregates()||this.hasGroups()||this.hasAggregates()||this.hasRecordCount())},t.prototype.drop=function(){console.warn('"drop()" method is obsolete. Use "clear()" instead'),this.clear()},t.prototype.clear=function(){return this.groups=[],this.aggregates=[],this.useGrandTotals=!1,this.useRecordCount=!1,this.caseSensitiveGroups=!1,this},t.prototype.hasColumnsInUse=function(t){for(var e=0,n=this.groups;e<n.length;e++){if(n[e].columns.filter((function(e){return t.indexOf(e)>=0})).length>0)return!0}for(var i=0,r=this.aggregates;i<r.length;i++){var o=r[i];if(t.indexOf(o.colId)>=0)return!0}return!1},t.prototype.needAggrCalculation=function(){return(this.hasAggregates()||this.hasRecordCount())&&(this.hasGrandTotals()||this.hasGroups())},t.prototype.saveToData=function(){return{groups:Array.from(this.groups),ugt:this.useGrandTotals,urc:this.useRecordCount,csg:this.caseSensitiveGroups,aggregates:Array.from(this.aggregates)}},t.prototype.loadFromData=function(t){t&&(void 0!==t.ugt&&(this.useGrandTotals=t.ugt),void 0!==t.urc&&(this.useRecordCount=t.urc),void 0!==t.csg&&(this.caseSensitiveGroups=t.csg),t.groups&&(this.groups=Array.from(t.groups)),t.aggregates&&(this.aggregates=Array.from(t.aggregates)))},t.prototype.buildGroupKey=function(t,e){var n=!this.caseSensitiveGroups,i={};if(t)for(var r=0,o=t.columns;r<o.length;r++){var a=o[r],s=e.getValue(a);n&&"string"==typeof s&&(s=s.toLowerCase()),i[a]=s}return i},t.prototype.strictCompare=function(t,e){return t instanceof Date?t.getTime()===e.getTime():t===e},t.prototype.caseInsensitiveCompare=function(t,e){return t instanceof Date?t.getTime()===e.getTime():("string"==typeof t?t.toLowerCase():t)===("string"==typeof e?e.toLowerCase():e)}}();!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(O||(O={}));var H,z=function(t){if(!t)throw Error("Options are required");if(!t.id)throw Error("Field Id is required");if(!t.label)throw Error("Label is required");this.id=t.id,this.type=S.getIfDefined(t.type,c.String),this.label=t.label,this.originAttrId=t.originAttrId,this.isAggr=t.isAggr||!1,this.displayFormat=t.dfmt,this.groupFooterColumnTemplate=t.gfct,this.style=t.style||{},this.description=t.description,this.calculatedWidth=0},G=function(){function t(){this.items=[],this.mapper={},this._dateColumnIdx=[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),t.prototype.add=function(t){var e;e=t instanceof z?t:new z(t);var n=this.items.length;return this.items.push(e),this.mapper[e.id]=n,[c.Date,c.DateTime,c.Time].indexOf(e.type)>=0&&this._dateColumnIdx.push(n),n},t.prototype.updateDateColumnIdx=function(){this._dateColumnIdx=this.getItems().filter((function(t){return[c.Date,c.DateTime,c.Time].indexOf(t.type)>=0})).map((function(t,e){return e}))},t.prototype.put=function(t,e){t>=0&&t<this.count&&(this.items[t]=e,this.updateDateColumnIdx())},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&(S.moveArrayItem(this.items,n,e),this.updateDateColumnIdx())},t.prototype.get=function(t){return t>=0&&t<this.count?this.items[t]:null},t.prototype.getIndex=function(t){return this.mapper[t]},t.prototype.getItems=function(){return this.items},t.prototype.getDateColumnIndexes=function(){return this._dateColumnIdx},t.prototype.removeAt=function(t){var e=this.get(t);this.items.splice(t,1);var n=this._dateColumnIdx.indexOf(t);n>=0&&this._dateColumnIdx.splice(n,1),delete this.mapper[e.id]},t.prototype.clear=function(){this.items=[],this._dateColumnIdx=[],this.mapper={}},t}(),j=function(){function t(t,e){this.columns=t,this.values=e}return t.prototype.toArray=function(){return Array.from(this.values)},t.prototype.size=function(){return this.values.length},t.prototype.getValue=function(t){var e;if("string"==typeof t){if(void 0===(e=this.columns.getIndex(t)))throw new RangeError("No column with id '"+t+"'")}else e=t;if(e>=this.values.length)throw new RangeError("Out of range: "+e);return this.values[e]},t.prototype.setValue=function(t,e){var n;if("string"==typeof t){if(void 0===(n=this.columns.getIndex(t)))throw new RangeError("No column with id '"+t+"'")}else n=t;if(n>=this.values.length)throw new RangeError("Out of range: "+n);this.values[n]=e},t}(),V=function(){function t(t){if(this._chunkSize=1e3,this._elasticChunks=!1,this.cachedRows=[],this.total=0,this.loader=null,this.needTotal=!0,this.isInMemory=!1,t=t||{},this._chunkSize=t.chunkSize||this._chunkSize,this._elasticChunks=t.elasticChunks||this._elasticChunks,this.loader=t.loader,void 0!==t.inMemory&&(this.isInMemory=t.inMemory),this.isInMemory&&(this.needTotal=!1),this._columns=new G,this.onUpdate=t.onUpdate,t.columns)for(var e=0,n=t.columns;e<n.length;e++){var i=n[e];this._columns.add(i)}if(t.rows)for(var r=0,o=t.rows;r<o.length;r++){var a=o[r],s=this.createRow(a);this.addRow(s)}this.needTotal=!this._elasticChunks}return Object.defineProperty(t.prototype,"columns",{get:function(){return this._columns},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chunkSize",{get:function(){return this._chunkSize},set:function(t){this._chunkSize=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"elasticChunks",{get:function(){return this._elasticChunks},set:function(t){this._elasticChunks=t,this.total=0,this.needTotal=!this.elasticChunks,this.cachedRows=[]},enumerable:!0,configurable:!0}),t.prototype.getRows=function(t){var e=this,n=0,i=this._chunkSize;t&&("page"in t?(n=t.pageSize*(t.page-1),i=t.pageSize):(n=t.offset,i=t.limit));var r=n+i;if(!this.needTotal&&!this.elasticChunks){if(n>=this.total)return Promise.resolve([]);r>this.total&&(r=this.total)}if(this.isInMemory&&r>this.cachedRows.length&&(r=this.cachedRows.length),r<=this.cachedRows.length)return Promise.resolve(this.cachedRows.slice(n,r));if(!this.loader)throw"Loader is not defined. Can't get the rows from "+n+" to "+r;var o=this.needTotal;this.needTotal&&(this.needTotal=!1);var a=this.cachedRows.length,s=r-a;return s<this._chunkSize&&(s=this._chunkSize),this.loader.loadChunk({offset:a,limit:s,needTotal:o}).then((function(t){(o&&(e.total=t.total),Array.prototype.push.apply(e.cachedRows,t.table.getCachedRows()),r>e.cachedRows.length&&(r=e.cachedRows.length),e.elasticChunks)&&(t.table.getCachedCount()<s&&(e.total=e.cachedRows.length));return e.fireUpdated(),e.cachedRows.slice(n,r)}))},t.prototype.getRow=function(t){return this.getRows({offset:t,limit:1}).then((function(t){return t.length>0?t[0]:null}))},t.prototype.getTotal=function(){return this.total},t.prototype.setTotal=function(t){this.total=t,this.needTotal=!1},t.prototype.getCachedCount=function(){return this.cachedRows.length},t.prototype.clear=function(){this.columns.clear(),this.cachedRows=[],this.total=0,this.needTotal=!this._elasticChunks,this.fireUpdated()},t.prototype.createRow=function(t){var e=this,n=this._columns.getDateColumnIndexes(),i=new Array(this._columns.count),r=t instanceof j?function(e){return t.getValue(e)}:function(e){return t[e]};return t&&this.columns.getItems().forEach((function(t){var o=r(t.id),a=e.columns.getIndex(t.id);i[a]=n.indexOf(a)>=0?e.mapDate(o,t.type):o})),new j(this._columns,i)},t.prototype.mapDate=function(t,e){if(t){var n=new Date(t);return isNaN(n.getTime())&&e==c.Time&&(n=S.strToTime(t)),n}return null},t.prototype.addRow=function(t){var e;if(Array.isArray(t)){var n=t,i=this._columns.getDateColumnIndexes();if(i.length>0)for(var r=0,o=i;r<o.length;r++){var a=o[r];n[a]&&(n[a]=this.mapDate(n[a],this._columns.get(a).type))}e=new j(this._columns,n)}else e=this.createRow(t);this.cachedRows.push(e);var s=this.getCachedCount();return s>this.total&&(this.total=s),e},t.prototype.getCachedRows=function(){return this.cachedRows},t.prototype.totalIsKnown=function(){return this.elasticChunks?this.getCachedCount()===this.total:!this.needTotal},t.prototype.fireUpdated=function(){this.onUpdate&&this.onUpdate(this)},t}(),U=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},t}(),W=function(){function t(t){this.silentMode=0,this.events=new Array,this.source=t}return t.prototype.subscribe=function(t,e){var n=this.getEventRecByType(t),i={id:U.newGuid(),callback:e};return n?n.eventCallbacks.push(i):(n={type:t,eventCallbacks:new Array(i)},this.events.push(n)),i.id},t.prototype.unsubscribe=function(t,e){var n=this.getEventRecByType(t);if(n){var i=-1;for(i=0;i<n.eventCallbacks.length&&n.eventCallbacks[i].id!==e;i++);i>=0&&n.eventCallbacks.splice(i,1)}},t.prototype.fire=function(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=!1),!this.silentMode||i){var r=this.getEventRecByType(t);if(r){var o={type:t,source:this.source,data:e},a=function(){for(var t=0,e=r.eventCallbacks;t<e.length;t++){e[t].callback(o)}};n>0?setTimeout(a,n):a()}}},t.prototype.enterSilentMode=function(){this.silentMode++},t.prototype.exitSilentMode=function(){this.silentMode&&this.silentMode--},t.prototype.isSilent=function(){return this.silentMode>0},t.prototype.getEventRecByType=function(t){for(var e=0,n=this.events;e<n.length;e++){var i=n[e];if(i.type==t)return i}return null},t}();!function(t){t.renderLiquidTemplate=function(t,e){var n=t;if(e)for(var i in e){var r=new RegExp("{{"+i+"}}","g");n=n.replace(r,e[i])}return n}}(H||(H={})),I.resetLocales(),"function"!=typeof Object.values&&(Object.values=function(t){return Object.keys(t).map((function(e){return t[e]}))}),"function"!=typeof Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)});n(1);function Y(t){var e={x:0,y:0};if(null!==t){var n=function(t){var e,n={top:0,right:0,bottom:0,left:0,width:0,height:0};try{e=t.getBoundingClientRect()}catch(t){e=n}var i=document.body,r=document.documentElement,o=function(){var t=document.body,e=document.documentElement;return{top:window.pageYOffset||e.scrollTop||t.scrollTop,left:window.pageXOffset||e.scrollLeft||t.scrollLeft}}(),a=o.top,s=o.left,l=r.clientTop||i.clientTop||0,u=r.clientLeft||i.clientLeft||0,c=e.top+a-l,d=e.left+s-u;return{top:Math.round(c),left:Math.round(d)}}(t);e={x:n.left,y:n.top}}return e}var Q=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),J=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i},K=function(){function t(t,e){this.element="string"==typeof t?document.createElement(t):t,e&&this.element.parentElement!==e&&e.appendChild(this.element)}return t.prototype.addChild=function(t,e){var n=tt(t,this.element);return e&&e(n),this},t.prototype.addChildElement=function(t){return t&&this.element.appendChild(t),this},t.prototype.attr=function(t,e){return this.element.setAttribute(t,e),this},t.prototype.id=function(t){return this.attr("id",t)},t.prototype.focus=function(){return this.element.focus(),this},t.prototype.title=function(t){return this.attr("title",t)},t.prototype.data=function(t,e){return void 0===e&&(e=null),null===e?(this.element.removeAttribute("data-"+t),this):this.attr("data-"+t,e)},t.prototype.show=function(){return this.removeStyle("display")},t.prototype.hide=function(t){return void 0===t&&(t=!0),t?this.setStyle("display","none"):this},t.prototype.visible=function(t){return void 0===t&&(t=!0),t?this.setStyle("visibility","visible"):this.setStyle("visibility","hidden")},t.prototype.isVisible=function(){return!!(this.element.offsetWidth||this.element.offsetHeight||this.element.getClientRects().length)},t.prototype.addClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var i=J(t.trim().split(" "),e),r=0;r<i.length;r++)this.element.classList.add(i[r]);return this},t.prototype.removeClass=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t)for(var i=J(t.trim().split(" "),e),r=0;r<i.length;r++)this.element.classList.remove(i[r]);return this},t.prototype.toggleClass=function(t,e){return void 0===e&&(e=void 0),t&&this.element.classList.toggle(t,e),this},t.prototype.on=function(t,e){for(var n=t.split(" "),i=0;i<n.length;i++)this.element.addEventListener(n[i],e);return this},t.prototype.off=function(t,e){for(var n=t.split(" "),i=0;i<n.length;i++)this.element.removeEventListener(n[i],e);return this},t.prototype.setStyle=function(t,e){return this.element.style.setProperty(t,e),this},t.prototype.removeStyle=function(t){return this.element.style.removeProperty(t),this},t.prototype.text=function(t){return this.element.innerText=t,this},t.prototype.html=function(t){return this.element.innerHTML=t,this},t.prototype.clear=function(){var t=this.element;this.element=document.createElement(this.element.tagName),t.replaceWith(this.element)},t.prototype.addText=function(t){var e=document.createTextNode(t);return this.element.appendChild(e),this},t.prototype.addHtml=function(t){return this.element.innerHTML+=t,this},t.prototype.toDOM=function(){return this.element},t.prototype.appendTo=function(t){return t&&t.appendChild(this.element),this},t}(),X=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"textarea",n)||this}return Q(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.rows=function(t){return this.element.rows=t,this},e.prototype.cols=function(t){return this.element.cols=t,this},e.prototype.value=function(t){return this.element.value=t,this},e}(K),Z=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"input",n)||this}return Q(e,t),e.prototype.name=function(t){return this.element.name=t,this},e.prototype.type=function(t){return this.element.type=t,this},e.prototype.size=function(t){return this.element.size=t,this},e.prototype.value=function(t){return t instanceof Date?this.element.valueAsDate=t:"number"==typeof t?this.element.valueAsNumber=t:this.element.value=t,this},e.prototype.mask=function(t){return function(t,e){var n={9:"[0-9]",a:"[a-z]"},i=e.split(""),r=function(e){if("focus"!==e.type||""===t.value){var r=[],o=t.selectionStart;i.forEach((function(e,i){if(n[e]){var o=new RegExp(n[e],"i").test(t.value.charAt(i));r.push(o?t.value.charAt(i):"_")}else r.push(e)})),t.value=r.join(""),t.selectionStart=t.selectionEnd=o}};t.addEventListener("keydown",(function(e){if(8===e.keyCode||46===e.keyCode){e.preventDefault();var r=[],o=t.selectionStart;if(0==o)return;for(var a=o,s=!0,l=i.length-1;l>=0;l--){var u=i[l];if(n[u]){var c=new RegExp(n[u],"i").test(t.value.charAt(l));c&&l!=o-1&&(s=!1),l===o-1&&a--,r.push(c&&l!=o-1?t.value.charAt(l):"_")}else l===a-1&&a--,o-1===l&&o--,r.push(u)}t.value=s?"":r.reverse().join(""),t.selectionStart=t.selectionEnd=a<0?0:a;var d=document.createEvent("Event");d.initEvent("input",!0,!0),t.dispatchEvent(d)}})),t.addEventListener("keypress",(function(e){var r=String.fromCharCode(e.charCode);if(r){e.preventDefault();var o=[],a=t.selectionStart,s=a;i.forEach((function(e,i){if(n[e]){var l=i!=a?t.value.charAt(i):r,u=new RegExp(n[e],"i").test(l);o.push(u?l:"_"),u&&a===i&&s++}else o.push(e),s===i&&s++,a===i&&a++})),t.value=o.join(""),t.selectionStart=t.selectionEnd=s;var l=document.createEvent("Event");l.initEvent("input",!0,!0),t.dispatchEvent(l)}})),t.addEventListener("input",r),t.addEventListener("focus",r)}(this.element,t),this},e}(K),$=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"select",n)||this}return Q(e,t),e.prototype.addOption=function(t){var e=document.createElement("option");return"string"==typeof t?(e.value=t,e.innerHTML=t):(e.value=t.value,e.innerHTML=t.title||t.value,e.selected=t.selected||!1),this.element.appendChild(e),this},e.prototype.value=function(t){return this.element.value=t,this},e}(K);function tt(t,e){return"div"===t||t instanceof HTMLDivElement||"span"===t||t instanceof HTMLSpanElement||"a"===t||t instanceof HTMLAnchorElement||"button"===t||t instanceof HTMLButtonElement||"img"===t||t instanceof HTMLImageElement?new K(t,e):"input"===t||t instanceof HTMLInputElement?new Z(t instanceof HTMLInputElement?t:null,e):"textarea"===t||t instanceof HTMLTextAreaElement?new X(t instanceof HTMLTextAreaElement?t:null,e):"select"===t||t instanceof HTMLSelectElement?new $(t instanceof HTMLSelectElement?t:null,e):new K(t,e)}var et,nt="undefined"!=typeof TouchEvent;!function(t){t.None="none",t.Allow="allow",t.Forbid="forbid"}(et||(et={}));var it,rt=function(t,e,n){this.dropEffect=et.Allow,this.pageX=0,this.pageY=0,this.item=t,this.dragImage=e,this.data=t.data,this.sourceEvent=n,n&&n instanceof MouseEvent&&(this.pageX=n.pageX,this.pageY=n.pageY),n&&nt&&n instanceof TouchEvent&&n.touches[0]&&(this.pageX=n.touches[0].pageX,this.pageY=n.touches[0].pageY)},ot=function(t){t&&t instanceof MouseEvent&&(this.x=t.pageX,this.y=t.pageY),t&&nt&&t instanceof TouchEvent&&t.touches[0]&&(this.x=t.touches[0].pageX,this.y=t.touches[0].pageY)},at=new(function(){function t(){this.delta=5,this.draggableItem=null,this.dragImage=null,this.finishedSuccessfully=!1,this.mouseDownPosition=null,this.containerDescriptors=[],this.containerDescriptorIndex=-1,this.dropEffect=et.None,this.classPrefix="eqjs-drop",this.DRAG_DISABLED_ATTR="drag-disabled"}return t.prototype.registerDraggableItem=function(t){var e=this,n=t.element;if(!n)throw Error("Element in draggle item is null or undefined");n.ondragstart=function(){return!1};var i=function(t){if(!n.hasAttribute(e.DRAG_DISABLED_ATTR)){t.preventDefault(),t instanceof MouseEvent&&t.stopPropagation();var i=new ot(t);(Math.abs(i.x-e.mouseDownPosition.x)>e.delta||Math.abs(i.y-e.mouseDownPosition.y)>e.delta)&&o(t)}},r=function(t){e.mouseMoveDragListener(t)},o=function(o){o.preventDefault(),o.stopPropagation(),n.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),e.finishedSuccessfully=!1,t.beforeDragStart&&t.beforeDragStart(),e.dragImage=tt("div").setStyle("position","absolute").setStyle("z-index","65530").toDOM(),document.body.appendChild(e.dragImage),e.dragImage.appendChild(n.cloneNode(!0)),t.renderer&&t.renderer(e.dragImage),e.dropEffect=et.None,e.updateCusror(e.dropEffect),e.updateImageClass(e.dropEffect),e.draggableItem={element:n,scope:t.scope,data:t.data},e.updateDragItemPosition(o);var a=new rt(e.draggableItem,e.dragImage,o);a.dropEffect=e.dropEffect,t.onDragStart&&t.onDragStart(a),e.dropEffect!==a.dropEffect&&(e.dropEffect=a.dropEffect,e.updateImageClass(e.dropEffect)),document.addEventListener("mousemove",r,!0),document.addEventListener("touchmove",r,!0)},a=function(t){nt&&t instanceof TouchEvent&&t.preventDefault(),e.mouseDownPosition=new ot(t),n.addEventListener("mousemove",i),n.addEventListener("touchmove",i),document.addEventListener("mouseup",s),document.addEventListener("touchend",s)};n.addEventListener("mousedown",a),n.addEventListener("touchstart",a);var s=function(t){e.mouseDownPosition=null,n.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),document.removeEventListener("mousemove",r,!0),document.removeEventListener("touchmove",r,!0),e.draggableItem&&l(t)},l=function(n){try{if(e.containerDescriptorIndex>=0){var i=e.containerDescriptors[e.containerDescriptorIndex],r={element:i.element,scopes:i.scopes,data:i.data},o=new rt(e.draggableItem,e.dragImage,n);try{r.scopes.indexOf(e.draggableItem.scope)>=0&&e.dropEffect===et.Allow&&(e.finishedSuccessfully=!0,i.onDrop&&i.onDrop(r,o))}finally{i.onDragLeave&&i.onDragLeave(r,o)}}}finally{try{var a=new rt(e.draggableItem,e.dragImage,n);a.data.finishedSuccessfully=e.finishedSuccessfully,t.onDragEnd&&t.onDragEnd(a)}finally{e.draggableItem=null,e.dragImage&&e.dragImage.parentElement&&e.dragImage.parentElement.removeChild(e.dragImage),e.dragImage=null,e.finishedSuccessfully=!1,document.removeEventListener("mouseup",s),document.removeEventListener("touchend",s)}}}},t.prototype.registerDropContainer=function(t){if(!t.element)throw Error("Element in drop container is null or undefined");this.containerDescriptors.push(t)},t.prototype.removeDropContainer=function(t){var e=this.containerDescriptors.filter((function(e){return e===t||e.element==t}));if(e)for(var n=0,i=e;n<i.length;n++){var r=i[n];S.removeArrayItem(this.containerDescriptors,r)}},t.prototype.mouseMoveDragListener=function(t){if(t instanceof MouseEvent&&t.preventDefault(),t.stopPropagation(),this.updateDragItemPosition(t),-1==this.containerDescriptorIndex){for(var e=0;e<this.containerDescriptors.length;e++){var n=this.containerDescriptors[e];if(this.detectDragEnterEvent(n.element,t)){this.containerDescriptorIndex=e;break}}this.containerDescriptorIndex>=0&&this.dragEnterEvent(t)}else{n=this.containerDescriptors[this.containerDescriptorIndex];this.detectDragLeaveEvent(n.element,t)&&(this.dragLeaveEvent(t),this.containerDescriptorIndex=-1)}if(this.containerDescriptorIndex>=0){var i={element:(n=this.containerDescriptors[this.containerDescriptorIndex]).element,scopes:n.scopes,data:n.data};if(i.scopes.indexOf(this.draggableItem.scope)>=0){var r=new rt(this.draggableItem,this.dragImage,t);r.dropEffect=this.dropEffect,n.onDragOver&&n.onDragOver(i,r)}}},t.prototype.updateCusror=function(t){switch(t){case et.Allow:this.setCursorStyle(this.dragImage,"grabbing");break;case et.Forbid:this.setCursorStyle(this.dragImage,"no-drop");break;default:this.setCursorStyle(this.dragImage,"grabbing")}},t.prototype.updateImageClass=function(t){switch(this.dragImage.classList.remove(this.classPrefix+"-allow"),this.dragImage.classList.remove(this.classPrefix+"-forbid"),this.dragImage.classList.remove(this.classPrefix+"-none"),t){case et.Allow:this.dragImage.classList.add(this.classPrefix+"-allow");break;case et.None:this.dragImage.classList.add(this.classPrefix+"-none");break;case et.Forbid:this.dragImage.classList.add(this.classPrefix+"-forbid");break;default:this.dragImage.classList.add(this.classPrefix+"-none")}},t.prototype.setCursorStyle=function(t,e){if(t){t.style.cursor=e;for(var n=0;n<t.children.length;n++)this.setCursorStyle(t.children[n],e)}},t.prototype.updateDragItemPosition=function(t){if(this.dragImage){var e=new ot(t);this.dragImage.style.top=e.y-this.dragImage.offsetHeight/2+"px",this.dragImage.style.left=e.x-this.dragImage.offsetWidth/2+"px"}},t.prototype.dragEnterEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var i=new rt(this.draggableItem,this.dragImage,t);i.dropEffect=et.Allow,e.onDragEnter&&e.onDragEnter(n,i),this.dropEffect=i.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}else this.dropEffect!==et.Forbid&&(this.dropEffect=et.None,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect))},t.prototype.dragLeaveEvent=function(t){var e=this.containerDescriptors[this.containerDescriptorIndex],n={element:e.element,scopes:e.scopes,data:e.data};if(n.scopes.indexOf(this.draggableItem.scope)>=0){var i=new rt(this.draggableItem,this.dragImage,t);i.dropEffect=et.None,e.onDragLeave&&e.onDragLeave(n,i),this.dropEffect=i.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}},t.prototype.detectDragEnterEvent=function(t,e){var n=Y(t),i=new ot(e);return!(i.y<n.y||i.y>n.y+t.offsetHeight)&&!(i.x<n.x||i.x>n.x+t.offsetWidth)},t.prototype.detectDragLeaveEvent=function(t,e){var n=Y(t),i=new ot(e);return!(i.y>n.y&&i.y<n.y+t.offsetHeight&&i.x>n.x&&i.x<n.x+t.offsetWidth)},t}());!function(t){t[t.Always=0]="Always",t[t.Once=1]="Once",t[t.Never=2]="Never"}(it||(it={}));var st,lt=/{0:(.*?)}/g;!function(t){t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.DATETIME=3]="DATETIME",t[t.BOOL=4]="BOOL"}(st||(st={}));var ut,ct=function(t,e,n,i){var r=t?t.toString().replace(/\n/g,"↵ "):"";n.innerText=r,n.title=r,e.align==ut.NONE&&n.classList.add("keg-cell-value-align-left")},dt=function(t,e,n,i){var r=(t||"").toString();"number"==typeof t&&(r=e.dataColumn&&e.dataColumn.displayFormat&&lt.test(e.dataColumn.displayFormat)?e.dataColumn.displayFormat.replace(lt,(function(e,n){return I.numberToStr(t,n)})):t.toLocaleString()),n.innerText=r,n.title=r,e.align==ut.NONE&&n.classList.add("keg-cell-value-align-right")},ht=function(t,e,n,i){var r="[object Date]"===Object.prototype.toString.call(t),o=(t||"").toString();if(r)if(e.dataColumn&&e.dataColumn.displayFormat&&lt.test(e.dataColumn.displayFormat))o=e.dataColumn.displayFormat.replace(lt,(function(n,i){return I.dateTimeToStr(t,e.type,i)}));else{var a=I.getCurrentLocale(),s={hour:"numeric",minute:"numeric",second:"numeric"};switch(e.type){case c.Date:o=t.toLocaleDateString(a);break;case c.Time:o=t.toLocaleTimeString(a,s);break;case c.DateTime:o=t.toLocaleDateString(a)+" "+t.toLocaleTimeString(a,s)}}n.innerText=o,n.title=o,e.align==ut.NONE&&n.classList.add("keg-cell-value-align-right")},pt=function(t,e,n,i){if(e.dataColumn&&e.dataColumn.displayFormat&&lt.test(e.dataColumn.displayFormat)){var r=e.dataColumn.displayFormat.replace(lt,(function(e,n){return I.booleanToStr(t,n)}));return ct(r,e,n)}n.classList.add("keg-cell-value-bool"),n.classList.add("keg-"+(t?"cell-value-true":"cell-value-false"))},ft=function(){function t(t){this.renderers={},this.defaultRenderers={},this.registerRenderer("StringDefault",ct),this.setDefaultRenderer(st.STRING,ct),this.registerRenderer("NumberDefault",dt),this.setDefaultRenderer(st.NUMBER,dt),this.registerRenderer("DateTimeDefault",ht),this.setDefaultRenderer(st.DATETIME,ht),this.registerRenderer("BoolDefault",pt),this.setDefaultRenderer(st.BOOL,pt)}return t.prototype.getDefaultRenderer=function(t){var e=this.getCellType(t);return this.defaultRenderers[st[e]]},t.prototype.getDefaultRendererByType=function(t){return this.defaultRenderers[st[t]]},t.prototype.setDefaultRenderer=function(t,e){e&&(this.defaultRenderers[st[t]]=e)},t.prototype.getRenderer=function(t){return this.renderers[t]},t.prototype.registerRenderer=function(t,e){this.renderers[t]=e},t.prototype.getCellType=function(t){switch(t){case c.Autoinc:case c.Byte:case c.Word:case c.Currency:case c.Float:case c.Int32:case c.Int64:return st.NUMBER;case c.Date:case c.DateTime:case c.Time:return st.DATETIME;case c.Bool:return st.BOOL;default:return st.STRING}},t}();!function(t){t[t.NONE=1]="NONE",t[t.LEFT=2]="LEFT",t[t.CENTER=3]="CENTER",t[t.RIGHT=4]="RIGHT"}(ut||(ut={}));var gt,mt=function(){function t(t,e,n){void 0===n&&(n=!1),this._label=null,this._description=null,this.align=ut.NONE,this.isVisible=!0,this.isRowNum=!1,this.dataColumn=t,this.grid=e;var i=e.options.columnWidths||{};t?(t.style.alignment&&(this.align=function(t){switch(t){case O.Left:return ut.LEFT;case O.Center:return ut.CENTER;case O.Right:return ut.RIGHT;default:return ut.NONE}}(t.style.alignment)),this.width=i&&i[this.type]?i[this.type].default:250,this.cellRenderer=this.grid.cellRendererStore.getDefaultRenderer(t.type),this._description=t.description):n&&(this.isRowNum=!0,this.width=i&&i.rowNumColumn?i.rowNumColumn.default:60,this._label="",this.cellRenderer=this.grid.cellRendererStore.getDefaultRendererByType(st.NUMBER)),e&&e.options&&e.options.onGetCellRenderer&&(this.cellRenderer=e.options.onGetCellRenderer(this,this.cellRenderer)||this.cellRenderer)}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label?this._label:this.isRowNum?"":this.dataColumn.label},set:function(t){this._label=this.label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._description},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this.dataColumn?this.dataColumn.type:null},enumerable:!0,configurable:!0}),t}(),yt=function(){function t(t,e){this.items=[],this.grid=e,this.sync(t)}return t.prototype.sync=function(t,e){void 0===e&&(e=!0),this.clear();var n=new mt(null,this.grid,!0);if(this.add(n),e||(n.isVisible=!1),t)for(var i=0,r=t.getItems();i<r.length;i++){var o=r[i],a=new mt(o,this.grid);this.grid.options.onSyncGridColumn&&this.grid.options.onSyncGridColumn(a),this.add(a)}},Object.defineProperty(t.prototype,"count",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),t.prototype.add=function(t){var e=this.items.length;return this.items.push(t),e},t.prototype.put=function(t,e){t>=0&&t<this.items.length&&(this.items[t]=e)},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&S.moveArrayItem(this.items,n,e)},t.prototype.get=function(t){return t>=0&&t<this.items.length?this.items[t]:null},t.prototype.getItems=function(){return this.items},t.prototype.removeAt=function(t){this.get(t);this.items.splice(t,1)},t.prototype.clear=function(){this.items=[]},t}(),vt=function(){return vt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},vt.apply(this,arguments)},bt=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,r++)i[r]=o[a];return i},Ct=(function(){function t(t){if(this.cssPrefix="keg",this.pagination={page:1,pageSize:30,total:0},this.paginationOptions={maxButtonCount:10,useBootstrap:!1},this.defaultDataGridOptions={slot:null,dataTable:null,fixHeightOnFirstRender:!1,syncGridColumns:!0,useRowNumeration:!0,allowDragDrop:!1,aggregates:{settings:null,calculator:null},paging:{enabled:!0,pageSize:30,pageSizeItems:[20,30,50,100,200]},columnWidths:{autoResize:it.Always,stringColumns:{min:100,max:500,default:250},numberColumns:{min:60,default:120},boolColumns:{min:50,default:80},dateColumns:{min:80,default:200},otherColumns:{min:100,max:500,default:250},rowNumColumn:{min:40,default:60}},showPlusButton:!1,viewportRowsCount:null,showActiveRow:!0},this.rowsOnPagePromise=null,this.containerInitialHeight=0,this.firstRender=!0,this.prevRowTotals=null,this.landingIndex=-1,this.landingSlot=tt("div").addClass(this.cssPrefix+"-col-landing-slot").addChildElement(tt("div").toDOM()).toDOM(),this._activeRowIndex=-1,t&&t.paging&&(t.paging=S.assign(this.defaultDataGridOptions.paging,t.paging)),this.options=this.mergeOptions(t),this.processColumnWidthsOptions(),!this.options.slot)throw Error('"slot" parameter is required to initialize EasyDataGrid');if(!this.options.dataTable)throw Error('"dataTable" parameter is required to initialize EasyDataGrid');this.dataTable=t.dataTable,this.eventEmitter=new W(this),this.cellRendererStore=new ft(t),this.columns=new yt(this.dataTable.columns,this),this.setSlot(this.options.slot),this.init(this.options)}t.prototype.mergeOptions=function(t){var e=S.assignDeep({},this.defaultDataGridOptions.columnWidths,t.columnWidths),n=S.assignDeep({},this.defaultDataGridOptions.paging,t.paging),i=S.assign({},this.defaultDataGridOptions,t);return i.columnWidths=e,i.paging=n,i},t.prototype.processColumnWidthsOptions=function(){var t=this.options.columnWidths;if(t){S.getStringDataTypes().forEach((function(e){t[e]=vt(vt({},t.stringColumns),t[e])})),S.getNumericDataTypes().forEach((function(e){t[e]=vt(vt({},t.numberColumns),t[e])})),t[c.Bool]=vt(vt({},t.boolColumns),t[c.Bool]),S.getDateDataTypes().forEach((function(e){t[e]=vt(vt({},t.dateColumns),t[e])}));var e=bt(S.getStringDataTypes(),S.getNumericDataTypes(),S.getDateDataTypes(),[c.Bool]);S.getAllDataTypes().forEach((function(n){n in e||(t[n]=vt(vt({},t.otherColumns),t[n]))})),t[c.Unknown]=t.otherColumns}},t.prototype.setSlot=function(t){if("string"==typeof t){if(t.length)if("#"===t[0])this.slot=document.getElementById(t.substring(1));else{if("."!==t[0])throw Error("Unrecognized slot parameter (Must be id, class or HTMLElement): "+t);var e=document.getElementsByClassName(t.substring(1));e.length&&(this.slot=e[0])}}else this.slot=t},t.prototype.init=function(t){var e=this;t.onInit&&this.addEventListener("init",t.onInit),t.onRowClick&&this.addEventListener("rowClick",t.onRowClick),t.onRowDbClick&&this.addEventListener("rowDbClick",t.onRowDbClick),t.onPlusButtonClick&&this.addEventListener("plusButtonClick",t.onPlusButtonClick),t.onColumnChanged&&this.addEventListener("columnChanged",t.onColumnChanged),t.onColumnDeleted&&this.addEventListener("columnDeleted",t.onColumnDeleted),t.onColumnMoved&&this.addEventListener("columnMoved",t.onColumnMoved),t.onPageChanged&&this.addEventListener("pageChanged",t.onPageChanged),t.onActiveRowChanged&&this.addEventListener("activeRowChanged",t.onActiveRowChanged),this.addEventListener("pageChanged",(function(t){return e.activeRowIndex=-1})),S.assignDeep(this.paginationOptions,t.pagination),this.pagination.pageSize=this.options.paging.pageSize||this.pagination.pageSize,this.options.allowDragDrop&&at.registerDropContainer({element:this.slot,scopes:["gridColumnMove"],onDragEnter:function(t,n){e.slot.classList.add("eqjs-drophover"),e.showLandingSlot(n.pageX,n.pageY)},onDragOver:function(t,n){e.showLandingSlot(n.pageX,n.pageY)},onDragLeave:function(t,n){n.dropEffect=et.Forbid,e.slot.classList.remove("eqjs-drophover"),e.hideLandingSlot()},onDrop:function(t,n){e.dataTable.columns.move(n.data.column,e.landingIndex),e.refresh(),e.fireEvent({type:"columnMoved",columnId:n.data.column.id,newIndex:e.landingIndex})}}),this.refresh(),this.fireEvent("init")},t.prototype.fireEvent=function(t){"string"==typeof t?this.eventEmitter.fire(t):this.eventEmitter.fire(t.type,t)},t.prototype.setData=function(t){this.dataTable=t,this.clear(),this.refresh()},t.prototype.getData=function(){return this.dataTable},t.prototype.getColumns=function(){return this.columns},t.prototype.destroy=function(){this.slot.innerHTML=""},t.prototype.refresh=function(){this.clearDOM(),this.render()},t.prototype.clearDOM=function(){this.slot.innerHTML=""},t.prototype.clear=function(){this.pagination.page=1,this.clearDOM()},t.prototype.render=function(){var t=this;if(this.hasData()||this.options.showPlusButton){this.containerInitialHeight=this.slot.clientHeight,this.rootDiv=document.createElement("div"),this.rootDiv.style.width="100%",this.rootDiv.classList.add(this.cssPrefix+"-root"),this.columns.sync(this.dataTable.columns,this.options.useRowNumeration),this.renderHeader(),this.rootDiv.appendChild(this.headerDiv),this.renderBody(),this.rootDiv.appendChild(this.bodyDiv),this.renderFooter(),this.rootDiv.appendChild(this.footerDiv);var e=document.createElement("div");e.classList.add(this.cssPrefix+"-container"),e.appendChild(this.rootDiv),this.slot.appendChild(e);var n=this.options.columnWidths.autoResize!==it.Never;this.rowsOnPagePromise?this.rowsOnPagePromise.then((function(){return t.updateHeight()})).then((function(){t.firstRender=!1,t.rowsOnPagePromise=null})):setTimeout((function(){t.updateHeight().then((function(){t.firstRender=!1,n&&t.resizeColumns()}))}),100)}},t.prototype.updateHeight=function(){var t=this;return new Promise((function(e){if(t.options.viewportRowsCount){var n=t.bodyCellContainerDiv.firstElementChild,i=(n?n.offsetHeight:36)*t.options.viewportRowsCount;return tt(t.bodyViewportDiv).setStyle("height",i+"px"),void setTimeout((function(){var n=t.bodyViewportDiv.offsetHeight-t.bodyViewportDiv.clientHeight;i+=n,tt(t.bodyViewportDiv).setStyle("height",i+"px"),e()}),100)}t.containerInitialHeight,e()})).then((function(){t.options.fixHeightOnFirstRender&&t.firstRender&&(t.slot.style.height=t.slot.offsetHeight+"px")}))},t.prototype.getContainerWidth=function(){return this.columns.getItems().filter((function(t){return t.isVisible})).map((function(t){return t.width})).reduce((function(t,e){return t+e}))},t.prototype.renderHeader=function(){var t=this;this.headerDiv=tt("div").addClass(this.cssPrefix+"-header").toDOM(),this.headerViewportDiv=tt("div",this.headerDiv).addClass(this.cssPrefix+"-header-viewport").toDOM(),this.headerCellContainerDiv=tt("div",this.headerViewportDiv).addClass(this.cssPrefix+"-header-cell-container").toDOM(),this.headerRowDiv=tt("div",this.headerCellContainerDiv).addClass(this.cssPrefix+"-header-row").toDOM(),this.columns.getItems().forEach((function(e,n){if(e.isVisible){var i=t.renderColumnHeader(e,n);t.headerRowDiv.appendChild(i),e.isRowNum&&tt(i).addChildElement(t.renderHeaderButtons())}}));var e=this.getContainerWidth();tt(this.headerCellContainerDiv).setStyle("width",e+"px")},t.prototype.hasData=function(){return this.dataTable.columns.count>0},t.prototype.renderColumnHeader=function(t,e){var n=this,i=tt("div").addClass(this.cssPrefix+"-header-cell").data("col-idx",""+e).setStyle("width",t.width+"px");t.dataColumn&&i.data("col-id",""+t.dataColumn.id);var r=i.toDOM();return tt("div",r).addClass(this.cssPrefix+"-header-cell-resize"),t.isRowNum||tt("div",r).addClass(this.cssPrefix+"-header-cell-label").text(t.label),t.description&&tt("div",r).addClass("question-mark").title(t.description),this.options.allowDragDrop&&at.registerDraggableItem({element:r,scope:"gridColumnMove",data:{column:t},renderer:function(e){e.innerHTML="";var i=document.createElement("div");i.innerText=t.label,e.classList.add(n.cssPrefix+"-sortable-helper"),e.appendChild(i)},onDragStart:function(t){t.dropEffect=et.Allow}}),r},t.prototype.renderBody=function(){var t=this;this.bodyDiv=tt("div").addClass(this.cssPrefix+"-body").toDOM(),this.bodyViewportDiv=tt("div",this.bodyDiv).addClass(this.cssPrefix+"-body-viewport").attr("tabIndex","0").toDOM(),this.bodyCellContainerDiv=tt("div",this.bodyViewportDiv).addClass(this.cssPrefix+"-cell-container").toDOM();var e=this.canShowAggregates();this.dataTable&&(this.showProgress(),this.rowsOnPagePromise=this.getRowsToRender().then((function(n){t.pagination.total=t.dataTable.getTotal(),t.hideProgress(),t.bodyCellContainerDiv.innerHTML="",t.prevRowTotals=null;var i=0;if(n.length){var r=e?t.options.aggregates.settings.getGroups():[];i=n.length<t.pagination.pageSize?n.length:t.pagination.pageSize,n.forEach((function(n,o){if(e&&t.updateTotalsState(r,n),o<i){var a=t.renderRow(n,o);t.bodyCellContainerDiv.appendChild(a)}}));var o=t.options.aggregates&&t.options.aggregates.showGrandTotalsOnEachPage;if(e&&(t.isLastPage()||o)){var a=new j(t.dataTable.columns,new Array(t.dataTable.columns.count));t.updateTotalsState(r,a,!0)}}if(t.options.columnWidths.autoResize!==it.Never)t.resizeColumns();else{var s=t.getContainerWidth();tt(t.bodyCellContainerDiv).setStyle("width",s+"px")}return i})).catch((function(t){return console.error(t),0}))),this.bodyViewportDiv.addEventListener("scroll",(function(e){tt(t.headerViewportDiv).setStyle("margin-left","-"+t.bodyViewportDiv.scrollLeft+"px")})),this.bodyViewportDiv.addEventListener("keydown",this.onViewportKeydown.bind(this))},t.prototype.isLastPage=function(){return this.dataTable.elasticChunks?this.dataTable.totalIsKnown()&&this.pagination.page*this.pagination.pageSize>=this.pagination.total:this.pagination.page*this.pagination.pageSize>=this.pagination.total},t.prototype.canShowAggregates=function(){if(!this.options||!this.options.aggregates||!this.options.aggregates.settings)return!1;var t=this.options.aggregates.settings;return(t.hasAggregates()||t.hasRecordCount())&&(t.hasGroups()||t.hasGrandTotals())},t.prototype.updateTotalsState=function(t,e,n){void 0===n&&(n=!1);var i=this.options.aggregates.settings;if(this.prevRowTotals&&i.hasGroups()){for(var r=-1,o=1;o<=t.length;o++){for(var a=0,s=t[o-1].columns;a<s.length;a++){var l=s[a];if(!i.compareValues(this.prevRowTotals.getValue(l),e.getValue(l))){r=o;break}}if(-1!==r)break}if(-1!==r)for(o=t.length;o>=r;o--){var u=new j(this.dataTable.columns,this.prevRowTotals.toArray()),c=this.renderTotalsRow(o,u);this.bodyCellContainerDiv.appendChild(c)}}if(n&&i.hasGrandTotals()&&i.hasAggregates()){c=this.renderTotalsRow(0,e);this.bodyCellContainerDiv.appendChild(c)}this.prevRowTotals=e},t.prototype.applyGroupColumnTemplate=function(t,e,n){var i=t.replace(/{{\s*GroupValue\s*}}/g,e?""+e:"-");return i=i.replace(/{{\s*GroupCount\s*}}/g,n?""+n:"-")},t.prototype.renderTotalsRow=function(t,e){var n=this,i=this.options.aggregates.settings,r=t>0?i.getGroups()[t-1]:{columns:[],aggregates:i.getAggregates()},o=tt("div").addClass(this.cssPrefix+"-row").addClass(this.cssPrefix+"-row-totals").addClass(this.cssPrefix+"-totals-lv"+t).data("totals-level",""+t).attr("tabindex","-1").toDOM();this.columns.getItems().forEach((function(t,i){if(t.isVisible){var a="",s=t.isRowNum?-1:n.dataTable.columns.getIndex(t.dataColumn.id);!t.isRowNum&&t.dataColumn&&r.columns.indexOf(t.dataColumn.id)>=0&&(a=e.getValue(s)),s==n.dataTable.columns.count-1&&(a=". . . . . ."),o.appendChild(n.renderCell(t,i,a,o))}}));var a=this.options.aggregates.calculator.getAggrContainer(),s=i.getAggregates().map((function(t){return t.colId})),l=i.buildGroupKey(r,e);return a.getAggregateData(t,l).then((function(a){for(var l=0,u=s;l<u.length;l++){var c=u[l];e.setValue(c,a[c])}o.innerHTML="",n.columns.getItems().forEach((function(l,u){if(l.isVisible){var c="",d=l.isRowNum?-1:n.dataTable.columns.getIndex(l.dataColumn.id);if(!l.isRowNum){var h=!1;if(l.dataColumn){var p=r.columns.indexOf(l.dataColumn.id),f=s.indexOf(l.dataColumn.id);h=t>0?p==r.columns.length-1:0==d,(p>=0||f>=0)&&(c=e.getValue(d))}var g="";if(t>0&&!(g=l.dataColumn.groupFooterColumnTemplate)&&i.hasRecordCount()&&h&&(g="{{GroupValue}} ({{GroupCount}})"),g)c=n.renderCell(l,u,c,o).firstChild.innerHTML,c=n.applyGroupColumnTemplate(g,c,a[i.COUNT_FIELD_NAME])}var m=n.renderCell(l,u,c,o);o.appendChild(m)}}))})).catch((function(t){return console.error(t)})),o},t.prototype.onViewportKeydown=function(t){if(this.options.showActiveRow){var e=this.bodyCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-row").length,n=void 0;switch(t.key){case"ArrowLeft":case"ArrowRight":break;case"ArrowUp":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?e-1:this.activeRowIndex-1,this.activeRowIndex=n>=0?n:0;break;case"ArrowDown":t.preventDefault(),n=this.activeRowIndex<0||this.activeRowIndex>=e?0:this.activeRowIndex+1,this.activeRowIndex=n<e?n:e-1}}},t.prototype.ensureRowVisibility=function(t){var e="number"==typeof t?this.getDataRow(t):t;if(e){var n=e.getBoundingClientRect(),i=this.bodyViewportDiv.getBoundingClientRect(),r=n.top-i.top,o=n.bottom-i.top,a=this.bodyViewportDiv.clientHeight,s=window.innerHeight||document.documentElement.clientHeight;if(r>0&&o<=a&&n.top>0&&n.bottom<s)return;r<0?this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+r:o>a&&(this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+o-a),(n=e.getBoundingClientRect()).top<0?document.documentElement.scrollTop=document.documentElement.scrollTop+n.top:n.bottom>s&&(document.documentElement.scrollTop=document.documentElement.scrollTop+n.bottom-s)}},t.prototype.getRowsToRender=function(){return!1===this.options.paging.enabled?Promise.resolve(this.dataTable.getCachedRows()):this.dataTable.getRows({offset:(this.pagination.page-1)*this.pagination.pageSize,limit:this.pagination.pageSize+1}).catch((function(t){return console.error(t),[]}))},t.prototype.renderFooter=function(){var t=this;this.footerDiv=tt("div").addClass(this.cssPrefix+"-footer").toDOM(),this.rowsOnPagePromise&&this.rowsOnPagePromise.then((function(e){t.footerDiv.innerHTML="",t.footerPaginateDiv=t.renderPageNavigator(),t.footerDiv.appendChild(t.footerPaginateDiv);var n=t.renderPageInfoBlock(e);t.footerDiv.appendChild(n)}))},t.prototype.renderPageInfoBlock=function(t){var e=tt("div").addClass(this.cssPrefix+"-page-info").toDOM();if(this.dataTable.getTotal()>0){var n=t?(this.pagination.page-1)*this.pagination.pageSize+1:0,i=t?n+t-1:0,r=this.dataTable.getTotal().toString();if(this.dataTable.elasticChunks)this.dataTable.getCachedCount()!==this.dataTable.getTotal()&&(r="?");e.innerHTML=I.getText("GridPageInfo").replace("{FirstPageRecordNum}","<span>"+n.toString()+"</span>").replace("{LastPageRecordNum}","<span>"+i.toString()+"</span>").replace("{Total}","<span>"+r+"</span>")}return e},t.prototype.showProgress=function(){},t.prototype.hideProgress=function(){},t.prototype.getLocalIndexByGlobal=function(t){return this.pagination?t%this.pagination.pageSize:t},t.prototype.getGlobalIndexByLocal=function(t){return this.pagination?(this.pagination.page-1)*this.pagination.pageSize+t:t},t.prototype.renderRow=function(t,e){var n=this,i=this.getGlobalIndexByLocal(e),r=tt("div").addClass(this.cssPrefix+"-row").addClass(this.cssPrefix+"-row-"+(e%2==1?"odd":"even")).data("row-idx",""+i).attr("tabindex","-1").on("click",(function(i){n.activeRowIndex=e,n.fireEvent({type:"rowClick",row:t,rowIndex:e,sourceEvent:i})})).on("dblclick",(function(i){n.fireEvent({type:"rowDbClick",row:t,rowIndex:e,sourceEvent:i})}));0==e&&r.addClass(this.cssPrefix+"-row-first");var o=r.toDOM();return this.options.showActiveRow&&e==this.activeRowIndex&&r.addClass(this.cssPrefix+"-row-active"),this.columns.getItems().forEach((function(e,r){if(e.isVisible){var a=e.isRowNum?-1:n.dataTable.columns.getIndex(e.dataColumn.id),s=e.isRowNum?i+1:t.getValue(a);o.appendChild(n.renderCell(e,r,s,o))}})),o},t.prototype.renderCell=function(t,e,n,i){var r=tt("div").addClass(this.cssPrefix+"-cell").data("col-idx",""+e).attr("tabindex","-1").setStyle("width",t.width+"px");t.align==ut.LEFT?r.addClass(this.cssPrefix+"-cell-align-left"):t.align==ut.RIGHT?r.addClass(this.cssPrefix+"-cell-align-right"):t.align==ut.CENTER&&r.addClass(this.cssPrefix+"-cell-align-center");var o=r.toDOM(),a=o.appendChild(tt("div").addClass(this.cssPrefix+"-cell-value").toDOM());return t.cellRenderer&&t.cellRenderer(n,t,a,i),o},t.prototype.setPage=function(t){this.pagination.page=t,this.fireEvent({type:"pageChanged",page:t}),this.refresh(),this.bodyViewportDiv.focus()},t.prototype.renderPageNavigator=function(){var t=this,e=document.createElement("div");e.className=this.cssPrefix+"-pagination-wrapper";var n=this.dataTable.getTotal();if(this.options.paging&&this.options.paging.enabled&&n>0){var i=this.paginationOptions.useBootstrap?"":this.cssPrefix+"-",r=function(e){var n=e.target;if(n.hasAttribute("data-page")){var i=parseInt(n.getAttribute("data-page"));t.setPage(i)}},o=function(e,n,o,a,s){var l=document.createElement("li");if(l.className=i+"page-item",!a){s&&(l.className+=" active");var u=document.createElement("a");return u.setAttribute("href","javascript:void(0)"),u.innerHTML=n||e.toString(),u.setAttribute("data-page",""+e),u.className=i+"page-link",u.addEventListener("click",r),l.appendChild(u),l}var c=document.createElement("span");if(c.setAttribute("aria-hidden","true"),c.className=i+"page-link",o)l.className+=" disabled";else{if(t.paginationOptions.useBootstrap)(c=document.createElement("a")).setAttribute("href","javascript:void(0)"),c.setAttribute("data-page",""+e);else{var d=document.createElement("a");d.setAttribute("href","javascript:void(0)"),d.setAttribute("data-page",""+e),c=d}c.className=i+"page-link",c.addEventListener("click",r)}return c.innerHTML=n,l.appendChild(c),l};if(this.dataTable.elasticChunks){var a=this.pagination.page||1;(l=document.createElement("ul")).className=i+"pagination";var s=o(a-1,"&laquo;",1==a,!0,!1);l.appendChild(s),s=o(a+1,"&raquo;",this.isLastPage(),!0,!1),l.appendChild(s),e.appendChild(l)}else if(this.pagination.total>this.pagination.pageSize){a=this.pagination.page||1;var l,u=Math.ceil(this.pagination.total/this.pagination.pageSize)||1,c=this.paginationOptions.maxButtonCount||10,d=a-1,h=d-d%c+1,p=h+c-1;p>u&&(p=u),(l=document.createElement("ul")).className=i+"pagination";s=o(h-1,"&laquo;",1==h,!0,!1);l.appendChild(s);for(var f=h;f<=p;f++)s=o(f,f.toString(),!1,!1,f==a),l.appendChild(s);s=o(p+1,"&raquo;",p==u,!0,!1),l.appendChild(s),e.appendChild(l)}if(this.options.paging.allowPageSizeChange){var g=document.createElement("div");g.className=this.cssPrefix+"-page-sizes";var m=document.createElement("div");m.className="kfrm-select "+this.cssPrefix+"-page-sizes-select",g.appendChild(m);var y=document.createElement("select"),v=this.options.paging.pageSizeItems||[],b=new Set(v);b.add(this.options.paging.pageSize||20),Array.from(b).forEach((function(t){var e=document.createElement("option");e.value=t.toString(),e.text=t.toString(),y.appendChild(e)})),y.value=(this.pagination.pageSize||20).toString(),m.appendChild(y),y.addEventListener("change",(function(e){var n=parseInt(e.target.value);t.pagination.pageSize=n,t.pagination.page=1,t.refresh()}));var C=document.createElement("div");C.className=this.cssPrefix+"-page-sizes-label",g.appendChild(C);var w=document.createElement("span");w.innerText=I.getText("GridItemsPerPage"),C.appendChild(w),e.appendChild(g)}}return e},t.prototype.addEventListener=function(t,e){return this.eventEmitter.subscribe(t,(function(t){return e(t.data)}))},t.prototype.removeEventListener=function(t,e){this.eventEmitter.unsubscribe(t,e)},t.prototype.renderHeaderButtons=function(){var t=this;return this.options.showPlusButton?tt("div").addClass(this.cssPrefix+"-header-btn-plus").title(this.options.plusButtonTitle||"Add").addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.fireEvent({type:"plusButtonClick",sourceEvent:e})}))})).toDOM():tt("span").addText("#").toDOM()},t.prototype.showLandingSlot=function(t,e){for(var n=this.headerRowDiv.querySelectorAll("[class*="+this.cssPrefix+"-table-col]"),i=[],r=1;r<n.length;r++){var o=n[r];"none"!==o.style.display&&i.push(o)}if(0===i.length)return this.landingIndex=0,void this.headerRowDiv.appendChild(this.landingSlot);var a=Y(this.landingSlot);if(!(t>=a.x&&t<=a.x+this.landingSlot.offsetWidth)){for(var s=this.landingIndex,l=0,u=i;l<u.length;l++){var c=u[l],d=Y(c),h=c.offsetWidth;t>d.x&&t<d.x+h&&(s=parseInt(c.getAttribute("data-col-idx"))-1)}s!=this.landingIndex&&(this.landingIndex=s,this.landingIndex<i.length?this.headerRowDiv.insertBefore(this.landingSlot,i[this.landingIndex]):this.headerRowDiv.appendChild(this.landingSlot))}},t.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},Object.defineProperty(t.prototype,"activeRowIndex",{get:function(){return this._activeRowIndex},set:function(t){if(t!==this._activeRowIndex){var e=this._activeRowIndex;this._activeRowIndex=t,this.updateActiveRow(),this.fireEvent({type:"activeRowChanged",oldValue:e,newValue:this.activeRowIndex,rowIndex:this.getGlobalIndexByLocal(this.activeRowIndex)})}},enumerable:!0,configurable:!0}),t.prototype.updateActiveRow=function(){var t=this;if(this.options.showActiveRow){this.bodyCellContainerDiv.querySelectorAll("[class*="+this.cssPrefix+"-row-active]").forEach((function(e){e.classList.remove(t.cssPrefix+"-row-active")}));var e=this.getActiveRow();e&&(e.classList.add(this.cssPrefix+"-row-active"),this.ensureRowVisibility(this.activeRowIndex))}},t.prototype.getActiveRow=function(){return this.getDataRow(this.activeRowIndex)},t.prototype.getDataRow=function(t){var e=Array.from(this.bodyCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-row:not(."+this.cssPrefix+"-row-totals)"));return t>=0&&t<e.length?e[t]:null},t.prototype.focus=function(){this.bodyViewportDiv.focus()},t.prototype.resizeColumns=function(){if(this.options.columnWidths.autoResize!==it.Never){var t=this.bodyCellContainerDiv.style.width;this.bodyCellContainerDiv.style.visibility="hidden",this.bodyCellContainerDiv.style.width="1px",this.headerRowDiv.style.width="1px";for(var e=0,n=this.columns.getItems(),i=this.headerCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-header-cell"),r=0,o=function(t){var o=n[t];if(!o.isVisible)return"continue";var s=a.options.columnWidths.autoResize!==it.Always&&o.dataColumn?o.dataColumn.calculatedWidth:0,l=a.bodyCellContainerDiv.querySelectorAll("."+a.cssPrefix+'-cell[data-col-idx="'+t+'"] > .'+a.cssPrefix+"-cell-value"),u=0;if(s>0)e+=s,o.width=s,l.forEach((function(t){t.parentElement.style.width=s+"px"})),i[r].style.width=s+"px";else if(0==l.length&&(i[r].style.width=null,i[r].style.whiteSpace="nowrap"),u=i[r].offsetWidth,l.length>0){l.forEach((function(t){t.parentElement.style.width=null;var e=t.parentElement.offsetWidth;e>u&&(u=e)})),u+=3;var c=o.isRowNum?a.options.columnWidths.rowNumColumn.max||500:a.options.columnWidths[o.dataColumn.type].max||2e3,d=o.isRowNum?a.options.columnWidths.rowNumColumn.min||0:a.options.columnWidths[o.dataColumn.type].min||20;u>c&&(u=c),u<d&&(u=d),S.isNumericType(o.type)&&(u=Math.round(1.3*u)),e+=u,o.width=u,l.forEach((function(t){t.parentElement.style.width=u+"px"})),i[r].style.width=u+"px",o.dataColumn&&(o.dataColumn.calculatedWidth=u)}else e+=u;r++},a=this,s=0;s<this.columns.count;s++)o(s);e>0?(this.bodyCellContainerDiv.style.width=e+"px",this.headerCellContainerDiv.style.width=e+"px"):(this.bodyCellContainerDiv.style.width=t,this.headerCellContainerDiv.style.width=t),this.bodyCellContainerDiv.style.visibility=null,this.headerRowDiv.removeAttribute("style")}}}(),function(){function t(t,e){this.slot=t,this.options=e||{},this.options.yearRange||(this.options.yearRange="c-10:c+10")}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-cal"},enumerable:!0,configurable:!0}),t.prototype.setDate=function(t){this.currentDate=new Date(t)},t.prototype.getDate=function(){return new Date(this.currentDate)},t.prototype.dateChanged=function(t){this.options.onDateChanged&&this.options.onDateChanged(this.currentDate,t)},t}()),wt=function(){function t(t){this.calendar=null,this.timePicker=null,this.options=t,this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp"},enumerable:!0,configurable:!0}),t.prototype.setDateTime=function(t){this.currentDateTime=new Date(t),this.calendar&&this.calendar.setDate(this.currentDateTime),this.timePicker&&this.timePicker.setTime(this.currentDateTime)},t.prototype.getDateTime=function(){return new Date(this.currentDateTime)},t.prototype.render=function(){var t=this;this.options.showCalendar&&(this.calendar=this.createCalendar({yearRange:this.options.yearRange,showDateTimeInput:this.options.showDateTimeInput,timePickerIsUsed:this.options.showTimePicker,oneClickDateSelection:this.options.oneClickDateSelection,onDateChanged:function(e,n){t.currentDateTime=e,t.timePicker&&t.timePicker.setTime(t.currentDateTime),t.options.showTimePicker&&t.dateTimeChanged(),n&&t.apply(t.currentDateTime)}}),this.calendar&&this.calendar.render()),this.options.showTimePicker&&(this.timePicker=this.createTimePicker({onTimeChanged:function(e){t.currentDateTime.setHours(e.getHours()),t.currentDateTime.setMinutes(e.getMinutes()),t.calendar&&t.calendar.setDate(t.currentDateTime),t.dateTimeChanged()}}),this.timePicker&&this.timePicker.render()),this.setDateTime(new Date)},t.prototype.createCalendar=function(t){return null},t.prototype.createTimePicker=function(t){return null},t.prototype.show=function(t){this.options.beforeShow&&this.options.beforeShow();var e=Y(t||document.body);this.slot.style.top=e.y+t.clientHeight+"px",this.slot.style.left=e.x+"px"},t.prototype.apply=function(t){this.options.onApply&&this.options.onApply(t),this.destroy()},t.prototype.cancel=function(){this.options.onCancel&&this.options.onCancel(),this.destroy()},t.prototype.destroy=function(){this.slot&&this.slot.parentElement&&this.slot.parentElement.removeChild(this.slot)},t.prototype.dateTimeChanged=function(){this.options.onDateTimeChanged&&this.options.onDateTimeChanged(this.currentDateTime)},t}(),Dt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),xt=function(t){function e(e,n){var i=t.call(this,e,n)||this;i.daysOfWeek=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i.calendarBody=null,i.isManualInputChanging=!1;for(var r=0;r<i.daysOfWeek.length;r++)i.daysOfWeek[r]=I.getShortWeekDayName(r+1);for(r=0;r<i.months.length;r++)i.months[r]=I.getLongMonthName(r+1);return i}return Dt(e,t),e.prototype.setDate=function(e){t.prototype.setDate.call(this,e),this.selectedMonth=this.currentDate.getMonth(),this.selectedYear=this.currentDate.getFullYear(),this.rerenderMonth()},e.prototype.render=function(){var t=this,e=tt("div",this.slot).addClass(this.cssPrefix+"-header");this.options.showDateTimeInput?e.addChildElement(this.renderManualDateInput()):e.addChild("span",(function(e){return t.headerTextElem=e.toDOM()})),tt(this.slot).addChildElement(this.renderCalendarButtons()),this.calendarBody=tt("div",this.slot).addClass(this.cssPrefix+"-body").toDOM()},e.prototype.getInputDateFormat=function(){var t=I.getLocaleSettings();return this.options.timePickerIsUsed?t.editDateFormat+" "+t.editTimeFormat:t.editDateFormat},e.prototype.renderManualDateInput=function(){var t=this,e=this.getInputDateFormat(),n=tt("input").attr("placeholder",e).addClass(this.cssPrefix+"-header-input");return n.mask(e.replace("yyyy","9999").replace("MM","99").replace("dd","99").replace("HH","99").replace("mm","99").replace("ss","99")).on("input",(function(i){n.removeClass("error");try{t.isManualInputChanging=!0;var r=S.strToDateTime(t.manualInputElem.value,e);t.currentDate=r,t.jump(t.currentDate.getFullYear(),t.currentDate.getMonth()),t.dateChanged(!1)}catch(t){n.addClass("error")}finally{t.isManualInputChanging=!1}})).on("keydown",(function(e){13===e.keyCode&&(e.preventDefault(),e.stopPropagation(),t.manualInputElem.className.indexOf("error")<0&&!t.isManualInputChanging&&t.dateChanged(!0))})).on("focus",(function(){setTimeout((function(){t.manualInputElem.selectionStart=0,t.manualInputElem.selectionEnd=0}),50)})),this.manualInputElem=n.toDOM(),this.manualInputElem},e.prototype.updateDisplayedDateValue=function(){if(this.manualInputElem){if(!this.isManualInputChanging){var t=this.getInputDateFormat();this.manualInputElem.value=S.dateTimeToStr(this.currentDate,t),this.manualInputElem.focus()}}else if(this.headerTextElem){var e=I.getCurrentLocale();this.headerTextElem.innerText=this.currentDate.toLocaleString("en"==e?void 0:e,{year:"numeric",month:"long",day:"numeric"})}},e.prototype.renderCalendarButtons=function(){var t=this;return tt("nav").addClass(this.cssPrefix+"-nav").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-prev").on("click",(function(){t.prev()})).addChild("span",(function(t){return t.html("&lsaquo;")}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-selectors").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-month").addChild("select",(function(e){e.on("change",(function(){t.jump(t.selectedYear,parseInt(t.selectMonthElem.value))}));for(var n=function(n){e.addChild("option",(function(e){return e.attr("value",n.toString()).text(t.months[n])}))},i=0;i<t.months.length;i++)n(i);t.selectMonthElem=e.toDOM()}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-year").addChild("select",(function(e){return t.selectYearElem=e.on("change",(function(){t.jump(parseInt(t.selectYearElem.value),t.selectedMonth)})).toDOM()}))}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-nav-next").on("click",(function(){t.next()})).addChild("span",(function(t){return t.html("&rsaquo;")}))})).toDOM()},e.prototype.prev=function(){this.selectedYear=0===this.selectedMonth?this.selectedYear-1:this.selectedYear,this.selectedMonth=0===this.selectedMonth?11:this.selectedMonth-1,this.rerenderMonth()},e.prototype.next=function(){this.selectedYear=11===this.selectedMonth?this.selectedYear+1:this.selectedYear,this.selectedMonth=(this.selectedMonth+1)%12,this.rerenderMonth()},e.prototype.rerenderSelectYear=function(){var t=/c-(\d*):c\+(\d*)/g.exec(this.options.yearRange),e=0,n=1;null!==t&&(e=parseInt(t[1]),n=parseInt(t[2])),this.selectYearElem.innerHTML="";for(var i=0;i<=e+n;i++){var r=document.createElement("option"),o=this.selectedYear-e+i;r.value=o.toString(),r.innerText=o.toString(),this.selectYearElem.appendChild(r)}},e.prototype.jump=function(t,e){this.selectedYear=t,this.selectedMonth=e,this.rerenderMonth()},e.prototype.rerenderMonth=function(){var t=this;this.updateDisplayedDateValue(),this.rerenderSelectYear();var e=new Date(this.selectedYear,this.selectedMonth).getDay(),n=new Date(this.selectedYear,this.selectedMonth+1,0).getDate();this.calendarBody.innerHTML="",this.selectYearElem.value=this.selectedYear.toString(),this.selectMonthElem.value=this.selectedMonth.toString(),this.daysOfWeek.forEach((function(e,n){tt("div",t.calendarBody).addClass(t.cssPrefix+"-weekday").addClass(0==n||6==n?t.cssPrefix+"-weekend":"").text(e)}));for(var i=0;i<e;i++)tt("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty");for(var r=new Date,o=1;o<=n;o++){var a=tt("div",this.calendarBody).addClass(this.cssPrefix+"-day").attr("data-date",o.toString()).text(o.toString()).on("click",(function(e){t.currentDate.setFullYear(t.selectedYear),t.currentDate.setMonth(t.selectedMonth),t.currentDate.setDate(parseInt(e.target.getAttribute("data-date"))),t.dateChanged(t.options.oneClickDateSelection)}));o===r.getDate()&&this.selectedYear===r.getFullYear()&&this.selectedMonth===r.getMonth()&&a.addClass(this.cssPrefix+"-day-current"),o===this.currentDate.getDate()&&this.selectedYear===this.currentDate.getFullYear()&&this.selectedMonth===this.currentDate.getMonth()&&a.addClass(this.cssPrefix+"-day-selected");var s=(e+o-1)%7;0!=s&&6!=s||a.addClass(this.cssPrefix+"-weekend")}var l=(e+n)%7,u=0==l?0:7-l;for(i=0;i<u;i++)tt("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty")},e.prototype.dateChanged=function(e){t.prototype.dateChanged.call(this,e),this.rerenderMonth()},e}(Ct),Et=function(){function t(t,e){this.slot=t,this.options=e||{}}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"kdtp-tp"},enumerable:!0,configurable:!0}),t.prototype.setTime=function(t){this.currentTime=new Date(t)},t.prototype.getTime=function(){return new Date(this.currentTime)},t.prototype.timeChanged=function(){this.options.onTimeChanged&&this.options.onTimeChanged(this.currentTime)},t}(),Tt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),It=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Tt(e,t),e.prototype.setTime=function(e){t.prototype.setTime.call(this,e),this.updateDisplayedTime(),this.hoursInput.valueAsNumber=e.getHours(),this.minutesInput.valueAsNumber=e.getMinutes()},e.prototype.render=function(){var t=this;tt("div",this.slot).addClass(this.cssPrefix+"-time").addChild("span",(function(e){return t.timeText=e.toDOM()})).toDOM();var e=tt("div",this.slot).addClass(this.cssPrefix+"-sliders");return e.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-time-row").title("Hours").addChild("input",(function(e){return t.hoursInput=e.addClass(t.cssPrefix+"-input-hours").type("range").attr("min","0").attr("max","23").attr("step","1").on("input",(function(e){t.currentTime.setHours(t.hoursInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),e.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-time-row").title("Minutes").addChild("input",(function(e){return t.minutesInput=e.addClass(t.cssPrefix+"-input-minutes").type("range").attr("min","0").attr("max","59").attr("step","1").on("input",(function(e){t.currentTime.setMinutes(t.minutesInput.valueAsNumber),t.updateDisplayedTime(),t.timeChanged()})).toDOM()}))})),this.slot},e.prototype.updateDisplayedTime=function(){var t=I.getCurrentLocale(),e=this.currentTime.toLocaleString("en"==t?void 0:t,{hour:"numeric",minute:"numeric"});this.timeText.innerText=e},e}(Et),St=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}St(e,t),e.prototype.render=function(){var e=this,n=tt("div",document.body).addClass(""+this.cssPrefix).attr("tabIndex","0").setStyle("position","absolute").setStyle("top","-1000px").setStyle("left","-1000px").on("keydown",(function(t){return 27===t.keyCode?e.cancel():13===t.keyCode&&e.apply(e.getDateTime()),!1}));this.options.zIndex&&n.setStyle("z-index",""+this.options.zIndex),this.slot=n.toDOM(),t.prototype.render.call(this),this.renderButtons(),this.globalMouseDownHandler=function(t){var n=window.event||t;n.srcElement||n.target;return!e.slot.contains(n.target)&&(document.removeEventListener("mousedown",e.globalMouseDownHandler,!0),e.cancel()),!0}},e.prototype.renderButtons=function(){var t=this,e=tt("div",this.slot).addClass(this.cssPrefix+"-buttons").addChild("button",(function(e){return t.nowButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-now").text(I.getText("ButtonNow")).on("click",(function(){return t.setDateTime(new Date),t.dateTimeChanged(),!1})).toDOM()}));!this.options.showTimePicker&&this.options.oneClickDateSelection||e.addChild("button",(function(e){return t.submitButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-apply").text(I.getText("ButtonApply")).on("click",(function(){return t.apply(t.getDateTime()),!1})).toDOM()})),e.addChild("button",(function(e){return t.submitButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-cancel").text(I.getText("ButtonCancel")).on("click",(function(){return t.cancel(),!1})).toDOM()}))},e.prototype.createCalendar=function(t){return this.calendarSlot=tt("div",this.slot).addClass(this.cssPrefix+"-cal").toDOM(),new xt(this.calendarSlot,t)},e.prototype.createTimePicker=function(t){return this.timePickerSlot=tt("div",this.slot).addClass(this.cssPrefix+"-tp").toDOM(),new It(this.timePickerSlot,t)},e.prototype.show=function(e){var n=this;if(this.options.showDateTimeInput){this.options.beforeShow&&this.options.beforeShow();var i=Y(e||document.body),r=Y(e?e.parentElement||e:document.body);this.slot.style.top=r.y+"px",this.slot.style.left=i.x+"px"}else t.prototype.show.call(this,e),this.slot.focus();setTimeout((function(){document.addEventListener("mousedown",n.globalMouseDownHandler,!0)}),1)}}(wt);!function(t){t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(gt||(gt={}));var kt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Mt=function(){function t(){}return t.prototype.openConfirm=function(t,e,n){var i=this,r={title:t,closable:!1,submitable:!0,cancelable:!0,body:'<div id="kdlg-dialog-confirm">'+e+"</div>"};return n?(r.onSubmit=function(){n(!0)},r.onCancel=function(){n(!1)},void this.open(r)):new Promise((function(t){r.onSubmit=function(){t(!0)},r.onCancel=function(){t(!1)},i.open(r)}))},t.prototype.openPrompt=function(t,e,n,i){var r=this,o={title:t,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,body:'<div id="kdlg-dialog-form" class="kfrm-form">\n <div class="kfrm-fields label-above">\n <label for="kdlg-dialog-form-input" id="kdlg-dialog-form-content">'+e+'</label>\n <input type="text" name="'+'kdlg-dialog-form-input" id="'+'kdlg-dialog-form-input" />\n </div>\n </div>',arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");n&&(t.value=n),t.focus()}},a=function(t){var e=document.getElementById("kdlg-dialog-form-input"),n=e.value;return n&&n.replace(/\s/g,"").length>0?(t(n),!0):(e.classList.add("eqjs-invalid"),!1)};return i?(o.onSubmit=function(){return a(i)},o.onCancel=function(){i("")},void this.open(o)):new Promise((function(t){o.onSubmit=function(){return a(t)},o.onCancel=function(){t("")},r.open(o)}))},t.prototype.open=function(t,e){var n=this,i=new Ot(t,e),r=t.onDestroy;return t.onDestroy=function(t){n.untrack(t),r&&r(t)},i.open(),this.track(i),i},t.prototype.createSet=function(t){return new Rt(t,this)},t.prototype.untrack=function(e){var n=t.openDialogs.indexOf(e);n>=0&&t.openDialogs.splice(n,1)},t.prototype.track=function(e){t.openDialogs.push(e)},t.prototype.openProgress=function(t){var e=this,n=new Pt(t),i=t.onDestroy;return t.onDestroy=function(t){e.untrack(t),i&&i(t)},n.open(),this.track(n),n},t.prototype.getAllDialogs=function(){return Array.from(t.openDialogs)},t.prototype.closeAllDialogs=function(){for(var e=0,n=Array.from(t.openDialogs);e<n.length;e++){n[e].close()}},t.openDialogs=[],t}(),Ot=function(){function t(t,e){var n=this;this.options=t,this.submitHandler=function(t){return(!n.options.onSubmit||!1!==n.options.onSubmit(n,t))&&(n.destroy(),!0)},this.cancelHandler=function(){n.options.onCancel&&n.options.onCancel(n),n.destroy()},this.keydownHandler=function(t){return 13!=t.keyCode||!n.isActiveDialog()||(t.preventDefault(),t.stopPropagation(),!n.submitHandler())||(window.removeEventListener("keydown",n.keydownHandler,!1),!1)},this.dialogId=S.generateId("dlg"),this.data=e,this.slot=tt("div",document.body).attr("tab-index","-1").data("dialog-id",this.dialogId).addClass("kdlg-modal","is-active").focus().addChild("div",(function(t){return t.addClass("kdlg-modal-background")})).addChild("div",(function(i){return n.windowElement=i.addClass("kdlg-modal-window").addChild("header",(function(e){n.headerElement=e.addClass("kdlg-header").addChild("p",(function(e){return e.addClass("kdlg-header-title").addText(t.title)})).toDOM(),!1!==t.closable&&e.addChild("button",(function(t){return t.addClass("kdlg-modal-close").on("click",(function(){n.cancelHandler()})).focus()}))})).addChild("div",(function(t){t.addClass("kdlg-alert-container"),n.alertElement=t.toDOM()})).addChild("section",(function(i){if(n.bodyElement=i.addClass("kdlg-body").toDOM(),"string"==typeof t.body){var r=H.renderLiquidTemplate(t.body,e);i.addHtml(r)}else i.addChildElement(t.body)})).addChild("footer",(function(e){var i=null;i=t.footerAlignment&&t.footerAlignment==gt.Center?"align-center":"align-right",n.footerElement=e.addClass("kdlg-footer").toDOM(),e.addClass(i),!1!==t.submitable&&(e.addChild("button",(function(e){e.id(n.dialogId+"-btn-submit").addClass("kfrm-button","is-info").addText(t.submitButtonText||I.getText("ButtonOK")),t.recaptchaSiteKey?(e.data("sitekey",t.recaptchaSiteKey),e.addClass("g-recaptcha"),e.on("click",(function(e){grecaptcha?grecaptcha.ready((function(){grecaptcha.execute(t.recaptchaSiteKey,{action:"submit"}).then((function(t){n.submitHandler(t)}))})):n.submitHandler()}))):e.on("click",(function(t){n.submitHandler()})),e.focus()})),!1!==t.cancelable&&e.addChild("button",(function(e){return e.id(n.dialogId+"-btn-cancel").addClass("kfrm-button").addText(t.cancelButtonText||I.getText("ButtonCancel")).on("click",(function(t){n.cancelHandler()}))})))})).toDOM()})).toDOM()}return t.prototype.getData=function(){return this.data},t.prototype.getRootElement=function(){return this.slot},t.prototype.getSubmitButtonElement=function(){return document.getElementById(this.dialogId+"-btn-submit")},t.prototype.getCancelButtonElement=function(){return document.getElementById(this.dialogId+"-btn-cancel")},t.prototype.open=function(){var t=this;this.options.beforeOpen&&this.options.beforeOpen(this),tt(this.slot).show(),this.options.arrangeParents&&this.arrangeParents(!0);var e=this.slot.querySelector(".kdlg-modal-window");this.options.height&&(e.style.height="string"==typeof this.options.height?this.options.height:this.options.height+"px"),this.options.width&&(e.style.width="string"==typeof this.options.width?this.options.width:this.options.width+"px"),this.options.submitOnEnter&&window.addEventListener("keydown",this.keydownHandler,!1),this.slot.querySelectorAll("input").forEach((function(e){return e.addEventListener("input",(function(){t.clearAlert(),t.options.onInput&&t.options.onInput(t)}))})),this.options.onShow&&this.options.onShow(this)},t.prototype.submit=function(){this.submitHandler()},t.prototype.cancel=function(){this.cancelHandler()},t.prototype.close=function(){this.destroy()},t.prototype.disableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!0}))},t.prototype.enableButtons=function(){this.slot.querySelectorAll("button").forEach((function(t){return t.disabled=!1}))},t.prototype.showAlert=function(t,e,n){var i=tt("div").addClass("kdlg-alert "+(e||"")).addChild("span",(function(t){return t.addClass("kdlg-alert-closebtn").text("×").on("click",(function(t){var e=t.target.parentElement;e.parentElement.removeChild(e)}))})).addText(t).toDOM();!0===n&&this.clearAlert(),this.alertElement.appendChild(i)},t.prototype.clearAlert=function(){this.alertElement.innerHTML=""},t.prototype.destroy=function(){document.querySelectorAll('[data-dialog-id="'+this.dialogId+'"]').length<=0||(this.options.arrangeParents&&this.arrangeParents(!1),document.body.removeChild(this.slot),this.options.submitOnEnter&&window.removeEventListener("keydown",this.keydownHandler,!1),this.options.onDestroy&&this.options.onDestroy(this))},t.prototype.isActiveDialog=function(){var t=document.documentElement.querySelectorAll(".kdlg-modal");return t[t.length-1]===this.slot},t.prototype.arrangeParents=function(t){for(var e=document.documentElement.querySelectorAll(".kdlg-modal-window"),n=0;n<e.length-1;n++)if(t){var i=0==n?20:40*n+20;tt(e[n]).setStyle("margin-top",i+"px").setStyle("margin-left",i+"px")}else tt(e[n]).removeStyle("margin-top").removeStyle("margin-left")},t}(),Pt=function(t){function e(e,n){var i,r,o=this,a=tt("div").addChild("div",(function(t){return i=t.text(e.content||"").toDOM()})).addChild("div",(function(t){t.addClass("kdlg-progress-line").addChild("div",(function(t){r=t.addClass("fill").toDOM(),e.determinated?t.setStyle("width","0%"):t.addClass("indeterminate")}))})).toDOM();return(o=t.call(this,{title:e.title,body:a,beforeOpen:e.beforeOpen,onSubmit:e.onSubmit,width:e.width,height:e.height,submitable:!1,cancelable:!1,closable:!1,onDestroy:e.onDestroy},n)||this).contentElement=i,o.progressElement=r,o}return kt(e,t),e.prototype.updateContent=function(t){this.contentElement.innerText=t},e.prototype.updateProgress=function(t){var e=this;t=this.in01(t),this.progressElement.style.width=100*t+"%",1===t&&setTimeout((function(){e.submit()}),500)},e.prototype.in01=function(t){return t>1?1:t<0?0:t},e}(Ot),Rt=function(){function t(t,e){this.options=t,this.dialogService=e,this.currentDialog=null,this.currentIndex=0,this.options=t,this.dialogService=e}return t.prototype.getCurrent=function(){return this.currentDialog},t.prototype.openNext=function(t){return this.open(this.currentIndex+1,t)},t.prototype.openPrev=function(t){return this.open(this.currentIndex-1,t)},t.prototype.open=function(t,e){if(t<0?this.currentIndex=0:t>=this.options.length?this.currentIndex=this.options.length-1:this.currentIndex=t,this.currentDialog)try{this.currentDialog.close()}catch(t){}var n=this.options[this.currentIndex];return this.currentDialog=this.dialogService.open(n,e),this.currentDialog},t.prototype.close=function(){this.currentDialog&&(this.currentDialog.close(),this.currentDialog=null)},t}();I.updateDefaultTexts({GridPageInfo:"{FirstPageRecordNum} - {LastPageRecordNum} of {Total} records",GridItemsPerPage:"items per page",ButtonOK:"OK",ButtonCancel:"Cancel",ButtonApply:"Apply",ButtonNow:"Now",LblTotal:"Total"});new Mt;function At(t){return!t||""===t.trim()}var _t,Lt="https://korzh.com/api/license",Nt=function(){function t(t){this.http=new L,this.context=t}return t.prototype.show=function(){var t=this,e=new Mt;this.dialogSet=e.createSet([{closable:!1,cancelable:!1,submitOnEnter:!0,title:"No license key for EasyQuery",body:this.buildStartPage(),submitButtonText:"Submit",onInput:this.validateForm.bind(this),onSubmit:this.startPageOnSubmit.bind(this)},{closable:!1,cancelable:!1,submitOnEnter:!0,title:"Please check your inbox",body:this.buildCodePage(),submitButtonText:"Get License Key",onInput:this.validateForm.bind(this),onSubmit:this.codePageOnSubmit.bind(this)},{closable:!1,cancelable:!1,submitable:!1,title:"Success",body:this.buildSuccessPage()},{closable:!1,cancelable:!1,submitable:!1,title:"Failure",body:this.buildFailurePage()}]);var n=this.dialogSet.open(0);setTimeout((function(){t.validateForm(n);var e=document.getElementById("eqAuthEmail");e&&e.focus()}),200)},t.prototype.isValidForm=function(t){var e=t.querySelector("#eqAuthEmail");if(e)return!At(e.value)&&e.value.toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);var n=t.querySelector("#eqAuthCode");return!n||!At(n.value)&&!isNaN(+n.value)&&n.value==n.value.trim()&&6===n.value.length},t.prototype.validateForm=function(t){t.getSubmitButtonElement().disabled=!this.isValidForm(t.getRootElement())},t.prototype.addInputField=function(t,e){t.addChild("label",(function(t){return t.attr("for",e.id).addHtml(e.label+" "+(e.required?'<sup style="color: red">*</sup>':"")+": ")})).addChild("input",(function(t){t.id(e.id),t.name(e.name||e.id),t.type(e.type||"text"),void 0!==e.value&&t.value(e.value),e.onInput&&t.on("input",e.onInput)}))},t.prototype.buildStartPage=function(){var t,e=tt("div");return e.addChild("div",(function(t){return t.html('<div style="font-size:1.2em">The EasyQuery license key is either absent, invalid or was issued for a different version of the library.</div><div style="font-size:1.2em">Please fill out the form to obtain a valid trial license key.</div>')})),e.addClass("kfrm-form").addChild("div",(function(e){t=e,e.addClass("kfrm-fields label-above"),e.addClass("kfrm-break-20")})),this.addInputField(t,{id:"eqAuthEmail",name:"email",label:"Email",required:!0}),this.addInputField(t,{id:"eqAuthName",name:"contactName",label:"Name (optional)",required:!1}),e.addChild("div",(function(t){return t.html('<div style="margin-top:20px;font-size:0.9em">* By clicking Submit, you agree with Korzh.com <a href="https://korzh.com/terms-of-use">Terms of use</a> and <a href="https://korzh.com/privacy">Privacy policy</a>.</div><div style="font-size:0.9em">You also agree to receive email messages from Korzh.com. This consent may be revoked at any time.</div>')})),e.toDOM()},t.prototype.buildCodePage=function(){var t,e=tt("div");return e.addChild("div",(function(t){return t.html('<div style="font-size:1.2em">We sent a confirmation code to <strong>{{email}}</strong>.</div><div style="font-size:1.2em">Please find it in the email and enter to the text box below</div>')})),e.addClass("kfrm-form").addChild("div",(function(e){t=e,e.addClass("kfrm-fields label-above"),e.addClass("kfrm-break-20")})),this.addInputField(t,{id:"eqAuthCode",name:"code",label:"Confirmation code",required:!0}),e.addChild("div",(function(t){return t.html('<div style="margin-top:20px;font-size:0.9em">NB: Don\'t forget to check your SPAM folder if the message does not arrive within the next 5 minutes, and mark it as "Not Spam" if it\'s found there.</div>')})),e.toDOM().outerHTML},t.prototype.buildSuccessPage=function(){var t=tt("div");return t.addChild("div",(function(t){return t.html('<div style="font-size:1.2em">You have successfully completed the registration process.</div><div style="font-size:1.2em">Please restart your web application to get the key applied.</div>')})),t.toDOM()},t.prototype.buildFailurePage=function(){var t=tt("div");return t.addChild("div",(function(t){return t.html("{{message}}")})),t.toDOM().outerHTML},t.prototype.startPageOnSubmit=function(t){var e=this,n=document.getElementById("eqAuthEmail"),r=document.getElementById("eqAuthName"),o=n.value,a=r.value;return t.disableButtons(),this.http.post(i.equtils.combinePath(Lt,"get-code"),{email:o,name:a,data:{ptag:this.context.backendInfo.type,apptype:this.context.backendInfo.subType}},{dataType:"json"}).then((function(t){if(0!==t.status)throw new Error(t.message);var n=e.dialogSet.openNext({email:o});setTimeout((function(){e.validateForm(n);var t=document.getElementById("eqAuthCode");t&&t.focus()}),200)})).catch((function(e){t.showAlert(e.message,"error",!0),t.enableButtons()})),!1},t.prototype.codePageOnSubmit=function(t){var e=this,n=document.getElementById("eqAuthCode").value;return t.disableButtons(),this.http.post(i.equtils.combinePath(Lt,"get-key"),{token:n,ptag:this.context.backendInfo.type,version:"7.2"},{dataType:"json"}).then((function(t){switch(t.status){case 0:var n=i.equtils.combinePath(e.context.getBaseEndpoint(),"lck");e.http.post(n,{version:"7.2",key:t.key},{dataType:"json"}).then((function(t){return e.dialogSet.openNext()}));break;case 2:e.dialogSet.open(3,{message:'<div style="font-size:1.2em">Your trial license for EasyQuery has expired.</div><div style="font-size:1.2em">Please <a href="https://korzh.com/support">contact us</a> if you want to extend the trial period.</div>'});break;case 3:e.dialogSet.open(3,{message:'<div style="font-size:1.2em">Your purchased license for EasyQuery has expired.</div><div style="font-size:1.2em">You need to <a href="https://korzh.com/account">renew the subscription</a> to get a valid license.</div>'});break;default:throw new Error(t.message)}})).catch((function(e){t.showAlert(e.message,"error",!0),t.enableButtons()})),!1},t}();function Ft(){_t&&(_t.style.right="-400px",setTimeout((function(){_t.parentNode.removeChild(_t)}),5e3))}i.EqContext.prototype.setLicenseKeyEndpoint=function(t){console.warn("This method is deprecated and will be ignored.\n The main EasyQuery endpoint (set via useEndpoint() function) is used to get the license since version 7.0.\n So, you can simply remove this function call")},i.EqContext.prototype.useEnterprise=function(t){var e=this,n=function(t,n){if(o.ck(t),o.__kt>1){var i=e.getServices();i.registerDataModelResolver((function(t){return new C})),i.registerQueryResolver((function(t){return new y(t.getModel())})),i.registerQueryStorageResolver((function(t){return new v(t)})),i.registerAggregatesCalculator((function(t){return new w(t)})),2===o.__kt&&(console.warn("EasyQuery.JS is working in the TRIAL MODE!\nPlease order a license (https://korzh.com/eq) to get a proper product key."),function(){(_t=document.createElement("div")).style.position="fixed",_t.style.bottom="0",_t.style.right="-400px",_t.style.width="400px",_t.style.height="100px",_t.style.color="grey",_t.style.textAlign="center",_t.style.opacity="0.7",_t.style.font="bold 1em Trebuchet MS, Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif",_t.style.transition="right 3s ease-out";var t=document.createElement("div"),e=document.createElement("span");e.innerText="EasyQuery",e.style.color="#3A94D4",e.style.lineHeight="50px",t.appendChild(e);var n=document.createElement("span");n.innerText="by Korzh.com",n.style.marginLeft="10px",t.appendChild(n),_t.appendChild(t);var i=document.createElement("div");i.innerText="FOR TRIAL USE ONLY",i.style.fontSize="1.2em",i.style.fontWeight="1000",_t.appendChild(i),document.body.appendChild(_t)}(),setTimeout((function(){_t&&(_t.style.right="0"),setTimeout(Ft,6e3)}),3e3))}else{if(n)!function(t){var e,n,i,r;switch(t.__kt){case 1:e="EasyQuery trial has expired",n='Your trial period for EasyQuery has expired. \n\tYou can send a request to <a href="https://korzh.com/account">extend your trial</a> or <a href="https://korzh.com/easyquery/licensing">buy a license</a> to get rid of all limitations.',i="Buy a license",r="https://korzh.com/easyquery/licensing";break;case-3:e="No license key for EasyQuery",n='Please <a href="https://korzh.com/easyquery#get-started">register for a trial</a> \n\tor <a href="https://korzh.com/easyquery/licensing">purchase a license</a> to get a proper product key. <br />\n\tIf you already have a key, please follow <a href="https://korzh.com/easyquery/docs/getting-started/product-key">this guide</a> to apply it.',i="Register trial",r="https://korzh.com/easyquery#get-started";break;default:e="Invalid key for EasyQuery!",n='The EasyQuery product key is either invalid or was issued for a different version of the library.\n The version you are using now is 7.2,\n\tso please <a href="https://korzh.com/account">login to your account</a> to get a proper key for version 7.2.',i="Get key",r="https://korzh.com/account"}var o=(new Mt).open({closable:!1,cancelable:!1,submitable:!1,title:e,body:n}).getRootElement().querySelector("footer");tt(o).removeClass("align-right").setStyle("justify-content","center").addChild("button",(function(t){return t.addClass("kfrm-button","is-info").addText(i).on("click",(function(t){window.location.href=r}))})),1==t.__kt&&tt(o).addChild("button",(function(t){return t.addClass("kfrm-button").addText("Extend trial").on("click",(function(t){window.location.href="https://korzh.com/account"}))}))}(o);else new Nt(e).show()}};if("string"==typeof t)n(t,!0);else{if("function"!=typeof t)throw new Error("Wrong type of 'keyOrInitCallback' parameter. It must be a string with a license key or a callback function.");var r=this.getServices().getHttpClient(),a=i.equtils.combinePath(this.getBaseEndpoint(),"lck2");r.get(a).then((function(i){n(i.key.split("").reverse().join(""),!1),e.useBackend({type:i.backendType,subType:i.appType}),t()})).catch((function(o){a=i.equtils.combinePath(e.getBaseEndpoint(),"lck"),r.get(a).then((function(e){n(e.split("").reverse().join(""),!1),t()})).catch((function(t){return e.throwError({action:"LCK",sourceError:t})}))}))}};var Bt=function(){return Bt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Bt.apply(this,arguments)},qt=function(){function t(t){this.context=t,this._needRecalculation=!0,this.aggrContainer=new i.EqAggregatesContainer(t)}return t.prototype.getAggrContainer=function(){return this.aggrContainer},t.prototype.calculate=function(t){this._needRecalculation=!1,this.aggrContainer.clear(),(t=t||{}).maxLevel=t.maxLevel>=0?t.maxLevel:0;var e=[],n=this.context.createQuery();n.loadFromData(this.context.getQuery().toJSONData());for(var r=this.context.getQuery().getAggregationSettings(),o=r.getAggregates(),a=r.getAggregates().map((function(t){return t.colId})),s=n.getColumns().filter((function(t){return a.indexOf(t.id)>=0})),l=function(t){n.changeColumnType(t,i.ExprTag.AggregateFunction,{funcId:o.filter((function(e){return e.colId==t.id}))[0].funcId})},u=0,c=s;u<c.length;u++){l(C=c[u])}for(var d=n.getColumns().filter((function(t){return t.expr.tag!==i.ExprTag.AggregateFunction})),h=0,p=d;h<p.length;h++){(C=p[h]).setHidden(!0)}if(r.hasRecordCount()){(C=n.createColumn()).caption=r.COUNT_FIELD_NAME,C._id=r.COUNT_FIELD_NAME;var f=new i.Expression(C);f.tag=i.ExprTag.CustomSql,f.sql="COUNT(*)",f.baseAttrId=null,C.expr=f,n.getColumns().push(C)}r.hasGrandTotals()&&e.push(this.processLevel({query:n,level:0,groupName:"Grand Totals",resultObtainedCallback:t.resultObtained,errorOccurredCallback:t.errorOccurred}));for(var g=r.getGroups(),m=1;m<=g.length;m++){for(var y=g[m-1],v=0,b=d;v<b.length;v++){var C;(C=b[v]).setHidden(y.columns.indexOf(C.id)<0)}e.push(this.processLevel({query:n,level:m,groupName:y.name,resultObtainedCallback:t.resultObtained,errorOccurredCallback:t.errorOccurred}))}return Promise.all(e).then((function(){})).catch((function(t){return console.error(t)}))},t.prototype.processLevel=function(t){var e=this,n=this.context.getServices().getDataFetcher(),i={aux:!0,query:t.query};return this.context.debugMode&&(i.debug="Fetching group data. Group: '"+t.groupName+"', level: "+t.level),n.fetchData(i).then((function(n){for(var i=new V({elasticChunks:!0}),r=n.resultSet,o=0,a=r.cols;o<a.length;o++){var s=a[o];i.columns.add(s)}for(var l=0,u=r.rows;l<u.length;l++){var c=u[l];i.addRow(c)}var d=e.buildLevelData(t.level,i);e.aggrContainer.setAggregateData(t.level,d),t.resultObtainedCallback&&t.resultObtainedCallback(n,t.level)})).catch((function(e){t.errorOccurredCallback&&t.errorOccurredCallback(Bt(Bt({},e),{level:t.level}))}))},t.prototype.buildLevelData=function(t,e){var n=this.context.getQuery().getAggregationSettings(),i=t>0?n.getGroups()[t-1].columns:[],r=n.getAggregates().map((function(t){return t.colId}));n.hasRecordCount()&&r.push(n.COUNT_FIELD_NAME);for(var o=new Map,a=0,s=e.getCachedRows();a<s.length;a++){for(var l=s[a],u={},c={},d=0,h=i;d<h.length;d++){var p=h[d];if(e.columns.getIndex(p)>=0){var f=l.getValue(p);n.caseSensitiveGroups||"string"!=typeof f||(f=f.toLowerCase()),u[p]=f}}for(var g=0,m=r;g<m.length;g++){var y=m[g];c[y]=l.getValue(y)}o.set(JSON.stringify(u),c)}return o},t.prototype.needRecalculation=function(){return this._needRecalculation},t.prototype.reset=function(){this._needRecalculation=!0},t}()}])}));
3
3
  //# sourceMappingURL=easyquery.enterprise.min.js.map