@easyquery/ui 7.1.3-beta02 → 7.2.0-rc01

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.
Files changed (50) hide show
  1. package/dist/browser/eq.community.css.map +1 -1
  2. package/dist/browser/eq.community.js +932 -761
  3. package/dist/browser/eq.community.js.map +1 -1
  4. package/dist/browser/eq.community.min.js +2 -2
  5. package/dist/browser/eq.community.min.js.LICENSE.txt +0 -2
  6. package/dist/browser/eq.community.min.js.map +1 -1
  7. package/dist/browser/eq.core.css +4 -4
  8. package/dist/browser/eq.core.min.css +2 -2
  9. package/dist/browser/eq.view.css +1 -1
  10. package/dist/browser/eq.view.min.css +1 -1
  11. package/dist/bundles/easyquery.ui.js +393 -251
  12. package/dist/bundles/easyquery.ui.js.map +1 -1
  13. package/dist/bundles/easyquery.ui.min.js +1 -1
  14. package/dist/bundles/easyquery.ui.min.js.LICENSE.txt +0 -2
  15. package/dist/bundles/easyquery.ui.min.js.map +1 -1
  16. package/dist/lib/facets/result_facet.d.ts +0 -1
  17. package/dist/lib/facets/result_facet.js +21 -54
  18. package/dist/lib/facets/result_facet.js.map +1 -1
  19. package/dist/lib/utils/popup_menu.d.ts +3 -3
  20. package/dist/lib/widgets/aggregation_bar.d.ts +1 -1
  21. package/dist/lib/widgets/charts/chart_widget.d.ts +1 -1
  22. package/dist/lib/widgets/columns_bar.d.ts +1 -1
  23. package/dist/lib/widgets/columns_panel.d.ts +1 -1
  24. package/dist/lib/widgets/columns_panel.js +4 -3
  25. package/dist/lib/widgets/columns_panel.js.map +1 -1
  26. package/dist/lib/widgets/easy_grid_widget.js +1 -1
  27. package/dist/lib/widgets/easy_grid_widget.js.map +1 -1
  28. package/dist/lib/widgets/entities_panel.d.ts +1 -1
  29. package/dist/lib/widgets/filter_bar.d.ts +1 -1
  30. package/dist/lib/widgets/query_panel.d.ts +1 -1
  31. package/dist/lib/widgets/query_panel.js +4 -3
  32. package/dist/lib/widgets/query_panel.js.map +1 -1
  33. package/dist/lib/widgets/queryname_widget.d.ts +1 -1
  34. package/dist/lib/widgets/renderers/aggr_settings/aggr_settings_renderer.d.ts +1 -1
  35. package/dist/lib/widgets/renderers/aggr_settings/aggr_settings_renderer.js.map +1 -1
  36. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.d.ts +1 -1
  37. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.js +1 -2
  38. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.js.map +1 -1
  39. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.d.ts +1 -1
  40. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.js +10 -3
  41. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.js.map +1 -1
  42. package/dist/lib/widgets/renderers/querypanel/addrow_renderer.d.ts +1 -1
  43. package/dist/lib/widgets/renderers/querypanel/condition_renderer.d.ts +1 -1
  44. package/dist/lib/widgets/renderers/querypanel/expression_renderer.d.ts +1 -1
  45. package/dist/lib/widgets/renderers/querypanel/operator_renderer.d.ts +1 -1
  46. package/dist/lib/widgets/renderers/querypanel/text_renderer.d.ts +1 -1
  47. package/dist/lib/widgets/renderers/sortingbar/column_renderer_sp.d.ts +1 -1
  48. package/dist/lib/widgets/result_facets_panel.d.ts +1 -1
  49. package/dist/lib/widgets/sorting_bar.d.ts +1 -1
  50. package/package.json +6 -8
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see easyquery.ui.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("easyqueryUI",["easyqueryCore"],e):"object"==typeof exports?exports.easyqueryUI=e(require("easyqueryCore")):t.easyqueryUI=e(t.easyqueryCore)}(window,(function(__WEBPACK_EXTERNAL_MODULE__2__){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},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=6)}([function(t,e,n){"use strict";var o,i;n.d(e,"d",(function(){return o})),n.d(e,"a",(function(){return E})),n.d(e,"b",(function(){return f})),n.d(e,"c",(function(){return M})),n.d(e,"e",(function(){return S})),n.d(e,"f",(function(){return I})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return 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"}(o||(o={})),function(t){t[t.Data=0]="Data",t[t.Virtual=1]="Virtual",t[t.Lookup=2]="Lookup"}(i||(i={}));var r,s="Unknown",a="EDIT",l="DATETIME";!function(t){t.Trace="TRACE",t.Options="OPTIONS",t.Get="GET",t.Put="PUT",t.Post="POST",t.Delete="DELETE"}(r||(r={}));var u,c,d=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 o=n[e].split(": "),i=o.shift(),r=o.join(": ");t[i]=r}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 h(t,e){for(var n="",o=0;o<e;o++)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},s=[];function a(t){for(var e=0,n=s;e<n.length;e++){(0,n[e])(t)}}function l(){return e.localeId}function u(t){var n=r[t];n?c.assignDeep(e,n):(e.englishName=t,e.displayName=t,e.texts=c.assignDeep({},i.texts)),e.localeId=t}function d(){return e.settings}function h(t){e.settings||(e.settings=c.assignDeep({},n)),e.settings=c.assignDeep(e.settings,t)}function p(t,n){a(n);var o=e;t&&(n.localeId||(n.localeId=t),(o=r[t])||(o=c.assignDeep({},i),r[t]=o)),c.assignDeep(o,n)}function f(){var t,n,o,i,r,s,a="object"==typeof navigator?navigator.language:void 0;t=a,n=new Date(2020,5,7,19,34,56,88),o=n.toLocaleDateString(t,{year:"numeric",month:"numeric",day:"numeric"}),i=n.toLocaleTimeString(t,{hour:"numeric",minute:"numeric",second:"numeric"}),r=o.replace("07","dd").replace("7","d").replace("06","MM").replace("6","M").replace("2020","yyyy").replace("20","yy"),s=i.replace("19","HH").replace("07","hh").replace("7","h").replace("34","mm").replace("56","ss").replace("PM","tt"),e.settings||(e.settings={}),h({shortDateFormat:r,shortTimeFormat:s})}function g(t){var e,n=d();switch(t){case o.Date:e=n.shortDateFormat;break;case o.Time:e=n.shortTimeFormat;break;default:e=n.shortDateFormat+" "+n.shortTimeFormat}return e}function m(t){var e,n=d();switch(t){case o.Date:e=n.longDateFormat;break;case o.Time:e=n.longTimeFormat;break;default:e=n.longDateFormat+" "+n.longTimeFormat}return e}t.addMapper=function(t){s.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=l,t.setLocale=function(t){console.warn("This method is deprecated. Use setCurrentLocale instead"),u(t)},t.setCurrentLocale=u,t.getText=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=e.texts,i="";if(t&&t.length)for(var r=t.length,s=0;s<r&&"object"==typeof(i=o[t[s]]);s++)o=i;return i},t.getLocaleSettings=d,t.getOneLocaleSetting=function(t){return e.settings[t]},t.getShortMonthName=function(t){var e=d();if(t>0&&t<13)return e.shortMonthNames[t-1];throw"Wrong month number: "+t},t.getLongMonthName=function(t){var e=d();if(t>0&&t<13)return e.longMonthNames[t-1];throw"Wrong month number: "+t},t.getShortWeekDayName=function(t){var e=d();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=d();if(t>0&&t<8)return e.longWeekDayNames.length>=t?e.longWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.updateLocaleSettings=h,t.updateLocaleTexts=function(t){"object"==typeof t?(a({localeId:e.localeId,texts:t}),c.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 o=r[n];o.texts=c.assignDeep({},t,o.texts)}e.texts=c.assignDeep({},t,e.texts)},t.updateLocaleInfo=p,t.addLocale=function(t,e){p(t,e)},t.resetLocales=function(){e||(e=c.assignDeep({},i),f())},t.dateTimeToStr=function(t,e,n){return n?"d"==n?n=g(o.Date):"D"==n?n=m(o.Date):"f"==n?n=g(o.DateTime):"F"==n&&(n=m(o.DateTime)):n=g(e),c.dateTimeToStr(t,n)},t.numberToStr=function(e,n){if(n&&n.length>0){var o=n.charAt(0).toUpperCase();if("S"===o)return function(e,n){if(!y[n]){var o=n.split("|").filter((function(t){return t.length>0})).map((function(t){return t.split("=")}));if(y[n]={},o.length>0)if(o[0].length>1)for(var i=0,r=o;i<r.length;i++){var s=r[i];y[n][Number.parseInt(s[1])]=s[0]}else o.forEach((function(t,e){y[n][e]=t[0]}))}var a=y[n];if(void 0!==a[e]){s=a[e];return t.getText(s)||s}return e.toString()}(e,n.slice(1));if(["D","F","C"].indexOf(o)>=0){var i=l();return e.toLocaleString(i,function(t){var e=d(),n=t[0].toUpperCase(),o=t.length>1?Number.parseInt(t.slice(1)):"D"==n?1:2;switch(n){case"D":return{style:"decimal",useGrouping:!1,minimumIntegerDigits:o};case"C":return{style:"currency",currency:e.currency,minimumFractionDigits:o};default:return{style:"decimal",minimumFractionDigits:o}}}(n))}return function(t,e){for(var n=t.toString(),o="",i=n.length-1,r=e.length-1;r>=0;r--){var s=e.charAt(r);"#"===s||"0"===s?i>=0?(o+=n.charAt(i),i--):"0"===s&&(o+=0):o+=s}return o.split("").reverse().join("")}(Math.trunc(e),n)}var r=d();return c.numberToStr(e,r.decimalSeparator)},t.booleanToStr=function(e,n){if(n&&n.length>0&&"S"===n.charAt(0).toUpperCase()){var o=n.slice(1).split("|");if(o.length>1){var i=o[e?1:0];return t.getText(i)||i}}return""+e};var y={}}(u||(u={})),function(t){t.getAllDataTypes=function(){return Object.values(o)},t.getDateDataTypes=function(){return[o.Time,o.Date,o.DateTime]},t.getStringDataTypes=function(){return[o.String,o.Memo]};var e=[o.Byte,o.Word,o.Int32,o.Int64,o.Float,o.Currency],n=[o.Byte,o.Word,o.Int32,o.Int64];function i(t,e,n){e||(e={});for(var o=0,s=n;o<s.length;o++){var a=s[o];if(a)for(var l in a)if(a.hasOwnProperty(l)){var u=a[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]&&(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,o=t;n<o.length;n++){var i=o[n];e.push(i)}return e}t.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0;o<e.length;o++){var i=e[o];if(i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}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,o=e.length,i=0;i<n&&i<o;i++)e[i]=t[i]},t.createArrayFrom=r,t.findItemById=function(t,e){for(var n=t.length,o=0;o<n;o++)if(t[o].id===e)return t[o];return null},t.findItemIndexById=function(t,e){for(var n=t.length,o=0;o<n;o++)if(t[o].id===e)return o;return-1},t.indexOfArrayItem=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=t.length,o=0;o<n;o++)if(e==t[o])return o;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 o=t.splice(e,1)[0];t.splice(n,0,o)},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,o){void 0===n&&(n=0);for(var i=t.length>>>0,r=n>>0,s=r<0?Math.max(i+r,0):Math.min(r,i),a=void 0===o?i:o>>0,l=a<0?Math.max(i+a,0):Math.min(a,i);s<l;)t[s]=e,s++;return t},t.shiftToFitWindow=function(t,e){var n=document.getElementsByTagName("body")[0],o=window.innerWidth||document.documentElement.clientWidth||n.clientWidth,i=t+e,r=0;return i>o&&t+(r=o-i-10)<0&&(r=10-t),r},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==o.Unknown||e==o.Unknown||t==e||t==o.Date&&e==o.DateTime||t==o.DateTime&&e==o.Date},t.isPropSet=function(t,e){return t[e]||t[e.toLowerCase()]||t[e.toUpperCase()]};var s="0123456789abcdefghijklmnopqrstuvwxyz";function a(t,e){var n=t.length;if(n>e){var o=n/e,i="";i+=t[0];for(var r=o,s=void 0,a=1;a<n;a++)s=t[a],a+1>r&&(i+=s,r+=o);return i}return t}function l(t,e,n){return t.substr(0,e)+n+t.substr(e+n.length)}function c(t,e){return Math.floor(Math.random()*(e-t))+t}function d(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("-"),o=1,i=e;n.length<e&&(o=e/n.length,i=n.length);for(var r="",s=0;s<i;s++)r+=a(n[s],o);return r}(t,4):t;e&&e.length>0&&(e+="-");var n=h("",2),o=s.length-1;return n=l(n,0,s[c(0,o)]),e+(n=l(n,1,s[c(0,o)]))+function(t){var e=36,n=14,o=h("",n),i=t;do{o=l(o,n--,s[i%e]),i=Math.floor(i/=e)}while(i>0);return r=o.trim(),r.split("").reverse().join("");var r}(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,"-"),o=e.replace(/[^a-zA-Z0-9_]/g,"-").split("-"),i=n.split("-"),r=o.indexOf("MM"),s=o.indexOf("dd"),a=o.indexOf("yyyy"),l=o.indexOf("HH"),u=o.indexOf("mm"),c=o.indexOf("ss"),h=new Date;try{var p=a>-1&&a<i.length?d(i[a]):h.getFullYear(),f=r>-1&&r<i.length?d(i[r])-1:h.getMonth()-1;if(f>11)throw"";var g=s>-1&&s<i.length?d(i[s]):h.getDate();if(g>function(t,e){return new Date(e,t+1,0).getDate()}(f,p))throw"";var m=l>-1&&l<i.length?d(i[l]):0;if(m>23)throw"";var y=u>-1&&u<i.length?d(i[u]):0;if(y>59)throw"";var v=c>-1&&c<i.length?d(i[c]):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?d(e[0]):0;if(n>23)throw"";var o=e.length>1?d(e[1]):0;if(o>59)throw"";var i=e.length>1?d(e[1]):0;if(i>59)throw"";return new Date(0,0,0,n,o,i)}catch(e){throw t+" is not a valid time."}};var p=/\[([^\]]+)]|y{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(),o=t.getMonth()+1,i=t.getDate(),r=t.getHours(),s=t.getMinutes(),a=t.getSeconds(),l=r%12||12,c=r>11,d={yyyy:n.toString(),MMMM:u.getLongMonthName(o),MMM:u.getShortMonthName(o),MM:o<10?"0"+o:o.toString(),M:o.toString(),dd:i<10?"0"+i:i.toString(),d:i.toString(),HH:r<10?"0"+r:r.toString(),H:r.toString(),hh:l<10?"0"+l:l.toString(),h:l.toString(),tt:c?"PM":"AM",mm:s<10?"0"+s:s.toString(),ss:a<10?"0"+a:a.toString()};return e.replace(p,(function(t,e){return e||d[t]}))},t.numberToStr=function(t,e){return e=e||u.getLocaleSettings().decimalSeparator,t.toString().replace(".",e)}}(c||(c={}));var p,f,g=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}(),m=(p=function(t,e){return p=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])},p(t,e)},function(t,e){function n(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),y=function(){return y=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},y.apply(this,arguments)},v=function(t){function e(e,n){var o=t.call(this,n)||this;return o.status=e,o}return m(e,t),e}(Error),C=(function(){function t(){this.defaultHeaders={},this.customPayload=void 0}t.prototype.get=function(t,e){return this.send(r.Get,t,null,e)},t.prototype.post=function(t,e,n){return this.send(r.Post,t,e,n)},t.prototype.put=function(t,e,n){return this.send(r.Put,t,e,n)},t.prototype.delete=function(t,e,n){return this.send(r.Delete,t,e,n)},t.prototype.send=function(e,n,o,i){var r=(i=i||{}).dataType||"json",s=i.contentType||"form-data"!==r?"application/json":null;o&&"form-data"!=r&&this.customPayload&&(o.data=c.assignDeep(o.data||{},this.customPayload));var a=new("onload"in new XMLHttpRequest?XMLHttpRequest:window.XDomainRequest),l={method:e,url:n,headers:y({},this.defaultHeaders,i.headers||{}),queryParams:i.queryParams||{},data:o};s&&(l.headers["Content-Type"]=s);var u=new d(a,l);this.beforeEachRequest&&(console.warn("HttpClient: 'beforeEachRequest' is deprecated and will be removed in future updates.\n Use 'onRequest' instead"),this.beforeEachRequest(u)),this.onRequest&&this.onRequest(u);var h=u.data&&"string"!=typeof u.data&&"json"==r?JSON.stringify(u.data):u.data;return u.open(),new g(u,new Promise((function(e,o){i.responseType&&(a.responseType=i.responseType),a.onreadystatechange=function(){if(4==a.readyState){var i=a.getResponseHeader("Content-Type")||"",r=a.status;if(r>=400){("arraybuffer"===a.responseType||"blob"===a.responseType?t.decodeArrayBuffer(a.response):Promise.resolve(a.responseText)).then((function(t){var e=0==i.indexOf("application/json")?JSON.parse(t):t,s=e.message||(404==r?"No such endpoint: "+n:e);o(new v(r,s))}))}else{var s="arraybuffer"===a.responseType||"blob"===a.responseType?a.response:0==i.indexOf("application/json")?JSON.parse(a.responseText):a.responseText;e(s)}}},a.send(h)})))},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]))}))}}(),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 o=t.createEntity(this);o.loadFromData(t,e.ents[n]),this.subEntities.push(o)}if(this.attributes=new Array,e.attrs)for(n=0;n<e.attrs.length;n++){var i=t.createEntityAttr(this);i.loadFromData(t,e.attrs[n]),this.attributes.push(i)}}},t.prototype.scan=function(t,e){var n={stop:!1},o=function(i){if(e&&e(i,n),i.attributes)for(var r=i.attributes.length,s=0;s<r&&!n.stop;s++){var a=i.attributes[s];if(t&&t(a,n),n.stop)return}if(i.subEntities){var l=i.subEntities.length;for(s=0;s<l&&!n.stop;s++)o(i.subEntities[s])}};o(this)},t}()),b=function(){function t(t){this.id="",this.caption="{Unrecognized attribute}",this.dataType=o.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=i.Data}return t.prototype.loadFromData=function(t,e){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,this.isNullable=c.getIfDefined(e.nul,this.isNullable),this.isEditable=c.getIfDefined(e.ied,this.isEditable),this.showOnView=c.getIfDefined(e.ivis||e.sov,this.showOnView),this.showOnCreate=c.getIfDefined(e.soc,this.showOnCreate),this.showOnEdit=c.getIfDefined(e.soe,this.showOnEdit),this.showInLookup=c.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}(),x=function(){function t(){this.id="",this.tag=s,this.resType=o.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,o=this.values;n<o.length;n++){var i=o[n];t.indexOf(i.id)>=0&&(e+=i.text+",")}else for(var r=0,s=this.values;r<s.length;r++){(i=s[r]).id===t&&(e+=i.text+",")}return e&&(e=e.substring(0,e.length-1)),e},t}(),w=(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 C(t)},t.prototype.createEntityAttr=function(t){return new b(t)},t.prototype.createValueEditor=function(){return new x},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=o[i],s=t.displayFormats[i]||new Array;this.displayFormats.set(r,s)}},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 o=n[e];if(o.id===t)return o}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,o;if(t.attributes){var i=t.attributes.length;for(n=0;n<i;n++)if(t.attributes[n].id==e)return t.attributes[n]}if(t.subEntities){var r=t.subEntities.length;for(n=0;n<r;n++)if(o=this.getEntityAttrById(t.subEntities[n],e))return o}return null},t.prototype.listByEntityWithFilter=function(t,e){var n,o=new Array,i=null;if(t.subEntities)for(var r=t.subEntities.length,s=0;s<r;s++){if(i=t.subEntities[s],!e||e(i,null))(n=u.getText("Entities",i.name))||(n=i.caption),(h=c.assign(this.createEntity(),{id:i.name,text:n,items:[],isEntity:!0})).items=this.listByEntityWithFilter(i,e),h.items.length>0&&o.push(h)}var a=null;if(t.attributes)for(var l=t.attributes.length,d=0;d<l;d++)if(a=t.attributes[d],!e||e(t,a)){(n=u.getText("Attributes",a.id))||(n=a.caption);var h=c.assign(this.createEntity(),{id:a.id,text:n,dataType:a.dataType});o.push(h)}return o},t.prototype.listByEntity=function(t,e,n){e=e||{};var o,i=[],r=[],s=null;if(t.subEntities)for(var a=t.subEntities.length,l=0;l<a;l++)if(s=t.subEntities[l],!n||n(s,null)){o=u.getText("Entities",s.name)||s.caption;var d=c.assign(this.createEntity(),{id:s.name,text:o,items:[],isEntity:!0,description:s.description}),h=c.assign({},e);h.includeRootData=!1,d.items=this.listByEntity(s,h,n),d.items.length>0&&i.push(d)}var p=null;if(t.attributes)for(var f=t.attributes.length,g=0;g<f;g++)p=t.attributes[g],n&&!n(t,p)||(o=u.getText("Attributes",p.id)||p.caption,r.push(c.assign(this.createEntityAttr(t),{id:p.id,text:o,dataType:p.dataType,lookupAttr:p.lookupAttr,description:p.description})));var m,y=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(i.sort(y),r.sort(y)),m=e.attrPlacement&&0!=e.attrPlacement?r.concat(i):i.concat(r),2==e.attrPlacement&&m.sort(y),e.includeRootData?((o=u.getText("Entities",t.name))||(o=t.caption),{id:t.name,text:o,items:m}):m},t.prototype.clear=function(){this.rootEntity=this.createEntity(),this.editors=[],this.version=""},t.prototype.addDefaultValueEditors=function(){this.addOrUpdateValueEditor("_DTE",a,o.String).defValue="",this.addOrUpdateValueEditor("_DPDE",l,o.DateTime),this.addOrUpdateValueEditor("_DPTE",l,o.DateTime)},t.prototype.addOrUpdateValueEditor=function(t,e,n){var o=c.findItemById(this.editors,t);return o||((o=this.createValueEditor()).id=t,this.editors.push(o)),o.tag=e,o.resType=n,o},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,o){if(!t)return"";n=n||" ";var i="";if(t.caption&&!o){var r=u.getText("Entities",t.caption);i=r||t.caption}if(t.attributes)for(var s=t.attributes.length,a=0;a<s;a++)if(t.attributes[a].id==e)return i;if(t.subEntities){var l=t.subEntities.length;for(a=0;a<l;a++){var c=t.subEntities[a],d=this.getEntityPathByAttr(c,e,n,!1);if(""!==d)return""!==i&&(d=i+n+d),d}}return""},t.prototype.getAttributeText=function(t,e){var n=u.getText("Attributes",t.id);if(n||(n=t.caption),!e)return n;var o=this.getFullEntityPathByAttr(t.id," ");return(o?e.replace(new RegExp("{attr}","g"),n).replace(new RegExp("{entity}","g"),o):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,o){t(n)&&(o.stop=!0,e=n)}),null),e}}(),function(){return w=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},w.apply(this,arguments)}),E=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"}return 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(w({columns:e,aggregates:null},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),w({},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 o=0,i=this.aggregates;o<i.length;o++){var r=i[o];if(t.indexOf(r.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}();!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(f||(f={}));var T,k=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=c.getIfDefined(t.type,o.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},D=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 k?t:new k(t);var n=this.items.length;return this.items.push(e),this.mapper[e.id]=n,[o.Date,o.DateTime,o.Time].indexOf(e.type)>=0&&this._dateColumnIdx.push(n),n},t.prototype.updateDateColumnIdx=function(){this._dateColumnIdx=this.getItems().filter((function(t){return[o.Date,o.DateTime,o.Time].indexOf(t.type)>=0})).map((function(t,e){return e}))},t.prototype.put=function(t,e){this.items[t]=e,this.updateDateColumnIdx()},t.prototype.move=function(t,e){var n=this.items.indexOf(t);n>=0&&n!=e&&(c.moveArrayItem(this.items,n,e),this.updateDateColumnIdx())},t.prototype.get=function(t){return this.items[t]},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}(),M=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}(),S=function(){function t(t){if(this._chunkSize=1e3,this._elasticChunks=!1,this.chunkMap={},this.total=0,this.loader=null,this.needTotal=!0,t=t||{},this._chunkSize=t.chunkSize||this._chunkSize,this._elasticChunks=t.elasticChunks||this._elasticChunks,this.loader=t.loader,this._columns=new D,t.columns)for(var e=0,n=t.columns;e<n.length;e++){var o=n[e];this._columns.add(o)}if(t.rows)for(var i=0,r=t.rows;i<r.length;i++){var s=r[i],a=this.createRow(s);this.addRow(a)}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.chunkMap={}},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.chunkMap={}},enumerable:!0,configurable:!0}),t.prototype.getRows=function(t){var e=this,n=0,o=this._chunkSize;t&&("page"in t?(n=t.pageSize*(t.page-1),o=t.pageSize):(n=t.offset,o=t.limit));var i=n+o;if(!this.needTotal&&!this.elasticChunks){if(n>=this.total)return Promise.resolve([]);i>this.total&&(i=this.total)}for(var r=Math.trunc(n/this._chunkSize),s=Math.trunc((i-1)/this._chunkSize),a=!0,l=r;l<=s;l++)if(!this.chunkMap[l]){a=!1;break}if(a){var u=[];for(l=r;l<=s;l++)u=u.concat(this.chunkMap[l].rows);var c=this.chunkMap[r].offset;return Promise.resolve(u.slice(n-c,i-c))}if(!this.loader)throw"Loader is not defined. Can't get the rows from "+n+" to "+i;var d=this.needTotal;this.needTotal&&(this.needTotal=!1);var h=this._chunkSize*(s-r+1);return this.elasticChunks&&h++,this.loader.loadChunk({offset:r*this._chunkSize,limit:h,needTotal:d}).then((function(t){var o=t.table.getCachedChunks();d&&(e.total=t.total,i>e.total&&(i=e.total));for(var a=r,l=0,u=o;l<u.length;l++){var c=u[l];e.chunkMap[a]={offset:a*e._chunkSize,rows:c.rows},a++}if(e.elasticChunks){var p=t.table.getCachedCount();if(p>0){c=e.chunkMap[a-1];p===h&&(c.rows.splice(c.rows.length-1,1),0==c.rows.length&&delete e.chunkMap[a-1]),p<h&&(e.total=e.getCachedCount())}}for(var f=[],g=r;g<=s;g++)f=f.concat(e.chunkMap[g].rows);var m=e.chunkMap[r].offset;return f.slice(n-m,i-m)}))},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,this.chunkMap={}},t.prototype.getCachedCount=function(){return this.getCachedRows().length},t.prototype.clear=function(){this.columns.clear(),this.chunkMap={},this.total=0,this.needTotal=!this._elasticChunks},t.prototype.createRow=function(t){var e=this,n=this._columns.getDateColumnIndexes(),o=new Array(this._columns.count),i=t instanceof M?function(e){return t.getValue(e)}:function(e){return t[e]};return t&&this.columns.getItems().forEach((function(t){var r=i(t.id),s=e.columns.getIndex(t.id);o[s]=n.indexOf(s)>=0?e.mapDate(r,t.type):r})),new M(this._columns,o)},t.prototype.mapDate=function(t,e){if(t){var n=new Date(t);return isNaN(n.getTime())&&e==o.Time&&(n=c.strToTime(t)),n}return null},t.prototype.addRow=function(t){var e;if(Array.isArray(t)){var n=this._columns.getDateColumnIndexes();if(n.length>0)for(var o=0,i=n;o<i.length;o++){var r=i[o];t[r]&&(t[r]=this.mapDate(t[r],this._columns.get(r).type))}e=new M(this._columns,t)}else e=this.createRow(t);var s=this.getLastChunk();(!s||s.rows.length>=this._chunkSize)&&(s=this.createChunk()),s.rows.push(e);var a=this.getCachedCount();return a>this.total&&(this.total=a),e},t.prototype.createChunk=function(t){void 0===t&&(t=this.getLastChunkIndex()+1);var e={offset:t*this._chunkSize,rows:[]};return this.chunkMap[t]=e,e},t.prototype.getLastChunkIndex=function(){var t=Object.keys(this.chunkMap);return t.length>0?parseInt(t[t.length-1]):-1},t.prototype.getLastChunk=function(){var t=this.getLastChunkIndex();return t>-1?this.chunkMap[t]:null},t.prototype.getCachedRows=function(){return this.getCachedChunks().reduce((function(t,e){return t.concat(e.rows)}),[])},t.prototype.getCachedChunks=function(){return Object.values(this.chunkMap)},t.prototype.totalIsKnown=function(){return this.elasticChunks?this.getCachedCount()===this.total:!this.needTotal},t}(),B=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}(),I=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),o={id:B.newGuid(),callback:e};return n?n.eventCallbacks.push(o):(n={type:t,eventCallbacks:new Array(o)},this.events.push(n)),o.id},t.prototype.unsubscribe=function(t,e){var n=this.getEventRecByType(t);if(n){var o=-1;for(o=0;o<n.eventCallbacks.length&&n.eventCallbacks[o].id!==e;o++);o>=0&&n.eventCallbacks.splice(o,1)}},t.prototype.fire=function(t,e,n,o){if(void 0===n&&(n=0),void 0===o&&(o=!1),!this.silentMode||o){var i=this.getEventRecByType(t);if(i){var r={type:t,source:this.source,data:e},s=function(){for(var t=0,e=i.eventCallbacks;t<e.length;t++){e[t].callback(r)}};n>0?setTimeout(s,n):s()}}},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 o=n[e];if(o.type==t)return o}return null},t}();!function(t){t.renderLiquidTemplate=function(t,e){var n=t;if(e)for(var o in e){var i=new RegExp("{{"+o+"}}","g");n=n.replace(i,e[o])}return n}}(T||(T={})),u.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)})},function(t,e,n){"use strict";n.d(e,"e",(function(){return q})),n.d(e,"a",(function(){return K})),n.d(e,"c",(function(){return C})),n.d(e,"i",(function(){return E})),n.d(e,"d",(function(){return T})),n.d(e,"j",(function(){return B})),n.d(e,"g",(function(){return i})),n.d(e,"f",(function(){return r})),n.d(e,"o",(function(){return s})),n.d(e,"q",(function(){return a})),n.d(e,"t",(function(){return l})),n.d(e,"p",(function(){return u})),n.d(e,"h",(function(){return c})),n.d(e,"m",(function(){return d})),n.d(e,"l",(function(){return h})),n.d(e,"k",(function(){return p})),n.d(e,"n",(function(){return f})),n.d(e,"r",(function(){return g})),n.d(e,"s",(function(){return m})),n.d(e,"b",(function(){return Z}));var o=n(0);n(5);function i(t,e,n){var o=document.createElement(e),i=n||{};return i.cssClass&&(o.className=i.cssClass),t.appendChild(o),o}function r(t,e){t.className=t.className?t.className+" "+e:e}function s(t){t.style.display="none"}function a(t,e){e||(e=""),t.style.display=e}function l(t,e,n){n||(n={}),n.display||(n.display=""),n.duration||(n.duration=200),s(t),a(e,n.display),n.complete&&n.complete()}function u(t){return"none"!=t.style.display&&0!=t.offsetWidth&&0!=t.offsetHeight}function c(t){var e;return"function"==typeof Event?e=new Event(t):(e=document.createEvent("Event")).initEvent(t,!0,!0),e}function d(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function h(){var t=document.body,e=document.documentElement;return{top:window.pageYOffset||e.scrollTop||t.scrollTop,left:window.pageXOffset||e.scrollLeft||t.scrollLeft}}function p(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 o=document.body,i=document.documentElement,r=h(),s=r.top,a=r.left,l=i.clientTop||o.clientTop||0,u=i.clientLeft||o.clientLeft||0,c=e.top+s-l,d=e.left+a-u;return{top:Math.round(c),left:Math.round(d)}}(t);e={x:n.left,y:n.top}}return e}function f(){return{width:window.innerWidth,height:window.innerHeight}}function g(t,e,n){t.style.removeProperty("display");var o=window.getComputedStyle(t).display;"none"===o&&(o="block"),t.style.display=o;var i=t.offsetHeight;t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=i+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout((function(){t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}function m(t,e,n){t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",window.setTimeout((function(){t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}var y,v=(y=function(t,e){return y=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])},y(t,e)},function(t,e){function n(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),C=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=E(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 o=t.trim().split(" ").concat(e),i=0;i<o.length;i++)this.element.classList.add(o[i]);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 o=t.trim().split(" ").concat(e),i=0;i<o.length;i++)this.element.classList.remove(o[i]);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(" "),o=0;o<n.length;o++)this.element.addEventListener(n[o],e);return this},t.prototype.off=function(t,e){for(var n=t.split(" "),o=0;o<n.length;o++)this.element.removeEventListener(n[o],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}(),b=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"textarea",n)||this}return v(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}(C),x=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"input",n)||this}return v(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]"},o=e.split(""),i=function(e){if("focus"!==e.type||""===t.value){var i=[],r=t.selectionStart;o.forEach((function(e,o){if(n[e]){var r=new RegExp(n[e],"i").test(t.value.charAt(o));i.push(r?t.value.charAt(o):"_")}else i.push(e)})),t.value=i.join(""),t.selectionStart=t.selectionEnd=r}};t.addEventListener("keydown",(function(e){if(8===e.keyCode||46===e.keyCode){e.preventDefault();var i=[],r=t.selectionStart;if(0==r)return;for(var s=r,a=!0,l=o.length-1;l>=0;l--){var u=o[l];if(n[u]){var c=new RegExp(n[u],"i").test(t.value.charAt(l));c&&l!=r-1&&(a=!1),l===r-1&&s--,i.push(c&&l!=r-1?t.value.charAt(l):"_")}else l===s-1&&s--,r-1===l&&r--,i.push(u)}t.value=a?"":i.reverse().join(""),t.selectionStart=t.selectionEnd=s<0?0:s;var d=document.createEvent("Event");d.initEvent("input",!0,!0),t.dispatchEvent(d)}})),t.addEventListener("keypress",(function(e){var i=String.fromCharCode(e.charCode);if(i){e.preventDefault();var r=[],s=t.selectionStart,a=s;o.forEach((function(e,o){if(n[e]){var l=o!=s?t.value.charAt(o):i,u=new RegExp(n[e],"i").test(l);r.push(u?l:"_"),u&&s===o&&a++}else r.push(e),a===o&&a++,s===o&&s++})),t.value=r.join(""),t.selectionStart=t.selectionEnd=a;var l=document.createEvent("Event");l.initEvent("input",!0,!0),t.dispatchEvent(l)}})),t.addEventListener("input",i),t.addEventListener("focus",i)}(this.element,t),this},e}(C),w=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"select",n)||this}return v(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}(C);function E(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 C(t,e):"input"===t||t instanceof HTMLInputElement?new x(t instanceof HTMLInputElement?t:null,e):"textarea"===t||t instanceof HTMLTextAreaElement?new b(t instanceof HTMLTextAreaElement?t:null,e):"select"===t||t instanceof HTMLSelectElement?new w(t instanceof HTMLSelectElement?t:null,e):new C(t,e)}var T,k="undefined"!=typeof TouchEvent;!function(t){t.None="none",t.Allow="allow",t.Forbid="forbid"}(T||(T={}));var D,M=function(t,e,n){this.dropEffect=T.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&&k&&n instanceof TouchEvent&&n.touches[0]&&(this.pageX=n.touches[0].pageX,this.pageY=n.touches[0].pageY)},S=function(t){t&&t instanceof MouseEvent&&(this.x=t.pageX,this.y=t.pageY),t&&k&&t instanceof TouchEvent&&t.touches[0]&&(this.x=t.touches[0].pageX,this.y=t.touches[0].pageY)},B=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=T.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 o=function(t){if(!n.hasAttribute(e.DRAG_DISABLED_ATTR)){t.preventDefault(),t instanceof MouseEvent&&t.stopPropagation();var o=new S(t);(Math.abs(o.x-e.mouseDownPosition.x)>e.delta||Math.abs(o.y-e.mouseDownPosition.y)>e.delta)&&r(t)}},i=function(t){e.mouseMoveDragListener(t)},r=function(r){r.preventDefault(),r.stopPropagation(),n.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),e.finishedSuccessfully=!1,t.beforeDragStart&&t.beforeDragStart(),e.dragImage=E("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=T.None,e.updateCusror(e.dropEffect),e.updateImageClass(e.dropEffect),e.draggableItem={element:n,scope:t.scope,data:t.data},e.updateDragItemPosition(r);var s=new M(e.draggableItem,e.dragImage,r);s.dropEffect=e.dropEffect,t.onDragStart&&t.onDragStart(s),e.dropEffect!==s.dropEffect&&(e.dropEffect=s.dropEffect,e.updateImageClass(e.dropEffect)),document.addEventListener("mousemove",i,!0),document.addEventListener("touchmove",i,!0)},s=function(t){k&&t instanceof TouchEvent&&t.preventDefault(),e.mouseDownPosition=new S(t),n.addEventListener("mousemove",o),n.addEventListener("touchmove",o),document.addEventListener("mouseup",a),document.addEventListener("touchend",a)};n.addEventListener("mousedown",s),n.addEventListener("touchstart",s);var a=function(t){e.mouseDownPosition=null,n.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),document.removeEventListener("mousemove",i,!0),document.removeEventListener("touchmove",i,!0),e.draggableItem&&l(t)},l=function(n){try{if(e.containerDescriptorIndex>=0){var o=e.containerDescriptors[e.containerDescriptorIndex],i={element:o.element,scopes:o.scopes,data:o.data},r=new M(e.draggableItem,e.dragImage,n);try{i.scopes.indexOf(e.draggableItem.scope)>=0&&e.dropEffect===T.Allow&&(e.finishedSuccessfully=!0,o.onDrop&&o.onDrop(i,r))}finally{o.onDragLeave&&o.onDragLeave(i,r)}}}finally{try{var s=new M(e.draggableItem,e.dragImage,n);s.data.finishedSuccessfully=e.finishedSuccessfully,t.onDragEnd&&t.onDragEnd(s)}finally{e.draggableItem=null,e.dragImage&&e.dragImage.parentElement&&e.dragImage.parentElement.removeChild(e.dragImage),e.dragImage=null,e.finishedSuccessfully=!1,document.removeEventListener("mouseup",a),document.removeEventListener("touchend",a)}}}},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];o.i.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 o={element:(n=this.containerDescriptors[this.containerDescriptorIndex]).element,scopes:n.scopes,data:n.data};if(o.scopes.indexOf(this.draggableItem.scope)>=0){var i=new M(this.draggableItem,this.dragImage,t);i.dropEffect=this.dropEffect,n.onDragOver&&n.onDragOver(o,i)}}},t.prototype.updateCusror=function(t){switch(t){case T.Allow:this.setCursorStyle(this.dragImage,"grabbing");break;case T.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 T.Allow:this.dragImage.classList.add(this.classPrefix+"-allow");break;case T.None:this.dragImage.classList.add(this.classPrefix+"-none");break;case T.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 S(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 o=new M(this.draggableItem,this.dragImage,t);o.dropEffect=T.Allow,e.onDragEnter&&e.onDragEnter(n,o),this.dropEffect=o.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}else this.dropEffect!==T.Forbid&&(this.dropEffect=T.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 o=new M(this.draggableItem,this.dragImage,t);o.dropEffect=T.None,e.onDragLeave&&e.onDragLeave(n,o),this.dropEffect=o.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}},t.prototype.detectDragEnterEvent=function(t,e){var n=p(t),o=new S(e);return!(o.y<n.y||o.y>n.y+t.offsetHeight)&&!(o.x<n.x||o.x>n.x+t.offsetWidth)},t.prototype.detectDragLeaveEvent=function(t,e){var n=p(t),o=new S(e);return!(o.y>n.y&&o.y<n.y+t.offsetHeight&&o.x>n.x&&o.x<n.x+t.offsetWidth)},t}()),I=/{0:(.*?)}/g;!function(t){t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.DATETIME=3]="DATETIME",t[t.BOOL=4]="BOOL"}(D||(D={}));var O,P=function(t,e,n,o){var i=t?t.toString().replace(/\n/g,"↵ "):"",r=E("div",n).addClass("keg-cell-value").addHtml(i).title(t||"");e.align==O.NONE&&r.addClass("keg-cell-value-align-left")},A=function(t,e,n,i){var r=(t||"").toString();"number"==typeof t&&(r=e.dataColumn&&e.dataColumn.displayFormat&&I.test(e.dataColumn.displayFormat)?e.dataColumn.displayFormat.replace(I,(function(e,n){return o.g.numberToStr(t,n)})):t.toLocaleString());var s=E("div",n).addClass("keg-cell-value").addHtml(r).title(r);e.align==O.NONE&&s.addClass("keg-cell-value-align-right")},L=function(t,e,n,i){var r="[object Date]"===Object.prototype.toString.call(t),s=(t||"").toString();if(r)if(e.dataColumn&&e.dataColumn.displayFormat&&I.test(e.dataColumn.displayFormat))s=e.dataColumn.displayFormat.replace(I,(function(n,i){return o.g.dateTimeToStr(t,e.type,i)}));else{var a=o.g.getCurrentLocale(),l={hour:"numeric",minute:"numeric",second:"numeric"};switch(e.type){case o.d.Date:s=t.toLocaleDateString(a);break;case o.d.Time:s=t.toLocaleTimeString(a,l);break;case o.d.DateTime:s=t.toLocaleDateString(a)+" "+t.toLocaleTimeString(a,l)}}var u=E("div",n).addClass("keg-cell-value").addHtml(s).title(s);e.align==O.NONE&&u.addClass("keg-cell-value-align-right")},R=function(t,e,n,i){if(e.dataColumn&&e.dataColumn.displayFormat&&I.test(e.dataColumn.displayFormat)){var r=e.dataColumn.displayFormat.replace(I,(function(e,n){return o.g.booleanToStr(t,n)}));return P(r,e,n)}E("div",n).addClass("keg-cell-value").addClass("keg-cell-value-bool").addClass("keg-"+(t?"cell-value-true":"cell-value-false"))},_=function(){function t(t){this.renderers={},this.defaultRenderers={},this.registerRenderer("StringDefault",P),this.setDefaultRenderer(D.STRING,P),this.registerRenderer("NumberDefault",A),this.setDefaultRenderer(D.NUMBER,A),this.registerRenderer("DateTimeDefault",L),this.setDefaultRenderer(D.DATETIME,L),this.registerRenderer("BoolDefault",R),this.setDefaultRenderer(D.BOOL,R)}return t.prototype.getDefaultRenderer=function(t){var e=this.getCellType(t);return this.defaultRenderers[D[e]]},t.prototype.getDefaultRendererByType=function(t){return this.defaultRenderers[D[t]]},t.prototype.setDefaultRenderer=function(t,e){e&&(this.defaultRenderers[D[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 o.d.Autoinc:case o.d.Byte:case o.d.Word:case o.d.Currency:case o.d.Float:case o.d.Int32:case o.d.Int64:return D.NUMBER;case o.d.Date:case o.d.DateTime:case o.d.Time:return D.DATETIME;case o.d.Bool:return D.BOOL;default:return D.STRING}},t}();!function(t){t[t.NONE=1]="NONE",t[t.LEFT=2]="LEFT",t[t.CENTER=3]="CENTER",t[t.RIGHT=4]="RIGHT"}(O||(O={}));var F,j=function(){function t(t,e,n){if(void 0===n&&(n=!1),this._label=null,this._description=null,this.align=O.NONE,this.isVisible=!0,this.isRowNum=!1,this.dataColumn=t,this.grid=e,t){t.style.alignment&&(this.align=function(t){switch(t){case o.b.Left:return O.LEFT;case o.b.Center:return O.CENTER;case o.b.Right:return O.RIGHT;default:return O.NONE}}(t.style.alignment));var i=t.type;switch(this.grid.cellRendererStore.getCellType(i)){case D.NUMBER:this.width=120;break;case D.DATETIME:this.width=200;break;case D.BOOL:this.width=80;break;default:this.width=250}this.cellRenderer=this.grid.cellRendererStore.getDefaultRenderer(t.type),this._description=t.description}else n&&(this.isRowNum=!0,this.width=60,this._label="",this.cellRenderer=this.grid.cellRendererStore.getDefaultRendererByType(D.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}(),Q=function(){function t(t,e){this.items=[],this.grid=e,this.sync(t)}return t.prototype.sync=function(t,e){if(void 0===e&&(e=!0),this.clear(),e){var n=new j(null,this.grid,!0);this.add(n)}if(t)for(var o=0,i=t.getItems();o<i.length;o++){var r=i[o],s=new j(r,this.grid);this.grid.options.onSyncGridColumn&&this.grid.options.onSyncGridColumn(s),this.add(s)}},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&&o.i.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}(),N=function(){return N=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},N.apply(this,arguments)},q=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]},addColumns:!1,viewportRowsCount:null,showActiveRow:!0},this.rowsOnPagePromise=null,this.containerInitialHeight=0,this.firstRender=!0,this.compareValues=this.strictCompare,this.prevRowTotals=null,this.landingIndex=-1,this.landingSlot=E("div").addClass(this.cssPrefix+"-col-landing-slot").addChildElement(E("div").toDOM()).toDOM(),this._activeRowIndex=-1,t&&t.paging&&(t.paging=o.i.assign(this.defaultDataGridOptions.paging,t.paging)),this.options=N({},this.defaultDataGridOptions,t),!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 o.f(this),this.cellRendererStore=new _(t),this.columns=new Q(this.dataTable.columns,this),this.setSlot(this.options.slot),this.init(this.options)}return 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.onAddColumnClick&&this.addEventListener("addColumnClick",t.onAddColumnClick),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})),o.i.assignDeep(this.paginationOptions,t.pagination),this.pagination.pageSize=this.options.paging.pageSize||this.pagination.pageSize,this.options.allowDragDrop&&B.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=T.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.addColumns){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),this.rowsOnPagePromise?this.rowsOnPagePromise.then((function(){return t.updateHeight()})).then((function(){t.firstRender=!1,t.rowsOnPagePromise=null})):setTimeout((function(){t.updateHeight(),t.firstRender=!1}),100)}},t.prototype.updateHeight=function(){var t=this;return new Promise((function(e){if(t.options.viewportRowsCount){var n=t.bodyCellContainerDiv.firstElementChild,o=(n?n.offsetHeight:36)*t.options.viewportRowsCount;return E(t.bodyDiv).setStyle("height",o+"px"),void setTimeout((function(){var n=t.bodyViewportDiv.offsetHeight-t.bodyViewportDiv.clientHeight;o+=n,E(t.bodyDiv).setStyle("height",o+"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=E("div").addClass(this.cssPrefix+"-header").toDOM(),this.headerViewportDiv=E("div",this.headerDiv).addClass(this.cssPrefix+"-header-viewport").toDOM(),this.headerCellContainerDiv=E("div",this.headerViewportDiv).addClass(this.cssPrefix+"-header-cell-container").toDOM(),this.headerRowDiv=E("div",this.headerCellContainerDiv).addClass(this.cssPrefix+"-header-row").toDOM(),this.columns.getItems().forEach((function(e,n){if(e.isVisible){var o=t.renderColumnHeader(e,n);t.headerRowDiv.appendChild(o),e.isRowNum&&E(o).addChildElement(t.renderAddColumnButton())}}));var e=this.getContainerWidth();E(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,o=E("div").addClass(this.cssPrefix+"-header-cell").data("col-idx",""+(e+1)).setStyle("width",t.width+"px");t.dataColumn&&o.data("col-id",""+t.dataColumn.id);var i=o.toDOM();return E("div",i).addClass(this.cssPrefix+"-header-cell-resize"),t.isRowNum||E("div",i).addClass(this.cssPrefix+"-header-cell-label").text(t.label),t.description&&E("div",i).addClass("question-mark").title(t.description),this.options.allowDragDrop&&B.registerDraggableItem({element:i,scope:"gridColumnMove",data:{column:t},renderer:function(e){e.innerHTML="";var o=document.createElement("div");o.innerText=t.label,e.classList.add(n.cssPrefix+"-sortable-helper"),e.appendChild(o)},onDragStart:function(t){t.dropEffect=T.Allow}}),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)},t.prototype.renderBody=function(){var t=this;this.bodyDiv=E("div").addClass(this.cssPrefix+"-body").toDOM(),this.bodyViewportDiv=E("div",this.bodyDiv).addClass(this.cssPrefix+"-body-viewport").attr("tabIndex","0").toDOM(),this.bodyCellContainerDiv=E("div",this.bodyViewportDiv).addClass(this.cssPrefix+"-cell-container").toDOM();var e=this.canShowAggregates();this.compareValues=this.caseInsensitiveCompare,e&&this.options.aggregates.settings.caseSensitiveGroups&&(this.compareValues=this.strictCompare),this.dataTable&&(this.showProgress(),this.rowsOnPagePromise=this.getRowsToRender().then((function(n){if(t.pagination.total=t.dataTable.getTotal(),t.hideProgress(),t.bodyCellContainerDiv.innerHTML="",t.prevRowTotals=null,n.length){var i=e?t.options.aggregates.settings.getGroups():[];n.forEach((function(n,o){e&&t.updateTotalsState(i,n);var r=t.renderRow(n,o);t.bodyCellContainerDiv.appendChild(r)}));var r=t.options.aggregates&&t.options.aggregates.showGrandTotalsOnEachPage;if(e&&(t.isLastPage()||r)){var s=new o.c(t.dataTable.columns,new Array(t.dataTable.columns.count));t.updateTotalsState(i,s,!0)}}var a=t.getContainerWidth();return E(t.bodyCellContainerDiv).setStyle("width",a+"px"),n.length})).catch((function(t){return console.error(t),0}))),this.bodyViewportDiv.addEventListener("scroll",(function(e){E(t.headerViewportDiv).setStyle("margin-left","-"+t.bodyViewportDiv.scrollLeft+"px")})),this.bodyViewportDiv.addEventListener("keydown",this.onVieportKeydown.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,s=1;s<=t.length;s++){for(var a=0,l=t[s-1].columns;a<l.length;a++){var u=l[a];if(this.compareValues(this.prevRowTotals.getValue(u),e.getValue(u))){r=s;break}}if(-1!==r)break}if(-1!==r)for(s=t.length;s>=r;s--){var c=new o.c(this.dataTable.columns,this.prevRowTotals.toArray()),d=this.renderTotalsRow(s,c);this.bodyCellContainerDiv.appendChild(d)}}if(n&&i.hasGrandTotals()&&i.hasAggregates()){d=this.renderTotalsRow(0,e);this.bodyCellContainerDiv.appendChild(d)}this.prevRowTotals=e},t.prototype.applyGroupColumnTemplate=function(t,e,n){var o=t.replace(/{{\s*GroupValue\s*}}/g,e?"<span>"+e+"</span>":"-");return o=o.replace(/{{\s*GroupCount\s*}}/g,n?"<span>"+n+"</span>":"-")},t.prototype.renderTotalsRow=function(t,e){var n=this,o=this.options.aggregates.settings,i=t>0?o.getGroups()[t-1]:{columns:[],aggregates:o.getAggregates()},r=E("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,o){if(t.isVisible){var s="",a=t.isRowNum?-1:n.dataTable.columns.getIndex(t.dataColumn.id);!t.isRowNum&&t.dataColumn&&i.columns.indexOf(t.dataColumn.id)>=0&&(s=e.getValue(a)),a==n.dataTable.columns.count-1&&(s=". . . . . ."),r.appendChild(n.renderCell(t,o,s,r))}}));var s=this.options.aggregates.calculator.getAggrContainer(),a=o.getAggregates().map((function(t){return t.colId})),l=this.buildGroupKey(i,e);return s.getAggregates(t,l).then((function(s){for(var l=0,u=a;l<u.length;l++){var c=u[l];e.setValue(c,s[c])}r.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=i.columns.indexOf(l.dataColumn.id),f=a.indexOf(l.dataColumn.id);h=t>0?p==i.columns.length-1:0==d,(p>=0||f>=0)&&(c=e.getValue(d))}var g="";if(t>0&&!(g=l.dataColumn.groupFooterColumnTemplate)&&o.hasRecordCount()&&h&&(g="{{GroupValue}} ({{GroupCount}})"),g)c=n.renderCell(l,d,c,r).firstChild.innerHTML,c=n.applyGroupColumnTemplate(g,c,s[o.COUNT_FIELD_NAME])}var m=n.renderCell(l,d,c,r);r.appendChild(m)}}))})).catch((function(t){return console.error(t)})),r},t.prototype.buildGroupKey=function(t,e){for(var n=this.options.aggregates.settings,o=n&&!n.caseSensitiveGroups,i={},r=0,s=t.columns;r<s.length;r++){var a=s[r],l=e.getValue(a);o&&"string"==typeof l&&(l=l.toLowerCase()),i[a]=l}return i},t.prototype.onVieportKeydown=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(),o=this.bodyViewportDiv.getBoundingClientRect(),i=n.top-o.top,r=n.bottom-o.top,s=this.bodyViewportDiv.clientHeight,a=window.innerHeight||document.documentElement.clientHeight;if(i>0&&r<=s&&n.top>0&&n.bottom<a)return;i<0?this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+i:r>s&&(this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+r-s),(n=e.getBoundingClientRect()).top<0?document.documentElement.scrollTop=document.documentElement.scrollTop+n.top:n.bottom>a&&(document.documentElement.scrollTop=document.documentElement.scrollTop+n.bottom-a)}},t.prototype.getRowsToRender=function(){return!1===this.options.paging.enabled?Promise.resolve(this.dataTable.getCachedRows()):this.dataTable.getRows({page:this.pagination.page,pageSize:this.pagination.pageSize}).catch((function(t){return console.error(t),[]}))},t.prototype.renderFooter=function(){var t=this;this.footerDiv=E("div").addClass(this.cssPrefix+"-footer").toDOM(),this.rowsOnPagePromise&&this.rowsOnPagePromise.then((function(e){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=E("div").addClass(this.cssPrefix+"-page-info").toDOM(),n=t?(this.pagination.page-1)*this.pagination.pageSize+1:0,i=t?n+t-1:0,r=this.dataTable.getTotal().toString();this.dataTable.elasticChunks&&(this.dataTable.getCachedCount()!==this.dataTable.getTotal()&&(r="?"));return e.innerHTML=o.g.getText("GridPageInfo").replace("{FirstPageRecordNum}","<span>"+n.toString()+"</span>").replace("{LastPageRecordNum}","<span>"+i.toString()+"</span>").replace("{Total}","<span>"+r+"</span>"),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,o=this.getGlobalIndexByLocal(e),i=E("div").addClass(this.cssPrefix+"-row").addClass(this.cssPrefix+"-row-"+(e%2==1?"odd":"even")).data("row-idx",""+o).attr("tabindex","-1").on("click",(function(o){n.activeRowIndex=e,n.fireEvent({type:"rowClick",row:t,rowIndex:e,sourceEvent:o})})).on("dblclick",(function(o){n.fireEvent({type:"rowDbClick",row:t,rowIndex:e,sourceEvent:o})}));0==e&&i.addClass(this.cssPrefix+"-row-first");var r=i.toDOM();return this.options.showActiveRow&&e==this.activeRowIndex&&i.addClass(this.cssPrefix+"-row-active"),this.columns.getItems().forEach((function(e){if(e.isVisible){var i=e.isRowNum?-1:n.dataTable.columns.getIndex(e.dataColumn.id),s=e.isRowNum?o+1:t.getValue(i);r.appendChild(n.renderCell(e,i,s,r))}})),r},t.prototype.renderCell=function(t,e,n,o){var i=E("div").addClass(this.cssPrefix+"-cell").data("col-idx",""+e).attr("tabindex","-1").setStyle("width",t.width+"px");return t.align==O.LEFT?i.addClass(this.cssPrefix+"-cell-align-left"):t.align==O.RIGHT?i.addClass(this.cssPrefix+"-cell-align-right"):t.align==O.CENTER&&i.addClass(this.cssPrefix+"-cell-align-center"),t.cellRenderer&&t.cellRenderer(n,t,i.toDOM(),o),i.toDOM()},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");if(e.className=this.cssPrefix+"-pagination-wrapper",this.options.paging&&this.options.paging.enabled){var n=this.paginationOptions.useBootstrap?"":this.cssPrefix+"-",i=function(e){var n=e.target;if(n.hasAttribute("data-page")){var o=parseInt(n.getAttribute("data-page"));t.setPage(o)}},r=function(e,o,r,s,a){var l=document.createElement("li");if(l.className=n+"page-item",!s){a&&(l.className+=" active");var u=document.createElement("a");return u.setAttribute("href","javascript:void(0)"),u.innerHTML=o||e.toString(),u.setAttribute("data-page",""+e),u.className=n+"page-link",u.addEventListener("click",i),l.appendChild(u),l}var c=document.createElement("span");if(c.setAttribute("aria-hidden","true"),c.className=n+"page-link",r)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=n+"page-link",c.addEventListener("click",i)}return c.innerHTML=o,l.appendChild(c),l};if(this.dataTable.elasticChunks){var s=this.pagination.page||1;(l=document.createElement("ul")).className=n+"pagination";var a=r(s-1,"&laquo;",1==s,!0,!1);l.appendChild(a),a=r(s+1,"&raquo;",this.isLastPage(),!0,!1),l.appendChild(a),e.appendChild(l)}else if(this.pagination.total>this.pagination.pageSize){s=this.pagination.page||1;var l,u=Math.ceil(this.pagination.total/this.pagination.pageSize)||1,c=this.paginationOptions.maxButtonCount||10,d=s-1,h=d-d%c+1,p=h+c-1;p>u&&(p=u),(l=document.createElement("ul")).className=n+"pagination";a=r(h-1,"&laquo;",1==h,!0,!1);l.appendChild(a);for(var f=h;f<=p;f++)a=r(f,f.toString(),!1,!1,f==s),l.appendChild(a);a=r(p+1,"&raquo;",p==u,!0,!1),l.appendChild(a),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||[],C=new Set(v);C.add(this.options.paging.pageSize||20),Array.from(C).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 b=document.createElement("div");b.className=this.cssPrefix+"-page-sizes-label",g.appendChild(b);var x=document.createElement("span");x.innerText=o.g.getText("GridItemsPerPage"),b.appendChild(x),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.renderAddColumnButton=function(){var t=this;return this.options.addColumns?E("div").addClass(this.cssPrefix+"-addrow").title(this.options.addColumnsTitle||"Add column").addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.fireEvent({type:"addColumnClick",sourceEvent:e})}))})).toDOM():E("span").addText("#").toDOM()},t.prototype.showLandingSlot=function(t,e){for(var n=this.headerRowDiv.querySelectorAll("[class*="+this.cssPrefix+"-table-col]"),o=[],i=1;i<n.length;i++){var r=n[i];"none"!==r.style.display&&o.push(r)}if(0===o.length)return this.landingIndex=0,void this.headerRowDiv.appendChild(this.landingSlot);var s=p(this.landingSlot);if(!(t>=s.x&&t<=s.x+this.landingSlot.offsetWidth)){for(var a=this.landingIndex,l=0,u=o;l<u.length;l++){var c=u[l],d=p(c),h=c.offsetWidth;t>d.x&&t<d.x+h&&(a=parseInt(c.getAttribute("data-col-idx"))-1)}a!=this.landingIndex&&(this.landingIndex=a,this.landingIndex<o.length?this.headerRowDiv.insertBefore(this.landingSlot,o[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}(),H=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}(),W=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=p(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}(),G=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),V=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]=o.g.getShortWeekDayName(r+1);for(r=0;r<i.months.length;r++)i.months[r]=o.g.getLongMonthName(r+1);return i}return G(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=E("div",this.slot).addClass(this.cssPrefix+"-header");this.options.showDateTimeInput?e.addChildElement(this.renderManualDateInput()):e.addChild("span",(function(e){return t.headerTextElem=e.toDOM()})),E(this.slot).addChildElement(this.renderCalendarButtons()),this.calendarBody=E("div",this.slot).addClass(this.cssPrefix+"-body").toDOM()},e.prototype.getInputDateFormat=function(){var t=o.g.getLocaleSettings();return this.options.timePickerIsUsed?t.editDateFormat+" "+t.editTimeFormat:t.editDateFormat},e.prototype.renderManualDateInput=function(){var t=this,e=this.getInputDateFormat(),n=E("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=o.i.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=o.i.dateTimeToStr(this.currentDate,t),this.manualInputElem.focus()}}else if(this.headerTextElem){var e=o.g.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 E("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])}))},o=0;o<t.months.length;o++)n(o);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 o=0;o<=e+n;o++){var i=document.createElement("option"),r=this.selectedYear-e+o;i.value=r.toString(),i.innerText=r.toString(),this.selectYearElem.appendChild(i)}},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){E("div",t.calendarBody).addClass(t.cssPrefix+"-weekday").addClass(0==n||6==n?t.cssPrefix+"-weekend":"").text(e)}));for(var o=0;o<e;o++)E("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty");for(var i=new Date,r=1;r<=n;r++){var s=E("div",this.calendarBody).addClass(this.cssPrefix+"-day").attr("data-date",r.toString()).text(r.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)}));r===i.getDate()&&this.selectedYear===i.getFullYear()&&this.selectedMonth===i.getMonth()&&s.addClass(this.cssPrefix+"-day-current"),r===this.currentDate.getDate()&&this.selectedYear===this.currentDate.getFullYear()&&this.selectedMonth===this.currentDate.getMonth()&&s.addClass(this.cssPrefix+"-day-selected");var a=(e+r-1)%7;0!=a&&6!=a||s.addClass(this.cssPrefix+"-weekend")}var l=(e+n)%7,u=0==l?0:7-l;for(o=0;o<u;o++)E("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty")},e.prototype.dateChanged=function(e){t.prototype.dateChanged.call(this,e),this.rerenderMonth()},e}(H),z=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}(),U=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),J=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return U(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;E("div",this.slot).addClass(this.cssPrefix+"-time").addChild("span",(function(e){return t.timeText=e.toDOM()})).toDOM();var e=E("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=o.g.getCurrentLocale(),e=this.currentTime.toLocaleString("en"==t?void 0:t,{hour:"numeric",minute:"numeric"});this.timeText.innerText=e},e}(z),Y=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),K=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Y(e,t),e.prototype.render=function(){var e=this,n=E("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=E("div",this.slot).addClass(this.cssPrefix+"-buttons").addChild("button",(function(e){return t.nowButton=e.addClass(t.cssPrefix+"-button "+t.cssPrefix+"-button-now").text(o.g.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(o.g.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(o.g.getText("ButtonCancel")).on("click",(function(){return t.cancel(),!1})).toDOM()}))},e.prototype.createCalendar=function(t){return this.calendarSlot=E("div",this.slot).addClass(this.cssPrefix+"-cal").toDOM(),new V(this.calendarSlot,t)},e.prototype.createTimePicker=function(t){return this.timePickerSlot=E("div",this.slot).addClass(this.cssPrefix+"-tp").toDOM(),new J(this.timePickerSlot,t)},e.prototype.show=function(e){var n=this;if(this.options.showDateTimeInput){this.options.beforeShow&&this.options.beforeShow();var o=p(e||document.body),i=p(e?e.parentElement||e:document.body);this.slot.style.top=i.y+"px",this.slot.style.left=o.x+"px"}else t.prototype.show.call(this,e),this.slot.focus();setTimeout((function(){document.addEventListener("mousedown",n.globalMouseDownHandler,!0)}),1)},e}(W);!function(t){t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(F||(F={}));var X=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Z=function(){function t(){}return t.prototype.openConfirm=function(t,e,n){var o=this,i={title:t,closable:!1,submitable:!0,cancelable:!0,body:'<div id="kdlg-dialog-confirm">'+e+"</div>"};return n?(i.onSubmit=function(){n(!0)},i.onCancel=function(){n(!1)},void this.open(i)):new Promise((function(t){i.onSubmit=function(){t(!0)},i.onCancel=function(){t(!1)},o.open(i)}))},t.prototype.openPrompt=function(t,e,n,o){var i=this,r={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()}},s=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 o?(r.onSubmit=function(){return s(o)},r.onCancel=function(){o("")},void this.open(r)):new Promise((function(t){r.onSubmit=function(){return s(t)},r.onCancel=function(){t("")},i.open(r)}))},t.prototype.open=function(t,e){var n=this,o=new $(t,e),i=t.onDestroy;return t.onDestroy=function(t){n.untrack(t),i&&i(t)},o.open(),this.track(o),o},t.prototype.createSet=function(t){return new et(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 tt(t),o=t.onDestroy;return t.onDestroy=function(t){e.untrack(t),o&&o(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}(),$=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=o.i.generateId("dlg"),this.data=e,this.slot=E("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=o.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==F.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||o.g.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||o.g.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),E(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 o=E("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(o)},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 o=0==n?20:40*n+20;E(e[n]).setStyle("margin-top",o+"px").setStyle("margin-left",o+"px")}else E(e[n]).removeStyle("margin-top").removeStyle("margin-left")},t}(),tt=function(t){function e(e,n){var o,i,r=this,s=E("div").addChild("div",(function(t){return o=t.text(e.content||"").toDOM()})).addChild("div",(function(t){t.addClass("kdlg-progress-line").addChild("div",(function(t){i=t.addClass("fill").toDOM(),e.determinated?t.setStyle("width","0%"):t.addClass("indeterminate")}))})).toDOM();return(r=t.call(this,{title:e.title,body:s,beforeOpen:e.beforeOpen,onSubmit:e.onSubmit,width:e.width,height:e.height,submitable:!1,cancelable:!1,closable:!1,onDestroy:e.onDestroy},n)||this).contentElement=o,r.progressElement=i,r}return X(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}($),et=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}();o.g.updateDefaultTexts({GridPageInfo:"{FirstPageRecordNum} - {LastPageRecordNum} of {Total} records",GridItemsPerPage:"items per page",ButtonOK:"OK",ButtonCancel:"Cancel",ButtonApply:"Apply",ButtonNow:"Now",LblTotal:"Total"});new Z},function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__2__},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return browserUtils}));var _utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4),browserUtils;(function(browserUtils){var _isFirefox=null,_isIE=null;function IsIE(){return eval("/*@cc_on!@*/false || !!document.documentMode")}function IsFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.IsIE=IsIE,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()?_utils__WEBPACK_IMPORTED_MODULE_0__.a: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.d(e,"c",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return s}));n(1);function o(t){for(var e=0;null!==t;){var n=document.defaultView.getComputedStyle(t,null).getPropertyValue("z-index");if("auto"!=n){var o=parseInt(n);o>e&&(e=o)}t=t.parentElement}return e}function i(t){setTimeout((function(e){t&&t.focus()}),100)}var r="eqjs",s="eqjs-mobile"},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,"EntitiesPanel",(function(){return d})),n.d(e,"ColumnsPanel",(function(){return T})),n.d(e,"ColumnsBar",(function(){return O})),n.d(e,"SortingBar",(function(){return L})),n.d(e,"QueryPanel",(function(){return yt})),n.d(e,"FilterBar",(function(){return Ct})),n.d(e,"HtmlContentWidget",(function(){return xt})),n.d(e,"EqHtmlGrid",(function(){return Et})),n.d(e,"Grid",(function(){return kt})),n.d(e,"EasyGridWidget",(function(){return St})),n.d(e,"StatementPanel",(function(){return It})),n.d(e,"ProcessWidget",(function(){return Pt})),n.d(e,"ManageDrillDownWidget",(function(){return Lt})),n.d(e,"ResultFacetsPanel",(function(){return oe})),n.d(e,"ExportWidget",(function(){return re})),n.d(e,"AggregationBar",(function(){return ue})),n.d(e,"ChartType",(function(){return Rt})),n.d(e,"ChartWidget",(function(){return Ht})),n.d(e,"GoogleChartWidget",(function(){return zt})),n.d(e,"ChartJsWidget",(function(){return Gt})),n.d(e,"BaseElementRenderer",(function(){return U})),n.d(e,"DropDownRenderer",(function(){return rt})),n.d(e,"AggrSettingsRenderer",(function(){return se})),n.d(e,"AggrFuncColumnRendererCB",(function(){return B})),n.d(e,"SimpleColumnRendererCB",(function(){return M})),n.d(e,"ColumnRendererCB",(function(){return k})),n.d(e,"AggrFuncColumnRendererCP",(function(){return b})),n.d(e,"SimpleColumnRendererCP",(function(){return v})),n.d(e,"ColumnAction",(function(){return i})),n.d(e,"ColumnRendererCP",(function(){return m})),n.d(e,"CustomSqlColumnRendererCP",(function(){return w})),n.d(e,"InputExpressionRenderer",(function(){return X})),n.d(e,"DateTimeExpressionRenderer",(function(){return dt})),n.d(e,"ConditionAction",(function(){return R})),n.d(e,"ConditionRenderer",(function(){return j})),n.d(e,"SimpleConditionRenderer",(function(){return Q})),n.d(e,"ConditionGroupRenderer",(function(){return V})),n.d(e,"ConditionGroupRowRenderer",(function(){return z})),n.d(e,"AttributeExpressionRenderer",(function(){return ot})),n.d(e,"ExpressionRenderer",(function(){return Y})),n.d(e,"OperatorRenderer",(function(){return ut})),n.d(e,"SubQueryExpressionRenderer",(function(){return pt})),n.d(e,"ListExpressionRenderer",(function(){return $})),n.d(e,"CustomListExpressionRenderer",(function(){return tt})),n.d(e,"SqlListExpressionRenderer",(function(){return et})),n.d(e,"TextRenderer",(function(){return _})),n.d(e,"AddRowRenderer",(function(){return at})),n.d(e,"ResultFacet",(function(){return Qt})),n.d(e,"DataTableFacet",(function(){return $t})),n.d(e,"ChartFacet",(function(){return Jt})),n.d(e,"PivotTableFacet",(function(){return Xt})),n.d(e,"View",(function(){return fe})),n.d(e,"AdvancedSearchView",(function(){return me})),n.d(e,"DataFilterView",(function(){return ve})),n.d(e,"HtmlDataFilterView",(function(){return be})),n.d(e,"ReportView",(function(){return we})),n.d(e,"DomDropDownElementBuilder",(function(){return q})),n.d(e,"dropdown",(function(){return H})),n.d(e,"PopupMenu",(function(){return p})),n.d(e,"QPEditablePart",(function(){return g})),n.d(e,"FacetType",(function(){return W})),n.d(e,"ExportDialog",(function(){return _t})),n.d(e,"AggrSettingsDialog",(function(){return ae}));var o,i,r=n(0),s=n(2),a=n(1),l=n(4),u=n(3),c=(o=function(t,e){return o=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])},o(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),d=function(t){function e(e){var n=t.call(this,e)||this;return n.queryChangedCallbackId=null,n.group=s.WidgetGroup.Model|s.WidgetGroup.Query,n.panel=e,n}return c(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-ep"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"entitiesPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock()},e.prototype.refreshCore=function(){this.render(),this.options.syncWithColumns&&this.refreshCheckedStateByColumns()},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.panel.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.panel.removeChild(this.progressBlock)},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.setOptions=function(t){var e=this;(this.options={showToolbar:!0,syncWithColumns:!1,showSelectAllButton:!1,showClearSelectionButton:!0,showAddColumnButton:!0,showAddConditionButton:!0,showCheckboxes:!0,showTooltips:!0,draggableAttributes:!0,showAttributes:{useInConditions:!0,useInResult:!0,useInSorting:!1},showFilterBox:!1,filterBoxMode:0,showIndicatorOnLoad:!0,attrPlacement:0,sortEntities:!1,autoClearSelection:!0,entityRenderedCallback:null,attributeRenderedCallback:null,columnTitleFormat:"{attr}"},t&&r.i.assignDeep(this.options,t),this.queryChangedCallbackId)&&(n=this.context.getQuery()).removeChangedCallback(this.queryChangedCallbackId);if(this.options.syncWithColumns){var n=this.context.getQuery();this.queryChangedCallbackId=n.addChangedCallback((function(t){var n=t.data;!n||n.part!=s.QueryChangePart.Columns&&n.part!=s.QueryChangePart.All||e.refreshCheckedStateByColumns()}))}},e.prototype.render=function(){var t=this.context.getModel();if(this.clear(),this.panel.classList.add(this.cssPrefix+"-panel"),this.panel.classList.add(u.a.getMobileCssClass()),this.rootEntityBlock=document.createElement("div"),null!=t&&!t.isEmpty()){var e=t.getEntitiesTree({addUIC:this.options.showAttributes.useInConditions,addUIR:this.options.showAttributes.useInResult,addUIS:this.options.showAttributes.useInSorting,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities,includeRootData:!0});this.entityTreeBlock=this.renderEntity(e,this.rootEntityBlock,0),this.panel.appendChild(this.entityTreeBlock)}this.options.showFilterBox?this.createFilterBox():this.rootEntityBlock.style.top="0",this.options.showToolbar&&!this.options.syncWithColumns?this.createToolPanel():this.rootEntityBlock.style.bottom="0"},e.prototype.renderEntity=function(t,e,n){var o,i=this,l=document.createElement("div");l.classList.add(this.cssPrefix+"-entity-node"),l.classList.add(u.a.getMobileCssClass());var c=document.createElement("div");c.classList.add(this.cssPrefix+"-entity-children"),c.classList.add(u.a.getMobileCssClass());var d=document.createElement("label");d.classList.add(this.cssPrefix+"-entity-node-label");var h=document.createElement("input");h.type="checkbox",h.title=t.text;var p,f,g,m=document.createElement("a");m.href="javascript:void(0)",m.title=r.g.getText("EntityToggle")+" "+t.text,m.classList.add(this.cssPrefix+"-entity-node-button");var y=n;if(e?(o=e).innerHTML="":o=document.createElement("div"),o.classList.add(this.cssPrefix+"-entity"),o.classList.add(u.a.getMobileCssClass()),t.id&&""!=t.id){d.innerText=t.text,l.appendChild(d),this.options.showCheckboxes&&d.insertBefore(h,d.firstChild),l.insertBefore(m,l.firstChild),this.options.showTooltips&&t.description&&d.setAttribute("title",t.description);for(var v=0;v<y;v++){var C=document.createElement("div");C.classList.add(this.cssPrefix+"-entity-offset"),l.insertBefore(C,l.firstChild)}o.appendChild(l),c.hidden=!0,y++}var b=t.items?t.items.length:0,x=function(e){var n=t.items[e];if(n.isEntity)c.appendChild(w.renderEntity(n,null,y));else if(!n.lookupAttr||!function(t,e){return e.querySelectorAll("."+i.cssPrefix+'-entity-attr[data-id="'+t+'"]').length>0}(n.lookupAttr,c)){(f=document.createElement("label")).innerText=n.text,f.classList.add(w.cssPrefix+"-entity-attr-label"),w.options.showCheckboxes&&((g=document.createElement("input")).type="checkbox",g.title=n.text,f.insertBefore(g,f.firstChild),w.options.syncWithColumns&&g.addEventListener("change",(function(t){var e=i.context.getModel(),n=i.context.getQuery(),o=t.currentTarget,r=o.parentElement.parentElement.getAttribute("data-id");if(e.checkAttrProperty(r,"useInResult"))if(o.checked){var a=e.getAttributeById(r),l=e.getAttributeText(a,i.options.columnTitleFormat),u=n.addColumn({attribute:a,caption:l});n.fireColumnsChangedEvent(s.QueryChangeAction.Add,u)}else{var c=n.getColumns().filter((function(t){return t.expr.tag===s.ExprTag.EntityAttribute&&t.expr.value===r}));c.length>0&&(n.removeColumn(c[0],null),n.fireColumnsChangedEvent(s.QueryChangeAction.Delete,c[0]))}}))),w.options.showTooltips&&n.description&&f.setAttribute("title",n.description);for(var o=0;o<y+1;o++){var r=document.createElement("div");r.classList.add(w.cssPrefix+"-entity-offset"),f.insertBefore(r,f.firstChild)}(p=document.createElement("div")).classList.add(w.cssPrefix+"-entity-attr"),0==l.innerHTML.length&&p.classList.add(w.cssPrefix+"-entity-attr-root"),p.innerHTML="",p.appendChild(f),p.setAttribute("data-id",n.id),w.options.draggableAttributes&&a.j.registerDraggableItem({element:p,scope:"entityAttr",data:{attrId:n.id},renderer:function(t){t.innerHTML="";var e=document.createElement("span");e.innerText=n.text,t.appendChild(e)}}),w.options.attributeRenderedCallback&&w.options.attributeRenderedCallback(p),c.appendChild(p)}},w=this;for(v=0;v<b;v++)x(v);if(c.innerHTML.length&&(o.appendChild(c),m.addEventListener("click",(function(t){c.hidden=!c.hidden;var e=t.target,n=i.cssPrefix+"-entity-node-button-open";e.classList.contains(n)?e.classList.remove(n):e.classList.add(n),t.preventDefault()}))),c){var E=c.querySelectorAll("."+this.cssPrefix+"-entity-attr > label > input");for(v=0;v<E.length;v++){E[v].addEventListener("click",(function(t){t.target.checked&&!h.checked?h.checked=!0:0===c.querySelectorAll("input:checked").length&&(h.checked=!1),t.stopPropagation()}))}}return h.addEventListener("click",(function(t){for(var e=t.target,n=c.querySelectorAll("label input"),o=0;o<n.length;o++){n[o].checked=e.checked}if(i.options.syncWithColumns){for(var r=i.context.getQuery(),a=i.context.getModel(),l=[],u=0,d=Array.from(c.querySelectorAll("."+i.cssPrefix+"-entity-attr"));u<d.length;u++){var h=d[u].getAttribute("data-id");a.checkAttrProperty(h,"useInResult")&&l.push(h)}if(e.checked)for(var p=0,f=l;p<f.length;p++){h=f[p];r.addColumn({attributeId:h})}else{var g=r.getColumns().filter((function(t){return t.expr.tag===s.ExprTag.EntityAttribute&&l.indexOf(t.expr.value)>=0}));r.removeColumns(g,null)}r.fireColumnsChangedEvent()}t.stopPropagation()})),e!=this.rootEntityBlock&&this.options.entityRenderedCallback&&this.options.entityRenderedCallback(o),o},e.prototype.createFilterBox=function(){var t=this;this.filterBoxBlock=document.createElement("div"),this.filterBoxBlock.classList.add(this.cssPrefix+"-filter-box"),this.filterBoxBlock.classList.add(u.a.getMobileCssClass()),this.filterBoxInput=document.createElement("input"),this.filterBoxInput.classList.add(this.cssPrefix+"-filter-box-input"),this.filterBoxInput.addEventListener("input",(function(e){for(var n=t.panel.querySelectorAll("."+t.cssPrefix+"-entity-attr"),o=0;o<n.length;o++){var i=n[o];i.hidden=!t.checkFilterAttribute(i)}var r=t.panel.querySelectorAll(":scope > ."+t.cssPrefix+"-entity");for(o=0;o<r.length;o++){for(var s=r[o],a=s.querySelectorAll("."+t.cssPrefix+"-entity-attr"),l=0,u=0;u<a.length;u++)"None"!==a[u].style.display&&l++;s.hidden=0===l}""===t.filterBoxInput.value?t.collapseAll():t.expandAll()})),this.filterBoxBlock.appendChild(this.filterBoxInput),this.panel.insertBefore(this.filterBoxBlock,this.panel.firstChild)},e.prototype.createToolPanel=function(){var t=this,e=this.cssPrefix+"-tool-panel",n=document.createElement("div");n.classList.add(e),n.classList.add(u.a.getMobileCssClass());var o=document.createElement("div");o.classList.add(e+"-select-all"),o.title="Select all";var i=document.createElement("div");i.classList.add(e+"-deselect-all"),i.title="Clear selection";var s=document.createElement("div");s.classList.add(e+"-add-columns"),s.title="Add column";var a=document.createElement("div");a.classList.add(e+"-add-cond"),a.title="Add condition";var l=document.createElement("div");l.classList.add(e+"-left-side");var c=document.createElement("div");c.classList.add(e+"-right-side");var d=this.context.getModel();this.options.showSelectAllButton&&(o.title=r.g.getText("ButtonSelectAll"),l.appendChild(o),o.addEventListener("click",(function(){t.selectAll()}))),this.options.showClearSelectionButton&&(i.title=r.g.getText("ButtonDeselectAll"),l.appendChild(i),i.addEventListener("click",(function(){t.deselectAll()}))),this.options.showAddColumnButton&&(s.title=r.g.getText("ButtonAddColumns"),c.appendChild(s),s.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll("."+t.cssPrefix+"-entity-attr"),o=[],i=t.context.getQuery();i.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),d.checkAttrProperty(e,"useInResult")&&o.push(e))}for(var a=0,l=o;a<l.length;a++){var u=l[a],c=d.getAttributeById(u),h=d.getAttributeText(c,t.options.columnTitleFormat);i.addColumn({attribute:c,caption:h})}i.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),i.fireProcessEvent({source:self,status:"finish"})}))),this.options.showAddConditionButton&&(a.title=r.g.getText("ButtonAddConditions"),c.appendChild(a),a.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll("."+t.cssPrefix+"-entity-attr"),o=[],i=t.context.getQuery();i.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),d.checkAttrProperty(e,"useInConditions")&&o.push(e))}for(var a=0,l=o;a<l.length;a++){var u=l[a];i.addSimpleCondition({attributeId:u})}i.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),i.fireProcessEvent({source:self,status:"finish"})}))),n.appendChild(l),n.appendChild(c),this.panel.appendChild(n)},e.prototype.checkFilterAttribute=function(t){if(t.querySelector("label input").checked)return!0;var e=t.querySelector("label").textContent;if(this.checkFilterText(e))return!0;var n=t.parentElement.parentElement.querySelector("."+this.cssPrefix+"-entity-node").querySelector("label").textContent;return!!this.checkFilterText(n)},e.prototype.checkFilterText=function(t){var e=this.filterBoxInput.value;return""==e||(0==this.options.filterBoxMode&&t.toLowerCase().indexOf(e.toLowerCase())>=0||1==this.options.filterBoxMode&&0==t.toLowerCase().indexOf(e.toLowerCase()))},e.prototype.refreshCheckedStateByColumns=function(){this.deselectAll();for(var t=0,e=this.context.getQuery().getColumns().filter((function(t){return t.expr.tag===s.ExprTag.EntityAttribute}));t<e.length;t++){var n=e[t],o=this.rootEntityBlock.querySelector("."+this.cssPrefix+'-entity-attr[data-id="'+n.expr.value+'"]'),i=o.querySelector("label > input");i.checked=!0;for(var r=o.parentElement;r&&r.classList.contains(this.cssPrefix+"-entity-children");){r.hidden=!1;var a=r.parentElement;if(!a||r===a.firstElementChild)break;(i=a.firstElementChild.querySelector("label > input")).checked=!0,r=a.parentElement}}},e.prototype.expandAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll("."+this.cssPrefix+"-entity-children"),n=0;n<e.length;n++){e[n].hidden=!1}var o=this.rootEntityBlock.querySelectorAll("."+this.cssPrefix+"-entity-node-button");for(t=0;t<o.length;t++){o[t].classList.add(this.cssPrefix+"-entity-node-button-open")}},e.prototype.collapseAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll("."+this.cssPrefix+"-entity-children"),n=0;n<e.length;n++){e[n].hidden=!0}var o=this.rootEntityBlock.querySelectorAll("."+this.cssPrefix+"-entity-node-button");for(t=0;t<o.length;t++){o[t].classList.remove(this.cssPrefix+"-entity-node-button-open")}},e.prototype.selectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!0}},e.prototype.deselectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!1}},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add(l.b+"-progress-win8"),this.progressBlock.classList.add(u.a.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e.prototype.clear=function(){this.panel.innerHTML=""},e}(s.Widget),h=function(){function t(t){this.isFilteringMode=!1,this.showSelected=!1,this.parentMenu=t.menu||null,this.parentLevel=t.parent||null,this.parentElement=t.container||document.body,this.levelIndex=t.levelIndex||0,this.levelDiv=null,this.domWriteItemsId=t.domWriteItemsId||!1,this.menuId=t.menuId||"",this.itemRenderedCallback=t.itemRenderedCallback||null,this._applyItem={id:null,text:null,itemDiv:null},this.items=t.items||[],this.activeItem=null,this.selectedItem=null,this.initialized=!1,this.showSelected=t.showSelected,this.updated=0,this.renderContent()}return Object.defineProperty(t.prototype,"applyItem",{get:function(){return this._applyItem},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!0,configurable:!0}),t.prototype.getItems=function(){return this.items},t.prototype.setItems=function(t){this.items=t},t.prototype.renderContent=function(){var t=this;if(this.items){var e=this.parentMenu.style.colors.bgON||"white",n=this.parentMenu.style.colors.fgON||"black",o=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontFamily||""),i=this.parentMenu.style.itemStyle.fontSize||"14px",s=this.parentMenu.options.multiselect,l=this.parentMenu.options.isSubQuery,c=Object(a.i)("div").addClass(u.a.getMobileCssClass());this.parentMenu.options.useDefaultStyles&&c.setStyle("backgroundColor",e).setStyle("border","1px solid").setStyle("borderColor",e).setStyle("backgroundColor",this.parentMenu.style.colors.border).setStyle("margin","-2px 2px 2px -2px").setStyle("width","auto").setStyle("height","auto"),c.setStyle("z-index",this.parentMenu.zIndex).setStyle("position","absolute").setStyle("display","none");var d=c.toDOM();d.menuLevel=this;var h=this._applyItem;if(s&&0===this.levelIndex&&!0!==this.parentMenu.options.hideButtons){var p=document.createElement("div");p.classList.add(this.cssPrefix+"-applyDiv"),p.menuItem=h,this.applyBtn=document.createElement("button"),this.parentMenu.options.useDefaultStyles&&(p.style.borderBottom="1px solid",p.style.padding="5px",p.style.marginBottom="5px",this.applyBtn.style.padding="0 5px",this.applyBtn.style.cursor="pointer");var f=document.createTextNode(this.parentMenu.options.buttons.submit);this.applyBtn.appendChild(f),p.appendChild(this.applyBtn);var g=document.createElement("button");g.classList.add(this.cssPrefix+"-cancel"),this.parentMenu.options.useDefaultStyles&&(g.style.padding="0 5px",g.style.cursor="pointer",g.style.marginLeft="15px");var m=document.createTextNode(this.parentMenu.options.buttons.cancel);g.appendChild(m),p.appendChild(g),d.appendChild(p),h.itemDiv=p,this.applyBtn.addEventListener("click",(function(){t.submit(t._applyItem)})),g.addEventListener("click",(function(){t.parentMenu.hideMenu()}))}if(null==this.parentLevel&&(this.parentMenu.options.searchBoxAlwaysShown||this.items.length>=this.parentMenu.options.showSearchBoxAfter)){var y=Object(a.i)("div").addClass(this.cssPrefix+"-searchDiv");this.parentMenu.options.useDefaultStyles&&(y.setStyle("border-bottom","1px solid #666").setStyle("background-color",e).setStyle("border-color",this.parentMenu.style.colors.border),""!=o&&y.setStyle("font-family",o),y.setStyle("font-size",i).setStyle("color",n).setStyle("cursor","pointer").setStyle("text-align","left").setStyle("padding","5px"));var v=Object(a.i)("input").id("searchBox").name("searchBox").type("text").size(16).addClass(this.cssPrefix+"-searchBox").on("input",(function(e){t.deactivateItem(t.activeItem),t.renderItems(t.searchBox.value)})).on("keydown",(function(e){switch(e.keyCode){case 13:t.activeItem&&t.activeItem.itemDiv.click();break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;case 39:t.searchBox.value||t.openSubLevel(t.activeItem)}}));this.parentMenu.options.useDefaultStyles&&v.setStyle("font-family","monospace").setStyle("font-size","8pt").setStyle("width","100%"),l&&v.addClass("eqjs-dialog"),this.searchBox=v.toDOM(),this.searchDiv=y.toDOM(),this.searchDiv.appendChild(this.searchBox),d.appendChild(this.searchDiv)}var C=document.createElement("div");C.tabIndex=1,Object(a.i)(C).addClass(this.cssPrefix+"-scrollDiv").addClass(u.a.getMobileCssClass()),C.style.overflowX="hidden",C.style.overflowY="auto",C.style.position="relative",d.appendChild(C),this.levelDiv=d,this.scrollDiv=C,this.menuId&&(this.levelDiv.id=this.menuId),this.parentLevel&&(this.levelDiv.style.zIndex=this.parentLevel.levelDiv.style.zIndex),this.renderItems();C.addEventListener("keydown",(function(e){switch(e.which){case 13:t.parentMenu.options.multiselect?t.parentMenu.getRootLevel().applyBtn.click():t.activeItem&&t.activeItem.itemDiv.click();break;case 32:t.activeItem&&t.activeItem.itemDiv.click();break;case 37:t.parentLevel&&!t.isFilteringMode&&(t.deactivateItem(t.activeItem),t.parentLevel.focus());break;case 39:t.openSubLevel(t.activeItem);break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;default:return}e.preventDefault()})),u.a.isMobileMode()&&(this.closeDiv=Object(a.i)("div",d).addClass("eqjs-menu-close-btn").addText(r.g.getText("ButtonClose")).on("click",(function(){t.parentMenu.hideMenu()})).toDOM())}},t.prototype.moveActiveItemDown=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e<t.length-1&&this.activateItem(t[e+1],!1)}else this.activateItem(t[0],!1)},t.prototype.moveActiveItemUp=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e>0&&this.activateItem(t[e-1],!1)}else this.activateItem(t[t.length-1],!1)},t.prototype.openSubLevel=function(t){t&&t.items&&!this.isFilteringMode&&(this.showSubLevel(t),t.subLevel.activateItem(t.subLevel.items[0]))},t.prototype.focusScrollDiv=function(){this.scrollDiv.focus()},t.prototype.turnCheckboxes=function(t){for(var e=0;e<t.length;e++){var n=t[e];n.itemCheckbox&&(n.itemCheckbox.checked=this.isItemSelected(n)),n.items&&this.turnCheckboxes(n.items)}},t.prototype.isItemSelected=function(t){if(t.items){for(var e=0;e<t.items.length;e++)if(this.isItemSelected(t.items[e]))return!0;return!1}return t.selected},t.prototype.setItemSelected=function(t,e){if(t.items)for(var n=0;n<t.items.length;n++)this.setItemSelected(t.items[n],e);else t.selected=e},t.prototype.submitItems=function(t,e){for(var n=0;n<t.length;n++)t[n].items?this.submitItems(t[n].items,e):t[n].selected&&e.push(t[n])},t.prototype.allSubitemsAreFiltered=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!1;return!0},t.prototype.isItemDiv=function(t){return!!t.menuItem},t.prototype.isLevelDiv=function(t){return!!t.menuLevel},t.prototype.getMenuItem=function(t){for(var e=t;!this.isItemDiv(e);){if(this.isLevelDiv(e))throw"Can't get menu item";e=e.parentElement}return e.menuItem},t.prototype.renderItemsWithoutFilter=function(){var t=this;this.isFilteringMode=!1;var e=this.scrollDiv,n=this.parentMenu.options.multiselect,o=this.parentMenu.options.activateOnMouseOver,i=this.parentMenu.style.colors.fgON||"black",r=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),s=this.parentMenu.getItemFilterCallback();e.innerHTML="";for(var l=0;l<this.items.length;l++){var c=this.items[l];if(c&&c.text){if(s){if(!s(c))continue;if(c.items&&this.allSubitemsAreFiltered(c.items,s))continue}c.data=function(e){return t[e]},void 0===c.selected&&(c.selected=!1),c.selected&&null==this.selectedItem&&(this.selectedItem=c);var d=document.createElement("div");if(Object(a.i)(d).addClass(this.cssPrefix+"-itemDiv").addClass(u.a.getMobileCssClass()),c.selected&&this.showSelected&&!n&&d.classList.add(this.cssPrefix+"-selected"),this.domWriteItemsId&&this.menuId&&(d.id="item-"+this.menuId+"-"+c.id),e.appendChild(d),d.menuItem=c,d.menuLevel=this,c.itemDiv=d,this.parentMenu.options.useDefaultStyles&&(d.style.fontSize=r,d.style.color=i,d.style.paddingLeft="15px",d.style.paddingRight="6px",d.style.cursor="pointer"),"---"==c.text)d.appendChild(document.createElement("hr"));else{if(n){var h=document.createElement("input");h.type="checkbox",h.id="cb"+c.id,h.checked=this.isItemSelected(c),h.defaultChecked=this.isItemSelected(c),d.appendChild(h),c.itemCheckbox=h,this.parentMenu.options.useDefaultStyles&&(h.style.margin="4px 10px 0 0",h.style.verticalAlign="top")}var p=document.createTextNode(c.text);if(d.appendChild(p),c.items&&c.items.length>0){d.classList.add(this.cssPrefix+"-itemDiv-hasChildren");var f=document.createElement("span");f.classList.add(this.cssPrefix+"-itemDiv-arrow"),d.appendChild(f);var g=document.createTextNode(">");f.appendChild(g)}var m=function(e){var o=t.getMenuItem(e.target);if(n)if(o.items&&e.target!=o.itemCheckbox)t.activateItem(o);else{var i=t.isItemSelected(o);t.setItemSelected(o,!i),o.itemCheckbox.checked=!i,t.parentMenu.refreshCheckboxes()}else t.activateItem(o),t.submit(o);return!1};d.removeEventListener("click",m),d.addEventListener("click",m),d.addEventListener("mouseenter",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!0,o&&t.activateItem(n)})),d.addEventListener("mouseleave",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!1,setTimeout((function(){t.parentMenu.isCursorInside||o&&n==t.activeItem&&!n.subLevel&&t.deactivateItem(n)}),200)}))}this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,d)}}},t.prototype.renderItemsWithFilter=function(t){this.isFilteringMode=!0,this.scrollDiv.innerHTML="";var e=t.split(">"),n=e.map((function(t){return t.replace(/\*/g,"")})),o=this.filterItems(this.items,e);this.filteredItems=[];for(var i=0;i<o.length;i++)this.renderItemWithFilter(o[i],n,0)},t.prototype.matchesFilter=function(t,e){return!t||!e||e.test(t)},t.prototype.filterItems=function(t,e){for(var n=[],o=e.length>0?e[0]:"",i=e.length>1?e.slice(1):e,s=o?new RegExp(o.replace(/\*/g,".+?"),"i"):null,a=0;a<t.length;a++){var l=t[a];if(l.items){var u=r.i.assign({},l),c=this.matchesFilter(l.text,s);e.length<2?c&&e.length<2?u.items=r.i.createArrayFrom(l.items):u.items=this.filterItems(l.items,i):u.items=c?this.filterItems(l.items,i):[],u.items.length>0&&n.push(u)}else this.matchesFilter(l.text,s)&&n.push(l)}return n},t.prototype.renderItemWithFilter=function(t,e,n){var o=this,i=this.scrollDiv,r=n<e.length?e[n]:e[e.length-1],s=this.parentMenu.options.multiselect,l=this.parentMenu.options.activateOnMouseOver,c=this.parentMenu.style.colors.fgON||"black",d=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),h=this.parentMenu.getItemFilterCallback();if(t&&t.text){if(h){if(!h(t))return;if(t.items&&this.allSubitemsAreFiltered(t.items,h))return}t.data=function(t){return this[t]},void 0===t.selected&&(t.selected=!1),t.selected&&null==this.selectedItem&&(this.selectedItem=t);var p=document.createElement("div");if(Object(a.i)(p).addClass(this.cssPrefix+"-itemDiv").addClass(u.a.getMobileCssClass()),p.style.marginLeft=10*n+"px",t.selected&&!s&&p.classList.add(this.cssPrefix+"-selected"),this.domWriteItemsId&&this.menuId&&(p.id="item-"+this.menuId+"-"+t.id),i.appendChild(p),p.menuItem=t,p.menuLevel=this,t.itemDiv=p,this.parentMenu.options.useDefaultStyles&&(p.style.fontSize=d,p.style.color=c,p.style.paddingLeft="15px",p.style.paddingRight="6px",p.style.cursor="pointer"),"---"==t.text)p.appendChild(document.createElement("hr"));else{if(s){var f=document.createElement("input");f.type="checkbox",f.id="cb"+t.id,f.checked=this.isItemSelected(t),f.defaultChecked=this.isItemSelected(t),p.appendChild(f),t.itemCheckbox=f,this.parentMenu.options.useDefaultStyles&&(f.style.margin="4px 10px 0 0",f.style.verticalAlign="top")}var g=document.createElement("span");if(g.innerHTML=this.highlightText(t.text,r),p.appendChild(g),t.items&&t.items.length>0)p.classList.add(this.cssPrefix+"-itemDiv-filter-hasChildren");else{this.filteredItems.push(t);var m=function(e){if(s)if(t.items&&e.target!=t.itemCheckbox)o.activateItem(t);else{var n=o.isItemSelected(t);o.setItemSelected(t,!n),t.itemCheckbox.checked=!n,o.parentMenu.refreshCheckboxes()}else o.activateItem(t),o.submit(t);return!1};p.removeEventListener("click",m),p.addEventListener("click",m),p.addEventListener("mouseenter",(function(e){o.parentMenu.isCursorInside=!0,l&&o.activateItem(t)})),p.addEventListener("mouseleave",(function(e){o.parentMenu.isCursorInside=!1,setTimeout((function(){o.parentMenu.isCursorInside||l&&t==o.activeItem&&!t.subLevel&&o.deactivateItem(t)}),200)}))}}if(t.items)for(var y=0;y<t.items.length;y++)this.renderItemWithFilter(t.items[y],e,n+1);this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,p)}},t.prototype.highlightText=function(t,e){if(e&&e.length>0){var n=e.toLowerCase(),o=t.toLowerCase();if(o.indexOf(n)>=0){for(var i=0,r=t,s=[];;){var a=o.indexOf(n,i);if(a>=0?(s.push(a),i=a+e.length):i++,i>=r.length-1)break}if(s.length>0){t="";for(var l=0;l<s.length;l++)0===l&&(t+=r.substring(0,s[l])),t+="<span class='eqjs-menu-itemDiv-highlight'>"+r.substring(s[l],s[l]+e.length)+"</span>",l<s.length-1?t+=r.substring(s[l]+e.length,s[l+1]):t+=r.substring(s[l]+e.length)}}}return t},t.prototype.renderItems=function(t){t||u.a.isMobileMode()?(t=t||"",this.renderItemsWithFilter(t.toLowerCase())):this.renderItemsWithoutFilter()},t.prototype.activateItem=function(t,e){void 0===e&&(e=!0),null!=this.activeItem&&this.deactivateItem(this.activeItem),this.activeItem=t;var n=t.itemDiv;if(n.classList.add("active"),this.parentMenu.options.useDefaultStyles){this.parentMenu.style.colors.bgON,this.parentMenu.style.colors.fgON;var o=this.parentMenu.style.colors.bgOVER,i=this.parentMenu.style.colors.fgOVER||"";this.parentMenu.style.itemClass;""!=(this.parentMenu.style.itemClassOver||"")?(n.style.backgroundColor="",n.style.color=""):(n.style.backgroundColor=o,n.style.color=i)}t.items&&!this.isFilteringMode&&e&&this.showSubLevel(t)},t.prototype.deactivateItem=function(t){if(t){var e=t.itemDiv;if(e.classList.remove("active"),this.parentMenu.options.useDefaultStyles){var n=this.parentMenu.style.colors.bgON,o=this.parentMenu.style.colors.fgON;""!=(this.parentMenu.style.itemClass||"")?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=n,e.style.color=o)}t.subLevel&&t.subLevel.hide(),this.activeItem=null}},t.prototype.showSubLevel=function(e){if(!e.subLevel){var n="";this.menuId&&(n=this.menuId+"-"+e.id),e.subLevel=new t({showSelected:this.showSelected,menu:this.parentMenu,parent:this,container:this.parentElement,items:e.items,levelIndex:this.levelIndex+1,domWriteItemsId:this.domWriteItemsId,menuId:n,itemRenderedCallback:this.itemRenderedCallback})}var o=Object(a.k)(e.itemDiv),i=Object(a.l)(),r=Object(a.n)(),s=o.x-i.left,l=r.width-s-e.itemDiv.offsetWidth;o.x+=e.itemDiv.offsetParent.offsetWidth,o.y+=1,e.subLevel.showAt(o.x,o.y,!0,!0),e.subLevel.levelDiv.style.width="",e.subLevel.levelDiv.style.right="",l>=e.subLevel.levelDiv.offsetWidth||l>=s?l<e.subLevel.levelDiv.offsetWidth&&(e.subLevel.levelDiv.style.right=-i.left+"px"):(s<e.subLevel.levelDiv.offsetWidth?e.subLevel.levelDiv.style.left=i.left+4+"px":e.subLevel.levelDiv.style.left="",e.subLevel.levelDiv.style.right=Object(a.m)().width-o.x+e.itemDiv.offsetWidth-6+"px"),e.subLevel.levelDiv.style.visibility="visible",e.subLevel.focus()},t.prototype.adjustTopPos=function(t){var e=Object(a.n)(),n=t-Object(a.l)().top+this.levelDiv.offsetHeight,o=t;return n>e.height-5&&(o-=n-e.height+5)<Object(a.l)().top&&(o=Object(a.l)().top+10),o},t.prototype.showAt=function(t,e,n,o){if(this.items){this.initLevelDiv(),this.turnCheckboxes(this.items),this.renderItems();var i=this.levelDiv.style;o&&(this.levelDiv.style.visibility="hidden"),i.display="block",i.left=t+"px",i.top=e+"px",this.scrollDiv.style.width="auto",this.scrollDiv.style.height="auto",n&&(e=this.adjustTopPos(e),i.top=e+"px");var r=this.parentMenu.minItemWidth;if(r>0&&this.scrollDiv.offsetWidth<r)for(var s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=r+"px";var l=this.parentMenu.maxItemWidth;if(l>0&&this.scrollDiv.offsetWidth>l)for(s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=l+"px",this.items[s].itemDiv.style.overflowX="hidden";var u=Object(a.n)().height-(e-Object(a.l)().top)-15;if(this.parentMenu.maxHeight>0&&u>this.parentMenu.maxHeight&&(u=this.parentMenu.maxHeight),null!=this._applyItem&&null!=this._applyItem.itemDiv&&(u-=this._applyItem.itemDiv.offsetHeight+5),null!=this.searchDiv&&(u-=this.searchDiv.offsetHeight),null!=this.closeDiv&&(u-=this.closeDiv.offsetHeight),this.levelDiv.offsetHeight>u){var c=u;c<50&&(c=50),this.scrollDiv.style.height=c+"px"}else this.scrollDiv.style.height="auto";this.activeItem=null}},t.prototype.focus=function(){var t=this;window.setTimeout((function(){t.scrollDiv.focus(),null!=t.searchBox&&(t.parentMenu.options.searchBoxAutoFocus&&t.searchBox.focus(),t.searchBox.value="")}),100)},t.prototype.hide=function(){(null!==this.activeItem&&this.activeItem.subLevel&&this.activeItem.subLevel.hide(),this.levelDiv)&&(this.levelDiv.style.display="none",this.initialized&&(this.parentElement.removeChild(this.levelDiv),this.initialized=!1))},t.prototype.initLevelDiv=function(){this.initialized||(this.parentElement.appendChild(this.levelDiv),Object(a.i)(this.levelDiv).addClass(this.cssPrefix+"-levelDiv").addClass(u.a.getMobileCssClass()),this.initialized=!0)},t.prototype.submit=function(t){if(null!=t&&!t.items){this.parentMenu.hideMenu();var e=[];t==this._applyItem&&this.submitItems(this.items,e),this.parentMenu.submitMenu(t,e)}},t.prototype.remove=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.subLevel&&e.subLevel.remove()}if(this.levelDiv){this.levelDiv.innerHTML="";var n=this.levelDiv.parentNode;null!=n&&n.removeChild(this.levelDiv)}this.levelDiv=null},t.prototype.update=function(t){this.remove(),this.items=t,this.activeItem=null,this.selectedItem=null,this._applyItem.itemDiv=null,this.initialized=!1,this.updated++,this.renderContent()},t.prototype.refreshCheckboxes=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemCheckbox&&(e.itemCheckbox.checked=this.isItemSelected(e)),e.subLevel&&e.subLevel.refreshCheckboxes()}},t.prototype.refreshItems=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemDiv&&(e.hidden?e.itemDiv.style.display="none":e.itemDiv.style.display="block"),e.subLevel&&e.subLevel.refreshItems()}},t.prototype.findItem=function(t){for(var e=t.toLowerCase(),n=0;n<this.items.length;n++){var o=this.items[n];if(0==o.text.toLowerCase().indexOf(e))return o}return null},t}(),p=function(){function t(e){var n=this;this.isCursorInside=!1,this.mouseIsOverBlock=!1,this.mouseIsOverLink=!1,this.toId=null,this.active=!1,this.ancorFocused=null,this.options={items:[],buttons:{submit:r.g.getText("ButtonApply"),cancel:r.g.getText("ButtonCancel")},itemFilterCallback:null,useDefaultStyles:!1,multiselect:!1,adjustHeight:!0,showSearchBoxAfter:30,activateOnMouseOver:!0,container:document.body,domWriteItemsId:!1,itemRenderedCallback:null},e&&r.i.assignDeep(this.options,e),this.options.hideButtons&&(this.options.submitOnBlur=!0),this.menuId=t.lastMenuID++,this.updateProps(),this.rootLevel=new h({menu:this,items:this.options.items,levelIndex:0,container:this.options.container,domWriteItemsId:this.options.domWriteItemsId,menuId:this.options.id,itemRenderedCallback:this.options.itemRenderedCallback,showSelected:this.options.showSelected}),this.rootLevel.levelDiv.classList.add(this.cssPrefix+"-rootLevel"),this.options.zIndex&&(this.rootLevel.levelDiv.style.zIndex=""+this.options.zIndex),this.menuKeyUpHandler=function(t){27==t.which&&(n.hideMenu(),t.stopImmediatePropagation())},this.globalMouseDownHandler=function(t){if(!n.active)return!0;for(var e=window.event||t,o=e.srcElement||e.target,i=!0;o;){if(o.tagName&&"div"==o.tagName.toLowerCase()&&o.menuLevel&&o.menuLevel.parentMenu==n){i=!1;break}o=o.parentNode||o.parentElement}return i&&(n.options.submitOnBlur&&n.rootLevel.submit(n.rootLevel.applyItem),n.hideMenu()),!0},this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!0,configurable:!0}),t.prototype.getItems=function(){return this.rootLevel.getItems()},t.prototype.updateProps=function(){this.style={},this.style.colors={border:"#666666",shadow:"#888888",bgON:"white",fgON:"black",bgOVER:"#B6BDD2",fgOVER:"black"},this.style.itemStyle={fontSize:"14px"},this.minItemWidth=0,this.maxItemWidth=0,this.maxHeight=0,this.zIndex=""+this.options.zIndex,this.commandTemplate="",this.args=[],this.active=!1},t.prototype.render=function(){},t.prototype.clearItemsMenuProps=function(t){if(t)for(var e=0;e<t.length;e++)this.clearItemMenuProps(t[e])},t.prototype.clearItemMenuProps=function(t){t.subLevel&&t.subLevel.parentMenu==this||(t.subLevel&&(t.subLevel.remove(),t.subLevel=null),t.itemDiv&&(t.itemDiv=null),t.items&&this.clearItemsMenuProps(t.items))},t.prototype.setSelectedItems=function(t,e){for(var n=t?t.length:0,o=0;o<n;o++){var i=t[o];i.items?this.setSelectedItems(i.items,e):i.selected=e.indexOf(i.id)>=0}},t.prototype.getRootLevel=function(){return this.rootLevel},t.prototype.getItemFilterCallback=function(){return this.itemFilterCallback},t.prototype.showMenu=function(t){this.ancorFocused=t.anchor==document.activeElement?t.anchor:null,this.clearItemsMenuProps(this.options.items),this.itemSelectedCallback=t.itemSelectedCallback||null,this.menuClosedCallback=t.menuClosedCallback||null,this.itemFilterCallback=t.itemFilterCallback||null,t.items&&(this.options.items=t.items,this.rootLevel.setItems(t.items)),t.onMenuItemSelected&&(this.options.onMenuItemSelected=t.onMenuItemSelected);var e=t.selectedIds||null;if(e?"string"==typeof e&&(e=e.split(",")):e=[],this.active=!0,this.setSelectedItems(this.options.items,e),u.a.isMobileMode())this.rootLevel.showAt(0,0,!0,!0),this.rootLevel.levelDiv.style.top="0px",this.rootLevel.levelDiv.style.bottom="0px",this.rootLevel.levelDiv.style.right="0px",this.rootLevel.levelDiv.style.position="fixed",this.rootLevel.levelDiv.style.fontSize="20px";else{var n=t.anchor||document.documentElement,o=Object(a.k)(n),i=n.offsetHeight,r=n.offsetHeight,s={x:o.x,y:o.y+i+2},c=Object(a.l)(),d=Object(a.n)(),h=s.x+r-c.left,p=d.width-h+r;s.x+=2,this.rootLevel.showAt(s.x,s.y,!0,!0),this.rootLevel.levelDiv.style.width="",this.rootLevel.levelDiv.style.right="",this.rootLevel.levelDiv.style.zIndex||(this.rootLevel.levelDiv.style.zIndex=""+Math.max(1e4,Object(l.c)(n)+1)),p>=this.rootLevel.levelDiv.offsetWidth||p>=h?p<this.rootLevel.levelDiv.offsetWidth&&(this.rootLevel.levelDiv.style.right=-c.left+"px"):(h<this.rootLevel.levelDiv.offsetWidth?this.rootLevel.levelDiv.style.left=c.left+4+"px":this.rootLevel.levelDiv.style.left="",this.rootLevel.levelDiv.style.right=Object(a.m)().width-s.x-r+"px"),this.rootLevel.levelDiv.style.fontSize="14px"}this.rootLevel.levelDiv.style.visibility="visible",this.rootLevel.focus(),document.addEventListener("keyup",this.menuKeyUpHandler),document.addEventListener("mousedown",this.globalMouseDownHandler,!0)},t.prototype.hideMenu=function(){document.removeEventListener("mousedown",this.globalMouseDownHandler,!0),document.removeEventListener("keyup",this.menuKeyUpHandler),this.rootLevel.hide(),this.ancorFocused&&this.ancorFocused.focus(),this.menuClosedCallback&&this.menuClosedCallback()},t.prototype.submitMenu=function(t,e){this.itemSelectedCallback&&this.itemSelectedCallback(t,e)},t.prototype.knockMenuStyle=function(t){t.removeAttribute("style");var e=t.querySelectorAll("ul").item(0);!1!==!(!e||!e.style)&&e.setAttribute("style","")},t.prototype.refreshItems=function(){this.rootLevel.refreshItems()},t.prototype.refreshCheckboxes=function(){this.rootLevel.refreshCheckboxes()},t.lastMenuID=0,t}(),f=function(){function t(){this.formatStr="",this.pos=0,this.token="text",this.tokenText=""}return t.prototype.start=function(t){this.formatStr=t,this.pos=0,this.tokenText=""},t.prototype.skipSpaces=function(){for(;this.pos<this.formatStr.length&&" "===this.formatStr.charAt(this.pos);)this.pos++},t.prototype.getToken=function(){return this.token},t.prototype.getTokenText=function(){return this.tokenText},t.prototype.next=function(){if(this.skipSpaces(),this.pos>=this.formatStr.length)return!1;var t=0;if("{"===this.formatStr.charAt(this.pos)){if((t=this.formatStr.indexOf("}",this.pos))<0)return!1;this.tokenText=this.formatStr.substring(this.pos,t+1),0!==this.tokenText.indexOf("{expr")&&0!==this.tokenText.indexOf("{attr")||(this.token="expression"),this.pos=t+1}else if("["===this.formatStr.charAt(this.pos)&&this.pos<this.formatStr.length-1&&"["===this.formatStr.charAt(this.pos+1))this.pos+=2,t=this.formatStr.indexOf("]]",this.pos),this.token="function",this.tokenText=this.formatStr.substring(this.pos,t),this.pos=t+2;else{this.token="text";var e=this.formatStr.indexOf("{",this.pos);e<0&&(e=this.formatStr.length);var n=this.formatStr.indexOf("[[",this.pos);n<0&&(n=this.formatStr.length),t=Math.min(e,n),this.tokenText=this.formatStr.substring(this.pos,t).trim(),this.pos=t}return!0},t}();!function(t){t[t.Enable=0]="Enable",t[t.Delete=1]="Delete",t[t.Hidden=2]="Hidden",t[t.SortingNone=3]="SortingNone",t[t.SortingAsc=4]="SortingAsc",t[t.SortingDesc=5]="SortingDesc",t[t.MoveTop=6]="MoveTop",t[t.MoveUp=7]="MoveUp",t[t.MoveDown=8]="MoveDown",t[t.MoveBottom=9]="MoveBottom",t[t.Menu=10]="Menu",t[t.Type=11]="Type",t[t.Format=12]="Format"}(i||(i={}));var g,m=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.buttonMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.panel=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!0,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute(),this.getButtonsToShow().indexOf("sorting")>=0&&this.column.enabled&&(this.sortingButton=this.renderSoringButton(this.column.sorting),this.column.sorting!==s.SortDirection.None&&(this.sortingButton.style.display="block"));var e=Object(a.i)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.panel.options.allowDragDrop&&!u.a.isMobileMode()&&a.j.registerDraggableItem({element:this.element,scope:"entityAttrSort",data:{column:this.column},beforeDragStart:function(){t.hideButtons()},renderer:function(e){e.innerHTML="";var n=document.createElement("span");n.innerText=t.column.caption,e.classList.add("eqjs-sortable-helper"),e.appendChild(n)},onDragStart:function(e){t.element.style.display="none",e.dropEffect=a.d.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.style.removeProperty("display")}}),this.isEditable()&&(this.createFunctionMenu(),this.createFormatsMenu()),this.createButtonMenu(),e.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderCheckbox()).addChild("div",(function(e){return e.addClass(l.b+"-button-placeholder",t.cssPrefix+"-button-placeholder",t.cssPrefix+"-colelement",t.cssPrefix+"-sortbutton-placeholder").addChildElement(t.sortingButton)})).addChildElement(this.renderExpressionBlock()),!1===this.panel.options.showColumnTitles||u.a.isMobileMode()||e.addChildElement(this.renderCaptionBlock()),e.addChild("div",(function(e){e.addClass(l.b+"-column-buttonsBlock",t.cssPrefix+"-buttonsBlock").addClass(u.a.getMobileCssClass()),t.getButtonsToShow().indexOf("enable")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderEnabledButton()),t.getButtonsToShow().indexOf("type")>=0&&t.column.enabled&&e.addChildElement(t.renderColumnTypeButton()),t.getButtonsToShow().indexOf("format")>=0&&t.column.enabled&&e.addChildElement(t.renderColumnFormatButton()),t.getButtonsToShow().indexOf("delete")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderDeleteButton()),t.getButtonsToShow().indexOf("menu")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderMenuButton())})),u.a.isMobileMode()||e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.panel.options.accentActiveColumn||u.a.isMobileMode())&&e.on("click",this.onMouseClick.bind(this)),this.panel.options.alwaysShowButtons&&this.showButtons(),this.element},t.prototype.onMouseClick=function(t){return t.stopPropagation(),this.panel.toggleColumnPicked(this.column),this.adjustButtonsVisibility(),u.a.isMobileMode()||this.element.dispatchEvent(Object(a.h)("mouseenter")),!1},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass());return this.isEditable()?e.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("click",(function(e){e.stopPropagation();var n=e.target,o=n.parentElement.querySelector("input");return o&&(n.style.display="none",o.style.removeProperty("display"),o.style.minWidth=""+n.clientWidth,o.focus(),t.element.setAttribute(a.j.DRAG_DISABLED_ATTR,"")),!1}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var i=e.target,r=i.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),i.style.display="none"),o&&t.column.caption!==i.value?(t.column.caption=i.value,t.fireColumnChanged()):(i.value=t.column.caption,Object(l.d)(r)),t.element.removeAttribute(a.j.DRAG_DISABLED_ATTR)}return!0}))})):e.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),e.toDOM()},t.prototype.renderSoringButton=function(t){var e,n=this,o=l.b+"-column-sortbutton";switch(t){case s.SortDirection.Ascending:e=o+"-asc";break;case s.SortDirection.Descending:e=o+"-desc";break;default:e=o+"-none"}return this.isEditable()?Object(a.i)("div").addClass(o,l.b+"-button",e).data("btnplaceholder","").title(s.i18n.getText("ButtonSorting")).attr("tabIndex","0").on("click",(function(t){t.stopPropagation(),n.keepShowingButtons=!0,(n.getUIS()&&n.panel.sortMenu||n.panel.moveMenu).showMenu({anchor:n.sortingButton,selectedIds:n.column.isHidden()?["IsHidden"]:null,itemSelectedCallback:function(t,e){var o;switch(t.id){case"IsHidden":o=i.Hidden;break;case"MoveTop":o=i.MoveTop;break;case"MoveDown":o=i.MoveDown;break;case"MoveUp":o=i.MoveUp;break;case"MoveBottom":o=i.MoveBottom;break;case"None":o=i.SortingNone;break;case"Ascending":o=i.SortingAsc;break;case"Descending":o=i.SortingDesc}n.buttonMenuHandler(o,null)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}})})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():t===s.SortDirection.Ascending||t===s.SortDirection.Descending?Object(a.i)("div").addClass(o,l.b+"-button",e).title(s.i18n.getText("ButtonSorting")).toDOM():null},t.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.column.isReadOnly()?Object(a.i)("div").title(s.i18n.getText("CmdToggleEnable")).attr("tabIndex","0").addClass(this.cssPrefix+"-colelement "+this.cssPrefix+"-column-checkbox").addClass(this.column.enabled?"enabled":"").on("click",(function(){return t.column.enabled=!t.column.enabled,t.column.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},t.prototype.renderDeleteButton=function(){var t=this;return Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-deletebutton-placeholder").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-delete").title(s.i18n.getText("CmdDelete")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(i.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.renderMenuButton=function(){var t=this;return Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-menubutton-placeholder").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-menu").title(s.i18n.getText("ButtonMenu")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(i.Menu,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){return this.getAttributeCaption(t,this.panel.options.titleElementFormat)},t.prototype.getAttributeCaption=function(t,e){return e=e||this.panel.options.attrElementFormat,this.panel.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.column.enabled?"":" "+this.cssPrefix+"-disabled",this.column.enabled&&(t+=this.column.isReadOnly()?" "+this.cssPrefix+"-readonly":""),t+=this.column.isHidden()?" "+this.cssPrefix+"-hidden":""},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.panel.options.allowAggrColumns&&!this.column.getQuery().enableAggregation?Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-typebutton-placeholder",this.cssPrefix+"-button-active").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-type").title(s.i18n.getText("ButtonToAggr")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeTypeHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this,e=this.getFormatsMenuItems();return this.isEditable()&&!1!==this.panel.options.allowDisplayFormatChange&&e.length>1?Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-formatbutton-placeholder",this.cssPrefix+"-button-active").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-format").title(s.i18n.getText("ButtonFormat")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeFormatHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderEnabledButton=function(){var t=this;return Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-enablebutton-placeholder",this.cssPrefix+"-button-active").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-enable").title(s.i18n.getText("CmdToggleEnable")).addClass(t.column.enabled?"enabled":"").attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(i.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.changeFormatHandler=function(t){var e=this,n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),o="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(o=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:o,itemSelectedCallback:function(t,n){return t.id!=o&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},t.prototype.getUIS=function(){return this.panel.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseEnter=function(t){return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){Object(a.i)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){Object(a.i)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtons||(this.panel.options.accentActiveColumn||u.a.isMobileMode())&&this.isColumnActive())&&this.showButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){this.keepShowingButtons||!0===this.panel.options.alwaysShowButtons||this.isColumnActive()&&1==this.panel.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),o=!0,i=null,r=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(r)>=0;this.column.expr.func!==u.id||c||(o=!1),c&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(u.id),i={id:u.id,text:t},e.push(i))}}o||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(i={id:"CustomSqlDivider",text:"---"},e.push(i),i={id:"CUSTOMSQL",text:t=s.i18n.getText("CustomExpression")},e.push(i));var d=this.column.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new p(h)},t.prototype.createFormatsMenu=function(){if(0!=this.panel.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new p(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:s.i18n.getText("DisplayFormats",t.name)||t.name}})))},t.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&Array.isArray(this.panel.options.buttons)?this.panel.options.buttons:["enable","delete","type","sorting","format"]},t.prototype.buttonMenuHandler=function(t,e){var n=this;switch(t){case i.Delete:var o=this.column.getQuery();o.removeColumn(this.column,this.panel),o.fireColumnsChangedEvent(s.QueryChangeAction.Delete,this.column);break;case i.Enable:this.column.enabled=!this.column.enabled,this.fireColumnChanged();break;case i.Hidden:this.column.setHidden(!this.column.isHidden()),this.fireColumnChanged();break;case i.MoveTop:this.panel.moveColumn(this.column,"MoveTop");break;case i.MoveBottom:this.panel.moveColumn(this.column,"MoveBottom");break;case i.MoveUp:this.panel.moveColumn(this.column,"MoveUp");break;case i.MoveDown:this.panel.moveColumn(this.column,"MoveDown");break;case i.SortingAsc:this.column.sorting=s.SortDirection.Ascending,this.column.fireChangedEvent();break;case i.SortingDesc:this.column.sorting=s.SortDirection.Descending,this.column.fireChangedEvent();break;case i.SortingNone:this.column.sorting=s.SortDirection.None,this.column.fireChangedEvent();break;case i.Menu:var r=this.buttonMenu;this.keepShowingButtons=!0,r.showMenu({anchor:e?e.target:null,selectedIds:this.getButtonMenuSelectedItems(),itemSelectedCallback:function(t){var o=t.id;switch(t.id){case"enable":o=i.Enable;break;case"delete":o=i.Delete;break;case"hidden":o=i.Hidden;break;case"MoveTop":o=i.MoveTop;break;case"MoveBottom":o=i.MoveBottom;break;case"MoveUp":o=i.MoveUp;break;case"MoveDown":o=i.MoveDown;break;case"None":o=i.SortingNone;break;case"Ascending":case"Descending":o=i.SortingAsc}n.buttonMenuHandler(o,e)},itemFilterCallback:function(t){return n.column.enabled||"__group"===t.id||"enable"===t.id||"delete"===t.id},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;default:this.processFormatsButtonMenuItems(t,e)||this.processExtraButtonMenuItems(t,e)}return e&&e.stopPropagation(),!1},t.prototype.createButtonMenu=function(){if(!this.buttonMenu){var t=this.column.id;t&&(t+="-ButtonMenu");var e=[];e.push({id:"enable",text:s.i18n.getText("MenuEnable")}),this.panel.options.allowHiddenColumns&&e.push({id:"hidden",text:s.i18n.getText("CmdHiddenColumn")}),e.push({id:"delete",text:s.i18n.getText("CmdDelete")});var n=[];n.push({id:"__group",text:" ",items:e});var o=this.panel.options.allowSorting?this.panel.getSortMenuList().concat(this.panel.getMoveMenuList()):this.panel.getMoveMenuList();n.push({id:"__group",text:s.i18n.getText("CmdGroupSort"),items:o});var i=this.getExtraButtonMenuItems();i&&Array.isArray(i)&&(n=n.concat(i));var r=this.getFormatsMenuItems();r.length>1&&n.push({id:"__group",text:s.i18n.getText("CmdGroupFormat"),items:r});var a={items:n,id:t,searchBoxAlwaysShown:!1,domWriteItemsId:!0,showSelected:!0};this.buttonMenu=new p(a)}},t.prototype.processFormatsButtonMenuItems=function(t,e){var n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());if("{0:__default}"==t)this.column.displayFormat="";else{if(!(n.filter((function(e){return e.format==t})).length>0))return!1;this.column.displayFormat=t}return this.column.fireChangedEvent(),!0},t.prototype.getButtonMenuSelectedItems=function(){var t=this,e=[];this.column.enabled&&e.push("enable"),this.column.isHidden()&&e.push("hidden");var n="{0:__default}";return this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).filter((function(e){return e.format==t.column.displayFormat})).length>0&&(n=this.column.displayFormat),e.push(n),e},t}(),y=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return y(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"},e.prototype.renderExpressionBlock=function(){var t=this;return Object(a.i)("div").addClass(this.cssPrefix+"-expr-block").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass()).addChildElement(t.renderBaseExpression())})).toDOM()},e.prototype.renderBaseExpression=function(){var t=this,e=this.getAttributeCaption(this.baseAttr);return this.isEditable()?Object(a.i)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.stopPropagation(),t.panel.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:t.baseExpressionItemSelectedCallback.bind(t),itemFilterCallback:function(t){return"__AddAll__"!==t.id}}),!1})).toDOM():Object(a.i)("span").text(e).title(e).toDOM()},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.panel.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeHandler=function(t){var e=this;this.keepShowingButtons=!0,this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return e.processExtraButtonMenuItems(t.id,null),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},e.prototype.changeTypeToCustomSql=function(){var t=this;this.column.getQuery().changeColumnType(this.column,s.ExprTag.CustomSql);var e=this.element.parentElement;setTimeout((function(){var n=e.querySelector("div[data-id='"+t.column.id+"'] div[class*='"+t.cssPrefix+"-expr-block'] div[class*='"+t.cssPrefix+"-colelement'] a");n&&n.click()}),500),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,s.ExprTag.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.processExtraButtonMenuItems=function(t,e){return"CUSTOMSQL"===t?this.changeTypeToCustomSql():this.changeTypeToAggr(t),!0},e.prototype.getExtraButtonMenuItems=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),o=!0,i=!0,s=null,a=this.getAttribute(),l=0,u=n;l<u.length;l++){var c=u[l];o=c.getAppliedTypesOrDefault().indexOf(a.dataType)>=0,this.column.expr.func!==c.id||o||(i=!1),o&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(c.id),s={id:c.id,text:t},e.push(s))}for(var d=0;d<n.length;d++)n[d];return i||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(s={id:"CustomSqlDivider",text:"---"},e.push(s),s={id:"CUSTOMSQL",text:t=r.g.getText("CustomExpression")},e.push(s)),[{id:"__group",text:r.g.getText("ColTypeGroup"),items:e}]},e}(m),C=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),b=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displayFormatParser=new f,e}return C(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-aggr"},e.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.panel.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderExpressionBlock=function(){var t=this,e=this.panel.getContext().getModel(),n=Object(a.i)("div").addClass(this.cssPrefix+"-expr-block",this.cssPrefix+"-expr-block-aggr").addClass(u.a.getMobileCssClass()),o=e.getAggrFunctionFormat(this.column.expr.func);if(o&&""!==o){var i=this.parseDisplayFormat(o);if(0!==i.length){for(var r=null,s=i.length,l=function(e){if(1===(r=i[e]).type)if(c.isEditable()){var o=Object(a.i)("a").attr("href","javascript:void(0)").text(r.text).on("click",(function(e){e.stopPropagation(),t.functionMenu.showMenu({anchor:o.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){"CUSTOMSQL"===e.id?t.changeTypeToCustomSql():(t.column.expr.func=e.id,t.column.caption="",t.fireColumnChanged())}})}));n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-aggrfuncelement").addClass(u.a.getMobileCssClass()).addChildElement(o.toDOM())}))}else n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-aggrfuncelement").addClass(u.a.getMobileCssClass()).addChild("span",(function(t){return t.text(r.text).title(r.text)}))}));else 2===r.type?n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass()).addChildElement(t.renderBaseExpression())})):3===r.type&&n.addChild("span",(function(e){return e.addClass(t.cssPrefix+"-colelement").addClass(u.a.getMobileCssClass()).text(r.text).title(r.text)}))},c=this,d=0;d<s;d++)l(d);return n.toDOM()}}},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.g.getText("ButtonToSimple"))),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.EntityAttribute),this.fireColumnChanged()},e.prototype.parseDisplayFormat=function(t){if(!t)return[];var e=[],n=this.displayFormatParser;for(n.start(t);n.next();){var o=n.getToken(),i=n.getTokenText();"function"===o?e.push({type:1,text:i}):"expression"===o?e.push({type:2}):"text"===o&&e.push({type:3,text:i})}return e},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.g.getText("ColTypeGroup"),items:[{id:"type",text:r.g.getText("ColTypeSimple")}]}]},e}(v),x=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),w=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dataTypeMenu=null,e}return x(e,t),e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"+t.prototype.getClassesToAdd.call(this)},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.g.getText("ButtonToSimple"))),e},e.prototype.renderExpressionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=Object(a.i)("div").addClass(this.cssPrefix+"-expr-block").addClass(u.a.getMobileCssClass()).toDOM(),n=Object(a.i)("div",e).addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass());return this.isEditable()?n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("touchstart click",(function(e){e.stopPropagation();var n=e.target,o=n.parentElement.querySelector("input");o&&(n.style.display="none",o.style.removeProperty("display"),o.style.width="100%",o.focus(),t.element.setAttribute(a.j.DRAG_DISABLED_ATTR,""))}))})).addChild("input",(function(e){return e.hide().value(t.column.expr.sql).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var i=e.target,r=i.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),i.style.display="none"),o&&t.column.expr.sql!==i.value?(t.column.expr.sql=i.value,t.fireColumnChanged()):i.value=t.column.expr.sql,t.element.removeAttribute(a.j.DRAG_DISABLED_ATTR)}}))})):n.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),n=Object(a.i)("div",e).addClass(this.cssPrefix+"-colelement").addChild("span",(function(t){t.text(":").title(":")})),n=Object(a.i)("div",e).addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass()),this.isEditable()?(this.createDataTypeMenu(),n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(r.d[t.column.expr.dataType]).text(r.d[t.column.expr.dataType]).on("touchstart click",(function(n){n.stopPropagation(),t.dataTypeMenu.showMenu({anchor:e.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){t.column.expr.dataType=e.id,t.fireColumnChanged()}})}))}))):(this.column.expr.dataType,n.addChild("span",(function(e){e.text(r.d[t.column.expr.dataType]).title(r.d[t.column.expr.dataType])}))),e},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.EntityAttribute),this.fireColumnChanged()},e.prototype.getDefaultColumnCaption=function(){return"Custom SQL Column"},e.prototype.getDefaultValue=function(){return this.column.expr.sql},e.prototype.getUIS=function(){return!0},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.createFunctionMenu=function(){},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.g.getText("ColTypeGroup"),items:[{id:"type",text:r.g.getText("ColTypeSimple")}]}]},e.prototype.createDataTypeMenu=function(){var t=[];for(var e in r.d)if(!isNaN(Number(e))){var n={id:e,text:r.d[e]};t.push(n)}var o=this.column.id;o&&(o+="-DataTypeMenu");var i={items:t,id:o,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.dataTypeMenu=new p(i)},e}(v),E=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),T=function(t){function e(e){var n=t.call(this,e)||this;return n.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,buttons:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0,allowHiddenColumns:!1,showAddAllForEntity:!1},n.landingSlot=Object(a.i)("div").addClass(n.cssPrefix+"-col-landing-slot").addChildElement(Object(a.i)("div").toDOM()).toDOM(),n.landingIndex=-1,n.slot.classList.add(n.cssPrefix+"-panel"),n.group=s.WidgetGroup.Query,n}return E(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsPanel"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n);var i=e.getModel();this.detachQueryObserver(),this.attachQueryObserver(),a.j.removeDropContainer(this.slot),this.options.allowDragDrop&&a.j.registerDropContainer({element:this.slot,scopes:["entityAttr","entityAttrSort"],onDragEnter:function(t,e){if(o.slot.classList.add(l.b+"-drophover"),"entityAttrSort"===e.item.scope)o.showLandingSlot(e.pageX,e.pageY);else{var n=e.data.attrId;i.checkAttrProperty(n,"useInResult")||(e.dropEffect=a.d.Forbid),e.dragImage.classList.add("eqjs-sortable-helper")}},onDragOver:function(t,e){var n=e.data.attrId;("entityAttrSort"===e.item.scope||i.checkAttrProperty(n,"useInResult"))&&o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){"entityAttrSort"===e.item.scope?e.dropEffect=a.d.Forbid:(e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width")),o.slot.classList.remove(l.b+"-drophover"),o.hideLandingSlot()},onDrop:function(t,e){if("entityAttrSort"==e.item.scope){var n=o.getQuery().getColumns().indexOf(e.data.column);o.moveColumnCore(n,o.landingIndex)}else{var i=e.data.attrId;o.addNewColumn(i,o.landingIndex)}}})},e.prototype.renderBaseElements=function(){var t=this,e=0;if(this.options.showHeader){var n=Object(a.i)("div",this.slot).hide().addClass(this.cssPrefix+"-header").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-header-expression").text(r.g.getText("HeaderExpression"))}));!1!==this.options.showColumnTitles&&n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-header-title").text(r.g.getText("HeaderTitle"))})),this.headerElement=n.toDOM(),e+=this.headerElement.offsetHeight}this.columnsBlock=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-columns").addClass(u.a.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowElement=Object(a.i)("div",this.slot).addClass(l.b+"-addrow",this.cssPrefix+"-addrow",l.b+"-addrow-empty").addClass(u.a.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").text(r.g.getText("CmdClickToAddColumn")).on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){if("__AddAll__"===e.id&&e.extra&&Array.isArray(e.extra.ids))e.extra.ids.forEach((function(e){return t.addNewColumn(e)}));else{var o=e.id;t.addNewColumn(o)}return!1}})}))})).toDOM(),e+=this.addRowElement.offsetHeight),this.columnsBlock.style.maxHeight=this.slot.offsetHeight-e-25+"px"},e.prototype.destroyCore=function(){a.j.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var o=n.data;if(o&&(o.part==s.QueryChangePart.Columns||o.part==s.QueryChangePart.Aggregation||o.part==s.QueryChangePart.All)){var i=document.activeElement,r=t.slot.contains(i)||i==document.body;switch(o.action){case s.QueryChangeAction.Modify:var a=o.changee,l=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var o=t.getColumnRenderer(e,n);if(o){var i=o.render();if(r){var s=i.querySelector("a")||i.querySelector(".eqjs-column-button");s&&s.focus()}}}};Array.isArray(a)?a.forEach((function(t){return l(t)})):l(a),t.agjustHeaderVisibility();break;case s.QueryChangeAction.Add:a=o.changee;var u=function(n){var o=e.getColumns().indexOf(n),i=t.addColumnElement(n,o);r&&i.querySelector("a").focus()};Array.isArray(a)?a.forEach((function(t){return u(t)})):u(a),t.agjustHeaderVisibility();break;case s.QueryChangeAction.Delete:a=o.changee;var c=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var o=n.nextSibling,i=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=o||i||t.addRowElement,a=s.querySelector("a")||s.querySelector(".eqjs-column-button");a&&a.focus()}}};t.agjustHeaderVisibility(),Array.isArray(a)?a.forEach((function(t){return c(t)})):c(a);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),o=[],i=0;i<n.length;i++){var r=n[i];"none"!==r.style.display&&o.push(r)}if(0===o.length)return this.landingIndex=0,void this.columnsBlock.appendChild(this.landingSlot);var s=Object(a.k)(this.landingSlot);if(!(e>=s.y&&e<=s.y+this.landingSlot.offsetHeight)){var l=o[0],u=l.offsetHeight,c=Object(a.k)(l),d=e>c.y+u/2?Math.round((e-c.y+u/2)/u):0;d>o.length&&(d=o.length),d!=this.landingIndex&&(this.landingIndex=d,this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))}},e.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t),u.a.isMobileMode()&&(this.options.buttons=["menu"],this.options.showHeader=!1)},e.prototype.onProcessStartCore=function(){},e.prototype.onProcessEndCore=function(){},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.renderBaseElements(),this.createEntitiesMenu(),this.createColumnMenus(),this.agjustHeaderVisibility(),Object(a.i)(this.slot).removeClass(l.a).addClass(u.a.getMobileCssClass());for(var t=this.context.getQuery().getColumns(),e=0,n=t;e<n.length;e++){var o=n[e];this.columnsBlock.appendChild(this.renderColumn(o))}}catch(t){this.context.throwError({action:"ColumnsPanel rendering",text:t.message,sourceError:t})}},e.prototype.agjustHeaderVisibility=function(){if(this.headerElement){var t=this.context.getQuery().getColumns();this.headerElement.style.display=t.length?"":"none"}},e.prototype.renderColumn=function(t){var e=this.getColumnRenderer(t);return e?e.render():null},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id="+t.id+"]"))&&(n=e.classList.contains("active"));for(var o=this.columnsBlock.querySelectorAll("."+this.cssPrefix+"-row"),i=0;i<o.length;i++){var r=o[i];Object(a.i)(r).removeClass("active"),this.options.alwaysShowButtons||Object(a.i)(r).data("show-buttons",null)}e&&!n&&Object(a.i)(e).addClass("active").data("show-buttons","")},e.prototype.addNewColumn=function(t,e){var n,o,i=this,r=this.getContext().getModel(),a=this.getQuery(),l=function(t){var e=r.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=r.getAttributeById(t))||!e.useInResult)return null}var n=a.createColumn();return n.caption=i.getDefaultColumnCaption(e),n.sorting=s.SortDirection.None,n.sortIndex=-1,n.expr.tag=s.ExprTag.EntityAttribute,n.expr.kind=s.DataKind.Attribute,n.expr.dataType=e.dataType,n.expr.setValue(t,!0),n.params.concat(e.params),n};if(Array.isArray(t)){n=[];for(var u=0;u<t.length;u++)(o=l(t[u]))&&n.push(o)}else n=l(t);return this.addColumn(n,e),n},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireColumnsChangedEvent(s.QueryChangeAction.Add,t)))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),o=this.renderColumn(t);return n.length>0&&e<n.length?this.columnsBlock.insertBefore(o,n[e]):(this.columnsBlock.appendChild(o),this.scrollToBottom()),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(o),o},e.prototype.scrollToBottom=function(){this.columnsBlock.scrollTop=this.columnsBlock.scrollHeight-this.columnsBlock.clientHeight},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],o=0;o<e;o++)this.checkColumn(t[o])&&n.push(t[o]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=0;n<e.length;n++)if((t.expr.tag===s.ExprTag.EntityAttribute&&e[n].expr.tag===s.ExprTag.EntityAttribute||t.expr.tag===s.ExprTag.ParentEntityAttribute&&e[n].expr.tag===s.ExprTag.ParentEntityAttribute)&&t.expr.value===e[n].expr.value)return null;return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case s.ExprTag.AggregateFunction:return new b(this,t,e);case s.ExprTag.CustomSql:return new w(this,t,e);case s.ExprTag.EntityAttribute:case s.ExprTag.ParentEntityAttribute:return new v(this,t,e)}return null},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.options.allowCustomExpressions},e.prototype.addAllColumnsToEntitiesList=function(t){var e=this,n=t.filter((function(t){return!t.isEntity})).map((function(t){return t.id}));n.length>0&&t.unshift({id:"__AddAll__",text:r.g.getText("AddAllForEntityText"),extra:{ids:n}}),t.forEach((function(t){t.items&&e.addAllColumnsToEntitiesList(t.items)}))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n=t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities});this.options.showAddAllForEntity&&this.addAllColumnsToEntitiesList(n);var o={id:e,items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(o,this.options.menuOptions),this.entitiesMenu=new p(o)},e.prototype.getSortMenuList=function(){return[{id:"None",text:r.g.getText("CmdNotSorted")},{id:"Ascending",text:r.g.getText("CmdAscending")},{id:"Descending",text:r.g.getText("CmdDescending")},{id:"---",text:"---"}]},e.prototype.getMoveMenuList=function(){return[{id:"MoveTop",text:r.g.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.g.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.g.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.g.getText("CmdMoveToLast")}]},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={id:e,items:this.getSortMenuList().concat(this.moveMenu.getItems()),domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.i.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new p(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n=r.i.createArrayFrom(this.getMoveMenuList());this.options.allowHiddenColumns&&(n.push({id:"---",text:"---"}),n.push({id:"IsHidden",text:r.g.getText("CmdHiddenColumn")}));var o={items:n,id:e,domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.i.assign(o,this.options.menuOptions),this.moveMenu=new p(o),o.searchBoxAlwaysShown=!1},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),o=n.indexOf(t);if(o>=0)switch(e){case"MoveTop":if(0==o)return;this.moveColumnCore(o,0);break;case"MoveUp":if(0==o)return;this.moveColumnCore(o,o-1);break;case"MoveDown":if(o==n.length-1)return;this.moveColumnCore(o,o+1);break;case"MoveBottom":if(o==n.length-1)return;this.moveColumnCore(o,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var o=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),i=o[t];0==e?this.columnsBlock.insertBefore(i,this.columnsBlock[0]):e>0&&e<o.length-1?t<e?this.columnsBlock.insertBefore(i,o[e+1]):this.columnsBlock.insertBefore(i,o[e]):this.columnsBlock.appendChild(i),n.moveColumn(t,e),n.fireColumnsChangedEvent()}},e.prototype.createColumnMenus=function(){this.createMoveMenu(),this.options.allowSorting&&this.createSortMenu()},e}(s.Widget),k=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.tapedTwice=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!0,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute();var e=Object(a.i)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.bar.options.allowDragDrop&&a.j.registerDraggableItem({element:this.element,scope:"entityAttrSort",beforeDragStart:function(){return t.element.dispatchEvent(Object(a.h)("mouseleave"))},onDragStart:function(e){t.hideButtons(),t.element.style.display="none",e.dropEffect=a.d.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.removeAttribute("style")},data:{column:this.column}}),this.column.isReadOnly()||(this.createFunctionMenu(),this.createFormatsMenu()),e.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderCaptionBlock()).addChildElement(this.renderSortingImage()),u.a.isMobileMode()||e.addChildElement(this.renderButtonsBlock()),e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.bar.options.accentActiveColumn||u.a.isMobileMode())&&e.on("touchstart click",this.onMouseClick.bind(this)),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderButtonsBlock=function(){return Object(a.i)("div",this.element).addClass(l.b+"-column-buttonsBlock",this.cssPrefix+"-buttonsBlock").addChildElement(this.renderSortingButton()).addChildElement(this.renderColumnTypeButton()).addChildElement(this.renderColumnFormatButton()).addChildElement(this.renderDeleteButton()).toDOM()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.getModel(),n=this.baseAttr!==e.nullAttribute?this.column.caption:e.getAttributeText(e.nullAttribute,"{attr}");if(!this.isEditable())return Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.title(t.column.caption).text(n).attr("tabIndex","0")})).toDOM();var o=!1;return Object(a.i)(this.element).on("touchstart dblclick",(function(e){if(e instanceof TouchEvent&&!t.tapedTwice)return t.tapedTwice||(t.tapedTwice=!0,setTimeout((function(){t.tapedTwice=!1}),300)),!0;e.stopPropagation(),o=t.element.querySelector("a")==document.activeElement;var n=t.element.querySelector("."+t.cssPrefix+"-captionelement input"),i=t.element.querySelector("."+t.cssPrefix+"-captionelement a");return n&&(n.style.width=t.element.clientWidth+"px",i.style.display="none",n.style.removeProperty("display"),n.focus(),t.element.setAttribute(a.j.DRAG_DISABLED_ATTR,"")),!1})),Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(n).on("keydown",(function(e){var n=e;if((n.ctrlKey||n.metaKey)&&(13==n.keyCode||10==n.keyCode)&&t.isColumnActive()){var o=document.createEvent("MouseEvents");return o.initEvent("dblclick",!0,!0),t.element.dispatchEvent(o),n.stopPropagation(),!1}return!0}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,i=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,i=!1):e instanceof FocusEvent&&(n=!0),n){var r=e.target,s=r.parentElement.querySelector("a");s&&(s.style.removeProperty("display"),r.style.display="none"),i&&t.column.caption!==r.value?(t.column.caption=r.value,t.fireColumnChanged()):r.value=t.column.caption,t.element.removeAttribute(a.j.DRAG_DISABLED_ATTR),o&&t.element.querySelector("a").focus()}}))})).toDOM()},t.prototype.renderSortingImage=function(){var t=this,e=l.b+"-column-sortbutton",n=e;switch(this.column.sorting){case s.SortDirection.Ascending:n=e+"-asc";break;case s.SortDirection.Descending:n=e+"-desc"}return this.column.sorting==s.SortDirection.None?null:Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-sortimage-placeholder").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-img-sorting",n).title(r.g.getText("ButtonSorting"))})).toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,(this.getUIS()&&this.bar.sortMenu||this.bar.moveMenu).showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var o;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var i=n.bar.getQuery();n.column.sorting="None"==(o=t.id)?s.SortDirection.None:"Ascending"==o?s.SortDirection.Ascending:"Descending"==o?s.SortDirection.Descending:void 0,n.column.sortIndex=i.getColumnSortIndex(n.column),n.fireColumnChanged()}else n.bar.moveColumn(n.column,t.id)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}}),!1},t.prototype.renderSortingButton=function(){var t=this;if(!this.isEditable())return null;var e=Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-sortbutton",l.b+"-column-sortbutton-none").title(r.g.getText("ButtonSorting")).attr("tabIndex","0").on("touchstart click",(function(n){return t.buttonSortingClickHandler(n,e.toDOM())})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}));return e.toDOM()},t.prototype.buttonDeleteClickHandler=function(t){t.stopPropagation();var e=this.bar.getQuery();return e.removeColumn(this.column,this.bar),e.fireColumnsChangedEvent(s.QueryChangeAction.Delete,this.column),!1},t.prototype.renderDeleteButton=function(){var t=this;return this.column.isReadOnly()?null:Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-button-delete").title(r.g.getText("CmdDelete")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonDeleteClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM()},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.column.enabled?"":" "+this.cssPrefix+"-disabled",this.column.enabled&&(t+=this.column.isReadOnly()?" "+this.cssPrefix+"-readonly":""),t},t.prototype.buttonTypeClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeColumnTypeHandler(t),!1},t.prototype.buttonFormatClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeFormatHandler(t),!1},t.prototype.formatButtonIsShown=function(){return!1!==this.bar.options.allowDisplayFormatChange&&this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).length>0},t.prototype.changeFormatHandler=function(t){var e=this,n=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),o="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(o=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:o,itemSelectedCallback:function(t,n){return t.id!=o&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},t.prototype.renderColumnTypeButton=function(){var t=this;return!this.isEditable()||!1===this.bar.options.allowAggrColumns||this.column.getQuery().enableAggregation?null:Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-button-type").title(r.g.getText("ButtonToAggr")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonTypeClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM()},t.prototype.renderColumnFormatButton=function(){var t=this;return this.isEditable()&&this.formatButtonIsShown()?Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-button-format").title(r.g.getText("ButtonFormat")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonFormatClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseClick=function(t){this.bar.toggleColumnPicked(this.column),this.adjustButtonsVisibility()},t.prototype.onMouseEnter=function(t){if(!u.a.isMobileMode())return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){if(!u.a.isMobileMode())return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){u.a.isMobileMode()?this.onHideButtonsMobile&&this.onHideButtonsMobile():Object(a.i)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){u.a.isMobileMode()?this.onShowButtonsMobile&&this.onShowButtonsMobile():Object(a.i)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){this.bar.options.alwaysShowButtons||(this.bar.options.accentActiveColumn||u.a.isMobileMode())&&this.isColumnActive()?this.showButtons():this.hideButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){1==this.bar.options.alwaysShowButtons||this.isColumnActive()&&1==this.bar.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.bar.getContext().getModel().getAggrFunctions(),o=!0,i=null,s=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(s)>=0;this.column.expr.func!==u.id||c||(o=!1),c&&(t=this.bar.getContext().getModel().getAggrFunctionCaption(u.id),i={id:u.id,text:t},e.push(i))}}o||(this.column.expr.func=e[0].id),this.bar.areCustomExpressionsAllowed()&&(i={id:"CustomSqlDivider",text:"---"},e.push(i),i={id:"CUSTOMSQL",text:t=r.g.getText("CustomExpression")},e.push(i));var d=this.element.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new p(h)},t.prototype.createFormatsMenu=function(){if(0!=this.bar.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new p(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:r.g.getText("DisplayFormats",t.name)||t.name}})))},t}(),D=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.setValue(n,!0),this.column.caption="",this.refresh(),this.fireColumnChanged()},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.bar.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeToCustomSql=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.CustomSql),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,s.ExprTag.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){var e=this;this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return"CUSTOMSQL"==t.id?e.changeTypeToCustomSql():e.changeTypeToAggr(t.id),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},e}(k),S=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return S(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-aggr"},e.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.bar.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.classList.add("aggregated"),e.title=r.g.getText("ButtonToSimple")),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged()},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.EntityAttribute),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){this.changeTypeToSimple()},e}(M),I=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),O=function(t){function e(e,n){var o=t.call(this,e)||this;return o.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0},o.landingSlot=Object(a.i)("div").addClass(l.b+"-highlight").toDOM(),o.landingIndex=-1,o.sortMenuList=[{id:"None",text:r.g.getText("CmdNotSorted")},{id:"Ascending",text:r.g.getText("CmdAscending")},{id:"Descending",text:r.g.getText("CmdDescending")},{id:"---",text:"---"}],o.moveMenuList=[{id:"MoveTop",text:r.g.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.g.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.g.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.g.getText("CmdMoveToLast")}],Object(a.i)(o.slot).addClass(o.cssPrefix+"-panel").addClass(u.a.getMobileCssClass()),o.group=s.WidgetGroup.Query,o.customQuery=n,o}return I(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsBar"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.detachQueryObserver(),this.attachQueryObserver(),a.j.removeDropContainer(this.slot),this.options.allowDragDrop&&a.j.registerDropContainer({element:this.slot,scopes:["entityAttrSort"],onDragEnter:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragOver:function(t,e){o.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){e.dropEffect=a.d.Forbid,o.hideLandingSlot()},onDrop:function(t,e){var n=o.getQuery().getColumns().indexOf(e.data.column);o.moveColumnCore(n,o.landingIndex)}})},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var o=n.data;if(o&&(o.part==s.QueryChangePart.Columns||o.part==s.QueryChangePart.Aggregation||o.part==s.QueryChangePart.All)){var i=document.activeElement,r=t.slot.contains(i)||i==document.body;switch(o.action){case s.QueryChangeAction.Modify:var a=o.changee,l=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var o=t.renderColumn(e,n);if(r){var i=o.querySelector("a");i&&i.focus()}}};Array.isArray(a)?a.forEach((function(t){return l(t)})):l(a);break;case s.QueryChangeAction.Add:a=o.changee;var u=function(n){var o=e.getColumns().indexOf(n);t.addColumnElement(n,o)};Array.isArray(a)?a.forEach((function(t){return u(t)})):u(a);break;case s.QueryChangeAction.Delete:a=o.changee;var c=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var o=n.nextSibling,i=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=(o||i||t.addRowButton).querySelector("a");s&&s.focus()}}};Array.isArray(a)?a.forEach((function(t){return c(t)})):c(a);break;default:t.refresh()}}}))},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.getContext().getQuery()},e.prototype.destroyCore=function(){a.j.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.setOptions=function(t){this.options=r.i.assignDeep(this.options,t)},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),o=[],i=0;i<n.length;i++)"none"!==n[i].style.display&&o.push(n[i]);if(0!==o.length){var r=Object(a.k)(this.landingSlot);if(!(t>=r.x&&t<=r.x+this.landingSlot.offsetWidth&&e>=r.y&&e<=r.y+this.landingSlot.offsetHeight)){var s=this.landingIndex;for(i=0;i<o.length;i++){var l=o[i],u=Object(a.k)(l),c=l.offsetWidth,d=l.offsetHeight,h=.2*c;if(t>=u.x+h&&t<=u.x+c-h&&e>=u.y+2&&e<=u.y+d-2){s=t>r.x?i+1:i;break}}(s!=this.landingIndex||this.landingSlot.parentElement)&&(this.landingIndex=s,this.landingIndex<=0&&this.columnsBlock.insertBefore(this.landingSlot,o[0]),this.landingIndex<o.length?this.columnsBlock.insertBefore(this.landingSlot,o[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot))}}else this.landingIndex=0},e.prototype.hideLandingSlot=function(){this.landingIndex=-1,this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e.prototype.onProcessStartCore=function(){},e.prototype.onProcessEndCore=function(){},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.renderAddRowButton=function(){var t=this;Object(a.i)(this.addRowButton).addClass(l.b+"-addrow",this.cssPrefix+"-addrow",l.b+"-addrow-empty").addClass(u.a.getMobileCssClass()).title(r.g.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.addNewColumn(o),!1}})}))})),u.a.isMobileMode()&&Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.options.allowSorting&&this.createSortMenu(),this.createMoveMenu(),this.columnsBlock=Object(a.i)("div").addClass(this.cssPrefix+"-columns").addClass(u.a.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=Object(a.i)("div").toDOM(),u.a.isMobileMode()?Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton):Object(a.i)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),Object(a.i)(this.slot).addChildElement(this.columnsBlock).addChildElement(this.renderColumnButtonsBlockMobile()),this.getQuery().getColumns().forEach((function(e,n){var o=t.renderColumn(e);t.columnsBlock.appendChild(o)}))},e.prototype.renderColumnButtonsBlockMobile=function(){var t=this;return this.columnButtonsBlockMobileArrow=Object(a.i)("i").toDOM(),this.columnButtonsBlockMobile=Object(a.i)("div").addClass(this.cssPrefix+"-column-buttonsBlock").addClass(u.a.getMobileCssClass()).addChildElement(this.columnButtonsBlockMobileArrow).hide().toDOM(),this.buttonsBlockSortingButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-sortbutton-none").toDOM(),Object(a.i)(this.buttonsBlockSortingButton).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonSortingClickHandler.call(t.currentColumnRenderer,e,t.buttonsBlockSortingButton),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})),this.buttonsBlockTypeButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-button-type").on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonTypeClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockFormatButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-button-format").on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonFormatClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockDeleteButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-button-delete").on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonDeleteClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button-close-block").on("touchstart click",(function(){t.toggleColumnPicked(null),t.hideColumnButtonsMobile()})),this.columnButtonsBlockMobile},e.prototype.showColumnButtonsMobile=function(t,e,n){this.currentActiveColumn=t,this.currentColumnRenderer=e;var o=n.getBoundingClientRect(),i=n.offsetTop,r=n.offsetLeft;Object(a.i)(this.columnButtonsBlockMobileArrow).setStyle("left",(r+o.width/2).toString()+"px"),o.top>100?Object(a.i)(this.columnButtonsBlockMobile).removeClass("show-below").setStyle("top",(i-o.height).toString()+"px"):Object(a.i)(this.columnButtonsBlockMobile).addClass("show-below").setStyle("top",(i+o.height).toString()+"px"),t.enabled&&!t.isReadOnly()?(Object(a.i)(this.buttonsBlockSortingButton).show(),Object(a.i)(this.buttonsBlockTypeButton).show(),e.formatButtonIsShown()?Object(a.i)(this.buttonsBlockFormatButton).show():Object(a.i)(this.buttonsBlockFormatButton).hide()):(Object(a.i)(this.buttonsBlockSortingButton).hide(),Object(a.i)(this.buttonsBlockTypeButton).hide()),t.isReadOnly()?Object(a.i)(this.columnButtonsBlockMobile).hide():Object(a.i)(this.columnButtonsBlockMobile).show()},e.prototype.hideColumnButtonsMobile=function(){Object(a.i)(this.columnButtonsBlockMobile).hide()},e.prototype.renderColumn=function(t,e){var n=this,o=this.getColumnRenderer(t,e);if(o){var i=o.render();return o.onShowButtonsMobile=function(){n.showColumnButtonsMobile(t,o,i)},o.onHideButtonsMobile=function(){n.hideColumnButtonsMobile()},i}return null},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case s.ExprTag.AggregateFunction:return new B(this,t,e);case s.ExprTag.CustomSql:case s.ExprTag.EntityAttribute:case s.ExprTag.ParentEntityAttribute:return new M(this,t,e)}return null},e.prototype.addNewColumn=function(t,e){var n=this,o=this.getContext().getModel(),i=this.getQuery(),r=function(t){var e=o.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=o.getAttributeById(t))||!e.useInResult)return null}var r=i.createColumn();return r.caption=n.getDefaultColumnCaption(e),r.sorting=s.SortDirection.None,r.sortIndex=-1,r.expr.tag=s.ExprTag.EntityAttribute,r.expr.kind=s.DataKind.Attribute,r.expr.dataType=e.dataType,r.expr.setValue(t,!0),r.params.concat(e.params),r};if(this.getQuery()){var a,l;if(Array.isArray(t)){a=[];for(var u=0;u<t.length;u++)(l=r(t[u]))&&a.push(l)}else a=r(t);return this.addColumn(a,e),a}},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id="+t.id+"]"))&&(n=e.classList.contains("active"));for(var o=this.columnsBlock.querySelectorAll("."+this.cssPrefix+"-row"),i=0;i<o.length;i++){var r=o[i];Object(a.i)(r).removeClass("active").data("show-buttons",null)}e&&!n&&Object(a.i)(e).addClass("active").data("show-buttons","")},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireChangedEvent({part:s.QueryChangePart.Columns,action:s.QueryChangeAction.Add,changee:t})))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),o=this.renderColumn(t);n.length>0&&e<n.length-1?this.columnsBlock.insertBefore(o,n[e]):this.columnsBlock.appendChild(o),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(o)},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],o=0;o<e;o++)this.checkColumn(t[o])&&n.push(t[o]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=JSON.stringify(t.expr),o=0;o<e.length;o++){if(JSON.stringify(e[o].expr)===n)return null}return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu&&this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(n,this.options.menuOptions),this.entitiesMenu=new p(n)},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList.concat(this.moveMenuList),id:e,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new p(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n={items:this.moveMenuList,id:e,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(n,this.options.menuOptions),this.moveMenu=new p(n),n.searchBoxAlwaysShown=!1},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),o=n.indexOf(t);if(o>=0)switch(e){case"MoveTop":if(0==o)return;this.moveColumnCore(o,0);break;case"MoveUp":if(0==o)return;this.moveColumnCore(o,o-1);break;case"MoveDown":if(o==n.length-1)return;this.moveColumnCore(o,o+1);break;case"MoveBottom":if(o==n.length-1)return;this.moveColumnCore(o,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var o=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),i=o[t];e<=0?this.columnsBlock.insertBefore(i,this.columnsBlock[0]):e<o.length?this.columnsBlock.insertBefore(i,o[e]):this.columnsBlock.appendChild(i),n.moveColumn(t,e),n.fireColumnsChangedEvent(s.QueryChangeAction.All)}},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.options.allowCustomExpressions},e.globalCounter=0,e}(s.Widget),P=function(){function t(t,e,n){this.functionMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!0,configurable:!0}),t.prototype.render=function(){this.baseAttr=this.getAttribute();var t=Object(a.i)("div");return t.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(t.toDOM(),this.element),this.element=t.toDOM(),t.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderCaptionBlock()),this.isEditable()&&t.addChildElement(this.renderSortingButton()),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeById(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.caption;return this.isEditable()||(e+=function(t){switch(t){case s.SortDirection.Ascending:return" ↑";case s.SortDirection.Descending:return" ↓";default:return""}}(this.column.sorting)),Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass()).addChild("div",(function(n){return n.title(t.column.caption).text(e)})).toDOM()},t.prototype.renderSortingButton=function(){var t=this,e=l.b+"-column-sortbutton",n=e;switch(this.column.sorting){case s.SortDirection.None:n=e+"-none";break;case s.SortDirection.Ascending:n=e+"-asc";break;case s.SortDirection.Descending:n=e+"-desc"}var o=Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-sortimage-placeholder").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-img-sorting",n).title(r.g.getText("ButtonSorting"))})).on("touchstart click",(function(e){return t.buttonSortingClickHandler(e,o.toDOM())}));return o.toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,this.bar.sortMenu.showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var o;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var i=n.bar.getContext().getQuery();n.column.isJustSorted()&&"None"==t.id?(i.removeColumn(n.column,n.bar),i.fireColumnsChangedEvent(s.QueryChangeAction.Delete,n.column,!0)):(n.column.sorting="None"==(o=t.id)?s.SortDirection.None:"Ascending"==o?s.SortDirection.Ascending:"Descending"==o?s.SortDirection.Descending:void 0,n.column.sortIndex=i.getColumnSortIndex(n.column),n.fireColumnChanged())}},menuClosedCallback:function(){n.keepShowingButtons=!1}}),!1},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){return this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t}(),A=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),L=function(t){function e(e){var n=t.call(this,e)||this;return n.options={showAddRow:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null}},n.sortMenuList=[{id:"None",text:r.g.getText("CmdNotSorted")},{id:"Ascending",text:r.g.getText("CmdAscending")},{id:"Descending",text:r.g.getText("CmdDescending")}],Object(a.i)(n.slot).addClass(n.cssPrefix+"-panel").addClass(u.a.getMobileCssClass()),n.group=s.WidgetGroup.Query,n}return A(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"sortingBar"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver()},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t)},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;if(n&&(n.part==s.QueryChangePart.SortingColumns||n.part==s.QueryChangePart.Columns||n.part==s.QueryChangePart.All))switch(n.action){case s.QueryChangeAction.Modify:var o=n.changee,i=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");n&&t.renderColumn(e,n)};Array.isArray(o)?o.forEach((function(t){return i(t)})):i(o);break;case s.QueryChangeAction.Add:o=n.changee;var r=function(e){t.addColumnElement(e)};Array.isArray(o)?o.forEach((function(t){return r(t)})):r(o);break;case s.QueryChangeAction.Delete:o=n.changee;var a=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");n&&t.columnsBlock.removeChild(n)};Array.isArray(o)?o.forEach((function(t){return a(t)})):a(o);break;default:t.refresh()}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getContext().getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.clear()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.renderAddRowButton=function(){var t=this;Object(a.i)(this.addRowButton).addClass(l.b+"-addrow",this.cssPrefix+"-addrow",l.b+"-addrow-empty").addClass(u.a.getMobileCssClass()).title(r.g.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.addNewColumn(o),!1}})}))})),u.a.isMobileMode()&&Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!1,addUIS:!0}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};this.entitiesMenu=new p(n)},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList,id:e,searchBoxAlwaysShown:!1};this.sortMenu=new p(n)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.createSortMenu(),this.columnsBlock=Object(a.i)("div").addClass(this.cssPrefix+"-columns").addClass(u.a.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=Object(a.i)("div").toDOM(),u.a.isMobileMode()?Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton):Object(a.i)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),Object(a.i)(this.slot).addChildElement(this.columnsBlock);var e=this.context.getQuery();e.getColumns().concat(e.getJustSortedColumns()).forEach((function(e,n){var o=t.renderColumn(e);t.columnsBlock.appendChild(o)}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getContext().getModel(),o=this.getContext().getQuery();if(this.getContext().getQuery())return this.addColumn(function(t){var i=n.getAttributeById(t);if(!i)return null;if(!i.useInSorting){if(!i.lookupAttr)return null;if(t=i.lookupAttr,!(i=n.getAttributeById(t))||!i.useInSorting)return null}var r=o.createColumn(!0);return r.caption=e.getDefaultColumnCaption(i),r.sorting=s.SortDirection.Ascending,r.sortIndex=e.getQuery().getColumnSortIndex(r),r.expr.tag=s.ExprTag.EntityAttribute,r.expr.setValue(t,!0),r.params.concat(i.params),r}(t))},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.addColumn=function(t){var e=this.getContext().getQuery();if(e&&(t=this.checkColumn(t)))return t=e.addColumn({caption:t.caption,attributeId:t.expr.value,sorting:t.sorting,sortIndex:t.sortIndex,justsorted:!0}),e.fireChangedEvent({part:s.QueryChangePart.SortingColumns,action:s.QueryChangeAction.Add,changee:t}),t},e.prototype.checkColumn=function(t){for(var e=this.getContext().getQuery(),n=e.getColumns().concat(e.getJustSortedColumns()),o=JSON.stringify(t.expr.saveToData()),i=0;i<n.length;i++){if(JSON.stringify(n[i].expr.saveToData())===o)return null}return t},e.prototype.renderColumn=function(t,e){var n=new P(this,t,e);return n?n.render():null},e.prototype.addColumnElement=function(t){var e=this.renderColumn(t);this.columnsBlock.appendChild(e),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(e)},e.prototype.clear=function(){this.slot.innerHTML=""},e}(s.Widget);!function(t){t[t.None=0]="None",t[t.Value=1]="Value",t[t.Attribute=2]="Attribute",t[t.Operator=4]="Operator",t[t.Addition=8]="Addition",t[t.Removal=16]="Removal",t[t.All=255]="All",t[t.NoAddition=-9]="NoAddition",t[t.NoRemoval=-17]="NoRemoval",t[t.FixedConditionList=5]="FixedConditionList"}(g||(g={}));var R,_=function(){function t(t,e,n){this.panel=t,this.text=e,this.element=n||Object(a.i)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.render=function(){var t=this;return Object(a.i)(this.element).html("").addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChild("span",(function(e){return e.text(t.text).title(t.text)})).toDOM(),this.element},t.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement"},t}(),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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){t[t.AddCondition=0]="AddCondition",t[t.AddGroup=1]="AddGroup",t[t.Enable=2]="Enable",t[t.Delete=4]="Delete",t[t.Menu=5]="Menu",t[t.Parameterized=6]="Parameterized",t[t.InJoin=7]="InJoin"}(R||(R={}));var j=function(){function t(t,e,n){this.panel=t,this.condition=e,this.element=n||Object(a.i)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.clear=function(){this.element&&(this.element.className="",this.element.removeAttribute("data-id"),this.element.removeAttribute("style"),Object(a.i)(this.element).html(""))},t.prototype.render=function(t){return this.clear(),this.coreRender(t),this.panel.options.onConditionRendered&&this.panel.options.onConditionRendered(this.condition,this.element),this.element},t.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()},t}(),Q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return F(e,t),e.prototype.getClassesToAdd=function(){var t=this.cssPrefix+"-row "+this.cssPrefix+"-row-condition";if(t+=this.condition.isInJoin()?" "+this.cssPrefix+"-condition-injoin":"",t+=this.condition.isParameterized()?" "+this.cssPrefix+"-condition-parameterized":"",!u.a.isMobileMode()){var e=this.condition.getLevel();e>0&&(t+=" "+this.cssPrefix+"-level-"+e)}return t+=this.condition.enabled?"":" "+this.cssPrefix+"-disabled",this.condition.enabled&&(t+=this.condition.isReadOnly()?" "+this.cssPrefix+"-readonly":""),t},e.prototype.coreRender=function(t){var e=this,n=this.panel.getContext().getModel(),o=n.getOperatorById(this.condition.getOperatorId()),i=s.equtils.parseOperatorFormat(o),r=null,l=i.length,c=Object(a.i)("div");this.element&&this.element.parentNode&&this.element.parentNode.replaceChild(c.toDOM(),this.element),this.element=c.toDOM(),c.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).data("id",this.condition.id).data("condrow","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction());for(var d=t,h=o==n.nullOperator?Math.min(l,this.condition.expressions.length+1):l,p=function(t){if("operator"===(r=i[t]).type){var e=f.panel.getOperatorRenderer(f.condition,r.text);e&&c.addChildElement(e.render())}else if("expression"===r.type){var n=d&&r.index>0,o=f.panel.getExpressionRenderer(f.condition.expressions[r.index]);if(o){var s=o.render(n);c.addChildElement(s),setTimeout((function(){o.adjustWidth()}),100)}d=d&&!n}else"text"===r.type&&c.addChildElement(new _(f.panel,r.text).render())},f=this,g=0;g<h;g++)p(g);(this.panel.options.accentActiveCondition||u.a.isMobileMode())&&c.on("click",(function(t){return t.stopPropagation(),e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),u.a.isMobileMode()||e.element.dispatchEvent(Object(a.h)("mouseenter")),!1})),c.addChildElement(this.renderButtonsBlock()),u.a.isMobileMode()||c.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&Object(a.i)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.setConditionParameterized=function(t){this.condition.setParameterized(t),this.condition.fireChangedEvent()},e.prototype.setConditionInJoin=function(t){this.condition.setInJoin(t),this.condition.fireChangedEvent()},e.prototype.getConditionMenu=function(){return this.panel.getConditionMenu()},e.prototype.renderConjunction=function(){var t=this.condition.getParent();if(!t)return null;var e=0==r.i.findItemIndexById(t.getConditions(),this.condition.id);if(this.panel.options.showConjunctions&&!e){var n=s.equtils.linkTypeToStr(this.condition.getParent().linkType),o=r.g.getText("Conj"+n);return Object(a.i)("span").text(o).title(o).addClass(this.cssPrefix+"-condelement "+this.cssPrefix+"-condition-conjuction").toDOM()}return null},e.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.condition.isReadOnly()?Object(a.i)("div").title(r.g.getText("CmdToggleEnable")).attr("tabIndex","0").addClass(this.cssPrefix+"-condelement "+this.cssPrefix+"-condition-checkbox").addClass(this.condition.enabled?"enabled":"").on("click",(function(){return t.condition.enabled=!t.condition.enabled,t.condition.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},e.prototype.isConditionActive=function(){return this.element.classList.contains("active")},e.prototype.hideButtons=function(){Object(a.i)(this.element).data("show-buttons",null)},e.prototype.showButtons=function(){Object(a.i)(this.element).data("show-buttons","")},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInConditions||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e.prototype.enterButtonBlock=function(){this.showButtons()},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInConditions||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.conditionMenuHandler=function(t,e){var n=this;switch(t){case R.AddCondition:if(!this.condition.isGroup())return;var o=this.panel.getEntitiesMenu();o&&o.showMenu({anchor:e.target,itemSelectedCallback:function(t){var e=n.panel.getQuery(),o={parent:n.condition,attributeId:t.id},i=e.addSimpleCondition(o);return i&&e.fireConditionsChangedEvent(s.QueryChangeAction.Add,i),!1}});break;case R.AddGroup:if(!this.condition.isGroup())return;var i=this.panel.getQuery(),r={parent:this.condition},a=this.panel.getQuery().addConditionGroup(r);a&&i.fireConditionsChangedEvent(s.QueryChangeAction.Add,a);break;case R.Enable:this.condition.enabled=!this.condition.enabled,this.condition.fireChangedEvent();break;case R.Delete:var l=this.condition.getParent();if(!l)return;var u=l.getConditions(),c=u.indexOf(this.condition);c>=0&&(u.splice(c,1),this.condition.getQuery().fireConditionsChangedEvent(s.QueryChangeAction.Delete,this.condition));break;case R.Menu:var d=this.getConditionMenu();this.keepShowingButtons=!0,d.showMenu({anchor:e.target,selectedIds:this.getConditionMenuSelectedItems(),itemSelectedCallback:function(t){var o;switch(t.id){case"enable":o=R.Enable;break;case"delete":o=R.Delete;break;case"param":o=R.Parameterized;break;case"inJoin":o=R.InJoin;break;case"addCondition":o=R.AddCondition;break;case"addGroup":o=R.AddGroup}n.conditionMenuHandler(o,e)},itemFilterCallback:function(t){var e=n.condition.enabled||"enable"===t.id||"delete"===t.id;if("enable"===t.id){var o=n.condition.getParent();e=e&&o&&o.enabled}else"delete"===t.id?e=e&&(n.panel.options.editableParts&g.Removal)===g.Removal:"addGroup"!==t.id&&"addCondition"!==t.id||(e=e&&(n.panel.options.editableParts&g.Addition)===g.Addition);return e},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;case R.Parameterized:this.condition.setParameterized(!this.condition.isParameterized()),this.condition.fireChangedEvent();break;case R.InJoin:this.condition.setInJoin(!this.condition.isInJoin()),this.condition.fireChangedEvent()}return e.stopPropagation(),!1},e.prototype.getConditionMenuSelectedItems=function(){var t=[];return this.condition.enabled&&t.push("enable"),this.condition.isParameterized()&&t.push("param"),this.condition.isInJoin()&&t.push("inJoin"),t},e.prototype.renderButtonsBlock=function(){var t=this,e=function(e){Object(a.i)(e.target).addClass(t.cssPrefix+"-condition-button-active")},n=function(e){Object(a.i)(e.target).removeClass(t.cssPrefix+"-condition-button-active")},o=Object(a.i)("div").addClass(this.cssPrefix+"-condition-buttonsBlock").addClass(u.a.getMobileCssClass());if(this.buttonsBlock=o.toDOM(),this.condition.isReadOnly())return this.buttonsBlock;var i=this.getButtonsToShow();return i.indexOf("addCondition")>=0&&this.condition.enabled&&(this.panel.options.editableParts&g.Addition)==g.Addition&&o.addChild("div",(function(o){o.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(o){o.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-addCondition").attr("tabIndex","0").data("button","").title(r.g.getText("CmdAddCondition")).on("click",(function(e){return t.conditionMenuHandler(R.AddCondition,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),(i.indexOf("addGroup")>=0||i.indexOf("addPredicate")>=0)&&this.condition.enabled&&(this.panel.options.editableParts&g.Addition)==g.Addition&&o.addChild("div",(function(o){o.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(o){o.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-addPredicate").attr("tabIndex","0").data("button","").title(r.g.getText("CmdAddCondGroup")).on("click",(function(e){return t.conditionMenuHandler(R.AddGroup,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("enable")>=0&&this.condition.getParent()&&this.condition.getParent().enabled&&o.addChild("div",(function(o){o.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(o){o.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-enable").attr("tabIndex","0").data("button","").title(r.g.getText("CmdToggleEnable")).addClass(t.condition.enabled?"enabled":"").on("click",(function(e){return t.conditionMenuHandler(R.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("delete")>=0&&this.condition.getParent()&&(this.panel.options.editableParts&g.Removal)==g.Removal&&o.addChild("div",(function(o){o.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(o){o.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-delete").attr("tabIndex","0").data("button","").title(r.g.getText("CmdDelete")).on("click",(function(e){return t.conditionMenuHandler(R.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("menu")>=0&&o.addChild("div",(function(o){o.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(o){o.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-menu").attr("tabIndex","0").data("button","").title(r.g.getText("ButtonMenu")).on("click",(function(e){return t.conditionMenuHandler(R.Menu,e)})),u.a.isMobileMode()||o.on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.adjustButtonsVisibility(),this.buttonsBlock},e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.condition&&Array.isArray(this.panel.options.buttons.condition)?this.panel.options.buttons.condition:["enable","delete"]},e}(j),N=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),q=function(t){function e(e){var n=t.call(this,"a",e)||this;return n.attr("href","javascript:void(0)"),n.on("click",(function(t){return t.preventDefault(),n.appear(),!1})),n}return N(e,t),e.prototype.onGetMenu=function(t){return this._onGetMenu=t,this},e.prototype.onItemSelected=function(t){return this._onItemSelected=t,this},e.prototype.appear=function(){var t=this,e=this._onGetMenu?this._onGetMenu():null;e&&e.showMenu({anchor:this.element,itemSelectedCallback:function(e){return t._onItemSelected&&t._onItemSelected(e.id),!1}})},e}(a.c);function H(t){return new q(t)}var W,G=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),V=function(t){function e(e,n,o){var i=t.call(this,e,n,o)||this;return i.isRoot=!n.getParent(),i}return G(e,t),e.prototype.getClassesToAdd=function(){var t=this.cssPrefix+"-group";return this.isRoot&&(t+=" "+this.cssPrefix+"-group-root"),t},e.prototype.coreRender=function(t){Object(a.i)(this.element).addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderGroupRow()).addChildElement(this.renderConditions(t)).data("id",this.condition.id).data("group","")},e.prototype.renderGroupRow=function(){return this.isRoot&&!this.panel.options.showRootRow?null:new z(this.panel,this.condition).render()},e.prototype.renderConditions=function(t){var e=this,n=Object(a.i)("div");return n.addClass(this.cssPrefix+"-conditions").addClass(""+u.a.getMobileCssClass()).data("conditions",""),this.isRoot&&n.addClass(this.cssPrefix+"-conditions-root"),this.condition.getConditions().forEach((function(o,i,r){var s=e.panel.getConditionRenderer(o);s&&n.addChildElement(s.render(t&&i==r.length-1))})),n.toDOM()},e}(j),z=function(t){function e(e,n,o){var i=t.call(this,e,n,o)||this;return i.isRoot=!i.condition.getParent(),i}return G(e,t),e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.group&&Array.isArray(this.panel.options.buttons.group)?this.panel.options.buttons.group:["addCondition","addGroup","enable","delete"]},e.prototype.getClassesToAdd=function(){var t;if(this.isRoot)t=this.cssPrefix+"-row "+this.cssPrefix+"-row-group "+this.cssPrefix+"-row-group-root";else{t=this.cssPrefix+"-row "+this.cssPrefix+"-row-group";var e=this.condition.getLevel();e>0&&(t+=" "+this.cssPrefix+"-level-"+e),t+=this.condition.enabled?"":" "+this.cssPrefix+"-disabled",this.condition.enabled&&(t+=this.condition.isReadOnly()?" "+this.cssPrefix+"-readonly":"")}return t},e.prototype.coreRender=function(t){var e=this,n=Object(a.i)(this.element).addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).data("group-row","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction()),o=this.condition.getLevel();o>0&&n.addClass(this.cssPrefix+"-level-"+o),this.buildGroupElements(n,this.getGroupTitle()),this.panel.options.accentActiveCondition&&n.on("click",(function(t){e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),u.a.isMobileMode()||n.toDOM().dispatchEvent(Object(a.h)("mouseenter"))})),n.addChildElement(this.renderButtonsBlock()),u.a.isMobileMode()||n.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&Object(a.i)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.getGroupTitle=function(){var t;return this.isRoot&&!u.a.isMobileMode()?(t=r.g.getText("RootConditionGroupTitle"))||(t=r.g.getText("RootPredicateTitle")):(t=r.g.getText("ConditionGroupTitle"))||(t=r.g.getText("PredicateTitle")),t},e.prototype.buildGroupElements=function(t,e){var n=this,o=e.indexOf("{lt}");if(o<0)t.addText(r.g.getText("ErrIncorrectGroupTitleFormat")),t.addClass(this.cssPrefix+"-error");else{o>0&&t.addChild("span",(function(t){t.addClass(n.cssPrefix+"-grelement").addText(e.substring(0,o))}));var i=s.equtils.linkTypeToStr(this.condition.linkType),a=r.i.findItemById(s.eqconsts.predicateLinkTypeList,i);a||(a=s.eqconsts.predicateLinkTypeList[0]),this.isEditable()?H(t.toDOM()).onGetMenu((function(){return n.getLinkTypeMenu()})).onItemSelected((function(t){n.condition.linkType=s.equtils.strToLinkType(t),n.condition.fireChangedEvent()})).addText(r.g.getText(a.key)).title(r.g.getText(a.key)).addClass(this.cssPrefix+"-grelement"):t.addChild("span",(function(t){t.text(r.g.getText(a.key)).title(r.g.getText(a.key)).addClass(n.cssPrefix+"-grelement")})),t.addChild("span",(function(t){t.addClass(n.cssPrefix+"-grelement").addText(e.substring(o+4))}))}},e.prototype.getConditionMenu=function(){return this.panel.getConditionGroupMenu(null==this.condition.getParent())},e.prototype.getLinkTypeMenu=function(){return this.panel.getLinkTypeMenu()},e.prototype.renderConjunction=function(){return this.isRoot?null:t.prototype.renderConjunction.call(this)},e.prototype.renderCheckbox=function(){return this.isRoot?null:t.prototype.renderCheckbox.call(this)},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInGroups||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInGroups||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e}(Q),U=function(){function t(t){this.element=t||Object(a.i)("div").toDOM()}return t.prototype.refresh=function(){this.render()},t.prototype.render=function(t){var e=this;return void 0===t&&(t=!1),this.labelElement=this.renderLabelElement(),Object(a.i)(this.element).html("").addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.labelElement),this.isEditable()&&(this.renderEditor(),t&&setTimeout((function(){return e.showEditor()}),50)),this.element},t.prototype.isEditable=function(){return!0},t.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?Object(a.i)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():Object(a.i)("span").title(e).text(e).toDOM()},t.prototype.getClassesToAdd=function(){return""},t.prototype.getLabelText=function(){return this.getEmptyText()},t.prototype.getEmptyText=function(){return"<empty>"},t}(),J=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Y=function(t){function e(e,n,o,i){var r=t.call(this,i)||this;return r.panel=e,r.expression=n,r.valueEditor=o,r}return J(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.render=function(e){return void 0===e&&(e=!1),t.prototype.render.call(this,e),this.panel.options.onExpressionRendered&&this.panel.options.onExpressionRendered(this.expression,this.element),this.element},e.prototype.getContext=function(){return this.panel.getContext()},e.prototype.isReadOnly=function(){var t=this.expression.getParent();return!t.enabled||t.isReadOnly()},e.prototype.isEditable=function(){return!this.isReadOnly()},e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement "+this.cssPrefix+"-valueelement"},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.value},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.g.getText("MsgEmptyScalarValue")},e.prototype.setValue=function(t,e){this.expression.setValue(t),e||this.expression.getParent().fireChangedEvent(s.ConditionPart.Value)},e.prototype.getValue=function(){return this.expression.value},e.prototype.validateInput=function(t){return{success:!0,value:t}},e.prototype.showValidationError=function(t,e){this.getContext().throwError({action:"ui.validation",text:t})},e.prototype.isEmptyValue=function(){var t=this.getValue();return null==t||!t},e.prototype.adjustWidth=function(){},e}(U),K=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),X=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return K(e,t),e.prototype.renderEditor=function(){var t=this;this.inputBuilder=Object(a.i)("input").hide().addClass(this.cssPrefix+"-ve-editbox").type("text").on("blur",(function(e){if(t.inputBuilder.isVisible()&&!t.dontProcessBlur){var n=t.validateInput(t.inputElement.value);return n.success?(t.setValue(t.inputElement.value),t.closeEditor()):(t.dontProcessBlur=!0,t.inputElement.focus(),setTimeout((function(){t.dontProcessBlur=!1}),200),t.showValidationError(n.message,e.target)),e.stopPropagation(),!1}})).on("keydown",(function(e){return 27===e.keyCode?(t.closeEditor(),e.stopPropagation(),!1):13===e.keyCode&&t.inputBuilder.isVisible()?(t.dontProcessBlur=!0,t.validateInput(t.inputElement.value).success?(t.setValue(t.inputElement.value),t.closeEditor(),t.dontProcessBlur=!1):(t.inputElement.focus(),setTimeout((function(){t.dontProcessBlur=!1}),200)),e.stopPropagation(),!1):void 0})),this.inputElement=this.inputBuilder.toDOM(),Object(a.i)(this.element).addChildElement(this.inputElement)},e.prototype.showEditor=function(){var t=200;if(!u.a.isMobileMode()){var e=this.element.offsetLeft,n=this.element.offsetWidth>t?this.element.offsetWidth:t,o=this.element.parentElement.clientWidth-e-55;this.inputBuilder.removeStyle("left").removeStyle("right"),o<t?this.inputBuilder.setStyle("right","55px").setStyle("width","200px"):o<n?this.inputBuilder.setStyle("left",e+"px").setStyle("width",o+"px"):this.inputBuilder.setStyle("left",e+"px").setStyle("width",n+"px")}Object(a.i)(this.labelElement).hide(),this.inputBuilder.value(this.getValue()).show(),this.inputElement.focus()},e.prototype.closeEditor=function(){this.inputBuilder.hide(),Object(a.i)(this.labelElement).show(),this.labelElement.focus()},e.prototype.validateInput=function(t){this.inputBuilder.removeClass("eqjs-invalid");var e={success:!0,value:t};return this.expression.kind==s.DataKind.List?this.validateListInput(t,e):this.validateScalarInput(t,e),e},e.prototype.validateListInput=function(t,e){for(var n=0,o=t.split(/\s*,\s*/);n<o.length;n++){var i=o[n];if(this.validateScalarInput(i,e),!e.success)return}},e.prototype.validateScalarInput=function(t,e){if(t&&r.i.isNumericType(this.expression.dataType)){var n=+t;isNaN(n)&&(e.success=!1,e.message='"'+t+'" '+r.g.getText("ErrNotNumber")),r.i.isIntType(this.expression.dataType)&&n!=parseInt(t,10)&&(e.success=!1,e.message='"'+t+'" '+r.g.getText("ErrIncorrectInteger"))}},e.prototype.showValidationError=function(e,n){t.prototype.showValidationError.call(this,e,n),this.inputBuilder.addClass("eqjs-invalid")},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&g.Value)===g.Value},e}(Y),Z=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.menuItemsList=[],e.showWhenReady=!1,e}return Z(e,t),e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&g.Value)===g.Value},e.prototype.setValue=function(t,e){void 0===e&&(e=!1);var n=this.adjustNewValue(t);if(t!==this.expression.value){var o=this.getValueText(t);this.expression.setContent(n,o),e||this.expression.getParent().fireChangedEvent(s.ConditionPart.Value)}return!0},e.prototype.getValueText=function(t){var e="";if(Array.isArray(t))for(var n=0,o=this.menuItemsList;n<o.length;n++){var i=o[n];t.indexOf(i.id)>=0&&(e+=i.text+",")}else for(var r=0,s=this.menuItemsList;r<s.length;r++){(i=s[r]).id===t&&(e+=i.text+",")}return e&&(e=e.substring(0,e.length-1)),e},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextList||r.g.getText("MsgEmptyListValue")},e.prototype.getListName=function(){return this.valueEditor.name},e.prototype.renderEditor=function(){var t=this;this.fillMenuItemsList((function(){t.renderMenuBlock()}))},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.getText()},e.prototype.showLoader=function(){},e.prototype.hideLoader=function(){},e.prototype.showEditor=function(){var t=this;this.menu?this.menu.showMenu({anchor:this.labelElement,selectedIds:this.getValuesAsArray(),itemSelectedCallback:function(e,n){if(t.menu.options.multiselect){if(n){for(var o=[],i=n.length,r=0;r<i;r++)o.push(n[r].id);t.setValue(o)}}else t.setValue(e.id);return!1}}):(this.showWhenReady=!0,this.showLoader())},e.prototype.closeEditor=function(){this.menu.hideMenu()},e.prototype.renderMenuBlock=function(){var t=!1;this.expression&&(t=this.expression.kind===s.DataKind.List);var e=this.panel,n={items:this.menuItemsList,multiselect:t,container:e?e.options.menuContainer:null,showSelected:!0};e&&r.i.assignDeep(n,e.options.menuOptions);var o=this.element.id;o&&(n.id=o+"-EditorMenu"),e&&(n.domWriteItemsId=e.options.domWriteItemsId),n.buttons={submit:r.g.getText("ButtonApply"),cancel:r.g.getText("ButtonCancel")},this.menu=new p(n)},e.prototype.getValuesAsArray=function(){if(this.expression.kind!==s.DataKind.List)return[this.expression.value];var t=this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);return t?t.map((function(t){return'"'==t.charAt(0)&&'"'==t.charAt(t.length-1)?(t=t.substring(1,t.length-1)).replace(/\"/g,'"'):t})):[]},e.prototype.adjustNewValue=function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(",")>=0?'"'+(t=t.replace(/"/g,'"'))+'"':t})).join(","):t},e.prototype.fillMenuItemsList=function(t){this.menuItemsList=this.valueEditor.values,t&&t()},e.prototype.takeDefaultValue=function(){if(this.menuItemsList)for(var t=this.menuItemsList.length,e=0;e<t;e++){var n=this.menuItemsList[e];if(n.isDefault){this.setValue(n.id,!0);break}}},e}(Y),tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isLoading=!1,e.onClickTemp=null,e}return Z(e,t),e.prototype.renderEditor=function(){var t=this;this.isLoading||(this.isLoading=!0,this.fillMenuItemsList((function(){if(t.isLoading=!1,t.isEmptyValue()&&t.takeDefaultValue(),!t.expression.isEmpty()&&t.expression._isDefaultValue){var e=t.getValueText(t.expression.value);t.expression.setContent(t.expression.value,e),t.expression.getParent().fireChangedEvent()}t.renderMenuBlock(),t.showWhenReady&&(t.showWhenReady=!1,t.hideLoader(),t.showEditor())})))},e.prototype.showLoader=function(){this.labelElement.style.display="none",this.loaderElement||(this.loaderElement=Object(a.i)("div",this.element).addClass(this.cssPrefix+"-ve-loader").toDOM()),this.loaderElement.style.display="block"},e.prototype.hideLoader=function(){this.loaderElement.style.display="none",this.labelElement.removeAttribute("style")},e.prototype.fillMenuItemsList=function(t){var e=this,n=this.getListName(),o=this.panel.getContext().getListRequestHandler();s.eqconsts.constLists[n]?(this.menuItemsList=s.eqconsts.constLists[n],t&&t()):o&&o({listName:n,editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}($),et=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Z(e,t),e.prototype.fillMenuItemsList=function(t){var e=this,n=this.panel.getContext(),o=(this.valueEditor,n.getListRequestHandler());o&&o({listName:"SQL",editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(tt),nt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ot=function(t){function e(e,n,o,i){var r=t.call(this,e,n,null,i)||this;return r.menu=o,r}return nt(e,t),e.prototype.renderEditor=function(){},e.prototype.getLabelText=function(){var t=this.panel.getContext().getModel(),e=this.expression.value,n=e?t.getAttributeByIdSafe(e):null,o=this.panel.options.attrElementFormat;return n?t.getAttributeText(n,o):this.getEmptyText()},e.prototype.setValue=function(e,n){void 0===n&&(n=!1),n=n&&e!==this.expression.value;var o=t.prototype.setValue.call(this,e,!0);return n||this.expression.getParent().fireChangedEvent(s.ConditionPart.EntityAttr|s.ConditionPart.Operator),o},e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&g.Attribute)===g.Attribute},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextAttribute||r.g.getText("MsgEmptyAttrValue")},e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement "+this.cssPrefix+"-attrelement"},e.prototype.adjustWidth=function(){u.a.isMobileMode()||this.element.clientWidth>this.element.parentElement.clientWidth/2&&Object(a.i)(this.element).addClass(this.cssPrefix+"-attrelement-wide")},e}($),it=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),rt=function(t){function e(e){return t.call(this,e)||this}return it(e,t),e.prototype.showEditor=function(){var t=this,e=this.getMenu();e&&e.showMenu({anchor:this.labelElement,itemSelectedCallback:function(e){return t.itemSelected(e.id),!1}})},e.prototype.closeEditor=function(){var t=this.getMenu();t&&t.hideMenu()},e}(U),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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),at=function(t){function e(e,n,o){var i=t.call(this,o)||this;return i.panel=e,i.menu=n,i}return st(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.getLabelText=function(){return r.g.getText("CmdClickToAddCondition")},e.prototype.getClassesToAdd=function(){return l.b+"-addrow "+this.cssPrefix+"-addrow"},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&g.Addition)===g.Addition},e.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?this.labelElement=Object(a.i)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():this.labelElement=Object(a.i)("div").toDOM(),this.labelElement},e.prototype.renderEditor=function(){},e.prototype.itemSelected=function(t){var e=this.panel.getQuery(),n={parent:e.getRootCondition(),attributeId:t},o=e.addSimpleCondition(n);o&&e.fireConditionsChangedEvent(s.QueryChangeAction.Add,o)},e.prototype.getMenu=function(){return this.menu},e}(rt),lt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ut=function(t){function e(e,n,o,i){var r=t.call(this,i)||this;return r.panel=e,r.condition=n,r.displayedText=o,r}return lt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.renderEditor=function(){var t=this,e=this.panel.getContext().getModel(),n=this.panel.getQuery(),o=[],i=(this.condition&&this.condition.expressions&&this.condition.expressions[0]?this.condition.expressions[0].value:null)?e.getAttributeById(this.condition.expressions[0].value):null;i&&i.operators&&i.operators.forEach((function(i){var a=e.getOperatorById(i),l=function(t){return t.defaultOperand.kind==s.DataKind.Query}(a);!n.isEx()&&l||!a||t.panel.options.isSubQuery&&l||o.push({id:i,text:r.g.getText("Operators",i,"caption")||a.caption})}));var a={items:o,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:r.i.generateId("opmn"),domWriteItemsId:this.panel.options.domWriteItemsId};r.i.assign(a,this.panel.options.menuOptions),this.menu=new p(a)},e.prototype.getLabelText=function(){return this.displayedText},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextOperator||r.g.getText("MsgEmptyOperator")},e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement "+this.cssPrefix+"-operelement"},e.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()&&(this.panel.options.editableParts&g.Operator)===g.Operator},e.prototype.itemSelected=function(t){this.condition.setOperatorId(t),this.condition.fireChangedEvent(s.ConditionPart.Operator)},e.prototype.getMenu=function(){return this.menu},e}(rt),ct=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),dt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dtp=null,e.internalDateFormat="yyyy-MM-dd",e.internalTimeFormat="HH:mm",e}return ct(e,t),e.prototype.renderEditor=function(){},e.prototype.showEditor=function(){var t=this;if(!this.dtp){var e={yearRange:this.panel.options.yearRange,showCalendar:this.expression.dataType!==r.d.Time,showTimePicker:this.expression.dataType!==r.d.Date,oneClickDateSelection:this.panel.options.oneClickDateSelection,showDateTimeInput:this.panel.options.showDateTimeInput,onApply:function(e){var n=t.convertToInternalFormat(e);t.setValue(n),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onCancel:function(){t.labelElement.innerText=t.getLabelText(),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onDateTimeChanged:function(e){var n=r.g.dateTimeToStr(e,t.expression.dataType);t.labelElement.innerText=n}};this.dtp=this.panel.options.dateTimePickerResolver?this.panel.options.dateTimePickerResolver(e):new a.a(e);var n=this.expression.getModel(),o=this.expression.value,i=new Date;i=this.expression.dataType!=r.d.Time&&n.isDateMacro(o)?n.getDateMacroValue(o):this.expression.dataType==r.d.Time&&n.isTimeMacro(o)?n.getTimeMacroValue(o):this.convertFromInternalFormat(o),this.dtp.setDateTime(i),this.dtp.show(this.element)}},e.prototype.closeEditor=function(){this.dtp.cancel(),this.dtp=null},e.prototype.getLabelText=function(){if(!this.expression.value)return this.getEmptyText();var t=this.expression.value,e=this.expression.getModel();if(!e)throw new Error("DataModel is not defined for "+this.expression.value);if(e.isDateMacro(t)||e.isTimeMacro(t)){var n=t.substring(3,t.length-2),o=r.g.getText(n);return o||"${{Today}}"}return r.g.dateTimeToStr(this.convertFromInternalFormat(t),this.expression.dataType)},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&g.Value)===g.Value},e.prototype.convertFromInternalFormat=function(t){return r.i.strToDateTime(t,this.internalDateFormat+" "+this.internalTimeFormat)},e.prototype.convertToInternalFormat=function(t){return r.i.dateTimeToStr(t,this.internalDateFormat+" "+this.internalTimeFormat)},e}(Y),ht=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ht(e,t),e.prototype.renderEditor=function(){this.dialogBlockBody=Object(a.i)("div").addClass("kfrm-form").toDOM(),this.createEntitiesMenu(),this.renderColumnBlock(),this.renderQueryPanelBlock()},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&g.Value)===g.Value},e.prototype.setValue=function(t,e){t instanceof s.Query&&(this.expression.subQuery=t,e||this.expression.getParent().fireChangedEvent(s.ConditionPart.Value))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel(),e=this.expression.dataType;if(this.colEntitiesList=t.getEntitiesTreeWithFilter((function(t,n){return n?n.useInConditions&&n.dataType===e:t.attributes&&t.useInConditions})),!t||t.isEmpty())return null;var n=this.element.getAttribute("data-id");n&&(n+="-SubColumnMenu");var o={items:this.colEntitiesList,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:n,isSubQuery:!0,domWriteItemsId:this.panel.options.domWriteItemsId};r.i.assign(o,this.panel.options.menuOptions),this.colEntitiesMenu=new p(o)},e.prototype.renderColumnBlock=function(){var t=this;this.columnBlock=Object(a.i)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.g.getText("SubQueryColumnTitle"))})).addChild("a",(function(e){return t.columnElement=e.attr("href","javascript:void(0)").on("click",(function(e){t.colEntitiesMenu.showMenu({anchor:t.columnElement,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;return t.setResultAttributeId(o),!1}})})).toDOM()})).toDOM()},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.g.getText("MsgSubQueryValue")},e.prototype.renderQueryPanelBlock=function(){var t=Object(a.i)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.g.getText("SubQueryQueryPanelCaption"))})).toDOM();this.queryPanelBlock=Object(a.i)("div",t).toDOM();var e=this.element.getAttribute("data-id");e&&(this.queryPanelBlock.id=e+"-SubQueryPanel")},e.prototype.setResultAttributeId=function(t){var e=this.getContext().getModel().getAttributeById(t);if(e){var n=this.getSubQuery(),o=n.getColumns(),i=void 0;if(o.length>0)(i=o[0]).expr.setValue(t),i.expr.dataType=e.dataType,i.fireChangedEvent();else{(i=n.createColumn()).sorting=s.SortDirection.None,i.sortIndex=-1;var r=new s.Expression(i);r.setValue(t),r.tag=s.ExprTag.EntityAttribute,r.kind=s.DataKind.Attribute,r.dataType=e.dataType,i.expr=r,o.push(i),n.fireColumnsChangedEvent(s.QueryChangeAction.Add,i)}this.columnElement.innerText=this.getAttributeText(e)}},e.prototype.getSubQuery=function(){return this.queryPanel.getQuery()},e.prototype.getAttributeText=function(t){if(!t)return r.g.getText("SubQueryEmptyColumn");var e=r.g.getText("Attributes",t.id);e||(e=t.caption);var n=this.panel.options.attrElementFormat;if(!n)return e;var o=n.replace(new RegExp("{attr}","g"),e),i=this.getContext().getModel().getFullEntityPathByAttr(t.id,".");return o.replace(new RegExp("{entity}","g"),i)},e.prototype.showEditor=function(){var t=this,e=this.panel,n=this.getContext();this.queryPanelBlock.innerHTML="";var o=n.createQuery();this.expression.subQuery&&o.loadFromData(this.expression.subQuery.toJSONData());var i=r.i.assign({},e.options);i.isSubQuery=!0,i.showAddRow=!0,i.menuContainer=document.body,i.menuOptions.isSubQuery=!0,i.entitiesListFilter=function(t,n){if(e.options.entitiesListFilter){var o=n||{};o.isSubQuery=!0,e.options.entitiesListFilter(t,o)}},this.queryPanel=new yt(this.queryPanelBlock,o),this.queryPanel.init(this.panel.getContext(),i);var a=null,l=o.getColumns();if(0==l.length){var u=this.expression.getParent();if(u.expressions.length>0){var c=u.expressions[0];a=c.tag==s.ExprTag.EntityAttribute||c.kind==s.DataKind.Attribute?c.value:null}}else a=l[0].expr.value;a?this.setResultAttributeId(a):this.columnElement.innerText=r.g.getText("SubQueryEmptyColumn"),this.queryPanel.refresh();var d=this.queryPanelBlock.querySelector(".eqjs-qp-conditions-root");d&&(d.style.minHeight="100px"),this.panel.getContext().getServices().getDialogService().open({title:r.g.getText("SubQueryDialogTitle"),body:this.dialogBlockBody,width:this.panel.options.subQueryDialogWidth,closable:!0,cancelable:!0,onSubmit:function(){var e=t.queryPanel.getQuery();return!!e.tryValidate({checkExpressions:!0})&&(t.setValue(e),!0)}})},e.prototype.closeEditor=function(){},e}(Y),ft=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),gt=function(t){function e(e,n,o,i){var r=t.call(this,e,n,o,i)||this;return r.expression.tag=s.ExprTag.ParentColumn,r}return ft(e,t),e.prototype.fillMenuItemsList=function(t){var e=this.panel.getQuery().getParentQuery(),n=this.expression.getParent().expressions[0].dataType;this.menuItemsList=e.getColumns().filter((function(t){return t.expr.dataType==n})).map((function(t){return{id:t.id,text:t.caption}})),t&&t()},e}(tt),mt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),yt=function(t){function e(e,n){var o=t.call(this,e)||this;return o.options={editableParts:g.All,isSubQuery:!1,activeCondition:null,entitiesPopupHandler:null,entitiesListFilter:null,menuContainer:document.body,showRootRow:!0,showAddRow:!0,showCheckboxes:!1,allowParameterization:!1,allowInJoinConditions:!1,showPoweredBy:!1,buttons:{condition:null,group:null},alwaysShowButtonsInGroups:!1,alwaysShowButtonsInConditions:!1,showConjunctions:!0,accentActiveCondition:!0,activateRootOnStart:!0,yearRange:"c-10:c+10",oneClickDateSelection:!0,showDateTimeInput:!1,attrElementFormat:"{entity} {attr}",menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,itemRenderedCallback:null},allowDragDrop:!0,attrPlacement:0,sortEntities:!1,subQueryDialogWidth:600,subQueryDialogHeight:300,dialogZIndex:1e5,numberListSeparators:[",",";"],autoEditNewCondition:!1,onConditionRendered:null,onGetConditionRenderer:null,onGetExpressionRenderer:null,onGetOperatorRenderer:null,onOperatorRendered:null,onGetAddRowRenderer:null,defaultQuery:null},o.customQuery=null,o.landingSlot=Object(a.i)("div").addClass(o.cssPrefix+"-cond-landing-slot").addChildElement(Object(a.i)("div").toDOM()).toDOM(),o.slot.classList.contains(o.cssPrefix+"-panel")||o.slot.classList.add(o.cssPrefix+"-panel"),o.group=s.WidgetGroup.Query,n&&(o.customQuery=n),o}return mt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"queryPanel"},e.prototype.init=function(e,n){var o=this;if(t.prototype.init.call(this,e,n),this.setOptions(n),this.detachQueryObserver(),this.attachQueryObserver(),a.j.removeDropContainer(this.slot),this.options.allowDragDrop){var i=this.getContext().getModel();a.j.registerDropContainer({element:this.slot,scopes:["entityAttr"],onDragEnter:function(t,e){o.slot.classList.add(l.b+"-drophover"),e.dragImage.classList.add("eqjs-sortable-helper"),o.showLandingSlot();var n=e.data.attrId;i.checkAttrProperty(n,"useInConditions")||(e.dropEffect=a.d.Forbid)},onDragOver:function(t,e){},onDragLeave:function(t,e){e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width"),o.slot.classList.remove(l.b+"-drophover"),o.hideLangindSlot()},onDrop:function(t,e){var n=o.getQuery(),i={parent:n.getRootCondition(),attributeId:e.data.attrId},r=n.addSimpleCondition(i);r&&n.fireConditionsChangedEvent(s.QueryChangeAction.Add,r)}})}},e.prototype.destroyCore=function(){a.j.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.getEntitiesMenu=function(){return this.entitiesMenu},e.prototype.getConditionMenu=function(){return this.conditionMenu},e.prototype.getLinkTypeMenu=function(){return this.linkTypeMenu},e.prototype.getConditionGroupMenu=function(t){return void 0===t&&(t=!1),t?this.rootGroupMenu:this.groupMenu},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;if(n&&(n.part==s.QueryChangePart.Conditions||n.part==s.QueryChangePart.All)){var o=document.activeElement,i=t.slot.contains(o)||o==document.body;switch(n.action){case s.QueryChangeAction.Modify:var r=n.changee,a=function(e,o){var r=t.slot.querySelector("div[data-id="+e.id+"]");if(r){o=o&&(n.condPart&s.ConditionPart.Operator)===s.ConditionPart.Operator&&e.expressions.length>1&&(e.expressions[1]._isDefaultValue||""==e.expressions[1].value||null==e.expressions[1].value);var a=r.classList.contains("active"),u=t.getConditionRenderer(e,r);if(u){var c=u.render(o);if(a&&t.toggleConditionPicked(e),i&&!o){var d=c.querySelector("a")||c.querySelector(".eqjs-qp-condition-button");d&&Object(l.d)(d)}}}},u=t.options.autoEditNewCondition;Array.isArray(r)?(r.forEach((function(t){return a(t,u)})),u=!1):a(r,u);break;case s.QueryChangeAction.Add:r=n.changee;var c=function(e){var n=t.getConditionRenderer(e);if(n){var o=e.getParent(),r=t.slot.querySelector("div[data-id="+o.id+"]");if(r){var s=r.lastChild;if(s){var a=n.render(t.options.autoEditNewCondition);s.appendChild(a),a.scrollIntoView(!1),i&&!t.options.autoEditNewCondition&&a.querySelector("a").focus()}}}};Array.isArray(r)?r.forEach((function(t){return c(t)})):c(r);break;case s.QueryChangeAction.Delete:r=n.changee;var d=function(e){var n=t.slot.querySelector("div[data-id="+e.id+"]");if(n){var o=t.slot.querySelector("div[data-id="+e.getParent().id+"] > .eqjs-qp-row-group"),r=n.nextSibling,s=n.previousSibling;if(n.parentElement.removeChild(n),i){var a=r||s||o,l=a.querySelector("a")||a.querySelector(".eqjs-qp-condition-button");l&&l.focus()}}};Array.isArray(r)?r.forEach((function(t){return d(t)})):d(r);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.context.getQuery()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t),this.options.dateFormatValue&&r.g.updateLocaleSettings({editDateFormat:this.options.dateFormatValue}),this.options.dateFormatDisplay&&r.g.updateLocaleSettings({shortDateFormat:this.options.dateFormatDisplay}),void 0===this.options.editableParts&&(this.options.editableParts=g.All),u.a.isMobileMode()&&(this.options.buttons=this.options.buttons||{},this.options.buttons.condition=["menu"],this.options.buttons.group=["menu"])},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.entitiesMenu=this.createEntitiesMenu(),this.createConditionMenus(),this.createLinkTypeMenu(),this.rootContainer=Object(a.i)("div",this.slot).toDOM(),Object(a.i)(this.slot).removeClass(l.a).addClass(u.a.getMobileCssClass());var t=this.getQuery().getRootCondition(),e=this.getConditionRenderer(t,this.rootContainer);if(e&&e.render(),this.options.showAddRow){this.addRowElement=Object(a.i)("div",this.slot).toDOM();var n=this.getAddRowRenderer(this.addRowElement);n&&n.render()}}catch(t){this.context.throwError({action:"QueryPanel rendering",text:t.message,sourceError:t})}},e.prototype.getConditionRenderer=function(t,e){var n;if(this.options.onGetConditionRenderer&&(n=this.options.onGetConditionRenderer(t,e)))return n;switch(t.tag){case s.CondTag.Simple:return new Q(this,t,e);case s.CondTag.Group:return new V(this,t,e)}return null},e.prototype.getExpressionRenderer=function(t,e){if(!t)throw"Expression is not defined in the condition";var n,o,i=this.getContext().getModel(),a=t.getParent(),l=i.getOperatorById(a.getOperatorId()),u=i.getAttributeByIdSafe(a.expressions[0].value),c=i.getOperand(u,l,t.getIndex());o=(n=c&&c.editor&&c.editor.tag!==s.EqEditorTag.Unknown?c.editor:u&&u.defaultEditor?u.defaultEditor:new s.EqValueEditor).tag;var d=t.dataType;if(d==r.d.Unknown&&(d=u.dataType),t.kind===s.DataKind.Attribute){if(0===t.getIndex())return new ot(this,t,this.entitiesMenu,e);var h=this.createEntitiesMenu((function(t,e){return!e||e.useInConditions&&e.dataType===d}));return new ot(this,t,h,e)}if(t.kind===s.DataKind.Query?o=s.EqEditorTag.SubQuery:t.kind===s.DataKind.Scalar?o!=s.EqEditorTag.Unknown||t.dataType!==r.d.Date&&t.dataType!==r.d.DateTime&&t.dataType!==r.d.Time||(o=s.EqEditorTag.DateTime):t.kind==s.DataKind.ParentColumn&&(o=s.EqEditorTag.BindToParentColumn),this.options.onGetExpressionRenderer){var p=this.options.onGetExpressionRenderer(this,t,n,e);if(p)return p}switch(o){case s.EqEditorTag.List:return new $(this,t,n,e);case s.EqEditorTag.SqlList:return new et(this,t,n,e);case s.EqEditorTag.CustomList:return new tt(this,t,n,e);case s.EqEditorTag.DateTime:return new dt(this,t,n,e);case s.EqEditorTag.SubQuery:return new pt(this,t,n,e);case s.EqEditorTag.BindToParentColumn:return new gt(this,t,n,e);default:return new X(this,t,n,e)}},e.prototype.getOperatorRenderer=function(t,e,n){var o;return this.options.onGetOperatorRenderer&&(o=this.options.onGetOperatorRenderer(t,e,n)),o||new ut(this,t,e,n)},e.prototype.getAddRowRenderer=function(t){var e;return this.options.onGetAddRowRenderer&&(e=this.options.onGetAddRowRenderer(t)),e||new at(this,this.entitiesMenu,t)},e.prototype.createEntitiesMenu=function(t){var e=this.getContext().getModel();if(!e||e.isEmpty())return null;var n=this.slot.id||"eq-querypanel";n+="-EntitiesMenu";var o={items:e.getEntitiesTree({addUIC:!0,addUIR:!1,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities},t),adjustHeight:this.options.adjustEntitiesMenuHeight,id:n,domWriteItemsId:this.options.domWriteItemsId};return r.i.assign(o,this.options.menuOptions),new p(o)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createConditionMenus=function(){var t=this.getQuery(),e=this.slot.id||"eq-querypanel";e+="-ConditionMenu";var n=[{id:"enable",text:r.g.getText("MenuEnable")},{id:"delete",text:r.g.getText("CmdDelete")}];t.isEx()&&((this.options.allowParameterization||this.options.allowInJoinConditions)&&n.push({id:"delimiter",text:"---"}),this.options.allowParameterization&&n.push({id:"param",text:r.g.getText("MenuParameterization")}),this.options.allowInJoinConditions&&n.push({id:"inJoin",text:r.g.getText("MenuJoinCond")}));var o={items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.i.assign(o,this.options.menuOptions),this.conditionMenu=new p(o);e=this.slot.id||"eq-querypanel";e+="-GroupMenu";o={items:n=[{id:"enable",text:r.g.getText("MenuEnable")},{id:"delete",text:r.g.getText("CmdDelete")},{id:"delimiter",text:"---"},{id:"addCondition",text:r.g.getText("CmdAddCondition")},{id:"addGroup",text:r.g.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.i.assign(o,this.options.menuOptions),this.groupMenu=new p(o);e=this.slot.id||"eq-querypanel";e+="-RootGroupMenu";o={items:n=[{id:"addCondition",text:r.g.getText("CmdAddCondition")},{id:"addGroup",text:r.g.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.i.assign(o,this.options.menuOptions),this.rootGroupMenu=new p(o)},e.prototype.createLinkTypeMenu=function(){var t=this.slot.id;t&&(t+="-LinkTypeMenu");var e={items:s.eqconsts.predicateLinkTypeList.map((function(t){return{id:t.id,text:r.g.getText(t.key)}})),adjustHeight:this.options.adjustEntitiesMenuHeight,id:t,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(e,this.options.menuOptions),this.linkTypeMenu=new p(e)},e.prototype.toggleConditionPicked=function(t,e){var n,o;void 0===e&&(e=void 0),t&&(n=this.slot.querySelector("div[data-id="+t.id+"][data-condrow], div[data-id="+t.id+"] > div[data-group-row]"))&&(o=n.classList.contains("active"));for(var i=this.slot.querySelectorAll("."+this.cssPrefix+"-row"),r=0;r<i.length;r++){var s=i[r];s.hasAttribute("data-group-row")?this.options.alwaysShowButtonsInGroups||Object(a.i)(s).data("show-buttons",null):this.options.alwaysShowButtonsInConditions||Object(a.i)(s).data("show-buttons",null),Object(a.i)(s).removeClass("active")}n&&!o&&Object(a.i)(n).addClass("active").data("show-buttons","")},e.prototype.showLandingSlot=function(){var t=this.slot.querySelector(".eqjs-qp-conditions-root");t&&(t.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))},e.prototype.hideLangindSlot=function(){this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e}(s.Widget),vt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ct=function(t){function e(e){var n=t.call(this,e)||this;return n.options={applyOnClose:!0,showApplyButton:!0,showClearButton:!0,queryPanel:{showAddRow:!0,showCheckboxes:!0,alwaysShowButtonsInGroups:!0}},n.headerClickListener=n.headerClickHandler.bind(n),n.group=s.WidgetGroup.Query,n}return vt(e,t),e.prototype.getWidgetType=function(){return"filterBar"},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-fb"},enumerable:!0,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.qpElement=Object(a.i)("div").addClass(this.cssPrefix+"-querypanel").toDOM(),this.queryPanel=new yt(this.qpElement),this.queryPanel.init(e,this.options.queryPanel||{}),this.attachQueryObserver()},e.prototype.setOptions=function(t){this.options=r.i.assignDeep(this.options,t)},e.prototype.applyBtnClick=function(t){this.applyFilter()},e.prototype.clearBtnClick=function(t){this.clearFilter()},e.prototype.showQueryPanel=function(t){var e=this;Object(a.r)(this.qpBlock,200,(function(){e.updateHeader(),t&&t()}))},e.prototype.hideQueryPanel=function(){var t=this;Object(a.s)(this.qpBlock,200,(function(){t.updateHeader(),t.options.applyOnClose&&t.applyFilter()}))},e.prototype.headerClickHandler=function(t){t.preventDefault(),Object(a.i)(this.qpBlock).isVisible()?this.hideQueryPanel():this.showQueryPanel()},e.prototype.updateHeader=function(){if(this.headerTextElement){var t="",e=this.getContext().getQuery();e&&(t=e.getConditionsText()),""==t&&(t=r.g.getText("StrNoFilterDefined")),Object(a.i)(this.headerTextElement).text(t).attr("title",t),!e||e.isEmptyConditions()?(Object(a.i)(this.headerTextElement).hide(),Object(a.i)(this.headerLinkElement).show(),Object(a.i)(this.qpBlock).isVisible()||(Object(a.i)(this.headerArrowBlock).hide(),this.headerElement.style.cursor="",this.headerElement.removeEventListener("click",this.headerClickListener))):(this.headerElement.style.cursor="pointer",this.headerElement.removeEventListener("click",this.headerClickListener),this.headerElement.addEventListener("click",this.headerClickListener),Object(a.i)(this.headerTextElement).show(),Object(a.i)(this.headerLinkElement).hide(),Object(a.i)(this.headerArrowBlock).show()),Object(a.i)(this.qpBlock).isVisible()?this.headerArrowElement.classList.add(this.cssPrefix+"-header-arrowUp"):this.headerArrowElement.classList.remove(this.cssPrefix+"-header-arrowUp"),this.textResize()}},e.prototype.render=function(){var t=this;Object(a.i)(this.slot).addClass(this.cssPrefix+"-container").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return t.headerElement=e.addClass(t.cssPrefix+"-header").addChild("div",(function(e){return t.headerIconElement=e.addClass(t.cssPrefix+"-header-icon").toDOM()})).addChild("div",(function(e){return t.headerTextBlock=e.addClass(t.cssPrefix+"-header-textblock").addChild("div",(function(e){return t.headerTextElement=e.addClass(t.cssPrefix+"-header-text").toDOM()})).addChild("div",(function(e){return t.headerLinkElement=e.addClass(t.cssPrefix+"-header-text "+t.cssPrefix+"-header-link").text(r.g.getText("StrNoFilterClickToAdd")).hide().on("click",(function(){t.queryPanel.showEntitiesMenu({anchor:t.headerLinkElement,selectedIds:null,itemSelectedCallback:function(e,n){var o=e.id;t.showQueryPanel((function(){var e=t.getContext().getQuery(),n={parent:e.getRootCondition(),attributeId:o},i=e.addSimpleCondition(n);i&&e.fireConditionsChangedEvent(s.QueryChangeAction.Add,i)}))}})})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.headerArrowBlock=e.addClass(t.cssPrefix+"-header-arrowblock").addChild("div",(function(e){return t.headerArrowElement=e.addClass(t.cssPrefix+"-header-arrow").toDOM()})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.qpBlock=e.addClass(t.cssPrefix+"-querypanelblock").addClass(u.a.getMobileCssClass()).hide().addChildElement(t.qpElement).toDOM()})),(this.options.showApplyButton||this.options.showClearButton)&&(this.buttonsBlock=Object(a.i)("div",this.qpBlock).addClass(this.cssPrefix+"-buttonsblock").addClass(u.a.getMobileCssClass()).toDOM()),this.options.showApplyButton&&Object(a.i)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass(this.cssPrefix+"-button "+this.cssPrefix+"-button-apply").text(r.g.getText("ButtonApply")).on("click",this.applyBtnClick.bind(this)),this.options.showClearButton&&Object(a.i)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass(this.cssPrefix+"-button "+this.cssPrefix+"-button-clear").text(r.g.getText("CmdClear")).on("click",this.clearBtnClick.bind(this)),window.addEventListener("resize",(function(){t.textResize()})),this.updateHeader(),this.queryPanel.refresh(),setTimeout((function(){return t.textResize()}),500)},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.applyFilter=function(){this.options.applyFilterCallback&&this.options.applyFilterCallback()},e.prototype.clearFilter=function(){var t=this.getContext().getQuery();t&&(t.clearConditions(),t.fireConditionsChangedEvent(s.QueryChangeAction.All))},e.prototype.textResize=function(){this.headerTextBlock.style.width=this.slot.clientWidth-this.headerIconElement.offsetWidth-(Object(a.i)(this.headerArrowBlock).isVisible()?this.headerArrowBlock.offsetWidth:0)+"px"},e.prototype.destroyCore=function(){this.queryPanel&&this.queryPanel.destroy(),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getContext().getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.updateHeader()}))},e.prototype.detachQueryObserver=function(){var t=this.getContext().getQuery();t&&t.removeChangedCallback(this.queryEventCallbackId)},e}(s.Widget),bt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),xt=function(t){function e(e){var n=t.call(this,e)||this;return n.contentElement=e,n.group=s.WidgetGroup.Result,n}return bt(e,t),e.prototype.getWidgetType=function(){return"htmlContent"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultContent&&this.render()},e.prototype.render=function(){this.context.resultContent&&(this.contentElement.innerHTML+=this.context.resultContent)},e.prototype.clear=function(){this.contentElement.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(s.Widget),wt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Et=function(t){function e(e){var n=t.call(this,e)||this;return n.options={maxButtonCount:10,useBootstrap:!1},n}return wt(e,t),e.prototype.getWidgetType=function(){return"eqHtmlGrid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n)},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t)},e.prototype.refreshCore=function(){t.prototype.refreshCore.call(this),this.renderPageNavigator()},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.renderPageNavigator=function(){var t=this,e=document.getElementById("PageNavigator");if(e){var n=parseInt(e.getAttribute("data-pagecount")),o=parseInt(e.getAttribute("data-pageindex"));if(n>1){var i=function(e){var n=e.target;if(n.hasAttribute("data-page")){var o=parseInt(n.getAttribute("data-page"));t.context.fetchDataChunk({chunk:{page:o},success:function(){t.context.refreshWidgets(s.WidgetGroup.Result)}})}},r=this.options.maxButtonCount||10,a=o-1,l=a-a%r+1,u=l+r-1;u>n&&(u=n);var c=document.createElement("ul");this.options.useBootstrap?c.className="pagination":c.className="eqv-pagination",this.options.pageItemCssClass&&(c.className+=" "+this.options.pageItemCssClass);var d=document.createElement("li");this.options.useBootstrap&&(d.className="page-item");var h=document.createElement("span");if(h.setAttribute("aria-hidden","true"),this.options.useBootstrap&&(h.className="page-link"),1==l)d.className+=" disabled";else{if(this.options.useBootstrap)(h=document.createElement("a")).setAttribute("href","javascript:void(0)"),h.setAttribute("data-page",""+(l-1)),h.className="page-link";else(f=document.createElement("a")).setAttribute("href","javascript:void(0)"),f.setAttribute("data-page",""+(l-1)),h=f;h.addEventListener("click",i)}h.innerHTML="&laquo;",d.appendChild(h),c.appendChild(d);for(var p=l;p<=u;p++)d=document.createElement("li"),this.options.useBootstrap&&(d.className="page-item"),p==o&&(d.className+=" active"),(h=document.createElement("a")).setAttribute("href","javascript:void(0)"),h.innerHTML=p.toString(),h.setAttribute("data-page",p.toString()),h.className="page-link",h.addEventListener("click",i),d.appendChild(h),c.appendChild(d);if(d=document.createElement("li"),this.options.useBootstrap&&(d.className="page-item"),(h=document.createElement("span")).setAttribute("aria-hidden","true"),this.options.useBootstrap&&(h.className="page-link"),u==n)d.className+="disabled";else{var f;if(this.options.useBootstrap)(h=document.createElement("a")).setAttribute("href","javascript:void(0)"),h.setAttribute("data-page",""+(u+1)),h.className+=" page-link";else(f=document.createElement("a")).setAttribute("href","javascript:void(0)"),f.setAttribute("data-page",""+(u+1)),h=f;h.addEventListener("click",i)}h.innerHTML="&raquo;",d.appendChild(h),c.appendChild(d),e.appendChild(c)}}},e}(xt),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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kt=function(t){function e(e){var n=t.call(this,e)||this;return n.options={useCustomLocaleSettings:!1},n.slot=e,n.group=s.WidgetGroup.Result,n}return Tt(e,t),e.prototype.getWidgetType=function(){return"grid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),n&&r.i.assignDeep(this.options,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultTable&&this.render()},e.prototype.render=function(){this.options.beforeTableRendering&&this.options.beforeTableRendering(this.context.resultTable),this.applyDisplayFormats()},e.prototype.applyDisplayFormats=function(){},e.prototype.clear=function(){this.slot.innerHTML=""},e}(s.Widget),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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Mt=function(){return Mt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Mt.apply(this,arguments)},St=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCustomTotalsSettings=!1,n.options={autoRefresh:!0},n.group=s.WidgetGroup.Result,n}return Dt(e,t),e.prototype.getWidgetType=function(){return"easyGrid"},e.prototype.init=function(e,n){var o=this;t.prototype.init.call(this,e,n);var i=Mt({},n,{slot:this.slot,dataTable:e.resultTable});this.options=r.i.assign(this.options,n),i.onAddColumnClick=function(t){return o.addColumnClickHandler(t)},i.onColumnMoved=function(t){return o.columnMovedHandler(t)},i.aggregates?this.hasCustomTotalsSettings=!0:i.aggregates={settings:e.getQuery().getAggregationSettings(),calculator:null},i.aggregates.calculator=this.context.getServices().getAggregatesCalculator(),this.destroy(),this.grid=new a.e(i),this.options.autoRefresh&&this.attachQueryObserver()},e.prototype.refreshCore=function(){this.clear(),this.updateTotalsSettings(),this.render()},e.prototype.render=function(){this.createEntitiesMenu(),this.grid.refresh()},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;!n||n.part!=s.QueryChangePart.Columns&&n.part!=s.QueryChangePart.All||(e.data.source==t?t.grid.refresh():t.refresh())}))},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.grid&&this.grid.destroy(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getContext().getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.updateTotalsSettings=function(){var t=this.getContext();if(!this.hasCustomTotalsSettings){var e=t.getQuery().getAggregationSettings();this.grid.options.aggregates.settings=e}},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(t&&!t.isEmpty()){var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1}),id:e};r.i.assign(n,this.options.menuOptions),this.entitiesMenu=new p(n)}},e.prototype.getModel=function(){return this.context.getModel()},e.prototype.getQuery=function(){return this.context.getQuery()},e.prototype.clear=function(){this.grid&&this.grid.clear()},e.prototype.addColumnClickHandler=function(t){var e=this;this.entitiesMenu.showMenu({anchor:t.sourceEvent.target,selectedIds:null,itemSelectedCallback:function(t,n){var o=t.id;return e.addNewColumn(o),!1}})},e.prototype.columnMovedHandler=function(t){var e=this.getQuery(),n=r.i.findItemIndexById(e.getColumns(),t.columnId);n>=0&&(e.moveColumn(n,t.newIndex),e.fireChangedEvent({part:s.QueryChangePart.Columns,action:s.QueryChangeAction.All,source:this}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getContext().getModel(),o=this.getContext().getQuery();if(this.getContext().getQuery())return this.addColumn(function(t){var i=n.getAttributeById(t);if(!i)return null;if(!i.useInSorting){if(!i.lookupAttr)return null;if(t=i.lookupAttr,!(i=n.getAttributeById(t))||!i.useInSorting)return null}var r=o.createColumn();return r.caption=e.getDefaultColumnCaption(i),r.sorting=s.SortDirection.None,r.sortIndex=-1,r.expr.tag=s.ExprTag.EntityAttribute,r.expr.setValue(t,!0),r.params.concat(i.params),r}(t))},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.addColumn=function(t){var e=this.getContext().getQuery();if(e&&(t=this.checkColumn(t)))return t=e.addColumn({caption:t.caption,attributeId:t.expr.value,sorting:t.sorting,sortIndex:t.sortIndex}),e.fireChangedEvent({part:s.QueryChangePart.Columns,action:s.QueryChangeAction.Add,changee:t,source:this}),t},e.prototype.checkColumn=function(t){for(var e=this.getContext().getQuery().getColumns(),n=JSON.stringify(t.expr.saveToData()),o=0;o<e.length;o++){if(JSON.stringify(e[o].expr.saveToData())===n)return null}return t},e}(kt),Bt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),It=function(t){function e(e){var n=t.call(this,e)||this;return n.panel=e,n.group=s.WidgetGroup.Statement,"TEXTAREA"!==n.panel.tagName&&(n.panel.innerHTML='<div class="eqv-sql-panel-result"></div>',n.panel=n.panel.querySelector("div")),n}return Bt(e,t),e.prototype.getWidgetType=function(){return"statementPanel"},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.render=function(){this.panel.textContent=this.context.resultStatement?this.context.resultStatement:"";var t=this.panel.innerHTML.replace(/\r\n/g,"<br />").replace(/ /g,"&nbsp;&nbsp;");this.panel.innerHTML=t},e.prototype.destroyCore=function(){this.clear()},e.prototype.clear=function(){this.panel.innerHTML=""},e}(s.Widget),Ot=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Pt=function(t){function e(e){var n=t.call(this,e)||this;return n.element=e,n.element.style.display="none",n.group=s.WidgetGroup.All,n}return Ot(e,t),e.prototype.getWidgetType=function(){return"processIndicator"},e.prototype.onProcessStartCore=function(){this.element.style.display=""},e.prototype.onProcessEndCore=function(){this.element.style.display="none"},e}(s.Widget),At=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Lt=function(t){function e(e){var n=t.call(this,e)||this;return n.clickHandler=function(){return n.openDialog()},n.columnsBar=null,n.queryPanel=null,n.ddQuery=null,n.cssPrefix=l.b,n.group=s.WidgetGroup.None,n}return At(e,t),e.prototype.getWidgetType=function(){return"manageDrillDown"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=n,this.refresh(),this.slot.addEventListener("click",this.clickHandler)},e.prototype.destroyCore=function(){this.slot.removeEventListener("click",this.clickHandler)},e.prototype.openDialog=function(){var t=this,e=this.context.getServices().getDialogService(),n=this.context.getQuery(),o=this.context.getModel(),i=Object(a.i)("div").addClass(this.cssPrefix+"-manage-drilldown").addChildElement(this.renderColumnsBarBlock()).addChildElement(this.renderQueryPanelBlock()).toDOM(),l=o.addOrUpdateOperator({id:"BindToParentColumn",caption:"is bound to",format:"{expr1} [[is bound to]] {expr2}",paramCount:2,kind:s.DataKind.ParentColumn,appliedTypes:[r.d.String,r.d.Bool,r.d.Float,r.d.Int32,r.d.Int64,r.d.Word]});l.defaultOperand.dataType=r.d.String,l.defaultOperand.kind=s.DataKind.ParentColumn,o.runThroughEntities((function(t){var e=t.operators.indexOf(l.id);e>0&&r.i.moveArrayItem(t.operators,e,0)}),null),this.ddQuery=new s.Query(o,null,{parent:n});var u=this.context.getQuery().getDrillDowns();if(u.length){var c=u[0];this.ddQuery.loadFromData(c.toJSONData())}e.open({title:"Manage Drill Down",body:i,cancelable:!0,closable:!1,beforeOpen:function(){var e=i.getElementsByClassName(t.cssPrefix+"-columnsbar-slot")[0];t.columnsBar=new O(e,t.ddQuery),t.columnsBar.init(t.context,t.options.columnsBar);var n=i.getElementsByClassName(t.cssPrefix+"-querypanel-slot")[0];t.queryPanel=new yt(n,t.ddQuery),t.queryPanel.init(t.context,t.options.queryPanel),t.columnsBar.refresh(),t.queryPanel.refresh()},onSubmit:function(){return t.submitDialog()},onDestroy:function(){t.destroyDialog()}})},e.prototype.renderQueryPanelBlock=function(){var t=this;return Object(a.i)("div").addClass(this.cssPrefix+"-querypanel-block").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-querypanel-caption")})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-querypanel-slot")})).toDOM()},e.prototype.renderColumnsBarBlock=function(){var t=this;return Object(a.i)("div").addClass(this.cssPrefix+"-columnsbar-block").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-columnsbar-caption")})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-columnsbar-slot")})).toDOM()},e.prototype.submitDialog=function(){if(this.ddQuery.tryValidate({checkExpressions:!0})){var t=this.context.getQuery().getDrillDowns();if(t.length)t[0].loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();else if(!this.ddQuery.isEmpty())this.context.getQuery().addDrillDown().loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();return!0}return!1},e.prototype.destroyDialog=function(){this.context.getModel().removeOperator("BindToParentColumn",!0),this.ddQuery=null,this.columnsBar&&this.columnsBar.destroy(),this.columnsBar=null,this.queryPanel&&this.queryPanel.destroy(),this.queryPanel=null},e}(s.Widget);!function(t){t.DataGrid="DATA_GRID",t.Chart="CHART",t.PivotTable="PIVOT_TABLE"}(W||(W={}));var Rt,_t=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this;if(void 0===t&&(t=null),!this.promise){var n=this.context.getExportFormats();if(0==n.length)throw Error("No exporter has been registered.");t=t||n[0],this.promise=new Promise((function(n,o){var i=e.context.getServices().getDialogService(),r=Object(a.i)("div").addClass("kdlg-form-section").addChild("div",(function(n){return n.addClass("kfrm-form").addChild("div",(function(n){return n.addClass("kfrm-fields col-a-1 label-align-right").addChild("label",(function(t){return t.addClass("kdlg-form-label","kflex-20").attr("for","export_format").addText(s.i18n.getText("ExportDlgFmtLabel"))})).addChild("div",(function(n){return n.addClass("kfrm-select").addChild("select",(function(n){n.attr("name","export_format").id("exportFormat");for(var o=0,i=e.context.getExportFormats();o<i.length;o++){var r=i[o];n.addOption({value:r,title:s.i18n.getText(r)||r,selected:t==r})}}))}))}))})).toDOM();i.open({title:s.i18n.getText("ExportDlgTitle"),body:r,onSubmit:function(){var t=r.querySelector("#exportFormat").value;return e.context.exportResult({format:t,success:n,error:o}),!0}})}))}return this.promise.finally((function(){return e.promise=null}))},t}(),Ft=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(s,a)}l((o=o.apply(t,e||[])).next())}))},jt=function(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}},Qt=function(){function t(t,e){var n=this;this.container=t,this.title=r.g.getText("Facets","DefaultFacetTitle"),this.cssPrefix="eqjs-facet",this.dialogTitle=r.g.getText("Facets","DefaultDlgTitle"),this.options={},this.canDisplayFlag=!0,this.downloadAllClickHandler=function(){var t=n.getContext().resultTable;if(t.elasticChunks){var e=n.getDialogService().openProgress({title:r.g.getText("Facets","LoadDataDlgTitle"),onSubmit:function(){return n.refresh()},determinated:!1});n.loadElasticChunk().then((function(t){e.submit()})).catch((function(t){e.submit(),n.getContext().throwError(t)}))}else for(var o=n.getChunksForLoading(),i=t.getTotal()-t.getCachedCount(),s=n.getDialogService().openProgress({title:r.g.getText("Facets","LoadDataDlgTitle"),content:r.g.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}","0").replace("{totalRecs}",""+i),onSubmit:function(){return n.refresh()},determinated:!0}),a=0,l=function(e){setTimeout((function(){t.getRows({offset:e.offset,limit:t.chunkSize}).then((function(t){var e=(a+=t.length)/i;s.updateContent(r.g.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}",""+a).replace("{totalRecs}",""+i)),s.updateProgress(e)})).catch((function(t){s.submit(),n.getContext().throwError(t)}))}),10)},u=0,c=o;u<c.length;u++){l(c[u])}},r.i.assignDeep(this.options,e)}return t.prototype.init=function(t){this.slot=t,this.contentDiv=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-content").toDOM(),this.displayMessageDiv=Object(a.i)("div",this.slot).hide().toDOM()},t.prototype.showSettingsDialog=function(){var t=this;return new Promise((function(e){var n=t.getDialogService(),o=t.renderDialogContent(),i=n.open({title:t.dialogTitle,body:o,cancelable:!0,closable:!1,onSubmit:function(){var n=t.submitSettingsDialog();return n&&e(!0),n},onCancel:function(){e(!1)}});t.afterDialogOpened(i)}))},t.prototype.afterDialogOpened=function(t){},t.prototype.renderDialogContent=function(){var t,e=Object(a.i)("div").addClass("kfrm-form").addChild("div",(function(e){return t=e.addClass(u.a.IsIE()?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right").toDOM()}));return this.renderFormFields(e.toDOM(),t),e.toDOM()},t.prototype.renderFormFields=function(t,e){var n=this,o=e;u.a.IsIE()&&(o=Object(a.i)("div",e).addClass("kfrm-field-ie").toDOM()),Object(a.i)(o).addChild("label",(function(t){return t.attr("for","tab_name").addText(r.g.getText("Facets","TabNameLabel"))})).addChild("input",(function(t){return t.id("facetTabName").name("tab_name").type("text").attr("value",n.title)}))},t.prototype.submitSettingsDialog=function(){var t=document.querySelector("#facetTabName");return 0!=t.value.length&&(this.title=t.value,!0)},t.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},t.prototype.canDisplay=function(){var t=this.getContext().resultTable;return t.getCachedCount()==t.getTotal()},t.prototype.showUnableDisplayMessage=function(t){var e=this.getContext().resultTable;this.displayMessageDiv.innerHTML=t||r.g.getText("Facets","ErrNotEnoughData").replace("{totalRecs}",""+e.getTotal()).replace("{cachedRecs}",""+e.getCachedCount()).replace(/\[(.*)\]/g,"<a href='javascript:void(0)' class=\""+this.cssPrefix+'-download-all-link">$1</a>');var n=this.displayMessageDiv.querySelector("a."+this.cssPrefix+"-download-all-link");n&&n.addEventListener("click",this.downloadAllClickHandler),Object(a.i)(this.contentDiv).hide(),Object(a.i)(this.displayMessageDiv).show()},t.prototype.hideUnableDisplayMessage=function(){Object(a.i)(this.displayMessageDiv).hide(),Object(a.i)(this.contentDiv).show()},t.prototype.getContext=function(){return this.container.getContext()},t.prototype.getQuery=function(){return this.getContext().getQuery()},t.prototype.saveToData=function(){return{title:this.title,type:this.getType()}},t.prototype.loadFromData=function(t){t&&(this.title=t.title)},t.prototype.refresh=function(){this.hideUnableDisplayMessage(),this.canDisplay()?this.refreshCore():this.showUnableDisplayMessage()},t.prototype.loadElasticChunk=function(){return Ft(this,void 0,void 0,(function(){var t,e,n,o=this;return jt(this,(function(i){return t=this.getContext().resultTable,e=t.getCachedChunks(),n=e[e.length-1],[2,t.getRows({offset:n.offset+t.chunkSize,limit:t.chunkSize}).then((function(e){return t.totalIsKnown()?Promise.resolve():o.loadElasticChunk()}))]}))}))},t.prototype.getChunksForLoading=function(){var t=this.getContext().resultTable,e=t.chunkSize,n=t.getCachedChunks(),o=[];0!=n[0].offset&&o.push({offset:0});for(var i=1;i<n.length;i++){var r=n[i].offset-n[i-1].offset-e;if(r>=e)for(var s=r/e,a=1;a<=s;a++)o.push({offset:n[i-1].offset+a*e})}var l=n[n.length-1],u=t.getTotal()-l.offset;if(u>=e)for(s=u/e,a=1;a<=s;a++)o.push({offset:l.offset+a*e});return o},t.prototype.onResize=function(){},t}();!function(t){t[t.Column=3]="Column",t[t.Histogram=4]="Histogram",t[t.Bar=5]="Bar",t[t.Combo=6]="Combo",t[t.Area=7]="Area",t[t.Line=9]="Line",t[t.Pie=10]="Pie",t[t.Polar=11]="Polar",t[t.Doughnut=12]="Doughnut",t[t.Radar=13]="Radar",t[t.SteppedLine=14]="SteppedLine"}(Rt||(Rt={}));var Nt,qt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ht=function(t){function e(e){var n=t.call(this,e)||this;return n.chartType=Rt.Pie,n.supportedChartTypes=[],n.dataTable=null,n.potentialLabelColumns=[],n.potentialDataColumns=[],n.labelColumn=-1,n.dataColumns=[],n.options={chartType:Rt.Pie,showOnPaging:!1,hideSettings:!1,legend:{show:!1,position:"right"}},n.element=e,n.group=s.WidgetGroup.Result,n}return qt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-chart"},enumerable:!0,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.dataTable=e.resultTable,this.setOptions(n)},e.prototype.hasData=function(){var t=null!=this.dataTable;return t&&(t=this.dataTable.getCachedCount()>0),t},e.prototype.hasColumnsForChart=function(){return this.potentialLabelColumns.length>0&&this.potentialDataColumns.length>0},e.prototype.refreshCore=function(){this.prepareChartData(),this.render()},e.prototype.setOptions=function(t){if(r.i.assignDeep(this.options,t),this.supportedChartTypes=this.getSupportedChartTypes(),0==this.supportedChartTypes.length)throw Error("Chart widget should support at least one chart type");t.chartType&&this.supportedChartTypes.indexOf(t.chartType)>=0?this.chartType=t.chartType:this.chartType=this.supportedChartTypes[0]},e.prototype.getOptions=function(){return this.options},e.prototype.getChartTypeName=function(t){switch(t){case Rt.Area:return r.g.getText("ChartType","Area");case Rt.Bar:return r.g.getText("ChartType","Bar");case Rt.Column:return r.g.getText("ChartType","Column");case Rt.Combo:return r.g.getText("ChartType","Combo");case Rt.Doughnut:return r.g.getText("ChartType","Doughnut");case Rt.Polar:return r.g.getText("ChartType","Polar");case Rt.Radar:return r.g.getText("ChartType","Radar");case Rt.Histogram:return r.g.getText("ChartType","Histogram");case Rt.Line:return r.g.getText("ChartType","Line");case Rt.SteppedLine:return r.g.getText("ChartType","SteppedLine");default:return r.g.getText("ChartType","Pie")}},e.prototype.updateSettings=function(t,e){void 0===e&&(e=!0),void 0!==t.showLegend&&(this.options.legend=this.options.legend||{},this.options.legend.show=t.showLegend),this.chartType=t.type,this.labelColumn=t.labelColumn,this.dataColumns[0]=t.dataColumn,e&&this.updateChartColumns()},e.prototype.prepareChartData=function(){var t=this;if(this.dataTable){this.potentialLabelColumns=[],this.potentialDataColumns=[];for(var e=this.dataTable.columns.count,n=0;n<e;n++){var o=this.dataTable.columns.get(n),i=o.type,s=o.label;this.potentialLabelColumns.push({idx:n,label:s}),r.i.isNumericType(i)&&this.potentialDataColumns.push({idx:n,label:s})}if(-1!=this.labelColumn?this.potentialLabelColumns.filter((function(e){return e.idx==t.labelColumn})).length||(this.labelColumn=-1):this.labelColumn=this.potentialLabelColumns.length>0?this.potentialLabelColumns[0].idx:-1,this.dataColumns.length){var a=this.potentialDataColumns.map((function(t){return t.idx}));this.dataColumns=this.dataColumns.filter((function(t){return a.indexOf(t)>=0})),this.dataColumns.length||(this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[])}else this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[];this.initChart()}},e.prototype.getSupportedChartTypes=function(){var t=this;return(this.options.supportedChartTypes?this.options.supportedChartTypes:Object.keys(Rt).map((function(t){return Rt[t]}))).filter((function(e){return t.hasChartTypes.indexOf(e)>=0}))},e.prototype.getCurrentChartType=function(){return this.chartType},e.prototype.render=function(){var t=this;if(this.clear(),this.hasData()&&this.hasColumnsForChart()&&this.context.resultTable.getTotal()==this.context.resultTable.getCachedCount()){var e=document.createElement("div");Object(a.f)(e,this.cssPrefix+"-header");var n=document.createElement("div");if(Object(a.f)(n,this.cssPrefix+"-main"),this.canDraw()){for(var o=document.createElement("select"),i=0,r=this.supportedChartTypes;i<r.length;i++){var s=r[i],l=document.createElement("option");l.value=s.toString(),l.text=this.getChartTypeName(s),o.appendChild(l)}o.value=this.chartType.toString(),e.appendChild(o),o.addEventListener("change",(function(e){var n=e.target.value;t.chartType=parseInt(n),t.refresh()})),this.settingsDiv=document.createElement("div"),Object(a.f)(this.settingsDiv,this.cssPrefix+"-settings"),Object(a.o)(this.settingsDiv),n.appendChild(this.settingsDiv),this.chartDiv=document.createElement("div"),Object(a.f)(this.chartDiv,this.cssPrefix+"-content"),Object(a.o)(this.chartDiv),n.appendChild(this.chartDiv),this.initSettingsDiv();var u=document.createElement("div");Object(a.f)(u,this.cssPrefix+"-settings-icon"),u.title="Settings",e.appendChild(u),u.addEventListener("click",(function(e){t.toggleSettings()})),this.drawChart(100)}else this.addContentDiv(n,"Unable to render the chart. None of the supported chart libraries (ChartJS, Google Charts, etc) is found.");this.options.hideSettings||this.element.appendChild(e),this.element.appendChild(n),this.element.style.display=""}else this.element.style.display="none"},e.prototype.addContentDiv=function(t,e){var n=document.createElement("div");Object(a.f)(n,this.cssPrefix+"-no-data"),n.innerText=e,t.appendChild(n)},e.prototype.clear=function(){this.element.innerHTML=""},e.prototype.drawChart=function(t){var e=this;Object(a.q)(this.chartDiv),t>0?setTimeout((function(){return e.drawCore()}),t):this.drawCore()},e.prototype.initSettingsDiv=function(){var t=this,e=document.createElement("div");e.textContent="SETTINGS",Object(a.f)(e,this.cssPrefix+"-settings-header"),this.settingsDiv.appendChild(e);var n=document.createElement("div");Object(a.f)(n,this.cssPrefix+"-settings-single"),this.settingsDiv.appendChild(n);var o=document.createElement("span");Object(a.q)(o),o.textContent="Label column",n.appendChild(o);var i=document.createElement("select");Object(a.q)(i),n.appendChild(i);for(var r=0,s=this.potentialLabelColumns;r<s.length;r++){var l=s[r];(f=document.createElement("option")).value=l.idx.toString(),f.text=l.label,i.appendChild(f)}this.labelColumn>=0&&(i.value=this.labelColumn.toString()),i.addEventListener("change",(function(e){t.labelColumn=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}));var u=document.createElement("div");Object(a.f)(u,this.cssPrefix+"-settings-single"),this.settingsDiv.appendChild(u);var c=document.createElement("span");Object(a.q)(c),c.textContent="Data column",u.appendChild(c);var d=document.createElement("select");Object(a.q)(d),u.appendChild(d);for(var h=0,p=this.potentialDataColumns;h<p.length;h++){var f;l=p[h];(f=document.createElement("option")).value=l.idx.toString(),f.text=l.label,d.appendChild(f)}this.dataColumns.length>0&&this.dataColumns[0]>=0&&(d.value=this.dataColumns[0].toString()),d.addEventListener("change",(function(e){t.dataColumns[0]=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}))},e.prototype.getPotentialLabelColumns=function(){return this.potentialLabelColumns},e.prototype.getPotentialDataColumns=function(){return this.potentialDataColumns},e.prototype.getLabelColumnIndex=function(){return this.labelColumn},e.prototype.getDataColumnIndex=function(){return this.dataColumns[0]},e.prototype.toggleSettings=function(t){var e,n;Object(a.p)(this.chartDiv)?(e=this.chartDiv,n=this.settingsDiv):(e=this.settingsDiv,n=this.chartDiv),Object(a.t)(e,n,{complete:t})},e}(s.Widget),Wt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Gt=function(t){function e(e){var n=t.call(this,e)||this;return n.colors=["#4dc9f6","#f67019","#f53794","#537bc4","#acc236","#166a8f","#00a950","#58595b","#8549ba"],n.chartLabels=[],n.chartColumns=[],n.hasChartTypes=[Rt.Column,Rt.Bar,Rt.Area,Rt.Line,Rt.SteppedLine,Rt.Doughnut,Rt.Polar,Rt.Radar,Rt.Pie],n.options.legend={show:!1,position:"bottom"},n}return Wt(e,t),e.prototype.getWidgetType=function(){return"chartChartJs"},e.hasChartJs=function(){return"undefined"!=typeof Chart},e.prototype.canDraw=function(){return e.hasChartJs()},e.prototype.initChart=function(){e.hasChartJs()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&this.updateChartColumns()},e.prototype.drawCore=function(){if(e.hasChartJs()&&this.dataTable&&this.dataTable.getCachedCount()>0){var t=this.generateConfig(),n=this.getChartCanvas(this.chartDiv).getContext("2d");new Chart(n,t)}},e.prototype.updateChartColumns=function(){if(this.dataTable){this.chartLabels=[],this.chartColumns=[];for(var t=this.dataTable.getCachedRows(),e=0;e<t.length;e++)this.chartLabels.push(t[e].getValue(this.labelColumn)),this.chartColumns.push(t[e].getValue(this.dataColumns[0]))}},e.prototype.getChartCanvas=function(t){var e=t.getElementsByTagName("canvas");return e&&e.length>0?e[0]:Object(a.g)(t,"canvas")},e.prototype.generateConfig=function(){var t,e=[],n=this.dataTable.columns.get(this.dataColumns[0]).label,o=!0;if(this.chartType==Rt.Pie||this.chartType==Rt.Doughnut||this.chartType==Rt.Polar||this.chartType==Rt.Bar||this.chartType==Rt.Column)for(var i=0;i<this.chartLabels.length;i++)e.push(this.colors[i%this.colors.length]);else e=[this.colors[3]];this.chartType!=Rt.Line&&this.chartType!=Rt.SteppedLine||(o=!1,t=this.colors[3]),this.options.legend=this.options.legend||{};var r={data:this.chartColumns,backgroundColor:e,borderColor:t,label:n,fill:o};this.chartType==Rt.SteppedLine&&(r.stepped=this.chartType===Rt.SteppedLine,r.steppedLine=this.chartType===Rt.SteppedLine);var s=this.options.legend.show&&(this.chartType==Rt.Pie||this.chartType==Rt.Radar||this.chartType==Rt.Polar||this.chartType==Rt.Doughnut);return{type:this.getChartType(),data:{datasets:[r],labels:this.chartLabels},options:{legend:{display:s,position:this.options.legend.position||"bottom"},title:{display:!0,text:n}}}},e.prototype.getChartType=function(){switch(this.chartType){case Rt.Column:return"bar";case Rt.Bar:return"horizontalBar";case Rt.Area:case Rt.SteppedLine:case Rt.Line:return"line";case Rt.Doughnut:return"doughnut";case Rt.Polar:return"polarArea";case Rt.Radar:return"radar";case Rt.Pie:default:return"pie"}},e}(Ht),Vt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),zt=function(t){function e(e){var n=t.call(this,e)||this;return n.hasChartTypes=[Rt.Column,Rt.Bar,Rt.Histogram,Rt.Combo,Rt.Area,Rt.Line,Rt.SteppedLine,Rt.Pie,Rt.Doughnut],n.options.legend={show:!0,position:"right"},n}return Vt(e,t),e.prototype.getWidgetType=function(){return"chartGoogle"},e.prototype.canDraw=function(){return e.hasGoogleCharts()},e.hasGoogleCharts=function(){return"undefined"!=typeof google&&void 0!==google.charts},e.prototype.initChart=function(){e.hasGoogleCharts()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&(this.googleDataView=new google.visualization.DataView(this.convertToGoogleFormat()),this.updateChartColumns())},e.prototype.convertToGoogleType=function(t){switch(t){case r.d.Date:return"date";case r.d.DateTime:return"datetime";case r.d.Time:return"timeofday";case r.d.Byte:case r.d.Word:case r.d.Int32:case r.d.Int64:case r.d.Currency:case r.d.Float:return"number";default:return"string"}},e.prototype.convertToGoogleValue=function(t,e){return e===r.d.Bool?t.toString():t},e.prototype.convertToGoogleFormat=function(){for(var t=new google.visualization.DataTable,e=this.dataTable.columns,n=0;n<e.count;n++){var o=e.get(n);t.addColumn(this.convertToGoogleType(o.type),o.label,o.id)}var i=this.dataTable.getCachedRows();t.addRows(i.length);for(n=0;n<i.length;n++)for(var r=i[n],s=0;s<e.count;s++)t.setCell(n,s,this.convertToGoogleValue(r.getValue(s),e.get(s).type));return t},e.prototype.drawCore=function(){if(null!=this.googleDataView){this.options.legend=this.options.legend||{};var t={width:"100%",height:"100%",chartArea:{width:this.getChartAreaWidth}};this.chartType==Rt.Doughnut&&(t.pieHole=.4),this.options.legend.show?t.legend={position:this.options.legend.position}:t.legend="none",this.createChart(this.chartDiv).draw(this.googleDataView,t)}},e.prototype.getChartAreaWidth=function(t){return t==Rt.Pie?"100%":"50%"},e.prototype.updateChartColumns=function(){this.googleDataView&&this.googleDataView.setColumns([].concat(this.labelColumn).concat(this.dataColumns))},e.prototype.createChart=function(t){switch(this.chartType){case Rt.Column:return new google.visualization.ColumnChart(t);case Rt.Histogram:return new google.visualization.Histogram(t);case Rt.Bar:return new google.visualization.BarChart(t);case Rt.Combo:return new google.visualization.ComboChart(t);case Rt.Area:return new google.visualization.AreaChart(t);case Rt.Line:return new google.visualization.LineChart(t);case Rt.SteppedLine:return new google.visualization.SteppedAreaChart(t);case Rt.Pie:case Rt.Doughnut:default:return new google.visualization.PieChart(t)}},e}(Ht),Ut=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Jt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.g.getText("Facets","Chart","FacetTitle"),e.dialogTitle=r.g.getText("Facets","Chart","DlgTitle"),e}return Ut(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),zt.hasGoogleCharts()?this.chart=new zt(this.contentDiv):this.chart=new Gt(this.contentDiv);var n=this.container.options?this.container.options.supportedChartTypes:null;this.chart.init(this.getContext(),{legend:{show:!1},showOnPaging:!0,hideSettings:!0,supportedChartTypes:n}),Object(a.i)(this.slot).hide()},e.prototype.destroy=function(){this.chart&&this.chart.destroy()},e.prototype.getType=function(){return W.Chart},e.prototype.renderFormFields=function(e,n){var o=this;t.prototype.renderFormFields.call(this,e,n);var i=u.a.IsIE(),s=i?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",l=document.createElement("select");l.id="chart_type_selector",l.name="chart_type_selector";for(var c=0,d=this.chart.getSupportedChartTypes();c<d.length;c++){var h=d[c];(b=document.createElement("option")).value=h.toString(),b.text=this.chart.getChartTypeName(h),l.appendChild(b)}l.value=this.chart.getCurrentChartType().toString(),this.settings||(this.chart.prepareChartData(),this.settings={type:this.chart.getCurrentChartType().toString(),labelColumn:""+(this.chart.getLabelColumnIndex()>=0?this.chart.getLabelColumnIndex():""),dataColumn:""+(this.chart.getDataColumnIndex()>=0?this.chart.getDataColumnIndex():""),showLegend:!1});var p=document.createElement("select");p.name="label_column_selector",p.id="label_column_selector";for(var f=0,g=this.chart.getPotentialLabelColumns();f<g.length;f++){var m=g[f];(b=document.createElement("option")).value=m.idx.toString(),b.text=m.label,p.appendChild(b)}p.value=this.settings.labelColumn;var y=document.createElement("select");y.id="data_column_selector",y.name="data_column_selector";for(var v=0,C=this.chart.getPotentialDataColumns();v<C.length;v++){var b;m=C[v];(b=document.createElement("option")).value=m.idx.toString(),b.text=m.label,y.appendChild(b)}y.value=this.settings.dataColumn.toString();var x=n,w=function(){return i?Object(a.i)("div",n).addClass("kfrm-field-ie").toDOM():n};i?Object(a.i)(e).addChildElement(w()):Object(a.i)(n).addChild("div").addChild("div"),x=w(),Object(a.i)(x).addChild("label",(function(t){return t.attr("for","chart_type_selector").text(r.g.getText("Facets","Chart","ChartTypeSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(l)})),x=w(),Object(a.i)(x).addChild("label",(function(t){return t.attr("for","label_column_selector").text(r.g.getText("Facets","Chart","LabelColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(p)})),x=w(),Object(a.i)(x).addChild("label",(function(t){return t.attr("for","data_column_selector").text(r.g.getText("Facets","Chart","DataColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(y)})),x=w(),Object(a.i)(x).addChild("div").addChild("div",(function(t){return t.addClass(s).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("show_legend").type("checkbox"),o.settings.showLegend&&t.attr("checked","")})).addText(" "+r.g.getText("Facets","Chart","ShowLegendLabel"))}))}))},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this),n=document.getElementById("chart_type_selector"),o=parseInt(n.value),i=document.getElementById("label_column_selector"),r=parseInt(i.value),s=document.getElementById("data_column_selector"),a=parseInt(s.value),l=document.getElementById("show_legend").checked;return e&&(this.settings={type:o,labelColumn:r,dataColumn:a,showLegend:l},this.canDisplay()&&this.refresh()),e},e.prototype.getSettings=function(){return this.settings},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&(e.chartType=this.settings.type,e.labelCol=this.settings.labelColumn,e.dataCol=this.settings.dataColumn,e.showLeg=this.settings.showLegend),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings={type:e.chartType,dataColumn:e.dataCol,labelColumn:e.labelCol,showLegend:e.showLeg})},e.prototype.refreshCore=function(){this.chart&&(this.settings&&this.chart.updateSettings(this.settings),this.chart.prepareChartData(),this.chart.refresh())},e.prototype.onResize=function(){this.refresh()},e}(Qt),Yt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();!function(t){t.Sum="SUM",t.Average="AVG",t.Min="MIN",t.Max="MAX",t.Count="COUNT"}(Nt||(Nt={}));var Kt=/{0:(.*?)}/g,Xt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.g.getText("Facets","Pivot","FacetTitle"),e.dialogTitle=r.g.getText("Facets","Pivot","DlgTitle"),e.pivotTable=new r.e,e}return Yt(e,t),e.prototype.init=function(e){var n=this;t.prototype.init.call(this,e),this.grid=new a.e({slot:this.contentDiv,dataTable:this.pivotTable,paging:{enabled:!1},useRowNumeration:!1,addColumns:!1,allowDragDrop:!1,onGetCellRenderer:function(t,e){if(t.dataColumn){if("total"==t.dataColumn.id)return function(t,n,o,i){e(t,n,o,i),o.style.fontWeight="900"};if(n.settings.totalsRow)if(0===n.pivotTable.columns.getIndex(t.dataColumn.id))return function(t,o,i,s){Number.parseInt(s.getAttribute("data-row-idx"))===n.pivotTable.getCachedCount()-1&&(t=r.g.getText("Facets","Pivot","TotalGridLabel")),e(t,o,i,s)}}}})},e.prototype.getType=function(){return W.PivotTable},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e.prototype.createAggrFuncSelectBuilder=function(t){for(var e=this.getContext().getModel(),n=Object(a.i)("select"),o=function(t){n.addChild("option",(function(n){n.attr("value",t).text(e.getAggrFunctionCaption(t))}))},i=0,r=Object.keys(Nt).map((function(t){return Nt[t]}));i<r.length;i++){o(r[i])}var s=n.toDOM().querySelectorAll("option");return null!=t?s.forEach((function(e){e.value==t&&(e.selected=!0)})):s[0].selected=!0,n},e.prototype.createColumnsSelectBuilder=function(t,e){for(var n=this.getContextDataTable(),o=Object(a.i)("select"),i=function(e){var i=n.columns.get(e),r=i.label,s=i.type,a=i.id;if(t&&t.indexOf(s)<0)return"continue";o.addChild("option",(function(t){t.attr("value",a).text(r)}))},r=0;r<n.columns.count;r++)i(r);var s=Array.from(o.toDOM().querySelectorAll("option"));if(s.length>0)if(null!=e)for(var l=0,u=s;l<u.length;l++){var c=u[l];if(c.value==e){o.toDOM().value=c.value;break}}else o.toDOM().value=s[0].value;return o},e.prototype.renderFormFields=function(e,n){var o=this;t.prototype.renderFormFields.call(this,e,n);var i=this.settings||{totalsRow:!0,totalsCol:!0},s=[r.d.String,r.d.Date,r.d.DateTime,r.d.Int32,r.d.Int64,r.d.Word,r.d.Byte],l=[r.d.String,r.d.Float,r.d.Int32,r.d.Int64,r.d.Word,r.d.Byte,r.d.Currency],c=u.a.IsIE(),d=n,h=c?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",p=function(){return c?Object(a.i)("div",n).addClass("kfrm-field-ie").toDOM():n};c?Object(a.i)(n).addChildElement(p()):Object(a.i)(n).addChild("div").addChild("div"),d=p(),Object(a.i)(d).addChild("label",(function(t){return t.attr("for","column_field").text(r.g.getText("Facets","Pivot","ColumnFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass(h).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","column_field").addChildElement(o.createColumnsSelectBuilder(s,i.colName).id("pivotTableColFieldSelector").toDOM())})).addChild("button",(function(t){return t.addClass("kfrm-button").addClass("eqjs-facets-button-swap").attr("title",r.g.getText("Facets","Pivot","SwapBtnTitle")).on("click",(function(){var t=document.getElementById("pivotTableColFieldSelector"),e=document.getElementById("pivotTableRowFieldSelector"),n=t.value;t.value=e.value,e.value=n}))}))})),d=p(),Object(a.i)(d).addChild("label",(function(t){return t.attr("for","row_field").text(r.g.getText("Facets","Pivot","RowFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","row_field").addChildElement(o.createColumnsSelectBuilder(s,i.rowName).id("pivotTableRowFieldSelector").toDOM())})),d=p(),Object(a.i)(d).addChild("label",(function(t){return t.attr("for","data_function").text(r.g.getText("Facets","Pivot","CellDataSelectorLabel"))})).addChild("div",(function(t){return t.addClass(h).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_function").addChildElement(o.createAggrFuncSelectBuilder(i.aggrFunc).id("pivotTableAggrFuncSelector").toDOM())})).addChild("label",(function(t){return t.addText("of ")})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_column").addChildElement(o.createColumnsSelectBuilder(l,i.fieldName).on("change",(function(t){var e=t.target.value;o.validateSelectedField(e)})).id("pivotTableCellFieldSelector").toDOM())}))})),d=p(),Object(a.i)(d).addChild("div").addChild("div",(function(t){return t.addClass(h).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsRow").type("checkbox"),i.totalsRow&&t.attr("checked","")})).addText(" "+r.g.getText("Facets","Pivot","TotalsRowLabel"))})).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsCol").type("checkbox"),i.totalsCol&&t.attr("checked","")})).addText(" "+r.g.getText("Facets","Pivot","TotalsColLabel"))}))}))},e.prototype.afterDialogOpened=function(t){var e=document.getElementById("pivotTableCellFieldSelector").value;e&&this.validateSelectedField(e)},e.prototype.validateSelectedField=function(t){var e=this.getContextDataTable(),n=e.columns.getIndex(t),o=e.columns.get(n),i=document.getElementById("pivotTableAggrFuncSelector");o.type==r.d.String?(i.disabled=!0,i.value=Nt.Count):i.disabled=!1},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this);return e&&(this.settings={colName:document.getElementById("pivotTableColFieldSelector").value,rowName:document.getElementById("pivotTableRowFieldSelector").value,aggrFunc:document.getElementById("pivotTableAggrFuncSelector").value,fieldName:document.getElementById("pivotTableCellFieldSelector").value,totalsRow:document.getElementById("pivotTableHasTotalsRow").checked,totalsCol:document.getElementById("pivotTableHasTotalsCol").checked},this.refresh()),e},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&r.i.assignDeep(e,this.settings),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings=r.i.assignDeep(this.settings,e),"AVERAGE"==this.settings.aggrFunc&&(this.settings.aggrFunc=Nt.Average))},e.prototype.refreshCore=function(){this.updatePivotData(),this.grid&&this.grid.refresh()},e.prototype.getContextDataTable=function(){return this.getContext().resultTable},e.prototype.updatePivotData=function(){this.pivotTable.clear();var t=this.getContextDataTable();if(t&&0!=t.getTotal()&&this.settings){var e=this.settings.colName,n=this.settings.rowName,o=this.settings.fieldName,i=t.columns.getIndex(e),s=t.columns.getIndex(n),a=t.columns.getIndex(o);if(null!=i&&null!=s&&null!=a){for(var l=t.columns.get(a),u=t.columns.get(i),c=t.columns.get(s),d=c.label,h=c.type,p=u.label,f=[],g=[],m=t.getCachedRows(),y=0;y<m.length;y++){var v=m[y].getValue(i);f.indexOf(v)<0&&f.push(v);var C=m[y].getValue(s);g.indexOf(C)<0&&g.push(C)}this.pivotTable.columns.add({id:d+"\\"+p,label:d+"\\"+p,description:"",type:h,dfmt:c.displayFormat,style:c.style});var b=[],x=null;r.i.isNumericType(u.type)?x=this.formatNumber:r.i.getDateDataTypes().indexOf(u.type)>=0&&(x=this.formatDate);for(y=0;y<f.length;y++){if(v=f[y]){var w=x?x(u,v):v;this.pivotTable.columns.add({id:v,label:w,description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==Nt.Count?l.type:r.d.Int64,style:l.style})}else b.push(y)}var E=[];for(y=0;y<g.length;y++)E.push([]),E[y].push(g[y]);for(y=0;y<g.length;y++)for(var T=0;T<f.length;T++)b.indexOf(T)>=0||E[y].push(this.calcAggrFunc(this.settings.aggrFunc,{colName:this.settings.colName,rowName:this.settings.rowName,fieldName:this.settings.fieldName,rowValue:g[y],colValue:f[T]}));if(this.settings.totalsCol){this.pivotTable.columns.add({id:"total",label:r.g.getText("Facets","Pivot","TotalGridLabel"),description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==Nt.Count?l.type:r.d.Int64});for(y=0;y<E.length;y++){var k=E[y],D=0;this.settings.aggrFunc!=Nt.Min&&this.settings.aggrFunc!=Nt.Max||(D=k[1]);for(T=1;T<k.length;T++){null!==(P=k[T])&&(this.settings.aggrFunc===Nt.Min?P<D&&(D=P):this.settings.aggrFunc===Nt.Max?P>D&&(D=P):D+=P)}this.settings.aggrFunc===Nt.Average&&(D/=k.length-1),k.push(D)}}for(var M=0,S=E;M<S.length;M++){k=S[M];this.pivotTable.addRow(k)}if(this.settings.totalsRow){var B=[];B.push(null);for(y=1;y<this.pivotTable.columns.count;y++){var I=this.pivotTable.getCachedRows(),O=0;this.settings.aggrFunc!=Nt.Min&&this.settings.aggrFunc!=Nt.Max||(O=I[0].getValue(y));for(T=0;T<I.length;T++){var P;null!==(P=I[T].getValue(y))&&(this.settings.aggrFunc===Nt.Min?P<O&&(O=P):this.settings.aggrFunc===Nt.Max?P>O&&(O=P):O+=P)}this.settings.aggrFunc===Nt.Average&&(O/=I.length),B.push(O)}this.pivotTable.addRow(B),this.contentDiv.classList.add("pivot-grid-totals-row")}else this.contentDiv.classList.remove("pivot-grid-totals-row")}else this.showUnableDisplayMessage(r.g.getText("Facets","ErrQueryChanged"))}},e.prototype.calcAggrFunc=function(t,e){switch(t){case Nt.Sum:return this.sum(e);case Nt.Average:return this.average(e);case Nt.Min:return this.min(e);case Nt.Max:return this.max(e);case Nt.Count:return this.count(e);default:return 0}},e.prototype.getSettings=function(){return this.settings},e.prototype.formatDate=function(t,e){var n="[object Date]"===Object.prototype.toString.call(e),o=(e||"").toString();if(n)if(t&&t.displayFormat&&Kt.test(t.displayFormat))o=t.displayFormat.replace(Kt,(function(n,o){return r.g.dateTimeToStr(e,t.type,o)}));else{var i=r.g.getCurrentLocale(),s={hour:"numeric",minute:"numeric",second:"numeric"};switch(t.type){case r.d.Date:o=e.toLocaleDateString(i);break;case r.d.Time:o=e.toLocaleTimeString(i,s);break;case r.d.DateTime:o=e.toLocaleDateString(i)+" "+e.toLocaleTimeString(i,s)}}return o},e.prototype.formatNumber=function(t,e){var n=(e||"").toString();return"number"==typeof e&&(n=t&&t.displayFormat&&Kt.test(t.displayFormat)?t.displayFormat.replace(Kt,(function(t,n){return r.g.numberToStr(e,n)})):e.toLocaleString()),n},e.prototype.sum=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue)e+=n[o].getValue(t.fieldName)}return e},e.prototype.average=function(t){for(var e=0,n=0,o=this.getContextDataTable().getCachedRows(),i=0;i<o.length;i++){var r=o[i].getValue(t.rowName),s=o[i].getValue(t.colName);if(r===t.rowValue&&s===t.colValue)e+=o[i].getValue(t.fieldName),n++}return 0!=n&&(e/=n),e},e.prototype.min=function(t){for(var e=Number.MAX_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue){var s=n[o].getValue(t.fieldName);s<e&&(e=s)}}return e==Number.MAX_SAFE_INTEGER?null:e},e.prototype.max=function(t){for(var e=Number.MIN_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);if(i===t.rowValue&&r===t.colValue){var s=n[o].getValue(t.fieldName);s>e&&(e=s)}}return e==Number.MIN_SAFE_INTEGER?null:e},e.prototype.count=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),o=0;o<n.length;o++){var i=n[o].getValue(t.rowName),r=n[o].getValue(t.colName);i===t.rowValue&&r===t.colValue&&e++}return e},e}(Qt),Zt=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),$t=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.grid=null,e.title=s.i18n.getText("Facets","DataTable","FacetTitle"),e.dialogTitle=s.i18n.getText("Facets","DataTable","DlgTitle"),e}return Zt(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this.reinitGrid()},e.prototype.getSettings=function(){return this.settings},e.prototype.reinitGrid=function(){this.grid&&this.grid.destroy();var t=this.container.options||{};t.gridResolver&&(this.grid=t.gridResolver(this.contentDiv,this.getType())),null==this.grid&&(this.grid=new St(this.contentDiv)),t.grid=t.grid||{},t.grid.autoRefresh=!1,t.grid.addColumns=!1;var e=this.getContext();t.grid.totals=this.settings,this.grid.init(e,t.grid)},e.prototype.getType=function(){return W.DataGrid},e.prototype.canDisplay=function(){return!0},e.prototype.refreshCore=function(){this.grid&&this.grid.refresh()},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e}(Qt),te=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ee=function(t){function e(e){var n=t.call(this,e)||this;return n.facets=[],n.options={},n.group=s.WidgetGroup.Result,n}return te(e,t),e.prototype.destroyCore=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.clear()},e.prototype.createFacetTab=function(t){var e=this.options[t];switch(t){case W.Chart:return new Jt(this,e);case W.PivotTable:return new Xt(this,e);default:return new $t(this,e)}},e.prototype.getQuery=function(){return this.getContext().getQuery()},e}(s.Widget),ne=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),oe=function(t){function e(e){var n=t.call(this,e)||this;return n.activeFacetIndex=-1,n.firstRender=!0,n.options={showExportButton:!0,showRefreshButton:!0,showMaximizeButton:!0,maximize2Window:!1,showProcessIndicator:!0,facetTypes:[W.DataGrid,W.Chart,W.PivotTable]},n.menuItems=[{id:W.DataGrid,text:r.g.getText("Facets","AddMenuItems","DataTable")},{id:W.Chart,text:r.g.getText("Facets","AddMenuItems","Chart")},{id:W.PivotTable,text:r.g.getText("Facets","AddMenuItems","Pivot")}],n.menuItemsFilter=function(t){return!(n.options.facetTypes.indexOf(t.id)<0)&&(t.id===W.DataGrid?0===n.facets.filter((function(t){return t.getType()==W.DataGrid})).length:t.id===W.PivotTable?n.getQuery().getColumns().length>2:t.id!==W.Chart||n.context.resultTable.columns.getItems().filter((function(t){return r.i.isNumericType(t.type)})).length>0)},n.slot.classList.contains(n.cssPrefix+"-panel")||n.slot.classList.add(n.cssPrefix+"-panel"),n.renderProcessBlock(),n}return ne(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-facets"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"facetsPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver(),this.loadFacets()},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;n.part==s.QueryChangePart.All&&n.source!=t&&(t.reloadFacets(),t.refreshCore(!0))}))},e.prototype.refreshCore=function(t){void 0===t&&(t=!1),(this.firstRender||t)&&(this.clear(),this.createAddMenu(),this.render()),this.validateAddFacetButton(),this.renderActiveFacet(),this.updateTotalRecords()},e.prototype.createAddMenu=function(){this.addMenu=new p({items:this.menuItems,id:"FacetType-List"})},e.prototype.updateTotalRecords=function(){var t=this.getContext().resultTable.getTotal();this.recordsDiv.innerHTML=r.g.getText("Facets","TotalRecordsLabel")+" "+t,0==t?Object(a.i)(this.exportDiv).hide():Object(a.i)(this.exportDiv).show()},e.prototype.renderProcessBlock=function(){this._processBlock=Object(a.i)("div").addClass(this.cssPrefix+"-spinner").addChild("div",(function(t){return t.addClass(l.b+"-progress-win8",u.a.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},e.prototype.onProcessStartCore=function(){this.options.showProcessIndicator&&!this._processBlock.parentNode&&this.bodyDiv&&(this.bodyDiv.childNodes.forEach((function(t){Object(a.i)(t).hide()})),this.bodyDiv.appendChild(this._processBlock))},e.prototype.onProcessEndCore=function(){if(this.options.showProcessIndicator&&this._processBlock.parentNode)try{this._processBlock.parentNode.removeChild(this._processBlock)}catch(t){}finally{this.renderActiveFacet(!1)}},e.prototype.render=function(){var t=this;this.firstRender=!1,this.headerDiv=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-header").toDOM(),this.tabsDiv=Object(a.i)("div",this.headerDiv).addClass(this.cssPrefix+"-tabs").toDOM(),this.tabsUl=Object(a.i)("ul",this.tabsDiv).addClass(this.cssPrefix+"-nav-tabs").toDOM(),this.bodyDiv=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-body").toDOM();for(var e=0,n=this.facets;e<n.length;e++){var o=n[e];this.renderFacet(o)}Object(a.i)(this.tabsDiv).addChild("div",(function(e){return t.addFacetButton=e.addClass(t.cssPrefix+"-add-button").title(r.g.getText("Facets","NewFacetTitle")).addChild("a",(function(t){return t.attr("href","javascript:void(0)")})).on("click",(function(e){return t.addClickHandler(e)})).toDOM()}));var i=Object(a.i)("div",this.headerDiv).addClass(this.cssPrefix+"-manage").toDOM();if(this.recordsDiv=Object(a.i)("div",i).addClass(this.cssPrefix+"-total-recs").toDOM(),this.options.showRefreshButton||this.options.showExportButton||this.options.showMaximizeButton){var s=Object(a.i)("div",i).addClass(this.cssPrefix+"-total-buttons").toDOM();this.options.showExportButton&&(this.exportDiv=Object(a.i)("button",s).on("click",(function(){return t.exportHandler()})).addClass(this.cssPrefix+"-button").addClass(this.cssPrefix+"-button-export").title(r.g.getText("Facets","ExportBtnTitle")).toDOM()),this.options.showRefreshButton&&Object(a.i)("button",s).on("click",(function(){return t.refreshHandler()})).addClass(this.cssPrefix+"-button").addClass(this.cssPrefix+"-button-refresh").title(r.g.getText("Facets","RefreshBtnTitle")),this.options.showMaximizeButton&&(this.maximizeButton=Object(a.i)("button",s).on("click",(function(){return t.options.maximize2Window?t.maximizeHandler(!0):t.maximizeHandler()})).addClass(this.cssPrefix+"-button").addClass(this.cssPrefix+"-button-maximize").title(r.g.getText("Facets","MaximizeBtnTitle")).toDOM())}},e.prototype.refreshHandler=function(){var t=this.getContext();t.fetchData({success:function(){t.refreshWidgets(s.WidgetGroup.Result)}})},e.prototype.exportHandler=function(){var t=this.getContext();new _t(t).show()},e.prototype.maximizeHandler=function(t){var e=Object(a.i)(this.slot);if(t)e.toggleClass(l.b+"-maximized-2window"),this.slot.classList.contains(l.b+"-maximized-2window")?(this.maximizeButton.title=r.g.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!0)):(this.maximizeButton.title=r.g.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!0));else{var n=!this.slot.hasAttribute("data-is-maximized");n?(this.slot.setAttribute("data-is-maximized",""),this.maximizeButton.title=r.g.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!0)):(this.slot.removeAttribute("data-is-maximized"),this.maximizeButton.title=r.g.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!0)),document.querySelectorAll("[data-hide-on-max]").forEach((function(t){n?t.setAttribute("style","display: none;"):t.removeAttribute("style")}))}this.facets.forEach((function(t){return t.onResize()}))},e.prototype.renderActiveFacet=function(t){var e=this;void 0===t&&(t=!0),this.tabsUl.querySelectorAll("li").forEach((function(t,n){t.classList.contains("active")&&t.classList.remove("active"),e.activeFacetIndex===n&&t.classList.add("active")})),this.bodyDiv.querySelectorAll("."+l.b+"-facet").forEach((function(n,o){Object(a.i)(n).hide(),e.activeFacetIndex===o&&(Object(a.i)(n).show(),t&&e.facets[o].refresh())}))},e.prototype.renderFacet=function(t){this.renderFacetTab(t);var e=this.renderFacetBody(t);t.init(e)},e.prototype.renderFacetTab=function(t){var e=this;return Object(a.i)("li",this.tabsUl).addChild("span",(function(n){return n.addClass(l.b+"-facet-settings").on("click",(function(n){n.stopPropagation(),e.settingsClickHandler(t)}))})).addChild("a",(function(e){return e.addText(t.title).attr("href","javascript:void(0)")})).addChild("span",(function(n){return n.addClass(l.b+"-facet-close").on("click",(function(n){n.stopPropagation(),e.closeClickHandler(t)}))})).on("click",(function(n){return e.selectClickHandler(t)})).toDOM()},e.prototype.renderFacetBody=function(t){return Object(a.i)("div",this.bodyDiv).addClass(l.b+"-facet").hide().toDOM()},e.prototype.refreshFacetTabs=function(){var t=this;this.tabsUl.querySelectorAll("li").forEach((function(e){t.tabsUl.removeChild(e)}));for(var e=0,n=this.facets;e<n.length;e++){var o=n[e];this.renderFacetTab(o)}},e.prototype.removeFacet=function(t){var e=this.facets.indexOf(t);if(e>=0){this.facets.splice(e,1);var n=this.tabsUl.childNodes[e];this.tabsUl.removeChild(n);var o=this.bodyDiv.childNodes[e];this.bodyDiv.removeChild(o),this.facets.length>0?this.activeFacetIndex=e<this.facets.length?e:this.facets.length-1:this.activeFacetIndex=-1,this.renderActiveFacet(),this.validateAddFacetButton()}},e.prototype.addClickHandler=function(t){var e=this;this.addMenu.showMenu({anchor:t.target,itemFilterCallback:this.menuItemsFilter,itemSelectedCallback:function(t){var n=e.createFacetTab(t.id),o=e.renderFacetBody(n);n.init(o),n.showSettingsDialog().then((function(t){t?(e.facets.push(n),e.activeFacetIndex=e.facets.length-1,e.renderFacetTab(n),e.renderActiveFacet(),e.saveFacets()):e.bodyDiv.removeChild(o),e.validateAddFacetButton()})).catch((function(t){return console.error(t)}))}})},e.prototype.selectClickHandler=function(t){var e=this.facets.indexOf(t);this.setActiveFacet(e)},e.prototype.settingsClickHandler=function(t){var e=this;t.showSettingsDialog().then((function(t){t&&(e.refreshFacetTabs(),e.renderActiveFacet(),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.closeClickHandler=function(t){var e=this;this.getDialogService().openConfirm(r.g.getText("Facets","RemoveFacetDlgTitle"),r.g.getText("Facets","RemoveFacetDlgContent").replace("{facetTitle}",t.title)).then((function(n){n&&(e.removeFacet(t),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.clear=function(){this.firstRender=!0,this.slot.innerHTML=""},e.prototype.createDefaultFacetIfNotExist=function(){if(0===this.facets.length){var t=this.createFacetTab(W.DataGrid);this.facets.push(t),this.activeFacetIndex=0}},e.prototype.validateAddFacetButton=function(){this.addFacetButton.hidden=0==this.addMenu.getItems().filter(this.menuItemsFilter).length},e.prototype.setActiveFacet=function(t){this.activeFacetIndex!=t&&(this.activeFacetIndex=t,this.renderActiveFacet(),this.saveFacets(!0))},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t)},e.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},e.prototype.saveFacets=function(t){void 0===t&&(t=!1);var e=this.getQuery();e.innerData=e.innerData||{},e.innerData.facets={active:this.activeFacetIndex,items:this.facets.map((function(t){return t.saveToData()}))},e.fireChangedEvent({part:s.QueryChangePart.Facets,action:t?s.QueryChangeAction.Activate:s.QueryChangeAction.All,source:this})},e.prototype.reloadFacets=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.loadFacets()},e.prototype.loadFacets=function(){var t=this.getQuery();if(this.facets=[],t.innerData&&t.innerData.facets){for(var e=0,n=t.innerData.facets.items;e<n.length;e++){var o=n[e],i=this.createFacetTab(o.type);i.loadFromData(o),this.facets.push(i)}var r=t.innerData.facets.active;this.activeFacetIndex=r>=0?r:this.facets.length-1}else this.createDefaultFacetIfNotExist()},e}(ee),ie=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),re=function(t){function e(e){var n=t.call(this,e)||this;return n.options={defFormat:"csv",enableExport:!0},n.clickHandler=function(t){n.slot.hasAttribute("disabled")||new _t(n.context).show(n.options.defFormat)},n.group=s.WidgetGroup.All,n}return ie(e,t),e.prototype.getWidgetType=function(){return"exportWidget"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=r.i.assignDeep(this.options,n),this.slot.addEventListener("click",this.clickHandler)},e.prototype.refreshCore=function(){this.options.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.slot.removeAttribute("disabled"):this.slot.setAttribute("disabled","")},e.prototype.destroyCore=function(){this.slot.removeAttribute("disabled"),this.slot.removeEventListener("click",this.clickHandler)},e}(s.Widget),se=function(){function t(t){if(this.selectState={columns:[]},this.funcMap={},!t||!t.slot)throw new Error("slot is required");if(!t||!t.query)throw new Error("query is required");this.slot=t.slot,this.query=t.query,this.onChanged=t.onChanged,this.dropSelectState(),this.dropState()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-as"},enumerable:!0,configurable:!0}),t.prototype.render=function(){this.createFunctionMenu(),this.setInitialState(),this.changed()},t.prototype.setInitialState=function(){for(var t=this.query.getAggregationSettings(),e=t.getInternalGroups(),n=t.getAggregates(),o=0,i=e;o<i.length;o++){var r=i[o];this.state.groups.push({columns:r.columns})}for(var s=0,a=n;s<a.length;s++){var l=a[s];this.state.aggregates.push({colId:l.colId,funcId:l.funcId})}this.state.grandTotals=t.hasGrandTotals(),this.state.recordCount=t.hasRecordCount()},t.prototype.getAvailableColumns=function(){return this.query.getColumns().filter((function(t){return t.enabled}))},t.prototype.renderCore=function(){var t=this;this.slot.innerHTML="";for(var e=this.getAvailableColumns(),n=Object(a.i)(this.slot),o=null,i=null,r=null,l=this.state.aggregates,u=-1,c=function(e){if(o&&o.columns.indexOf(e.id)>=0)return d.renderColumn(i,e,!0),"continue";if(null!=(o=d.getGroupForColumn(e.id))){u++;var c=Object(a.i)("div",d.slot).addClass(d.cssPrefix+"-group").data("gindex",""+u);return i=Object(a.i)("div",c.toDOM()).addClass(d.cssPrefix+"-columns"),d.renderColumn(i,e,!0),"continue"}var h=l.filter((function(t){return t.colId==e.id}))[0];if(h){var p=Object(a.i)("div",d.slot).addClass(d.cssPrefix+"-aggr");return d.renderColumn(p,e,!0,h.funcId),p.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-buttons").addChild("button",(function(e){return e.addClass(t.cssPrefix+"-unaggr-btn").title(s.i18n.getText("AggrSettings","UnaggrBtn")).on("click",t.removeAggrBtnClickHandler.bind(t))}))})),"continue"}if(d.selectState.columns.indexOf(e.id)>=0){if(null==r){var f=Object(a.i)("div",d.slot).addClass(d.cssPrefix+"-selected");r=Object(a.i)("div",f.toDOM()).addClass(d.cssPrefix+"-columns")}return d.renderColumn(r,e,!1),"continue"}d.renderColumn(n,e,!1)},d=this,h=0,p=e;h<p.length;h++){c(p[h])}if(r){var f=Object(a.i)("div",r.toDOM().parentElement).addClass(this.cssPrefix+"-buttons");f.addChild("button",(function(e){return e.addClass(t.cssPrefix+"-group-btn").title(s.i18n.getText("AggrSettings","GroupBtn")).on("click",t.groupBtnClickHandler.bind(t))})),1==this.selectState.columns.length&&f.addChild("button",(function(e){return e.addClass(t.cssPrefix+"-aggr-btn").title(s.i18n.getText("AggrSettings","AggrBtn")).on("click",t.aggrBtnClickHandler.bind(t))}))}Object(a.i)(this.slot).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-counts").addChild("label",(function(e){return e.addClass("switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.recordCount&&e.attr("checked",""),e.on("change",t.countsCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")}))})).addChild("span",(function(t){return t.addClass("switch-text").addText(s.i18n.getText("AggrSettings","GroupCountsLabel"))}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-grandtotals").addChild("label",(function(e){return e.addClass("switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.grandTotals&&e.attr("checked",""),e.on("change",t.grandCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")}))})).addChild("span",(function(t){return t.addClass("switch-text").addText(s.i18n.getText("AggrSettings","GrandTotalsLabel"))}))})),this.slot.querySelectorAll("."+this.cssPrefix+"-group").forEach((function(e){Object(a.i)(e).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-buttons").addChild("button",(function(e){return e.addClass(t.cssPrefix+"-ungroup-btn").title(s.i18n.getText("AggrSettings","UngroupBtn")).on("click",t.removeGroupBtnClickHandler.bind(t))}))}))})),this.validateCheckboxes()},t.prototype.validateCheckboxes=function(){if(0!==this.selectState.columns.length){for(var t,e,n=null,o=0;o<this.slot.childNodes.length;o++){(s=this.slot.childNodes[o]).classList.contains(this.cssPrefix+"-selected")?t&&t.classList.contains(this.cssPrefix+"-column")&&(e=t):s.classList.contains(this.cssPrefix+"-column")&&t&&t.classList.contains(this.cssPrefix+"-selected")&&(n=s),t=s}for(o=0;o<this.slot.childNodes.length;o++){(s=this.slot.childNodes[o]).classList.contains(this.cssPrefix+"-column")&&s!=e&&s!=n&&s.firstElementChild.firstElementChild.setAttribute("disabled","")}var i="."+this.cssPrefix+"-selected>."+this.cssPrefix+"-columns>."+this.cssPrefix+"-column",r=this.slot.querySelectorAll(i);for(o=1;o<r.length-1;o++){var s;(s=r[o]).firstElementChild.firstElementChild.setAttribute("disabled","")}}},t.prototype.isValid=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,o=this.state.grandTotals,i=this.state.recordCount;return!t&&(n?e||i:!!e&&(n||o))},t.prototype.getValidationMessage=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,o=this.state.grandTotals,i=this.state.recordCount;return t?s.i18n.getText("AggrSettings","SelectedError")+" ":!n||e||i?!e||n||o?s.i18n.getText("AggrSettings","NoGroupsOrAggrError")+" ":s.i18n.getText("AggrSettings","NoGroupsOrGrandError")+" ":s.i18n.getText("AggrSettings","NoAggrOrCountError")+" "},t.prototype.getSettings=function(){for(var t=new r.a(this.query),e=0,n=this.state.groups;e<n.length;e++){var o=n[e];t.addGroup({columns:o.columns})}for(var i=0,s=this.state.aggregates;i<s.length;i++){var a=s[i];t.addAggregateColumn(a.colId,a.funcId)}return this.state.grandTotals&&t.addGrandTotals(),this.state.recordCount&&t.addCounts(),t},t.prototype.renderColumn=function(t,e,n,o){var i=this;void 0===o&&(o=null),t.addChild("div",(function(t){t.data("colid",e.id);var r=o?e.caption+" ("+i.funcMap[o].caption+")":e.caption;n?t.addClass(i.cssPrefix+"-column-used").addText(r):t.addClass(i.cssPrefix+"-column").addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.attr("type","checkbox"),i.selectState.columns.indexOf(e.id)>=0&&t.attr("checked",""),t.on("change",i.colCheckboxChangeHandler.bind(i))})).addText(r)}))}))},t.prototype.getGroupForColumn=function(t){var e=this.getGroupIndexForColumn(t);return e>=0?this.state.groups[e]:null},t.prototype.getGroupIndexForColumn=function(t){for(var e=0;e<this.state.groups.length;e++){if(this.state.groups[e].columns.indexOf(t)>=0)return e}return-1},t.prototype.grandCheckboxChangeHandler=function(t){this.state.grandTotals=!this.state.grandTotals,this.onChanged&&this.onChanged()},t.prototype.countsCheckboxChangeHandler=function(t){this.state.recordCount=!this.state.recordCount,this.onChanged&&this.onChanged()},t.prototype.colCheckboxChangeHandler=function(t){var e=t.target.parentElement.parentElement.getAttribute("data-colid"),n=this.selectState.columns.indexOf(e);if(n>=0)this.selectState.columns.splice(n,1);else{this.selectState.columns.push(e);var o=this.getAvailableColumns();this.selectState.columns=this.selectState.columns.sort((function(t,e){return o.findIndex((function(e){return e.id==t}))-o.findIndex((function(t){return t.id==e}))}))}this.changed()},t.prototype.groupBtnClickHandler=function(){this.state.groups.push({columns:this.selectState.columns});var t=this.getAvailableColumns();this.state.groups=this.state.groups.sort((function(e,n){return t.findIndex((function(t){return t.id==e.columns[0]}))-t.findIndex((function(t){return t.id==n.columns[0]}))})),this.dropSelectState(),this.changed()},t.prototype.removeGroupBtnClickHandler=function(t){var e=t.target,n=Number.parseInt(e.parentElement.parentElement.getAttribute("data-gindex"));this.state.groups.splice(n,1),this.changed()},t.prototype.removeAggrBtnClickHandler=function(t){var e=t.target.parentElement.parentElement.querySelector("."+this.cssPrefix+"-column-used").getAttribute("data-colid"),n=this.state.aggregates.findIndex((function(t){return t.colId==e}));n>=0&&(this.state.aggregates.splice(n,1),this.changed())},t.prototype.aggrBtnClickHandler=function(t){var e=this,n=(this.query.getModel(),this.selectState.columns[0]),o=this.getAvailableColumns().filter((function(t){return t.id==n}))[0];this.functionMenu.showMenu({anchor:t.target,itemFilterCallback:function(t){return e.funcMap[t.id].appliedTypes.indexOf(o.expr.dataType)>=0},itemSelectedCallback:function(t){e.state.aggregates.push({colId:n,funcId:t.id}),e.dropSelectState(),e.changed()}})},t.prototype.clear=function(){this.dropSelectState(),this.dropState(),this.changed()},t.prototype.dropSelectState=function(){this.selectState={columns:[]}},t.prototype.dropState=function(){this.state={groups:[],aggregates:[],recordCount:!0,grandTotals:!1}},t.prototype.changed=function(){this.onChanged&&this.onChanged(),this.renderCore()},t.prototype.createFunctionMenu=function(){for(var t=this.query.getModel(),e=[],n=0,o=this.query.getModel().getAggrFunctions();n<o.length;n++){var i=o[n];if(i){this.funcMap[i.id]=i;var r=t.getAggrFunctionCaption(i.id),s={id:i.id,text:r};e.push(s)}}var a=this.slot.id;a&&(a+="-FunctionsMenu");var l={items:e,id:a,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new p(l)},t}(),ae=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this,n=t||this.context.getQuery();return this.query=this.context.createQuery(),this.query.loadFromData(n.toJSONData()),this.promise||(this.promise=new Promise((function(t,o){var i=e.context.getServices().getDialogService();e.body=e.renderBody();var r=i.open({title:"Aggregation settings",body:e.body,onSubmit:function(){return!(e.query.enableAggregation&&!e.renderer.isValid())&&(n.enableAggregation=e.query.enableAggregation,n.enableAggregation&&n.useAggregation((function(t){var n=e.renderer.getSettings();t.loadFromData(n.saveToData())})),n.fireChangedEvent({part:s.QueryChangePart.Aggregation,wasModified:!1}),t(),!0)},onCancel:function(){t()}});e.renderer=new se({slot:e.body.querySelector("#AggrSettingsComponent"),query:e.query,onChanged:function(){r.clearAlert();var t=e.renderer.isValid();if(!t){var n=e.renderer.getValidationMessage();r.showAlert(n,"warning")}r.getRootElement().querySelector(".kfrm-button.is-info").disabled=!t&&e.query.enableAggregation}}),e.query.enableAggregation&&e.renderer.render()}))),this.promise.catch((function(t){return console.error(t)})).finally((function(){return e.promise=null}))},t.prototype.renderBody=function(){var t=this;return Object(a.i)("div").addChild("div",(function(e){return e.addClass("eqjs-as-enableaggr").addChild("label",(function(e){return e.addClass("switch").addChild("input",(function(e){e.attr("type","checkbox"),t.query.enableAggregation&&e.attr("checked",""),e.on("change",t.enableAggrCheckBoxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")}))})).addChild("span",(function(t){return t.addClass("switch-text").addText(s.i18n.getText("AggrSettings","EnableAggrLabel"))}))})).addChild("div",(function(t){return t.id("AggrSettingsComponent")})).toDOM()},t.prototype.enableAggrCheckBoxChangeHandler=function(t){if(this.query.enableAggregation=!this.query.enableAggregation,this.body.querySelector("#AggrSettingsComponent").innerHTML="",this.query.enableAggregation)this.renderer.render();else{var e=this.body?this.body.closest(".kdlg-modal").querySelector("footer .kfrm-button.is-info"):null;e&&(e.disabled=!1)}},t}(),le=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ue=function(t){function e(e,n){var o=t.call(this,e)||this;return o.linkClickCallback=function(){new ae(o.context).show(o.getQuery())},o.queryEventCallbackId=null,o.customQuery=n,o.group=s.WidgetGroup.Query|s.WidgetGroup.QueryStatus,o}return le(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-aggrb"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"aggregationBar"},e.prototype.refreshCore=function(){this.render()},e.prototype.getLinkText=function(){var t=this.getQuery();if(t.enableAggregation){for(var e=t.getAggregationSettings(),n=e.getInternalGroups(),o=e.getAggregates(),i=[],r=t.getColumns(),a=0,l=n;a<l.length;a++){var u=l[a].columns.map((function(t){var e=r.find((function(e){return e.id==t}));return e?e.caption:""}));i.push("["+u.join(", ")+"]")}for(var c=i.join(", "),d=[],h=t.getModel().getAggrFunctions(),p=function(t){var e=r.find((function(e){return e.id==t.colId})),n=h.find((function(e){return e.id==t.funcId}));e&&n&&d.push(e.caption+" ("+n.caption+")")},f=0,g=o;f<g.length;f++){p(g[f])}var m=d.join(", ");return(c||s.i18n.getText("AggrSettings","NoGroupsLabel"))+" ::: "+(m?"<"+m+">":s.i18n.getText("AggrSettings","NoAggrsLabel"))}return s.i18n.getText("AggrSettings","EmptySettingsLabel")},e.prototype.render=function(){this.slot.classList.add(this.cssPrefix+"-panel");var t=u.a.getMobileCssClass();t&&this.slot.classList.add(t),this.dialogLink||(this.dialogLink=document.createElement("a"),this.dialogLink.setAttribute("href","javascript:void(0)"),this.slot.appendChild(this.dialogLink)),this.dialogLink.textContent=this.getLinkText(),this.dialogLink.removeEventListener("click",this.linkClickCallback),this.dialogLink.addEventListener("click",this.linkClickCallback)},e.prototype.clear=function(){this.slot.innerHTML="",this.dialogLink=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e.prototype.getQuery=function(){return this.customQuery||this.context.getQuery()},e}(s.Widget),ce=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),de=function(t){function e(e){var n=t.call(this,e)||this;return n.changeLocale=function(){var t=n.selectEl.value;r.g.setCurrentLocale(t),n.context.refreshWidgets(s.WidgetGroup.All)},n.group=s.WidgetGroup.None,n}return ce(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.clear(),this.render()},e.prototype.getWidgetType=function(){return"changeLocale"},e.prototype.render=function(){var t=r.g.getLocales();if(t.length>1){this.selectEl=document.createElement("select");for(var e=0,n=t;e<n.length;e++){var o=n[e],i=document.createElement("option");i.value=o.locale,i.innerHTML=this.displayLocaleName(o),this.selectEl.appendChild(i)}this.selectEl.value=r.g.getCurrentLocale(),this.selectEl.classList.add("eqv-select"),this.selectEl.addEventListener("change",this.changeLocale),this.slot.appendChild(this.selectEl)}},e.prototype.displayLocaleName=function(t){return t.englishName&&t.displayName?t.englishName+" - "+t.displayName:t.englishName?t.englishName:t.displayName?t.displayName:t.locale},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(s.Widget),he=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),pe=function(t){function e(e){var n=t.call(this,e)||this;return n.queryEventCallbackId=null,n.group=s.WidgetGroup.Query|s.WidgetGroup.QueryStatus,n}return he(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-query-name"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"queryName"},e.prototype.refreshCore=function(){this.render()},e.prototype.render=function(){this.slot.classList.add(""+this.cssPrefix);var t=u.a.getMobileCssClass();t&&this.slot.classList.add(t),this.nameSlot||(this.nameSlot=document.createElement("div"),this.nameSlot.classList.add(this.cssPrefix+"-text"),this.nameSlot.classList.add(this.cssPrefix+"-theme"),this.slot.appendChild(this.nameSlot)),this.asteriskSlot||(this.asteriskSlot=document.createElement("span"),this.asteriskSlot.innerHTML="*",this.asteriskSlot.classList.add(this.cssPrefix+"-asterisk"),this.slot.appendChild(this.asteriskSlot)),this.tooltipSlot||(this.tooltipSlot=document.createElement("span"),this.tooltipSlot.classList.add(this.cssPrefix+"-tooltip"),this.tooltipSlot.classList.add(this.cssPrefix+"-theme"),this.slot.appendChild(this.tooltipSlot));var e=this.context.getQuery().getName();this.nameSlot.textContent=e,this.tooltipSlot.textContent=e,this.asteriskSlot.style.visibility=this.context.getQuery().isModified()?"visible":"hidden"},e.prototype.clear=function(){this.slot.innerHTML="",this.nameSlot=null,this.tooltipSlot=null,this.asteriskSlot=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.context.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.context.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e}(s.Widget),fe=function(){function t(){this.domRoots=[document],this.defaultViewOptions={enableExport:!0,disableConfirmationOnQueryChange:!1,queryFileExtensions:"text/xml,application/json",result:{clearResultOnQueryChange:!0,showChart:!0,showProcessIndicator:!0},widgets:{resultGrid:{addColumns:!1}}},this.resultOptions={},this.enableExport=!1,this.resetContext(),this.renderSpinner()}return t.prototype.resetContext=function(){this.context=new s.EqContext,this.context.getServices().registerDialogServiceResolver((function(){return new a.b}))},t.prototype.init=function(t){try{this.context.initStart(),t&&t.shadowRoots&&(this.domRoots=this.domRoots.concat(t.shadowRoots)),t=this.initOptions(t),this.initWidgets(t),this.context.init(t),this.initDone()}catch(t){this.context.throwError({action:"Init",sourceError:t})}},t.prototype.initOptions=function(t){return(t=t?r.i.assignDeep({},this.defaultViewOptions,t):this.defaultViewOptions).handlers||(t.handlers={}),t.widgets||(t.widgets={}),this.resultOptions=r.i.assignDeep(this.resultOptions,t.result),void 0===this.resultOptions.showProcessIndicator?this.resultOptions.showProcessIndicator=!0:t.widgets.facetsPanel&&(t.widgets.facetsPanel.showProcessIndicator=this.resultOptions.showProcessIndicator),t.widgets.easyGrid||(t.widgets.easyGrid=t.widgets.resultGrid||{}),t.columnTitleFormat&&(t.widgets.entitiesPanel=t.widgets.entitiesPanel||{},t.widgets.entitiesPanel.columnTitleFormat=t.widgets.entitiesPanel.columnTitleFormat||t.columnTitleFormat,t.widgets.columnsBar=t.widgets.columnsBar||{},t.widgets.columnsBar.titleElementFormat=t.widgets.columnsBar.titleElementFormat||t.columnTitleFormat,t.widgets.columnsPanel=t.widgets.columnsPanel||{},t.widgets.columnsPanel.titleElementFormat=t.widgets.columnsPanel.titleElementFormat||t.columnTitleFormat),t.widgets.easyGrid.paging=r.i.assignDeep(this.resultOptions.paging,t.widgets.easyGrid.paging),this.enableExport=t.enableExport||!1,t.widgets.exportWidget||(t.widgets.exportWidget={}),t.widgets.exportWidget.enableExport=this.enableExport,t},t.prototype.initWidgets=function(t){var e="QueryPanel",n="ColumnsPanel",o="EntitiesPanel",i="ResultPanel",r="ColumnsBar",s="FilterBar",l="ProcessBar",u="StatementPanel",c="ChangeLocale",d="QueryNameLabel",h="ResultFacetsPanel",p="ResultCount",f="ExportButton",g="AggregationBar";t.slots&&(d=t.slots.queryNameLabel||d,e=t.slots.queryPanel||e,n=t.slots.columnsPanel||n,r=t.slots.columnsBar||r,o=t.slots.entitiesPanel||o,i=t.slots.resultPanel||i,u=t.slots.statementPanel||u,l=t.slots.processBar||l,c=t.slots.changeLocale||c,h=t.slots.facetsPanel||h,p=t.slots.resultCountSpan||p,s=t.slots.filterBar||s,f=t.slots.exportButtons||f,g=t.slots.aggregationBar||g);var m=this.resolveElement(o);m&&!this.entitiesPanelWidget&&(this.entitiesPanelWidget=this.createEntitiesPanelWidget(m),this.context.addWidget(this.entitiesPanelWidget));var y=this.resolveElement(n);y&&!this.columnsPanelWidget&&(this.columnsPanelWidget=this.createColumnsPanelWidget(y),this.context.addWidget(this.columnsPanelWidget));var v=this.resolveElement(r);v&&!this.columnsBarWidget&&(this.columnsBarWidget=this.createColumnsBarWidget(v),this.context.addWidget(this.columnsBarWidget));var C=this.resolveElement(e);if(C&&!this.queryPanelWidget&&(this.queryPanelWidget=this.createQueryPanelWidget(C),this.context.addWidget(this.queryPanelWidget)),this.resultPanelSlot=this.resolveElement(i),this.resultPanelSlot){if(!this.resultGridWidget){var b=Object(a.g)(this.resultPanelSlot,"div",{cssClass:"eqv-result-grid"});this.resultGridWidget=this.createResultGridWidget(b),this.context.addWidget(this.resultGridWidget)}if(this.resultOptions.showChart&&!this.chartWidget){var x=Object(a.g)(this.resultPanelSlot,"div",{cssClass:"eqv-chart-panel"});x.style.display="none",this.chartWidget=this.createChartWidget(x),this.context.addWidget(this.chartWidget)}}var w=this.resolveElement(d);w&&!this.queryNameWidget&&(this.queryNameWidget=this.createQueryNameWidget(w),this.context.addWidget(this.queryNameWidget));var E=this.resolveElement(s);E&&!this.filterBarWidget&&(this.filterBarWidget=this.createFilterBarWidget(E),this.context.addWidget(this.filterBarWidget));var T=this.resolveElement("SortingBar");T&&!this.sortingBarWidget&&(this.sortingBarWidget=this.createSortingBarWidget(T),this.context.addWidget(this.sortingBarWidget));var k=this.resolveElement(l);k&&!this.processWidget&&(this.processWidget=this.createProcessWidget(k),this.context.addWidget(this.processWidget));var D=this.resolveElement(u);D&&!this.statementPanelWidget&&(this.statementPanelWidget=this.createStatementPanelWidget(D),this.context.addWidget(this.statementPanelWidget));var M=this.resolveElement(c);if(M){var S=this.createLocaleWidget(M);this.context.addWidget(S)}var B=this.resolveElement(h);B&&!this.resultFacetPanelWidget&&(this.resultFacetPanelWidget=this.createResultFacetsPanel(B),this.context.addWidget(this.resultFacetPanelWidget));var I=this.resolveElement(f);I&&!this.exportWidget&&(this.exportWidget=this.createExportWidget(I),this.context.addWidget(this.exportWidget)),this.resultCountSlot=this.resolveElement(p);var O=this.resolveElement(g);O&&!this.aggregationBarWidget&&(this.aggregationBarWidget=this.createAggregationBarWidget(O),this.context.addWidget(this.aggregationBarWidget))},t.prototype.initDone=function(){},t.prototype.resolveElement=function(t){if("string"==typeof t){for(var e=0,n=this.domRoots;e<n.length;e++){var o=n[e].getElementById(t);if(o)return o}return null}return t},t.prototype.resolveElementsByClassName=function(t){for(var e=[],n=0,o=this.domRoots;n<o.length;n++)for(var i=o[n].querySelectorAll("."+t),r=0;r<i.length;r++)e.push(i[r]);return e},t.prototype.displayRecordsCount=function(t){this.resultCountSlot&&void 0!==t&&(this.resultCountSlot.style.display="inline",this.resultCountSlot.innerHTML=r.g.getText("MsgResultCount").replace("{0}",t.toString()))},t.prototype.getContext=function(){return this.context},t.prototype.setDialogService=function(t){this.context.getServices().registerDialogServiceResolver((function(){return t}))},t.prototype.executeQuery=function(t){console.warn("`executeQuery` is deprecated. Use `fetchData` instead"),this.fetchData(t)},t.prototype.fetchData=function(t){var e=this;t=t||{refresh:!0},this.showResultSpinner(),this.context.fetchData({elasticPaging:t.elasticPaging,success:function(n){e.hideResultSpinner(),e.toggleExportButtons(),e.displayRecordsCount(e.context.resultTable.getTotal()),!0===t.refresh&&e.context.refreshWidgets(s.WidgetGroup.Result),t.callback&&t.callback(),t.success&&t.success()},error:function(){e.hideResultSpinner()}})},t.prototype.toggleExportButtons=function(){this.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.enableExportButtons():this.disableExportButtons()},t.prototype.enableExportButtons=function(){},t.prototype.disableExportButtons=function(){},t.prototype.renderSpinner=function(){this._spinnerDiv=Object(a.i)("div").addClass("eqjs-result-spinner").addChild("div",(function(t){return t.addClass(l.b+"-progress-win8",u.a.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},t.prototype.showResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&!this._spinnerDiv.parentNode){for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];Object(a.i)(e).hide()}this.resultPanelSlot.appendChild(this._spinnerDiv)}},t.prototype.hideResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&this._spinnerDiv.parentNode){this._spinnerDiv.parentNode.removeChild(this._spinnerDiv);for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];Object(a.i)(e).show()}}},t.prototype.createChartWidget=function(t){return this.resultOptions.chartWidgetResolver?this.resultOptions.chartWidgetResolver(t):new Gt(t)},t.prototype.createResultGridWidget=function(t){return this.resultOptions.resultGridResolver?this.resultOptions.resultGridResolver(t):new St(t)},t.prototype.createEntitiesPanelWidget=function(t){return new d(t)},t.prototype.createColumnsPanelWidget=function(t){return new T(t)},t.prototype.createQueryPanelWidget=function(t){return new yt(t)},t.prototype.createLocaleWidget=function(t){return new de(t)},t.prototype.createProcessWidget=function(t){return new Pt(t)},t.prototype.createColumnsBarWidget=function(t){return new O(t)},t.prototype.createFilterBarWidget=function(t){return new Ct(t)},t.prototype.createSortingBarWidget=function(t){return new L(t)},t.prototype.createQueryNameWidget=function(t){return new pe(t)},t.prototype.createStatementPanelWidget=function(t){return new It(t)},t.prototype.createResultFacetsPanel=function(t){return new oe(t)},t.prototype.createExportWidget=function(t){return new re(t)},t.prototype.createAggregationBarWidget=function(t){return new ue(t)},t.prototype.detach=function(){this.entitiesPanelWidget&&(this.entitiesPanelWidget.destroy(),this.entitiesPanelWidget=null),this.columnsPanelWidget&&(this.columnsPanelWidget.destroy(),this.columnsPanelWidget=null),this.queryPanelWidget&&(this.queryPanelWidget.destroy(),this.queryPanelWidget=null),this.columnsBarWidget&&(this.columnsBarWidget.destroy(),this.columnsBarWidget=null),this.resultGridWidget&&(this.resultGridWidget.destroy(),this.resultGridWidget=null),this.chartWidget&&(this.chartWidget.destroy(),this.chartWidget=null),this.queryNameWidget&&(this.queryNameWidget.destroy(),this.queryNameWidget=null),this.processWidget&&(this.processWidget.destroy(),this.processWidget=null),this.localeWidget&&(this.localeWidget.destroy(),this.localeWidget=null),this.statementPanelWidget&&(this.statementPanelWidget.destroy(),this.statementPanelWidget=null),this.filterBarWidget&&(this.filterBarWidget.destroy(),this.filterBarWidget=null),this.sortingBarWidget&&(this.sortingBarWidget.destroy(),this.sortingBarWidget=null),this.statementWidget&&(this.statementWidget.destroy(),this.statementWidget=null),this.exportWidget&&(this.exportWidget.destroy(),this.exportWidget=null),this.resultFacetPanelWidget&&(this.resultFacetPanelWidget.destroy(),this.resultFacetPanelWidget=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),this.resultPanelSlot&&(this.resultPanelSlot.innerHTML="",this.resultPanelSlot=null),this.domRoots=[document],this.resetContext()},t}(),ge=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),me=function(t){function e(){var e=t.call(this)||this;e.exportButtons=[],e.disabledClass="eqjs-disabled",e.dropdownContainerClass="eqv-dropdown-container",e.dropdownButtonClass="eqv-drop-button",e.dropdownContentClass="eqv-dropdown-content",e.dropdownShowClass="eqv-dropdown-show",e._querySaveTemplate='<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"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n </div>\n </div>',e.queryListMenu=null,e.fetchDataButtonClickHandler=e.fetchDataButtonClick.bind(e),e.clearQueryButtonClickHandler=e.clearQueryButtonClick.bind(e),e.newQueryButtonClickHandler=e.newQueryButtonClick.bind(e),e.loadQueryButtonClickHandler=e.loadQueryButtonClick.bind(e),e.saveQueryButtonClickHandler=e.saveQueryButtonClick.bind(e),e.copyQueryButtonClickHandler=e.copyQueryButtonClick.bind(e),e.removeQueryButtonClickHandler=e.removeQueryButtonClick.bind(e),e.storageButtonClickHandler=e.storageDropButtonClick.bind(e),e.saveQueryToFileButtonClickHandler=e.saveQueryToFileButtonClick.bind(e),e.loadQueryFromFileButtonClickHandler=e.loadQueryFromFileButtonClick.bind(e);var n=e;return e.exportButtonClickHandler=function(t){if(!this.classList.contains(n.disabledClass)){var e=this.getAttribute("data-format");n.getContext().exportResult({format:e})}},e.queryChangedHandler=function(t){var n=t.data;e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(s.WidgetGroup.Result)),e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none"),e.options.syncQueryOnChange&&e.syncQuery(),e.options.fetchDataOnChange&&(!n||n.part!=s.QueryChangePart.ExtraData&&n.part!=s.QueryChangePart.Facets)&&e.fetchData()},e.outsideClickHandler=function(t){var n=null;t.target.matches("."+e.dropdownButtonClass)?n=t.target.parentElement.querySelector("."+e.dropdownContentClass):t.target.matches("."+e.dropdownButtonClass+" > span")&&(n=t.target.parentElement.parentElement.querySelector("."+e.dropdownContentClass));for(var o=e.resolveElementsByClassName(e.dropdownContentClass),i=0;i<o.length;i++){var r=o[i];n!=r&&r.classList.contains(e.dropdownShowClass)&&r.classList.remove(e.dropdownShowClass)}},e}return ge(e,t),e.prototype.refreshQueryList=function(){var t=this;this.queryListPanel&&(this.queryListPanel.innerHTML="",this.context.loadQueryList({success:function(e){var n=Object(a.i)("ul",t.queryListPanel).addClass("list-group list-group-flush");e.map((function(e){n.addChild("li",(function(n){n.addClass("list-group-item").setStyle("cursor","pointer").data("id",e.id).text(e.name).on("click",(function(){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}))}))}))}}))},e.prototype.initOptions=function(e){return this.options=t.prototype.initOptions.call(this,e),void 0===this.options.syncQueryOnChange&&(this.options.syncQueryOnChange=!0),window.addEventListener("click",this.outsideClickHandler),this.options},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var o="eqjs-export",i="QueryContentJson",r="ClearQueryButton",s="NewQueryButton",a="LoadQueryButton",l="SaveQueryButton",u="CopyQueryButton",c="RemoveQueryButton",d="StorageDropButton",h="FetchDataButton",p="LoadQueryFromFileButton",f="SaveQueryToFileButton",g="QueryListPanel";e.slots&&(i=e.slots.queryContentInput||i,h=e.slots.fetchDataButton||h,r=e.slots.clearQueryButton||r,s=e.slots.newQueryButton||s,a=e.slots.loadQueryButton||a,l=e.slots.saveQueryButton||l,u=e.slots.copyQueryButton||u,c=e.slots.removeQueryButton||c,d=e.slots.storageButton||d,o=e.slots.exportClass||o,p=e.slots.loadQueryFromFileButton||p,f=e.slots.saveQueryToFileButton||f,g=e.slots.queryListPanel||g),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll("."+o)))}),[]),e.enableExport||this.hideExportButtons(),this.disableExportButtons();this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})),this.fetchDataButton||(this.fetchDataButton=this.resolveElement(h),this.fetchDataButton||(this.fetchDataButton=this.resolveElement("ExecuteQueryButton")),this.fetchDataButton&&this.fetchDataButton.addEventListener("click",this.fetchDataButtonClickHandler)),this.clearQueryButton||(this.clearQueryButton=this.resolveElement(r),this.clearQueryButton&&this.clearQueryButton.addEventListener("click",this.clearQueryButtonClickHandler)),this.newQueryButton||(this.newQueryButton=this.resolveElement(s),this.newQueryButton&&this.newQueryButton.addEventListener("click",this.newQueryButtonClickHandler)),this.loadQueryButton||(this.loadQueryButton=this.resolveElement(a),this.loadQueryButton&&this.loadQueryButton.addEventListener("click",this.loadQueryButtonClickHandler)),this.saveQueryButton||(this.saveQueryButton=this.resolveElement(l),this.saveQueryButton&&this.saveQueryButton.addEventListener("click",this.saveQueryButtonClickHandler)),this.copyQueryButton||(this.copyQueryButton=this.resolveElement(u),this.copyQueryButton&&this.copyQueryButton.addEventListener("click",this.copyQueryButtonClickHandler)),this.removeQueryButton||(this.removeQueryButton=this.resolveElement(c),this.removeQueryButton&&this.removeQueryButton.addEventListener("click",this.removeQueryButtonClickHandler)),this.storageDropButton||(this.storageDropButton=this.resolveElement(d),this.storageDropButton&&this.storageDropButton.addEventListener("click",this.storageButtonClickHandler)),this.saveQueryToFileButton||(this.saveQueryToFileButton=this.resolveElement(f),this.saveQueryToFileButton&&this.saveQueryToFileButton.addEventListener("click",this.saveQueryToFileButtonClickHandler)),this.queryListPanel||(this.queryListPanel=this.resolveElement(g),this.queryListPanel||(this.queryListPanel=this.resolveElement("QueryListSlot")),this.queryListPanel&&this.context.addEventListener("ready",(function(){n.refreshQueryList()}))),this.loadQueryFromFileButton||(this.loadQueryFromFileButton=this.resolveElement(p),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput=document.createElement("input"),this.loadQueryFromFileInput.type="file",this.loadQueryFromFileInput.accept=e.queryFileExtensions,this.loadQueryFromFileInput.style.display="none",document.body.appendChild(this.loadQueryFromFileInput),this.loadQueryFromFileInput.addEventListener("change",this.loadQueryFromFileInputSelect.bind(this)),this.loadQueryFromFileButton.addEventListener("click",this.loadQueryFromFileButtonClickHandler)))},e.prototype.initDone=function(){t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback(this.queryChangedHandler)},e.prototype.syncQuery=function(){var t=this;this.context.syncQuery({success:function(e){e.statement&&t.context.refreshWidgets(s.WidgetGroup.Statement)}})},e.prototype.disableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!0,e.classList.contains(t.disabledClass)||e.classList.add(t.disabledClass)}))},e.prototype.enableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!1,e.classList.contains(t.disabledClass)&&e.classList.remove(t.disabledClass)}))},e.prototype.hideExportButtons=function(){this.exportButtons.forEach((function(t){t.style.display="none"}))},e.prototype.clearQueryButtonClick=function(){this.context.clearQuery(),this.context.refreshWidgets(s.WidgetGroup.Statement)},e.prototype.createNewQuery=function(t){return this.context.newQuery(t)},e.prototype.loadQuery=function(t){t&&this.context.loadQuery({queryId:t,silent:!1})},e.prototype.saveQuery=function(t,e){var n=this;this.context.saveQuery({success:function(){t&&t(),n.context.getQuery().fireChangedEvent({part:s.QueryChangePart.Properties,wasModified:!1}),n.refreshQueryList()},error:e})},e.prototype.saveCurrentQuery=function(t,e){var n=this;void 0===t&&(t=!1);var o=this.context.getQuery();o.isNewbie||t?this.showSaveQueryDialog((function(t){return new Promise((function(e){t&&(o.regenerateId(),o.setName(t),o.fireChangedEvent({part:s.QueryChangePart.Properties,wasModified:!0}),n.saveQuery((function(){e({success:!0})}),(function(t){return e({success:!1,message:t})})))}))})):this.saveQuery(e)},e.prototype.checkIfQueryModified=function(t){var e=this;this.context.getQuery().isModified()&&!this.options.disableConfirmationOnQueryChange?this.showQueryChangedDialog((function(n){n?e.saveCurrentQuery(!1,t):t()})):t()},e.prototype.removeCurrentQuery=function(){var t=this;this.context.removeQuery({success:function(){t.createNewQuery({useStorage:!1}),t.resultCountSlot&&(t.resultCountSlot.style.display="none"),t.context.clearResult(),t.refreshQueryList()}})},e.prototype.showNewQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=r.g.getText("NewQueryDefName"),o=e.open({title:r.g.getText("NewQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");n&&(t.value=n),document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("NewQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;o.disableButtons();var n=o.getRootElement().querySelector("header"),i=Object(a.i)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){n.removeChild(i),o.enableButtons(),t.success?o.close():o.showAlert(t.message,"error")}))}return!1}})},e.prototype.showQueryChangedDialog=function(t){this.context.getServices().getDialogService().openConfirm(r.g.getText("QueryChangedTitle"),r.g.getText("QueryChangedContent"),t)},e.prototype.showSaveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery(),o=n.isNewbie?n.getName():r.g.getText("SaveQueryDefName").replace("{queryName}",n.getName()),i=e.open({title:r.g.getText("SaveQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=o,document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("SaveQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;i.disableButtons();var n=i.getRootElement().querySelector("header"),o=Object(a.i)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){i.enableButtons(),n.removeChild(o),t.success?i.close():i.showAlert(t.message,"error")}))}return!1}})},e.prototype.showRemoveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery();e.openConfirm(r.g.getText("RemoveQueryTitle"),r.g.getText("RemoveQueryContent").replace("{queryName}",n.getName()),t)},e.prototype.showSaveQueryToFileDialog=function(t){var e=this.getContext().getServices().getDialogService(),n=this.context.getQuery(),o=this.renderSaveToFileDialogBody(n.getName()),i=e.open({title:r.g.getText("SaveQueryToFileDlgTitle"),body:o,onSubmit:function(){var e=o.querySelector("#kdlgFileNameInput"),n=e?e.value:"Query",r=o.querySelector("#kdlgFileFormatSelector"),s=r?r.value:"json";if(t){i.disableButtons();var l=i.getRootElement().querySelector("header"),u=Object(a.i)("div",l).addClass("eqjs-process-bar local").toDOM();return t(n,s).then((function(t){i.enableButtons(),l.removeChild(u),t.success?i.close():i.showAlert(t.message,"error")})),!1}return!0}})},e.prototype.renderSaveToFileDialogBody=function(t,e){void 0===e&&(e="json");var n=u.a.IsIE(),o=n?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right",i=n?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal";return Object(a.i)("div").addClass("kfrm-form").addChild("div",(function(n){n.addClass(o).addChild("label",(function(t){return t.attr("for","file_name").addText(r.g.getText("FileNameLabel"))})).addChild("div",(function(n){return n.addClass(i).addChild("input",(function(e){return e.id("kdlgFileNameInput").name("file_name").type("text").attr("value",t)})).addChild("label",(function(t){return t.addText(".")})).addChild("div",(function(t){return t.addClass("kfrm-select").addChild("select",(function(t){return t.id("kdlgFileFormatSelector").addClass("kdlg-form-control").addOption({value:"xml",selected:"xml"===e}).addOption({value:"json",selected:"json"===e})}))}))}))})).toDOM()},e.prototype.newQueryButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.createNewQuery()}))},e.prototype.saveQueryToFileButtonClick=function(){var t=this;this.showSaveQueryToFileDialog((function(e,n){return new Promise((function(o){t.context.getQueryFile({fileName:e,format:n,success:function(){return o({success:!0})},error:function(t){return o({success:!1,message:t})}})}))}))},e.prototype.loadQueryFromFileButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.showLoadQueryFromFileDialog()}))},e.prototype.showLoadQueryFromFileDialog=function(){this.loadQueryFromFileInput.click()},e.prototype.loadQueryFromFileInputSelect=function(){var t=this,e=this.loadQueryFromFileInput.files.item(0),n=new FormData;n.append(e.name,e),this.loadQueryFromFileInput.value="",this.context.uploadQueryFile({data:n,success:function(){t.syncQuery(),t.refreshQueryList()}})},e.prototype.loadQueryButtonClick=function(){var t=this;this.context.loadQueryList({success:function(e){t.fillLoadQueryButtonMenu(e),t.queryListMenu.showMenu({anchor:t.loadQueryButton,adjustHeight:!1,itemSelectedCallback:function(e){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}})}})},e.prototype.fillLoadQueryButtonMenu=function(t){var e=this.getContext().getQuery();this.queryListMenu=new p({items:t.map((function(t){return{id:t.id,text:t.name}})),selectedIds:e.getId()})},e.prototype.saveQueryButtonClick=function(){this.saveCurrentQuery()},e.prototype.copyQueryButtonClick=function(){this.saveCurrentQuery(!0)},e.prototype.removeQueryButtonClick=function(){var t=this;this.showRemoveQueryDialog((function(e){e&&t.removeCurrentQuery()}))},e.prototype.storageDropButtonClick=function(){var t=this,e=this.storageDropButton.parentElement.querySelector("."+this.dropdownContentClass);e&&window.setTimeout((function(){return e.classList.toggle(t.dropdownShowClass)}),100)},e.prototype.fetchDataButtonClick=function(){this.fetchData()},e.prototype.detach=function(){var e=this;this.enableExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.fetchDataButton&&(this.fetchDataButton.removeEventListener("click",this.fetchDataButtonClickHandler),this.fetchDataButton=null),this.clearQueryButton&&(this.clearQueryButton.removeEventListener("click",this.clearQueryButtonClickHandler),this.clearQueryButton=null),this.newQueryButton&&(this.newQueryButton.removeEventListener("click",this.newQueryButtonClickHandler),this.newQueryButton=null),this.loadQueryButton&&(this.loadQueryButton.removeEventListener("click",this.loadQueryButtonClickHandler),this.loadQueryButton=null),this.saveQueryButton&&(this.saveQueryButton.removeEventListener("click",this.saveQueryButtonClickHandler),this.saveQueryButton=null),this.copyQueryButton&&(this.copyQueryButton.removeEventListener("click",this.copyQueryButtonClickHandler),this.copyQueryButton=null),this.removeQueryButton&&(this.removeQueryButton.removeEventListener("click",this.removeQueryButtonClickHandler),this.removeQueryButton=null),this.storageDropButton&&(this.storageDropButton.removeEventListener("click",this.storageButtonClickHandler),this.storageDropButton=null),this.saveQueryToFileButton&&(this.saveQueryToFileButton.removeEventListener("click",this.saveQueryToFileButtonClickHandler),this.saveQueryToFileButton=null),this.queryListPanel&&(this.queryListPanel=null),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput&&document.body.removeChild(this.loadQueryFromFileInput),this.loadQueryFromFileButton.removeEventListener("click",this.loadQueryFromFileButtonClickHandler),this.loadQueryFromFileButton=null),t.prototype.detach.call(this)},e}(fe),ye=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ve=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ye(e,t),e.prototype.initOptions=function(e){var n=this;return e=t.prototype.initOptions.call(this,e),this.context.getQuery().addChangedCallback((function(){n.resultOptions.clearResultOnQueryChange&&n.context.clearResult(),e.syncQueryOnChange&&n.context.syncQuery()})),this.context.addEventListener("ready",this.fetchData.bind(this)),e},e.prototype.initWidgets=function(e){var n=this;if(t.prototype.initWidgets.call(this,e),this.sortingBarWidget&&this.context.getQuery().addChangedCallback((function(t){var e=t.data;!e||e.part!=s.QueryChangePart.SortingColumns&&e.part!=s.QueryChangePart.Columns&&e.part!=s.QueryChangePart.All||n.fetchData()})),this.filterBarWidget){var o=this.filterBarWidget.getWidgetType();e.widgets[o]=e.widgets[o]||{},e.widgets[o].applyFilterCallback||(e.widgets[o].applyFilterCallback=function(){n.fetchData()})}},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e.prototype.fetchData=function(){t.prototype.fetchData.call(this,{refresh:!0})},e}(fe),Ce=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),be=function(t){function e(){return t.call(this)||this}return Ce(e,t),e.prototype.createResultGridWidget=function(t){return new Et(t)},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e}(ve),xe=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 o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),we=function(t){function e(){var e=t.call(this)||this;return e.reports=[],e.reportCache=[],e.exportButtons=[],e.exportClass="eqjs-export",e.disabledClass="eqjs-disabled",e.enableExport=!1,e.useReportCache=!0,e.syncReportOnChange=!0,e.fetchDataOnChange=!1,e._reportSaveTemplate='<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"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n <label for="kdlg-dialog-form-textarea" id="kdlg-dialog-form-desc-label"></label>\n <textarea type="text" name="kdlg-dialog-form-textarea" id="kdlg-dialog-form-textarea"></textarea>\n </div>\n </div>',e.context.useStoredQueryOnFetch=!0,e.exportButtonClickHandler=function(t,n){if(!t.classList.contains(e.disabledClass)){var o=t.getAttribute("data-format");e.context.exportResult({format:o})}},e.clearReportButtonClickHandler=e.clearReportButtonClick.bind(e),e.newReportButtonClickHandler=e.newReportButtonClick.bind(e),e.loadReportButtonClickHandler=e.loadReportButtonClick.bind(e),e.saveReportButtonClickHandler=e.saveReportButtonClick.bind(e),e.removeReportButtonClickHandler=e.removeReportButtonClick.bind(e),e.updateReportButtonClickHandler=e.updateReportButtonClick.bind(e),u.a.onMobileModeChanged((function(t){document.location.reload()})),e}return xe(e,t),e.prototype.initOptions=function(e){return void 0!==(e=t.prototype.initOptions.call(this,e)).syncQueryOnChange&&(this.syncReportOnChange=e.syncQueryOnChange),void 0!==e.syncReportOnChange&&(this.syncReportOnChange=e.syncReportOnChange),e.syncQueryOnChange=this.syncReportOnChange,void 0!==e.useReportCache&&(this.useReportCache=e.useReportCache),this.defaultReportId=e.defaultReportId,e},e.prototype.initDone=function(){var e=this;t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback((function(t){var n=t.data;(n&&("query.switched"==n.changeType?(e.context.clearResult(),e.context.refreshWidgets(s.WidgetGroup.Result),e.context.refreshWidgets(s.WidgetGroup.Query)):(e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none"))),e.syncReportOnChange)&&(n&&"query.switched"!=n.changeType&&!n.noSync&&e.syncReport());n&&"query.switched"!=n.changeType&&n.part!=s.QueryChangePart.ExtraData&&n.part!=s.QueryChangePart.Facets&&(e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(s.WidgetGroup.Result)),e.fetchDataOnChange&&e.fetchData())})),window.setTimeout((function(){e.context.loadQueryList({success:function(t){Array.isArray(t)&&(e.reports=t,e.reports.filter((function(t){return t.id==e.defaultReportId})).length>0?e.renderReportList({reportId:e.defaultReportId}):e.renderReportList())}})}),100)},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var o="ClearReportButton",i="NewReportButton",r="LoadReportButton",s="SaveReportButton",a="RemoveReportButton",l="UpdateReportButton",u="ResultCount",c="ResultExportButtons",d=this.exportClass;e.slots&&(u=e.slots.resultCountSpan||u,c=e.slots.exportButtons||c,o=e.slots.clearReportButton||o,i=e.slots.newReportButton||i,r=e.slots.loadReportButton||r,s=e.slots.saveReportButton||s,a=e.slots.removeReportButton||a,l=e.slots.updateReportButton||l,d=e.slots.exportClass||d),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll("."+d)))}),[]),this.enableExport=e.enableExport,this.enableExport?this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})):this.hideExportButtons(),this.exportButtonsContainer=this.resolveElement(c),this.clearReportButton||(this.clearReportButton=this.resolveElement(o),this.clearReportButton&&this.clearReportButton.addEventListener("click",this.clearReportButtonClickHandler)),this.newReportButton||(this.newReportButton=this.resolveElement(i),this.newReportButton&&this.newReportButton.addEventListener("click",this.newReportButtonClickHandler)),this.loadReportButton||(this.loadReportButton=this.resolveElement(r),this.loadReportButton&&this.loadReportButton.addEventListener("click",this.loadReportButtonClickHandler)),this.saveReportButton||(this.saveReportButton=this.resolveElement(s),this.saveReportButton&&this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler)),this.removeReportButton||(this.removeReportButton=this.resolveElement(a),this.removeReportButton&&this.removeReportButton.addEventListener("click",this.removeReportButtonClickHandler)),this.updateReportButton||(this.updateReportButton=this.resolveElement(l),this.updateReportButton&&this.updateReportButton.addEventListener("click",this.updateReportButtonClickHandler)),this.reportListSlot=document.getElementById("ReportList"),this.resultCountSlot=this.resolveElement(u)},e.prototype.newReport=function(){var t=this,e=this.context.getServices().getDialogService().open({title:r.g.getText("NewReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=r.g.getText("NewReportDefName"),document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.g.getText("ReportDescLabel"),t.focus()},onSubmit:function(){var n=document.getElementById("kdlg-dialog-form-input").value;if(n&&n.replace(/\s/g,"").length>0){e.clearAlert(),e.disableButtons();var o=e.getRootElement().querySelector("header"),i=Object(a.i)("div",o).addClass("eqjs-process-bar local").toDOM(),r=document.getElementById("kdlg-dialog-form-textarea").value;t.context.newQuery({name:n,description:r,success:function(){e.close();var n=t.context.getQuery(),o=n.getId();t.insertIntoReportList({id:o,name:n.getName(),description:n.getDescription()}),t.renderReportList({reportId:o})},error:function(t){o.removeChild(i),e.enableButtons(),e.showAlert(t,"error")}})}return!1}})},e.prototype.loadReport=function(t){var e=this;if(!t)throw"Empty report ID!";var n=this.findReportById(t);if(n){var o=this.context.getQuery(),i=function(){e.renderReportProps(),o.fireChangedEvent({part:s.QueryChangePart.All,noSync:!0,changeType:"query.switched"}),e.fetchData()},r=this.useReportCache?this.getReportContentFromCache(n):null;r?(o.clear(),o.loadFromJson(r,{validate:!1}),i()):this.context.loadQuery({queryId:t,silent:!0,success:function(){e.saveReportContentInCache(n,o.toJSON()),i()}}),this.setActiveReport(t)}},e.prototype.saveCurrentReportAs=function(){var t=this,e=this.context.getQuery(),n=this.context.getServices().getDialogService().open({title:r.g.getText("SaveReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=e.getName(),document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.g.getText("ReportDescLabel"),document.getElementById("kdlg-dialog-form-textarea").value=e.getDescription(),t.focus()},onSubmit:function(){var o=document.getElementById("kdlg-dialog-form-input").value;if(o&&o.replace(/\s/g,"").length>0){e.setId(r.i.generateId(o.replace(/\s/g,""))),n.clearAlert(),n.disableButtons();var i=n.getRootElement().querySelector("header"),l=Object(a.i)("div",i).addClass("eqjs-process-bar local").toDOM(),u=document.getElementById("kdlg-dialog-form-textarea").value;e.setDescription(u),t.context.newQuery({clearQuery:!1,name:o,success:function(){n.close(),t.context.refreshWidgets(s.WidgetGroup.Query);var o=t.context.getQuery().getId();t.fetchData(),t.insertIntoReportList({id:o,name:e.getName(),description:e.getDescription()}),t.renderReportList({reportId:o}),t.setActiveReport(o),t.renderReportProps()},error:function(t){i.removeChild(l),n.enableButtons(),n.showAlert(t,"error")}})}return!1}})},e.prototype.removeCurrentReport=function(){var t=this,e=this.context.getQuery();this.context.getServices().getDialogService().openConfirm(r.g.getText("RemoveReportDlgTitle"),r.g.getText("RemoveReportContent").replace("{reportName}",e.getName())).then((function(n){if(n){var o=e.getId();t.context.removeQuery({queryId:o,success:function(){var e=t.removeFromReportList(o);t.renderReportList({reportIndex:e})}})}}))},e.prototype.syncReport=function(){var t=this;if(this.useReportCache){var e=this.context.getQuery(),n=this.findReportById(e.getId());n&&(n.lastUpdated=Date.now(),this.saveReportContentInCache(n,e.toJSON()))}this.context.syncQuery({success:function(e){e.query&&t.context.refreshWidgets(s.WidgetGroup.Query),e.statement&&t.context.refreshWidgets(s.WidgetGroup.Statement)}})},e.prototype.setActiveReport=function(t){for(var e=this.reportListSlot.querySelectorAll("li"),n=0;n<e.length;n++){var o=e[n];o.classList.remove("active"),o.getAttribute("data-rid")===t&&o.classList.add("active")}},e.prototype.renderReportProps=function(){var t=this.context.getQuery();document.getElementById("ReportTitle").innerHTML=t.getName();var e=document.querySelector(".columns-bar");if(e){e.innerHTML="<strong>Columns:</strong>";for(var n=0,o=t.getColumns();n<o.length;n++){var i=o[n];e.innerHTML+='<span class="label label-default">'+i.caption+"</span> "}}},e.prototype.renderReportList=function(t){if(this.renderReportPanels(),!this.reportListSlot.matches("li")){this.reportListSlot.innerHTML="",t=t||{reportId:this.reports.length>0?this.reports[0].id:null};var e=document.createElement("ul");e.className="list-group list-group-flush",this.reportListSlot.appendChild(e);for(var n=0,o=this.reports;n<o.length;n++){var i=o[n];this.renderReportItemInList(i,e)}if(t.reportId&&this.loadReport(t.reportId),void 0!==t.reportIndex){var r=t.reportIndex;r>=this.reports.length&&(r=this.reports.length-1),r<0&&this.reports.length>0&&(r=0),r>=0&&this.loadReport(this.reports[r].id)}}},e.prototype.detach=function(){var e=this;this.exportButtonsContainer&&(this.showExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.exportButtonsContainer=null),this.clearReportButton&&(this.clearReportButton.removeEventListener("click",this.clearReportButtonClickHandler),this.clearReportButton=null),this.newReportButton&&(this.newReportButton.removeEventListener("click",this.newReportButtonClickHandler),this.newReportButton=null),this.loadReportButton||(this.loadReportButton.removeEventListener("click",this.loadReportButtonClickHandler),this.loadReportButton=null),this.saveReportButton&&(this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler),this.saveReportButton=null),this.removeReportButton||(this.removeReportButton.removeEventListener("click",this.removeReportButtonClickHandler),this.removeReportButton=null),this.updateReportButton&&(this.updateReportButton.removeEventListener("click",this.updateReportButtonClickHandler),this.removeReportButton=null),this.reportListSlot&&(this.reportListSlot.innerHTML="",this.reportListSlot=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),t.prototype.detach.call(this)},e.prototype.renderReportItemInList=function(t,e){var n=this;e||(e=this.reportListSlot.querySelector("ul"));var o=t.name||t.description||"",i=document.createElement("li");i.className="list-group-item",i.style.cursor="pointer",i.setAttribute("data-rid",t.id),i.innerText=o,t.description&&(i.title=t.description),i.addEventListener("click",(function(t){var e=t.target.getAttribute("data-rid");n.loadReport(e),n.setActiveReport(e)})),e.appendChild(i)},e.prototype.renderReportPanels=function(){var t=document.getElementById("ReportsContainer"),e=document.getElementById("NoReportPanel");this.reports.length>0?(this.hideElement(e),this.showElement(t)):(this.hideElement(t),this.showElement(e))},e.prototype.hideElement=function(t){t&&(t.style.visibility="hidden")},e.prototype.showElement=function(t){t&&t.style.removeProperty("visibility")},e.prototype.insertIntoReportList=function(t){this.reports.push(t)},e.prototype.removeFromReportList=function(t){var e=this.indexOfReportById(t);return e>=0&&this.reports.splice(e,1),e},e.prototype.indexOfReportById=function(t){for(var e=0;e<this.reports.length;e++)if(this.reports[e].id===t)return e;return-1},e.prototype.clearReportButtonClick=function(){this.clearErrors(),this.context.clearQuery()},e.prototype.updateReportButtonClick=function(){this.fetchData()},e.prototype.saveReportButtonClick=function(){this.saveCurrentReportAs()},e.prototype.loadReportButtonClick=function(){this.loadReport("LastQuery")},e.prototype.removeReportButtonClick=function(){this.removeCurrentReport()},e.prototype.newReportButtonClick=function(){this.newReport()},e.prototype.errorHandler=function(t){},e.prototype.clearErrors=function(){},e.prototype.disableExportButtons=function(){this.hideExportButtons()},e.prototype.enableExportButtons=function(){this.showExportButtons()},e.prototype.hideExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="none")},e.prototype.showExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="initial")},e.prototype.saveReportContentInCache=function(t,e){var n=this.findReportCacheItem(t.id);n||(n={id:t.id},this.reportCache.push(n)),n.lastUpdated=t.lastUpdated,n.content=e},e.prototype.getReportContentFromCache=function(t){var e=this.findReportCacheItem(t.id);return e&&e.lastUpdated===t.lastUpdated?e.content:null},e.prototype.findReportById=function(t){for(var e=0,n=this.reports;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e.prototype.findReportCacheItem=function(t){for(var e=0,n=this.reportCache;e<n.length;e++){var o=n[e];if(o.id===t)return o}return null},e}(fe);r.g.addMapper((function(t){if(t||t.texts)for(var e in t.texts)switch(e){case"PredicateTitle":t.texts.ConditionGroupTitle=t.texts[e];break;case"RootPredicateTitle":t.texts.RootConditionGroupTitle=t.texts[e];break;case"ErrIncorrectPredicateTitleFormat":t.texts.ErrIncorrectGroupTitleFormat=t.texts[e];break;case"ButtonAddPredicate":t.texts.ButtonAddGroup=t.texts[e];break;case"ButtonDelete":t.texts.CmdDelete=t.texts[e];break;case"ButtonClear":t.texts.CmdClear=t.texts[e];break;case"ButtonEnable":t.texts.CmdToggleEnable=t.texts[e];break;case"ButtonAddCondition":t.texts.CmdAddCondition=t.texts[e];break;case"ButtonAddGroup":t.texts.CmdAddCondGroup=t.texts[e]}})),r.g.updateDefaultTexts({AltMenuAttribute:"Attribute",AltMenuConstantExpression:"Constant expression",ButtonApply:"Apply",ButtonCancel:"Cancel",ButtonClose:"Close",ButtonNext:"Next",ButtonPrev:"Prev",ButtonNow:"Now",ButtonOK:"OK",MenuEnable:"Enabled",MenuParameterization:"Parameterized",MenuJoinCond:"Use in JOIN",CmdClear:"Clear",CmdDelete:"Delete",CmdToggleEnable:"Toggle enable",CmdAddCondition:"Add condition",CmdAddCondGroup:"Add group of conditions",ButtonSelectAll:"Select all",ButtonDeselectAll:"Clear selection",ButtonAddColumns:"Add column(s)",ButtonAddConditions:"Add condition(s)",CmdClickToAddCondition:"[Add new condition]",CmdDeleteRow:"Delete this row",ErrIncorrectGroupTitleFormat:"Incorrect condition group title format",ErrNotNumber:" is not a number",ErrIncorrectInteger:"Incorrect integer value",ErrIncorrectNumberList:"Incorrect list format",False:"False",LinkTypeAll:"all",LinkTypeAny:"any",LinkTypeNone:"none",LinkTypeNotAll:"not all",ConjAll:"and",ConjAny:"or",ConjNotAll:"and",ConjNone:"or",MsgApplySelection:"[Apply selection]",MsgAs:"as",MsgEmptyList:"(empty list)",MsgEmptyListValue:"[select value]",MsgEmptyScalarValue:"[enter value]",MsgSubQueryValue:"[edit sub-query]",MsgEmptyAttrValue:"[select attribute]",MsgEmptyOperator:"[Unrecognized operator]",MsgEmptyCustomSql:"[enter SQL expression]",MsgCustomSql:"[Custom SQL]",MsgNoResult:"No result",MsgResultCount:"{0} records found",MsgOf:"of",ConditionGroupTitle:"{lt} of the following apply",RootConditionGroupTitle:"Select records where {lt} of the following apply",StrAddConditions:"Add conditions",SubQueryDialogTitle:"Edit sub-query",SubQueryColumnTitle:"Column:",SubQueryEmptyColumn:"[select column]",SubQueryQueryPanelCaption:"Conditions",True:"True",ButtonSorting:"Sorting",ButtonToAggr:"Change to aggregate column",ButtonToSimple:"Change to simple column",ButtonFormat:"Display format",CmdAscending:"Ascending",CmdClickToAddColumn:"[Add new column]",CmdDeleteColumn:"Delete column",CmdDeleteSorting:"Delete sorting",CmdDescending:"Descending",CmdGroupSort:"Sorting",CmdGroupFormat:"Display format",CmdNotSorted:"Not sorted",ColTypeAggrFunc:"Aggregate function",ColTypeCompound:"Calculated",ColTypeGroup:"Column type",ColTypeSimple:"Simple column",HeaderExpression:"Expression",HeaderSorting:"Sorting",HeaderTitle:"Title",SortHeaderColumn:"Column",SortHeaderSorting:"Sorting",StrAddColumns:"Add columns",CustomExpression:"Custom Expression",AddAllForEntityText:"[Add all attributes]",CmdMoveToStart:"Move to start",CmdMoveRight:"Move right",CmdMoveLeft:"Move left",CmdMoveToEnd:"Move to the end",CmdMoveUp:"Move up",CmdMoveDown:"Move down",ButtonMenu:"Show menu",CmdToSimple:"Not aggregated",CmdMoveToFirst:"Move to the first",CmdMoveToPrev:"Move to the previous",CmdMoveToNext:"Move to the next",CmdMoveToLast:"Move to the last",CmdHiddenColumn:"Hidden",RowButtonTitle:"Click to see the available options",EntityToggle:"Toggle entity",StrNoFilterDefined:"No filter defined",StrNoFilterClickToAdd:"No filter defined. Click to add a new condition",HintHours:"Hours",HintMinutes:"Minutes",RemoveQueryTitle:"Confirmation",RemoveQueryContent:"Remove query [{queryName}]?",NewQueryTitle:"New query",NewQueryContent:"New query name: ",NewQueryDefName:"New query",SaveQueryTitle:"Save query",SaveQueryContent:"Query name: ",SaveQueryDefName:"{queryName} copy",QueryChangedTitle:"Confirmation",QueryChangedContent:"The query was changed. Do you want to save it first?",UpdateQuerySelector:"[click here to load the query]",FileNameLabel:"File name: ",SaveQueryToFileDlgTitle:"Save query to file",NewReportDefName:"New report",NewReportDlgTitle:"New report",SaveReportDlgTitle:"Save report",SaveReportDlgLabel:"Report name:",ReportDescLabel:"Description: ",RemoveReportDlgTitle:"Remove report",RemoveReportContent:"Are you sure you want to remove '{reportName}'?",Facets:{TotalRecordsLabel:"Total records:",AddMenuItems:{Chart:"Chart",Pivot:"Pivot table",DataTable:"Data table"},LoadDataDlgTitle:"Downloading data",LoadDataDlgContent:"Records loaded: {loadedRecs}/{totalRecs}",RefreshBtnTitle:"Refresh",ExportBtnTitle:"Export",MaximizeBtnTitle:"Maximize",RestoreBtnTitle:"Restore Down",RemoveFacetDlgTitle:"Remove facet",RemoveFacetDlgContent:"Are you sure, that you want to delete {facetTitle} tab?",DefaultDlgTitle:"Setup facet",DefaultFacetTitle:"",NewFacetTitle:"New Facet",TabNameLabel:"Tab name",ErrQueryChanged:"FAILED TO DISPLAY. QUERY WAS CHANGED",ErrNotEnoughData:"We can't display the graph because not all data for this query is loaded. \n The total number of records: {totalRecs}, currently loaded: {cachedRecs}. \n You can [download the result]. Please note: this may take some time and consume a lot of memory.",Chart:{FacetTitle:"Chart",DlgTitle:"Chart settings",DataColumnSelectorLabel:"Data column",LabelColumnSelectorLabel:"Label column",ChartTypeSelectorLabel:"Chart type",ShowLegendLabel:"Show legend (if available)"},Pivot:{FacetTitle:"Pivot table",DlgTitle:"Pivot settings",SwapBtnTitle:"Swap column and row fields",ColumnFieldSelectorLabel:"Column field",RowFieldSelectorLabel:"Row field",CellDataSelectorLabel:"Cell data",TotalsRowLabel:"Totals row",TotalsColLabel:"Totals column",TotalGridLabel:"Total"},DataTable:{FacetTitle:"Result table",DlgTitle:"Table facet settings"}},TotalsDlgLabel:"Totals",GrandTotalsLabel:"Grand totals",TotalsDlgTitle:"Select totals",ExportDlgTitle:"Export result",ExportDlgFmtLabel:"Format",csv:"CSV",excel:"Excel",pdf:"PDF","excel-html":"HTML (Excel-compatible)",AggrSettings:{GroupBtn:"Group selected column(s)",UngroupBtn:"Ungroup columns",AggrBtn:"Aggregate selected column",UnaggrBtn:"Remove column aggregation",GrandTotalsLabel:"Show grand totals",GroupCountsLabel:"Show record count for groups",EnableAggrLabel:"Enable aggregation",SelectedError:"Complete the action with selected column(s)",NoGroupsOrAggrError:"Add at least one group or aggregation",NoGroupsOrGrandError:"Add at least one group, or enable grand totals",NoAggrOrCountError:"Add at least one aggregation, or enable records count",NoGroupsLabel:"No groups",NoAggrsLabel:"No aggregations",EmptySettingsLabel:"[ Click to setup ]"},ChartType:{Area:"Area chart",Bar:"Bar chart",Column:"Column chart",Combo:"Combo chart",Doughnut:"Doughnut chart",Polar:"Polar chart",Radar:"Radar chart",Histogram:"Histogram chart",Line:"Line chart",SteppedLine:"Stepped line chart",Pie:"Pie chart"}}),s.EqServiceProvider.prototype.registerDialogServiceResolver=function(t){this.dialogServiceResolver=t},s.EqServiceProvider.prototype.getDialogService=function(){if(!this.dialogService){if(!this.dialogServiceResolver)throw"DialogServiceResolver is not defined";this.dialogService=this.dialogServiceResolver()}return this.dialogService},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),window.NodeList&&!window.NodeList.prototype.forEach&&(window.NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.findIndex||(Array.prototype.findIndex=function(t){if(null==this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),o=n.length>>>0,i=arguments[1],r=0;r<o;r++)if(e=n[r],t.call(i,e,r,n))return r;return-1})}])}));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("easyqueryCore")):"function"==typeof define&&define.amd?define("easyqueryUI",["easyqueryCore"],e):"object"==typeof exports?exports.easyqueryUI=e(require("easyqueryCore")):t.easyqueryUI=e(t.easyqueryCore)}(window,(function(__WEBPACK_EXTERNAL_MODULE__2__){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));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=6)}([function(t,e,n){"use strict";var i,o;n.d(e,"d",(function(){return i})),n.d(e,"a",(function(){return E})),n.d(e,"b",(function(){return f})),n.d(e,"c",(function(){return M})),n.d(e,"e",(function(){return S})),n.d(e,"f",(function(){return I})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return 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"}(i||(i={})),function(t){t[t.Data=0]="Data",t[t.Virtual=1]="Virtual",t[t.Lookup=2]="Lookup"}(o||(o={}));var r,s="Unknown",a="EDIT",l="DATETIME";!function(t){t.Trace="TRACE",t.Options="OPTIONS",t.Get="GET",t.Put="PUT",t.Post="POST",t.Delete="DELETE"}(r||(r={}));var u,c,d=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(": "),o=i.shift(),r=i.join(": ");t[o]=r}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 h(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"},o={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":o},s=[];function a(t){for(var e=0,n=s;e<n.length;e++){(0,n[e])(t)}}function l(){return e.localeId}function u(t){var n=r[t];n?c.assignDeep(e,n):(e.englishName=t,e.displayName=t,e.texts=c.assignDeep({},o.texts)),e.localeId=t}function d(){return e.settings}function h(t){e.settings||(e.settings=c.assignDeep({},n)),e.settings=c.assignDeep(e.settings,t)}function p(t,n){a(n);var i=e;t&&(n.localeId||(n.localeId=t),(i=r[t])||(i=c.assignDeep({},o),r[t]=i)),c.assignDeep(i,n)}function f(){var t,n,i,o,r,s,a="object"==typeof navigator?navigator.language:void 0;t=a,n=new Date(2020,5,7,19,34,56,88),i=n.toLocaleDateString(t,{year:"numeric",month:"numeric",day:"numeric"}),o=n.toLocaleTimeString(t,{hour:"numeric",minute:"numeric",second:"numeric"}),r=i.replace("07","dd").replace("7","d").replace("06","MM").replace("6","M").replace("2020","yyyy").replace("20","yy"),s=o.replace("19","HH").replace("07","hh").replace("7","h").replace("34","mm").replace("56","ss").replace("PM","tt"),e.settings||(e.settings={}),h({shortDateFormat:r,shortTimeFormat:s})}function g(t){var e,n=d();switch(t){case i.Date:e=n.shortDateFormat;break;case i.Time:e=n.shortTimeFormat;break;default:e=n.shortDateFormat+" "+n.shortTimeFormat}return e}function m(t){var e,n=d();switch(t){case i.Date:e=n.longDateFormat;break;case i.Time:e=n.longTimeFormat;break;default:e=n.longDateFormat+" "+n.longTimeFormat}return e}t.addMapper=function(t){s.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=l,t.setLocale=function(t){console.warn("This method is deprecated. Use setCurrentLocale instead"),u(t)},t.setCurrentLocale=u,t.getText=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=e.texts,o="";if(t&&t.length)for(var r=t.length,s=0;s<r&&"object"==typeof(o=i[t[s]]);s++)i=o;return o},t.getLocaleSettings=d,t.getOneLocaleSetting=function(t){return e.settings[t]},t.getShortMonthName=function(t){var e=d();if(t>0&&t<13)return e.shortMonthNames[t-1];throw"Wrong month number: "+t},t.getLongMonthName=function(t){var e=d();if(t>0&&t<13)return e.longMonthNames[t-1];throw"Wrong month number: "+t},t.getShortWeekDayName=function(t){var e=d();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=d();if(t>0&&t<8)return e.longWeekDayNames.length>=t?e.longWeekDayNames[t-1]:t.toString();throw"Wrong month number: "+t},t.updateLocaleSettings=h,t.updateLocaleTexts=function(t){"object"==typeof t?(a({localeId:e.localeId,texts:t}),c.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=c.assignDeep({},t,i.texts)}e.texts=c.assignDeep({},t,e.texts)},t.updateLocaleInfo=p,t.addLocale=function(t,e){p(t,e)},t.resetLocales=function(){e||(e=c.assignDeep({},o),f())},t.dateTimeToStr=function(t,e,n){return n?"d"==n?n=g(i.Date):"D"==n?n=m(i.Date):"f"==n?n=g(i.DateTime):"F"==n&&(n=m(i.DateTime)):n=g(e),c.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(!y[n]){var i=n.split("|").filter((function(t){return t.length>0})).map((function(t){return t.split("=")}));if(y[n]={},i.length>0)if(i[0].length>1)for(var o=0,r=i;o<r.length;o++){var s=r[o];y[n][Number.parseInt(s[1])]=s[0]}else i.forEach((function(t,e){y[n][e]=t[0]}))}var a=y[n];if(void 0!==a[e]){s=a[e];return t.getText(s)||s}return e.toString()}(e,n.slice(1));if(["D","F","C"].indexOf(i)>=0){var o=l();return e.toLocaleString(o,function(t){var e=d(),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}}}(n))}return function(t,e){for(var n=t.toString(),i="",o=n.length-1,r=e.length-1;r>=0;r--){var s=e.charAt(r);"#"===s||"0"===s?o>=0?(i+=n.charAt(o),o--):"0"===s&&(i+=0):i+=s}return i.split("").reverse().join("")}(Math.trunc(e),n)}var r=d();return c.numberToStr(e,r.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 o=i[e?1:0];return t.getText(o)||o}}return""+e};var y={}}(u||(u={})),function(t){t.getAllDataTypes=function(){return Object.values(i).filter((function(t){return"number"==typeof t}))},t.getDateDataTypes=function(){return[i.Time,i.Date,i.DateTime]},t.getStringDataTypes=function(){return[i.String,i.Memo,i.FixedChar]};var e=[i.Byte,i.Word,i.Int32,i.Int64,i.Float,i.Currency,i.Autoinc];t.getNumericDataTypes=function(){return e};var n=[i.Byte,i.Word,i.Int32,i.Int64,i.Autoinc];function o(t,e,n){e||(e={});for(var i=0,s=n;i<s.length;i++){var a=s[i];if(a)for(var l in a)if(a.hasOwnProperty(l)){var u=a[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]),o(t,e[l],[u])):e[l]=u}}return e}function r(t){for(var e=[],n=0,i=t;n<i.length;n++){var o=i[n];e.push(o)}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 o=e[i];if(o)for(var r in o)o.hasOwnProperty(r)&&(t[r]=o[r])}return t},t.assignDeep=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return o(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,o=0;o<n&&o<i;o++)e[o]=t[o]},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 o=t.length>>>0,r=n>>0,s=r<0?Math.max(o+r,0):Math.min(r,o),a=void 0===i?o:i>>0,l=a<0?Math.max(o+a,0):Math.min(a,o);s<l;)t[s]=e,s++;return t},t.shiftToFitWindow=function(t,e){var n=document.getElementsByTagName("body")[0],i=window.innerWidth||document.documentElement.clientWidth||n.clientWidth,o=t+e,r=0;return o>i&&t+(r=i-o-10)<0&&(r=10-t),r},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==i.Unknown||e==i.Unknown||t==e||t==i.Date&&e==i.DateTime||t==i.DateTime&&e==i.Date},t.isPropSet=function(t,e){return t[e]||t[e.toLowerCase()]||t[e.toUpperCase()]};var s="0123456789abcdefghijklmnopqrstuvwxyz";function a(t,e){var n=t.length;if(n>e){var i=n/e,o="";o+=t[0];for(var r=i,s=void 0,a=1;a<n;a++)s=t[a],a+1>r&&(o+=s,r+=i);return o}return t}function l(t,e,n){return t.substr(0,e)+n+t.substr(e+n.length)}function c(t,e){return Math.floor(Math.random()*(e-t))+t}function d(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,o=e;n.length<e&&(i=e/n.length,o=n.length);for(var r="",s=0;s<o;s++)r+=a(n[s],i);return r}(t,4):t;e&&e.length>0&&(e+="-");var n=h("",2),i=s.length-1;return n=l(n,0,s[c(0,i)]),e+(n=l(n,1,s[c(0,i)]))+function(t){var e=36,n=14,i=h("",n),o=t;do{i=l(i,n--,s[o%e]),o=Math.floor(o/=e)}while(o>0);return r=i.trim(),r.split("").reverse().join("");var r}(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("-"),o=n.split("-"),r=i.indexOf("MM"),s=i.indexOf("dd"),a=i.indexOf("yyyy"),l=i.indexOf("HH"),u=i.indexOf("mm"),c=i.indexOf("ss"),h=new Date;try{var p=a>-1&&a<o.length?d(o[a]):h.getFullYear(),f=r>-1&&r<o.length?d(o[r])-1:h.getMonth()-1;if(f>11)throw"";var g=s>-1&&s<o.length?d(o[s]):h.getDate();if(g>function(t,e){return new Date(e,t+1,0).getDate()}(f,p))throw"";var m=l>-1&&l<o.length?d(o[l]):0;if(m>23)throw"";var y=u>-1&&u<o.length?d(o[u]):0;if(y>59)throw"";var v=c>-1&&c<o.length?d(o[c]):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?d(e[0]):0;if(n>23)throw"";var i=e.length>1?d(e[1]):0;if(i>59)throw"";var o=e.length>1?d(e[1]):0;if(o>59)throw"";return new Date(0,0,0,n,i,o)}catch(e){throw t+" is not a valid time."}};var p=/\[([^\]]+)]|y{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(),i=t.getMonth()+1,o=t.getDate(),r=t.getHours(),s=t.getMinutes(),a=t.getSeconds(),l=r%12||12,c=r>11,d={yyyy:n.toString(),MMMM:u.getLongMonthName(i),MMM:u.getShortMonthName(i),MM:i<10?"0"+i:i.toString(),M:i.toString(),dd:o<10?"0"+o:o.toString(),d:o.toString(),HH:r<10?"0"+r:r.toString(),H:r.toString(),hh:l<10?"0"+l:l.toString(),h:l.toString(),tt:c?"PM":"AM",mm:s<10?"0"+s:s.toString(),ss:a<10?"0"+a:a.toString()};return e.replace(p,(function(t,e){return e||d[t]}))},t.numberToStr=function(t,e){return e=e||u.getLocaleSettings().decimalSeparator,t.toString().replace(".",e)}}(c||(c={}));var p,f,g=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}(),m=(p=function(t,e){return p=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])},p(t,e)},function(t,e){function n(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),y=function(){return y=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},y.apply(this,arguments)},v=function(t){function e(e,n){var i=t.call(this,n)||this;return i.status=e,i}return m(e,t),e}(Error),C=(function(){function t(){this.defaultHeaders={},this.customPayload=void 0}t.prototype.get=function(t,e){return this.send(r.Get,t,null,e)},t.prototype.post=function(t,e,n){return this.send(r.Post,t,e,n)},t.prototype.put=function(t,e,n){return this.send(r.Put,t,e,n)},t.prototype.delete=function(t,e,n){return this.send(r.Delete,t,e,n)},t.prototype.send=function(e,n,i,o){var r=(o=o||{}).dataType||"json",s=o.contentType||"form-data"!==r?"application/json":null;i&&"form-data"!=r&&this.customPayload&&(i.data=c.assignDeep(i.data||{},this.customPayload));var a=new("onload"in new XMLHttpRequest?XMLHttpRequest:window.XDomainRequest),l={method:e,url:n,headers:y(y({},this.defaultHeaders),o.headers||{}),queryParams:o.queryParams||{},data:i};s&&(l.headers["Content-Type"]=s);var u=new d(a,l);this.beforeEachRequest&&(console.warn("HttpClient: 'beforeEachRequest' is deprecated and will be removed in future updates.\n Use 'onRequest' instead"),this.beforeEachRequest(u)),this.onRequest&&this.onRequest(u);var h=u.data&&"string"!=typeof u.data&&"json"==r?JSON.stringify(u.data):u.data;return u.open(),new g(u,new Promise((function(e,i){o.responseType&&(a.responseType=o.responseType),a.onreadystatechange=function(){if(4==a.readyState){var o=a.getResponseHeader("Content-Type")||"",r=a.status;if(r>=400){("arraybuffer"===a.responseType||"blob"===a.responseType?t.decodeArrayBuffer(a.response):Promise.resolve(a.responseText)).then((function(t){var e=0==o.indexOf("application/json")?JSON.parse(t):t,s=e.message||(404==r?"No such endpoint: "+n:e);i(new v(r,s))}))}else{var s="arraybuffer"===a.responseType||"blob"===a.responseType?a.response:0==o.indexOf("application/json")?JSON.parse(a.responseText):a.responseText;e(s)}}},a.send(h)})))},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]))}))}}(),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 o=t.createEntityAttr(this);o.loadFromData(t,e.attrs[n]),this.attributes.push(o)}}},t.prototype.scan=function(t,e){var n={stop:!1},i=function(o){if(e&&e(o,n),o.attributes)for(var r=o.attributes.length,s=0;s<r&&!n.stop;s++){var a=o.attributes[s];if(t&&t(a,n),n.stop)return}if(o.subEntities){var l=o.subEntities.length;for(s=0;s<l&&!n.stop;s++)i(o.subEntities[s])}};i(this)},t.prototype.getFirstPrimaryAttr=function(){return this.getPrimaryAttrs()[0]},t.prototype.getPrimaryAttrs=function(){return this.attributes.filter((function(t){return t.isPrimaryKey}))},t}()),b=function(){function t(t){this.id="",this.caption="{Unrecognized attribute}",this.dataType=i.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=o.Data}return t.prototype.loadFromData=function(t,e){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,this.isNullable=c.getIfDefined(e.nul,this.isNullable),this.isEditable=c.getIfDefined(e.ied,this.isEditable),this.showOnView=c.getIfDefined(e.ivis||e.sov,this.showOnView),this.showOnCreate=c.getIfDefined(e.soc,this.showOnCreate),this.showOnEdit=c.getIfDefined(e.soe,this.showOnEdit),this.showInLookup=c.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}(),x=function(){function t(){this.id="",this.tag=s,this.resType=i.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 o=i[n];t.indexOf(o.id)>=0&&(e+=o.text+",")}else for(var r=0,s=this.values;r<s.length;r++){(o=s[r]).id===t&&(e+=o.text+",")}return e&&(e=e.substring(0,e.length-1)),e},t}(),w=(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 C(t)},t.prototype.createEntityAttr=function(t){return new b(t)},t.prototype.createValueEditor=function(){return new x},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 o in t.displayFormats){var r=i[o],s=t.displayFormats[o]||new Array;this.displayFormats.set(r,s)}},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 o=t.attributes.length;for(n=0;n<o;n++)if(t.attributes[n].id==e)return t.attributes[n]}if(t.subEntities){var r=t.subEntities.length;for(n=0;n<r;n++)if(i=this.getEntityAttrById(t.subEntities[n],e))return i}return null},t.prototype.listByEntityWithFilter=function(t,e){var n,i=new Array,o=null;if(t.subEntities)for(var r=t.subEntities.length,s=0;s<r;s++){if(o=t.subEntities[s],!e||e(o,null))(n=u.getText("Entities",o.name))||(n=o.caption),(h=c.assign(this.createEntity(),{id:o.name,text:n,items:[],isEntity:!0})).items=this.listByEntityWithFilter(o,e),h.items.length>0&&i.push(h)}var a=null;if(t.attributes)for(var l=t.attributes.length,d=0;d<l;d++)if(a=t.attributes[d],!e||e(t,a)){(n=u.getText("Attributes",a.id))||(n=a.caption);var h=c.assign(this.createEntity(),{id:a.id,text:n,dataType:a.dataType});i.push(h)}return i},t.prototype.listByEntity=function(t,e,n){e=e||{};var i,o=[],r=[],s=null;if(t.subEntities)for(var a=t.subEntities.length,l=0;l<a;l++)if(s=t.subEntities[l],!n||n(s,null)){i=u.getText("Entities",s.name)||s.caption;var d=c.assign(this.createEntity(),{id:s.name,text:i,items:[],isEntity:!0,description:s.description}),h=c.assign({},e);h.includeRootData=!1,d.items=this.listByEntity(s,h,n),d.items.length>0&&o.push(d)}var p=null;if(t.attributes)for(var f=t.attributes.length,g=0;g<f;g++)p=t.attributes[g],n&&!n(t,p)||(i=u.getText("Attributes",p.id)||p.caption,r.push(c.assign(this.createEntityAttr(t),{id:p.id,text:i,dataType:p.dataType,lookupAttr:p.lookupAttr,description:p.description})));var m,y=function(t,e){return t.text.toLowerCase()==e.text.toLowerCase()?0:t.text.toLowerCase()>e.text.toLowerCase()?1:-1};return e.sortEntities&&(o.sort(y),r.sort(y)),m=e.attrPlacement&&0!=e.attrPlacement?r.concat(o):o.concat(r),2==e.attrPlacement&&m.sort(y),e.includeRootData?((i=u.getText("Entities",t.name))||(i=t.caption),{id:t.name,text:i,items:m}):m},t.prototype.clear=function(){this.rootEntity=this.createEntity(),this.editors=[],this.version=""},t.prototype.addDefaultValueEditors=function(){this.addOrUpdateValueEditor("_DTE",a,i.String).defValue="",this.addOrUpdateValueEditor("_DPDE",l,i.DateTime),this.addOrUpdateValueEditor("_DPTE",l,i.DateTime)},t.prototype.addOrUpdateValueEditor=function(t,e,n){var i=c.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 o="";if(t.caption&&!i){var r=u.getText("Entities",t.caption);o=r||t.caption}if(t.attributes)for(var s=t.attributes.length,a=0;a<s;a++)if(t.attributes[a].id==e)return o;if(t.subEntities){var l=t.subEntities.length;for(a=0;a<l;a++){var c=t.subEntities[a],d=this.getEntityPathByAttr(c,e,n,!1);if(""!==d)return""!==o&&(d=o+n+d),d}}return""},t.prototype.getAttributeText=function(t,e){var n=u.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 w=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},w.apply(this,arguments)}),E=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"}return 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(w({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),w(w({},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,o=this.aggregates;i<o.length;i++){var r=o[i];if(t.indexOf(r.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 o=0,r=t.columns;o<r.length;o++){var s=r[o],a=e.getValue(s);n&&"string"==typeof a&&(a=a.toLowerCase()),i[s]=a}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)},t}();!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(f||(f={}));var T,D=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=c.getIfDefined(t.type,i.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},k=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 D?t:new D(t);var n=this.items.length;return this.items.push(e),this.mapper[e.id]=n,[i.Date,i.DateTime,i.Time].indexOf(e.type)>=0&&this._dateColumnIdx.push(n),n},t.prototype.updateDateColumnIdx=function(){this._dateColumnIdx=this.getItems().filter((function(t){return[i.Date,i.DateTime,i.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&&(c.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}(),M=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}(),S=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 k,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 o=0,r=t.rows;o<r.length;o++){var s=r[o],a=this.createRow(s);this.addRow(a)}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 o=n+i;if(!this.needTotal&&!this.elasticChunks){if(n>=this.total)return Promise.resolve([]);o>this.total&&(o=this.total)}if(this.isInMemory&&o>this.cachedRows.length&&(o=this.cachedRows.length),o<=this.cachedRows.length)return Promise.resolve(this.cachedRows.slice(n,o));if(!this.loader)throw"Loader is not defined. Can't get the rows from "+n+" to "+o;var r=this.needTotal;this.needTotal&&(this.needTotal=!1);var s=this.cachedRows.length,a=o-s;return a<this._chunkSize&&(a=this._chunkSize),this.loader.loadChunk({offset:s,limit:a,needTotal:r}).then((function(t){(r&&(e.total=t.total),Array.prototype.push.apply(e.cachedRows,t.table.getCachedRows()),o>e.cachedRows.length&&(o=e.cachedRows.length),e.elasticChunks)&&(t.table.getCachedCount()<a&&(e.total=e.cachedRows.length));return e.fireUpdated(),e.cachedRows.slice(n,o)}))},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},t.prototype.createRow=function(t){var e=this,n=this._columns.getDateColumnIndexes(),i=new Array(this._columns.count),o=t instanceof M?function(e){return t.getValue(e)}:function(e){return t[e]};return t&&this.columns.getItems().forEach((function(t){var r=o(t.id),s=e.columns.getIndex(t.id);i[s]=n.indexOf(s)>=0?e.mapDate(r,t.type):r})),new M(this._columns,i)},t.prototype.mapDate=function(t,e){if(t){var n=new Date(t);return isNaN(n.getTime())&&e==i.Time&&(n=c.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 o=0,r=i;o<r.length;o++){var s=r[o];n[s]&&(n[s]=this.mapDate(n[s],this._columns.get(s).type))}e=new M(this._columns,n)}else e=this.createRow(t);this.cachedRows.push(e);var a=this.getCachedCount();return a>this.total&&(this.total=a),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}(),B=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}(),I=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:B.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 o=this.getEventRecByType(t);if(o){var r={type:t,source:this.source,data:e},s=function(){for(var t=0,e=o.eventCallbacks;t<e.length;t++){e[t].callback(r)}};n>0?setTimeout(s,n):s()}}},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 o=new RegExp("{{"+i+"}}","g");n=n.replace(o,e[i])}return n}}(T||(T={})),u.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)})},function(t,e,n){"use strict";n.d(e,"e",(function(){return G})),n.d(e,"a",(function(){return $})),n.d(e,"c",(function(){return b})),n.d(e,"i",(function(){return T})),n.d(e,"d",(function(){return D})),n.d(e,"j",(function(){return I})),n.d(e,"g",(function(){return o})),n.d(e,"f",(function(){return r})),n.d(e,"o",(function(){return s})),n.d(e,"q",(function(){return a})),n.d(e,"t",(function(){return l})),n.d(e,"p",(function(){return u})),n.d(e,"h",(function(){return c})),n.d(e,"m",(function(){return d})),n.d(e,"l",(function(){return h})),n.d(e,"k",(function(){return p})),n.d(e,"n",(function(){return f})),n.d(e,"r",(function(){return g})),n.d(e,"s",(function(){return m})),n.d(e,"b",(function(){return et}));var i=n(0);n(5);function o(t,e,n){var i=document.createElement(e),o=n||{};return o.cssClass&&(i.className=o.cssClass),t.appendChild(i),i}function r(t,e){t.className=t.className?t.className+" "+e:e}function s(t){t.style.display="none"}function a(t,e){e||(e=""),t.style.display=e}function l(t,e,n){n||(n={}),n.display||(n.display=""),n.duration||(n.duration=200),s(t),a(e,n.display),n.complete&&n.complete()}function u(t){return"none"!=t.style.display&&0!=t.offsetWidth&&0!=t.offsetHeight}function c(t){var e;return"function"==typeof Event?e=new Event(t):(e=document.createEvent("Event")).initEvent(t,!0,!0),e}function d(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function h(){var t=document.body,e=document.documentElement;return{top:window.pageYOffset||e.scrollTop||t.scrollTop,left:window.pageXOffset||e.scrollLeft||t.scrollLeft}}function p(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,o=document.documentElement,r=h(),s=r.top,a=r.left,l=o.clientTop||i.clientTop||0,u=o.clientLeft||i.clientLeft||0,c=e.top+s-l,d=e.left+a-u;return{top:Math.round(c),left:Math.round(d)}}(t);e={x:n.left,y:n.top}}return e}function f(){return{width:window.innerWidth,height:window.innerHeight}}function g(t,e,n){t.style.removeProperty("display");var i=window.getComputedStyle(t).display;"none"===i&&(i="block"),t.style.display=i;var o=t.offsetHeight;t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=o+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout((function(){t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}function m(t,e,n){t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height="0px",t.style.paddingTop="0px",t.style.paddingBottom="0px",t.style.marginTop="0px",t.style.marginBottom="0px",window.setTimeout((function(){t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property"),t.style.removeProperty("box-sizing"),n&&n()}),e)}var y,v=(y=function(t,e){return y=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])},y(t,e)},function(t,e){function n(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),C=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),o=0;for(e=0;e<n;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i},b=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=T(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=C(t.trim().split(" "),e),o=0;o<i.length;o++)this.element.classList.add(i[o]);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=C(t.trim().split(" "),e),o=0;o<i.length;o++)this.element.classList.remove(i[o]);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 v(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}(b),w=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"input",n)||this}return v(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(""),o=function(e){if("focus"!==e.type||""===t.value){var o=[],r=t.selectionStart;i.forEach((function(e,i){if(n[e]){var r=new RegExp(n[e],"i").test(t.value.charAt(i));o.push(r?t.value.charAt(i):"_")}else o.push(e)})),t.value=o.join(""),t.selectionStart=t.selectionEnd=r}};t.addEventListener("keydown",(function(e){if(8===e.keyCode||46===e.keyCode){e.preventDefault();var o=[],r=t.selectionStart;if(0==r)return;for(var s=r,a=!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!=r-1&&(a=!1),l===r-1&&s--,o.push(c&&l!=r-1?t.value.charAt(l):"_")}else l===s-1&&s--,r-1===l&&r--,o.push(u)}t.value=a?"":o.reverse().join(""),t.selectionStart=t.selectionEnd=s<0?0:s;var d=document.createEvent("Event");d.initEvent("input",!0,!0),t.dispatchEvent(d)}})),t.addEventListener("keypress",(function(e){var o=String.fromCharCode(e.charCode);if(o){e.preventDefault();var r=[],s=t.selectionStart,a=s;i.forEach((function(e,i){if(n[e]){var l=i!=s?t.value.charAt(i):o,u=new RegExp(n[e],"i").test(l);r.push(u?l:"_"),u&&s===i&&a++}else r.push(e),a===i&&a++,s===i&&s++})),t.value=r.join(""),t.selectionStart=t.selectionEnd=a;var l=document.createEvent("Event");l.initEvent("input",!0,!0),t.dispatchEvent(l)}})),t.addEventListener("input",o),t.addEventListener("focus",o)}(this.element,t),this},e}(b),E=function(t){function e(e,n){return e?t.call(this,e,n)||this:t.call(this,"select",n)||this}return v(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}(b);function T(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 b(t,e):"input"===t||t instanceof HTMLInputElement?new w(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 E(t instanceof HTMLSelectElement?t:null,e):new b(t,e)}var D,k="undefined"!=typeof TouchEvent;!function(t){t.None="none",t.Allow="allow",t.Forbid="forbid"}(D||(D={}));var M,S=function(t,e,n){this.dropEffect=D.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&&k&&n instanceof TouchEvent&&n.touches[0]&&(this.pageX=n.touches[0].pageX,this.pageY=n.touches[0].pageY)},B=function(t){t&&t instanceof MouseEvent&&(this.x=t.pageX,this.y=t.pageY),t&&k&&t instanceof TouchEvent&&t.touches[0]&&(this.x=t.touches[0].pageX,this.y=t.touches[0].pageY)},I=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=D.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 B(t);(Math.abs(i.x-e.mouseDownPosition.x)>e.delta||Math.abs(i.y-e.mouseDownPosition.y)>e.delta)&&r(t)}},o=function(t){e.mouseMoveDragListener(t)},r=function(r){r.preventDefault(),r.stopPropagation(),n.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),e.finishedSuccessfully=!1,t.beforeDragStart&&t.beforeDragStart(),e.dragImage=T("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=D.None,e.updateCusror(e.dropEffect),e.updateImageClass(e.dropEffect),e.draggableItem={element:n,scope:t.scope,data:t.data},e.updateDragItemPosition(r);var s=new S(e.draggableItem,e.dragImage,r);s.dropEffect=e.dropEffect,t.onDragStart&&t.onDragStart(s),e.dropEffect!==s.dropEffect&&(e.dropEffect=s.dropEffect,e.updateImageClass(e.dropEffect)),document.addEventListener("mousemove",o,!0),document.addEventListener("touchmove",o,!0)},s=function(t){k&&t instanceof TouchEvent&&t.preventDefault(),e.mouseDownPosition=new B(t),n.addEventListener("mousemove",i),n.addEventListener("touchmove",i),document.addEventListener("mouseup",a),document.addEventListener("touchend",a)};n.addEventListener("mousedown",s),n.addEventListener("touchstart",s);var a=function(t){e.mouseDownPosition=null,n.removeEventListener("mousemove",i),n.removeEventListener("touchmove",i),document.removeEventListener("mousemove",o,!0),document.removeEventListener("touchmove",o,!0),e.draggableItem&&l(t)},l=function(n){try{if(e.containerDescriptorIndex>=0){var i=e.containerDescriptors[e.containerDescriptorIndex],o={element:i.element,scopes:i.scopes,data:i.data},r=new S(e.draggableItem,e.dragImage,n);try{o.scopes.indexOf(e.draggableItem.scope)>=0&&e.dropEffect===D.Allow&&(e.finishedSuccessfully=!0,i.onDrop&&i.onDrop(o,r))}finally{i.onDragLeave&&i.onDragLeave(o,r)}}}finally{try{var s=new S(e.draggableItem,e.dragImage,n);s.data.finishedSuccessfully=e.finishedSuccessfully,t.onDragEnd&&t.onDragEnd(s)}finally{e.draggableItem=null,e.dragImage&&e.dragImage.parentElement&&e.dragImage.parentElement.removeChild(e.dragImage),e.dragImage=null,e.finishedSuccessfully=!1,document.removeEventListener("mouseup",a),document.removeEventListener("touchend",a)}}}},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,o=e;n<o.length;n++){var r=o[n];i.i.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 o=new S(this.draggableItem,this.dragImage,t);o.dropEffect=this.dropEffect,n.onDragOver&&n.onDragOver(i,o)}}},t.prototype.updateCusror=function(t){switch(t){case D.Allow:this.setCursorStyle(this.dragImage,"grabbing");break;case D.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 D.Allow:this.dragImage.classList.add(this.classPrefix+"-allow");break;case D.None:this.dragImage.classList.add(this.classPrefix+"-none");break;case D.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 B(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 S(this.draggableItem,this.dragImage,t);i.dropEffect=D.Allow,e.onDragEnter&&e.onDragEnter(n,i),this.dropEffect=i.dropEffect,this.updateCusror(this.dropEffect),this.updateImageClass(this.dropEffect)}else this.dropEffect!==D.Forbid&&(this.dropEffect=D.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 S(this.draggableItem,this.dragImage,t);i.dropEffect=D.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=p(t),i=new B(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=p(t),i=new B(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"}(M||(M={}));var O,P=/{0:(.*?)}/g;!function(t){t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.DATETIME=3]="DATETIME",t[t.BOOL=4]="BOOL"}(O||(O={}));var A,L=function(t,e,n,i){var o=t?t.toString().replace(/\n/g,"↵ "):"",r=T("div",n).addClass("keg-cell-value").addHtml(o).title(t||"");e.align==A.NONE&&r.addClass("keg-cell-value-align-left")},R=function(t,e,n,o){var r=(t||"").toString();"number"==typeof t&&(r=e.dataColumn&&e.dataColumn.displayFormat&&P.test(e.dataColumn.displayFormat)?e.dataColumn.displayFormat.replace(P,(function(e,n){return i.g.numberToStr(t,n)})):t.toLocaleString());var s=T("div",n).addClass("keg-cell-value").addHtml(r).title(r);e.align==A.NONE&&s.addClass("keg-cell-value-align-right")},_=function(t,e,n,o){var r="[object Date]"===Object.prototype.toString.call(t),s=(t||"").toString();if(r)if(e.dataColumn&&e.dataColumn.displayFormat&&P.test(e.dataColumn.displayFormat))s=e.dataColumn.displayFormat.replace(P,(function(n,o){return i.g.dateTimeToStr(t,e.type,o)}));else{var a=i.g.getCurrentLocale(),l={hour:"numeric",minute:"numeric",second:"numeric"};switch(e.type){case i.d.Date:s=t.toLocaleDateString(a);break;case i.d.Time:s=t.toLocaleTimeString(a,l);break;case i.d.DateTime:s=t.toLocaleDateString(a)+" "+t.toLocaleTimeString(a,l)}}var u=T("div",n).addClass("keg-cell-value").addHtml(s).title(s);e.align==A.NONE&&u.addClass("keg-cell-value-align-right")},F=function(t,e,n,o){if(e.dataColumn&&e.dataColumn.displayFormat&&P.test(e.dataColumn.displayFormat)){var r=e.dataColumn.displayFormat.replace(P,(function(e,n){return i.g.booleanToStr(t,n)}));return L(r,e,n)}T("div",n).addClass("keg-cell-value").addClass("keg-cell-value-bool").addClass("keg-"+(t?"cell-value-true":"cell-value-false"))},j=function(){function t(t){this.renderers={},this.defaultRenderers={},this.registerRenderer("StringDefault",L),this.setDefaultRenderer(O.STRING,L),this.registerRenderer("NumberDefault",R),this.setDefaultRenderer(O.NUMBER,R),this.registerRenderer("DateTimeDefault",_),this.setDefaultRenderer(O.DATETIME,_),this.registerRenderer("BoolDefault",F),this.setDefaultRenderer(O.BOOL,F)}return t.prototype.getDefaultRenderer=function(t){var e=this.getCellType(t);return this.defaultRenderers[O[e]]},t.prototype.getDefaultRendererByType=function(t){return this.defaultRenderers[O[t]]},t.prototype.setDefaultRenderer=function(t,e){e&&(this.defaultRenderers[O[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 i.d.Autoinc:case i.d.Byte:case i.d.Word:case i.d.Currency:case i.d.Float:case i.d.Int32:case i.d.Int64:return O.NUMBER;case i.d.Date:case i.d.DateTime:case i.d.Time:return O.DATETIME;case i.d.Bool:return O.BOOL;default:return O.STRING}},t}();!function(t){t[t.NONE=1]="NONE",t[t.LEFT=2]="LEFT",t[t.CENTER=3]="CENTER",t[t.RIGHT=4]="RIGHT"}(A||(A={}));var Q,N=function(){function t(t,e,n){void 0===n&&(n=!1),this._label=null,this._description=null,this.align=A.NONE,this.isVisible=!0,this.isRowNum=!1,this.dataColumn=t,this.grid=e;var o=e.options.columnWidths||{};t?(t.style.alignment&&(this.align=function(t){switch(t){case i.b.Left:return A.LEFT;case i.b.Center:return A.CENTER;case i.b.Right:return A.RIGHT;default:return A.NONE}}(t.style.alignment)),this.width=o&&o[this.type]?o[this.type].default:250,this.cellRenderer=this.grid.cellRendererStore.getDefaultRenderer(t.type),this._description=t.description):n&&(this.isRowNum=!0,this.width=o&&o.rowNumColumn?o.rowNumColumn.default:60,this._label="",this.cellRenderer=this.grid.cellRendererStore.getDefaultRendererByType(O.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}(),q=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 N(null,this.grid,!0);if(this.add(n),e||(n.isVisible=!1),t)for(var i=0,o=t.getItems();i<o.length;i++){var r=o[i],s=new N(r,this.grid);this.grid.options.onSyncGridColumn&&this.grid.options.onSyncGridColumn(s),this.add(s)}},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&&i.i.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}(),H=function(){return H=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},H.apply(this,arguments)},W=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),o=0;for(e=0;e<n;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i},G=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:M.Once,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}},addColumns:!1,viewportRowsCount:null,showActiveRow:!0},this.rowsOnPagePromise=null,this.containerInitialHeight=0,this.firstRender=!0,this.prevRowTotals=null,this.landingIndex=-1,this.landingSlot=T("div").addClass(this.cssPrefix+"-col-landing-slot").addChildElement(T("div").toDOM()).toDOM(),this._activeRowIndex=-1,t&&t.paging&&(t.paging=i.i.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 i.f(this),this.cellRendererStore=new j(t),this.columns=new q(this.dataTable.columns,this),this.setSlot(this.options.slot),this.init(this.options)}return t.prototype.mergeOptions=function(t){var e=i.i.assignDeep({},this.defaultDataGridOptions.columnWidths,t.columnWidths),n=i.i.assignDeep({},this.defaultDataGridOptions.paging,t.paging),o=i.i.assign({},this.defaultDataGridOptions,t);return o.columnWidths=e,o.paging=n,o},t.prototype.processColumnWidthsOptions=function(){var t=this.options.columnWidths;if(t){i.i.getStringDataTypes().forEach((function(e){t[e]=H(H({},t.stringColumns),t[e])})),i.i.getNumericDataTypes().forEach((function(e){t[e]=H(H({},t.numberColumns),t[e])})),t[i.d.Bool]=H(H({},t.boolColumns),t[i.d.Bool]),i.i.getDateDataTypes().forEach((function(e){t[e]=H(H({},t.dateColumns),t[e])}));var e=W(i.i.getStringDataTypes(),i.i.getNumericDataTypes(),i.i.getDateDataTypes(),[i.d.Bool]);i.i.getAllDataTypes().forEach((function(n){n in e||(t[n]=H(H({},t.otherColumns),t[n]))}))}},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.onAddColumnClick&&this.addEventListener("addColumnClick",t.onAddColumnClick),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})),i.i.assignDeep(this.paginationOptions,t.pagination),this.pagination.pageSize=this.options.paging.pageSize||this.pagination.pageSize,this.options.allowDragDrop&&I.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=D.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.addColumns){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!==M.Never;this.rowsOnPagePromise?this.rowsOnPagePromise.then((function(){return t.updateHeight()})).then((function(){t.firstRender=!1,t.rowsOnPagePromise=null,n&&t.resizeColumns()})):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 T(t.bodyDiv).setStyle("height",i+"px"),void setTimeout((function(){var n=t.bodyViewportDiv.offsetHeight-t.bodyViewportDiv.clientHeight;i+=n,T(t.bodyDiv).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=T("div").addClass(this.cssPrefix+"-header").toDOM(),this.headerViewportDiv=T("div",this.headerDiv).addClass(this.cssPrefix+"-header-viewport").toDOM(),this.headerCellContainerDiv=T("div",this.headerViewportDiv).addClass(this.cssPrefix+"-header-cell-container").toDOM(),this.headerRowDiv=T("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&&T(i).addChildElement(t.renderAddColumnButton())}}));var e=this.getContainerWidth();T(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=T("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 o=i.toDOM();return T("div",o).addClass(this.cssPrefix+"-header-cell-resize"),t.isRowNum||T("div",o).addClass(this.cssPrefix+"-header-cell-label").text(t.label),t.description&&T("div",o).addClass("question-mark").title(t.description),this.options.allowDragDrop&&I.registerDraggableItem({element:o,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=D.Allow}}),o},t.prototype.renderBody=function(){var t=this;this.bodyDiv=T("div").addClass(this.cssPrefix+"-body").toDOM(),this.bodyViewportDiv=T("div",this.bodyDiv).addClass(this.cssPrefix+"-body-viewport").attr("tabIndex","0").toDOM(),this.bodyCellContainerDiv=T("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 o=0;if(n.length){var r=e?t.options.aggregates.settings.getGroups():[];o=n.length<t.pagination.pageSize?n.length:t.pagination.pageSize,n.forEach((function(n,i){if(e&&t.updateTotalsState(r,n),i<o){var s=t.renderRow(n,i);t.bodyCellContainerDiv.appendChild(s)}}));var s=t.options.aggregates&&t.options.aggregates.showGrandTotalsOnEachPage;if(e&&(t.isLastPage()||s)){var a=new i.c(t.dataTable.columns,new Array(t.dataTable.columns.count));t.updateTotalsState(r,a,!0)}}var l=t.getContainerWidth();return T(t.bodyCellContainerDiv).setStyle("width",l+"px"),o})).catch((function(t){return console.error(t),0}))),this.bodyViewportDiv.addEventListener("scroll",(function(e){T(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 o=this.options.aggregates.settings;if(this.prevRowTotals&&o.hasGroups()){for(var r=-1,s=1;s<=t.length;s++){for(var a=0,l=t[s-1].columns;a<l.length;a++){var u=l[a];if(!o.compareValues(this.prevRowTotals.getValue(u),e.getValue(u))){r=s;break}}if(-1!==r)break}if(-1!==r)for(s=t.length;s>=r;s--){var c=new i.c(this.dataTable.columns,this.prevRowTotals.toArray()),d=this.renderTotalsRow(s,c);this.bodyCellContainerDiv.appendChild(d)}}if(n&&o.hasGrandTotals()&&o.hasAggregates()){d=this.renderTotalsRow(0,e);this.bodyCellContainerDiv.appendChild(d)}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,o=t>0?i.getGroups()[t-1]:{columns:[],aggregates:i.getAggregates()},r=T("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 s="",a=t.isRowNum?-1:n.dataTable.columns.getIndex(t.dataColumn.id);!t.isRowNum&&t.dataColumn&&o.columns.indexOf(t.dataColumn.id)>=0&&(s=e.getValue(a)),a==n.dataTable.columns.count-1&&(s=". . . . . ."),r.appendChild(n.renderCell(t,i,s,r))}}));var s=this.options.aggregates.calculator.getAggrContainer(),a=i.getAggregates().map((function(t){return t.colId})),l=i.buildGroupKey(o,e);return s.getAggregateData(t,l).then((function(s){for(var l=0,u=a;l<u.length;l++){var c=u[l];e.setValue(c,s[c])}r.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=o.columns.indexOf(l.dataColumn.id),f=a.indexOf(l.dataColumn.id);h=t>0?p==o.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,r).firstChild.innerHTML,c=n.applyGroupColumnTemplate(g,c,s[i.COUNT_FIELD_NAME])}var m=n.renderCell(l,u,c,r);r.appendChild(m)}}))})).catch((function(t){return console.error(t)})),r},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(),o=n.top-i.top,r=n.bottom-i.top,s=this.bodyViewportDiv.clientHeight,a=window.innerHeight||document.documentElement.clientHeight;if(o>0&&r<=s&&n.top>0&&n.bottom<a)return;o<0?this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+o:r>s&&(this.bodyViewportDiv.scrollTop=this.bodyViewportDiv.scrollTop+r-s),(n=e.getBoundingClientRect()).top<0?document.documentElement.scrollTop=document.documentElement.scrollTop+n.top:n.bottom>a&&(document.documentElement.scrollTop=document.documentElement.scrollTop+n.bottom-a)}},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=T("div").addClass(this.cssPrefix+"-footer").toDOM(),this.rowsOnPagePromise&&this.rowsOnPagePromise.then((function(e){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=T("div").addClass(this.cssPrefix+"-page-info").toDOM(),n=t?(this.pagination.page-1)*this.pagination.pageSize+1:0,o=t?n+t-1:0,r=this.dataTable.getTotal().toString();this.dataTable.elasticChunks&&(this.dataTable.getCachedCount()!==this.dataTable.getTotal()&&(r="?"));return e.innerHTML=i.g.getText("GridPageInfo").replace("{FirstPageRecordNum}","<span>"+n.toString()+"</span>").replace("{LastPageRecordNum}","<span>"+o.toString()+"</span>").replace("{Total}","<span>"+r+"</span>"),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),o=T("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&&o.addClass(this.cssPrefix+"-row-first");var r=o.toDOM();return this.options.showActiveRow&&e==this.activeRowIndex&&o.addClass(this.cssPrefix+"-row-active"),this.columns.getItems().forEach((function(e,o){if(e.isVisible){var s=e.isRowNum?-1:n.dataTable.columns.getIndex(e.dataColumn.id),a=e.isRowNum?i+1:t.getValue(s);r.appendChild(n.renderCell(e,o,a,r))}})),r},t.prototype.renderCell=function(t,e,n,i){var o=T("div").addClass(this.cssPrefix+"-cell").data("col-idx",""+e).attr("tabindex","-1").setStyle("width",t.width+"px");return t.align==A.LEFT?o.addClass(this.cssPrefix+"-cell-align-left"):t.align==A.RIGHT?o.addClass(this.cssPrefix+"-cell-align-right"):t.align==A.CENTER&&o.addClass(this.cssPrefix+"-cell-align-center"),t.cellRenderer&&t.cellRenderer(n,t,o.toDOM(),i),o.toDOM()},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");if(e.className=this.cssPrefix+"-pagination-wrapper",this.options.paging&&this.options.paging.enabled){var n=this.paginationOptions.useBootstrap?"":this.cssPrefix+"-",o=function(e){var n=e.target;if(n.hasAttribute("data-page")){var i=parseInt(n.getAttribute("data-page"));t.setPage(i)}},r=function(e,i,r,s,a){var l=document.createElement("li");if(l.className=n+"page-item",!s){a&&(l.className+=" active");var u=document.createElement("a");return u.setAttribute("href","javascript:void(0)"),u.innerHTML=i||e.toString(),u.setAttribute("data-page",""+e),u.className=n+"page-link",u.addEventListener("click",o),l.appendChild(u),l}var c=document.createElement("span");if(c.setAttribute("aria-hidden","true"),c.className=n+"page-link",r)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=n+"page-link",c.addEventListener("click",o)}return c.innerHTML=i,l.appendChild(c),l};if(this.dataTable.elasticChunks){var s=this.pagination.page||1;(l=document.createElement("ul")).className=n+"pagination";var a=r(s-1,"&laquo;",1==s,!0,!1);l.appendChild(a),a=r(s+1,"&raquo;",this.isLastPage(),!0,!1),l.appendChild(a),e.appendChild(l)}else if(this.pagination.total>this.pagination.pageSize){s=this.pagination.page||1;var l,u=Math.ceil(this.pagination.total/this.pagination.pageSize)||1,c=this.paginationOptions.maxButtonCount||10,d=s-1,h=d-d%c+1,p=h+c-1;p>u&&(p=u),(l=document.createElement("ul")).className=n+"pagination";a=r(h-1,"&laquo;",1==h,!0,!1);l.appendChild(a);for(var f=h;f<=p;f++)a=r(f,f.toString(),!1,!1,f==s),l.appendChild(a);a=r(p+1,"&raquo;",p==u,!0,!1),l.appendChild(a),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||[],C=new Set(v);C.add(this.options.paging.pageSize||20),Array.from(C).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 b=document.createElement("div");b.className=this.cssPrefix+"-page-sizes-label",g.appendChild(b);var x=document.createElement("span");x.innerText=i.g.getText("GridItemsPerPage"),b.appendChild(x),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.renderAddColumnButton=function(){var t=this;return this.options.addColumns?T("div").addClass(this.cssPrefix+"-addrow").title(this.options.addColumnsTitle||"Add column").addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.fireEvent({type:"addColumnClick",sourceEvent:e})}))})).toDOM():T("span").addText("#").toDOM()},t.prototype.showLandingSlot=function(t,e){for(var n=this.headerRowDiv.querySelectorAll("[class*="+this.cssPrefix+"-table-col]"),i=[],o=1;o<n.length;o++){var r=n[o];"none"!==r.style.display&&i.push(r)}if(0===i.length)return this.landingIndex=0,void this.headerRowDiv.appendChild(this.landingSlot);var s=p(this.landingSlot);if(!(t>=s.x&&t<=s.x+this.landingSlot.offsetWidth)){for(var a=this.landingIndex,l=0,u=i;l<u.length;l++){var c=u[l],d=p(c),h=c.offsetWidth;t>d.x&&t<d.x+h&&(a=parseInt(c.getAttribute("data-col-idx"))-1)}a!=this.landingIndex&&(this.landingIndex=a,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!==M.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(),o=this.headerCellContainerDiv.querySelectorAll("."+this.cssPrefix+"-header-cell"),r=0,s=function(t){var s=n[t];if(!s.isVisible)return"continue";var l=a.options.columnWidths.autoResize!==M.Always&&s.dataColumn?s.dataColumn.calculatedWidth:0,u=a.bodyCellContainerDiv.querySelectorAll("."+a.cssPrefix+'-cell[data-col-idx="'+t+'"] > .'+a.cssPrefix+"-cell-value"),c=0;if(l>0)e+=l,s.width=l,u.forEach((function(t){t.parentElement.style.width=l+"px"})),o[r].style.width=l+"px";else if(0==u.length&&(o[r].style.width=null,o[r].style.whiteSpace="nowrap"),c=o[r].offsetWidth,u.length>0){u.forEach((function(t){t.parentElement.style.width=null;var e=t.parentElement.offsetWidth;e>c&&(c=e)})),c+=3;var d=s.isRowNum?a.options.columnWidths.rowNumColumn.max||500:a.options.columnWidths[s.dataColumn.type].max||2e3,h=s.isRowNum?a.options.columnWidths.rowNumColumn.min||0:a.options.columnWidths[s.dataColumn.type].min||20;c>d&&(c=d),c<h&&(c=h),i.i.isNumericType(s.type)&&(c=Math.round(1.3*c)),e+=c,s.width=c,u.forEach((function(t){t.parentElement.style.width=c+"px"})),o[r].style.width=c+"px",s.dataColumn&&(s.dataColumn.calculatedWidth=c)}else e+=c;r++},a=this,l=0;l<this.columns.count;l++)s(l);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")}},t}(),V=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}(),z=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=p(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}(),U=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(t){function e(e,n){var o=t.call(this,e,n)||this;o.daysOfWeek=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o.calendarBody=null,o.isManualInputChanging=!1;for(var r=0;r<o.daysOfWeek.length;r++)o.daysOfWeek[r]=i.g.getShortWeekDayName(r+1);for(r=0;r<o.months.length;r++)o.months[r]=i.g.getLongMonthName(r+1);return o}return U(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=T("div",this.slot).addClass(this.cssPrefix+"-header");this.options.showDateTimeInput?e.addChildElement(this.renderManualDateInput()):e.addChild("span",(function(e){return t.headerTextElem=e.toDOM()})),T(this.slot).addChildElement(this.renderCalendarButtons()),this.calendarBody=T("div",this.slot).addClass(this.cssPrefix+"-body").toDOM()},e.prototype.getInputDateFormat=function(){var t=i.g.getLocaleSettings();return this.options.timePickerIsUsed?t.editDateFormat+" "+t.editTimeFormat:t.editDateFormat},e.prototype.renderManualDateInput=function(){var t=this,e=this.getInputDateFormat(),n=T("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(o){n.removeClass("error");try{t.isManualInputChanging=!0;var r=i.i.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=i.i.dateTimeToStr(this.currentDate,t),this.manualInputElem.focus()}}else if(this.headerTextElem){var e=i.g.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 T("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 o=document.createElement("option"),r=this.selectedYear-e+i;o.value=r.toString(),o.innerText=r.toString(),this.selectYearElem.appendChild(o)}},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){T("div",t.calendarBody).addClass(t.cssPrefix+"-weekday").addClass(0==n||6==n?t.cssPrefix+"-weekend":"").text(e)}));for(var i=0;i<e;i++)T("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty");for(var o=new Date,r=1;r<=n;r++){var s=T("div",this.calendarBody).addClass(this.cssPrefix+"-day").attr("data-date",r.toString()).text(r.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)}));r===o.getDate()&&this.selectedYear===o.getFullYear()&&this.selectedMonth===o.getMonth()&&s.addClass(this.cssPrefix+"-day-current"),r===this.currentDate.getDate()&&this.selectedYear===this.currentDate.getFullYear()&&this.selectedMonth===this.currentDate.getMonth()&&s.addClass(this.cssPrefix+"-day-selected");var a=(e+r-1)%7;0!=a&&6!=a||s.addClass(this.cssPrefix+"-weekend")}var l=(e+n)%7,u=0==l?0:7-l;for(i=0;i<u;i++)T("div",this.calendarBody).addClass(this.cssPrefix+"-day-empty")},e.prototype.dateChanged=function(e){t.prototype.dateChanged.call(this,e),this.rerenderMonth()},e}(V),Y=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}(),K=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)}}(),X=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return K(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;T("div",this.slot).addClass(this.cssPrefix+"-time").addChild("span",(function(e){return t.timeText=e.toDOM()})).toDOM();var e=T("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.g.getCurrentLocale(),e=this.currentTime.toLocaleString("en"==t?void 0:t,{hour:"numeric",minute:"numeric"});this.timeText.innerText=e},e}(Y),Z=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}return Z(e,t),e.prototype.render=function(){var e=this,n=T("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=T("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.g.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.g.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.g.getText("ButtonCancel")).on("click",(function(){return t.cancel(),!1})).toDOM()}))},e.prototype.createCalendar=function(t){return this.calendarSlot=T("div",this.slot).addClass(this.cssPrefix+"-cal").toDOM(),new J(this.calendarSlot,t)},e.prototype.createTimePicker=function(t){return this.timePickerSlot=T("div",this.slot).addClass(this.cssPrefix+"-tp").toDOM(),new X(this.timePickerSlot,t)},e.prototype.show=function(e){var n=this;if(this.options.showDateTimeInput){this.options.beforeShow&&this.options.beforeShow();var i=p(e||document.body),o=p(e?e.parentElement||e:document.body);this.slot.style.top=o.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)},e}(z);!function(t){t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right"}(Q||(Q={}));var 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)}}(),et=function(){function t(){}return t.prototype.openConfirm=function(t,e,n){var i=this,o={title:t,closable:!1,submitable:!0,cancelable:!0,body:'<div id="kdlg-dialog-confirm">'+e+"</div>"};return n?(o.onSubmit=function(){n(!0)},o.onCancel=function(){n(!1)},void this.open(o)):new Promise((function(t){o.onSubmit=function(){t(!0)},o.onCancel=function(){t(!1)},i.open(o)}))},t.prototype.openPrompt=function(t,e,n,i){var o=this,r={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()}},s=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?(r.onSubmit=function(){return s(i)},r.onCancel=function(){i("")},void this.open(r)):new Promise((function(t){r.onSubmit=function(){return s(t)},r.onCancel=function(){t("")},o.open(r)}))},t.prototype.open=function(t,e){var n=this,i=new nt(t,e),o=t.onDestroy;return t.onDestroy=function(t){n.untrack(t),o&&o(t)},i.open(),this.track(i),i},t.prototype.createSet=function(t){return new ot(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 it(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}(),nt=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=i.i.generateId("dlg"),this.data=e,this.slot=T("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(o){return n.windowElement=o.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(o){if(n.bodyElement=o.addClass("kdlg-body").toDOM(),"string"==typeof t.body){var r=i.h.renderLiquidTemplate(t.body,e);o.addHtml(r)}else o.addChildElement(t.body)})).addChild("footer",(function(e){var o=null;o=t.footerAlignment&&t.footerAlignment==Q.Center?"align-center":"align-right",n.footerElement=e.addClass("kdlg-footer").toDOM(),e.addClass(o),!1!==t.submitable&&(e.addChild("button",(function(e){e.id(n.dialogId+"-btn-submit").addClass("kfrm-button","is-info").addText(t.submitButtonText||i.g.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.g.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),T(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=T("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;T(e[n]).setStyle("margin-top",i+"px").setStyle("margin-left",i+"px")}else T(e[n]).removeStyle("margin-top").removeStyle("margin-left")},t}(),it=function(t){function e(e,n){var i,o,r=this,s=T("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){o=t.addClass("fill").toDOM(),e.determinated?t.setStyle("width","0%"):t.addClass("indeterminate")}))})).toDOM();return(r=t.call(this,{title:e.title,body:s,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,r.progressElement=o,r}return tt(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}(nt),ot=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.g.updateDefaultTexts({GridPageInfo:"{FirstPageRecordNum} - {LastPageRecordNum} of {Total} records",GridItemsPerPage:"items per page",ButtonOK:"OK",ButtonCancel:"Cancel",ButtonApply:"Apply",ButtonNow:"Now",LblTotal:"Total"});new et},function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__2__},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return browserUtils}));var _utils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4),browserUtils;(function(browserUtils){var _isFirefox=null,_isIE=null;function IsIE(){return eval("/*@cc_on!@*/false || !!document.documentMode")}function IsFirefox(){if(null===_isFirefox){var t=navigator.userAgent;_isFirefox=t.toLowerCase().indexOf("firefox")>-1}return _isFirefox}browserUtils.IsIE=IsIE,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()?_utils__WEBPACK_IMPORTED_MODULE_0__.a: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.d(e,"c",(function(){return i})),n.d(e,"d",(function(){return o})),n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return s}));n(1);function i(t){for(var e=0;null!==t;){var n=document.defaultView.getComputedStyle(t,null).getPropertyValue("z-index");if("auto"!=n){var i=parseInt(n);i>e&&(e=i)}t=t.parentElement}return e}function o(t){setTimeout((function(e){t&&t.focus()}),100)}var r="eqjs",s="eqjs-mobile"},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,"EntitiesPanel",(function(){return d})),n.d(e,"ColumnsPanel",(function(){return D})),n.d(e,"ColumnsBar",(function(){return P})),n.d(e,"SortingBar",(function(){return R})),n.d(e,"QueryPanel",(function(){return vt})),n.d(e,"FilterBar",(function(){return bt})),n.d(e,"HtmlContentWidget",(function(){return wt})),n.d(e,"EqHtmlGrid",(function(){return Tt})),n.d(e,"Grid",(function(){return kt})),n.d(e,"EasyGridWidget",(function(){return Bt})),n.d(e,"StatementPanel",(function(){return Ot})),n.d(e,"ProcessWidget",(function(){return At})),n.d(e,"ManageDrillDownWidget",(function(){return Rt})),n.d(e,"ResultFacetsPanel",(function(){return oe})),n.d(e,"ExportWidget",(function(){return se})),n.d(e,"AggregationBar",(function(){return ce})),n.d(e,"ChartType",(function(){return _t})),n.d(e,"ChartWidget",(function(){return Wt})),n.d(e,"GoogleChartWidget",(function(){return Ut})),n.d(e,"ChartJsWidget",(function(){return Vt})),n.d(e,"BaseElementRenderer",(function(){return J})),n.d(e,"DropDownRenderer",(function(){return st})),n.d(e,"AggrSettingsRenderer",(function(){return ae})),n.d(e,"AggrFuncColumnRendererCB",(function(){return I})),n.d(e,"SimpleColumnRendererCB",(function(){return S})),n.d(e,"ColumnRendererCB",(function(){return k})),n.d(e,"AggrFuncColumnRendererCP",(function(){return x})),n.d(e,"SimpleColumnRendererCP",(function(){return C})),n.d(e,"ColumnAction",(function(){return o})),n.d(e,"ColumnRendererCP",(function(){return y})),n.d(e,"CustomSqlColumnRendererCP",(function(){return E})),n.d(e,"InputExpressionRenderer",(function(){return Z})),n.d(e,"DateTimeExpressionRenderer",(function(){return ht})),n.d(e,"ConditionAction",(function(){return _})),n.d(e,"ConditionRenderer",(function(){return Q})),n.d(e,"SimpleConditionRenderer",(function(){return N})),n.d(e,"ConditionGroupRenderer",(function(){return z})),n.d(e,"ConditionGroupRowRenderer",(function(){return U})),n.d(e,"AttributeExpressionRenderer",(function(){return ot})),n.d(e,"ExpressionRenderer",(function(){return K})),n.d(e,"OperatorRenderer",(function(){return ct})),n.d(e,"SubQueryExpressionRenderer",(function(){return ft})),n.d(e,"ListExpressionRenderer",(function(){return tt})),n.d(e,"CustomListExpressionRenderer",(function(){return et})),n.d(e,"SqlListExpressionRenderer",(function(){return nt})),n.d(e,"TextRenderer",(function(){return F})),n.d(e,"AddRowRenderer",(function(){return lt})),n.d(e,"ResultFacet",(function(){return Nt})),n.d(e,"DataTableFacet",(function(){return te})),n.d(e,"ChartFacet",(function(){return Yt})),n.d(e,"PivotTableFacet",(function(){return Zt})),n.d(e,"View",(function(){return ge})),n.d(e,"AdvancedSearchView",(function(){return ye})),n.d(e,"DataFilterView",(function(){return Ce})),n.d(e,"HtmlDataFilterView",(function(){return xe})),n.d(e,"ReportView",(function(){return Ee})),n.d(e,"DomDropDownElementBuilder",(function(){return H})),n.d(e,"dropdown",(function(){return W})),n.d(e,"PopupMenu",(function(){return p})),n.d(e,"QPEditablePart",(function(){return m})),n.d(e,"FacetType",(function(){return G})),n.d(e,"ExportDialog",(function(){return Ft})),n.d(e,"AggrSettingsDialog",(function(){return le}));var i,o,r=n(0),s=n(2),a=n(1),l=n(4),u=n(3),c=(i=function(t,e){return i=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])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),d=function(t){function e(e){var n=t.call(this,e)||this;return n.queryChangedCallbackId=null,n.group=s.WidgetGroup.Model|s.WidgetGroup.Query,n.panel=e,n}return c(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-ep"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"entitiesPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.renderProgressBlock()},e.prototype.refreshCore=function(){this.render(),this.options.syncWithColumns&&this.refreshCheckedStateByColumns()},e.prototype.onProcessStartCore=function(){this.options.showIndicatorOnLoad&&(this.progressBlock.parentNode||this.panel.appendChild(this.progressBlock))},e.prototype.onProcessEndCore=function(){this.options.showIndicatorOnLoad&&this.progressBlock.parentNode&&this.panel.removeChild(this.progressBlock)},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.setOptions=function(t){var e=this;(this.options={showToolbar:!0,syncWithColumns:!1,showSelectAllButton:!1,showClearSelectionButton:!0,showAddColumnButton:!0,showAddConditionButton:!0,showCheckboxes:!0,showTooltips:!0,draggableAttributes:!0,showAttributes:{useInConditions:!0,useInResult:!0,useInSorting:!1},showFilterBox:!1,filterBoxMode:0,showIndicatorOnLoad:!0,attrPlacement:0,sortEntities:!1,autoClearSelection:!0,entityRenderedCallback:null,attributeRenderedCallback:null,columnTitleFormat:"{attr}"},t&&r.i.assignDeep(this.options,t),this.queryChangedCallbackId)&&(n=this.context.getQuery()).removeChangedCallback(this.queryChangedCallbackId);if(this.options.syncWithColumns){var n=this.context.getQuery();this.queryChangedCallbackId=n.addChangedCallback((function(t){var n=t.data;!n||n.part!=s.QueryChangePart.Columns&&n.part!=s.QueryChangePart.All||e.refreshCheckedStateByColumns()}))}},e.prototype.render=function(){var t=this.context.getModel();if(this.clear(),this.panel.classList.add(this.cssPrefix+"-panel"),this.panel.classList.add(u.a.getMobileCssClass()),this.rootEntityBlock=document.createElement("div"),null!=t&&!t.isEmpty()){var e=t.getEntitiesTree({addUIC:this.options.showAttributes.useInConditions,addUIR:this.options.showAttributes.useInResult,addUIS:this.options.showAttributes.useInSorting,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities,includeRootData:!0});this.entityTreeBlock=this.renderEntity(e,this.rootEntityBlock,0),this.panel.appendChild(this.entityTreeBlock)}this.options.showFilterBox?this.createFilterBox():this.rootEntityBlock.style.top="0",this.options.showToolbar&&!this.options.syncWithColumns?this.createToolPanel():this.rootEntityBlock.style.bottom="0"},e.prototype.renderEntity=function(t,e,n){var i,o=this,l=document.createElement("div");l.classList.add(this.cssPrefix+"-entity-node"),l.classList.add(u.a.getMobileCssClass());var c=document.createElement("div");c.classList.add(this.cssPrefix+"-entity-children"),c.classList.add(u.a.getMobileCssClass());var d=document.createElement("label");d.classList.add(this.cssPrefix+"-entity-node-label");var h=document.createElement("input");h.type="checkbox",h.title=t.text;var p,f,g,m=document.createElement("a");m.href="javascript:void(0)",m.title=r.g.getText("EntityToggle")+" "+t.text,m.classList.add(this.cssPrefix+"-entity-node-button");var y=n;if(e?(i=e).innerHTML="":i=document.createElement("div"),i.classList.add(this.cssPrefix+"-entity"),i.classList.add(u.a.getMobileCssClass()),t.id&&""!=t.id){d.innerText=t.text,l.appendChild(d),this.options.showCheckboxes&&d.insertBefore(h,d.firstChild),l.insertBefore(m,l.firstChild),this.options.showTooltips&&t.description&&d.setAttribute("title",t.description);for(var v=0;v<y;v++){var C=document.createElement("div");C.classList.add(this.cssPrefix+"-entity-offset"),l.insertBefore(C,l.firstChild)}i.appendChild(l),c.hidden=!0,y++}var b=t.items?t.items.length:0,x=function(e){var n=t.items[e];if(n.isEntity)c.appendChild(w.renderEntity(n,null,y));else if(!n.lookupAttr||!function(t,e){return e.querySelectorAll("."+o.cssPrefix+'-entity-attr[data-id="'+t+'"]').length>0}(n.lookupAttr,c)){(f=document.createElement("label")).innerText=n.text,f.classList.add(w.cssPrefix+"-entity-attr-label"),w.options.showCheckboxes&&((g=document.createElement("input")).type="checkbox",g.title=n.text,f.insertBefore(g,f.firstChild),w.options.syncWithColumns&&g.addEventListener("change",(function(t){var e=o.context.getModel(),n=o.context.getQuery(),i=t.currentTarget,r=i.parentElement.parentElement.getAttribute("data-id");if(e.checkAttrProperty(r,"useInResult"))if(i.checked){var a=e.getAttributeById(r),l=e.getAttributeText(a,o.options.columnTitleFormat),u=n.addColumn({attribute:a,caption:l});n.fireColumnsChangedEvent(s.QueryChangeAction.Add,u)}else{var c=n.getColumns().filter((function(t){return t.expr.tag===s.ExprTag.EntityAttribute&&t.expr.value===r}));c.length>0&&(n.removeColumn(c[0],null),n.fireColumnsChangedEvent(s.QueryChangeAction.Delete,c[0]))}}))),w.options.showTooltips&&n.description&&f.setAttribute("title",n.description);for(var i=0;i<y+1;i++){var r=document.createElement("div");r.classList.add(w.cssPrefix+"-entity-offset"),f.insertBefore(r,f.firstChild)}(p=document.createElement("div")).classList.add(w.cssPrefix+"-entity-attr"),0==l.innerHTML.length&&p.classList.add(w.cssPrefix+"-entity-attr-root"),p.innerHTML="",p.appendChild(f),p.setAttribute("data-id",n.id),w.options.draggableAttributes&&a.j.registerDraggableItem({element:p,scope:"entityAttr",data:{attrId:n.id},renderer:function(t){t.innerHTML="";var e=document.createElement("span");e.innerText=n.text,t.appendChild(e)}}),w.options.attributeRenderedCallback&&w.options.attributeRenderedCallback(p),c.appendChild(p)}},w=this;for(v=0;v<b;v++)x(v);if(c.innerHTML.length&&(i.appendChild(c),m.addEventListener("click",(function(t){c.hidden=!c.hidden;var e=t.target,n=o.cssPrefix+"-entity-node-button-open";e.classList.contains(n)?e.classList.remove(n):e.classList.add(n),t.preventDefault()}))),c){var E=c.querySelectorAll("."+this.cssPrefix+"-entity-attr > label > input");for(v=0;v<E.length;v++){E[v].addEventListener("click",(function(t){t.target.checked&&!h.checked?h.checked=!0:0===c.querySelectorAll("input:checked").length&&(h.checked=!1),t.stopPropagation()}))}}return h.addEventListener("click",(function(t){for(var e=t.target,n=c.querySelectorAll("label input"),i=0;i<n.length;i++){n[i].checked=e.checked}if(o.options.syncWithColumns){for(var r=o.context.getQuery(),a=o.context.getModel(),l=[],u=0,d=Array.from(c.querySelectorAll("."+o.cssPrefix+"-entity-attr"));u<d.length;u++){var h=d[u].getAttribute("data-id");a.checkAttrProperty(h,"useInResult")&&l.push(h)}if(e.checked)for(var p=0,f=l;p<f.length;p++){h=f[p];r.addColumn({attributeId:h})}else{var g=r.getColumns().filter((function(t){return t.expr.tag===s.ExprTag.EntityAttribute&&l.indexOf(t.expr.value)>=0}));r.removeColumns(g,null)}r.fireColumnsChangedEvent()}t.stopPropagation()})),e!=this.rootEntityBlock&&this.options.entityRenderedCallback&&this.options.entityRenderedCallback(i),i},e.prototype.createFilterBox=function(){var t=this;this.filterBoxBlock=document.createElement("div"),this.filterBoxBlock.classList.add(this.cssPrefix+"-filter-box"),this.filterBoxBlock.classList.add(u.a.getMobileCssClass()),this.filterBoxInput=document.createElement("input"),this.filterBoxInput.classList.add(this.cssPrefix+"-filter-box-input"),this.filterBoxInput.addEventListener("input",(function(e){for(var n=t.panel.querySelectorAll("."+t.cssPrefix+"-entity-attr"),i=0;i<n.length;i++){var o=n[i];o.hidden=!t.checkFilterAttribute(o)}var r=t.panel.querySelectorAll(":scope > ."+t.cssPrefix+"-entity");for(i=0;i<r.length;i++){for(var s=r[i],a=s.querySelectorAll("."+t.cssPrefix+"-entity-attr"),l=0,u=0;u<a.length;u++)"None"!==a[u].style.display&&l++;s.hidden=0===l}""===t.filterBoxInput.value?t.collapseAll():t.expandAll()})),this.filterBoxBlock.appendChild(this.filterBoxInput),this.panel.insertBefore(this.filterBoxBlock,this.panel.firstChild)},e.prototype.createToolPanel=function(){var t=this,e=this.cssPrefix+"-tool-panel",n=document.createElement("div");n.classList.add(e),n.classList.add(u.a.getMobileCssClass());var i=document.createElement("div");i.classList.add(e+"-select-all"),i.title="Select all";var o=document.createElement("div");o.classList.add(e+"-deselect-all"),o.title="Clear selection";var s=document.createElement("div");s.classList.add(e+"-add-columns"),s.title="Add column";var a=document.createElement("div");a.classList.add(e+"-add-cond"),a.title="Add condition";var l=document.createElement("div");l.classList.add(e+"-left-side");var c=document.createElement("div");c.classList.add(e+"-right-side");var d=this.context.getModel();this.options.showSelectAllButton&&(i.title=r.g.getText("ButtonSelectAll"),l.appendChild(i),i.addEventListener("click",(function(){t.selectAll()}))),this.options.showClearSelectionButton&&(o.title=r.g.getText("ButtonDeselectAll"),l.appendChild(o),o.addEventListener("click",(function(){t.deselectAll()}))),this.options.showAddColumnButton&&(s.title=r.g.getText("ButtonAddColumns"),c.appendChild(s),s.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll("."+t.cssPrefix+"-entity-attr"),i=[],o=t.context.getQuery();o.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),d.checkAttrProperty(e,"useInResult")&&i.push(e))}for(var a=0,l=i;a<l.length;a++){var u=l[a],c=d.getAttributeById(u),h=d.getAttributeText(c,t.options.columnTitleFormat);o.addColumn({attribute:c,caption:h})}o.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),o.fireProcessEvent({source:self,status:"finish"})}))),this.options.showAddConditionButton&&(a.title=r.g.getText("ButtonAddConditions"),c.appendChild(a),a.addEventListener("click",(function(){var e,n=t.panel.querySelectorAll("."+t.cssPrefix+"-entity-attr"),i=[],o=t.context.getQuery();o.fireProcessEvent({source:self,status:"start"});for(var r=0;r<n.length;r++){var s=n[r];s.getElementsByTagName("input")[0].checked&&(e=s.getAttribute("data-id"),d.checkAttrProperty(e,"useInConditions")&&i.push(e))}for(var a=0,l=i;a<l.length;a++){var u=l[a];o.addSimpleCondition({attributeId:u})}o.fireChangedEvent(),t.options.autoClearSelection&&t.deselectAll(),o.fireProcessEvent({source:self,status:"finish"})}))),n.appendChild(l),n.appendChild(c),this.panel.appendChild(n)},e.prototype.checkFilterAttribute=function(t){if(t.querySelector("label input").checked)return!0;var e=t.querySelector("label").textContent;if(this.checkFilterText(e))return!0;var n=t.parentElement.parentElement.querySelector("."+this.cssPrefix+"-entity-node").querySelector("label").textContent;return!!this.checkFilterText(n)},e.prototype.checkFilterText=function(t){var e=this.filterBoxInput.value;return""==e||(0==this.options.filterBoxMode&&t.toLowerCase().indexOf(e.toLowerCase())>=0||1==this.options.filterBoxMode&&0==t.toLowerCase().indexOf(e.toLowerCase()))},e.prototype.refreshCheckedStateByColumns=function(){this.deselectAll();for(var t=0,e=this.context.getQuery().getColumns().filter((function(t){return t.expr.tag===s.ExprTag.EntityAttribute}));t<e.length;t++){var n=e[t],i=this.rootEntityBlock.querySelector("."+this.cssPrefix+'-entity-attr[data-id="'+n.expr.value+'"]'),o=i.querySelector("label > input");o.checked=!0;for(var r=i.parentElement;r&&r.classList.contains(this.cssPrefix+"-entity-children");){r.hidden=!1;var a=r.parentElement;if(!a||r===a.firstElementChild)break;(o=a.firstElementChild.querySelector("label > input")).checked=!0,r=a.parentElement}}},e.prototype.expandAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll("."+this.cssPrefix+"-entity-children"),n=0;n<e.length;n++){e[n].hidden=!1}var i=this.rootEntityBlock.querySelectorAll("."+this.cssPrefix+"-entity-node-button");for(t=0;t<i.length;t++){i[t].classList.add(this.cssPrefix+"-entity-node-button-open")}},e.prototype.collapseAll=function(){for(var t=0;t<this.rootEntityBlock.childNodes.length;t++)for(var e=this.rootEntityBlock.childNodes[0].querySelectorAll("."+this.cssPrefix+"-entity-children"),n=0;n<e.length;n++){e[n].hidden=!0}var i=this.rootEntityBlock.querySelectorAll("."+this.cssPrefix+"-entity-node-button");for(t=0;t<i.length;t++){i[t].classList.remove(this.cssPrefix+"-entity-node-button-open")}},e.prototype.selectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!0}},e.prototype.deselectAll=function(){for(var t=this.entityTreeBlock.querySelectorAll("input"),e=0;e<t.length;e++){t[e].checked=!1}},e.prototype.renderProgressBlock=function(){this.progressBlock=document.createElement("div"),this.progressBlock.classList.add(l.b+"-progress-win8"),this.progressBlock.classList.add(u.a.getMobileCssClass()),this.progressBlock.innerHTML='<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>'},e.prototype.clear=function(){this.panel.innerHTML=""},e}(s.Widget),h=function(){function t(t){this.isFilteringMode=!1,this.showSelected=!1,this.parentMenu=t.menu||null,this.parentLevel=t.parent||null,this.parentElement=t.container||document.body,this.levelIndex=t.levelIndex||0,this.levelDiv=null,this.domWriteItemsId=t.domWriteItemsId||!1,this.menuId=t.menuId||"",this.itemRenderedCallback=t.itemRenderedCallback||null,this._applyItem={id:null,text:null,itemDiv:null},this.items=t.items||[],this.activeItem=null,this.selectedItem=null,this.initialized=!1,this.showSelected=t.showSelected,this.updated=0,this.renderContent()}return Object.defineProperty(t.prototype,"applyItem",{get:function(){return this._applyItem},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!0,configurable:!0}),t.prototype.getItems=function(){return this.items},t.prototype.setItems=function(t){this.items=t},t.prototype.renderContent=function(){var t=this;if(this.items){var e=this.parentMenu.style.colors.bgON||"white",n=this.parentMenu.style.colors.fgON||"black",i=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontFamily||""),o=this.parentMenu.style.itemStyle.fontSize||"14px",s=this.parentMenu.options.multiselect,l=this.parentMenu.options.isSubQuery,c=Object(a.i)("div").addClass(u.a.getMobileCssClass());this.parentMenu.options.useDefaultStyles&&c.setStyle("backgroundColor",e).setStyle("border","1px solid").setStyle("borderColor",e).setStyle("backgroundColor",this.parentMenu.style.colors.border).setStyle("margin","-2px 2px 2px -2px").setStyle("width","auto").setStyle("height","auto"),c.setStyle("z-index",this.parentMenu.zIndex).setStyle("position","absolute").setStyle("display","none");var d=c.toDOM();d.menuLevel=this;var h=this._applyItem;if(s&&0===this.levelIndex&&!0!==this.parentMenu.options.hideButtons){var p=document.createElement("div");p.classList.add(this.cssPrefix+"-applyDiv"),p.menuItem=h,this.applyBtn=document.createElement("button"),this.parentMenu.options.useDefaultStyles&&(p.style.borderBottom="1px solid",p.style.padding="5px",p.style.marginBottom="5px",this.applyBtn.style.padding="0 5px",this.applyBtn.style.cursor="pointer");var f=document.createTextNode(this.parentMenu.options.buttons.submit);this.applyBtn.appendChild(f),p.appendChild(this.applyBtn);var g=document.createElement("button");g.classList.add(this.cssPrefix+"-cancel"),this.parentMenu.options.useDefaultStyles&&(g.style.padding="0 5px",g.style.cursor="pointer",g.style.marginLeft="15px");var m=document.createTextNode(this.parentMenu.options.buttons.cancel);g.appendChild(m),p.appendChild(g),d.appendChild(p),h.itemDiv=p,this.applyBtn.addEventListener("click",(function(){t.submit(t._applyItem)})),g.addEventListener("click",(function(){t.parentMenu.hideMenu()}))}if(null==this.parentLevel&&(this.parentMenu.options.searchBoxAlwaysShown||this.items.length>=this.parentMenu.options.showSearchBoxAfter)){var y=Object(a.i)("div").addClass(this.cssPrefix+"-searchDiv");this.parentMenu.options.useDefaultStyles&&(y.setStyle("border-bottom","1px solid #666").setStyle("background-color",e).setStyle("border-color",this.parentMenu.style.colors.border),""!=i&&y.setStyle("font-family",i),y.setStyle("font-size",o).setStyle("color",n).setStyle("cursor","pointer").setStyle("text-align","left").setStyle("padding","5px"));var v=Object(a.i)("input").id("searchBox").name("searchBox").type("text").size(16).addClass(this.cssPrefix+"-searchBox").on("input",(function(e){t.deactivateItem(t.activeItem),t.renderItems(t.searchBox.value)})).on("keydown",(function(e){switch(e.keyCode){case 13:t.activeItem&&t.activeItem.itemDiv.click();break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;case 39:t.searchBox.value||t.openSubLevel(t.activeItem)}}));this.parentMenu.options.useDefaultStyles&&v.setStyle("font-family","monospace").setStyle("font-size","8pt").setStyle("width","100%"),l&&v.addClass("eqjs-dialog"),this.searchBox=v.toDOM(),this.searchDiv=y.toDOM(),this.searchDiv.appendChild(this.searchBox),d.appendChild(this.searchDiv)}var C=document.createElement("div");C.tabIndex=1,Object(a.i)(C).addClass(this.cssPrefix+"-scrollDiv").addClass(u.a.getMobileCssClass()),C.style.overflowX="hidden",C.style.overflowY="auto",C.style.position="relative",d.appendChild(C),this.levelDiv=d,this.scrollDiv=C,this.menuId&&(this.levelDiv.id=this.menuId),this.parentLevel&&(this.levelDiv.style.zIndex=this.parentLevel.levelDiv.style.zIndex),this.renderItems();C.addEventListener("keydown",(function(e){switch(e.which){case 13:t.parentMenu.options.multiselect?t.parentMenu.getRootLevel().applyBtn.click():t.activeItem&&t.activeItem.itemDiv.click();break;case 32:t.activeItem&&t.activeItem.itemDiv.click();break;case 37:t.parentLevel&&!t.isFilteringMode&&(t.deactivateItem(t.activeItem),t.parentLevel.focus());break;case 39:t.openSubLevel(t.activeItem);break;case 38:t.moveActiveItemUp();break;case 40:t.moveActiveItemDown();break;default:return}e.preventDefault()})),u.a.isMobileMode()&&(this.closeDiv=Object(a.i)("div",d).addClass("eqjs-menu-close-btn").addText(r.g.getText("ButtonClose")).on("click",(function(){t.parentMenu.hideMenu()})).toDOM())}},t.prototype.moveActiveItemDown=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e<t.length-1&&this.activateItem(t[e+1],!1)}else this.activateItem(t[0],!1)},t.prototype.moveActiveItemUp=function(){var t=this.isFilteringMode?this.filteredItems:this.items;if(this.activeItem){var e=t.indexOf(this.activeItem);e>0&&this.activateItem(t[e-1],!1)}else this.activateItem(t[t.length-1],!1)},t.prototype.openSubLevel=function(t){t&&t.items&&!this.isFilteringMode&&(this.showSubLevel(t),t.subLevel.activateItem(t.subLevel.items[0]))},t.prototype.focusScrollDiv=function(){this.scrollDiv.focus()},t.prototype.turnCheckboxes=function(t){for(var e=0;e<t.length;e++){var n=t[e];n.itemCheckbox&&(n.itemCheckbox.checked=this.isItemSelected(n)),n.items&&this.turnCheckboxes(n.items)}},t.prototype.isItemSelected=function(t){if(t.items){for(var e=0;e<t.items.length;e++)if(this.isItemSelected(t.items[e]))return!0;return!1}return t.selected},t.prototype.setItemSelected=function(t,e){if(t.items)for(var n=0;n<t.items.length;n++)this.setItemSelected(t.items[n],e);else t.selected=e},t.prototype.submitItems=function(t,e){for(var n=0;n<t.length;n++)t[n].items?this.submitItems(t[n].items,e):t[n].selected&&e.push(t[n])},t.prototype.allSubitemsAreFiltered=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!1;return!0},t.prototype.isItemDiv=function(t){return!!t.menuItem},t.prototype.isLevelDiv=function(t){return!!t.menuLevel},t.prototype.getMenuItem=function(t){for(var e=t;!this.isItemDiv(e);){if(this.isLevelDiv(e))throw"Can't get menu item";e=e.parentElement}return e.menuItem},t.prototype.renderItemsWithoutFilter=function(){var t=this;this.isFilteringMode=!1;var e=this.scrollDiv,n=this.parentMenu.options.multiselect,i=this.parentMenu.options.activateOnMouseOver,o=this.parentMenu.style.colors.fgON||"black",r=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),s=this.parentMenu.getItemFilterCallback();e.innerHTML="";for(var l=0;l<this.items.length;l++){var c=this.items[l];if(c&&c.text){if(s){if(!s(c))continue;if(c.items&&this.allSubitemsAreFiltered(c.items,s))continue}c.data=function(e){return t[e]},void 0===c.selected&&(c.selected=!1),c.selected&&null==this.selectedItem&&(this.selectedItem=c);var d=document.createElement("div");if(Object(a.i)(d).addClass(this.cssPrefix+"-itemDiv").addClass(u.a.getMobileCssClass()),c.selected&&this.showSelected&&!n&&d.classList.add(this.cssPrefix+"-selected"),this.domWriteItemsId&&this.menuId&&(d.id="item-"+this.menuId+"-"+c.id),e.appendChild(d),d.menuItem=c,d.menuLevel=this,c.itemDiv=d,this.parentMenu.options.useDefaultStyles&&(d.style.fontSize=r,d.style.color=o,d.style.paddingLeft="15px",d.style.paddingRight="6px",d.style.cursor="pointer"),"---"==c.text)d.appendChild(document.createElement("hr"));else{if(n){var h=document.createElement("input");h.type="checkbox",h.id="cb"+c.id,h.checked=this.isItemSelected(c),h.defaultChecked=this.isItemSelected(c),d.appendChild(h),c.itemCheckbox=h,this.parentMenu.options.useDefaultStyles&&(h.style.margin="4px 10px 0 0",h.style.verticalAlign="top")}var p=document.createTextNode(c.text);if(d.appendChild(p),c.items&&c.items.length>0){d.classList.add(this.cssPrefix+"-itemDiv-hasChildren");var f=document.createElement("span");f.classList.add(this.cssPrefix+"-itemDiv-arrow"),d.appendChild(f);var g=document.createTextNode(">");f.appendChild(g)}var m=function(e){var i=t.getMenuItem(e.target);if(n)if(i.items&&e.target!=i.itemCheckbox)t.activateItem(i);else{var o=t.isItemSelected(i);t.setItemSelected(i,!o),i.itemCheckbox.checked=!o,t.parentMenu.refreshCheckboxes()}else t.activateItem(i),t.submit(i);return!1};d.removeEventListener("click",m),d.addEventListener("click",m),d.addEventListener("mouseenter",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!0,i&&t.activateItem(n)})),d.addEventListener("mouseleave",(function(e){var n=t.getMenuItem(e.target);t.parentMenu.isCursorInside=!1,setTimeout((function(){t.parentMenu.isCursorInside||i&&n==t.activeItem&&!n.subLevel&&t.deactivateItem(n)}),200)}))}this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,d)}}},t.prototype.renderItemsWithFilter=function(t){this.isFilteringMode=!0,this.scrollDiv.innerHTML="";var e=t.split(">"),n=e.map((function(t){return t.replace(/\*/g,"")})),i=this.filterItems(this.items,e);this.filteredItems=[];for(var o=0;o<i.length;o++)this.renderItemWithFilter(i[o],n,0)},t.prototype.matchesFilter=function(t,e){return!t||!e||e.test(t)},t.prototype.filterItems=function(t,e){for(var n=[],i=e.length>0?e[0]:"",o=e.length>1?e.slice(1):e,s=i?new RegExp(i.replace(/\*/g,".+?"),"i"):null,a=0;a<t.length;a++){var l=t[a];if(l.items){var u=r.i.assign({},l),c=this.matchesFilter(l.text,s);e.length<2?c&&e.length<2?u.items=r.i.createArrayFrom(l.items):u.items=this.filterItems(l.items,o):u.items=c?this.filterItems(l.items,o):[],u.items.length>0&&n.push(u)}else this.matchesFilter(l.text,s)&&n.push(l)}return n},t.prototype.renderItemWithFilter=function(t,e,n){var i=this,o=this.scrollDiv,r=n<e.length?e[n]:e[e.length-1],s=this.parentMenu.options.multiselect,l=this.parentMenu.options.activateOnMouseOver,c=this.parentMenu.style.colors.fgON||"black",d=(this.parentMenu.style.colors.bgOVER,this.parentMenu.style.itemStyle.fontSize||"14px"),h=this.parentMenu.getItemFilterCallback();if(t&&t.text){if(h){if(!h(t))return;if(t.items&&this.allSubitemsAreFiltered(t.items,h))return}t.data=function(t){return this[t]},void 0===t.selected&&(t.selected=!1),t.selected&&null==this.selectedItem&&(this.selectedItem=t);var p=document.createElement("div");if(Object(a.i)(p).addClass(this.cssPrefix+"-itemDiv").addClass(u.a.getMobileCssClass()),p.style.marginLeft=10*n+"px",t.selected&&!s&&p.classList.add(this.cssPrefix+"-selected"),this.domWriteItemsId&&this.menuId&&(p.id="item-"+this.menuId+"-"+t.id),o.appendChild(p),p.menuItem=t,p.menuLevel=this,t.itemDiv=p,this.parentMenu.options.useDefaultStyles&&(p.style.fontSize=d,p.style.color=c,p.style.paddingLeft="15px",p.style.paddingRight="6px",p.style.cursor="pointer"),"---"==t.text)p.appendChild(document.createElement("hr"));else{if(s){var f=document.createElement("input");f.type="checkbox",f.id="cb"+t.id,f.checked=this.isItemSelected(t),f.defaultChecked=this.isItemSelected(t),p.appendChild(f),t.itemCheckbox=f,this.parentMenu.options.useDefaultStyles&&(f.style.margin="4px 10px 0 0",f.style.verticalAlign="top")}var g=document.createElement("span");if(g.innerHTML=this.highlightText(t.text,r),p.appendChild(g),t.items&&t.items.length>0)p.classList.add(this.cssPrefix+"-itemDiv-filter-hasChildren");else{this.filteredItems.push(t);var m=function(e){if(s)if(t.items&&e.target!=t.itemCheckbox)i.activateItem(t);else{var n=i.isItemSelected(t);i.setItemSelected(t,!n),t.itemCheckbox.checked=!n,i.parentMenu.refreshCheckboxes()}else i.activateItem(t),i.submit(t);return!1};p.removeEventListener("click",m),p.addEventListener("click",m),p.addEventListener("mouseenter",(function(e){i.parentMenu.isCursorInside=!0,l&&i.activateItem(t)})),p.addEventListener("mouseleave",(function(e){i.parentMenu.isCursorInside=!1,setTimeout((function(){i.parentMenu.isCursorInside||l&&t==i.activeItem&&!t.subLevel&&i.deactivateItem(t)}),200)}))}}if(t.items)for(var y=0;y<t.items.length;y++)this.renderItemWithFilter(t.items[y],e,n+1);this.itemRenderedCallback&&this.itemRenderedCallback(this.menuId,p)}},t.prototype.highlightText=function(t,e){if(e&&e.length>0){var n=e.toLowerCase(),i=t.toLowerCase();if(i.indexOf(n)>=0){for(var o=0,r=t,s=[];;){var a=i.indexOf(n,o);if(a>=0?(s.push(a),o=a+e.length):o++,o>=r.length-1)break}if(s.length>0){t="";for(var l=0;l<s.length;l++)0===l&&(t+=r.substring(0,s[l])),t+="<span class='eqjs-menu-itemDiv-highlight'>"+r.substring(s[l],s[l]+e.length)+"</span>",l<s.length-1?t+=r.substring(s[l]+e.length,s[l+1]):t+=r.substring(s[l]+e.length)}}}return t},t.prototype.renderItems=function(t){t||u.a.isMobileMode()?(t=t||"",this.renderItemsWithFilter(t.toLowerCase())):this.renderItemsWithoutFilter()},t.prototype.activateItem=function(t,e){void 0===e&&(e=!0),null!=this.activeItem&&this.deactivateItem(this.activeItem),this.activeItem=t;var n=t.itemDiv;if(n.classList.add("active"),this.parentMenu.options.useDefaultStyles){this.parentMenu.style.colors.bgON,this.parentMenu.style.colors.fgON;var i=this.parentMenu.style.colors.bgOVER,o=this.parentMenu.style.colors.fgOVER||"";this.parentMenu.style.itemClass;""!=(this.parentMenu.style.itemClassOver||"")?(n.style.backgroundColor="",n.style.color=""):(n.style.backgroundColor=i,n.style.color=o)}t.items&&!this.isFilteringMode&&e&&this.showSubLevel(t)},t.prototype.deactivateItem=function(t){if(t){var e=t.itemDiv;if(e.classList.remove("active"),this.parentMenu.options.useDefaultStyles){var n=this.parentMenu.style.colors.bgON,i=this.parentMenu.style.colors.fgON;""!=(this.parentMenu.style.itemClass||"")?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=n,e.style.color=i)}t.subLevel&&t.subLevel.hide(),this.activeItem=null}},t.prototype.showSubLevel=function(e){if(!e.subLevel){var n="";this.menuId&&(n=this.menuId+"-"+e.id),e.subLevel=new t({showSelected:this.showSelected,menu:this.parentMenu,parent:this,container:this.parentElement,items:e.items,levelIndex:this.levelIndex+1,domWriteItemsId:this.domWriteItemsId,menuId:n,itemRenderedCallback:this.itemRenderedCallback})}var i=Object(a.k)(e.itemDiv),o=Object(a.l)(),r=Object(a.n)(),s=i.x-o.left,l=r.width-s-e.itemDiv.offsetWidth;i.x+=e.itemDiv.offsetParent.offsetWidth,i.y+=1,e.subLevel.showAt(i.x,i.y,!0,!0),e.subLevel.levelDiv.style.width="",e.subLevel.levelDiv.style.right="",l>=e.subLevel.levelDiv.offsetWidth||l>=s?l<e.subLevel.levelDiv.offsetWidth&&(e.subLevel.levelDiv.style.right=-o.left+"px"):(s<e.subLevel.levelDiv.offsetWidth?e.subLevel.levelDiv.style.left=o.left+4+"px":e.subLevel.levelDiv.style.left="",e.subLevel.levelDiv.style.right=Object(a.m)().width-i.x+e.itemDiv.offsetWidth-6+"px"),e.subLevel.levelDiv.style.visibility="visible",e.subLevel.focus()},t.prototype.adjustTopPos=function(t){var e=Object(a.n)(),n=t-Object(a.l)().top+this.levelDiv.offsetHeight,i=t;return n>e.height-5&&(i-=n-e.height+5)<Object(a.l)().top&&(i=Object(a.l)().top+10),i},t.prototype.showAt=function(t,e,n,i){if(this.items){this.initLevelDiv(),this.turnCheckboxes(this.items),this.renderItems();var o=this.levelDiv.style;i&&(this.levelDiv.style.visibility="hidden"),o.display="block",o.left=t+"px",o.top=e+"px",this.scrollDiv.style.width="auto",this.scrollDiv.style.height="auto",n&&(e=this.adjustTopPos(e),o.top=e+"px");var r=this.parentMenu.minItemWidth;if(r>0&&this.scrollDiv.offsetWidth<r)for(var s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=r+"px";var l=this.parentMenu.maxItemWidth;if(l>0&&this.scrollDiv.offsetWidth>l)for(s=0;s<this.items.length;s++)this.items[s].itemDiv.style.width=l+"px",this.items[s].itemDiv.style.overflowX="hidden";var u=Object(a.n)().height-(e-Object(a.l)().top)-15;if(this.parentMenu.maxHeight>0&&u>this.parentMenu.maxHeight&&(u=this.parentMenu.maxHeight),null!=this._applyItem&&null!=this._applyItem.itemDiv&&(u-=this._applyItem.itemDiv.offsetHeight+5),null!=this.searchDiv&&(u-=this.searchDiv.offsetHeight),null!=this.closeDiv&&(u-=this.closeDiv.offsetHeight),this.levelDiv.offsetHeight>u){var c=u;c<50&&(c=50),this.scrollDiv.style.height=c+"px"}else this.scrollDiv.style.height="auto";this.activeItem=null}},t.prototype.focus=function(){var t=this;window.setTimeout((function(){t.scrollDiv.focus(),null!=t.searchBox&&(t.parentMenu.options.searchBoxAutoFocus&&t.searchBox.focus(),t.searchBox.value="")}),100)},t.prototype.hide=function(){(null!==this.activeItem&&this.activeItem.subLevel&&this.activeItem.subLevel.hide(),this.levelDiv)&&(this.levelDiv.style.display="none",this.initialized&&(this.parentElement.removeChild(this.levelDiv),this.initialized=!1))},t.prototype.initLevelDiv=function(){this.initialized||(this.parentElement.appendChild(this.levelDiv),Object(a.i)(this.levelDiv).addClass(this.cssPrefix+"-levelDiv").addClass(u.a.getMobileCssClass()),this.initialized=!0)},t.prototype.submit=function(t){if(null!=t&&!t.items){this.parentMenu.hideMenu();var e=[];t==this._applyItem&&this.submitItems(this.items,e),this.parentMenu.submitMenu(t,e)}},t.prototype.remove=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.subLevel&&e.subLevel.remove()}if(this.levelDiv){this.levelDiv.innerHTML="";var n=this.levelDiv.parentNode;null!=n&&n.removeChild(this.levelDiv)}this.levelDiv=null},t.prototype.update=function(t){this.remove(),this.items=t,this.activeItem=null,this.selectedItem=null,this._applyItem.itemDiv=null,this.initialized=!1,this.updated++,this.renderContent()},t.prototype.refreshCheckboxes=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemCheckbox&&(e.itemCheckbox.checked=this.isItemSelected(e)),e.subLevel&&e.subLevel.refreshCheckboxes()}},t.prototype.refreshItems=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.itemDiv&&(e.hidden?e.itemDiv.style.display="none":e.itemDiv.style.display="block"),e.subLevel&&e.subLevel.refreshItems()}},t.prototype.findItem=function(t){for(var e=t.toLowerCase(),n=0;n<this.items.length;n++){var i=this.items[n];if(0==i.text.toLowerCase().indexOf(e))return i}return null},t}(),p=function(){function t(e){var n=this;this.isCursorInside=!1,this.mouseIsOverBlock=!1,this.mouseIsOverLink=!1,this.toId=null,this.active=!1,this.ancorFocused=null,this.options={items:[],buttons:{submit:r.g.getText("ButtonApply"),cancel:r.g.getText("ButtonCancel")},itemFilterCallback:null,useDefaultStyles:!1,multiselect:!1,adjustHeight:!0,showSearchBoxAfter:30,activateOnMouseOver:!0,container:document.body,domWriteItemsId:!1,itemRenderedCallback:null},e&&r.i.assignDeep(this.options,e),this.options.hideButtons&&(this.options.submitOnBlur=!0),this.menuId=t.lastMenuID++,this.updateProps(),this.rootLevel=new h({menu:this,items:this.options.items,levelIndex:0,container:this.options.container,domWriteItemsId:this.options.domWriteItemsId,menuId:this.options.id,itemRenderedCallback:this.options.itemRenderedCallback,showSelected:this.options.showSelected}),this.rootLevel.levelDiv.classList.add(this.cssPrefix+"-rootLevel"),this.options.zIndex&&(this.rootLevel.levelDiv.style.zIndex=""+this.options.zIndex),this.menuKeyUpHandler=function(t){27==t.which&&(n.hideMenu(),t.stopImmediatePropagation())},this.globalMouseDownHandler=function(t){if(!n.active)return!0;for(var e=window.event||t,i=e.srcElement||e.target,o=!0;i;){if(i.tagName&&"div"==i.tagName.toLowerCase()&&i.menuLevel&&i.menuLevel.parentMenu==n){o=!1;break}i=i.parentNode||i.parentElement}return o&&(n.options.submitOnBlur&&n.rootLevel.submit(n.rootLevel.applyItem),n.hideMenu()),!0},this.render()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-menu"},enumerable:!0,configurable:!0}),t.prototype.getItems=function(){return this.rootLevel.getItems()},t.prototype.updateProps=function(){this.style={},this.style.colors={border:"#666666",shadow:"#888888",bgON:"white",fgON:"black",bgOVER:"#B6BDD2",fgOVER:"black"},this.style.itemStyle={fontSize:"14px"},this.minItemWidth=0,this.maxItemWidth=0,this.maxHeight=0,this.zIndex=""+this.options.zIndex,this.commandTemplate="",this.args=[],this.active=!1},t.prototype.render=function(){},t.prototype.clearItemsMenuProps=function(t){if(t)for(var e=0;e<t.length;e++)this.clearItemMenuProps(t[e])},t.prototype.clearItemMenuProps=function(t){t.subLevel&&t.subLevel.parentMenu==this||(t.subLevel&&(t.subLevel.remove(),t.subLevel=null),t.itemDiv&&(t.itemDiv=null),t.items&&this.clearItemsMenuProps(t.items))},t.prototype.setSelectedItems=function(t,e){for(var n=t?t.length:0,i=0;i<n;i++){var o=t[i];o.items?this.setSelectedItems(o.items,e):o.selected=e.indexOf(o.id)>=0}},t.prototype.getRootLevel=function(){return this.rootLevel},t.prototype.getItemFilterCallback=function(){return this.itemFilterCallback},t.prototype.showMenu=function(t){this.ancorFocused=t.anchor==document.activeElement?t.anchor:null,this.clearItemsMenuProps(this.options.items),this.itemSelectedCallback=t.itemSelectedCallback||null,this.menuClosedCallback=t.menuClosedCallback||null,this.itemFilterCallback=t.itemFilterCallback||null,t.items&&(this.options.items=t.items,this.rootLevel.setItems(t.items)),t.onMenuItemSelected&&(this.options.onMenuItemSelected=t.onMenuItemSelected);var e=t.selectedIds||null;if(e?"string"==typeof e&&(e=e.split(",")):e=[],this.active=!0,this.setSelectedItems(this.options.items,e),u.a.isMobileMode())this.rootLevel.showAt(0,0,!0,!0),this.rootLevel.levelDiv.style.top="0px",this.rootLevel.levelDiv.style.bottom="0px",this.rootLevel.levelDiv.style.right="0px",this.rootLevel.levelDiv.style.position="fixed",this.rootLevel.levelDiv.style.fontSize="20px";else{var n=t.anchor||document.documentElement,i=Object(a.k)(n),o=n.offsetHeight,r=n.offsetHeight,s={x:i.x,y:i.y+o+2},c=Object(a.l)(),d=Object(a.n)(),h=s.x+r-c.left,p=d.width-h+r;s.x+=2,this.rootLevel.showAt(s.x,s.y,!0,!0),this.rootLevel.levelDiv.style.width="",this.rootLevel.levelDiv.style.right="",this.rootLevel.levelDiv.style.zIndex||(this.rootLevel.levelDiv.style.zIndex=""+Math.max(1e4,Object(l.c)(n)+1)),p>=this.rootLevel.levelDiv.offsetWidth||p>=h?p<this.rootLevel.levelDiv.offsetWidth&&(this.rootLevel.levelDiv.style.right=-c.left+"px"):(h<this.rootLevel.levelDiv.offsetWidth?this.rootLevel.levelDiv.style.left=c.left+4+"px":this.rootLevel.levelDiv.style.left="",this.rootLevel.levelDiv.style.right=Object(a.m)().width-s.x-r+"px"),this.rootLevel.levelDiv.style.fontSize="14px"}this.rootLevel.levelDiv.style.visibility="visible",this.rootLevel.focus(),document.addEventListener("keyup",this.menuKeyUpHandler),document.addEventListener("mousedown",this.globalMouseDownHandler,!0)},t.prototype.hideMenu=function(){document.removeEventListener("mousedown",this.globalMouseDownHandler,!0),document.removeEventListener("keyup",this.menuKeyUpHandler),this.rootLevel.hide(),this.ancorFocused&&this.ancorFocused.focus(),this.menuClosedCallback&&this.menuClosedCallback()},t.prototype.submitMenu=function(t,e){this.itemSelectedCallback&&this.itemSelectedCallback(t,e)},t.prototype.knockMenuStyle=function(t){t.removeAttribute("style");var e=t.querySelectorAll("ul").item(0);!1!==!(!e||!e.style)&&e.setAttribute("style","")},t.prototype.refreshItems=function(){this.rootLevel.refreshItems()},t.prototype.refreshCheckboxes=function(){this.rootLevel.refreshCheckboxes()},t.lastMenuID=0,t}(),f=function(){function t(){this.formatStr="",this.pos=0,this.token="text",this.tokenText=""}return t.prototype.start=function(t){this.formatStr=t,this.pos=0,this.tokenText=""},t.prototype.skipSpaces=function(){for(;this.pos<this.formatStr.length&&" "===this.formatStr.charAt(this.pos);)this.pos++},t.prototype.getToken=function(){return this.token},t.prototype.getTokenText=function(){return this.tokenText},t.prototype.next=function(){if(this.skipSpaces(),this.pos>=this.formatStr.length)return!1;var t=0;if("{"===this.formatStr.charAt(this.pos)){if((t=this.formatStr.indexOf("}",this.pos))<0)return!1;this.tokenText=this.formatStr.substring(this.pos,t+1),0!==this.tokenText.indexOf("{expr")&&0!==this.tokenText.indexOf("{attr")||(this.token="expression"),this.pos=t+1}else if("["===this.formatStr.charAt(this.pos)&&this.pos<this.formatStr.length-1&&"["===this.formatStr.charAt(this.pos+1))this.pos+=2,t=this.formatStr.indexOf("]]",this.pos),this.token="function",this.tokenText=this.formatStr.substring(this.pos,t),this.pos=t+2;else{this.token="text";var e=this.formatStr.indexOf("{",this.pos);e<0&&(e=this.formatStr.length);var n=this.formatStr.indexOf("[[",this.pos);n<0&&(n=this.formatStr.length),t=Math.min(e,n),this.tokenText=this.formatStr.substring(this.pos,t).trim(),this.pos=t}return!0},t}(),g=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),o=0;for(e=0;e<n;e++)for(var r=arguments[e],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i};!function(t){t[t.Enable=0]="Enable",t[t.Delete=1]="Delete",t[t.Hidden=2]="Hidden",t[t.SortingNone=3]="SortingNone",t[t.SortingAsc=4]="SortingAsc",t[t.SortingDesc=5]="SortingDesc",t[t.MoveTop=6]="MoveTop",t[t.MoveUp=7]="MoveUp",t[t.MoveDown=8]="MoveDown",t[t.MoveBottom=9]="MoveBottom",t[t.Menu=10]="Menu",t[t.Type=11]="Type",t[t.Format=12]="Format"}(o||(o={}));var m,y=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.buttonMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.panel=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!0,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute(),this.getButtonsToShow().indexOf("sorting")>=0&&this.column.enabled&&(this.sortingButton=this.renderSoringButton(this.column.sorting),this.column.sorting!==s.SortDirection.None&&(this.sortingButton.style.display="block"));var e=Object(a.i)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.panel.options.allowDragDrop&&!u.a.isMobileMode()&&a.j.registerDraggableItem({element:this.element,scope:"entityAttrSort",data:{column:this.column},beforeDragStart:function(){t.hideButtons()},renderer:function(e){e.innerHTML="";var n=document.createElement("span");n.innerText=t.column.caption,e.classList.add("eqjs-sortable-helper"),e.appendChild(n)},onDragStart:function(e){t.element.style.display="none",e.dropEffect=a.d.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.style.removeProperty("display")}}),this.isEditable()&&(this.createFunctionMenu(),this.createFormatsMenu()),this.createButtonMenu(),e.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderCheckbox()).addChild("div",(function(e){return e.addClass(l.b+"-button-placeholder",t.cssPrefix+"-button-placeholder",t.cssPrefix+"-colelement",t.cssPrefix+"-sortbutton-placeholder").addChildElement(t.sortingButton)})).addChildElement(this.renderExpressionBlock()),!1===this.panel.options.showColumnTitles||u.a.isMobileMode()||e.addChildElement(this.renderCaptionBlock()),e.addChild("div",(function(e){e.addClass(l.b+"-column-buttonsBlock",t.cssPrefix+"-buttonsBlock").addClass(u.a.getMobileCssClass()),t.getButtonsToShow().indexOf("enable")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderEnabledButton()),t.getButtonsToShow().indexOf("type")>=0&&t.column.enabled&&e.addChildElement(t.renderColumnTypeButton()),t.getButtonsToShow().indexOf("format")>=0&&t.column.enabled&&e.addChildElement(t.renderColumnFormatButton()),t.getButtonsToShow().indexOf("delete")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderDeleteButton()),t.getButtonsToShow().indexOf("menu")>=0&&!t.column.isReadOnly()&&e.addChildElement(t.renderMenuButton())})),u.a.isMobileMode()||e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.panel.options.accentActiveColumn||u.a.isMobileMode())&&e.on("click",this.onMouseClick.bind(this)),this.panel.options.alwaysShowButtons&&this.showButtons(),this.element},t.prototype.onMouseClick=function(t){return t.stopPropagation(),this.panel.toggleColumnPicked(this.column),this.adjustButtonsVisibility(),u.a.isMobileMode()||this.element.dispatchEvent(Object(a.h)("mouseenter")),!1},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass());return this.isEditable()?e.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("click",(function(e){e.stopPropagation();var n=e.target,i=n.parentElement.querySelector("input");return i&&(n.style.display="none",i.style.removeProperty("display"),i.style.minWidth=""+n.clientWidth,i.focus(),t.element.setAttribute(a.j.DRAG_DISABLED_ATTR,"")),!1}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,i=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,i=!1):e instanceof FocusEvent&&(n=!0),n){var o=e.target,r=o.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),o.style.display="none"),i&&t.column.caption!==o.value?(t.column.caption=o.value,t.fireColumnChanged()):(o.value=t.column.caption,Object(l.d)(r)),t.element.removeAttribute(a.j.DRAG_DISABLED_ATTR)}return!0}))})):e.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),e.toDOM()},t.prototype.renderSoringButton=function(t){var e,n=this,i=l.b+"-column-sortbutton";switch(t){case s.SortDirection.Ascending:e=i+"-asc";break;case s.SortDirection.Descending:e=i+"-desc";break;default:e=i+"-none"}return this.isEditable()?Object(a.i)("div").addClass(i,l.b+"-button",e).data("btnplaceholder","").title(s.i18n.getText("ButtonSorting")).attr("tabIndex","0").on("click",(function(t){t.stopPropagation(),n.keepShowingButtons=!0,(n.getUIS()&&n.panel.sortMenu||n.panel.moveMenu).showMenu({anchor:n.sortingButton,selectedIds:n.column.isHidden()?["IsHidden"]:null,itemSelectedCallback:function(t,e){var i;switch(t.id){case"IsHidden":i=o.Hidden;break;case"MoveTop":i=o.MoveTop;break;case"MoveDown":i=o.MoveDown;break;case"MoveUp":i=o.MoveUp;break;case"MoveBottom":i=o.MoveBottom;break;case"None":i=o.SortingNone;break;case"Ascending":i=o.SortingAsc;break;case"Descending":i=o.SortingDesc}n.buttonMenuHandler(i,null)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}})})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():t===s.SortDirection.Ascending||t===s.SortDirection.Descending?Object(a.i)("div").addClass(i,l.b+"-button",e).title(s.i18n.getText("ButtonSorting")).toDOM():null},t.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.column.isReadOnly()?Object(a.i)("div").title(s.i18n.getText("CmdToggleEnable")).attr("tabIndex","0").addClass(this.cssPrefix+"-colelement "+this.cssPrefix+"-column-checkbox").addClass(this.column.enabled?"enabled":"").on("click",(function(){return t.column.enabled=!t.column.enabled,t.column.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},t.prototype.renderDeleteButton=function(){var t=this;return Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-deletebutton-placeholder").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-delete").title(s.i18n.getText("CmdDelete")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(o.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.renderMenuButton=function(){var t=this;return Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-menubutton-placeholder").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-menu").title(s.i18n.getText("ButtonMenu")).attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(o.Menu,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){return this.getAttributeCaption(t,this.panel.options.titleElementFormat)},t.prototype.getAttributeCaption=function(t,e){return e=e||this.panel.options.attrElementFormat,this.panel.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.column.enabled?"":" "+this.cssPrefix+"-disabled",this.column.enabled&&(t+=this.column.isReadOnly()?" "+this.cssPrefix+"-readonly":""),t+=this.column.isHidden()?" "+this.cssPrefix+"-hidden":""},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.panel.options.allowAggrColumns?Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-typebutton-placeholder",this.cssPrefix+"-button-active").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-type").title(s.i18n.getText("ButtonToAggr")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeTypeHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this,e=this.getFormatsMenuItems();return this.isEditable()&&!1!==this.panel.options.allowDisplayFormatChange&&e.length>1?Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-formatbutton-placeholder",this.cssPrefix+"-button-active").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-format").title(s.i18n.getText("ButtonFormat")).attr("tabIndex","0").on("click",(function(e){e.stopPropagation(),t.keepShowingButtons=!0,t.changeFormatHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM():null},t.prototype.renderEnabledButton=function(){var t=this;return Object(a.i)("div").addClass(l.b+"-button-placeholder",this.cssPrefix+"-button-placeholder",this.cssPrefix+"-enablebutton-placeholder",this.cssPrefix+"-button-active").data("btnplaceholder","").addChild("div",(function(e){return e.addClass(l.b+"-button",l.b+"-column-button",l.b+"-column-button-enable").title(s.i18n.getText("CmdToggleEnable")).addClass(t.column.enabled?"enabled":"").attr("tabIndex","0").on("click",(function(e){return t.buttonMenuHandler(o.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}))})).toDOM()},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.changeFormatHandler=function(t){var e=this,n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),i="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(i=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:i,itemSelectedCallback:function(t,n){return t.id!=i&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},t.prototype.getUIS=function(){return this.panel.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseEnter=function(t){return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){Object(a.i)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){Object(a.i)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtons||(this.panel.options.accentActiveColumn||u.a.isMobileMode())&&this.isColumnActive())&&this.showButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){this.keepShowingButtons||!0===this.panel.options.alwaysShowButtons||this.isColumnActive()&&1==this.panel.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),i=!0,o=null,r=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(r)>=0;this.column.expr.func!==u.id||c||(i=!1),c&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(u.id),o={id:u.id,text:t},e.push(o))}}i||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(o={id:"CustomSqlDivider",text:"---"},e.push(o),o={id:"CUSTOMSQL",text:t=s.i18n.getText("CustomExpression")},e.push(o));var d=this.column.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new p(h)},t.prototype.createFormatsMenu=function(){if(0!=this.panel.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new p(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:s.i18n.getText("DisplayFormats",t.name)||t.name}})))},t.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&Array.isArray(this.panel.options.buttons)?this.panel.options.buttons:["enable","delete","type","sorting","format"]},t.prototype.buttonMenuHandler=function(t,e){var n=this;switch(t){case o.Delete:var i=this.column.getQuery();i.removeColumn(this.column,this.panel),i.fireColumnsChangedEvent(s.QueryChangeAction.Delete,this.column);break;case o.Enable:this.column.enabled=!this.column.enabled,this.fireColumnChanged();break;case o.Hidden:this.column.setHidden(!this.column.isHidden()),this.fireColumnChanged();break;case o.MoveTop:this.panel.moveColumn(this.column,"MoveTop");break;case o.MoveBottom:this.panel.moveColumn(this.column,"MoveBottom");break;case o.MoveUp:this.panel.moveColumn(this.column,"MoveUp");break;case o.MoveDown:this.panel.moveColumn(this.column,"MoveDown");break;case o.SortingAsc:this.column.sorting=s.SortDirection.Ascending,this.column.fireChangedEvent();break;case o.SortingDesc:this.column.sorting=s.SortDirection.Descending,this.column.fireChangedEvent();break;case o.SortingNone:this.column.sorting=s.SortDirection.None,this.column.fireChangedEvent();break;case o.Menu:var r=this.buttonMenu;this.keepShowingButtons=!0,r.showMenu({anchor:e?e.target:null,selectedIds:this.getButtonMenuSelectedItems(),itemSelectedCallback:function(t){var i=t.id;switch(t.id){case"enable":i=o.Enable;break;case"delete":i=o.Delete;break;case"hidden":i=o.Hidden;break;case"MoveTop":i=o.MoveTop;break;case"MoveBottom":i=o.MoveBottom;break;case"MoveUp":i=o.MoveUp;break;case"MoveDown":i=o.MoveDown;break;case"None":i=o.SortingNone;break;case"Ascending":case"Descending":i=o.SortingAsc}n.buttonMenuHandler(i,e)},itemFilterCallback:function(t){return n.column.enabled||"__group"===t.id||"enable"===t.id||"delete"===t.id},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;default:this.processFormatsButtonMenuItems(t,e)||this.processExtraButtonMenuItems(t,e)}return e&&e.stopPropagation(),!1},t.prototype.createButtonMenu=function(){if(!this.buttonMenu){var t=this.column.id;t&&(t+="-ButtonMenu");var e=[];e.push({id:"enable",text:s.i18n.getText("MenuEnable")}),this.panel.options.allowHiddenColumns&&e.push({id:"hidden",text:s.i18n.getText("CmdHiddenColumn")}),e.push({id:"delete",text:s.i18n.getText("CmdDelete")});var n=[];n.push({id:"__group",text:" ",items:e});var i=this.panel.options.allowSorting?g(this.panel.getSortMenuList(),this.panel.getMoveMenuList()):this.panel.getMoveMenuList();n.push({id:"__group",text:s.i18n.getText("CmdGroupSort"),items:i});var o=this.getExtraButtonMenuItems();o&&Array.isArray(o)&&(n=g(n,o));var r=this.getFormatsMenuItems();r.length>1&&n.push({id:"__group",text:s.i18n.getText("CmdGroupFormat"),items:r});var a={items:n,id:t,searchBoxAlwaysShown:!1,domWriteItemsId:!0,showSelected:!0};this.buttonMenu=new p(a)}},t.prototype.processFormatsButtonMenuItems=function(t,e){var n=this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());if("{0:__default}"==t)this.column.displayFormat="";else{if(!(n.filter((function(e){return e.format==t})).length>0))return!1;this.column.displayFormat=t}return this.column.fireChangedEvent(),!0},t.prototype.getButtonMenuSelectedItems=function(){var t=this,e=[];this.column.enabled&&e.push("enable"),this.column.isHidden()&&e.push("hidden");var n="{0:__default}";return this.panel.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).filter((function(e){return e.format==t.column.displayFormat})).length>0&&(n=this.column.displayFormat),e.push(n),e},t}(),v=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 v(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"},e.prototype.renderExpressionBlock=function(){var t=this;return Object(a.i)("div").addClass(this.cssPrefix+"-expr-block").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass()).addChildElement(t.renderBaseExpression())})).toDOM()},e.prototype.renderBaseExpression=function(){var t=this,e=this.getAttributeCaption(this.baseAttr);return this.isEditable()?Object(a.i)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.stopPropagation(),t.panel.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:t.baseExpressionItemSelectedCallback.bind(t),itemFilterCallback:function(t){return"__AddAll__"!==t.id}}),!1})).toDOM():Object(a.i)("span").text(e).title(e).toDOM()},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.panel.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeHandler=function(t){var e=this;this.keepShowingButtons=!0,this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return e.processExtraButtonMenuItems(t.id,null),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},e.prototype.changeTypeToCustomSql=function(){var t=this;this.column.getQuery().changeColumnType(this.column,s.ExprTag.CustomSql);var e=this.element.parentElement;setTimeout((function(){var n=e.querySelector("div[data-id='"+t.column.id+"'] div[class*='"+t.cssPrefix+"-expr-block'] div[class*='"+t.cssPrefix+"-colelement'] a");n&&n.click()}),500),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,s.ExprTag.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.processExtraButtonMenuItems=function(t,e){return"CUSTOMSQL"===t?this.changeTypeToCustomSql():this.changeTypeToAggr(t),!0},e.prototype.getExtraButtonMenuItems=function(){for(var t,e=[],n=this.panel.getContext().getModel().getAggrFunctions(),i=!0,o=!0,s=null,a=this.getAttribute(),l=0,u=n;l<u.length;l++){var c=u[l];i=c.getAppliedTypesOrDefault().indexOf(a.dataType)>=0,this.column.expr.func!==c.id||i||(o=!1),i&&(t=this.panel.getContext().getModel().getAggrFunctionCaption(c.id),s={id:c.id,text:t},e.push(s))}for(var d=0;d<n.length;d++)n[d];return o||(this.column.expr.func=e[0].id),this.panel.areCustomExpressionsAllowed()&&(s={id:"CustomSqlDivider",text:"---"},e.push(s),s={id:"CUSTOMSQL",text:t=r.g.getText("CustomExpression")},e.push(s)),[{id:"__group",text:r.g.getText("ColTypeGroup"),items:e}]},e}(y),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)}}(),x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displayFormatParser=new f,e}return b(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-aggr"},e.prototype.getAttribute=function(){return this.panel.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultColumnCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.panel.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderExpressionBlock=function(){var t=this,e=this.panel.getContext().getModel(),n=Object(a.i)("div").addClass(this.cssPrefix+"-expr-block",this.cssPrefix+"-expr-block-aggr").addClass(u.a.getMobileCssClass()),i=e.getAggrFunctionFormat(this.column.expr.func);if(i&&""!==i){var o=this.parseDisplayFormat(i);if(0!==o.length){for(var r=null,s=o.length,l=function(e){if(1===(r=o[e]).type)if(c.isEditable()){var i=Object(a.i)("a").attr("href","javascript:void(0)").text(r.text).on("click",(function(e){e.stopPropagation(),t.functionMenu.showMenu({anchor:i.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){"CUSTOMSQL"===e.id?t.changeTypeToCustomSql():(t.column.expr.func=e.id,t.column.caption="",t.fireColumnChanged())}})}));n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-aggrfuncelement").addClass(u.a.getMobileCssClass()).addChildElement(i.toDOM())}))}else n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-aggrfuncelement").addClass(u.a.getMobileCssClass()).addChild("span",(function(t){return t.text(r.text).title(r.text)}))}));else 2===r.type?n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-colelement",t.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass()).addChildElement(t.renderBaseExpression())})):3===r.type&&n.addChild("span",(function(e){return e.addClass(t.cssPrefix+"-colelement").addClass(u.a.getMobileCssClass()).text(r.text).title(r.text)}))},c=this,d=0;d<s;d++)l(d);return n.toDOM()}}},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.g.getText("ButtonToSimple"))),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;return this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged(),!1},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.EntityAttribute),this.fireColumnChanged()},e.prototype.parseDisplayFormat=function(t){if(!t)return[];var e=[],n=this.displayFormatParser;for(n.start(t);n.next();){var i=n.getToken(),o=n.getTokenText();"function"===i?e.push({type:1,text:o}):"expression"===i?e.push({type:2}):"text"===i&&e.push({type:3,text:o})}return e},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.g.getText("ColTypeGroup"),items:[{id:"type",text:r.g.getText("ColTypeSimple")}]}]},e}(C),w=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)}}(),E=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dataTypeMenu=null,e}return w(e,t),e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"+t.prototype.getClassesToAdd.call(this)},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.firstElementChild.classList.add("aggregated"),e.firstElementChild.setAttribute("title",r.g.getText("ButtonToSimple"))),e},e.prototype.renderExpressionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultColumnCaption());var e=Object(a.i)("div").addClass(this.cssPrefix+"-expr-block").addClass(u.a.getMobileCssClass()).toDOM(),n=Object(a.i)("div",e).addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass());return this.isEditable()?n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(t.column.caption).on("touchstart click",(function(e){e.stopPropagation();var n=e.target,i=n.parentElement.querySelector("input");i&&(n.style.display="none",i.style.removeProperty("display"),i.style.width="100%",i.focus(),t.element.setAttribute(a.j.DRAG_DISABLED_ATTR,""))}))})).addChild("input",(function(e){return e.hide().value(t.column.expr.sql).on("blur keydown",(function(e){var n=!1,i=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,i=!1):e instanceof FocusEvent&&(n=!0),n){var o=e.target,r=o.parentElement.querySelector("a");r&&(r.style.removeProperty("display"),o.style.display="none"),i&&t.column.expr.sql!==o.value?(t.column.expr.sql=o.value,t.fireColumnChanged()):o.value=t.column.expr.sql,t.element.removeAttribute(a.j.DRAG_DISABLED_ATTR)}}))})):n.addChild("span",(function(e){e.text(t.column.caption).title(t.column.caption)})),n=Object(a.i)("div",e).addClass(this.cssPrefix+"-colelement").addChild("span",(function(t){t.text(":").title(":")})),n=Object(a.i)("div",e).addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-attrelement").addClass(u.a.getMobileCssClass()),this.isEditable()?(this.createDataTypeMenu(),n.addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(r.d[t.column.expr.dataType]).text(r.d[t.column.expr.dataType]).on("touchstart click",(function(n){n.stopPropagation(),t.dataTypeMenu.showMenu({anchor:e.toDOM(),selectedIds:null,itemSelectedCallback:function(e,n){t.column.expr.dataType=e.id,t.fireColumnChanged()}})}))}))):(this.column.expr.dataType,n.addChild("span",(function(e){e.text(r.d[t.column.expr.dataType]).title(r.d[t.column.expr.dataType])}))),e},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.EntityAttribute),this.fireColumnChanged()},e.prototype.getDefaultColumnCaption=function(){return"Custom SQL Column"},e.prototype.getDefaultValue=function(){return this.column.expr.sql},e.prototype.getUIS=function(){return!0},e.prototype.changeTypeHandler=function(t){this.changeTypeToSimple()},e.prototype.processExtraButtonMenuItems=function(t,e){return this.changeTypeToSimple(),!0},e.prototype.createFunctionMenu=function(){},e.prototype.getExtraButtonMenuItems=function(){return[{id:"__group",text:r.g.getText("ColTypeGroup"),items:[{id:"type",text:r.g.getText("ColTypeSimple")}]}]},e.prototype.createDataTypeMenu=function(){var t=[];for(var e in r.d)if(!isNaN(Number(e))){var n={id:e,text:r.d[e]};t.push(n)}var i=this.column.id;i&&(i+="-DataTypeMenu");var o={items:t,id:i,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.dataTypeMenu=new p(o)},e}(C),T=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)}}(),D=function(t){function e(e){var n=t.call(this,e)||this;return n.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,buttons:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0,allowHiddenColumns:!1,showAddAllForEntity:!1},n.landingSlot=Object(a.i)("div").addClass(n.cssPrefix+"-col-landing-slot").addChildElement(Object(a.i)("div").toDOM()).toDOM(),n.landingIndex=-1,n.slot.classList.add(n.cssPrefix+"-panel"),n.group=s.WidgetGroup.Query,n}return T(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qc"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsPanel"},e.prototype.init=function(e,n){var i=this;t.prototype.init.call(this,e,n),this.setOptions(n);var o=e.getModel();this.detachQueryObserver(),this.attachQueryObserver(),a.j.removeDropContainer(this.slot),this.options.allowDragDrop&&a.j.registerDropContainer({element:this.slot,scopes:["entityAttr","entityAttrSort"],onDragEnter:function(t,e){if(i.slot.classList.add(l.b+"-drophover"),"entityAttrSort"===e.item.scope)i.showLandingSlot(e.pageX,e.pageY);else{var n=e.data.attrId;o.checkAttrProperty(n,"useInResult")||(e.dropEffect=a.d.Forbid),e.dragImage.classList.add("eqjs-sortable-helper")}},onDragOver:function(t,e){var n=e.data.attrId;("entityAttrSort"===e.item.scope||o.checkAttrProperty(n,"useInResult"))&&i.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){"entityAttrSort"===e.item.scope?e.dropEffect=a.d.Forbid:(e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width")),i.slot.classList.remove(l.b+"-drophover"),i.hideLandingSlot()},onDrop:function(t,e){if("entityAttrSort"==e.item.scope){var n=i.getQuery().getColumns().indexOf(e.data.column);i.moveColumnCore(n,i.landingIndex)}else{var o=e.data.attrId;i.addNewColumn(o,i.landingIndex)}}})},e.prototype.renderBaseElements=function(){var t=this,e=0;if(this.options.showHeader){var n=Object(a.i)("div",this.slot).hide().addClass(this.cssPrefix+"-header").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-header-expression").text(r.g.getText("HeaderExpression"))}));!1!==this.options.showColumnTitles&&n.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-header-title").text(r.g.getText("HeaderTitle"))})),this.headerElement=n.toDOM(),e+=this.headerElement.offsetHeight}this.columnsBlock=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-columns").addClass(u.a.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowElement=Object(a.i)("div",this.slot).addClass(l.b+"-addrow",this.cssPrefix+"-addrow",l.b+"-addrow-empty").addClass(u.a.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").text(r.g.getText("CmdClickToAddColumn")).on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){if("__AddAll__"===e.id&&e.extra&&Array.isArray(e.extra.ids))e.extra.ids.forEach((function(e){return t.addNewColumn(e)}));else{var i=e.id;t.addNewColumn(i)}return!1}})}))})).toDOM(),e+=this.addRowElement.offsetHeight),this.columnsBlock.style.maxHeight=this.slot.offsetHeight-e-25+"px"},e.prototype.destroyCore=function(){a.j.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var i=n.data;if(i&&(i.part==s.QueryChangePart.Columns||i.part==s.QueryChangePart.Aggregation||i.part==s.QueryChangePart.All)){var o=document.activeElement,r=t.slot.contains(o)||o==document.body;switch(i.action){case s.QueryChangeAction.Modify:var a=i.changee,l=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var i=t.getColumnRenderer(e,n);if(i){var o=i.render();if(r){var s=o.querySelector("a")||o.querySelector(".eqjs-column-button");s&&s.focus()}}}};Array.isArray(a)?a.forEach((function(t){return l(t)})):l(a),t.agjustHeaderVisibility();break;case s.QueryChangeAction.Add:a=i.changee;var u=function(n){var i=e.getColumns().indexOf(n),o=t.addColumnElement(n,i);r&&o.querySelector("a").focus()};Array.isArray(a)?a.forEach((function(t){return u(t)})):u(a),t.agjustHeaderVisibility();break;case s.QueryChangeAction.Delete:a=i.changee;var c=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var i=n.nextSibling,o=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=i||o||t.addRowElement,a=s.querySelector("a")||s.querySelector(".eqjs-column-button");a&&a.focus()}}};t.agjustHeaderVisibility(),Array.isArray(a)?a.forEach((function(t){return c(t)})):c(a);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),i=[],o=0;o<n.length;o++){var r=n[o];"none"!==r.style.display&&i.push(r)}if(0===i.length)return this.landingIndex=0,void this.columnsBlock.appendChild(this.landingSlot);var s=Object(a.k)(this.landingSlot);if(!(e>=s.y&&e<=s.y+this.landingSlot.offsetHeight)){var l=i[0],u=l.offsetHeight,c=Object(a.k)(l),d=e>c.y+u/2?Math.round((e-c.y+u/2)/u):0;d>i.length&&(d=i.length),d!=this.landingIndex&&(this.landingIndex=d,this.landingIndex<i.length?this.columnsBlock.insertBefore(this.landingSlot,i[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))}},e.prototype.hideLandingSlot=function(){var t=this;this.landingIndex=-1,setTimeout((function(){t.landingSlot.parentElement&&t.landingSlot.parentElement.removeChild(t.landingSlot)}),10)},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t),u.a.isMobileMode()&&(this.options.buttons=["menu"],this.options.showHeader=!1)},e.prototype.onProcessStartCore=function(){},e.prototype.onProcessEndCore=function(){},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.renderBaseElements(),this.createEntitiesMenu(),this.createColumnMenus(),this.agjustHeaderVisibility(),Object(a.i)(this.slot).removeClass(l.a).addClass(u.a.getMobileCssClass());for(var t=this.context.getQuery().getColumns(),e=0,n=t;e<n.length;e++){var i=n[e];this.columnsBlock.appendChild(this.renderColumn(i))}}catch(t){var o=t;this.context.throwError({action:"ColumnsPanel rendering",text:o.message,sourceError:o})}},e.prototype.agjustHeaderVisibility=function(){if(this.headerElement){var t=this.context.getQuery().getColumns();this.headerElement.style.display=t.length?"":"none"}},e.prototype.renderColumn=function(t){var e=this.getColumnRenderer(t);return e?e.render():null},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id="+t.id+"]"))&&(n=e.classList.contains("active"));for(var i=this.columnsBlock.querySelectorAll("."+this.cssPrefix+"-row"),o=0;o<i.length;o++){var r=i[o];Object(a.i)(r).removeClass("active"),this.options.alwaysShowButtons||Object(a.i)(r).data("show-buttons",null)}e&&!n&&Object(a.i)(e).addClass("active").data("show-buttons","")},e.prototype.addNewColumn=function(t,e){var n,i,o=this,r=this.getContext().getModel(),a=this.getQuery(),l=function(t){var e=r.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=r.getAttributeById(t))||!e.useInResult)return null}var n=a.createColumn();return n.caption=o.getDefaultColumnCaption(e),n.sorting=s.SortDirection.None,n.sortIndex=-1,n.expr.tag=s.ExprTag.EntityAttribute,n.expr.kind=s.DataKind.Attribute,n.expr.dataType=e.dataType,n.expr.setValue(t,!0),n.params.concat(e.params),n};if(Array.isArray(t)){n=[];for(var u=0;u<t.length;u++)(i=l(t[u]))&&n.push(i)}else n=l(t);return this.addColumn(n,e),n},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireColumnsChangedEvent(s.QueryChangeAction.Add,t)))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),i=this.renderColumn(t);return n.length>0&&e<n.length?this.columnsBlock.insertBefore(i,n[e]):(this.columnsBlock.appendChild(i),this.scrollToBottom()),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(i),i},e.prototype.scrollToBottom=function(){this.columnsBlock.scrollTop=this.columnsBlock.scrollHeight-this.columnsBlock.clientHeight},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],i=0;i<e;i++)this.checkColumn(t[i])&&n.push(t[i]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=0;n<e.length;n++)if((t.expr.tag===s.ExprTag.EntityAttribute&&e[n].expr.tag===s.ExprTag.EntityAttribute||t.expr.tag===s.ExprTag.ParentEntityAttribute&&e[n].expr.tag===s.ExprTag.ParentEntityAttribute)&&t.expr.value===e[n].expr.value)return null;return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case s.ExprTag.AggregateFunction:return new x(this,t,e);case s.ExprTag.CustomSql:return new E(this,t,e);case s.ExprTag.EntityAttribute:case s.ExprTag.ParentEntityAttribute:return new C(this,t,e)}return null},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.options.allowCustomExpressions},e.prototype.addAllColumnsToEntitiesList=function(t){var e=this,n=t.filter((function(t){return!t.isEntity})).map((function(t){return t.id}));n.length>0&&t.unshift({id:"__AddAll__",text:r.g.getText("AddAllForEntityText"),extra:{ids:n}}),t.forEach((function(t){t.items&&e.addAllColumnsToEntitiesList(t.items)}))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n=t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities});this.options.showAddAllForEntity&&this.addAllColumnsToEntitiesList(n);var i={id:e,items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(i,this.options.menuOptions),this.entitiesMenu=new p(i)},e.prototype.getSortMenuList=function(){return[{id:"None",text:r.g.getText("CmdNotSorted")},{id:"Ascending",text:r.g.getText("CmdAscending")},{id:"Descending",text:r.g.getText("CmdDescending")},{id:"---",text:"---"}]},e.prototype.getMoveMenuList=function(){return[{id:"MoveTop",text:r.g.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.g.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.g.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.g.getText("CmdMoveToLast")}]},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={id:e,items:this.getSortMenuList().concat(this.moveMenu.getItems()),domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.i.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new p(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n=r.i.createArrayFrom(this.getMoveMenuList());this.options.allowHiddenColumns&&(n.push({id:"---",text:"---"}),n.push({id:"IsHidden",text:r.g.getText("CmdHiddenColumn")}));var i={items:n,id:e,domWriteItemsId:this.options.domWriteItemsId,showSelected:!0};r.i.assign(i,this.options.menuOptions),this.moveMenu=new p(i),i.searchBoxAlwaysShown=!1},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),i=n.indexOf(t);if(i>=0)switch(e){case"MoveTop":if(0==i)return;this.moveColumnCore(i,0);break;case"MoveUp":if(0==i)return;this.moveColumnCore(i,i-1);break;case"MoveDown":if(i==n.length-1)return;this.moveColumnCore(i,i+1);break;case"MoveBottom":if(i==n.length-1)return;this.moveColumnCore(i,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var i=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),o=i[t];0==e?this.columnsBlock.insertBefore(o,this.columnsBlock[0]):e>0&&e<i.length-1?t<e?this.columnsBlock.insertBefore(o,i[e+1]):this.columnsBlock.insertBefore(o,i[e]):this.columnsBlock.appendChild(o),n.moveColumn(t,e),n.fireColumnsChangedEvent()}},e.prototype.createColumnMenus=function(){this.createMoveMenu(),this.options.allowSorting&&this.createSortMenu()},e}(s.Widget),k=function(){function t(t,e,n){this.functionMenu=null,this.formatsMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.tapedTwice=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!0,configurable:!0}),t.prototype.render=function(){var t=this;this.baseAttr=this.getAttribute();var e=Object(a.i)("div");return e.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(e.toDOM(),this.element),this.element=e.toDOM(),this.bar.options.allowDragDrop&&a.j.registerDraggableItem({element:this.element,scope:"entityAttrSort",beforeDragStart:function(){return t.element.dispatchEvent(Object(a.h)("mouseleave"))},onDragStart:function(e){t.hideButtons(),t.element.style.display="none",e.dropEffect=a.d.Allow},onDragEnd:function(e){e.data.finishedSuccessfully||t.element.removeAttribute("style")},data:{column:this.column}}),this.column.isReadOnly()||(this.createFunctionMenu(),this.createFormatsMenu()),e.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderCaptionBlock()).addChildElement(this.renderSortingImage()),u.a.isMobileMode()||e.addChildElement(this.renderButtonsBlock()),e.on("mouseenter",this.onMouseEnter.bind(this)).on("mouseleave",this.onMouseLeave.bind(this)),(this.bar.options.accentActiveColumn||u.a.isMobileMode())&&e.on("touchstart click",this.onMouseClick.bind(this)),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderButtonsBlock=function(){return Object(a.i)("div",this.element).addClass(l.b+"-column-buttonsBlock",this.cssPrefix+"-buttonsBlock").addChildElement(this.renderSortingButton()).addChildElement(this.renderColumnTypeButton()).addChildElement(this.renderColumnFormatButton()).addChildElement(this.renderDeleteButton()).toDOM()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.getModel(),n=this.baseAttr!==e.nullAttribute?this.column.caption:e.getAttributeText(e.nullAttribute,"{attr}");if(!this.isEditable())return Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.title(t.column.caption).text(n).attr("tabIndex","0")})).toDOM();var i=!1;return Object(a.i)(this.element).on("touchstart dblclick",(function(e){if(e instanceof TouchEvent&&!t.tapedTwice)return t.tapedTwice||(t.tapedTwice=!0,setTimeout((function(){t.tapedTwice=!1}),300)),!0;e.stopPropagation(),i=t.element.querySelector("a")==document.activeElement;var n=t.element.querySelector("."+t.cssPrefix+"-captionelement input"),o=t.element.querySelector("."+t.cssPrefix+"-captionelement a");return n&&(n.style.width=t.element.clientWidth+"px",o.style.display="none",n.style.removeProperty("display"),n.focus(),t.element.setAttribute(a.j.DRAG_DISABLED_ATTR,"")),!1})),Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass()).addChild("a",(function(e){return e.attr("href","javascript:void(0)").title(t.column.caption).text(n).on("keydown",(function(e){var n=e;if((n.ctrlKey||n.metaKey)&&(13==n.keyCode||10==n.keyCode)&&t.isColumnActive()){var i=document.createEvent("MouseEvents");return i.initEvent("dblclick",!0,!0),t.element.dispatchEvent(i),n.stopPropagation(),!1}return!0}))})).addChild("input",(function(e){return e.hide().value(t.column.caption).on("blur keydown",(function(e){var n=!1,o=!0;if(e instanceof KeyboardEvent?13===e.keyCode?n=!0:27===e.keyCode&&(n=!0,o=!1):e instanceof FocusEvent&&(n=!0),n){var r=e.target,s=r.parentElement.querySelector("a");s&&(s.style.removeProperty("display"),r.style.display="none"),o&&t.column.caption!==r.value?(t.column.caption=r.value,t.fireColumnChanged()):r.value=t.column.caption,t.element.removeAttribute(a.j.DRAG_DISABLED_ATTR),i&&t.element.querySelector("a").focus()}}))})).toDOM()},t.prototype.renderSortingImage=function(){var t=this,e=l.b+"-column-sortbutton",n=e;switch(this.column.sorting){case s.SortDirection.Ascending:n=e+"-asc";break;case s.SortDirection.Descending:n=e+"-desc"}return this.column.sorting==s.SortDirection.None?null:Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-sortimage-placeholder").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-img-sorting",n).title(r.g.getText("ButtonSorting"))})).toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,(this.getUIS()&&this.bar.sortMenu||this.bar.moveMenu).showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var i;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var o=n.bar.getQuery();n.column.sorting="None"==(i=t.id)?s.SortDirection.None:"Ascending"==i?s.SortDirection.Ascending:"Descending"==i?s.SortDirection.Descending:void 0,n.column.sortIndex=o.getColumnSortIndex(n.column),n.fireColumnChanged()}else n.bar.moveColumn(n.column,t.id)},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}}),!1},t.prototype.renderSortingButton=function(){var t=this;if(!this.isEditable())return null;var e=Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-sortbutton",l.b+"-column-sortbutton-none").title(r.g.getText("ButtonSorting")).attr("tabIndex","0").on("touchstart click",(function(n){return t.buttonSortingClickHandler(n,e.toDOM())})).on("keypress",(function(t){13==t.keyCode&&t.target.click()}));return e.toDOM()},t.prototype.buttonDeleteClickHandler=function(t){t.stopPropagation();var e=this.bar.getQuery();return e.removeColumn(this.column,this.bar),e.fireColumnsChangedEvent(s.QueryChangeAction.Delete,this.column),!1},t.prototype.renderDeleteButton=function(){var t=this;return this.column.isReadOnly()?null:Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-button-delete").title(r.g.getText("CmdDelete")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonDeleteClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM()},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){var t="";return t+=this.column.enabled?"":" "+this.cssPrefix+"-disabled",this.column.enabled&&(t+=this.column.isReadOnly()?" "+this.cssPrefix+"-readonly":""),t},t.prototype.buttonTypeClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeColumnTypeHandler(t),!1},t.prototype.buttonFormatClickHandler=function(t){return t.stopPropagation(),this.keepShowingButtons=!0,this.changeFormatHandler(t),!1},t.prototype.formatButtonIsShown=function(){return!1!==this.bar.options.allowDisplayFormatChange&&this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()).length>0},t.prototype.changeFormatHandler=function(t){var e=this,n=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType()),i="{0:__default}";n.filter((function(t){return t.format==e.column.displayFormat})).length>0&&(i=this.column.displayFormat),this.formatsMenu.showMenu({anchor:t.target,selectedIds:i,itemSelectedCallback:function(t,n){return t.id!=i&&("{0:__default}"==t.id?e.column.displayFormat="":e.column.displayFormat=t.id,e.column.fireChangedEvent()),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},t.prototype.renderColumnTypeButton=function(){var t=this;return this.isEditable()&&!1!==this.bar.options.allowAggrColumns?Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-button-type").title(r.g.getText("ButtonToAggr")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonTypeClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.renderColumnFormatButton=function(){var t=this;return this.isEditable()&&this.formatButtonIsShown()?Object(a.i)("div").addClass(l.b+"-column-button",l.b+"-column-button-format").title(r.g.getText("ButtonFormat")).attr("tabIndex","0").on("touchstart click",(function(e){return t.buttonFormatClickHandler(e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).toDOM():null},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t.prototype.onMouseClick=function(t){this.bar.toggleColumnPicked(this.column),this.adjustButtonsVisibility()},t.prototype.onMouseEnter=function(t){if(!u.a.isMobileMode())return this.isMouseOverBlock=!0,this.enterButtonBlock(),t.stopPropagation(),!1},t.prototype.onMouseLeave=function(t){if(!u.a.isMobileMode())return this.isMouseOverBlock=!1,this.leaveButtonBlock(),t.stopPropagation(),!1},t.prototype.isColumnActive=function(){return this.element.classList.contains("active")},t.prototype.hideButtons=function(){u.a.isMobileMode()?this.onHideButtonsMobile&&this.onHideButtonsMobile():Object(a.i)(this.element).data("show-buttons",null)},t.prototype.showButtons=function(){u.a.isMobileMode()?this.onShowButtonsMobile&&this.onShowButtonsMobile():Object(a.i)(this.element).data("show-buttons","")},t.prototype.adjustButtonsVisibility=function(){this.bar.options.alwaysShowButtons||(this.bar.options.accentActiveColumn||u.a.isMobileMode())&&this.isColumnActive()?this.showButtons():this.hideButtons()},t.prototype.enterButtonBlock=function(){this.showButtons()},t.prototype.leaveButtonBlock=function(){1==this.bar.options.alwaysShowButtons||this.isColumnActive()&&1==this.bar.options.accentActiveColumn||this.hideButtons()},t.prototype.createFunctionMenu=function(){for(var t,e=[],n=this.bar.getContext().getModel().getAggrFunctions(),i=!0,o=null,s=this.column.getDataType(),a=0,l=n;a<l.length;a++){var u=l[a];if(u){var c=u.getAppliedTypesOrDefault().indexOf(s)>=0;this.column.expr.func!==u.id||c||(i=!1),c&&(t=this.bar.getContext().getModel().getAggrFunctionCaption(u.id),o={id:u.id,text:t},e.push(o))}}i||(this.column.expr.func=e[0].id),this.bar.areCustomExpressionsAllowed()&&(o={id:"CustomSqlDivider",text:"---"},e.push(o),o={id:"CUSTOMSQL",text:t=r.g.getText("CustomExpression")},e.push(o));var d=this.element.id;d&&(d+="-FunctionsMenu");var h={items:e,id:d,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new p(h)},t.prototype.createFormatsMenu=function(){if(0!=this.bar.options.allowDisplayFormatChange){var t=this.column.id;t&&(t+="-FormatsMenu");var e={items:this.getFormatsMenuItems(),id:t,searchBoxAlwaysShown:!1,showSelected:!0,domWriteItemsId:!0};this.formatsMenu=new p(e)}},t.prototype.getFormatsMenuItems=function(){var t=this.bar.getContext().getModel().getDisplayFormatsForType(this.column.getDataType());return[{id:"{0:__default}",text:"Default"}].concat(t.map((function(t){return{id:t.format,text:r.g.getText("DisplayFormats",t.name)||t.name}})))},t}(),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)}}(),S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return M(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.setValue(n,!0),this.column.caption="",this.refresh(),this.fireColumnChanged()},e.prototype.getUIS=function(){var t=this.column.expr.args[0];return!t||this.bar.getContext().getModel().checkAttrProperty(t.value,"useInSorting")},e.prototype.changeTypeToCustomSql=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.CustomSql),this.fireColumnChanged()},e.prototype.changeTypeToAggr=function(t){this.column.getQuery().changeColumnType(this.column,s.ExprTag.AggregateFunction,{funcId:t}),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){var e=this;this.functionMenu.showMenu({anchor:t.target,selectedIds:null,itemSelectedCallback:function(t,n){return"CUSTOMSQL"==t.id?e.changeTypeToCustomSql():e.changeTypeToAggr(t.id),!1},menuClosedCallback:function(){e.keepShowingButtons=!1,e.isMouseOverBlock||e.element.dispatchEvent(Object(a.h)("mouseleave"))}})},e}(k),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)}}(),I=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.getClassesToAdd=function(){return t.prototype.getClassesToAdd.call(this)+" "+this.cssPrefix+"-row "+this.cssPrefix+"-row-column-aggr"},e.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeByIdSafe(this.column.expr.args[0].value)},e.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)+" "+this.bar.getContext().getModel().getAggrFunctionCaption(this.column.expr.func)},e.prototype.renderColumnTypeButton=function(){var e=t.prototype.renderColumnTypeButton.call(this);return e&&(e.classList.add("aggregated"),e.title=r.g.getText("ButtonToSimple")),e},e.prototype.baseExpressionItemSelectedCallback=function(t,e){var n=t.id;this.column.expr.args[0].setValue(n,!0),this.column.caption="",this.fireColumnChanged()},e.prototype.changeTypeToSimple=function(){this.column.getQuery().changeColumnType(this.column,s.ExprTag.EntityAttribute),this.fireColumnChanged()},e.prototype.changeColumnTypeHandler=function(t){this.changeTypeToSimple()},e}(S),O=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)}}(),P=function(t){function e(e,n){var i=t.call(this,e)||this;return i.options={isSubQuery:!1,activeColumn:null,showAddRow:!0,showHeader:!0,showColumnTitles:!0,allowAggrColumns:!0,allowDuplicates:!0,allowCustomExpressions:!1,allowSorting:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,alwaysShowButtons:!1,accentActiveColumn:!0,allowDragDrop:!0,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null},attrPlacement:0,sortEntities:!1,columnRenderedCallback:null,customExpressionText:0},i.landingSlot=Object(a.i)("div").addClass(l.b+"-highlight").toDOM(),i.landingIndex=-1,i.sortMenuList=[{id:"None",text:r.g.getText("CmdNotSorted")},{id:"Ascending",text:r.g.getText("CmdAscending")},{id:"Descending",text:r.g.getText("CmdDescending")},{id:"---",text:"---"}],i.moveMenuList=[{id:"MoveTop",text:r.g.getText("CmdMoveToFirst")},{id:"MoveUp",text:r.g.getText("CmdMoveToPrev")},{id:"MoveDown",text:r.g.getText("CmdMoveToNext")},{id:"MoveBottom",text:r.g.getText("CmdMoveToLast")}],Object(a.i)(i.slot).addClass(i.cssPrefix+"-panel").addClass(u.a.getMobileCssClass()),i.group=s.WidgetGroup.Query,i.customQuery=n,i}return O(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-cb"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"columnsBar"},e.prototype.init=function(e,n){var i=this;t.prototype.init.call(this,e,n),this.setOptions(n),this.detachQueryObserver(),this.attachQueryObserver(),a.j.removeDropContainer(this.slot),this.options.allowDragDrop&&a.j.registerDropContainer({element:this.slot,scopes:["entityAttrSort"],onDragEnter:function(t,e){i.showLandingSlot(e.pageX,e.pageY)},onDragOver:function(t,e){i.showLandingSlot(e.pageX,e.pageY)},onDragLeave:function(t,e){e.dropEffect=a.d.Forbid,i.hideLandingSlot()},onDrop:function(t,e){var n=i.getQuery().getColumns().indexOf(e.data.column);i.moveColumnCore(n,i.landingIndex)}})},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(n){var i=n.data;if(i&&(i.part==s.QueryChangePart.Columns||i.part==s.QueryChangePart.Aggregation||i.part==s.QueryChangePart.All)){var o=document.activeElement,r=t.slot.contains(o)||o==document.body;switch(i.action){case s.QueryChangeAction.Modify:var a=i.changee,l=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var i=t.renderColumn(e,n);if(r){var o=i.querySelector("a");o&&o.focus()}}};Array.isArray(a)?a.forEach((function(t){return l(t)})):l(a);break;case s.QueryChangeAction.Add:a=i.changee;var u=function(n){var i=e.getColumns().indexOf(n);t.addColumnElement(n,i)};Array.isArray(a)?a.forEach((function(t){return u(t)})):u(a);break;case s.QueryChangeAction.Delete:a=i.changee;var c=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");if(n){var i=n.nextSibling,o=n.previousSibling;if(t.columnsBlock.removeChild(n),r){var s=(i||o||t.addRowButton).querySelector("a");s&&s.focus()}}};Array.isArray(a)?a.forEach((function(t){return c(t)})):c(a);break;default:t.refresh()}}}))},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.getContext().getQuery()},e.prototype.destroyCore=function(){a.j.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.setOptions=function(t){this.options=r.i.assignDeep(this.options,t)},e.prototype.showLandingSlot=function(t,e){for(var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),i=[],o=0;o<n.length;o++)"none"!==n[o].style.display&&i.push(n[o]);if(0!==i.length){var r=Object(a.k)(this.landingSlot);if(!(t>=r.x&&t<=r.x+this.landingSlot.offsetWidth&&e>=r.y&&e<=r.y+this.landingSlot.offsetHeight)){var s=this.landingIndex;for(o=0;o<i.length;o++){var l=i[o],u=Object(a.k)(l),c=l.offsetWidth,d=l.offsetHeight,h=.2*c;if(t>=u.x+h&&t<=u.x+c-h&&e>=u.y+2&&e<=u.y+d-2){s=t>r.x?o+1:o;break}}(s!=this.landingIndex||this.landingSlot.parentElement)&&(this.landingIndex=s,this.landingIndex<=0&&this.columnsBlock.insertBefore(this.landingSlot,i[0]),this.landingIndex<i.length?this.columnsBlock.insertBefore(this.landingSlot,i[this.landingIndex]):this.columnsBlock.appendChild(this.landingSlot))}}else this.landingIndex=0},e.prototype.hideLandingSlot=function(){this.landingIndex=-1,this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e.prototype.onProcessStartCore=function(){},e.prototype.onProcessEndCore=function(){},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.renderAddRowButton=function(){var t=this;Object(a.i)(this.addRowButton).addClass(l.b+"-addrow",this.cssPrefix+"-addrow",l.b+"-addrow-empty").addClass(u.a.getMobileCssClass()).title(r.g.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var i=e.id;return t.addNewColumn(i),!1}})}))})),u.a.isMobileMode()&&Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.options.allowSorting&&this.createSortMenu(),this.createMoveMenu(),this.columnsBlock=Object(a.i)("div").addClass(this.cssPrefix+"-columns").addClass(u.a.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=Object(a.i)("div").toDOM(),u.a.isMobileMode()?Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton):Object(a.i)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),Object(a.i)(this.slot).addChildElement(this.columnsBlock).addChildElement(this.renderColumnButtonsBlockMobile()),this.getQuery().getColumns().forEach((function(e,n){var i=t.renderColumn(e);t.columnsBlock.appendChild(i)}))},e.prototype.renderColumnButtonsBlockMobile=function(){var t=this;return this.columnButtonsBlockMobileArrow=Object(a.i)("i").toDOM(),this.columnButtonsBlockMobile=Object(a.i)("div").addClass(this.cssPrefix+"-column-buttonsBlock").addClass(u.a.getMobileCssClass()).addChildElement(this.columnButtonsBlockMobileArrow).hide().toDOM(),this.buttonsBlockSortingButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-sortbutton-none").toDOM(),Object(a.i)(this.buttonsBlockSortingButton).on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonSortingClickHandler.call(t.currentColumnRenderer,e,t.buttonsBlockSortingButton),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})),this.buttonsBlockTypeButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-button-type").on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonTypeClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockFormatButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-button-format").on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonFormatClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),this.buttonsBlockDeleteButton=Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button",this.cssPrefix+"-column-button-delete").on("touchstart click",(function(e){return e.stopPropagation(),t.currentColumnRenderer.buttonDeleteClickHandler.call(t.currentColumnRenderer,e),t.toggleColumnPicked(null),t.hideColumnButtonsMobile(),!1})).toDOM(),Object(a.i)("div",this.columnButtonsBlockMobile).addClass(this.cssPrefix+"-column-button-close-block").on("touchstart click",(function(){t.toggleColumnPicked(null),t.hideColumnButtonsMobile()})),this.columnButtonsBlockMobile},e.prototype.showColumnButtonsMobile=function(t,e,n){this.currentActiveColumn=t,this.currentColumnRenderer=e;var i=n.getBoundingClientRect(),o=n.offsetTop,r=n.offsetLeft;Object(a.i)(this.columnButtonsBlockMobileArrow).setStyle("left",(r+i.width/2).toString()+"px"),i.top>100?Object(a.i)(this.columnButtonsBlockMobile).removeClass("show-below").setStyle("top",(o-i.height).toString()+"px"):Object(a.i)(this.columnButtonsBlockMobile).addClass("show-below").setStyle("top",(o+i.height).toString()+"px"),t.enabled&&!t.isReadOnly()?(Object(a.i)(this.buttonsBlockSortingButton).show(),Object(a.i)(this.buttonsBlockTypeButton).show(),e.formatButtonIsShown()?Object(a.i)(this.buttonsBlockFormatButton).show():Object(a.i)(this.buttonsBlockFormatButton).hide()):(Object(a.i)(this.buttonsBlockSortingButton).hide(),Object(a.i)(this.buttonsBlockTypeButton).hide()),t.isReadOnly()?Object(a.i)(this.columnButtonsBlockMobile).hide():Object(a.i)(this.columnButtonsBlockMobile).show()},e.prototype.hideColumnButtonsMobile=function(){Object(a.i)(this.columnButtonsBlockMobile).hide()},e.prototype.renderColumn=function(t,e){var n=this,i=this.getColumnRenderer(t,e);if(i){var o=i.render();return i.onShowButtonsMobile=function(){n.showColumnButtonsMobile(t,i,o)},i.onHideButtonsMobile=function(){n.hideColumnButtonsMobile()},o}return null},e.prototype.getColumnRenderer=function(t,e){switch(t.expr.tag){case s.ExprTag.AggregateFunction:return new I(this,t,e);case s.ExprTag.CustomSql:case s.ExprTag.EntityAttribute:case s.ExprTag.ParentEntityAttribute:return new S(this,t,e)}return null},e.prototype.addNewColumn=function(t,e){var n=this,i=this.getContext().getModel(),o=this.getQuery(),r=function(t){var e=i.getAttributeById(t);if(!e)return null;if(!e.useInResult){if(!e.lookupAttr)return null;if(t=e.lookupAttr,!(e=i.getAttributeById(t))||!e.useInResult)return null}var r=o.createColumn();return r.caption=n.getDefaultColumnCaption(e),r.sorting=s.SortDirection.None,r.sortIndex=-1,r.expr.tag=s.ExprTag.EntityAttribute,r.expr.kind=s.DataKind.Attribute,r.expr.dataType=e.dataType,r.expr.setValue(t,!0),r.params.concat(e.params),r};if(this.getQuery()){var a,l;if(Array.isArray(t)){a=[];for(var u=0;u<t.length;u++)(l=r(t[u]))&&a.push(l)}else a=r(t);return this.addColumn(a,e),a}},e.prototype.toggleColumnPicked=function(t){var e,n;t&&(e=this.columnsBlock.querySelector("div[data-id="+t.id+"]"))&&(n=e.classList.contains("active"));for(var i=this.columnsBlock.querySelectorAll("."+this.cssPrefix+"-row"),o=0;o<i.length;o++){var r=i[o];Object(a.i)(r).removeClass("active").data("show-buttons",null)}e&&!n&&Object(a.i)(e).addClass("active").data("show-buttons","")},e.prototype.addColumn=function(t,e){var n=this.getQuery();n&&(!(t=Array.isArray(t)?this.checkColumnsArray(t):this.checkColumn(t))||Array.isArray(t)&&0==t.length||(n.addColumnObj(t,e,self),n.fireChangedEvent({part:s.QueryChangePart.Columns,action:s.QueryChangeAction.Add,changee:t})))},e.prototype.addColumnElement=function(t,e){var n=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),i=this.renderColumn(t);n.length>0&&e<n.length-1?this.columnsBlock.insertBefore(i,n[e]):this.columnsBlock.appendChild(i),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(i)},e.prototype.checkColumnsArray=function(t){for(var e=t.length,n=[],i=0;i<e;i++)this.checkColumn(t[i])&&n.push(t[i]);return n},e.prototype.checkColumn=function(t){if(!this.options.allowDuplicates)for(var e=this.getQuery().getColumns(),n=JSON.stringify(t.expr),i=0;i<e.length;i++){if(JSON.stringify(e[i].expr)===n)return null}return t},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.getColumnsBlock=function(){return this.columnsBlock},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu&&this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(n,this.options.menuOptions),this.entitiesMenu=new p(n)},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList.concat(this.moveMenuList),id:e,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(n,this.options.menuOptions),n.searchBoxAlwaysShown=!1,this.sortMenu=new p(n)},e.prototype.createMoveMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-MoveMenu");var n={items:this.moveMenuList,id:e,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(n,this.options.menuOptions),this.moveMenu=new p(n),n.searchBoxAlwaysShown=!1},e.prototype.moveColumn=function(t,e){var n=this.getQuery().getColumns(),i=n.indexOf(t);if(i>=0)switch(e){case"MoveTop":if(0==i)return;this.moveColumnCore(i,0);break;case"MoveUp":if(0==i)return;this.moveColumnCore(i,i-1);break;case"MoveDown":if(i==n.length-1)return;this.moveColumnCore(i,i+1);break;case"MoveBottom":if(i==n.length-1)return;this.moveColumnCore(i,n.length-1)}},e.prototype.moveColumnCore=function(t,e){var n=this.getQuery();if(n){var i=this.columnsBlock.querySelectorAll("[class*="+this.cssPrefix+"-row]"),o=i[t];e<=0?this.columnsBlock.insertBefore(o,this.columnsBlock[0]):e<i.length?this.columnsBlock.insertBefore(o,i[e]):this.columnsBlock.appendChild(o),n.moveColumn(t,e),n.fireColumnsChangedEvent(s.QueryChangeAction.All)}},e.prototype.areCustomExpressionsAllowed=function(){return this.getQuery().isEx()&&this.options.allowCustomExpressions},e.globalCounter=0,e}(s.Widget),A=function(){function t(t,e,n){this.functionMenu=null,this.isMouseOverBlock=!1,this.keepShowingButtons=!1,this.bar=t,this.column=e,this.element=n}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!0,configurable:!0}),t.prototype.render=function(){this.baseAttr=this.getAttribute();var t=Object(a.i)("div");return t.data("id",this.column.id),this.element&&this.element.parentNode.replaceChild(t.toDOM(),this.element),this.element=t.toDOM(),t.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderCaptionBlock()),this.isEditable()&&t.addChildElement(this.renderSortingButton()),this.element},t.prototype.fireColumnChanged=function(){this.column.fireChangedEvent()},t.prototype.refresh=function(){this.render()},t.prototype.getAttribute=function(){return this.bar.getContext().getModel().getAttributeById(this.column.expr.value)},t.prototype.isEditable=function(){return this.column.enabled&&!this.column.isReadOnly()},t.prototype.renderCaptionBlock=function(){var t=this;this.column.caption&&""!=this.column.caption||(this.column.caption=this.getDefaultCaption());var e=this.column.caption;return this.isEditable()||(e+=function(t){switch(t){case s.SortDirection.Ascending:return" ↑";case s.SortDirection.Descending:return" ↓";default:return""}}(this.column.sorting)),Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-captionelement").addClass(u.a.getMobileCssClass()).addChild("div",(function(n){return n.title(t.column.caption).text(e)})).toDOM()},t.prototype.renderSortingButton=function(){var t=this,e=l.b+"-column-sortbutton",n=e;switch(this.column.sorting){case s.SortDirection.None:n=e+"-none";break;case s.SortDirection.Ascending:n=e+"-asc";break;case s.SortDirection.Descending:n=e+"-desc"}var i=Object(a.i)("div").addClass(this.cssPrefix+"-colelement",this.cssPrefix+"-sortimage-placeholder").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-img-sorting",n).title(r.g.getText("ButtonSorting"))})).on("touchstart click",(function(e){return t.buttonSortingClickHandler(e,i.toDOM())}));return i.toDOM()},t.prototype.buttonSortingClickHandler=function(t,e){var n=this;return t.stopPropagation(),this.keepShowingButtons=!0,this.bar.sortMenu.showMenu({anchor:e,selectedIds:null,itemSelectedCallback:function(t,e){var i;if("None"==t.id||"Ascending"==t.id||"Descending"==t.id){var o=n.bar.getContext().getQuery();n.column.isJustSorted()&&"None"==t.id?(o.removeColumn(n.column,n.bar),o.fireColumnsChangedEvent(s.QueryChangeAction.Delete,n.column,!0)):(n.column.sorting="None"==(i=t.id)?s.SortDirection.None:"Ascending"==i?s.SortDirection.Ascending:"Descending"==i?s.SortDirection.Descending:void 0,n.column.sortIndex=o.getColumnSortIndex(n.column),n.fireColumnChanged())}},menuClosedCallback:function(){n.keepShowingButtons=!1}}),!1},t.prototype.getDefaultCaption=function(){return this.getDefaultTitleText(this.baseAttr)},t.prototype.getDefaultTitleText=function(t){var e=this.bar.options.titleElementFormat||this.bar.options.attrElementFormat;return this.bar.getContext().getModel().getAttributeText(t,e)},t.prototype.getClassesToAdd=function(){return this.cssPrefix+"-row "+this.cssPrefix+"-row-column-entattr"},t.prototype.getUIS=function(){return this.bar.getContext().getModel().checkAttrProperty(this.column.expr.value,"useInSorting")},t}(),L=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)}}(),R=function(t){function e(e){var n=t.call(this,e)||this;return n.options={showAddRow:!0,attrElementFormat:"{entity} {attr}",titleElementFormat:null,menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,adjustHeight:!0,itemRenderedCallback:null}},n.sortMenuList=[{id:"None",text:r.g.getText("CmdNotSorted")},{id:"Ascending",text:r.g.getText("CmdAscending")},{id:"Descending",text:r.g.getText("CmdDescending")}],Object(a.i)(n.slot).addClass(n.cssPrefix+"-panel").addClass(u.a.getMobileCssClass()),n.group=s.WidgetGroup.Query,n}return L(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-sb"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"sortingBar"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver()},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t)},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;if(n&&(n.part==s.QueryChangePart.SortingColumns||n.part==s.QueryChangePart.Columns||n.part==s.QueryChangePart.All))switch(n.action){case s.QueryChangeAction.Modify:var i=n.changee,o=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");n&&t.renderColumn(e,n)};Array.isArray(i)?i.forEach((function(t){return o(t)})):o(i);break;case s.QueryChangeAction.Add:i=n.changee;var r=function(e){t.addColumnElement(e)};Array.isArray(i)?i.forEach((function(t){return r(t)})):r(i);break;case s.QueryChangeAction.Delete:i=n.changee;var a=function(e){var n=t.columnsBlock.querySelector("div[data-id='"+e.id+"']");n&&t.columnsBlock.removeChild(n)};Array.isArray(i)?i.forEach((function(t){return a(t)})):a(i);break;default:t.refresh()}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getContext().getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.getContext().getQuery()},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.clear()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.renderAddRowButton=function(){var t=this;Object(a.i)(this.addRowButton).addClass(l.b+"-addrow",this.cssPrefix+"-addrow",l.b+"-addrow-empty").addClass(u.a.getMobileCssClass()).title(r.g.getText("CmdClickToAddColumn")).addChild("a",(function(e){return e.attr("href","javascript:void(0)").on("click",(function(e){e.preventDefault(),t.showEntitiesMenu({anchor:e.target,selectedIds:null,itemSelectedCallback:function(e,n){var i=e.id;return t.addNewColumn(i),!1}})}))})),u.a.isMobileMode()&&Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!1,addUIS:!0}),adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId};this.entitiesMenu=new p(n)},e.prototype.createSortMenu=function(){var t=this.getContext().getModel();if(!t||t.isEmpty())return null;var e=this.slot.id;e&&(e+="-SortMenu");var n={items:this.sortMenuList,id:e,searchBoxAlwaysShown:!1};this.sortMenu=new p(n)},e.prototype.render=function(){var t=this;this.createEntitiesMenu(),this.createSortMenu(),this.columnsBlock=Object(a.i)("div").addClass(this.cssPrefix+"-columns").addClass(u.a.getMobileCssClass()).toDOM(),this.options.showAddRow&&(this.addRowButton=Object(a.i)("div").toDOM(),u.a.isMobileMode()?Object(a.i)(this.columnsBlock).addChildElement(this.addRowButton):Object(a.i)(this.slot).addChildElement(this.addRowButton),this.renderAddRowButton()),Object(a.i)(this.slot).addChildElement(this.columnsBlock);var e=this.context.getQuery();e.getColumns().concat(e.getJustSortedColumns()).forEach((function(e,n){var i=t.renderColumn(e);t.columnsBlock.appendChild(i)}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getContext().getModel(),i=this.getContext().getQuery();if(this.getContext().getQuery())return this.addColumn(function(t){var o=n.getAttributeById(t);if(!o)return null;if(!o.useInSorting){if(!o.lookupAttr)return null;if(t=o.lookupAttr,!(o=n.getAttributeById(t))||!o.useInSorting)return null}var r=i.createColumn(!0);return r.caption=e.getDefaultColumnCaption(o),r.sorting=s.SortDirection.Ascending,r.sortIndex=e.getQuery().getColumnSortIndex(r),r.expr.tag=s.ExprTag.EntityAttribute,r.expr.setValue(t,!0),r.params.concat(o.params),r}(t))},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.addColumn=function(t){var e=this.getContext().getQuery();if(e&&(t=this.checkColumn(t)))return t=e.addColumn({caption:t.caption,attributeId:t.expr.value,sorting:t.sorting,sortIndex:t.sortIndex,justsorted:!0}),e.fireChangedEvent({part:s.QueryChangePart.SortingColumns,action:s.QueryChangeAction.Add,changee:t}),t},e.prototype.checkColumn=function(t){for(var e=this.getContext().getQuery(),n=e.getColumns().concat(e.getJustSortedColumns()),i=JSON.stringify(t.expr.saveToData()),o=0;o<n.length;o++){if(JSON.stringify(n[o].expr.saveToData())===i)return null}return t},e.prototype.renderColumn=function(t,e){var n=new A(this,t,e);return n?n.render():null},e.prototype.addColumnElement=function(t){var e=this.renderColumn(t);this.columnsBlock.appendChild(e),this.options.columnRenderedCallback&&this.options.columnRenderedCallback(e)},e.prototype.clear=function(){this.slot.innerHTML=""},e}(s.Widget);!function(t){t[t.None=0]="None",t[t.Value=1]="Value",t[t.Attribute=2]="Attribute",t[t.Operator=4]="Operator",t[t.Addition=8]="Addition",t[t.Removal=16]="Removal",t[t.All=255]="All",t[t.NoAddition=-9]="NoAddition",t[t.NoRemoval=-17]="NoRemoval",t[t.FixedConditionList=5]="FixedConditionList"}(m||(m={}));var _,F=function(){function t(t,e,n){this.panel=t,this.text=e,this.element=n||Object(a.i)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.render=function(){var t=this;return Object(a.i)(this.element).html("").addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChild("span",(function(e){return e.text(t.text).title(t.text)})).toDOM(),this.element},t.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement"},t}(),j=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){t[t.AddCondition=0]="AddCondition",t[t.AddGroup=1]="AddGroup",t[t.Enable=2]="Enable",t[t.Delete=4]="Delete",t[t.Menu=5]="Menu",t[t.Parameterized=6]="Parameterized",t[t.InJoin=7]="InJoin"}(_||(_={}));var Q=function(){function t(t,e,n){this.panel=t,this.condition=e,this.element=n||Object(a.i)("div").toDOM()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),t.prototype.refresh=function(){this.render()},t.prototype.clear=function(){this.element&&(this.element.className="",this.element.removeAttribute("data-id"),this.element.removeAttribute("style"),Object(a.i)(this.element).html(""))},t.prototype.render=function(t){return this.clear(),this.coreRender(t),this.panel.options.onConditionRendered&&this.panel.options.onConditionRendered(this.condition,this.element),this.element},t.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()},t}(),N=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return j(e,t),e.prototype.getClassesToAdd=function(){var t=this.cssPrefix+"-row "+this.cssPrefix+"-row-condition";if(t+=this.condition.isInJoin()?" "+this.cssPrefix+"-condition-injoin":"",t+=this.condition.isParameterized()?" "+this.cssPrefix+"-condition-parameterized":"",!u.a.isMobileMode()){var e=this.condition.getLevel();e>0&&(t+=" "+this.cssPrefix+"-level-"+e)}return t+=this.condition.enabled?"":" "+this.cssPrefix+"-disabled",this.condition.enabled&&(t+=this.condition.isReadOnly()?" "+this.cssPrefix+"-readonly":""),t},e.prototype.coreRender=function(t){var e=this,n=this.panel.getContext().getModel(),i=n.getOperatorById(this.condition.getOperatorId()),o=s.equtils.parseOperatorFormat(i),r=null,l=o.length,c=Object(a.i)("div");this.element&&this.element.parentNode&&this.element.parentNode.replaceChild(c.toDOM(),this.element),this.element=c.toDOM(),c.addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).data("id",this.condition.id).data("condrow","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction());for(var d=t,h=i==n.nullOperator?Math.min(l,this.condition.expressions.length+1):l,p=function(t){if("operator"===(r=o[t]).type){var e=f.panel.getOperatorRenderer(f.condition,r.text);e&&c.addChildElement(e.render())}else if("expression"===r.type){var n=d&&r.index>0,i=f.panel.getExpressionRenderer(f.condition.expressions[r.index]);if(i){var s=i.render(n);c.addChildElement(s),setTimeout((function(){i.adjustWidth()}),100)}d=d&&!n}else"text"===r.type&&c.addChildElement(new F(f.panel,r.text).render())},f=this,g=0;g<h;g++)p(g);(this.panel.options.accentActiveCondition||u.a.isMobileMode())&&c.on("click",(function(t){return t.stopPropagation(),e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),u.a.isMobileMode()||e.element.dispatchEvent(Object(a.h)("mouseenter")),!1})),c.addChildElement(this.renderButtonsBlock()),u.a.isMobileMode()||c.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&Object(a.i)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.setConditionParameterized=function(t){this.condition.setParameterized(t),this.condition.fireChangedEvent()},e.prototype.setConditionInJoin=function(t){this.condition.setInJoin(t),this.condition.fireChangedEvent()},e.prototype.getConditionMenu=function(){return this.panel.getConditionMenu()},e.prototype.renderConjunction=function(){var t=this.condition.getParent();if(!t)return null;var e=0==r.i.findItemIndexById(t.getConditions(),this.condition.id);if(this.panel.options.showConjunctions&&!e){var n=s.equtils.linkTypeToStr(this.condition.getParent().linkType),i=r.g.getText("Conj"+n);return Object(a.i)("span").text(i).title(i).addClass(this.cssPrefix+"-condelement "+this.cssPrefix+"-condition-conjuction").toDOM()}return null},e.prototype.renderCheckbox=function(){var t=this;return this.panel.options.showCheckboxes&&!this.condition.isReadOnly()?Object(a.i)("div").title(r.g.getText("CmdToggleEnable")).attr("tabIndex","0").addClass(this.cssPrefix+"-condelement "+this.cssPrefix+"-condition-checkbox").addClass(this.condition.enabled?"enabled":"").on("click",(function(){return t.condition.enabled=!t.condition.enabled,t.condition.fireChangedEvent(),!1})).on("keypress",(function(t){[13,32].includes(t.keyCode)&&t.target.click()})).toDOM():null},e.prototype.isConditionActive=function(){return this.element.classList.contains("active")},e.prototype.hideButtons=function(){Object(a.i)(this.element).data("show-buttons",null)},e.prototype.showButtons=function(){Object(a.i)(this.element).data("show-buttons","")},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInConditions||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e.prototype.enterButtonBlock=function(){this.showButtons()},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInConditions||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.conditionMenuHandler=function(t,e){var n=this;switch(t){case _.AddCondition:if(!this.condition.isGroup())return;var i=this.panel.getEntitiesMenu();i&&i.showMenu({anchor:e.target,itemSelectedCallback:function(t){var e=n.panel.getQuery(),i={parent:n.condition,attributeId:t.id},o=e.addSimpleCondition(i);return o&&e.fireConditionsChangedEvent(s.QueryChangeAction.Add,o),!1}});break;case _.AddGroup:if(!this.condition.isGroup())return;var o=this.panel.getQuery(),r={parent:this.condition},a=this.panel.getQuery().addConditionGroup(r);a&&o.fireConditionsChangedEvent(s.QueryChangeAction.Add,a);break;case _.Enable:this.condition.enabled=!this.condition.enabled,this.condition.fireChangedEvent();break;case _.Delete:var l=this.condition.getParent();if(!l)return;var u=l.getConditions(),c=u.indexOf(this.condition);c>=0&&(u.splice(c,1),this.condition.getQuery().fireConditionsChangedEvent(s.QueryChangeAction.Delete,this.condition));break;case _.Menu:var d=this.getConditionMenu();this.keepShowingButtons=!0,d.showMenu({anchor:e.target,selectedIds:this.getConditionMenuSelectedItems(),itemSelectedCallback:function(t){var i;switch(t.id){case"enable":i=_.Enable;break;case"delete":i=_.Delete;break;case"param":i=_.Parameterized;break;case"inJoin":i=_.InJoin;break;case"addCondition":i=_.AddCondition;break;case"addGroup":i=_.AddGroup}n.conditionMenuHandler(i,e)},itemFilterCallback:function(t){var e=n.condition.enabled||"enable"===t.id||"delete"===t.id;if("enable"===t.id){var i=n.condition.getParent();e=e&&i&&i.enabled}else"delete"===t.id?e=e&&(n.panel.options.editableParts&m.Removal)===m.Removal:"addGroup"!==t.id&&"addCondition"!==t.id||(e=e&&(n.panel.options.editableParts&m.Addition)===m.Addition);return e},menuClosedCallback:function(){n.keepShowingButtons=!1,n.isMouseOverBlock||n.leaveButtonBlock()}});break;case _.Parameterized:this.condition.setParameterized(!this.condition.isParameterized()),this.condition.fireChangedEvent();break;case _.InJoin:this.condition.setInJoin(!this.condition.isInJoin()),this.condition.fireChangedEvent()}return e.stopPropagation(),!1},e.prototype.getConditionMenuSelectedItems=function(){var t=[];return this.condition.enabled&&t.push("enable"),this.condition.isParameterized()&&t.push("param"),this.condition.isInJoin()&&t.push("inJoin"),t},e.prototype.renderButtonsBlock=function(){var t=this,e=function(e){Object(a.i)(e.target).addClass(t.cssPrefix+"-condition-button-active")},n=function(e){Object(a.i)(e.target).removeClass(t.cssPrefix+"-condition-button-active")},i=Object(a.i)("div").addClass(this.cssPrefix+"-condition-buttonsBlock").addClass(u.a.getMobileCssClass());if(this.buttonsBlock=i.toDOM(),this.condition.isReadOnly())return this.buttonsBlock;var o=this.getButtonsToShow();return o.indexOf("addCondition")>=0&&this.condition.enabled&&(this.panel.options.editableParts&m.Addition)==m.Addition&&i.addChild("div",(function(i){i.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(i){i.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-addCondition").attr("tabIndex","0").data("button","").title(r.g.getText("CmdAddCondition")).on("click",(function(e){return t.conditionMenuHandler(_.AddCondition,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),(o.indexOf("addGroup")>=0||o.indexOf("addPredicate")>=0)&&this.condition.enabled&&(this.panel.options.editableParts&m.Addition)==m.Addition&&i.addChild("div",(function(i){i.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(i){i.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-addPredicate").attr("tabIndex","0").data("button","").title(r.g.getText("CmdAddCondGroup")).on("click",(function(e){return t.conditionMenuHandler(_.AddGroup,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("enable")>=0&&this.condition.getParent()&&this.condition.getParent().enabled&&i.addChild("div",(function(i){i.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(i){i.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-enable").attr("tabIndex","0").data("button","").title(r.g.getText("CmdToggleEnable")).addClass(t.condition.enabled?"enabled":"").on("click",(function(e){return t.conditionMenuHandler(_.Enable,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("delete")>=0&&this.condition.getParent()&&(this.panel.options.editableParts&m.Removal)==m.Removal&&i.addChild("div",(function(i){i.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(i){i.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-delete").attr("tabIndex","0").data("button","").title(r.g.getText("CmdDelete")).on("click",(function(e){return t.conditionMenuHandler(_.Delete,e)})).on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.getButtonsToShow().indexOf("menu")>=0&&i.addChild("div",(function(i){i.addClass(t.cssPrefix+"-button-placeholder").data("btnplaceholder","").addChild("div",(function(i){i.addClass(t.cssPrefix+"-condition-button "+t.cssPrefix+"-condition-button-menu").attr("tabIndex","0").data("button","").title(r.g.getText("ButtonMenu")).on("click",(function(e){return t.conditionMenuHandler(_.Menu,e)})),u.a.isMobileMode()||i.on("keypress",(function(t){13==t.keyCode&&t.target.click()})).on("mouseenter",e).on("mouseleave",n)}))})),this.adjustButtonsVisibility(),this.buttonsBlock},e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.condition&&Array.isArray(this.panel.options.buttons.condition)?this.panel.options.buttons.condition:["enable","delete"]},e}(Q),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)}}(),H=function(t){function e(e){var n=t.call(this,"a",e)||this;return n.attr("href","javascript:void(0)"),n.on("click",(function(t){return t.preventDefault(),n.appear(),!1})),n}return q(e,t),e.prototype.onGetMenu=function(t){return this._onGetMenu=t,this},e.prototype.onItemSelected=function(t){return this._onItemSelected=t,this},e.prototype.appear=function(){var t=this,e=this._onGetMenu?this._onGetMenu():null;e&&e.showMenu({anchor:this.element,itemSelectedCallback:function(e){return t._onItemSelected&&t._onItemSelected(e.id),!1}})},e}(a.c);function W(t){return new H(t)}var G,V=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)}}(),z=function(t){function e(e,n,i){var o=t.call(this,e,n,i)||this;return o.isRoot=!n.getParent(),o}return V(e,t),e.prototype.getClassesToAdd=function(){var t=this.cssPrefix+"-group";return this.isRoot&&(t+=" "+this.cssPrefix+"-group-root"),t},e.prototype.coreRender=function(t){Object(a.i)(this.element).addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.renderGroupRow()).addChildElement(this.renderConditions(t)).data("id",this.condition.id).data("group","")},e.prototype.renderGroupRow=function(){return this.isRoot&&!this.panel.options.showRootRow?null:new U(this.panel,this.condition).render()},e.prototype.renderConditions=function(t){var e=this,n=Object(a.i)("div");return n.addClass(this.cssPrefix+"-conditions").addClass(""+u.a.getMobileCssClass()).data("conditions",""),this.isRoot&&n.addClass(this.cssPrefix+"-conditions-root"),this.condition.getConditions().forEach((function(i,o,r){var s=e.panel.getConditionRenderer(i);s&&n.addChildElement(s.render(t&&o==r.length-1))})),n.toDOM()},e}(Q),U=function(t){function e(e,n,i){var o=t.call(this,e,n,i)||this;return o.isRoot=!o.condition.getParent(),o}return V(e,t),e.prototype.getButtonsToShow=function(){return this.panel.options.buttons&&this.panel.options.buttons.group&&Array.isArray(this.panel.options.buttons.group)?this.panel.options.buttons.group:["addCondition","addGroup","enable","delete"]},e.prototype.getClassesToAdd=function(){var t;if(this.isRoot)t=this.cssPrefix+"-row "+this.cssPrefix+"-row-group "+this.cssPrefix+"-row-group-root";else{t=this.cssPrefix+"-row "+this.cssPrefix+"-row-group";var e=this.condition.getLevel();e>0&&(t+=" "+this.cssPrefix+"-level-"+e),t+=this.condition.enabled?"":" "+this.cssPrefix+"-disabled",this.condition.enabled&&(t+=this.condition.isReadOnly()?" "+this.cssPrefix+"-readonly":"")}return t},e.prototype.coreRender=function(t){var e=this,n=Object(a.i)(this.element).addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).data("group-row","").addChildElement(this.renderCheckbox()).addChildElement(this.renderConjunction()),i=this.condition.getLevel();i>0&&n.addClass(this.cssPrefix+"-level-"+i),this.buildGroupElements(n,this.getGroupTitle()),this.panel.options.accentActiveCondition&&n.on("click",(function(t){e.panel.toggleConditionPicked(e.condition),e.adjustButtonsVisibility(),u.a.isMobileMode()||n.toDOM().dispatchEvent(Object(a.h)("mouseenter"))})),n.addChildElement(this.renderButtonsBlock()),u.a.isMobileMode()||n.on("mouseenter",(function(t){return e.isMouseOverBlock=!0,e.enterButtonBlock(),t.stopPropagation(),!1})).on("mouseleave",(function(t){return e.isMouseOverBlock=!1,!e.keepShowingButtons&&Object(a.i)(e.buttonsBlock).isVisible()&&e.leaveButtonBlock(),t.stopPropagation(),!1}))},e.prototype.getGroupTitle=function(){var t;return this.isRoot&&!u.a.isMobileMode()?(t=r.g.getText("RootConditionGroupTitle"))||(t=r.g.getText("RootPredicateTitle")):(t=r.g.getText("ConditionGroupTitle"))||(t=r.g.getText("PredicateTitle")),t},e.prototype.buildGroupElements=function(t,e){var n=this,i=e.indexOf("{lt}");if(i<0)t.addText(r.g.getText("ErrIncorrectGroupTitleFormat")),t.addClass(this.cssPrefix+"-error");else{i>0&&t.addChild("span",(function(t){t.addClass(n.cssPrefix+"-grelement").addText(e.substring(0,i))}));var o=s.equtils.linkTypeToStr(this.condition.linkType),a=r.i.findItemById(s.eqconsts.predicateLinkTypeList,o);a||(a=s.eqconsts.predicateLinkTypeList[0]),this.isEditable()?W(t.toDOM()).onGetMenu((function(){return n.getLinkTypeMenu()})).onItemSelected((function(t){n.condition.linkType=s.equtils.strToLinkType(t),n.condition.fireChangedEvent()})).addText(r.g.getText(a.key)).title(r.g.getText(a.key)).addClass(this.cssPrefix+"-grelement"):t.addChild("span",(function(t){t.text(r.g.getText(a.key)).title(r.g.getText(a.key)).addClass(n.cssPrefix+"-grelement")})),t.addChild("span",(function(t){t.addClass(n.cssPrefix+"-grelement").addText(e.substring(i+4))}))}},e.prototype.getConditionMenu=function(){return this.panel.getConditionGroupMenu(null==this.condition.getParent())},e.prototype.getLinkTypeMenu=function(){return this.panel.getLinkTypeMenu()},e.prototype.renderConjunction=function(){return this.isRoot?null:t.prototype.renderConjunction.call(this)},e.prototype.renderCheckbox=function(){return this.isRoot?null:t.prototype.renderCheckbox.call(this)},e.prototype.leaveButtonBlock=function(){this.panel.options.alwaysShowButtonsInGroups||this.isConditionActive()&&this.panel.options.accentActiveCondition||this.hideButtons()},e.prototype.adjustButtonsVisibility=function(){(this.panel.options.alwaysShowButtonsInGroups||this.panel.options.accentActiveCondition&&this.isConditionActive())&&this.showButtons()},e}(N),J=function(){function t(t){this.element=t||Object(a.i)("div").toDOM()}return t.prototype.refresh=function(){this.render()},t.prototype.render=function(t){var e=this;return void 0===t&&(t=!1),this.labelElement=this.renderLabelElement(),Object(a.i)(this.element).html("").addClass(this.getClassesToAdd()).addClass(u.a.getMobileCssClass()).addChildElement(this.labelElement),this.isEditable()&&(this.renderEditor(),t&&setTimeout((function(){return e.showEditor()}),50)),this.element},t.prototype.isEditable=function(){return!0},t.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?Object(a.i)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():Object(a.i)("span").title(e).text(e).toDOM()},t.prototype.getClassesToAdd=function(){return""},t.prototype.getLabelText=function(){return this.getEmptyText()},t.prototype.getEmptyText=function(){return"<empty>"},t}(),Y=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)}}(),K=function(t){function e(e,n,i,o){var r=t.call(this,o)||this;return r.panel=e,r.expression=n,r.valueEditor=i,r}return Y(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.render=function(e){return void 0===e&&(e=!1),t.prototype.render.call(this,e),this.panel.options.onExpressionRendered&&this.panel.options.onExpressionRendered(this.expression,this.element),this.element},e.prototype.getContext=function(){return this.panel.getContext()},e.prototype.isReadOnly=function(){var t=this.expression.getParent();return!t.enabled||t.isReadOnly()},e.prototype.isEditable=function(){return!this.isReadOnly()},e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement "+this.cssPrefix+"-valueelement"},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.value},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.g.getText("MsgEmptyScalarValue")},e.prototype.setValue=function(t,e){this.expression.setValue(t),e||this.expression.getParent().fireChangedEvent(s.ConditionPart.Value)},e.prototype.getValue=function(){return this.expression.value},e.prototype.validateInput=function(t){return{success:!0,value:t}},e.prototype.showValidationError=function(t,e){this.getContext().throwError({action:"ui.validation",text:t})},e.prototype.isEmptyValue=function(){var t=this.getValue();return null==t||!t},e.prototype.adjustWidth=function(){},e}(J),X=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)}}(),Z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return X(e,t),e.prototype.renderEditor=function(){var t=this;this.inputBuilder=Object(a.i)("input").hide().addClass(this.cssPrefix+"-ve-editbox").type("text").on("blur",(function(e){if(t.inputBuilder.isVisible()&&!t.dontProcessBlur){var n=t.validateInput(t.inputElement.value);return n.success?(t.setValue(t.inputElement.value),t.closeEditor()):(t.dontProcessBlur=!0,t.inputElement.focus(),setTimeout((function(){t.dontProcessBlur=!1}),200),t.showValidationError(n.message,e.target)),e.stopPropagation(),!1}})).on("keydown",(function(e){return 27===e.keyCode?(t.closeEditor(),e.stopPropagation(),!1):13===e.keyCode&&t.inputBuilder.isVisible()?(t.dontProcessBlur=!0,t.validateInput(t.inputElement.value).success?(t.setValue(t.inputElement.value),t.closeEditor(),t.dontProcessBlur=!1):(t.inputElement.focus(),setTimeout((function(){t.dontProcessBlur=!1}),200)),e.stopPropagation(),!1):void 0})),this.inputElement=this.inputBuilder.toDOM(),Object(a.i)(this.element).addChildElement(this.inputElement)},e.prototype.showEditor=function(){var t=200;if(!u.a.isMobileMode()){var e=this.element.offsetLeft,n=this.element.offsetWidth>t?this.element.offsetWidth:t,i=this.element.parentElement.clientWidth-e-55;this.inputBuilder.removeStyle("left").removeStyle("right"),i<t?this.inputBuilder.setStyle("right","55px").setStyle("width","200px"):i<n?this.inputBuilder.setStyle("left",e+"px").setStyle("width",i+"px"):this.inputBuilder.setStyle("left",e+"px").setStyle("width",n+"px")}Object(a.i)(this.labelElement).hide(),this.inputBuilder.value(this.getValue()).show(),this.inputElement.focus()},e.prototype.closeEditor=function(){this.inputBuilder.hide(),Object(a.i)(this.labelElement).show(),this.labelElement.focus()},e.prototype.validateInput=function(t){this.inputBuilder.removeClass("eqjs-invalid");var e={success:!0,value:t};return this.expression.kind==s.DataKind.List?this.validateListInput(t,e):this.validateScalarInput(t,e),e},e.prototype.validateListInput=function(t,e){for(var n=0,i=t.split(/\s*,\s*/);n<i.length;n++){var o=i[n];if(this.validateScalarInput(o,e),!e.success)return}},e.prototype.validateScalarInput=function(t,e){if(t&&r.i.isNumericType(this.expression.dataType)){var n=+t;isNaN(n)&&(e.success=!1,e.message='"'+t+'" '+r.g.getText("ErrNotNumber")),r.i.isIntType(this.expression.dataType)&&n!=parseInt(t,10)&&(e.success=!1,e.message='"'+t+'" '+r.g.getText("ErrIncorrectInteger"))}},e.prototype.showValidationError=function(e,n){t.prototype.showValidationError.call(this,e,n),this.inputBuilder.addClass("eqjs-invalid")},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&m.Value)===m.Value},e}(K),$=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)}}(),tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.menuItemsList=[],e.showWhenReady=!1,e}return $(e,t),e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&m.Value)===m.Value},e.prototype.setValue=function(t,e){void 0===e&&(e=!1);var n=this.adjustNewValue(t);if(t!==this.expression.value){var i=this.getValueText(t);this.expression.setContent(n,i),e||this.expression.getParent().fireChangedEvent(s.ConditionPart.Value)}return!0},e.prototype.getValueText=function(t){var e="";if(Array.isArray(t))for(var n=0,i=this.menuItemsList;n<i.length;n++){var o=i[n];t.indexOf(o.id)>=0&&(e+=o.text+",")}else for(var r=0,s=this.menuItemsList;r<s.length;r++){(o=s[r]).id===t&&(e+=o.text+",")}return e&&(e=e.substring(0,e.length-1)),e},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextList||r.g.getText("MsgEmptyListValue")},e.prototype.getListName=function(){return this.valueEditor.name},e.prototype.renderEditor=function(){var t=this;this.fillMenuItemsList((function(){t.renderMenuBlock()}))},e.prototype.getLabelText=function(){return this.expression.isEmpty()?this.getEmptyText():this.expression.getText()},e.prototype.showLoader=function(){},e.prototype.hideLoader=function(){},e.prototype.showEditor=function(){var t=this;this.menu?this.menu.showMenu({anchor:this.labelElement,selectedIds:this.getValuesAsArray(),itemSelectedCallback:function(e,n){if(t.menu.options.multiselect){if(n){for(var i=[],o=n.length,r=0;r<o;r++)i.push(n[r].id);t.setValue(i)}}else t.setValue(e.id);return!1}}):(this.showWhenReady=!0,this.showLoader())},e.prototype.closeEditor=function(){this.menu.hideMenu()},e.prototype.renderMenuBlock=function(){var t=!1;this.expression&&(t=this.expression.kind===s.DataKind.List);var e=this.panel,n={items:this.menuItemsList,multiselect:t,container:e?e.options.menuContainer:null,showSelected:!0};e&&r.i.assignDeep(n,e.options.menuOptions);var i=this.element.id;i&&(n.id=i+"-EditorMenu"),e&&(n.domWriteItemsId=e.options.domWriteItemsId),n.buttons={submit:r.g.getText("ButtonApply"),cancel:r.g.getText("ButtonCancel")},this.menu=new p(n)},e.prototype.getValuesAsArray=function(){if(this.expression.kind!==s.DataKind.List)return[this.expression.value];var t=this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);return t?t.map((function(t){return'"'==t.charAt(0)&&'"'==t.charAt(t.length-1)?(t=t.substring(1,t.length-1)).replace(/\"/g,'"'):t})):[]},e.prototype.adjustNewValue=function(t){return Array.isArray(t)?t.map((function(t){return t.indexOf(",")>=0?'"'+(t=t.replace(/"/g,'"'))+'"':t})).join(","):t},e.prototype.fillMenuItemsList=function(t){this.menuItemsList=this.valueEditor.values,t&&t()},e.prototype.takeDefaultValue=function(){if(this.menuItemsList)for(var t=this.menuItemsList.length,e=0;e<t;e++){var n=this.menuItemsList[e];if(n.isDefault){this.setValue(n.id,!0);break}}},e}(K),et=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isLoading=!1,e.onClickTemp=null,e}return $(e,t),e.prototype.renderEditor=function(){var t=this;this.isLoading||(this.isLoading=!0,this.fillMenuItemsList((function(){if(t.isLoading=!1,t.isEmptyValue()&&t.takeDefaultValue(),!t.expression.isEmpty()&&t.expression._isDefaultValue){var e=t.getValueText(t.expression.value);t.expression.setContent(t.expression.value,e),t.expression.getParent().fireChangedEvent()}t.renderMenuBlock(),t.showWhenReady&&(t.showWhenReady=!1,t.hideLoader(),t.showEditor())})))},e.prototype.showLoader=function(){this.labelElement.style.display="none",this.loaderElement||(this.loaderElement=Object(a.i)("div",this.element).addClass(this.cssPrefix+"-ve-loader").toDOM()),this.loaderElement.style.display="block"},e.prototype.hideLoader=function(){this.loaderElement.style.display="none",this.labelElement.removeAttribute("style")},e.prototype.fillMenuItemsList=function(t){var e=this,n=this.getListName(),i=this.panel.getContext().getListRequestHandler();s.eqconsts.constLists[n]?(this.menuItemsList=s.eqconsts.constLists[n],t&&t()):i&&i({listName:n,editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(tt),nt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return $(e,t),e.prototype.fillMenuItemsList=function(t){var e=this,n=this.panel.getContext(),i=(this.valueEditor,n.getListRequestHandler());i&&i({listName:"SQL",editorId:this.valueEditor.id,editorParams:this.valueEditor.extraParams,value:this.getValue()},(function(n){e.menuItemsList=n,t&&t()}))},e}(et),it=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)}}(),ot=function(t){function e(e,n,i,o){var r=t.call(this,e,n,null,o)||this;return r.menu=i,r}return it(e,t),e.prototype.renderEditor=function(){},e.prototype.getLabelText=function(){var t=this.panel.getContext().getModel(),e=this.expression.value,n=e?t.getAttributeByIdSafe(e):null,i=this.panel.options.attrElementFormat;return n?t.getAttributeText(n,i):this.getEmptyText()},e.prototype.setValue=function(e,n){void 0===n&&(n=!1),n=n&&e!==this.expression.value;var i=t.prototype.setValue.call(this,e,!0);return n||this.expression.getParent().fireChangedEvent(s.ConditionPart.EntityAttr|s.ConditionPart.Operator),i},e.prototype.isEditable=function(){return!this.isReadOnly()&&(this.panel.options.editableParts&m.Attribute)===m.Attribute},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextAttribute||r.g.getText("MsgEmptyAttrValue")},e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement "+this.cssPrefix+"-attrelement"},e.prototype.adjustWidth=function(){u.a.isMobileMode()||this.element.clientWidth>this.element.parentElement.clientWidth/2&&Object(a.i)(this.element).addClass(this.cssPrefix+"-attrelement-wide")},e}(tt),rt=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)}}(),st=function(t){function e(e){return t.call(this,e)||this}return rt(e,t),e.prototype.showEditor=function(){var t=this,e=this.getMenu();e&&e.showMenu({anchor:this.labelElement,itemSelectedCallback:function(e){return t.itemSelected(e.id),!1}})},e.prototype.closeEditor=function(){var t=this.getMenu();t&&t.hideMenu()},e}(J),at=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)}}(),lt=function(t){function e(e,n,i){var o=t.call(this,i)||this;return o.panel=e,o.menu=n,o}return at(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.getLabelText=function(){return r.g.getText("CmdClickToAddCondition")},e.prototype.getClassesToAdd=function(){return l.b+"-addrow "+this.cssPrefix+"-addrow"},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&m.Addition)===m.Addition},e.prototype.renderLabelElement=function(){var t=this,e=this.getLabelText();return this.isEditable()?this.labelElement=Object(a.i)("a").attr("href","javascript:void(0)").title(e).text(e).on("click",(function(e){return e.preventDefault(),t.showEditor(),!1})).toDOM():this.labelElement=Object(a.i)("div").toDOM(),this.labelElement},e.prototype.renderEditor=function(){},e.prototype.itemSelected=function(t){var e=this.panel.getQuery(),n={parent:e.getRootCondition(),attributeId:t},i=e.addSimpleCondition(n);i&&e.fireConditionsChangedEvent(s.QueryChangeAction.Add,i)},e.prototype.getMenu=function(){return this.menu},e}(st),ut=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)}}(),ct=function(t){function e(e,n,i,o){var r=t.call(this,o)||this;return r.panel=e,r.condition=n,r.displayedText=i,r}return ut(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.renderEditor=function(){var t=this,e=this.panel.getContext().getModel(),n=this.panel.getQuery(),i=[],o=(this.condition&&this.condition.expressions&&this.condition.expressions[0]?this.condition.expressions[0].value:null)?e.getAttributeById(this.condition.expressions[0].value):null;o&&o.operators&&o.operators.forEach((function(o){var a=e.getOperatorById(o),l=function(t){return t.defaultOperand.kind==s.DataKind.Query}(a);!n.isEx()&&l||!a||t.panel.options.isSubQuery&&l||i.push({id:o,text:r.g.getText("Operators",o,"caption")||a.caption})}));var a={items:i,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:r.i.generateId("opmn"),domWriteItemsId:this.panel.options.domWriteItemsId};r.i.assign(a,this.panel.options.menuOptions),this.menu=new p(a)},e.prototype.getLabelText=function(){return this.displayedText},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextOperator||r.g.getText("MsgEmptyOperator")},e.prototype.getClassesToAdd=function(){return this.cssPrefix+"-condelement "+this.cssPrefix+"-operelement"},e.prototype.isEditable=function(){return this.condition.enabled&&!this.condition.isReadOnly()&&(this.panel.options.editableParts&m.Operator)===m.Operator},e.prototype.itemSelected=function(t){this.condition.setOperatorId(t),this.condition.fireChangedEvent(s.ConditionPart.Operator)},e.prototype.getMenu=function(){return this.menu},e}(st),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)}}(),ht=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dtp=null,e.internalDateFormat="yyyy-MM-dd",e.internalTimeFormat="HH:mm",e}return dt(e,t),e.prototype.renderEditor=function(){},e.prototype.showEditor=function(){var t=this;if(!this.dtp){var e={yearRange:this.panel.options.yearRange,showCalendar:this.expression.dataType!==r.d.Time,showTimePicker:this.expression.dataType!==r.d.Date,oneClickDateSelection:this.panel.options.oneClickDateSelection,showDateTimeInput:this.panel.options.showDateTimeInput,onApply:function(e){var n=t.convertToInternalFormat(e);t.setValue(n),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onCancel:function(){t.labelElement.innerText=t.getLabelText(),t.dtp=null,setTimeout((function(){return t.labelElement.focus()}),100)},onDateTimeChanged:function(e){var n=r.g.dateTimeToStr(e,t.expression.dataType);t.labelElement.innerText=n}};this.dtp=this.panel.options.dateTimePickerResolver?this.panel.options.dateTimePickerResolver(e):new a.a(e);var n=this.expression.getModel(),i=this.expression.value,o=new Date;o=this.expression.dataType!=r.d.Time&&n.isDateMacro(i)?n.getDateMacroValue(i):this.expression.dataType==r.d.Time&&n.isTimeMacro(i)?n.getTimeMacroValue(i):this.convertFromInternalFormat(i),this.dtp.setDateTime(o),this.dtp.show(this.element)}},e.prototype.closeEditor=function(){this.dtp.cancel(),this.dtp=null},e.prototype.getLabelText=function(){if(!this.expression.value)return this.getEmptyText();var t=this.expression.value,e=this.expression.getModel();if(!e)throw new Error("DataModel is not defined for "+this.expression.value);if(e.isDateMacro(t)||e.isTimeMacro(t)){var n=t.substring(3,t.length-2),i=r.g.getText(n);return i||"${{Today}}"}return r.g.dateTimeToStr(this.convertFromInternalFormat(t),this.expression.dataType)},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&m.Value)===m.Value},e.prototype.convertFromInternalFormat=function(t){return r.i.strToDateTime(t,this.internalDateFormat+" "+this.internalTimeFormat)},e.prototype.convertToInternalFormat=function(t){return r.i.dateTimeToStr(t,this.internalDateFormat+" "+this.internalTimeFormat)},e}(K),pt=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)}}(),ft=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return pt(e,t),e.prototype.renderEditor=function(){this.dialogBlockBody=Object(a.i)("div").addClass("kfrm-form").toDOM(),this.createEntitiesMenu(),this.renderColumnBlock(),this.renderQueryPanelBlock()},e.prototype.isEditable=function(){return t.prototype.isEditable.call(this)&&(this.panel.options.editableParts&m.Value)===m.Value},e.prototype.setValue=function(t,e){t instanceof s.Query&&(this.expression.subQuery=t,e||this.expression.getParent().fireChangedEvent(s.ConditionPart.Value))},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel(),e=this.expression.dataType;if(this.colEntitiesList=t.getEntitiesTreeWithFilter((function(t,n){return n?n.useInConditions&&n.dataType===e:t.attributes&&t.useInConditions})),!t||t.isEmpty())return null;var n=this.element.getAttribute("data-id");n&&(n+="-SubColumnMenu");var i={items:this.colEntitiesList,adjustHeight:this.panel.options.adjustEntitiesMenuHeight,id:n,isSubQuery:!0,domWriteItemsId:this.panel.options.domWriteItemsId};r.i.assign(i,this.panel.options.menuOptions),this.colEntitiesMenu=new p(i)},e.prototype.renderColumnBlock=function(){var t=this;this.columnBlock=Object(a.i)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.g.getText("SubQueryColumnTitle"))})).addChild("a",(function(e){return t.columnElement=e.attr("href","javascript:void(0)").on("click",(function(e){t.colEntitiesMenu.showMenu({anchor:t.columnElement,selectedIds:null,itemSelectedCallback:function(e,n){var i=e.id;return t.setResultAttributeId(i),!1}})})).toDOM()})).toDOM()},e.prototype.getEmptyText=function(){return this.panel.options.emptyTextValue||r.g.getText("MsgSubQueryValue")},e.prototype.renderQueryPanelBlock=function(){var t=Object(a.i)("div",this.dialogBlockBody).addClass("kfrm-field").addChild("label",(function(t){return t.addText(r.g.getText("SubQueryQueryPanelCaption"))})).toDOM();this.queryPanelBlock=Object(a.i)("div",t).toDOM();var e=this.element.getAttribute("data-id");e&&(this.queryPanelBlock.id=e+"-SubQueryPanel")},e.prototype.setResultAttributeId=function(t){var e=this.getContext().getModel().getAttributeById(t);if(e){var n=this.getSubQuery(),i=n.getColumns(),o=void 0;if(i.length>0)(o=i[0]).expr.setValue(t),o.expr.dataType=e.dataType,o.fireChangedEvent();else{(o=n.createColumn()).sorting=s.SortDirection.None,o.sortIndex=-1;var r=new s.Expression(o);r.setValue(t),r.tag=s.ExprTag.EntityAttribute,r.kind=s.DataKind.Attribute,r.dataType=e.dataType,o.expr=r,i.push(o),n.fireColumnsChangedEvent(s.QueryChangeAction.Add,o)}this.columnElement.innerText=this.getAttributeText(e)}},e.prototype.getSubQuery=function(){return this.queryPanel.getQuery()},e.prototype.getAttributeText=function(t){if(!t)return r.g.getText("SubQueryEmptyColumn");var e=r.g.getText("Attributes",t.id);e||(e=t.caption);var n=this.panel.options.attrElementFormat;if(!n)return e;var i=n.replace(new RegExp("{attr}","g"),e),o=this.getContext().getModel().getFullEntityPathByAttr(t.id,".");return i.replace(new RegExp("{entity}","g"),o)},e.prototype.showEditor=function(){var t=this,e=this.panel,n=this.getContext();this.queryPanelBlock.innerHTML="";var i=n.createQuery();this.expression.subQuery&&i.loadFromData(this.expression.subQuery.toJSONData());var o=r.i.assign({},e.options);o.isSubQuery=!0,o.showAddRow=!0,o.menuContainer=document.body,o.menuOptions.isSubQuery=!0,o.entitiesListFilter=function(t,n){if(e.options.entitiesListFilter){var i=n||{};i.isSubQuery=!0,e.options.entitiesListFilter(t,i)}},this.queryPanel=new vt(this.queryPanelBlock,i),this.queryPanel.init(this.panel.getContext(),o);var a=null,l=i.getColumns();if(0==l.length){var u=this.expression.getParent();if(u.expressions.length>0){var c=u.expressions[0];a=c.tag==s.ExprTag.EntityAttribute||c.kind==s.DataKind.Attribute?c.value:null}}else a=l[0].expr.value;a?this.setResultAttributeId(a):this.columnElement.innerText=r.g.getText("SubQueryEmptyColumn"),this.queryPanel.refresh();var d=this.queryPanelBlock.querySelector(".eqjs-qp-conditions-root");d&&(d.style.minHeight="100px"),this.panel.getContext().getServices().getDialogService().open({title:r.g.getText("SubQueryDialogTitle"),body:this.dialogBlockBody,width:this.panel.options.subQueryDialogWidth,closable:!0,cancelable:!0,onSubmit:function(){var e=t.queryPanel.getQuery();return!!e.tryValidate({checkExpressions:!0})&&(t.setValue(e),!0)}})},e.prototype.closeEditor=function(){},e}(K),gt=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(t){function e(e,n,i,o){var r=t.call(this,e,n,i,o)||this;return r.expression.tag=s.ExprTag.ParentColumn,r}return gt(e,t),e.prototype.fillMenuItemsList=function(t){var e=this.panel.getQuery().getParentQuery(),n=this.expression.getParent().expressions[0].dataType;this.menuItemsList=e.getColumns().filter((function(t){return t.expr.dataType==n})).map((function(t){return{id:t.id,text:t.caption}})),t&&t()},e}(et),yt=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)}}(),vt=function(t){function e(e,n){var i=t.call(this,e)||this;return i.options={editableParts:m.All,isSubQuery:!1,activeCondition:null,entitiesPopupHandler:null,entitiesListFilter:null,menuContainer:document.body,showRootRow:!0,showAddRow:!0,showCheckboxes:!1,allowParameterization:!1,allowInJoinConditions:!1,showPoweredBy:!1,buttons:{condition:null,group:null},alwaysShowButtonsInGroups:!1,alwaysShowButtonsInConditions:!1,showConjunctions:!0,accentActiveCondition:!0,activateRootOnStart:!0,yearRange:"c-10:c+10",oneClickDateSelection:!0,showDateTimeInput:!1,attrElementFormat:"{entity} {attr}",menuOptions:{showSearchBoxAfter:30,searchBoxAutoFocus:!0,activateOnMouseOver:!0,itemRenderedCallback:null},allowDragDrop:!0,attrPlacement:0,sortEntities:!1,subQueryDialogWidth:600,subQueryDialogHeight:300,dialogZIndex:1e5,numberListSeparators:[",",";"],autoEditNewCondition:!1,onConditionRendered:null,onGetConditionRenderer:null,onGetExpressionRenderer:null,onGetOperatorRenderer:null,onOperatorRendered:null,onGetAddRowRenderer:null,defaultQuery:null},i.customQuery=null,i.landingSlot=Object(a.i)("div").addClass(i.cssPrefix+"-cond-landing-slot").addChildElement(Object(a.i)("div").toDOM()).toDOM(),i.slot.classList.contains(i.cssPrefix+"-panel")||i.slot.classList.add(i.cssPrefix+"-panel"),i.group=s.WidgetGroup.Query,n&&(i.customQuery=n),i}return yt(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-qp"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"queryPanel"},e.prototype.init=function(e,n){var i=this;if(t.prototype.init.call(this,e,n),this.setOptions(n),this.detachQueryObserver(),this.attachQueryObserver(),a.j.removeDropContainer(this.slot),this.options.allowDragDrop){var o=this.getContext().getModel();a.j.registerDropContainer({element:this.slot,scopes:["entityAttr"],onDragEnter:function(t,e){i.slot.classList.add(l.b+"-drophover"),e.dragImage.classList.add("eqjs-sortable-helper"),i.showLandingSlot();var n=e.data.attrId;o.checkAttrProperty(n,"useInConditions")||(e.dropEffect=a.d.Forbid)},onDragOver:function(t,e){},onDragLeave:function(t,e){e.dragImage.classList.remove("eqjs-sortable-helper"),e.dragImage.style.removeProperty("width"),i.slot.classList.remove(l.b+"-drophover"),i.hideLangindSlot()},onDrop:function(t,e){var n=i.getQuery(),o={parent:n.getRootCondition(),attributeId:e.data.attrId},r=n.addSimpleCondition(o);r&&n.fireConditionsChangedEvent(s.QueryChangeAction.Add,r)}})}},e.prototype.destroyCore=function(){a.j.removeDropContainer(this.slot),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.getEntitiesMenu=function(){return this.entitiesMenu},e.prototype.getConditionMenu=function(){return this.conditionMenu},e.prototype.getLinkTypeMenu=function(){return this.linkTypeMenu},e.prototype.getConditionGroupMenu=function(t){return void 0===t&&(t=!1),t?this.rootGroupMenu:this.groupMenu},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;if(n&&(n.part==s.QueryChangePart.Conditions||n.part==s.QueryChangePart.All)){var i=document.activeElement,o=t.slot.contains(i)||i==document.body;switch(n.action){case s.QueryChangeAction.Modify:var r=n.changee,a=function(e,i){var r=t.slot.querySelector("div[data-id="+e.id+"]");if(r){i=i&&(n.condPart&s.ConditionPart.Operator)===s.ConditionPart.Operator&&e.expressions.length>1&&(e.expressions[1]._isDefaultValue||""==e.expressions[1].value||null==e.expressions[1].value);var a=r.classList.contains("active"),u=t.getConditionRenderer(e,r);if(u){var c=u.render(i);if(a&&t.toggleConditionPicked(e),o&&!i){var d=c.querySelector("a")||c.querySelector(".eqjs-qp-condition-button");d&&Object(l.d)(d)}}}},u=t.options.autoEditNewCondition;Array.isArray(r)?(r.forEach((function(t){return a(t,u)})),u=!1):a(r,u);break;case s.QueryChangeAction.Add:r=n.changee;var c=function(e){var n=t.getConditionRenderer(e);if(n){var i=e.getParent(),r=t.slot.querySelector("div[data-id="+i.id+"]");if(r){var s=r.lastChild;if(s){var a=n.render(t.options.autoEditNewCondition);s.appendChild(a),a.scrollIntoView(!1),o&&!t.options.autoEditNewCondition&&a.querySelector("a").focus()}}}};Array.isArray(r)?r.forEach((function(t){return c(t)})):c(r);break;case s.QueryChangeAction.Delete:r=n.changee;var d=function(e){var n=t.slot.querySelector("div[data-id="+e.id+"]");if(n){var i=t.slot.querySelector("div[data-id="+e.getParent().id+"] > .eqjs-qp-row-group"),r=n.nextSibling,s=n.previousSibling;if(n.parentElement.removeChild(n),o){var a=r||s||i,l=a.querySelector("a")||a.querySelector(".eqjs-qp-condition-button");l&&l.focus()}}};Array.isArray(r)?r.forEach((function(t){return d(t)})):d(r);break;default:t.refresh()}}}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.getQuery=function(){return this.customQuery?this.customQuery:this.context.getQuery()},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t),this.options.dateFormatValue&&r.g.updateLocaleSettings({editDateFormat:this.options.dateFormatValue}),this.options.dateFormatDisplay&&r.g.updateLocaleSettings({shortDateFormat:this.options.dateFormatDisplay}),void 0===this.options.editableParts&&(this.options.editableParts=m.All),u.a.isMobileMode()&&(this.options.buttons=this.options.buttons||{},this.options.buttons.condition=["menu"],this.options.buttons.group=["menu"])},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.render=function(){try{this.entitiesMenu=this.createEntitiesMenu(),this.createConditionMenus(),this.createLinkTypeMenu(),this.rootContainer=Object(a.i)("div",this.slot).toDOM(),Object(a.i)(this.slot).removeClass(l.a).addClass(u.a.getMobileCssClass());var t=this.getQuery().getRootCondition(),e=this.getConditionRenderer(t,this.rootContainer);if(e&&e.render(),this.options.showAddRow){this.addRowElement=Object(a.i)("div",this.slot).toDOM();var n=this.getAddRowRenderer(this.addRowElement);n&&n.render()}}catch(t){var i=t;this.context.throwError({action:"QueryPanel rendering",text:i.message,sourceError:i})}},e.prototype.getConditionRenderer=function(t,e){var n;if(this.options.onGetConditionRenderer&&(n=this.options.onGetConditionRenderer(t,e)))return n;switch(t.tag){case s.CondTag.Simple:return new N(this,t,e);case s.CondTag.Group:return new z(this,t,e)}return null},e.prototype.getExpressionRenderer=function(t,e){if(!t)throw"Expression is not defined in the condition";var n,i,o=this.getContext().getModel(),a=t.getParent(),l=o.getOperatorById(a.getOperatorId()),u=o.getAttributeByIdSafe(a.expressions[0].value),c=o.getOperand(u,l,t.getIndex());i=(n=c&&c.editor&&c.editor.tag!==s.EqEditorTag.Unknown?c.editor:u&&u.defaultEditor?u.defaultEditor:new s.EqValueEditor).tag;var d=t.dataType;if(d==r.d.Unknown&&(d=u.dataType),t.kind===s.DataKind.Attribute){if(0===t.getIndex())return new ot(this,t,this.entitiesMenu,e);var h=this.createEntitiesMenu((function(t,e){return!e||e.useInConditions&&e.dataType===d}));return new ot(this,t,h,e)}if(t.kind===s.DataKind.Query?i=s.EqEditorTag.SubQuery:t.kind===s.DataKind.Scalar?i!=s.EqEditorTag.Unknown||t.dataType!==r.d.Date&&t.dataType!==r.d.DateTime&&t.dataType!==r.d.Time||(i=s.EqEditorTag.DateTime):t.kind==s.DataKind.ParentColumn&&(i=s.EqEditorTag.BindToParentColumn),this.options.onGetExpressionRenderer){var p=this.options.onGetExpressionRenderer(this,t,n,e);if(p)return p}switch(i){case s.EqEditorTag.List:return new tt(this,t,n,e);case s.EqEditorTag.SqlList:return new nt(this,t,n,e);case s.EqEditorTag.CustomList:return new et(this,t,n,e);case s.EqEditorTag.DateTime:return new ht(this,t,n,e);case s.EqEditorTag.SubQuery:return new ft(this,t,n,e);case s.EqEditorTag.BindToParentColumn:return new mt(this,t,n,e);default:return new Z(this,t,n,e)}},e.prototype.getOperatorRenderer=function(t,e,n){var i;return this.options.onGetOperatorRenderer&&(i=this.options.onGetOperatorRenderer(t,e,n)),i||new ct(this,t,e,n)},e.prototype.getAddRowRenderer=function(t){var e;return this.options.onGetAddRowRenderer&&(e=this.options.onGetAddRowRenderer(t)),e||new lt(this,this.entitiesMenu,t)},e.prototype.createEntitiesMenu=function(t){var e=this.getContext().getModel();if(!e||e.isEmpty())return null;var n=this.slot.id||"eq-querypanel";n+="-EntitiesMenu";var i={items:e.getEntitiesTree({addUIC:!0,addUIR:!1,addUIS:!1,attrPlacement:this.options.attrPlacement,sortEntities:this.options.sortEntities},t),adjustHeight:this.options.adjustEntitiesMenuHeight,id:n,domWriteItemsId:this.options.domWriteItemsId};return r.i.assign(i,this.options.menuOptions),new p(i)},e.prototype.showEntitiesMenu=function(t){this.entitiesMenu.showMenu(t)},e.prototype.createConditionMenus=function(){var t=this.getQuery(),e=this.slot.id||"eq-querypanel";e+="-ConditionMenu";var n=[{id:"enable",text:r.g.getText("MenuEnable")},{id:"delete",text:r.g.getText("CmdDelete")}];t.isEx()&&((this.options.allowParameterization||this.options.allowInJoinConditions)&&n.push({id:"delimiter",text:"---"}),this.options.allowParameterization&&n.push({id:"param",text:r.g.getText("MenuParameterization")}),this.options.allowInJoinConditions&&n.push({id:"inJoin",text:r.g.getText("MenuJoinCond")}));var i={items:n,adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.i.assign(i,this.options.menuOptions),this.conditionMenu=new p(i);e=this.slot.id||"eq-querypanel";e+="-GroupMenu";i={items:n=[{id:"enable",text:r.g.getText("MenuEnable")},{id:"delete",text:r.g.getText("CmdDelete")},{id:"delimiter",text:"---"},{id:"addCondition",text:r.g.getText("CmdAddCondition")},{id:"addGroup",text:r.g.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.i.assign(i,this.options.menuOptions),this.groupMenu=new p(i);e=this.slot.id||"eq-querypanel";e+="-RootGroupMenu";i={items:n=[{id:"addCondition",text:r.g.getText("CmdAddCondition")},{id:"addGroup",text:r.g.getText("CmdAddCondGroup")}],adjustHeight:this.options.adjustEntitiesMenuHeight,id:e,domWriteItemsId:this.options.domWriteItemsId,showSearchBoxAfter:100,showSelected:!0};r.i.assign(i,this.options.menuOptions),this.rootGroupMenu=new p(i)},e.prototype.createLinkTypeMenu=function(){var t=this.slot.id;t&&(t+="-LinkTypeMenu");var e={items:s.eqconsts.predicateLinkTypeList.map((function(t){return{id:t.id,text:r.g.getText(t.key)}})),adjustHeight:this.options.adjustEntitiesMenuHeight,id:t,domWriteItemsId:this.options.domWriteItemsId};r.i.assign(e,this.options.menuOptions),this.linkTypeMenu=new p(e)},e.prototype.toggleConditionPicked=function(t,e){var n,i;void 0===e&&(e=void 0),t&&(n=this.slot.querySelector("div[data-id="+t.id+"][data-condrow], div[data-id="+t.id+"] > div[data-group-row]"))&&(i=n.classList.contains("active"));for(var o=this.slot.querySelectorAll("."+this.cssPrefix+"-row"),r=0;r<o.length;r++){var s=o[r];s.hasAttribute("data-group-row")?this.options.alwaysShowButtonsInGroups||Object(a.i)(s).data("show-buttons",null):this.options.alwaysShowButtonsInConditions||Object(a.i)(s).data("show-buttons",null),Object(a.i)(s).removeClass("active")}n&&!i&&Object(a.i)(n).addClass("active").data("show-buttons","")},e.prototype.showLandingSlot=function(){var t=this.slot.querySelector(".eqjs-qp-conditions-root");t&&(t.appendChild(this.landingSlot),this.landingSlot.scrollIntoView({block:"center",behavior:"smooth"}))},e.prototype.hideLangindSlot=function(){this.landingSlot.parentElement&&this.landingSlot.parentElement.removeChild(this.landingSlot)},e}(s.Widget),Ct=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)}}(),bt=function(t){function e(e){var n=t.call(this,e)||this;return n.options={applyOnClose:!0,showApplyButton:!0,showClearButton:!0,queryPanel:{showAddRow:!0,showCheckboxes:!0,alwaysShowButtonsInGroups:!0}},n.headerClickListener=n.headerClickHandler.bind(n),n.group=s.WidgetGroup.Query,n}return Ct(e,t),e.prototype.getWidgetType=function(){return"filterBar"},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-fb"},enumerable:!0,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.qpElement=Object(a.i)("div").addClass(this.cssPrefix+"-querypanel").toDOM(),this.queryPanel=new vt(this.qpElement),this.queryPanel.init(e,this.options.queryPanel||{}),this.attachQueryObserver()},e.prototype.setOptions=function(t){this.options=r.i.assignDeep(this.options,t)},e.prototype.applyBtnClick=function(t){this.applyFilter()},e.prototype.clearBtnClick=function(t){this.clearFilter()},e.prototype.showQueryPanel=function(t){var e=this;Object(a.r)(this.qpBlock,200,(function(){e.updateHeader(),t&&t()}))},e.prototype.hideQueryPanel=function(){var t=this;Object(a.s)(this.qpBlock,200,(function(){t.updateHeader(),t.options.applyOnClose&&t.applyFilter()}))},e.prototype.headerClickHandler=function(t){t.preventDefault(),Object(a.i)(this.qpBlock).isVisible()?this.hideQueryPanel():this.showQueryPanel()},e.prototype.updateHeader=function(){if(this.headerTextElement){var t="",e=this.getContext().getQuery();e&&(t=e.getConditionsText()),""==t&&(t=r.g.getText("StrNoFilterDefined")),Object(a.i)(this.headerTextElement).text(t).attr("title",t),!e||e.isEmptyConditions()?(Object(a.i)(this.headerTextElement).hide(),Object(a.i)(this.headerLinkElement).show(),Object(a.i)(this.qpBlock).isVisible()||(Object(a.i)(this.headerArrowBlock).hide(),this.headerElement.style.cursor="",this.headerElement.removeEventListener("click",this.headerClickListener))):(this.headerElement.style.cursor="pointer",this.headerElement.removeEventListener("click",this.headerClickListener),this.headerElement.addEventListener("click",this.headerClickListener),Object(a.i)(this.headerTextElement).show(),Object(a.i)(this.headerLinkElement).hide(),Object(a.i)(this.headerArrowBlock).show()),Object(a.i)(this.qpBlock).isVisible()?this.headerArrowElement.classList.add(this.cssPrefix+"-header-arrowUp"):this.headerArrowElement.classList.remove(this.cssPrefix+"-header-arrowUp"),this.textResize()}},e.prototype.render=function(){var t=this;Object(a.i)(this.slot).addClass(this.cssPrefix+"-container").addClass(u.a.getMobileCssClass()).addChild("div",(function(e){return t.headerElement=e.addClass(t.cssPrefix+"-header").addChild("div",(function(e){return t.headerIconElement=e.addClass(t.cssPrefix+"-header-icon").toDOM()})).addChild("div",(function(e){return t.headerTextBlock=e.addClass(t.cssPrefix+"-header-textblock").addChild("div",(function(e){return t.headerTextElement=e.addClass(t.cssPrefix+"-header-text").toDOM()})).addChild("div",(function(e){return t.headerLinkElement=e.addClass(t.cssPrefix+"-header-text "+t.cssPrefix+"-header-link").text(r.g.getText("StrNoFilterClickToAdd")).hide().on("click",(function(){t.queryPanel.showEntitiesMenu({anchor:t.headerLinkElement,selectedIds:null,itemSelectedCallback:function(e,n){var i=e.id;t.showQueryPanel((function(){var e=t.getContext().getQuery(),n={parent:e.getRootCondition(),attributeId:i},o=e.addSimpleCondition(n);o&&e.fireConditionsChangedEvent(s.QueryChangeAction.Add,o)}))}})})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.headerArrowBlock=e.addClass(t.cssPrefix+"-header-arrowblock").addChild("div",(function(e){return t.headerArrowElement=e.addClass(t.cssPrefix+"-header-arrow").toDOM()})).toDOM()})).toDOM()})).addChild("div",(function(e){return t.qpBlock=e.addClass(t.cssPrefix+"-querypanelblock").addClass(u.a.getMobileCssClass()).hide().addChildElement(t.qpElement).toDOM()})),(this.options.showApplyButton||this.options.showClearButton)&&(this.buttonsBlock=Object(a.i)("div",this.qpBlock).addClass(this.cssPrefix+"-buttonsblock").addClass(u.a.getMobileCssClass()).toDOM()),this.options.showApplyButton&&Object(a.i)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass(this.cssPrefix+"-button "+this.cssPrefix+"-button-apply").text(r.g.getText("ButtonApply")).on("click",this.applyBtnClick.bind(this)),this.options.showClearButton&&Object(a.i)("a",this.buttonsBlock).attr("href","javascript:void(0)").addClass(this.cssPrefix+"-button "+this.cssPrefix+"-button-clear").text(r.g.getText("CmdClear")).on("click",this.clearBtnClick.bind(this)),window.addEventListener("resize",(function(){t.textResize()})),this.updateHeader(),this.queryPanel.refresh(),setTimeout((function(){return t.textResize()}),500)},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.applyFilter=function(){this.options.applyFilterCallback&&this.options.applyFilterCallback()},e.prototype.clearFilter=function(){var t=this.getContext().getQuery();t&&(t.clearConditions(),t.fireConditionsChangedEvent(s.QueryChangeAction.All))},e.prototype.textResize=function(){this.headerTextBlock.style.width=this.slot.clientWidth-this.headerIconElement.offsetWidth-(Object(a.i)(this.headerArrowBlock).isVisible()?this.headerArrowBlock.offsetWidth:0)+"px"},e.prototype.destroyCore=function(){this.queryPanel&&this.queryPanel.destroy(),this.detachQueryObserver(),this.slot.innerHTML=""},e.prototype.attachQueryObserver=function(){var t=this,e=this.getContext().getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.updateHeader()}))},e.prototype.detachQueryObserver=function(){var t=this.getContext().getQuery();t&&t.removeChangedCallback(this.queryEventCallbackId)},e}(s.Widget),xt=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)}}(),wt=function(t){function e(e){var n=t.call(this,e)||this;return n.contentElement=e,n.group=s.WidgetGroup.Result,n}return xt(e,t),e.prototype.getWidgetType=function(){return"htmlContent"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultContent&&this.render()},e.prototype.render=function(){this.context.resultContent&&(this.contentElement.innerHTML+=this.context.resultContent)},e.prototype.clear=function(){this.contentElement.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(s.Widget),Et=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)}}(),Tt=function(t){function e(e){var n=t.call(this,e)||this;return n.options={maxButtonCount:10,useBootstrap:!1},n}return Et(e,t),e.prototype.getWidgetType=function(){return"eqHtmlGrid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n)},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t)},e.prototype.refreshCore=function(){t.prototype.refreshCore.call(this),this.renderPageNavigator()},e.prototype.destroyCore=function(){this.slot.innerHTML=""},e.prototype.renderPageNavigator=function(){var t=this,e=document.getElementById("PageNavigator");if(e){var n=parseInt(e.getAttribute("data-pagecount")),i=parseInt(e.getAttribute("data-pageindex"));if(n>1){var o=function(e){var n=e.target;if(n.hasAttribute("data-page")){var i=parseInt(n.getAttribute("data-page"));t.context.fetchDataChunk({chunk:{page:i},success:function(){t.context.refreshWidgets(s.WidgetGroup.Result)}})}},r=this.options.maxButtonCount||10,a=i-1,l=a-a%r+1,u=l+r-1;u>n&&(u=n);var c=document.createElement("ul");this.options.useBootstrap?c.className="pagination":c.className="eqv-pagination",this.options.pageItemCssClass&&(c.className+=" "+this.options.pageItemCssClass);var d=document.createElement("li");this.options.useBootstrap&&(d.className="page-item");var h=document.createElement("span");if(h.setAttribute("aria-hidden","true"),this.options.useBootstrap&&(h.className="page-link"),1==l)d.className+=" disabled";else{if(this.options.useBootstrap)(h=document.createElement("a")).setAttribute("href","javascript:void(0)"),h.setAttribute("data-page",""+(l-1)),h.className="page-link";else(f=document.createElement("a")).setAttribute("href","javascript:void(0)"),f.setAttribute("data-page",""+(l-1)),h=f;h.addEventListener("click",o)}h.innerHTML="&laquo;",d.appendChild(h),c.appendChild(d);for(var p=l;p<=u;p++)d=document.createElement("li"),this.options.useBootstrap&&(d.className="page-item"),p==i&&(d.className+=" active"),(h=document.createElement("a")).setAttribute("href","javascript:void(0)"),h.innerHTML=p.toString(),h.setAttribute("data-page",p.toString()),h.className="page-link",h.addEventListener("click",o),d.appendChild(h),c.appendChild(d);if(d=document.createElement("li"),this.options.useBootstrap&&(d.className="page-item"),(h=document.createElement("span")).setAttribute("aria-hidden","true"),this.options.useBootstrap&&(h.className="page-link"),u==n)d.className+="disabled";else{var f;if(this.options.useBootstrap)(h=document.createElement("a")).setAttribute("href","javascript:void(0)"),h.setAttribute("data-page",""+(u+1)),h.className+=" page-link";else(f=document.createElement("a")).setAttribute("href","javascript:void(0)"),f.setAttribute("data-page",""+(u+1)),h=f;h.addEventListener("click",o)}h.innerHTML="&raquo;",d.appendChild(h),c.appendChild(d),e.appendChild(c)}}},e}(wt),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)}}(),kt=function(t){function e(e){var n=t.call(this,e)||this;return n.options={useCustomLocaleSettings:!1},n.slot=e,n.group=s.WidgetGroup.Result,n}return Dt(e,t),e.prototype.getWidgetType=function(){return"grid"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),n&&r.i.assignDeep(this.options,n)},e.prototype.refreshCore=function(){this.clear(),this.context.resultTable&&this.render()},e.prototype.render=function(){this.options.beforeTableRendering&&this.options.beforeTableRendering(this.context.resultTable),this.applyDisplayFormats()},e.prototype.applyDisplayFormats=function(){},e.prototype.clear=function(){this.slot.innerHTML=""},e}(s.Widget),Mt=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)}}(),St=function(){return St=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},St.apply(this,arguments)},Bt=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCustomTotalsSettings=!1,n.options={autoRefresh:!0},n.group=s.WidgetGroup.Result,n}return Mt(e,t),e.prototype.getWidgetType=function(){return"easyGrid"},e.prototype.init=function(e,n){var i=this;t.prototype.init.call(this,e,n);var o=St(St({},n),{slot:this.slot,dataTable:e.resultTable});this.options=r.i.assign(this.options,n),o.onAddColumnClick=function(t){return i.addColumnClickHandler(t)},o.onColumnMoved=function(t){return i.columnMovedHandler(t)},o.aggregates?this.hasCustomTotalsSettings=!0:o.aggregates={settings:e.getQuery().getAggregationSettings(),calculator:null},o.aggregates.calculator=this.context.getServices().getAggregatesCalculator(),this.destroy(),this.grid=new a.e(o),this.options.autoRefresh&&this.attachQueryObserver()},e.prototype.refreshCore=function(){this.clear(),this.updateTotalsSettings(),this.render()},e.prototype.render=function(){this.createEntitiesMenu(),this.grid.refresh()},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;!n||n.part!=s.QueryChangePart.Columns&&n.part!=s.QueryChangePart.All||(e.data.source==t?t.grid.refresh():t.refresh())}))},e.prototype.destroyCore=function(){this.detachQueryObserver(),this.grid&&this.grid.destroy(),this.slot.innerHTML=""},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getContext().getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.updateTotalsSettings=function(){var t=this.getContext();if(!this.hasCustomTotalsSettings){var e=t.getQuery().getAggregationSettings();this.grid.options.aggregates.settings=e}},e.prototype.createEntitiesMenu=function(){var t=this.getContext().getModel();if(t&&!t.isEmpty()){var e=this.slot.id;e&&(e+="-EntitiesMenu");var n={items:t.getEntitiesTree({addUIC:!1,addUIR:!0,addUIS:!1}),id:e};r.i.assign(n,this.options.menuOptions),this.entitiesMenu=new p(n)}},e.prototype.getModel=function(){return this.context.getModel()},e.prototype.getQuery=function(){return this.context.getQuery()},e.prototype.clear=function(){this.grid&&this.grid.clear()},e.prototype.addColumnClickHandler=function(t){var e=this;this.entitiesMenu.showMenu({anchor:t.sourceEvent.target,selectedIds:null,itemSelectedCallback:function(t,n){var i=t.id;return e.addNewColumn(i),!1}})},e.prototype.columnMovedHandler=function(t){var e=this.getQuery(),n=r.i.findItemIndexById(e.getColumns(),t.columnId);n>=0&&(e.moveColumn(n,t.newIndex),e.fireChangedEvent({part:s.QueryChangePart.Columns,action:s.QueryChangeAction.All,source:this}))},e.prototype.addNewColumn=function(t){var e=this,n=this.getContext().getModel(),i=this.getContext().getQuery();if(this.getContext().getQuery())return this.addColumn(function(t){var o=n.getAttributeById(t);if(!o)return null;if(!o.useInSorting){if(!o.lookupAttr)return null;if(t=o.lookupAttr,!(o=n.getAttributeById(t))||!o.useInSorting)return null}var r=i.createColumn();return r.caption=e.getDefaultColumnCaption(o),r.sorting=s.SortDirection.None,r.sortIndex=-1,r.expr.tag=s.ExprTag.EntityAttribute,r.expr.setValue(t,!0),r.params.concat(o.params),r}(t))},e.prototype.getDefaultColumnCaption=function(t){var e=this.options.titleElementFormat||this.options.attrElementFormat;return this.getContext().getModel().getAttributeText(t,e)},e.prototype.addColumn=function(t){var e=this.getContext().getQuery();if(e&&(t=this.checkColumn(t)))return t=e.addColumn({caption:t.caption,attributeId:t.expr.value,sorting:t.sorting,sortIndex:t.sortIndex}),e.fireChangedEvent({part:s.QueryChangePart.Columns,action:s.QueryChangeAction.Add,changee:t,source:this}),t},e.prototype.checkColumn=function(t){for(var e=this.getContext().getQuery().getColumns(),n=JSON.stringify(t.expr.saveToData()),i=0;i<e.length;i++){if(JSON.stringify(e[i].expr.saveToData())===n)return null}return t},e}(kt),It=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)}}(),Ot=function(t){function e(e){var n=t.call(this,e)||this;return n.panel=e,n.group=s.WidgetGroup.Statement,"TEXTAREA"!==n.panel.tagName&&(n.panel.innerHTML='<div class="eqv-sql-panel-result"></div>',n.panel=n.panel.querySelector("div")),n}return It(e,t),e.prototype.getWidgetType=function(){return"statementPanel"},e.prototype.refreshCore=function(){this.clear(),this.render()},e.prototype.render=function(){this.panel.textContent=this.context.resultStatement?this.context.resultStatement:"";var t=this.panel.innerHTML.replace(/\r\n/g,"<br />").replace(/ /g,"&nbsp;&nbsp;");this.panel.innerHTML=t},e.prototype.destroyCore=function(){this.clear()},e.prototype.clear=function(){this.panel.innerHTML=""},e}(s.Widget),Pt=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)}}(),At=function(t){function e(e){var n=t.call(this,e)||this;return n.element=e,n.element.style.display="none",n.group=s.WidgetGroup.All,n}return Pt(e,t),e.prototype.getWidgetType=function(){return"processIndicator"},e.prototype.onProcessStartCore=function(){this.element.style.display=""},e.prototype.onProcessEndCore=function(){this.element.style.display="none"},e}(s.Widget),Lt=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)}}(),Rt=function(t){function e(e){var n=t.call(this,e)||this;return n.clickHandler=function(){return n.openDialog()},n.columnsBar=null,n.queryPanel=null,n.ddQuery=null,n.cssPrefix=l.b,n.group=s.WidgetGroup.None,n}return Lt(e,t),e.prototype.getWidgetType=function(){return"manageDrillDown"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=n,this.refresh(),this.slot.addEventListener("click",this.clickHandler)},e.prototype.destroyCore=function(){this.slot.removeEventListener("click",this.clickHandler)},e.prototype.openDialog=function(){var t=this,e=this.context.getServices().getDialogService(),n=this.context.getQuery(),i=this.context.getModel(),o=Object(a.i)("div").addClass(this.cssPrefix+"-manage-drilldown").addChildElement(this.renderColumnsBarBlock()).addChildElement(this.renderQueryPanelBlock()).toDOM(),l=i.addOrUpdateOperator({id:"BindToParentColumn",caption:"is bound to",format:"{expr1} [[is bound to]] {expr2}",paramCount:2,kind:s.DataKind.ParentColumn,appliedTypes:[r.d.String,r.d.Bool,r.d.Float,r.d.Int32,r.d.Int64,r.d.Word]});l.defaultOperand.dataType=r.d.String,l.defaultOperand.kind=s.DataKind.ParentColumn,i.runThroughEntities((function(t){var e=t.operators.indexOf(l.id);e>0&&r.i.moveArrayItem(t.operators,e,0)}),null),this.ddQuery=new s.Query(i,null,{parent:n});var u=this.context.getQuery().getDrillDowns();if(u.length){var c=u[0];this.ddQuery.loadFromData(c.toJSONData())}e.open({title:"Manage Drill Down",body:o,cancelable:!0,closable:!1,beforeOpen:function(){var e=o.getElementsByClassName(t.cssPrefix+"-columnsbar-slot")[0];t.columnsBar=new P(e,t.ddQuery),t.columnsBar.init(t.context,t.options.columnsBar);var n=o.getElementsByClassName(t.cssPrefix+"-querypanel-slot")[0];t.queryPanel=new vt(n,t.ddQuery),t.queryPanel.init(t.context,t.options.queryPanel),t.columnsBar.refresh(),t.queryPanel.refresh()},onSubmit:function(){return t.submitDialog()},onDestroy:function(){t.destroyDialog()}})},e.prototype.renderQueryPanelBlock=function(){var t=this;return Object(a.i)("div").addClass(this.cssPrefix+"-querypanel-block").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-querypanel-caption")})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-querypanel-slot")})).toDOM()},e.prototype.renderColumnsBarBlock=function(){var t=this;return Object(a.i)("div").addClass(this.cssPrefix+"-columnsbar-block").addChild("div",(function(e){return e.addClass(t.cssPrefix+"-columnsbar-caption")})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-columnsbar-slot")})).toDOM()},e.prototype.submitDialog=function(){if(this.ddQuery.tryValidate({checkExpressions:!0})){var t=this.context.getQuery().getDrillDowns();if(t.length)t[0].loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();else if(!this.ddQuery.isEmpty())this.context.getQuery().addDrillDown().loadFromData(this.ddQuery.toJSONData()),this.context.getQuery().fireChangedEvent();return!0}return!1},e.prototype.destroyDialog=function(){this.context.getModel().removeOperator("BindToParentColumn",!0),this.ddQuery=null,this.columnsBar&&this.columnsBar.destroy(),this.columnsBar=null,this.queryPanel&&this.queryPanel.destroy(),this.queryPanel=null},e}(s.Widget);!function(t){t.DataGrid="DATA_GRID",t.Chart="CHART",t.PivotTable="PIVOT_TABLE"}(G||(G={}));var _t,Ft=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this;if(void 0===t&&(t=null),!this.promise){var n=this.context.getExportFormats();if(0==n.length)throw Error("No exporter has been registered.");t=t||n[0],this.promise=new Promise((function(n,i){var o=e.context.getServices().getDialogService(),r=Object(a.i)("div").addClass("kdlg-form-section").addChild("div",(function(n){return n.addClass("kfrm-form").addChild("div",(function(n){return n.addClass("kfrm-fields col-a-1 label-align-right").addChild("label",(function(t){return t.addClass("kdlg-form-label","kflex-20").attr("for","export_format").addText(s.i18n.getText("ExportDlgFmtLabel"))})).addChild("div",(function(n){return n.addClass("kfrm-select").addChild("select",(function(n){n.attr("name","export_format").id("exportFormat");for(var i=0,o=e.context.getExportFormats();i<o.length;i++){var r=o[i];n.addOption({value:r,title:s.i18n.getText(r)||r,selected:t==r})}}))}))}))})).toDOM();o.open({title:s.i18n.getText("ExportDlgTitle"),body:r,onSubmit:function(){var t=r.querySelector("#exportFormat").value;return e.context.exportResult({format:t,success:n,error:i}),!0}})}))}return this.promise.finally((function(){return e.promise=null}))},t}(),jt=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},Qt=function(t,e){var n,i,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,i=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){s.label=r[1];break}if(6===r[0]&&s.label<o[1]){s.label=o[1],o=r;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(r);break}o[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}},Nt=function(){function t(t,e){var n=this;this.container=t,this.title=r.g.getText("Facets","DefaultFacetTitle"),this.cssPrefix="eqjs-facet",this.dialogTitle=r.g.getText("Facets","DefaultDlgTitle"),this.options={},this.canDisplayFlag=!0,this.downloadAllClickHandler=function(){var t=n.getContext().resultTable;if(t.elasticChunks){var e=n.getDialogService().openProgress({title:r.g.getText("Facets","LoadDataDlgTitle"),onSubmit:function(){return n.refresh()},determinated:!1});n.loadElasticChunk().then((function(t){e.submit()})).catch((function(t){e.submit(),n.getContext().throwError(t)}))}else{var i=t.getCachedRows().length,o=t.getTotal()-t.getCachedCount(),s=n.getDialogService().openProgress({title:r.g.getText("Facets","LoadDataDlgTitle"),content:r.g.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}","0").replace("{totalRecs}",""+o),onSubmit:function(){return n.refresh()},determinated:!0}),a=0;setTimeout((function(){t.getRows({offset:i,limit:o}).then((function(t){var e=(a+=t.length)/o;s.updateContent(r.g.getText("Facets","LoadDataDlgContent").replace("{loadedRecs}",""+a).replace("{totalRecs}",""+o)),s.updateProgress(e)})).catch((function(t){s.submit(),n.getContext().throwError(t)}))}),10)}},r.i.assignDeep(this.options,e)}return t.prototype.init=function(t){this.slot=t,this.contentDiv=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-content").toDOM(),this.displayMessageDiv=Object(a.i)("div",this.slot).hide().toDOM()},t.prototype.showSettingsDialog=function(){var t=this;return new Promise((function(e){var n=t.getDialogService(),i=t.renderDialogContent(),o=n.open({title:t.dialogTitle,body:i,cancelable:!0,closable:!1,onSubmit:function(){var n=t.submitSettingsDialog();return n&&e(!0),n},onCancel:function(){e(!1)}});t.afterDialogOpened(o)}))},t.prototype.afterDialogOpened=function(t){},t.prototype.renderDialogContent=function(){var t,e=Object(a.i)("div").addClass("kfrm-form").addChild("div",(function(e){return t=e.addClass(u.a.IsIE()?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right").toDOM()}));return this.renderFormFields(e.toDOM(),t),e.toDOM()},t.prototype.renderFormFields=function(t,e){var n=this,i=e;u.a.IsIE()&&(i=Object(a.i)("div",e).addClass("kfrm-field-ie").toDOM()),Object(a.i)(i).addChild("label",(function(t){return t.attr("for","tab_name").addText(r.g.getText("Facets","TabNameLabel"))})).addChild("input",(function(t){return t.id("facetTabName").name("tab_name").type("text").attr("value",n.title)}))},t.prototype.submitSettingsDialog=function(){var t=document.querySelector("#facetTabName");return 0!=t.value.length&&(this.title=t.value,!0)},t.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},t.prototype.canDisplay=function(){var t=this.getContext().resultTable;return t.getCachedCount()==t.getTotal()},t.prototype.showUnableDisplayMessage=function(t){var e=this.getContext().resultTable;this.displayMessageDiv.innerHTML=t||r.g.getText("Facets","ErrNotEnoughData").replace("{totalRecs}",""+e.getTotal()).replace("{cachedRecs}",""+e.getCachedCount()).replace(/\[(.*)\]/g,"<a href='javascript:void(0)' class=\""+this.cssPrefix+'-download-all-link">$1</a>');var n=this.displayMessageDiv.querySelector("a."+this.cssPrefix+"-download-all-link");n&&n.addEventListener("click",this.downloadAllClickHandler),Object(a.i)(this.contentDiv).hide(),Object(a.i)(this.displayMessageDiv).show()},t.prototype.hideUnableDisplayMessage=function(){Object(a.i)(this.displayMessageDiv).hide(),Object(a.i)(this.contentDiv).show()},t.prototype.getContext=function(){return this.container.getContext()},t.prototype.getQuery=function(){return this.getContext().getQuery()},t.prototype.saveToData=function(){return{title:this.title,type:this.getType()}},t.prototype.loadFromData=function(t){t&&(this.title=t.title)},t.prototype.refresh=function(){this.hideUnableDisplayMessage(),this.canDisplay()?this.refreshCore():this.showUnableDisplayMessage()},t.prototype.loadElasticChunk=function(){return jt(this,void 0,void 0,(function(){var t,e,n=this;return Qt(this,(function(i){return t=this.getContext().resultTable,e=t.getCachedRows().length,[2,t.getRows({offset:e,limit:t.chunkSize}).then((function(e){return t.totalIsKnown()?Promise.resolve():n.loadElasticChunk()}))]}))}))},t.prototype.onResize=function(){},t}();!function(t){t[t.Column=3]="Column",t[t.Histogram=4]="Histogram",t[t.Bar=5]="Bar",t[t.Combo=6]="Combo",t[t.Area=7]="Area",t[t.Line=9]="Line",t[t.Pie=10]="Pie",t[t.Polar=11]="Polar",t[t.Doughnut=12]="Doughnut",t[t.Radar=13]="Radar",t[t.SteppedLine=14]="SteppedLine"}(_t||(_t={}));var qt,Ht=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)}}(),Wt=function(t){function e(e){var n=t.call(this,e)||this;return n.chartType=_t.Pie,n.supportedChartTypes=[],n.dataTable=null,n.potentialLabelColumns=[],n.potentialDataColumns=[],n.labelColumn=-1,n.dataColumns=[],n.options={chartType:_t.Pie,showOnPaging:!1,hideSettings:!1,legend:{show:!1,position:"right"}},n.element=e,n.group=s.WidgetGroup.Result,n}return Ht(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-chart"},enumerable:!0,configurable:!0}),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.dataTable=e.resultTable,this.setOptions(n)},e.prototype.hasData=function(){var t=null!=this.dataTable;return t&&(t=this.dataTable.getCachedCount()>0),t},e.prototype.hasColumnsForChart=function(){return this.potentialLabelColumns.length>0&&this.potentialDataColumns.length>0},e.prototype.refreshCore=function(){this.prepareChartData(),this.render()},e.prototype.setOptions=function(t){if(r.i.assignDeep(this.options,t),this.supportedChartTypes=this.getSupportedChartTypes(),0==this.supportedChartTypes.length)throw Error("Chart widget should support at least one chart type");t.chartType&&this.supportedChartTypes.indexOf(t.chartType)>=0?this.chartType=t.chartType:this.chartType=this.supportedChartTypes[0]},e.prototype.getOptions=function(){return this.options},e.prototype.getChartTypeName=function(t){switch(t){case _t.Area:return r.g.getText("ChartType","Area");case _t.Bar:return r.g.getText("ChartType","Bar");case _t.Column:return r.g.getText("ChartType","Column");case _t.Combo:return r.g.getText("ChartType","Combo");case _t.Doughnut:return r.g.getText("ChartType","Doughnut");case _t.Polar:return r.g.getText("ChartType","Polar");case _t.Radar:return r.g.getText("ChartType","Radar");case _t.Histogram:return r.g.getText("ChartType","Histogram");case _t.Line:return r.g.getText("ChartType","Line");case _t.SteppedLine:return r.g.getText("ChartType","SteppedLine");default:return r.g.getText("ChartType","Pie")}},e.prototype.updateSettings=function(t,e){void 0===e&&(e=!0),void 0!==t.showLegend&&(this.options.legend=this.options.legend||{},this.options.legend.show=t.showLegend),this.chartType=t.type,this.labelColumn=t.labelColumn,this.dataColumns[0]=t.dataColumn,e&&this.updateChartColumns()},e.prototype.prepareChartData=function(){var t=this;if(this.dataTable){this.potentialLabelColumns=[],this.potentialDataColumns=[];for(var e=this.dataTable.columns.count,n=0;n<e;n++){var i=this.dataTable.columns.get(n),o=i.type,s=i.label;this.potentialLabelColumns.push({idx:n,label:s}),r.i.isNumericType(o)&&this.potentialDataColumns.push({idx:n,label:s})}if(-1!=this.labelColumn?this.potentialLabelColumns.filter((function(e){return e.idx==t.labelColumn})).length||(this.labelColumn=-1):this.labelColumn=this.potentialLabelColumns.length>0?this.potentialLabelColumns[0].idx:-1,this.dataColumns.length){var a=this.potentialDataColumns.map((function(t){return t.idx}));this.dataColumns=this.dataColumns.filter((function(t){return a.indexOf(t)>=0})),this.dataColumns.length||(this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[])}else this.dataColumns=this.potentialDataColumns.length>0?[].concat(this.potentialDataColumns[0].idx):[];this.initChart()}},e.prototype.getSupportedChartTypes=function(){var t=this;return(this.options.supportedChartTypes?this.options.supportedChartTypes:Object.keys(_t).map((function(t){return _t[t]}))).filter((function(e){return t.hasChartTypes.indexOf(e)>=0}))},e.prototype.getCurrentChartType=function(){return this.chartType},e.prototype.render=function(){var t=this;if(this.clear(),this.hasData()&&this.hasColumnsForChart()&&this.context.resultTable.getTotal()==this.context.resultTable.getCachedCount()){var e=document.createElement("div");Object(a.f)(e,this.cssPrefix+"-header");var n=document.createElement("div");if(Object(a.f)(n,this.cssPrefix+"-main"),this.canDraw()){for(var i=document.createElement("select"),o=0,r=this.supportedChartTypes;o<r.length;o++){var s=r[o],l=document.createElement("option");l.value=s.toString(),l.text=this.getChartTypeName(s),i.appendChild(l)}i.value=this.chartType.toString(),e.appendChild(i),i.addEventListener("change",(function(e){var n=e.target.value;t.chartType=parseInt(n),t.refresh()})),this.settingsDiv=document.createElement("div"),Object(a.f)(this.settingsDiv,this.cssPrefix+"-settings"),Object(a.o)(this.settingsDiv),n.appendChild(this.settingsDiv),this.chartDiv=document.createElement("div"),Object(a.f)(this.chartDiv,this.cssPrefix+"-content"),Object(a.o)(this.chartDiv),n.appendChild(this.chartDiv),this.initSettingsDiv();var u=document.createElement("div");Object(a.f)(u,this.cssPrefix+"-settings-icon"),u.title="Settings",e.appendChild(u),u.addEventListener("click",(function(e){t.toggleSettings()})),this.drawChart(100)}else this.addContentDiv(n,"Unable to render the chart. None of the supported chart libraries (ChartJS, Google Charts, etc) is found.");this.options.hideSettings||this.element.appendChild(e),this.element.appendChild(n),this.element.style.display=""}else this.element.style.display="none"},e.prototype.addContentDiv=function(t,e){var n=document.createElement("div");Object(a.f)(n,this.cssPrefix+"-no-data"),n.innerText=e,t.appendChild(n)},e.prototype.clear=function(){this.element.innerHTML=""},e.prototype.drawChart=function(t){var e=this;Object(a.q)(this.chartDiv),t>0?setTimeout((function(){return e.drawCore()}),t):this.drawCore()},e.prototype.initSettingsDiv=function(){var t=this,e=document.createElement("div");e.textContent="SETTINGS",Object(a.f)(e,this.cssPrefix+"-settings-header"),this.settingsDiv.appendChild(e);var n=document.createElement("div");Object(a.f)(n,this.cssPrefix+"-settings-single"),this.settingsDiv.appendChild(n);var i=document.createElement("span");Object(a.q)(i),i.textContent="Label column",n.appendChild(i);var o=document.createElement("select");Object(a.q)(o),n.appendChild(o);for(var r=0,s=this.potentialLabelColumns;r<s.length;r++){var l=s[r];(f=document.createElement("option")).value=l.idx.toString(),f.text=l.label,o.appendChild(f)}this.labelColumn>=0&&(o.value=this.labelColumn.toString()),o.addEventListener("change",(function(e){t.labelColumn=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}));var u=document.createElement("div");Object(a.f)(u,this.cssPrefix+"-settings-single"),this.settingsDiv.appendChild(u);var c=document.createElement("span");Object(a.q)(c),c.textContent="Data column",u.appendChild(c);var d=document.createElement("select");Object(a.q)(d),u.appendChild(d);for(var h=0,p=this.potentialDataColumns;h<p.length;h++){var f;l=p[h];(f=document.createElement("option")).value=l.idx.toString(),f.text=l.label,d.appendChild(f)}this.dataColumns.length>0&&this.dataColumns[0]>=0&&(d.value=this.dataColumns[0].toString()),d.addEventListener("change",(function(e){t.dataColumns[0]=parseInt(e.target.value),t.updateChartColumns(),t.toggleSettings((function(){t.drawChart(100)}))}))},e.prototype.getPotentialLabelColumns=function(){return this.potentialLabelColumns},e.prototype.getPotentialDataColumns=function(){return this.potentialDataColumns},e.prototype.getLabelColumnIndex=function(){return this.labelColumn},e.prototype.getDataColumnIndex=function(){return this.dataColumns[0]},e.prototype.toggleSettings=function(t){var e,n;Object(a.p)(this.chartDiv)?(e=this.chartDiv,n=this.settingsDiv):(e=this.settingsDiv,n=this.chartDiv),Object(a.t)(e,n,{complete:t})},e}(s.Widget),Gt=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)}}(),Vt=function(t){function e(e){var n=t.call(this,e)||this;return n.colors=["#4dc9f6","#f67019","#f53794","#537bc4","#acc236","#166a8f","#00a950","#58595b","#8549ba"],n.chartLabels=[],n.chartColumns=[],n.hasChartTypes=[_t.Column,_t.Bar,_t.Area,_t.Line,_t.SteppedLine,_t.Doughnut,_t.Polar,_t.Radar,_t.Pie],n.options.legend={show:!1,position:"bottom"},n}return Gt(e,t),e.prototype.getWidgetType=function(){return"chartChartJs"},e.hasChartJs=function(){return"undefined"!=typeof Chart},e.prototype.canDraw=function(){return e.hasChartJs()},e.prototype.initChart=function(){e.hasChartJs()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&this.updateChartColumns()},e.prototype.drawCore=function(){if(e.hasChartJs()&&this.dataTable&&this.dataTable.getCachedCount()>0){var t=this.generateConfig(),n=this.getChartCanvas(this.chartDiv).getContext("2d");new Chart(n,t)}},e.prototype.updateChartColumns=function(){if(this.dataTable){this.chartLabels=[],this.chartColumns=[];for(var t=this.dataTable.getCachedRows(),e=0;e<t.length;e++)this.chartLabels.push(t[e].getValue(this.labelColumn)),this.chartColumns.push(t[e].getValue(this.dataColumns[0]))}},e.prototype.getChartCanvas=function(t){var e=t.getElementsByTagName("canvas");return e&&e.length>0?e[0]:Object(a.g)(t,"canvas")},e.prototype.generateConfig=function(){var t,e=[],n=this.dataTable.columns.get(this.dataColumns[0]).label,i=!0;if(this.chartType==_t.Pie||this.chartType==_t.Doughnut||this.chartType==_t.Polar||this.chartType==_t.Bar||this.chartType==_t.Column)for(var o=0;o<this.chartLabels.length;o++)e.push(this.colors[o%this.colors.length]);else e=[this.colors[3]];this.chartType!=_t.Line&&this.chartType!=_t.SteppedLine||(i=!1,t=this.colors[3]),this.options.legend=this.options.legend||{};var r={data:this.chartColumns,backgroundColor:e,borderColor:t,label:n,fill:i};this.chartType==_t.SteppedLine&&(r.stepped=this.chartType===_t.SteppedLine,r.steppedLine=this.chartType===_t.SteppedLine);var s=this.options.legend.show&&(this.chartType==_t.Pie||this.chartType==_t.Radar||this.chartType==_t.Polar||this.chartType==_t.Doughnut);return{type:this.getChartType(),data:{datasets:[r],labels:this.chartLabels},options:{legend:{display:s,position:this.options.legend.position||"bottom"},title:{display:!0,text:n}}}},e.prototype.getChartType=function(){switch(this.chartType){case _t.Column:return"bar";case _t.Bar:return"horizontalBar";case _t.Area:case _t.SteppedLine:case _t.Line:return"line";case _t.Doughnut:return"doughnut";case _t.Polar:return"polarArea";case _t.Radar:return"radar";case _t.Pie:default:return"pie"}},e}(Wt),zt=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)}}(),Ut=function(t){function e(e){var n=t.call(this,e)||this;return n.hasChartTypes=[_t.Column,_t.Bar,_t.Histogram,_t.Combo,_t.Area,_t.Line,_t.SteppedLine,_t.Pie,_t.Doughnut],n.options.legend={show:!0,position:"right"},n}return zt(e,t),e.prototype.getWidgetType=function(){return"chartGoogle"},e.prototype.canDraw=function(){return e.hasGoogleCharts()},e.hasGoogleCharts=function(){return"undefined"!=typeof google&&void 0!==google.charts},e.prototype.initChart=function(){e.hasGoogleCharts()&&this.labelColumn>=0&&this.dataColumns&&this.dataColumns.length>0&&(this.googleDataView=new google.visualization.DataView(this.convertToGoogleFormat()),this.updateChartColumns())},e.prototype.convertToGoogleType=function(t){switch(t){case r.d.Date:return"date";case r.d.DateTime:return"datetime";case r.d.Time:return"timeofday";case r.d.Byte:case r.d.Word:case r.d.Int32:case r.d.Int64:case r.d.Currency:case r.d.Float:return"number";default:return"string"}},e.prototype.convertToGoogleValue=function(t,e){return e===r.d.Bool?t.toString():t},e.prototype.convertToGoogleFormat=function(){for(var t=new google.visualization.DataTable,e=this.dataTable.columns,n=0;n<e.count;n++){var i=e.get(n);t.addColumn(this.convertToGoogleType(i.type),i.label,i.id)}var o=this.dataTable.getCachedRows();t.addRows(o.length);for(n=0;n<o.length;n++)for(var r=o[n],s=0;s<e.count;s++)t.setCell(n,s,this.convertToGoogleValue(r.getValue(s),e.get(s).type));return t},e.prototype.drawCore=function(){if(null!=this.googleDataView){this.options.legend=this.options.legend||{};var t={width:"100%",height:"100%",chartArea:{width:this.getChartAreaWidth}};this.chartType==_t.Doughnut&&(t.pieHole=.4),this.options.legend.show?t.legend={position:this.options.legend.position}:t.legend="none",this.createChart(this.chartDiv).draw(this.googleDataView,t)}},e.prototype.getChartAreaWidth=function(t){return t==_t.Pie?"100%":"50%"},e.prototype.updateChartColumns=function(){this.googleDataView&&this.googleDataView.setColumns([].concat(this.labelColumn).concat(this.dataColumns))},e.prototype.createChart=function(t){switch(this.chartType){case _t.Column:return new google.visualization.ColumnChart(t);case _t.Histogram:return new google.visualization.Histogram(t);case _t.Bar:return new google.visualization.BarChart(t);case _t.Combo:return new google.visualization.ComboChart(t);case _t.Area:return new google.visualization.AreaChart(t);case _t.Line:return new google.visualization.LineChart(t);case _t.SteppedLine:return new google.visualization.SteppedAreaChart(t);case _t.Pie:case _t.Doughnut:default:return new google.visualization.PieChart(t)}},e}(Wt),Jt=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)}}(),Yt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.g.getText("Facets","Chart","FacetTitle"),e.dialogTitle=r.g.getText("Facets","Chart","DlgTitle"),e}return Jt(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),Ut.hasGoogleCharts()?this.chart=new Ut(this.contentDiv):this.chart=new Vt(this.contentDiv);var n=this.container.options?this.container.options.supportedChartTypes:null;this.chart.init(this.getContext(),{legend:{show:!1},showOnPaging:!0,hideSettings:!0,supportedChartTypes:n}),Object(a.i)(this.slot).hide()},e.prototype.destroy=function(){this.chart&&this.chart.destroy()},e.prototype.getType=function(){return G.Chart},e.prototype.renderFormFields=function(e,n){var i=this;t.prototype.renderFormFields.call(this,e,n);var o=u.a.IsIE(),s=o?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",l=document.createElement("select");l.id="chart_type_selector",l.name="chart_type_selector";for(var c=0,d=this.chart.getSupportedChartTypes();c<d.length;c++){var h=d[c];(b=document.createElement("option")).value=h.toString(),b.text=this.chart.getChartTypeName(h),l.appendChild(b)}l.value=this.chart.getCurrentChartType().toString(),this.settings||(this.chart.prepareChartData(),this.settings={type:this.chart.getCurrentChartType().toString(),labelColumn:""+(this.chart.getLabelColumnIndex()>=0?this.chart.getLabelColumnIndex():""),dataColumn:""+(this.chart.getDataColumnIndex()>=0?this.chart.getDataColumnIndex():""),showLegend:!1});var p=document.createElement("select");p.name="label_column_selector",p.id="label_column_selector";for(var f=0,g=this.chart.getPotentialLabelColumns();f<g.length;f++){var m=g[f];(b=document.createElement("option")).value=m.idx.toString(),b.text=m.label,p.appendChild(b)}p.value=this.settings.labelColumn;var y=document.createElement("select");y.id="data_column_selector",y.name="data_column_selector";for(var v=0,C=this.chart.getPotentialDataColumns();v<C.length;v++){var b;m=C[v];(b=document.createElement("option")).value=m.idx.toString(),b.text=m.label,y.appendChild(b)}y.value=this.settings.dataColumn.toString();var x=n,w=function(){return o?Object(a.i)("div",n).addClass("kfrm-field-ie").toDOM():n};o?Object(a.i)(e).addChildElement(w()):Object(a.i)(n).addChild("div").addChild("div"),x=w(),Object(a.i)(x).addChild("label",(function(t){return t.attr("for","chart_type_selector").text(r.g.getText("Facets","Chart","ChartTypeSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(l)})),x=w(),Object(a.i)(x).addChild("label",(function(t){return t.attr("for","label_column_selector").text(r.g.getText("Facets","Chart","LabelColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(p)})),x=w(),Object(a.i)(x).addChild("label",(function(t){return t.attr("for","data_column_selector").text(r.g.getText("Facets","Chart","DataColumnSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").addChildElement(y)})),x=w(),Object(a.i)(x).addChild("div").addChild("div",(function(t){return t.addClass(s).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("show_legend").type("checkbox"),i.settings.showLegend&&t.attr("checked","")})).addText(" "+r.g.getText("Facets","Chart","ShowLegendLabel"))}))}))},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this),n=document.getElementById("chart_type_selector"),i=parseInt(n.value),o=document.getElementById("label_column_selector"),r=parseInt(o.value),s=document.getElementById("data_column_selector"),a=parseInt(s.value),l=document.getElementById("show_legend").checked;return e&&(this.settings={type:i,labelColumn:r,dataColumn:a,showLegend:l},this.canDisplay()&&this.refresh()),e},e.prototype.getSettings=function(){return this.settings},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&(e.chartType=this.settings.type,e.labelCol=this.settings.labelColumn,e.dataCol=this.settings.dataColumn,e.showLeg=this.settings.showLegend),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings={type:e.chartType,dataColumn:e.dataCol,labelColumn:e.labelCol,showLegend:e.showLeg})},e.prototype.refreshCore=function(){this.chart&&(this.settings&&this.chart.updateSettings(this.settings),this.chart.prepareChartData(),this.chart.refresh())},e.prototype.onResize=function(){this.refresh()},e}(Nt),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)}}();!function(t){t.Sum="SUM",t.Average="AVG",t.Min="MIN",t.Max="MAX",t.Count="COUNT"}(qt||(qt={}));var Xt=/{0:(.*?)}/g,Zt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title=r.g.getText("Facets","Pivot","FacetTitle"),e.dialogTitle=r.g.getText("Facets","Pivot","DlgTitle"),e.pivotTable=new r.e,e}return Kt(e,t),e.prototype.init=function(e){var n=this;t.prototype.init.call(this,e),this.grid=new a.e({slot:this.contentDiv,dataTable:this.pivotTable,paging:{enabled:!1},useRowNumeration:!1,addColumns:!1,allowDragDrop:!1,onGetCellRenderer:function(t,e){if(t.dataColumn){if("total"==t.dataColumn.id)return function(t,n,i,o){e(t,n,i,o),i.style.fontWeight="900"};if(n.settings.totalsRow)if(0===n.pivotTable.columns.getIndex(t.dataColumn.id))return function(t,i,o,s){Number.parseInt(s.getAttribute("data-row-idx"))===n.pivotTable.getCachedCount()-1&&(t=r.g.getText("Facets","Pivot","TotalGridLabel")),e(t,i,o,s)}}}})},e.prototype.getType=function(){return G.PivotTable},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e.prototype.createAggrFuncSelectBuilder=function(t){for(var e=this.getContext().getModel(),n=Object(a.i)("select"),i=function(t){n.addChild("option",(function(n){n.attr("value",t).text(e.getAggrFunctionCaption(t))}))},o=0,r=Object.keys(qt).map((function(t){return qt[t]}));o<r.length;o++){i(r[o])}var s=n.toDOM().querySelectorAll("option");return null!=t?s.forEach((function(e){e.value==t&&(e.selected=!0)})):s[0].selected=!0,n},e.prototype.createColumnsSelectBuilder=function(t,e){for(var n=this.getContextDataTable(),i=Object(a.i)("select"),o=function(e){var o=n.columns.get(e),r=o.label,s=o.type,a=o.id;if(t&&t.indexOf(s)<0)return"continue";i.addChild("option",(function(t){t.attr("value",a).text(r)}))},r=0;r<n.columns.count;r++)o(r);var s=Array.from(i.toDOM().querySelectorAll("option"));if(s.length>0)if(null!=e)for(var l=0,u=s;l<u.length;l++){var c=u[l];if(c.value==e){i.toDOM().value=c.value;break}}else i.toDOM().value=s[0].value;return i},e.prototype.renderFormFields=function(e,n){var i=this;t.prototype.renderFormFields.call(this,e,n);var o=this.settings||{totalsRow:!0,totalsCol:!0},s=[r.d.String,r.d.Date,r.d.DateTime,r.d.Int32,r.d.Int64,r.d.Word,r.d.Byte],l=[r.d.String,r.d.Float,r.d.Int32,r.d.Int64,r.d.Word,r.d.Byte,r.d.Currency],c=u.a.IsIE(),d=n,h=c?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal",p=function(){return c?Object(a.i)("div",n).addClass("kfrm-field-ie").toDOM():n};c?Object(a.i)(n).addChildElement(p()):Object(a.i)(n).addChild("div").addChild("div"),d=p(),Object(a.i)(d).addChild("label",(function(t){return t.attr("for","column_field").text(r.g.getText("Facets","Pivot","ColumnFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass(h).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","column_field").addChildElement(i.createColumnsSelectBuilder(s,o.colName).id("pivotTableColFieldSelector").toDOM())})).addChild("button",(function(t){return t.addClass("kfrm-button").addClass("eqjs-facets-button-swap").attr("title",r.g.getText("Facets","Pivot","SwapBtnTitle")).on("click",(function(){var t=document.getElementById("pivotTableColFieldSelector"),e=document.getElementById("pivotTableRowFieldSelector"),n=t.value;t.value=e.value,e.value=n}))}))})),d=p(),Object(a.i)(d).addChild("label",(function(t){return t.attr("for","row_field").text(r.g.getText("Facets","Pivot","RowFieldSelectorLabel"))})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","row_field").addChildElement(i.createColumnsSelectBuilder(s,o.rowName).id("pivotTableRowFieldSelector").toDOM())})),d=p(),Object(a.i)(d).addChild("label",(function(t){return t.attr("for","data_function").text(r.g.getText("Facets","Pivot","CellDataSelectorLabel"))})).addChild("div",(function(t){return t.addClass(h).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_function").addChildElement(i.createAggrFuncSelectBuilder(o.aggrFunc).id("pivotTableAggrFuncSelector").toDOM())})).addChild("label",(function(t){return t.addText("of ")})).addChild("div",(function(t){return t.addClass("kfrm-select").attr("name","data_column").addChildElement(i.createColumnsSelectBuilder(l,o.fieldName).on("change",(function(t){var e=t.target.value;i.validateSelectedField(e)})).id("pivotTableCellFieldSelector").toDOM())}))})),d=p(),Object(a.i)(d).addChild("div").addChild("div",(function(t){return t.addClass(h).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsRow").type("checkbox"),o.totalsRow&&t.attr("checked","")})).addText(" "+r.g.getText("Facets","Pivot","TotalsRowLabel"))})).addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.id("pivotTableHasTotalsCol").type("checkbox"),o.totalsCol&&t.attr("checked","")})).addText(" "+r.g.getText("Facets","Pivot","TotalsColLabel"))}))}))},e.prototype.afterDialogOpened=function(t){var e=document.getElementById("pivotTableCellFieldSelector").value;e&&this.validateSelectedField(e)},e.prototype.validateSelectedField=function(t){var e=this.getContextDataTable(),n=e.columns.getIndex(t),i=e.columns.get(n),o=document.getElementById("pivotTableAggrFuncSelector");i.type==r.d.String?(o.disabled=!0,o.value=qt.Count):o.disabled=!1},e.prototype.submitSettingsDialog=function(){var e=t.prototype.submitSettingsDialog.call(this);return e&&(this.settings={colName:document.getElementById("pivotTableColFieldSelector").value,rowName:document.getElementById("pivotTableRowFieldSelector").value,aggrFunc:document.getElementById("pivotTableAggrFuncSelector").value,fieldName:document.getElementById("pivotTableCellFieldSelector").value,totalsRow:document.getElementById("pivotTableHasTotalsRow").checked,totalsCol:document.getElementById("pivotTableHasTotalsCol").checked},this.refresh()),e},e.prototype.saveToData=function(){var e=t.prototype.saveToData.call(this);return this.settings&&r.i.assignDeep(e,this.settings),e},e.prototype.loadFromData=function(e){t.prototype.loadFromData.call(this,e),e&&(this.settings=r.i.assignDeep(this.settings,e),"AVERAGE"==this.settings.aggrFunc&&(this.settings.aggrFunc=qt.Average))},e.prototype.refreshCore=function(){this.updatePivotData(),this.grid&&this.grid.refresh()},e.prototype.getContextDataTable=function(){return this.getContext().resultTable},e.prototype.updatePivotData=function(){this.pivotTable.clear();var t=this.getContextDataTable();if(t&&0!=t.getTotal()&&this.settings){var e=this.settings.colName,n=this.settings.rowName,i=this.settings.fieldName,o=t.columns.getIndex(e),s=t.columns.getIndex(n),a=t.columns.getIndex(i);if(null!=o&&null!=s&&null!=a){for(var l=t.columns.get(a),u=t.columns.get(o),c=t.columns.get(s),d=c.label,h=c.type,p=u.label,f=[],g=[],m=t.getCachedRows(),y=0;y<m.length;y++){var v=m[y].getValue(o);f.indexOf(v)<0&&f.push(v);var C=m[y].getValue(s);g.indexOf(C)<0&&g.push(C)}this.pivotTable.columns.add({id:d+"\\"+p,label:d+"\\"+p,description:"",type:h,dfmt:c.displayFormat,style:c.style});var b=[],x=null;r.i.isNumericType(u.type)?x=this.formatNumber:r.i.getDateDataTypes().indexOf(u.type)>=0&&(x=this.formatDate);for(y=0;y<f.length;y++){if(v=f[y]){var w=x?x(u,v):v;this.pivotTable.columns.add({id:v,label:w,description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==qt.Count?l.type:r.d.Int64,style:l.style})}else b.push(y)}var E=[];for(y=0;y<g.length;y++)E.push([]),E[y].push(g[y]);for(y=0;y<g.length;y++)for(var T=0;T<f.length;T++)b.indexOf(T)>=0||E[y].push(this.calcAggrFunc(this.settings.aggrFunc,{colName:this.settings.colName,rowName:this.settings.rowName,fieldName:this.settings.fieldName,rowValue:g[y],colValue:f[T]}));if(this.settings.totalsCol){this.pivotTable.columns.add({id:"total",label:r.g.getText("Facets","Pivot","TotalGridLabel"),description:"",dfmt:l.displayFormat,type:this.settings.aggrFunc!==qt.Count?l.type:r.d.Int64});for(y=0;y<E.length;y++){var D=E[y],k=0;this.settings.aggrFunc!=qt.Min&&this.settings.aggrFunc!=qt.Max||(k=D[1]);for(T=1;T<D.length;T++){null!==(P=D[T])&&(this.settings.aggrFunc===qt.Min?P<k&&(k=P):this.settings.aggrFunc===qt.Max?P>k&&(k=P):k+=P)}this.settings.aggrFunc===qt.Average&&(k/=D.length-1),D.push(k)}}for(var M=0,S=E;M<S.length;M++){D=S[M];this.pivotTable.addRow(D)}if(this.settings.totalsRow){var B=[];B.push(null);for(y=1;y<this.pivotTable.columns.count;y++){var I=this.pivotTable.getCachedRows(),O=0;this.settings.aggrFunc!=qt.Min&&this.settings.aggrFunc!=qt.Max||(O=I[0].getValue(y));for(T=0;T<I.length;T++){var P;null!==(P=I[T].getValue(y))&&(this.settings.aggrFunc===qt.Min?P<O&&(O=P):this.settings.aggrFunc===qt.Max?P>O&&(O=P):O+=P)}this.settings.aggrFunc===qt.Average&&(O/=I.length),B.push(O)}this.pivotTable.addRow(B),this.contentDiv.classList.add("pivot-grid-totals-row")}else this.contentDiv.classList.remove("pivot-grid-totals-row")}else this.showUnableDisplayMessage(r.g.getText("Facets","ErrQueryChanged"))}},e.prototype.calcAggrFunc=function(t,e){switch(t){case qt.Sum:return this.sum(e);case qt.Average:return this.average(e);case qt.Min:return this.min(e);case qt.Max:return this.max(e);case qt.Count:return this.count(e);default:return 0}},e.prototype.getSettings=function(){return this.settings},e.prototype.formatDate=function(t,e){var n="[object Date]"===Object.prototype.toString.call(e),i=(e||"").toString();if(n)if(t&&t.displayFormat&&Xt.test(t.displayFormat))i=t.displayFormat.replace(Xt,(function(n,i){return r.g.dateTimeToStr(e,t.type,i)}));else{var o=r.g.getCurrentLocale(),s={hour:"numeric",minute:"numeric",second:"numeric"};switch(t.type){case r.d.Date:i=e.toLocaleDateString(o);break;case r.d.Time:i=e.toLocaleTimeString(o,s);break;case r.d.DateTime:i=e.toLocaleDateString(o)+" "+e.toLocaleTimeString(o,s)}}return i},e.prototype.formatNumber=function(t,e){var n=(e||"").toString();return"number"==typeof e&&(n=t&&t.displayFormat&&Xt.test(t.displayFormat)?t.displayFormat.replace(Xt,(function(t,n){return r.g.numberToStr(e,n)})):e.toLocaleString()),n},e.prototype.sum=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),i=0;i<n.length;i++){var o=n[i].getValue(t.rowName),r=n[i].getValue(t.colName);if(o===t.rowValue&&r===t.colValue)e+=n[i].getValue(t.fieldName)}return e},e.prototype.average=function(t){for(var e=0,n=0,i=this.getContextDataTable().getCachedRows(),o=0;o<i.length;o++){var r=i[o].getValue(t.rowName),s=i[o].getValue(t.colName);if(r===t.rowValue&&s===t.colValue)e+=i[o].getValue(t.fieldName),n++}return 0!=n&&(e/=n),e},e.prototype.min=function(t){for(var e=Number.MAX_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),i=0;i<n.length;i++){var o=n[i].getValue(t.rowName),r=n[i].getValue(t.colName);if(o===t.rowValue&&r===t.colValue){var s=n[i].getValue(t.fieldName);s<e&&(e=s)}}return e==Number.MAX_SAFE_INTEGER?null:e},e.prototype.max=function(t){for(var e=Number.MIN_SAFE_INTEGER,n=this.getContextDataTable().getCachedRows(),i=0;i<n.length;i++){var o=n[i].getValue(t.rowName),r=n[i].getValue(t.colName);if(o===t.rowValue&&r===t.colValue){var s=n[i].getValue(t.fieldName);s>e&&(e=s)}}return e==Number.MIN_SAFE_INTEGER?null:e},e.prototype.count=function(t){for(var e=0,n=this.getContextDataTable().getCachedRows(),i=0;i<n.length;i++){var o=n[i].getValue(t.rowName),r=n[i].getValue(t.colName);o===t.rowValue&&r===t.colValue&&e++}return e},e}(Nt),$t=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)}}(),te=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.grid=null,e.title=s.i18n.getText("Facets","DataTable","FacetTitle"),e.dialogTitle=s.i18n.getText("Facets","DataTable","DlgTitle"),e}return $t(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this.reinitGrid()},e.prototype.getSettings=function(){return this.settings},e.prototype.reinitGrid=function(){this.grid&&this.grid.destroy();var t=this.container.options||{};t.gridResolver&&(this.grid=t.gridResolver(this.contentDiv,this.getType())),null==this.grid&&(this.grid=new Bt(this.contentDiv)),t.grid=t.grid||{},t.grid.autoRefresh=!1,t.grid.addColumns=!1;var e=this.getContext();t.grid.totals=this.settings,this.grid.init(e,t.grid)},e.prototype.getType=function(){return G.DataGrid},e.prototype.canDisplay=function(){return!0},e.prototype.refreshCore=function(){this.grid&&this.grid.refresh()},e.prototype.destroy=function(){this.grid&&this.grid.destroy()},e}(Nt),ee=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)}}(),ne=function(t){function e(e){var n=t.call(this,e)||this;return n.facets=[],n.options={},n.group=s.WidgetGroup.Result,n}return ee(e,t),e.prototype.destroyCore=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.clear()},e.prototype.createFacetTab=function(t){var e=this.options[t];switch(t){case G.Chart:return new Yt(this,e);case G.PivotTable:return new Zt(this,e);default:return new te(this,e)}},e.prototype.getQuery=function(){return this.getContext().getQuery()},e}(s.Widget),ie=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)}}(),oe=function(t){function e(e){var n=t.call(this,e)||this;return n.activeFacetIndex=-1,n.firstRender=!0,n.options={showExportButton:!0,showRefreshButton:!0,showMaximizeButton:!0,maximize2Window:!1,showProcessIndicator:!0,facetTypes:[G.DataGrid,G.Chart,G.PivotTable]},n.menuItems=[{id:G.DataGrid,text:r.g.getText("Facets","AddMenuItems","DataTable")},{id:G.Chart,text:r.g.getText("Facets","AddMenuItems","Chart")},{id:G.PivotTable,text:r.g.getText("Facets","AddMenuItems","Pivot")}],n.menuItemsFilter=function(t){return!(n.options.facetTypes.indexOf(t.id)<0)&&(t.id===G.DataGrid?0===n.facets.filter((function(t){return t.getType()==G.DataGrid})).length:t.id===G.PivotTable?n.getQuery().getColumns().length>2:t.id!==G.Chart||n.context.resultTable.columns.getItems().filter((function(t){return r.i.isNumericType(t.type)})).length>0)},n.slot.classList.contains(n.cssPrefix+"-panel")||n.slot.classList.add(n.cssPrefix+"-panel"),n.renderProcessBlock(),n}return ie(e,t),Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-facets"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"facetsPanel"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.setOptions(n),this.destroyCore(),this.attachQueryObserver(),this.loadFacets()},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){var n=e.data;n.part==s.QueryChangePart.All&&n.source!=t&&(t.reloadFacets(),t.refreshCore(!0))}))},e.prototype.refreshCore=function(t){void 0===t&&(t=!1),(this.firstRender||t)&&(this.clear(),this.createAddMenu(),this.render()),this.validateAddFacetButton(),this.renderActiveFacet(),this.updateTotalRecords()},e.prototype.createAddMenu=function(){this.addMenu=new p({items:this.menuItems,id:"FacetType-List"})},e.prototype.updateTotalRecords=function(){var t=this.getContext().resultTable.getTotal();this.recordsDiv.innerHTML=r.g.getText("Facets","TotalRecordsLabel")+" "+t,0==t?Object(a.i)(this.exportDiv).hide():Object(a.i)(this.exportDiv).show()},e.prototype.renderProcessBlock=function(){this._processBlock=Object(a.i)("div").addClass(this.cssPrefix+"-spinner").addChild("div",(function(t){return t.addClass(l.b+"-progress-win8",u.a.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},e.prototype.onProcessStartCore=function(){this.options.showProcessIndicator&&!this._processBlock.parentNode&&this.bodyDiv&&(this.bodyDiv.childNodes.forEach((function(t){Object(a.i)(t).hide()})),this.bodyDiv.appendChild(this._processBlock))},e.prototype.onProcessEndCore=function(){if(this.options.showProcessIndicator&&this._processBlock.parentNode)try{this._processBlock.parentNode.removeChild(this._processBlock)}catch(t){}finally{this.renderActiveFacet(!1)}},e.prototype.render=function(){var t=this;this.firstRender=!1,this.headerDiv=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-header").toDOM(),this.tabsDiv=Object(a.i)("div",this.headerDiv).addClass(this.cssPrefix+"-tabs").toDOM(),this.tabsUl=Object(a.i)("ul",this.tabsDiv).addClass(this.cssPrefix+"-nav-tabs").toDOM(),this.bodyDiv=Object(a.i)("div",this.slot).addClass(this.cssPrefix+"-body").toDOM();for(var e=0,n=this.facets;e<n.length;e++){var i=n[e];this.renderFacet(i)}Object(a.i)(this.tabsDiv).addChild("div",(function(e){return t.addFacetButton=e.addClass(t.cssPrefix+"-add-button").title(r.g.getText("Facets","NewFacetTitle")).addChild("a",(function(t){return t.attr("href","javascript:void(0)")})).on("click",(function(e){return t.addClickHandler(e)})).toDOM()}));var o=Object(a.i)("div",this.headerDiv).addClass(this.cssPrefix+"-manage").toDOM();if(this.recordsDiv=Object(a.i)("div",o).addClass(this.cssPrefix+"-total-recs").toDOM(),this.options.showRefreshButton||this.options.showExportButton||this.options.showMaximizeButton){var s=Object(a.i)("div",o).addClass(this.cssPrefix+"-total-buttons").toDOM();this.options.showExportButton&&(this.exportDiv=Object(a.i)("button",s).on("click",(function(){return t.exportHandler()})).addClass(this.cssPrefix+"-button").addClass(this.cssPrefix+"-button-export").title(r.g.getText("Facets","ExportBtnTitle")).toDOM()),this.options.showRefreshButton&&Object(a.i)("button",s).on("click",(function(){return t.refreshHandler()})).addClass(this.cssPrefix+"-button").addClass(this.cssPrefix+"-button-refresh").title(r.g.getText("Facets","RefreshBtnTitle")),this.options.showMaximizeButton&&(this.maximizeButton=Object(a.i)("button",s).on("click",(function(){return t.options.maximize2Window?t.maximizeHandler(!0):t.maximizeHandler()})).addClass(this.cssPrefix+"-button").addClass(this.cssPrefix+"-button-maximize").title(r.g.getText("Facets","MaximizeBtnTitle")).toDOM())}},e.prototype.refreshHandler=function(){var t=this.getContext();t.fetchData({success:function(){t.refreshWidgets(s.WidgetGroup.Result)}})},e.prototype.exportHandler=function(){var t=this.getContext();new Ft(t).show()},e.prototype.maximizeHandler=function(t){var e=Object(a.i)(this.slot);if(t)e.toggleClass(l.b+"-maximized-2window"),this.slot.classList.contains(l.b+"-maximized-2window")?(this.maximizeButton.title=r.g.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!0)):(this.maximizeButton.title=r.g.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!0));else{var n=!this.slot.hasAttribute("data-is-maximized");n?(this.slot.setAttribute("data-is-maximized",""),this.maximizeButton.title=r.g.getText("Facets","RestoreBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!0)):(this.slot.removeAttribute("data-is-maximized"),this.maximizeButton.title=r.g.getText("Facets","MaximizeBtnTitle"),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-restore",!1),this.maximizeButton.classList.toggle(this.cssPrefix+"-button-maximize",!0)),document.querySelectorAll("[data-hide-on-max]").forEach((function(t){n?t.setAttribute("style","display: none;"):t.removeAttribute("style")}))}this.facets.forEach((function(t){return t.onResize()}))},e.prototype.renderActiveFacet=function(t){var e=this;void 0===t&&(t=!0),this.tabsUl.querySelectorAll("li").forEach((function(t,n){t.classList.contains("active")&&t.classList.remove("active"),e.activeFacetIndex===n&&t.classList.add("active")})),this.bodyDiv.querySelectorAll("."+l.b+"-facet").forEach((function(n,i){Object(a.i)(n).hide(),e.activeFacetIndex===i&&(Object(a.i)(n).show(),t&&e.facets[i].refresh())}))},e.prototype.renderFacet=function(t){this.renderFacetTab(t);var e=this.renderFacetBody(t);t.init(e)},e.prototype.renderFacetTab=function(t){var e=this;return Object(a.i)("li",this.tabsUl).addChild("span",(function(n){return n.addClass(l.b+"-facet-settings").on("click",(function(n){n.stopPropagation(),e.settingsClickHandler(t)}))})).addChild("a",(function(e){return e.addText(t.title).attr("href","javascript:void(0)")})).addChild("span",(function(n){return n.addClass(l.b+"-facet-close").on("click",(function(n){n.stopPropagation(),e.closeClickHandler(t)}))})).on("click",(function(n){return e.selectClickHandler(t)})).toDOM()},e.prototype.renderFacetBody=function(t){return Object(a.i)("div",this.bodyDiv).addClass(l.b+"-facet").hide().toDOM()},e.prototype.refreshFacetTabs=function(){var t=this;this.tabsUl.querySelectorAll("li").forEach((function(e){t.tabsUl.removeChild(e)}));for(var e=0,n=this.facets;e<n.length;e++){var i=n[e];this.renderFacetTab(i)}},e.prototype.removeFacet=function(t){var e=this.facets.indexOf(t);if(e>=0){this.facets.splice(e,1);var n=this.tabsUl.childNodes[e];this.tabsUl.removeChild(n);var i=this.bodyDiv.childNodes[e];this.bodyDiv.removeChild(i),this.facets.length>0?this.activeFacetIndex=e<this.facets.length?e:this.facets.length-1:this.activeFacetIndex=-1,this.renderActiveFacet(),this.validateAddFacetButton()}},e.prototype.addClickHandler=function(t){var e=this;this.addMenu.showMenu({anchor:t.target,itemFilterCallback:this.menuItemsFilter,itemSelectedCallback:function(t){var n=e.createFacetTab(t.id),i=e.renderFacetBody(n);n.init(i),n.showSettingsDialog().then((function(t){t?(e.facets.push(n),e.activeFacetIndex=e.facets.length-1,e.renderFacetTab(n),e.renderActiveFacet(),e.saveFacets()):e.bodyDiv.removeChild(i),e.validateAddFacetButton()})).catch((function(t){return console.error(t)}))}})},e.prototype.selectClickHandler=function(t){var e=this.facets.indexOf(t);this.setActiveFacet(e)},e.prototype.settingsClickHandler=function(t){var e=this;t.showSettingsDialog().then((function(t){t&&(e.refreshFacetTabs(),e.renderActiveFacet(),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.closeClickHandler=function(t){var e=this;this.getDialogService().openConfirm(r.g.getText("Facets","RemoveFacetDlgTitle"),r.g.getText("Facets","RemoveFacetDlgContent").replace("{facetTitle}",t.title)).then((function(n){n&&(e.removeFacet(t),e.saveFacets())})).catch((function(t){return console.error(t)}))},e.prototype.clear=function(){this.firstRender=!0,this.slot.innerHTML=""},e.prototype.createDefaultFacetIfNotExist=function(){if(0===this.facets.length){var t=this.createFacetTab(G.DataGrid);this.facets.push(t),this.activeFacetIndex=0}},e.prototype.validateAddFacetButton=function(){this.addFacetButton.hidden=0==this.addMenu.getItems().filter(this.menuItemsFilter).length},e.prototype.setActiveFacet=function(t){this.activeFacetIndex!=t&&(this.activeFacetIndex=t,this.renderActiveFacet(),this.saveFacets(!0))},e.prototype.setOptions=function(t){r.i.assignDeep(this.options,t)},e.prototype.getDialogService=function(){return this.getContext().getServices().getDialogService()},e.prototype.saveFacets=function(t){void 0===t&&(t=!1);var e=this.getQuery();e.innerData=e.innerData||{},e.innerData.facets={active:this.activeFacetIndex,items:this.facets.map((function(t){return t.saveToData()}))},e.fireChangedEvent({part:s.QueryChangePart.Facets,action:t?s.QueryChangeAction.Activate:s.QueryChangeAction.All,source:this})},e.prototype.reloadFacets=function(){for(var t=0,e=this.facets;t<e.length;t++){e[t].destroy()}this.loadFacets()},e.prototype.loadFacets=function(){var t=this.getQuery();if(this.facets=[],t.innerData&&t.innerData.facets){for(var e=0,n=t.innerData.facets.items;e<n.length;e++){var i=n[e],o=this.createFacetTab(i.type);o.loadFromData(i),this.facets.push(o)}var r=t.innerData.facets.active;this.activeFacetIndex=r>=0?r:this.facets.length-1}else this.createDefaultFacetIfNotExist()},e}(ne),re=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)}}(),se=function(t){function e(e){var n=t.call(this,e)||this;return n.options={defFormat:"csv",enableExport:!0},n.clickHandler=function(t){n.slot.hasAttribute("disabled")||new Ft(n.context).show(n.options.defFormat)},n.group=s.WidgetGroup.All,n}return re(e,t),e.prototype.getWidgetType=function(){return"exportWidget"},e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.options=r.i.assignDeep(this.options,n),this.slot.addEventListener("click",this.clickHandler)},e.prototype.refreshCore=function(){this.options.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.slot.removeAttribute("disabled"):this.slot.setAttribute("disabled","")},e.prototype.destroyCore=function(){this.slot.removeAttribute("disabled"),this.slot.removeEventListener("click",this.clickHandler)},e}(s.Widget),ae=function(){function t(t){if(this.selectState={columns:[]},this.funcMap={},!t||!t.slot)throw new Error("slot is required");if(!t||!t.query)throw new Error("query is required");this.slot=t.slot,this.query=t.query,this.onChanged=t.onChanged,this.dropSelectState(),this.dropState()}return Object.defineProperty(t.prototype,"cssPrefix",{get:function(){return"eqjs-as"},enumerable:!0,configurable:!0}),t.prototype.render=function(){this.createFunctionMenu(),this.setInitialState(),this.changed()},t.prototype.setInitialState=function(){for(var t=this.query.getAggregationSettings(),e=t.getInternalGroups(),n=t.getAggregates(),i=0,o=e;i<o.length;i++){var r=o[i];this.state.groups.push({columns:r.columns})}for(var s=0,a=n;s<a.length;s++){var l=a[s];this.state.aggregates.push({colId:l.colId,funcId:l.funcId})}this.state.grandTotals=t.hasGrandTotals(),this.state.recordCount=t.hasRecordCount()},t.prototype.getAvailableColumns=function(){return this.query.getColumns().filter((function(t){return t.enabled}))},t.prototype.renderCore=function(){var t=this;this.slot.innerHTML="";for(var e=this.getAvailableColumns(),n=Object(a.i)(this.slot),i=null,o=null,r=null,l=this.state.aggregates,u=-1,c=function(e){if(i&&i.columns.indexOf(e.id)>=0)return d.renderColumn(o,e,!0),"continue";if(null!=(i=d.getGroupForColumn(e.id))){u++;var c=Object(a.i)("div",d.slot).addClass(d.cssPrefix+"-group").data("gindex",""+u);return o=Object(a.i)("div",c.toDOM()).addClass(d.cssPrefix+"-columns"),d.renderColumn(o,e,!0),"continue"}var h=l.filter((function(t){return t.colId==e.id}))[0];if(h){var p=Object(a.i)("div",d.slot).addClass(d.cssPrefix+"-aggr");return d.renderColumn(p,e,!0,h.funcId),p.addChild("div",(function(e){return e.addClass(t.cssPrefix+"-buttons").addChild("button",(function(e){return e.addClass(t.cssPrefix+"-unaggr-btn").title(s.i18n.getText("AggrSettings","UnaggrBtn")).on("click",t.removeAggrBtnClickHandler.bind(t))}))})),"continue"}if(d.selectState.columns.indexOf(e.id)>=0){if(null==r){var f=Object(a.i)("div",d.slot).addClass(d.cssPrefix+"-selected");r=Object(a.i)("div",f.toDOM()).addClass(d.cssPrefix+"-columns")}return d.renderColumn(r,e,!1),"continue"}d.renderColumn(n,e,!1)},d=this,h=0,p=e;h<p.length;h++){c(p[h])}if(r){var f=Object(a.i)("div",r.toDOM().parentElement).addClass(this.cssPrefix+"-buttons");f.addChild("button",(function(e){return e.addClass(t.cssPrefix+"-group-btn").title(s.i18n.getText("AggrSettings","GroupBtn")).on("click",t.groupBtnClickHandler.bind(t))})),1==this.selectState.columns.length&&f.addChild("button",(function(e){return e.addClass(t.cssPrefix+"-aggr-btn").title(s.i18n.getText("AggrSettings","AggrBtn")).on("click",t.aggrBtnClickHandler.bind(t))}))}Object(a.i)(this.slot).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-counts").addChild("label",(function(e){return e.addClass("switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.recordCount&&e.attr("checked",""),e.on("change",t.countsCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")}))})).addChild("span",(function(t){return t.addClass("switch-text").addText(s.i18n.getText("AggrSettings","GroupCountsLabel"))}))})).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-grandtotals").addChild("label",(function(e){return e.addClass("switch").addChild("input",(function(e){e.attr("type","checkbox"),t.state.grandTotals&&e.attr("checked",""),e.on("change",t.grandCheckboxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")}))})).addChild("span",(function(t){return t.addClass("switch-text").addText(s.i18n.getText("AggrSettings","GrandTotalsLabel"))}))})),this.slot.querySelectorAll("."+this.cssPrefix+"-group").forEach((function(e){Object(a.i)(e).addChild("div",(function(e){return e.addClass(t.cssPrefix+"-buttons").addChild("button",(function(e){return e.addClass(t.cssPrefix+"-ungroup-btn").title(s.i18n.getText("AggrSettings","UngroupBtn")).on("click",t.removeGroupBtnClickHandler.bind(t))}))}))})),this.validateCheckboxes()},t.prototype.validateCheckboxes=function(){if(0!==this.selectState.columns.length){for(var t,e,n=null,i=0;i<this.slot.childNodes.length;i++){(s=this.slot.childNodes[i]).classList.contains(this.cssPrefix+"-selected")?t&&t.classList.contains(this.cssPrefix+"-column")&&(e=t):s.classList.contains(this.cssPrefix+"-column")&&t&&t.classList.contains(this.cssPrefix+"-selected")&&(n=s),t=s}for(i=0;i<this.slot.childNodes.length;i++){(s=this.slot.childNodes[i]).classList.contains(this.cssPrefix+"-column")&&s!=e&&s!=n&&s.firstElementChild.firstElementChild.setAttribute("disabled","")}var o="."+this.cssPrefix+"-selected>."+this.cssPrefix+"-columns>."+this.cssPrefix+"-column",r=this.slot.querySelectorAll(o);for(i=1;i<r.length-1;i++){var s;(s=r[i]).firstElementChild.firstElementChild.setAttribute("disabled","")}}},t.prototype.isValid=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,i=this.state.grandTotals,o=this.state.recordCount;return!t&&(n?e||o:!!e&&(n||i))},t.prototype.getValidationMessage=function(){var t=this.selectState.columns.length,e=this.state.aggregates.length>0,n=this.state.groups.length>0,i=this.state.grandTotals,o=this.state.recordCount;return t?s.i18n.getText("AggrSettings","SelectedError")+" ":!n||e||o?!e||n||i?s.i18n.getText("AggrSettings","NoGroupsOrAggrError")+" ":s.i18n.getText("AggrSettings","NoGroupsOrGrandError")+" ":s.i18n.getText("AggrSettings","NoAggrOrCountError")+" "},t.prototype.getSettings=function(){for(var t=new r.a(this.query),e=0,n=this.state.groups;e<n.length;e++){var i=n[e];t.addGroup({columns:i.columns})}for(var o=0,s=this.state.aggregates;o<s.length;o++){var a=s[o];t.addAggregateColumn(a.colId,a.funcId)}return this.state.grandTotals&&t.addGrandTotals(),this.state.recordCount&&t.addCounts(),t},t.prototype.renderColumn=function(t,e,n,i){var o=this;void 0===i&&(i=null),t.addChild("div",(function(t){t.data("colid",e.id);var r=i?e.caption+" ("+o.funcMap[i].caption+")":e.caption;n?t.addClass(o.cssPrefix+"-column-used").addText(r):t.addClass(o.cssPrefix+"-column").addChild("label",(function(t){return t.addClass("checkbox").addChild("input",(function(t){t.attr("type","checkbox"),o.selectState.columns.indexOf(e.id)>=0&&t.attr("checked",""),t.on("change",o.colCheckboxChangeHandler.bind(o))})).addText(r)}))}))},t.prototype.getGroupForColumn=function(t){var e=this.getGroupIndexForColumn(t);return e>=0?this.state.groups[e]:null},t.prototype.getGroupIndexForColumn=function(t){for(var e=0;e<this.state.groups.length;e++){if(this.state.groups[e].columns.indexOf(t)>=0)return e}return-1},t.prototype.grandCheckboxChangeHandler=function(t){this.state.grandTotals=!this.state.grandTotals,this.onChanged&&this.onChanged()},t.prototype.countsCheckboxChangeHandler=function(t){this.state.recordCount=!this.state.recordCount,this.onChanged&&this.onChanged()},t.prototype.colCheckboxChangeHandler=function(t){var e=t.target.parentElement.parentElement.getAttribute("data-colid"),n=this.selectState.columns.indexOf(e);if(n>=0)this.selectState.columns.splice(n,1);else{this.selectState.columns.push(e);var i=this.getAvailableColumns();this.selectState.columns=this.selectState.columns.sort((function(t,e){return i.findIndex((function(e){return e.id==t}))-i.findIndex((function(t){return t.id==e}))}))}this.changed()},t.prototype.groupBtnClickHandler=function(){this.state.groups.push({columns:this.selectState.columns});var t=this.getAvailableColumns();this.state.groups=this.state.groups.sort((function(e,n){return t.findIndex((function(t){return t.id==e.columns[0]}))-t.findIndex((function(t){return t.id==n.columns[0]}))})),this.dropSelectState(),this.changed()},t.prototype.removeGroupBtnClickHandler=function(t){var e=t.target,n=Number.parseInt(e.parentElement.parentElement.getAttribute("data-gindex"));this.state.groups.splice(n,1),this.changed()},t.prototype.removeAggrBtnClickHandler=function(t){var e=t.target.parentElement.parentElement.querySelector("."+this.cssPrefix+"-column-used").getAttribute("data-colid"),n=this.state.aggregates.findIndex((function(t){return t.colId==e}));n>=0&&(this.state.aggregates.splice(n,1),this.changed())},t.prototype.aggrBtnClickHandler=function(t){var e=this,n=(this.query.getModel(),this.selectState.columns[0]),i=this.getAvailableColumns().filter((function(t){return t.id==n}))[0];this.functionMenu.showMenu({anchor:t.target,itemFilterCallback:function(t){return e.funcMap[t.id].appliedTypes.indexOf(i.expr.dataType)>=0},itemSelectedCallback:function(t){e.state.aggregates.push({colId:n,funcId:t.id}),e.dropSelectState(),e.changed()}})},t.prototype.clear=function(){this.dropSelectState(),this.dropState(),this.changed()},t.prototype.dropSelectState=function(){this.selectState={columns:[]}},t.prototype.dropState=function(){this.state={groups:[],aggregates:[],recordCount:!0,grandTotals:!1}},t.prototype.changed=function(){this.onChanged&&this.onChanged(),this.renderCore()},t.prototype.createFunctionMenu=function(){for(var t=this.query.getModel(),e=[],n=0,i=this.query.getModel().getAggrFunctions();n<i.length;n++){var o=i[n];if(o){this.funcMap[o.id]=o;var r=t.getAggrFunctionCaption(o.id),s={id:o.id,text:r};e.push(s)}}var a=this.slot.id;a&&(a+="-FunctionsMenu");var l={items:e,id:a,searchBoxAlwaysShown:!1,domWriteItemsId:!0};this.functionMenu=new p(l)},t}(),le=function(){function t(t){this.context=t,this.promise=null}return t.prototype.show=function(t){var e=this,n=t||this.context.getQuery();return this.query=this.context.createQuery(),this.query.loadFromData(n.toJSONData()),this.promise||(this.promise=new Promise((function(t,i){var o=e.context.getServices().getDialogService();e.body=e.renderBody();var r=o.open({title:"Aggregation settings",body:e.body,onSubmit:function(){return!(e.query.enableAggregation&&!e.renderer.isValid())&&(n.enableAggregation=e.query.enableAggregation,n.enableAggregation&&n.useAggregation((function(t){var n=e.renderer.getSettings();t.loadFromData(n.saveToData())})),n.fireChangedEvent({part:s.QueryChangePart.Aggregation,wasModified:!1}),t(),!0)},onCancel:function(){t()}});e.renderer=new ae({slot:e.body.querySelector("#AggrSettingsComponent"),query:e.query,onChanged:function(){r.clearAlert();var t=e.renderer.isValid();if(!t){var n=e.renderer.getValidationMessage();r.showAlert(n,"warning")}r.getRootElement().querySelector(".kfrm-button.is-info").disabled=!t&&e.query.enableAggregation}}),e.query.enableAggregation&&e.renderer.render()}))),this.promise.catch((function(t){return console.error(t)})).finally((function(){return e.promise=null}))},t.prototype.renderBody=function(){var t=this;return Object(a.i)("div").addChild("div",(function(e){return e.addClass("eqjs-as-enableaggr").addChild("label",(function(e){return e.addClass("switch").addChild("input",(function(e){e.attr("type","checkbox"),t.query.enableAggregation&&e.attr("checked",""),e.on("change",t.enableAggrCheckBoxChangeHandler.bind(t))})).addChild("span",(function(t){return t.addClass("slider round")}))})).addChild("span",(function(t){return t.addClass("switch-text").addText(s.i18n.getText("AggrSettings","EnableAggrLabel"))}))})).addChild("div",(function(t){return t.id("AggrSettingsComponent")})).toDOM()},t.prototype.enableAggrCheckBoxChangeHandler=function(t){if(this.query.enableAggregation=!this.query.enableAggregation,this.body.querySelector("#AggrSettingsComponent").innerHTML="",this.query.enableAggregation)this.renderer.render();else{var e=this.body?this.body.closest(".kdlg-modal").querySelector("footer .kfrm-button.is-info"):null;e&&(e.disabled=!1)}},t}(),ue=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)}}(),ce=function(t){function e(e,n){var i=t.call(this,e)||this;return i.linkClickCallback=function(){new le(i.context).show(i.getQuery())},i.queryEventCallbackId=null,i.customQuery=n,i.group=s.WidgetGroup.Query|s.WidgetGroup.QueryStatus,i}return ue(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-aggrb"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"aggregationBar"},e.prototype.refreshCore=function(){this.render()},e.prototype.getLinkText=function(){var t=this.getQuery();if(t.enableAggregation){for(var e=t.getAggregationSettings(),n=e.getInternalGroups(),i=e.getAggregates(),o=[],r=t.getColumns(),a=0,l=n;a<l.length;a++){var u=l[a].columns.map((function(t){var e=r.find((function(e){return e.id==t}));return e?e.caption:""}));o.push("["+u.join(", ")+"]")}for(var c=o.join(", "),d=[],h=t.getModel().getAggrFunctions(),p=function(t){var e=r.find((function(e){return e.id==t.colId})),n=h.find((function(e){return e.id==t.funcId}));e&&n&&d.push(e.caption+" ("+n.caption+")")},f=0,g=i;f<g.length;f++){p(g[f])}var m=d.join(", ");return(c||s.i18n.getText("AggrSettings","NoGroupsLabel"))+" ::: "+(m?"<"+m+">":s.i18n.getText("AggrSettings","NoAggrsLabel"))}return s.i18n.getText("AggrSettings","EmptySettingsLabel")},e.prototype.render=function(){this.slot.classList.add(this.cssPrefix+"-panel");var t=u.a.getMobileCssClass();t&&this.slot.classList.add(t),this.dialogLink||(this.dialogLink=document.createElement("a"),this.dialogLink.setAttribute("href","javascript:void(0)"),this.slot.appendChild(this.dialogLink)),this.dialogLink.textContent=this.getLinkText(),this.dialogLink.removeEventListener("click",this.linkClickCallback),this.dialogLink.addEventListener("click",this.linkClickCallback)},e.prototype.clear=function(){this.slot.innerHTML="",this.dialogLink=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e.prototype.getQuery=function(){return this.customQuery||this.context.getQuery()},e}(s.Widget),de=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)}}(),he=function(t){function e(e){var n=t.call(this,e)||this;return n.changeLocale=function(){var t=n.selectEl.value;r.g.setCurrentLocale(t),n.context.refreshWidgets(s.WidgetGroup.All)},n.group=s.WidgetGroup.None,n}return de(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.clear(),this.render()},e.prototype.getWidgetType=function(){return"changeLocale"},e.prototype.render=function(){var t=r.g.getLocales();if(t.length>1){this.selectEl=document.createElement("select");for(var e=0,n=t;e<n.length;e++){var i=n[e],o=document.createElement("option");o.value=i.locale,o.innerHTML=this.displayLocaleName(i),this.selectEl.appendChild(o)}this.selectEl.value=r.g.getCurrentLocale(),this.selectEl.classList.add("eqv-select"),this.selectEl.addEventListener("change",this.changeLocale),this.slot.appendChild(this.selectEl)}},e.prototype.displayLocaleName=function(t){return t.englishName&&t.displayName?t.englishName+" - "+t.displayName:t.englishName?t.englishName:t.displayName?t.displayName:t.locale},e.prototype.clear=function(){this.slot.innerHTML=""},e.prototype.destroyCore=function(){this.clear()},e}(s.Widget),pe=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)}}(),fe=function(t){function e(e){var n=t.call(this,e)||this;return n.queryEventCallbackId=null,n.group=s.WidgetGroup.Query|s.WidgetGroup.QueryStatus,n}return pe(e,t),e.prototype.init=function(e,n){t.prototype.init.call(this,e,n),this.destroyCore(),this.attachQueryObserver()},Object.defineProperty(e.prototype,"cssPrefix",{get:function(){return"eqjs-query-name"},enumerable:!0,configurable:!0}),e.prototype.getWidgetType=function(){return"queryName"},e.prototype.refreshCore=function(){this.render()},e.prototype.render=function(){this.slot.classList.add(""+this.cssPrefix);var t=u.a.getMobileCssClass();t&&this.slot.classList.add(t),this.nameSlot||(this.nameSlot=document.createElement("div"),this.nameSlot.classList.add(this.cssPrefix+"-text"),this.nameSlot.classList.add(this.cssPrefix+"-theme"),this.slot.appendChild(this.nameSlot)),this.asteriskSlot||(this.asteriskSlot=document.createElement("span"),this.asteriskSlot.innerHTML="*",this.asteriskSlot.classList.add(this.cssPrefix+"-asterisk"),this.slot.appendChild(this.asteriskSlot)),this.tooltipSlot||(this.tooltipSlot=document.createElement("span"),this.tooltipSlot.classList.add(this.cssPrefix+"-tooltip"),this.tooltipSlot.classList.add(this.cssPrefix+"-theme"),this.slot.appendChild(this.tooltipSlot));var e=this.context.getQuery().getName();this.nameSlot.textContent=e,this.tooltipSlot.textContent=e,this.asteriskSlot.style.visibility=this.context.getQuery().isModified()?"visible":"hidden"},e.prototype.clear=function(){this.slot.innerHTML="",this.nameSlot=null,this.tooltipSlot=null,this.asteriskSlot=null},e.prototype.attachQueryObserver=function(){var t=this,e=this.context.getQuery();this.queryEventCallbackId=e.addChangedCallback((function(e){t.refreshCore()}))},e.prototype.detachQueryObserver=function(){this.queryEventCallbackId&&this.context.getQuery().removeChangedCallback(this.queryEventCallbackId)},e.prototype.destroyCore=function(){this.clear(),this.detachQueryObserver()},e}(s.Widget),ge=function(){function t(){this.domRoots=[document],this.defaultViewOptions={enableExport:!0,disableConfirmationOnQueryChange:!1,queryFileExtensions:"text/xml,application/json",result:{clearResultOnQueryChange:!0,showChart:!0,showProcessIndicator:!0},widgets:{resultGrid:{addColumns:!1}}},this.resultOptions={},this.enableExport=!1,this.resetContext(),this.renderSpinner()}return t.prototype.resetContext=function(){this.context=new s.EqContext,this.context.getServices().registerDialogServiceResolver((function(){return new a.b}))},t.prototype.init=function(t){try{this.context.initStart(),t&&t.shadowRoots&&(this.domRoots=this.domRoots.concat(t.shadowRoots)),t=this.initOptions(t),this.initWidgets(t),this.context.init(t),this.initDone()}catch(t){this.context.throwError({action:"Init",sourceError:t})}},t.prototype.initOptions=function(t){return(t=t?r.i.assignDeep({},this.defaultViewOptions,t):this.defaultViewOptions).handlers||(t.handlers={}),t.widgets||(t.widgets={}),this.resultOptions=r.i.assignDeep(this.resultOptions,t.result),void 0===this.resultOptions.showProcessIndicator?this.resultOptions.showProcessIndicator=!0:t.widgets.facetsPanel&&(t.widgets.facetsPanel.showProcessIndicator=this.resultOptions.showProcessIndicator),t.widgets.easyGrid||(t.widgets.easyGrid=t.widgets.resultGrid||{}),t.columnTitleFormat&&(t.widgets.entitiesPanel=t.widgets.entitiesPanel||{},t.widgets.entitiesPanel.columnTitleFormat=t.widgets.entitiesPanel.columnTitleFormat||t.columnTitleFormat,t.widgets.columnsBar=t.widgets.columnsBar||{},t.widgets.columnsBar.titleElementFormat=t.widgets.columnsBar.titleElementFormat||t.columnTitleFormat,t.widgets.columnsPanel=t.widgets.columnsPanel||{},t.widgets.columnsPanel.titleElementFormat=t.widgets.columnsPanel.titleElementFormat||t.columnTitleFormat),t.widgets.easyGrid.paging=r.i.assignDeep(this.resultOptions.paging,t.widgets.easyGrid.paging),this.enableExport=t.enableExport||!1,t.widgets.exportWidget||(t.widgets.exportWidget={}),t.widgets.exportWidget.enableExport=this.enableExport,t},t.prototype.initWidgets=function(t){var e="QueryPanel",n="ColumnsPanel",i="EntitiesPanel",o="ResultPanel",r="ColumnsBar",s="FilterBar",l="ProcessBar",u="StatementPanel",c="ChangeLocale",d="QueryNameLabel",h="ResultFacetsPanel",p="ResultCount",f="ExportButton",g="AggregationBar";t.slots&&(d=t.slots.queryNameLabel||d,e=t.slots.queryPanel||e,n=t.slots.columnsPanel||n,r=t.slots.columnsBar||r,i=t.slots.entitiesPanel||i,o=t.slots.resultPanel||o,u=t.slots.statementPanel||u,l=t.slots.processBar||l,c=t.slots.changeLocale||c,h=t.slots.facetsPanel||h,p=t.slots.resultCountSpan||p,s=t.slots.filterBar||s,f=t.slots.exportButtons||f,g=t.slots.aggregationBar||g);var m=this.resolveElement(i);m&&!this.entitiesPanelWidget&&(this.entitiesPanelWidget=this.createEntitiesPanelWidget(m),this.context.addWidget(this.entitiesPanelWidget));var y=this.resolveElement(n);y&&!this.columnsPanelWidget&&(this.columnsPanelWidget=this.createColumnsPanelWidget(y),this.context.addWidget(this.columnsPanelWidget));var v=this.resolveElement(r);v&&!this.columnsBarWidget&&(this.columnsBarWidget=this.createColumnsBarWidget(v),this.context.addWidget(this.columnsBarWidget));var C=this.resolveElement(e);if(C&&!this.queryPanelWidget&&(this.queryPanelWidget=this.createQueryPanelWidget(C),this.context.addWidget(this.queryPanelWidget)),this.resultPanelSlot=this.resolveElement(o),this.resultPanelSlot){if(!this.resultGridWidget){var b=Object(a.g)(this.resultPanelSlot,"div",{cssClass:"eqv-result-grid"});this.resultGridWidget=this.createResultGridWidget(b),this.context.addWidget(this.resultGridWidget)}if(this.resultOptions.showChart&&!this.chartWidget){var x=Object(a.g)(this.resultPanelSlot,"div",{cssClass:"eqv-chart-panel"});x.style.display="none",this.chartWidget=this.createChartWidget(x),this.context.addWidget(this.chartWidget)}}var w=this.resolveElement(d);w&&!this.queryNameWidget&&(this.queryNameWidget=this.createQueryNameWidget(w),this.context.addWidget(this.queryNameWidget));var E=this.resolveElement(s);E&&!this.filterBarWidget&&(this.filterBarWidget=this.createFilterBarWidget(E),this.context.addWidget(this.filterBarWidget));var T=this.resolveElement("SortingBar");T&&!this.sortingBarWidget&&(this.sortingBarWidget=this.createSortingBarWidget(T),this.context.addWidget(this.sortingBarWidget));var D=this.resolveElement(l);D&&!this.processWidget&&(this.processWidget=this.createProcessWidget(D),this.context.addWidget(this.processWidget));var k=this.resolveElement(u);k&&!this.statementPanelWidget&&(this.statementPanelWidget=this.createStatementPanelWidget(k),this.context.addWidget(this.statementPanelWidget));var M=this.resolveElement(c);if(M){var S=this.createLocaleWidget(M);this.context.addWidget(S)}var B=this.resolveElement(h);B&&!this.resultFacetPanelWidget&&(this.resultFacetPanelWidget=this.createResultFacetsPanel(B),this.context.addWidget(this.resultFacetPanelWidget));var I=this.resolveElement(f);I&&!this.exportWidget&&(this.exportWidget=this.createExportWidget(I),this.context.addWidget(this.exportWidget)),this.resultCountSlot=this.resolveElement(p);var O=this.resolveElement(g);O&&!this.aggregationBarWidget&&(this.aggregationBarWidget=this.createAggregationBarWidget(O),this.context.addWidget(this.aggregationBarWidget))},t.prototype.initDone=function(){},t.prototype.resolveElement=function(t){if("string"==typeof t){for(var e=0,n=this.domRoots;e<n.length;e++){var i=n[e].getElementById(t);if(i)return i}return null}return t},t.prototype.resolveElementsByClassName=function(t){for(var e=[],n=0,i=this.domRoots;n<i.length;n++)for(var o=i[n].querySelectorAll("."+t),r=0;r<o.length;r++)e.push(o[r]);return e},t.prototype.displayRecordsCount=function(t){this.resultCountSlot&&void 0!==t&&(this.resultCountSlot.style.display="inline",this.resultCountSlot.innerHTML=r.g.getText("MsgResultCount").replace("{0}",t.toString()))},t.prototype.getContext=function(){return this.context},t.prototype.setDialogService=function(t){this.context.getServices().registerDialogServiceResolver((function(){return t}))},t.prototype.executeQuery=function(t){console.warn("`executeQuery` is deprecated. Use `fetchData` instead"),this.fetchData(t)},t.prototype.fetchData=function(t){var e=this;t=t||{refresh:!0},this.showResultSpinner(),this.context.fetchData({elasticPaging:t.elasticPaging,success:function(n){e.hideResultSpinner(),e.toggleExportButtons(),e.displayRecordsCount(e.context.resultTable.getTotal()),!0===t.refresh&&e.context.refreshWidgets(s.WidgetGroup.Result),t.callback&&t.callback(),t.success&&t.success()},error:function(){e.hideResultSpinner()}})},t.prototype.toggleExportButtons=function(){this.enableExport&&this.context.resultTable&&this.context.resultTable.getCachedCount()>0?this.enableExportButtons():this.disableExportButtons()},t.prototype.enableExportButtons=function(){},t.prototype.disableExportButtons=function(){},t.prototype.renderSpinner=function(){this._spinnerDiv=Object(a.i)("div").addClass("eqjs-result-spinner").addChild("div",(function(t){return t.addClass(l.b+"-progress-win8",u.a.getMobileCssClass()).addHtml('<div class="wBall" id="wBall_1"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_2"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_3"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_4"><div class="wInnerBall"></div></div><div class="wBall" id="wBall_5"><div class="wInnerBall"></div></div>')})).toDOM()},t.prototype.showResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&!this._spinnerDiv.parentNode){for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];Object(a.i)(e).hide()}this.resultPanelSlot.appendChild(this._spinnerDiv)}},t.prototype.hideResultSpinner=function(){if(this.resultOptions.showProcessIndicator&&this.resultPanelSlot&&this._spinnerDiv.parentNode){this._spinnerDiv.parentNode.removeChild(this._spinnerDiv);for(var t=0;t<this.resultPanelSlot.children.length;t++){var e=this.resultPanelSlot.children[t];Object(a.i)(e).show()}}},t.prototype.createChartWidget=function(t){return this.resultOptions.chartWidgetResolver?this.resultOptions.chartWidgetResolver(t):new Vt(t)},t.prototype.createResultGridWidget=function(t){return this.resultOptions.resultGridResolver?this.resultOptions.resultGridResolver(t):new Bt(t)},t.prototype.createEntitiesPanelWidget=function(t){return new d(t)},t.prototype.createColumnsPanelWidget=function(t){return new D(t)},t.prototype.createQueryPanelWidget=function(t){return new vt(t)},t.prototype.createLocaleWidget=function(t){return new he(t)},t.prototype.createProcessWidget=function(t){return new At(t)},t.prototype.createColumnsBarWidget=function(t){return new P(t)},t.prototype.createFilterBarWidget=function(t){return new bt(t)},t.prototype.createSortingBarWidget=function(t){return new R(t)},t.prototype.createQueryNameWidget=function(t){return new fe(t)},t.prototype.createStatementPanelWidget=function(t){return new Ot(t)},t.prototype.createResultFacetsPanel=function(t){return new oe(t)},t.prototype.createExportWidget=function(t){return new se(t)},t.prototype.createAggregationBarWidget=function(t){return new ce(t)},t.prototype.detach=function(){this.entitiesPanelWidget&&(this.entitiesPanelWidget.destroy(),this.entitiesPanelWidget=null),this.columnsPanelWidget&&(this.columnsPanelWidget.destroy(),this.columnsPanelWidget=null),this.queryPanelWidget&&(this.queryPanelWidget.destroy(),this.queryPanelWidget=null),this.columnsBarWidget&&(this.columnsBarWidget.destroy(),this.columnsBarWidget=null),this.resultGridWidget&&(this.resultGridWidget.destroy(),this.resultGridWidget=null),this.chartWidget&&(this.chartWidget.destroy(),this.chartWidget=null),this.queryNameWidget&&(this.queryNameWidget.destroy(),this.queryNameWidget=null),this.processWidget&&(this.processWidget.destroy(),this.processWidget=null),this.localeWidget&&(this.localeWidget.destroy(),this.localeWidget=null),this.statementPanelWidget&&(this.statementPanelWidget.destroy(),this.statementPanelWidget=null),this.filterBarWidget&&(this.filterBarWidget.destroy(),this.filterBarWidget=null),this.sortingBarWidget&&(this.sortingBarWidget.destroy(),this.sortingBarWidget=null),this.statementWidget&&(this.statementWidget.destroy(),this.statementWidget=null),this.exportWidget&&(this.exportWidget.destroy(),this.exportWidget=null),this.resultFacetPanelWidget&&(this.resultFacetPanelWidget.destroy(),this.resultFacetPanelWidget=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),this.resultPanelSlot&&(this.resultPanelSlot.innerHTML="",this.resultPanelSlot=null),this.domRoots=[document],this.resetContext()},t}(),me=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)}}(),ye=function(t){function e(){var e=t.call(this)||this;e.exportButtons=[],e.disabledClass="eqjs-disabled",e.dropdownContainerClass="eqv-dropdown-container",e.dropdownButtonClass="eqv-drop-button",e.dropdownContentClass="eqv-dropdown-content",e.dropdownShowClass="eqv-dropdown-show",e._querySaveTemplate='<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"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n </div>\n </div>',e.queryListMenu=null,e.fetchDataButtonClickHandler=e.fetchDataButtonClick.bind(e),e.clearQueryButtonClickHandler=e.clearQueryButtonClick.bind(e),e.newQueryButtonClickHandler=e.newQueryButtonClick.bind(e),e.loadQueryButtonClickHandler=e.loadQueryButtonClick.bind(e),e.saveQueryButtonClickHandler=e.saveQueryButtonClick.bind(e),e.copyQueryButtonClickHandler=e.copyQueryButtonClick.bind(e),e.removeQueryButtonClickHandler=e.removeQueryButtonClick.bind(e),e.storageButtonClickHandler=e.storageDropButtonClick.bind(e),e.saveQueryToFileButtonClickHandler=e.saveQueryToFileButtonClick.bind(e),e.loadQueryFromFileButtonClickHandler=e.loadQueryFromFileButtonClick.bind(e);var n=e;return e.exportButtonClickHandler=function(t){if(!this.classList.contains(n.disabledClass)){var e=this.getAttribute("data-format");n.getContext().exportResult({format:e})}},e.queryChangedHandler=function(t){var n=t.data;e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(s.WidgetGroup.Result)),e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none"),e.options.syncQueryOnChange&&e.syncQuery(),e.options.fetchDataOnChange&&(!n||n.part!=s.QueryChangePart.ExtraData&&n.part!=s.QueryChangePart.Facets)&&e.fetchData()},e.outsideClickHandler=function(t){var n=null;t.target.matches("."+e.dropdownButtonClass)?n=t.target.parentElement.querySelector("."+e.dropdownContentClass):t.target.matches("."+e.dropdownButtonClass+" > span")&&(n=t.target.parentElement.parentElement.querySelector("."+e.dropdownContentClass));for(var i=e.resolveElementsByClassName(e.dropdownContentClass),o=0;o<i.length;o++){var r=i[o];n!=r&&r.classList.contains(e.dropdownShowClass)&&r.classList.remove(e.dropdownShowClass)}},e}return me(e,t),e.prototype.refreshQueryList=function(){var t=this;this.queryListPanel&&(this.queryListPanel.innerHTML="",this.context.loadQueryList({success:function(e){var n=Object(a.i)("ul",t.queryListPanel).addClass("list-group list-group-flush");e.map((function(e){n.addChild("li",(function(n){n.addClass("list-group-item").setStyle("cursor","pointer").data("id",e.id).text(e.name).on("click",(function(){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}))}))}))}}))},e.prototype.initOptions=function(e){return this.options=t.prototype.initOptions.call(this,e),void 0===this.options.syncQueryOnChange&&(this.options.syncQueryOnChange=!0),window.addEventListener("click",this.outsideClickHandler),this.options},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var i="eqjs-export",o="QueryContentJson",r="ClearQueryButton",s="NewQueryButton",a="LoadQueryButton",l="SaveQueryButton",u="CopyQueryButton",c="RemoveQueryButton",d="StorageDropButton",h="FetchDataButton",p="LoadQueryFromFileButton",f="SaveQueryToFileButton",g="QueryListPanel";e.slots&&(o=e.slots.queryContentInput||o,h=e.slots.fetchDataButton||h,r=e.slots.clearQueryButton||r,s=e.slots.newQueryButton||s,a=e.slots.loadQueryButton||a,l=e.slots.saveQueryButton||l,u=e.slots.copyQueryButton||u,c=e.slots.removeQueryButton||c,d=e.slots.storageButton||d,i=e.slots.exportClass||i,p=e.slots.loadQueryFromFileButton||p,f=e.slots.saveQueryToFileButton||f,g=e.slots.queryListPanel||g),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll("."+i)))}),[]),e.enableExport||this.hideExportButtons(),this.disableExportButtons();this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})),this.fetchDataButton||(this.fetchDataButton=this.resolveElement(h),this.fetchDataButton||(this.fetchDataButton=this.resolveElement("ExecuteQueryButton")),this.fetchDataButton&&this.fetchDataButton.addEventListener("click",this.fetchDataButtonClickHandler)),this.clearQueryButton||(this.clearQueryButton=this.resolveElement(r),this.clearQueryButton&&this.clearQueryButton.addEventListener("click",this.clearQueryButtonClickHandler)),this.newQueryButton||(this.newQueryButton=this.resolveElement(s),this.newQueryButton&&this.newQueryButton.addEventListener("click",this.newQueryButtonClickHandler)),this.loadQueryButton||(this.loadQueryButton=this.resolveElement(a),this.loadQueryButton&&this.loadQueryButton.addEventListener("click",this.loadQueryButtonClickHandler)),this.saveQueryButton||(this.saveQueryButton=this.resolveElement(l),this.saveQueryButton&&this.saveQueryButton.addEventListener("click",this.saveQueryButtonClickHandler)),this.copyQueryButton||(this.copyQueryButton=this.resolveElement(u),this.copyQueryButton&&this.copyQueryButton.addEventListener("click",this.copyQueryButtonClickHandler)),this.removeQueryButton||(this.removeQueryButton=this.resolveElement(c),this.removeQueryButton&&this.removeQueryButton.addEventListener("click",this.removeQueryButtonClickHandler)),this.storageDropButton||(this.storageDropButton=this.resolveElement(d),this.storageDropButton&&this.storageDropButton.addEventListener("click",this.storageButtonClickHandler)),this.saveQueryToFileButton||(this.saveQueryToFileButton=this.resolveElement(f),this.saveQueryToFileButton&&this.saveQueryToFileButton.addEventListener("click",this.saveQueryToFileButtonClickHandler)),this.queryListPanel||(this.queryListPanel=this.resolveElement(g),this.queryListPanel||(this.queryListPanel=this.resolveElement("QueryListSlot")),this.queryListPanel&&this.context.addEventListener("ready",(function(){n.refreshQueryList()}))),this.loadQueryFromFileButton||(this.loadQueryFromFileButton=this.resolveElement(p),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput=document.createElement("input"),this.loadQueryFromFileInput.type="file",this.loadQueryFromFileInput.accept=e.queryFileExtensions,this.loadQueryFromFileInput.style.display="none",document.body.appendChild(this.loadQueryFromFileInput),this.loadQueryFromFileInput.addEventListener("change",this.loadQueryFromFileInputSelect.bind(this)),this.loadQueryFromFileButton.addEventListener("click",this.loadQueryFromFileButtonClickHandler)))},e.prototype.initDone=function(){t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback(this.queryChangedHandler)},e.prototype.syncQuery=function(){var t=this;this.context.syncQuery({success:function(e){e.statement&&t.context.refreshWidgets(s.WidgetGroup.Statement)}})},e.prototype.disableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!0,e.classList.contains(t.disabledClass)||e.classList.add(t.disabledClass)}))},e.prototype.enableExportButtons=function(){var t=this;this.exportButtons.forEach((function(e){e.disabled=!1,e.classList.contains(t.disabledClass)&&e.classList.remove(t.disabledClass)}))},e.prototype.hideExportButtons=function(){this.exportButtons.forEach((function(t){t.style.display="none"}))},e.prototype.clearQueryButtonClick=function(){this.context.clearQuery(),this.context.refreshWidgets(s.WidgetGroup.Statement)},e.prototype.createNewQuery=function(t){return this.context.newQuery(t)},e.prototype.loadQuery=function(t){t&&this.context.loadQuery({queryId:t,silent:!1})},e.prototype.saveQuery=function(t,e){var n=this;this.context.saveQuery({success:function(){t&&t(),n.context.getQuery().fireChangedEvent({part:s.QueryChangePart.Properties,wasModified:!1}),n.refreshQueryList()},error:e})},e.prototype.saveCurrentQuery=function(t,e){var n=this;void 0===t&&(t=!1);var i=this.context.getQuery();i.isNewbie||t?this.showSaveQueryDialog((function(t){return new Promise((function(e){t&&(i.regenerateId(),i.setName(t),i.fireChangedEvent({part:s.QueryChangePart.Properties,wasModified:!0}),n.saveQuery((function(){e({success:!0})}),(function(t){return e({success:!1,message:t})})))}))})):this.saveQuery(e)},e.prototype.checkIfQueryModified=function(t){var e=this;this.context.getQuery().isModified()&&!this.options.disableConfirmationOnQueryChange?this.showQueryChangedDialog((function(n){n?e.saveCurrentQuery(!1,t):t()})):t()},e.prototype.removeCurrentQuery=function(){var t=this;this.context.removeQuery({success:function(){t.createNewQuery({useStorage:!1}),t.resultCountSlot&&(t.resultCountSlot.style.display="none"),t.context.clearResult(),t.refreshQueryList()}})},e.prototype.showNewQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=r.g.getText("NewQueryDefName"),i=e.open({title:r.g.getText("NewQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");n&&(t.value=n),document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("NewQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;i.disableButtons();var n=i.getRootElement().querySelector("header"),o=Object(a.i)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){n.removeChild(o),i.enableButtons(),t.success?i.close():i.showAlert(t.message,"error")}))}return!1}})},e.prototype.showQueryChangedDialog=function(t){this.context.getServices().getDialogService().openConfirm(r.g.getText("QueryChangedTitle"),r.g.getText("QueryChangedContent"),t)},e.prototype.showSaveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery(),i=n.isNewbie?n.getName():r.g.getText("SaveQueryDefName").replace("{queryName}",n.getName()),o=e.open({title:r.g.getText("SaveQueryTitle"),body:this._querySaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=i,document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("SaveQueryContent"),t.focus()},onSubmit:function(){var e=document.getElementById("kdlg-dialog-form-input").value;if(e&&e.replace(/\s/g,"").length>0){if(!t)return!0;o.disableButtons();var n=o.getRootElement().querySelector("header"),i=Object(a.i)("div",n).addClass("eqjs-process-bar local").toDOM();t(e).then((function(t){o.enableButtons(),n.removeChild(i),t.success?o.close():o.showAlert(t.message,"error")}))}return!1}})},e.prototype.showRemoveQueryDialog=function(t){var e=this.context.getServices().getDialogService(),n=this.context.getQuery();e.openConfirm(r.g.getText("RemoveQueryTitle"),r.g.getText("RemoveQueryContent").replace("{queryName}",n.getName()),t)},e.prototype.showSaveQueryToFileDialog=function(t){var e=this.getContext().getServices().getDialogService(),n=this.context.getQuery(),i=this.renderSaveToFileDialogBody(n.getName()),o=e.open({title:r.g.getText("SaveQueryToFileDlgTitle"),body:i,onSubmit:function(){var e=i.querySelector("#kdlgFileNameInput"),n=e?e.value:"Query",r=i.querySelector("#kdlgFileFormatSelector"),s=r?r.value:"json";if(t){o.disableButtons();var l=o.getRootElement().querySelector("header"),u=Object(a.i)("div",l).addClass("eqjs-process-bar local").toDOM();return t(n,s).then((function(t){o.enableButtons(),l.removeChild(u),t.success?o.close():o.showAlert(t.message,"error")})),!1}return!0}})},e.prototype.renderSaveToFileDialogBody=function(t,e){void 0===e&&(e="json");var n=u.a.IsIE(),i=n?"kfrm-fields-ie col-ie-1-4 label-align-right":"kfrm-fields col-a-1 label-align-right",o=n?"kfrm-fields-ie is-horizontal":"kfrm-fields is-horizontal";return Object(a.i)("div").addClass("kfrm-form").addChild("div",(function(n){n.addClass(i).addChild("label",(function(t){return t.attr("for","file_name").addText(r.g.getText("FileNameLabel"))})).addChild("div",(function(n){return n.addClass(o).addChild("input",(function(e){return e.id("kdlgFileNameInput").name("file_name").type("text").attr("value",t)})).addChild("label",(function(t){return t.addText(".")})).addChild("div",(function(t){return t.addClass("kfrm-select").addChild("select",(function(t){return t.id("kdlgFileFormatSelector").addClass("kdlg-form-control").addOption({value:"xml",selected:"xml"===e}).addOption({value:"json",selected:"json"===e})}))}))}))})).toDOM()},e.prototype.newQueryButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.createNewQuery()}))},e.prototype.saveQueryToFileButtonClick=function(){var t=this;this.showSaveQueryToFileDialog((function(e,n){return new Promise((function(i){t.context.getQueryFile({fileName:e,format:n,success:function(){return i({success:!0})},error:function(t){return i({success:!1,message:t})}})}))}))},e.prototype.loadQueryFromFileButtonClick=function(){var t=this;this.checkIfQueryModified((function(){t.showLoadQueryFromFileDialog()}))},e.prototype.showLoadQueryFromFileDialog=function(){this.loadQueryFromFileInput.click()},e.prototype.loadQueryFromFileInputSelect=function(){var t=this,e=this.loadQueryFromFileInput.files.item(0),n=new FormData;n.append(e.name,e),this.loadQueryFromFileInput.value="",this.context.uploadQueryFile({data:n,success:function(){t.syncQuery(),t.refreshQueryList()}})},e.prototype.loadQueryButtonClick=function(){var t=this;this.context.loadQueryList({success:function(e){t.fillLoadQueryButtonMenu(e),t.queryListMenu.showMenu({anchor:t.loadQueryButton,adjustHeight:!1,itemSelectedCallback:function(e){t.checkIfQueryModified((function(){return t.loadQuery(e.id)}))}})}})},e.prototype.fillLoadQueryButtonMenu=function(t){var e=this.getContext().getQuery();this.queryListMenu=new p({items:t.map((function(t){return{id:t.id,text:t.name}})),selectedIds:e.getId()})},e.prototype.saveQueryButtonClick=function(){this.saveCurrentQuery()},e.prototype.copyQueryButtonClick=function(){this.saveCurrentQuery(!0)},e.prototype.removeQueryButtonClick=function(){var t=this;this.showRemoveQueryDialog((function(e){e&&t.removeCurrentQuery()}))},e.prototype.storageDropButtonClick=function(){var t=this,e=this.storageDropButton.parentElement.querySelector("."+this.dropdownContentClass);e&&window.setTimeout((function(){return e.classList.toggle(t.dropdownShowClass)}),100)},e.prototype.fetchDataButtonClick=function(){this.fetchData()},e.prototype.detach=function(){var e=this;this.enableExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.fetchDataButton&&(this.fetchDataButton.removeEventListener("click",this.fetchDataButtonClickHandler),this.fetchDataButton=null),this.clearQueryButton&&(this.clearQueryButton.removeEventListener("click",this.clearQueryButtonClickHandler),this.clearQueryButton=null),this.newQueryButton&&(this.newQueryButton.removeEventListener("click",this.newQueryButtonClickHandler),this.newQueryButton=null),this.loadQueryButton&&(this.loadQueryButton.removeEventListener("click",this.loadQueryButtonClickHandler),this.loadQueryButton=null),this.saveQueryButton&&(this.saveQueryButton.removeEventListener("click",this.saveQueryButtonClickHandler),this.saveQueryButton=null),this.copyQueryButton&&(this.copyQueryButton.removeEventListener("click",this.copyQueryButtonClickHandler),this.copyQueryButton=null),this.removeQueryButton&&(this.removeQueryButton.removeEventListener("click",this.removeQueryButtonClickHandler),this.removeQueryButton=null),this.storageDropButton&&(this.storageDropButton.removeEventListener("click",this.storageButtonClickHandler),this.storageDropButton=null),this.saveQueryToFileButton&&(this.saveQueryToFileButton.removeEventListener("click",this.saveQueryToFileButtonClickHandler),this.saveQueryToFileButton=null),this.queryListPanel&&(this.queryListPanel=null),this.loadQueryFromFileButton&&(this.loadQueryFromFileInput&&document.body.removeChild(this.loadQueryFromFileInput),this.loadQueryFromFileButton.removeEventListener("click",this.loadQueryFromFileButtonClickHandler),this.loadQueryFromFileButton=null),t.prototype.detach.call(this)},e}(ge),ve=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)}}(),Ce=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ve(e,t),e.prototype.initOptions=function(e){var n=this;return e=t.prototype.initOptions.call(this,e),this.context.getQuery().addChangedCallback((function(){n.resultOptions.clearResultOnQueryChange&&n.context.clearResult(),e.syncQueryOnChange&&n.context.syncQuery()})),this.context.addEventListener("ready",this.fetchData.bind(this)),e},e.prototype.initWidgets=function(e){var n=this;if(t.prototype.initWidgets.call(this,e),this.sortingBarWidget&&this.context.getQuery().addChangedCallback((function(t){var e=t.data;!e||e.part!=s.QueryChangePart.SortingColumns&&e.part!=s.QueryChangePart.Columns&&e.part!=s.QueryChangePart.All||n.fetchData()})),this.filterBarWidget){var i=this.filterBarWidget.getWidgetType();e.widgets[i]=e.widgets[i]||{},e.widgets[i].applyFilterCallback||(e.widgets[i].applyFilterCallback=function(){n.fetchData()})}},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e.prototype.fetchData=function(){t.prototype.fetchData.call(this,{refresh:!0})},e}(ge),be=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)}}(),xe=function(t){function e(){return t.call(this)||this}return be(e,t),e.prototype.createResultGridWidget=function(t){return new Tt(t)},e.prototype.applyQueryFilter=function(){console.warn("applyQueryFilter is obsolete. Use fetchData instead"),this.fetchData()},e}(Ce),we=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)}}(),Ee=function(t){function e(){var e=t.call(this)||this;return e.reports=[],e.reportCache=[],e.exportButtons=[],e.exportClass="eqjs-export",e.disabledClass="eqjs-disabled",e.enableExport=!1,e.useReportCache=!0,e.syncReportOnChange=!0,e.fetchDataOnChange=!1,e._reportSaveTemplate='<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"></label>\n <input type="text" name="kdlg-dialog-form-input" id="kdlg-dialog-form-input" />\n <label for="kdlg-dialog-form-textarea" id="kdlg-dialog-form-desc-label"></label>\n <textarea type="text" name="kdlg-dialog-form-textarea" id="kdlg-dialog-form-textarea"></textarea>\n </div>\n </div>',e.context.useStoredQueryOnFetch=!0,e.exportButtonClickHandler=function(t,n){if(!t.classList.contains(e.disabledClass)){var i=t.getAttribute("data-format");e.context.exportResult({format:i})}},e.clearReportButtonClickHandler=e.clearReportButtonClick.bind(e),e.newReportButtonClickHandler=e.newReportButtonClick.bind(e),e.loadReportButtonClickHandler=e.loadReportButtonClick.bind(e),e.saveReportButtonClickHandler=e.saveReportButtonClick.bind(e),e.removeReportButtonClickHandler=e.removeReportButtonClick.bind(e),e.updateReportButtonClickHandler=e.updateReportButtonClick.bind(e),u.a.onMobileModeChanged((function(t){document.location.reload()})),e}return we(e,t),e.prototype.initOptions=function(e){return void 0!==(e=t.prototype.initOptions.call(this,e)).syncQueryOnChange&&(this.syncReportOnChange=e.syncQueryOnChange),void 0!==e.syncReportOnChange&&(this.syncReportOnChange=e.syncReportOnChange),e.syncQueryOnChange=this.syncReportOnChange,void 0!==e.useReportCache&&(this.useReportCache=e.useReportCache),this.defaultReportId=e.defaultReportId,e},e.prototype.initDone=function(){var e=this;t.prototype.initDone.call(this),this.context.getQuery().addChangedCallback((function(t){var n=t.data;(n&&("query.switched"==n.changeType?(e.context.clearResult(),e.context.refreshWidgets(s.WidgetGroup.Result),e.context.refreshWidgets(s.WidgetGroup.Query)):(e.disableExportButtons(),e.resultCountSlot&&(e.resultCountSlot.style.display="none"))),e.syncReportOnChange)&&(n&&"query.switched"!=n.changeType&&!n.noSync&&e.syncReport());n&&"query.switched"!=n.changeType&&n.part!=s.QueryChangePart.ExtraData&&n.part!=s.QueryChangePart.Facets&&(e.resultOptions.clearResultOnQueryChange&&(e.context.clearResult(),e.context.refreshWidgets(s.WidgetGroup.Result)),e.fetchDataOnChange&&e.fetchData())})),window.setTimeout((function(){e.context.loadQueryList({success:function(t){Array.isArray(t)&&(e.reports=t,e.reports.filter((function(t){return t.id==e.defaultReportId})).length>0?e.renderReportList({reportId:e.defaultReportId}):e.renderReportList())}})}),100)},e.prototype.initWidgets=function(e){var n=this;t.prototype.initWidgets.call(this,e);var i="ClearReportButton",o="NewReportButton",r="LoadReportButton",s="SaveReportButton",a="RemoveReportButton",l="UpdateReportButton",u="ResultCount",c="ResultExportButtons",d=this.exportClass;e.slots&&(u=e.slots.resultCountSpan||u,c=e.slots.exportButtons||c,i=e.slots.clearReportButton||i,o=e.slots.newReportButton||o,r=e.slots.loadReportButton||r,s=e.slots.saveReportButton||s,a=e.slots.removeReportButton||a,l=e.slots.updateReportButton||l,d=e.slots.exportClass||d),this.exportButtons=this.domRoots.reduce((function(t,e){return t.concat(Array.from(e.querySelectorAll("."+d)))}),[]),this.enableExport=e.enableExport,this.enableExport?this.exportButtons.forEach((function(t){t.addEventListener("click",n.exportButtonClickHandler)})):this.hideExportButtons(),this.exportButtonsContainer=this.resolveElement(c),this.clearReportButton||(this.clearReportButton=this.resolveElement(i),this.clearReportButton&&this.clearReportButton.addEventListener("click",this.clearReportButtonClickHandler)),this.newReportButton||(this.newReportButton=this.resolveElement(o),this.newReportButton&&this.newReportButton.addEventListener("click",this.newReportButtonClickHandler)),this.loadReportButton||(this.loadReportButton=this.resolveElement(r),this.loadReportButton&&this.loadReportButton.addEventListener("click",this.loadReportButtonClickHandler)),this.saveReportButton||(this.saveReportButton=this.resolveElement(s),this.saveReportButton&&this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler)),this.removeReportButton||(this.removeReportButton=this.resolveElement(a),this.removeReportButton&&this.removeReportButton.addEventListener("click",this.removeReportButtonClickHandler)),this.updateReportButton||(this.updateReportButton=this.resolveElement(l),this.updateReportButton&&this.updateReportButton.addEventListener("click",this.updateReportButtonClickHandler)),this.reportListSlot=document.getElementById("ReportList"),this.resultCountSlot=this.resolveElement(u)},e.prototype.newReport=function(){var t=this,e=this.context.getServices().getDialogService().open({title:r.g.getText("NewReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=r.g.getText("NewReportDefName"),document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.g.getText("ReportDescLabel"),t.focus()},onSubmit:function(){var n=document.getElementById("kdlg-dialog-form-input").value;if(n&&n.replace(/\s/g,"").length>0){e.clearAlert(),e.disableButtons();var i=e.getRootElement().querySelector("header"),o=Object(a.i)("div",i).addClass("eqjs-process-bar local").toDOM(),r=document.getElementById("kdlg-dialog-form-textarea").value;t.context.newQuery({name:n,description:r,success:function(){e.close();var n=t.context.getQuery(),i=n.getId();t.insertIntoReportList({id:i,name:n.getName(),description:n.getDescription()}),t.renderReportList({reportId:i})},error:function(t){i.removeChild(o),e.enableButtons(),e.showAlert(t,"error")}})}return!1}})},e.prototype.loadReport=function(t){var e=this;if(!t)throw"Empty report ID!";var n=this.findReportById(t);if(n){var i=this.context.getQuery(),o=function(){e.renderReportProps(),i.fireChangedEvent({part:s.QueryChangePart.All,noSync:!0,changeType:"query.switched"}),e.fetchData()},r=this.useReportCache?this.getReportContentFromCache(n):null;r?(i.clear(),i.loadFromJson(r,{validate:!1}),o()):this.context.loadQuery({queryId:t,silent:!0,success:function(){e.saveReportContentInCache(n,i.toJSON()),o()}}),this.setActiveReport(t)}},e.prototype.saveCurrentReportAs=function(){var t=this,e=this.context.getQuery(),n=this.context.getServices().getDialogService().open({title:r.g.getText("SaveReportDlgTitle"),body:this._reportSaveTemplate,submitable:!0,closable:!0,cancelable:!0,submitOnEnter:!0,arrangeParents:!1,beforeOpen:function(){var t=document.getElementById("kdlg-dialog-form-input");t.value=e.getName(),document.getElementById("kdlg-dialog-form-content").innerHTML=r.g.getText("SaveReportDlgLabel"),document.getElementById("kdlg-dialog-form-desc-label").innerHTML=r.g.getText("ReportDescLabel"),document.getElementById("kdlg-dialog-form-textarea").value=e.getDescription(),t.focus()},onSubmit:function(){var i=document.getElementById("kdlg-dialog-form-input").value;if(i&&i.replace(/\s/g,"").length>0){e.setId(r.i.generateId(i.replace(/\s/g,""))),n.clearAlert(),n.disableButtons();var o=n.getRootElement().querySelector("header"),l=Object(a.i)("div",o).addClass("eqjs-process-bar local").toDOM(),u=document.getElementById("kdlg-dialog-form-textarea").value;e.setDescription(u),t.context.newQuery({clearQuery:!1,name:i,success:function(){n.close(),t.context.refreshWidgets(s.WidgetGroup.Query);var i=t.context.getQuery().getId();t.fetchData(),t.insertIntoReportList({id:i,name:e.getName(),description:e.getDescription()}),t.renderReportList({reportId:i}),t.setActiveReport(i),t.renderReportProps()},error:function(t){o.removeChild(l),n.enableButtons(),n.showAlert(t,"error")}})}return!1}})},e.prototype.removeCurrentReport=function(){var t=this,e=this.context.getQuery();this.context.getServices().getDialogService().openConfirm(r.g.getText("RemoveReportDlgTitle"),r.g.getText("RemoveReportContent").replace("{reportName}",e.getName())).then((function(n){if(n){var i=e.getId();t.context.removeQuery({queryId:i,success:function(){var e=t.removeFromReportList(i);t.renderReportList({reportIndex:e})}})}}))},e.prototype.syncReport=function(){var t=this;if(this.useReportCache){var e=this.context.getQuery(),n=this.findReportById(e.getId());n&&(n.lastUpdated=Date.now(),this.saveReportContentInCache(n,e.toJSON()))}this.context.syncQuery({success:function(e){e.query&&t.context.refreshWidgets(s.WidgetGroup.Query),e.statement&&t.context.refreshWidgets(s.WidgetGroup.Statement)}})},e.prototype.setActiveReport=function(t){for(var e=this.reportListSlot.querySelectorAll("li"),n=0;n<e.length;n++){var i=e[n];i.classList.remove("active"),i.getAttribute("data-rid")===t&&i.classList.add("active")}},e.prototype.renderReportProps=function(){var t=this.context.getQuery();document.getElementById("ReportTitle").innerHTML=t.getName();var e=document.querySelector(".columns-bar");if(e){e.innerHTML="<strong>Columns:</strong>";for(var n=0,i=t.getColumns();n<i.length;n++){var o=i[n];e.innerHTML+='<span class="label label-default">'+o.caption+"</span> "}}},e.prototype.renderReportList=function(t){if(this.renderReportPanels(),!this.reportListSlot.matches("li")){this.reportListSlot.innerHTML="",t=t||{reportId:this.reports.length>0?this.reports[0].id:null};var e=document.createElement("ul");e.className="list-group list-group-flush",this.reportListSlot.appendChild(e);for(var n=0,i=this.reports;n<i.length;n++){var o=i[n];this.renderReportItemInList(o,e)}if(t.reportId&&this.loadReport(t.reportId),void 0!==t.reportIndex){var r=t.reportIndex;r>=this.reports.length&&(r=this.reports.length-1),r<0&&this.reports.length>0&&(r=0),r>=0&&this.loadReport(this.reports[r].id)}}},e.prototype.detach=function(){var e=this;this.exportButtonsContainer&&(this.showExportButtons(),this.exportButtons.forEach((function(t){t.removeEventListener("click",e.exportButtonClickHandler)})),this.exportButtons=[],this.exportButtonsContainer=null),this.clearReportButton&&(this.clearReportButton.removeEventListener("click",this.clearReportButtonClickHandler),this.clearReportButton=null),this.newReportButton&&(this.newReportButton.removeEventListener("click",this.newReportButtonClickHandler),this.newReportButton=null),this.loadReportButton||(this.loadReportButton.removeEventListener("click",this.loadReportButtonClickHandler),this.loadReportButton=null),this.saveReportButton&&(this.saveReportButton.addEventListener("click",this.saveReportButtonClickHandler),this.saveReportButton=null),this.removeReportButton||(this.removeReportButton.removeEventListener("click",this.removeReportButtonClickHandler),this.removeReportButton=null),this.updateReportButton&&(this.updateReportButton.removeEventListener("click",this.updateReportButtonClickHandler),this.removeReportButton=null),this.reportListSlot&&(this.reportListSlot.innerHTML="",this.reportListSlot=null),this.resultCountSlot&&(this.resultCountSlot.innerHTML="",this.resultCountSlot=null),t.prototype.detach.call(this)},e.prototype.renderReportItemInList=function(t,e){var n=this;e||(e=this.reportListSlot.querySelector("ul"));var i=t.name||t.description||"",o=document.createElement("li");o.className="list-group-item",o.style.cursor="pointer",o.setAttribute("data-rid",t.id),o.innerText=i,t.description&&(o.title=t.description),o.addEventListener("click",(function(t){var e=t.target.getAttribute("data-rid");n.loadReport(e),n.setActiveReport(e)})),e.appendChild(o)},e.prototype.renderReportPanels=function(){var t=document.getElementById("ReportsContainer"),e=document.getElementById("NoReportPanel");this.reports.length>0?(this.hideElement(e),this.showElement(t)):(this.hideElement(t),this.showElement(e))},e.prototype.hideElement=function(t){t&&(t.style.visibility="hidden")},e.prototype.showElement=function(t){t&&t.style.removeProperty("visibility")},e.prototype.insertIntoReportList=function(t){this.reports.push(t)},e.prototype.removeFromReportList=function(t){var e=this.indexOfReportById(t);return e>=0&&this.reports.splice(e,1),e},e.prototype.indexOfReportById=function(t){for(var e=0;e<this.reports.length;e++)if(this.reports[e].id===t)return e;return-1},e.prototype.clearReportButtonClick=function(){this.clearErrors(),this.context.clearQuery()},e.prototype.updateReportButtonClick=function(){this.fetchData()},e.prototype.saveReportButtonClick=function(){this.saveCurrentReportAs()},e.prototype.loadReportButtonClick=function(){this.loadReport("LastQuery")},e.prototype.removeReportButtonClick=function(){this.removeCurrentReport()},e.prototype.newReportButtonClick=function(){this.newReport()},e.prototype.errorHandler=function(t){},e.prototype.clearErrors=function(){},e.prototype.disableExportButtons=function(){this.hideExportButtons()},e.prototype.enableExportButtons=function(){this.showExportButtons()},e.prototype.hideExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="none")},e.prototype.showExportButtons=function(){this.exportButtonsContainer&&(this.exportButtonsContainer.style.display="initial")},e.prototype.saveReportContentInCache=function(t,e){var n=this.findReportCacheItem(t.id);n||(n={id:t.id},this.reportCache.push(n)),n.lastUpdated=t.lastUpdated,n.content=e},e.prototype.getReportContentFromCache=function(t){var e=this.findReportCacheItem(t.id);return e&&e.lastUpdated===t.lastUpdated?e.content:null},e.prototype.findReportById=function(t){for(var e=0,n=this.reports;e<n.length;e++){var i=n[e];if(i.id===t)return i}return null},e.prototype.findReportCacheItem=function(t){for(var e=0,n=this.reportCache;e<n.length;e++){var i=n[e];if(i.id===t)return i}return null},e}(ge);r.g.addMapper((function(t){if(t||t.texts)for(var e in t.texts)switch(e){case"PredicateTitle":t.texts.ConditionGroupTitle=t.texts[e];break;case"RootPredicateTitle":t.texts.RootConditionGroupTitle=t.texts[e];break;case"ErrIncorrectPredicateTitleFormat":t.texts.ErrIncorrectGroupTitleFormat=t.texts[e];break;case"ButtonAddPredicate":t.texts.ButtonAddGroup=t.texts[e];break;case"ButtonDelete":t.texts.CmdDelete=t.texts[e];break;case"ButtonClear":t.texts.CmdClear=t.texts[e];break;case"ButtonEnable":t.texts.CmdToggleEnable=t.texts[e];break;case"ButtonAddCondition":t.texts.CmdAddCondition=t.texts[e];break;case"ButtonAddGroup":t.texts.CmdAddCondGroup=t.texts[e]}})),r.g.updateDefaultTexts({AltMenuAttribute:"Attribute",AltMenuConstantExpression:"Constant expression",ButtonApply:"Apply",ButtonCancel:"Cancel",ButtonClose:"Close",ButtonNext:"Next",ButtonPrev:"Prev",ButtonNow:"Now",ButtonOK:"OK",MenuEnable:"Enabled",MenuParameterization:"Parameterized",MenuJoinCond:"Use in JOIN",CmdClear:"Clear",CmdDelete:"Delete",CmdToggleEnable:"Toggle enable",CmdAddCondition:"Add condition",CmdAddCondGroup:"Add group of conditions",ButtonSelectAll:"Select all",ButtonDeselectAll:"Clear selection",ButtonAddColumns:"Add column(s)",ButtonAddConditions:"Add condition(s)",CmdClickToAddCondition:"[Add new condition]",CmdDeleteRow:"Delete this row",ErrIncorrectGroupTitleFormat:"Incorrect condition group title format",ErrNotNumber:" is not a number",ErrIncorrectInteger:"Incorrect integer value",ErrIncorrectNumberList:"Incorrect list format",False:"False",LinkTypeAll:"all",LinkTypeAny:"any",LinkTypeNone:"none",LinkTypeNotAll:"not all",ConjAll:"and",ConjAny:"or",ConjNotAll:"and",ConjNone:"or",MsgApplySelection:"[Apply selection]",MsgAs:"as",MsgEmptyList:"(empty list)",MsgEmptyListValue:"[select value]",MsgEmptyScalarValue:"[enter value]",MsgSubQueryValue:"[edit sub-query]",MsgEmptyAttrValue:"[select attribute]",MsgEmptyOperator:"[Unrecognized operator]",MsgEmptyCustomSql:"[enter SQL expression]",MsgCustomSql:"[Custom SQL]",MsgNoResult:"No result",MsgResultCount:"{0} records found",MsgOf:"of",ConditionGroupTitle:"{lt} of the following apply",RootConditionGroupTitle:"Select records where {lt} of the following apply",StrAddConditions:"Add conditions",SubQueryDialogTitle:"Edit sub-query",SubQueryColumnTitle:"Column:",SubQueryEmptyColumn:"[select column]",SubQueryQueryPanelCaption:"Conditions",True:"True",ButtonSorting:"Sorting",ButtonToAggr:"Change to aggregate column",ButtonToSimple:"Change to simple column",ButtonFormat:"Display format",CmdAscending:"Ascending",CmdClickToAddColumn:"[Add new column]",CmdDeleteColumn:"Delete column",CmdDeleteSorting:"Delete sorting",CmdDescending:"Descending",CmdGroupSort:"Sorting",CmdGroupFormat:"Display format",CmdNotSorted:"Not sorted",ColTypeAggrFunc:"Aggregate function",ColTypeCompound:"Calculated",ColTypeGroup:"Column type",ColTypeSimple:"Simple column",HeaderExpression:"Expression",HeaderSorting:"Sorting",HeaderTitle:"Title",SortHeaderColumn:"Column",SortHeaderSorting:"Sorting",StrAddColumns:"Add columns",CustomExpression:"Custom Expression",AddAllForEntityText:"[Add all attributes]",CmdMoveToStart:"Move to start",CmdMoveRight:"Move right",CmdMoveLeft:"Move left",CmdMoveToEnd:"Move to the end",CmdMoveUp:"Move up",CmdMoveDown:"Move down",ButtonMenu:"Show menu",CmdToSimple:"Not aggregated",CmdMoveToFirst:"Move to the first",CmdMoveToPrev:"Move to the previous",CmdMoveToNext:"Move to the next",CmdMoveToLast:"Move to the last",CmdHiddenColumn:"Hidden",RowButtonTitle:"Click to see the available options",EntityToggle:"Toggle entity",StrNoFilterDefined:"No filter defined",StrNoFilterClickToAdd:"No filter defined. Click to add a new condition",HintHours:"Hours",HintMinutes:"Minutes",RemoveQueryTitle:"Confirmation",RemoveQueryContent:"Remove query [{queryName}]?",NewQueryTitle:"New query",NewQueryContent:"New query name: ",NewQueryDefName:"New query",SaveQueryTitle:"Save query",SaveQueryContent:"Query name: ",SaveQueryDefName:"{queryName} copy",QueryChangedTitle:"Confirmation",QueryChangedContent:"The query was changed. Do you want to save it first?",UpdateQuerySelector:"[click here to load the query]",FileNameLabel:"File name: ",SaveQueryToFileDlgTitle:"Save query to file",NewReportDefName:"New report",NewReportDlgTitle:"New report",SaveReportDlgTitle:"Save report",SaveReportDlgLabel:"Report name:",ReportDescLabel:"Description: ",RemoveReportDlgTitle:"Remove report",RemoveReportContent:"Are you sure you want to remove '{reportName}'?",Facets:{TotalRecordsLabel:"Total records:",AddMenuItems:{Chart:"Chart",Pivot:"Pivot table",DataTable:"Data table"},LoadDataDlgTitle:"Downloading data",LoadDataDlgContent:"Records loaded: {loadedRecs}/{totalRecs}",RefreshBtnTitle:"Refresh",ExportBtnTitle:"Export",MaximizeBtnTitle:"Maximize",RestoreBtnTitle:"Restore Down",RemoveFacetDlgTitle:"Remove facet",RemoveFacetDlgContent:"Are you sure, that you want to delete {facetTitle} tab?",DefaultDlgTitle:"Setup facet",DefaultFacetTitle:"",NewFacetTitle:"New Facet",TabNameLabel:"Tab name",ErrQueryChanged:"FAILED TO DISPLAY. QUERY WAS CHANGED",ErrNotEnoughData:"We can't display the graph because not all data for this query is loaded. \n The total number of records: {totalRecs}, currently loaded: {cachedRecs}. \n You can [download the result]. Please note: this may take some time and consume a lot of memory.",Chart:{FacetTitle:"Chart",DlgTitle:"Chart settings",DataColumnSelectorLabel:"Data column",LabelColumnSelectorLabel:"Label column",ChartTypeSelectorLabel:"Chart type",ShowLegendLabel:"Show legend (if available)"},Pivot:{FacetTitle:"Pivot table",DlgTitle:"Pivot settings",SwapBtnTitle:"Swap column and row fields",ColumnFieldSelectorLabel:"Column field",RowFieldSelectorLabel:"Row field",CellDataSelectorLabel:"Cell data",TotalsRowLabel:"Totals row",TotalsColLabel:"Totals column",TotalGridLabel:"Total"},DataTable:{FacetTitle:"Result table",DlgTitle:"Table facet settings"}},TotalsDlgLabel:"Totals",GrandTotalsLabel:"Grand totals",TotalsDlgTitle:"Select totals",ExportDlgTitle:"Export result",ExportDlgFmtLabel:"Format",csv:"CSV",excel:"Excel",pdf:"PDF","excel-html":"HTML (Excel-compatible)",AggrSettings:{GroupBtn:"Group selected column(s)",UngroupBtn:"Ungroup columns",AggrBtn:"Aggregate selected column",UnaggrBtn:"Remove column aggregation",GrandTotalsLabel:"Show grand totals",GroupCountsLabel:"Show record count for groups",EnableAggrLabel:"Enable aggregation",SelectedError:"Complete the action with selected column(s)",NoGroupsOrAggrError:"Add at least one group or aggregation",NoGroupsOrGrandError:"Add at least one group, or enable grand totals",NoAggrOrCountError:"Add at least one aggregation, or enable records count",NoGroupsLabel:"No groups",NoAggrsLabel:"No aggregations",EmptySettingsLabel:"[ Click to setup ]"},ChartType:{Area:"Area chart",Bar:"Bar chart",Column:"Column chart",Combo:"Combo chart",Doughnut:"Doughnut chart",Polar:"Polar chart",Radar:"Radar chart",Histogram:"Histogram chart",Line:"Line chart",SteppedLine:"Stepped line chart",Pie:"Pie chart"}}),s.EqServiceProvider.prototype.registerDialogServiceResolver=function(t){this.dialogServiceResolver=t},s.EqServiceProvider.prototype.getDialogService=function(){if(!this.dialogService){if(!this.dialogServiceResolver)throw"DialogServiceResolver is not defined";this.dialogService=this.dialogServiceResolver()}return this.dialogService},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),window.NodeList&&!window.NodeList.prototype.forEach&&(window.NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.findIndex||(Array.prototype.findIndex=function(t){if(null==this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),i=n.length>>>0,o=arguments[1],r=0;r<i;r++)if(e=n[r],t.call(o,e,r,n))return r;return-1})}])}));
3
3
  //# sourceMappingURL=easyquery.ui.min.js.map