@syncfusion/ej2-querybuilder 25.1.42 → 25.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * filename: ej2-querybuilder.min.js
3
- * version : 25.1.42
3
+ * version : 25.2.3
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
8
8
  * applicable laws.
9
9
  */
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionDropdowns"),require("SyncfusionButtons"),require("SyncfusionCalendars"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionPopups"),require("SyncfusionSplitbuttons")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionDropdowns","SyncfusionButtons","SyncfusionCalendars","SyncfusionData","SyncfusionInputs","SyncfusionPopups","SyncfusionSplitbuttons"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionDropdowns"),require("SyncfusionButtons"),require("SyncfusionCalendars"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionPopups"),require("SyncfusionSplitbuttons")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionDropdowns,e.SyncfusionButtons,e.SyncfusionCalendars,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionPopups,e.SyncfusionSplitbuttons)}(this,function(e,t,l,i,n,o,r,s){return function(e){function t(i){if(l[i])return l[i].exports;var n=l[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var l={};return t.m=e,t.c=l,t.i=function(e){return e},t.d=function(e,l,i){t.o(e,l)||Object.defineProperty(e,l,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var l=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(l,"a",l),l},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,l){t.exports=e},function(e,l){e.exports=t},function(e,t,l){"use strict";var i=l(4);l.d(t,"a",function(){return i.a}),l.d(t,"b",function(){return i.b}),l.d(t,"c",function(){return i.c}),l.d(t,"d",function(){return i.d}),l.d(t,"e",function(){return i.e});var n=l(5);l.d(t,"f",function(){return n.a})},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=l(2);l.d(t,"Columns",function(){return i.a}),l.d(t,"Rule",function(){return i.b}),l.d(t,"Value",function(){return i.c}),l.d(t,"ShowButtons",function(){return i.d}),l.d(t,"QueryBuilder",function(){return i.e}),l.d(t,"QueryLibrary",function(){return i.f})},function(e,t,l){"use strict";l.d(t,"a",function(){return m}),l.d(t,"b",function(){return f}),l.d(t,"c",function(){return g}),l.d(t,"d",function(){return v}),l.d(t,"e",function(){return y});var i=l(0),n=(l.n(i),l(6)),o=(l.n(n),l(1)),r=(l.n(o),l(8)),s=(l.n(r),l(9)),a=(l.n(s),l(7)),u=(l.n(a),l(11)),d=(l.n(u),l(10)),p=(l.n(d),this&&this.__extends||function(){var e=function(t,l){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])})(t,l)};return function(t,l){function i(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(i.prototype=l.prototype,new i)}}()),c=this&&this.__assign||function(){return c=Object.assign||function(e){for(var t,l=1,i=arguments.length;l<i;l++){t=arguments[l];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},c.apply(this,arguments)},h=this&&this.__decorate||function(e,t,l,i){var n,o=arguments.length,r=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,l):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,l,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(r=(o<3?n(r):o>3?n(t,l,r):n(t,l))||r);return o>3&&r&&Object.defineProperty(t,l,r),r},m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(null)],t.prototype,"field",void 0),h([l.i(i.Property)(null)],t.prototype,"label",void 0),h([l.i(i.Property)(null)],t.prototype,"type",void 0),h([l.i(i.Property)(null)],t.prototype,"values",void 0),h([l.i(i.Property)(null)],t.prototype,"operators",void 0),h([l.i(i.Property)()],t.prototype,"ruleTemplate",void 0),h([l.i(i.Property)(null)],t.prototype,"template",void 0),h([l.i(i.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],t.prototype,"validation",void 0),h([l.i(i.Property)(null)],t.prototype,"format",void 0),h([l.i(i.Property)(null)],t.prototype,"step",void 0),h([l.i(i.Property)(null)],t.prototype,"value",void 0),h([l.i(i.Property)(null)],t.prototype,"category",void 0),h([l.i(i.Property)(null)],t.prototype,"columns",void 0),t}(i.ChildProperty),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(null)],t.prototype,"condition",void 0),h([l.i(i.Collection)([],t)],t.prototype,"rules",void 0),h([l.i(i.Property)(null)],t.prototype,"field",void 0),h([l.i(i.Property)(null)],t.prototype,"label",void 0),h([l.i(i.Property)(null)],t.prototype,"type",void 0),h([l.i(i.Property)(null)],t.prototype,"operator",void 0),h([l.i(i.Property)(null)],t.prototype,"value",void 0),h([l.i(i.Property)(!1)],t.prototype,"not",void 0),h([l.i(i.Property)(!1)],t.prototype,"isLocked",void 0),t}(i.ChildProperty),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(null)],t.prototype,"numericTextBoxModel",void 0),h([l.i(i.Property)(null)],t.prototype,"multiSelectModel",void 0),h([l.i(i.Property)(null)],t.prototype,"datePickerModel",void 0),h([l.i(i.Property)(null)],t.prototype,"textBoxModel",void 0),h([l.i(i.Property)(null)],t.prototype,"radioButtonModel",void 0),t}(i.ChildProperty),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(!1)],t.prototype,"cloneRule",void 0),h([l.i(i.Property)(!1)],t.prototype,"cloneGroup",void 0),h([l.i(i.Property)(!1)],t.prototype,"lockRule",void 0),h([l.i(i.Property)(!1)],t.prototype,"lockGroup",void 0),h([l.i(i.Property)(!0)],t.prototype,"ruleDelete",void 0),h([l.i(i.Property)(!0)],t.prototype,"groupInsert",void 0),h([l.i(i.Property)(!0)],t.prototype,"groupDelete",void 0),t}(i.ChildProperty),y=function(e){function t(t,l){var i=e.call(this,t,l)||this;return i.isReadonly=!0,i.fields={text:"label",value:"field"},i.updatedRule={not:!1,condition:"and",isLocked:!1},i.isLocale=!1,i.isRefreshed=!1,i.isNotified=!1,i.isAddSuccess=!1,i.isNotValueChange=!1,i.isFieldChange=!1,i.isFieldClose=!1,i.isDestroy=!1,i.isGetNestedData=!1,i.isCustomOprCols=[],i.groupCounter=0,i.lockItems=[],i.groupIndex=-1,i.ruleIndex=-1,i.isLastGroup=!1,i.cloneGrpBtnClick=!1,i.isMiddleGroup=!1,i.cloneRuleBtnClick=!1,o.MultiSelect.Inject(o.CheckBoxSelection),i}return p(t,e),t.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},t.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),t=this.element.querySelectorAll("input.e-control"),n=0,o=t.length;n<o;n++)t[n].className.indexOf("e-tooltip")>-1?l.i(i.getComponent)(t[n],"tooltip").destroy():t[n].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(t[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var r=this.createElement("div",{attrs:{class:"e-group-container"}}),s=this.createElement("div",{attrs:{class:"e-group-header"}}),a=this.createElement("div",{attrs:{class:"e-group-body"}});r.appendChild(s).appendChild(a),this.element.appendChild(r),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&l.i(i.removeClass)(this.element.querySelectorAll(".e-qb-toggle"),"e-active-toggle"),e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),this.disableRuleCondition(e.parentElement)},t.prototype.getWrapper=function(){return this.element},t.prototype.getModuleName=function(){return"query-builder"},t.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},t.prototype.GetRootColumnName=function(e){return this.separator?e.split(this.separator)[0]:e},t.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],i=void 0,n=!1,o=!1,r=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=this.columns,u=0,d=a.length;u<d;u++)this.updateCustomOperator(a[u],"initial"),a[u].type||(e.indexOf(a[u].field)>-1&&(r=this.dataColl[0][a[u].field],i=typeof r,"string"===i?o=!isNaN(Date.parse(r)):"object"===i&&(o=r instanceof Date&&!isNaN(r.getTime()),i="string"),a[u].type=i,o=!1),i="string"),a[u].validation||(a[u].validation=s),a[u].category?n=!0:a[u].category=this.l10n.getConstant("OtherFields"),l.indexOf(a[u].category)<0&&l.push(a[u].category),(!a[u].operators||this.isLocale&&0!==this.isCustomOprCols.indexOf(a[u].field))&&(a[u].operators=this.customOperators[a[u].type+"Operator"]);n&&(l.length>1||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(var u=0,d=e.length;u<d;u++)r=this.dataColl[0][e[u]],i=typeof r,"string"===i?o=!isNaN(Date.parse(r)):"object"!==i||Object.keys(r).length||(o=r instanceof Date&&!isNaN(r.getTime()),i="string"),t[u]={field:e[u],label:e[u],type:o?"date":i,validation:s},o=!1,t[u].operators=this.customOperators[t[u].type+"Operator"],"object"===i&&this.updateSubFields(r,t[u]);this.columns=t}}else if(this.columns.length){for(var a=this.columns,u=0,d=a.length;u<d;u++)a[u].category?this.fields={text:"label",value:"field",groupBy:"category"}:a[u].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(a[u]),a[u].operators&&!this.isLocale||(a[u].operators=this.customOperators[a[u].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},t.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},t.prototype.updateSubFields=function(e,t,l){var i;t.columns=[];var n,o,r,s,a=Object.keys(e);l=l||this.dataColl[0];for(var u=0,d=a.length;u<d;u++){var p=t.field.split(".");s=l?l[p[p.length-1]][a[u]]:this.dataColl[0][t.field][a[u]];var c=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof s,n=t.field+this.separator+a[u],o=a[u],r="object"!==r||isNaN(Date.parse(s))?r:"date",i={field:n,label:o,type:r},"object"!==r&&(i.operators=this.customOperators[r+"Operator"]),t.columns.push(i),"object"===r&&this.updateSubFields(s,i,c)}},t.prototype.updateCustomOperator=function(e,t){if(e.operators){this.isLocale||"initial"!==t||l.i(i.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=this,o=0;o<e.operators.length;o++)!function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var i=e.operators[t],o=Object.keys(i),r=o.map(function(e){return i[""+e]}).join(",").split(","),s=o.indexOf("value");n.operators[r[s]]=r[l]}}(o)}},t.prototype.focusEventHandler=function(e){this.target=e.target},t.prototype.clickEventHandler=function(e){var t,n=this,o=e.target;this.isImportRules=!1;var r;if("SPAN"===o.tagName&&(o=o.parentElement),o.className.indexOf("e-collapse-rule")>-1){var s=new i.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var a=document.getElementById(this.element.id+"_summary_content"),u=a.querySelector(".e-summary-text");s.animate(".e-query-builder",{name:"SlideLeftIn"});var d=this.element.querySelector(".e-group-container");d.style.display="none",u.textContent=this.getSqlFromRules(this.rule),a.style.display="block",u.style.height=u.scrollHeight+"px"}if("BUTTON"===o.tagName&&o.className.indexOf("e-qb-toggle")<0)switch(!0){case o.className.indexOf("e-removerule")>-1:this.actionButton=o,this.deleteRule(o);break;case o.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=o,this.cloneRuleBtnClick=!0,this.ruleClone(o);break;case o.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=o,this.ruleLock(o);break;case o.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=o,this.groupLock(o);break;case o.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=o,this.cloneGrpBtnClick=!0,this.groupClone(l.i(i.closest)(o,".e-group-container"));break;case o.className.indexOf("e-deletegroup")>-1:this.actionButton=o,this.deleteGroup(l.i(i.closest)(o,".e-group-container"));break;case o.className.indexOf("e-edit-rule")>-1:var s=new i.Animation({duration:1e3,delay:0});if(s.animate(".e-query-builder",{name:"SlideLeftIn"}),document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not);var p=l.i(i.extend)({},this.rule,{},!0);this.setGroupRules(p),this.renderSummaryCollapse()}else{var d=this.element.querySelector(".e-group-container");d.querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}else if("LABEL"===o.tagName&&o.parentElement.className.indexOf("e-btn-group")>-1||o.className.indexOf("e-qb-toggle")>-1){var c=l.i(i.closest)(o,".e-group-container");if(!this.headerTemplate){var h=o.getAttribute("for"),m=void 0;h&&(m=document.getElementById(h).getAttribute("value")),r=c.id.replace(this.element.id+"_","");var f=this.getGroup(r),g=void 0;if(this.enableNotCondition)if(o.className.indexOf("e-qb-toggle")>-1){var v=c.getElementsByClassName("e-qb-toggle")[0];v.className.indexOf("e-active-toggle")>-1?(l.i(i.removeClass)([v],"e-active-toggle"),g=!1):(l.i(i.addClass)([v],"e-active-toggle"),g=!0),m=f.condition}else g=f.not;t={groupID:r,cancel:!1,type:"condition",value:m.toLowerCase()},this.enableNotCondition&&(t={groupID:r,cancel:!1,type:"condition",value:m.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(t,o):this.trigger("beforeChange",t,function(e){n.beforeSuccessCallBack(e,o)}),this.target=o}},t.prototype.beforeSuccessCallBack=function(e,t){if(!e.cancel){var n=l.i(i.closest)(t,".e-group-container"),o=n.id.replace(this.element.id+"_",""),r=this.getValidRules(this.rule),s=this.getParentGroup(n);s.condition=e.value,this.enableNotCondition&&(s.not=e.not),this.isImportRules||this.trigger("change",{groupID:o,type:"condition",value:s.condition}),this.filterRules(r,this.getValidRules(this.rule),"condition")}},t.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||l.i(i.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?l.i(i.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.i(i.removeClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&l.i(i.addClass)([t.element.querySelector("li").parentElement],"e-rtl")):l.i(i.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(l.i(i.closest)(e,".e-group-container"),{}):t.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,l.i(i.closest)(e,".e-group-container"),"",!0)},t.prototype.appendRuleElem=function(e,t,n,o,r,s){var a,u,d,p=e.querySelector(".e-rule-list");if("change"===n?a=l.i(i.select)("#"+o,e):(a=this.createElement("div",{attrs:{class:"e-rule-container"}}),a.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick?(this.ruleIndex<0?p.appendChild(a):p.insertBefore(a,p.children[this.ruleIndex+1]),this.cloneRuleBtnClick=!1):p.appendChild(a),this.ruleIdCounter++),t&&t.ruleTemplate&&s){d={requestType:"template-initialize",ruleID:a.id,action:r,fields:this.fields,rule:s},this.trigger("actionBegin",d),this.ruleTemplateFn=this.templateParser(t.ruleTemplate);var c=this.element.id+t.field,h=void 0;if(d.fields=this.fields,d.columns=this.columns,""===s.field&&(s.field=t.field),d.operators=this.getOperators(s.field),d.operatorFields={text:"key",value:"value"},this.isReact)h=this.ruleTemplateFn(d,this,a.id,c)[0],u=h,u.className+=" e-rule-field",a.appendChild(u);else if(this.isAngular){var m=this.ruleTemplateFn(d,this,a.id,c);h=3===m[0].nodeType?m[1]:m[0],u=h,u.className+=" e-rule-field",a.appendChild(u)}else this.isVue3?(h=this.ruleTemplateFn(d,this,"Template",c),u=h,l.i(i.append)(u,a),a.children[a.children.length-1].className+=" e-rule-field"):(h=this.ruleTemplateFn(d,this,"Template",c)[0],u=h,u.className+=" e-rule-field",a.appendChild(u))}else u=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),a.appendChild(u);return this.showButtons.lockGroup&&l.i(i.removeClass)(a.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&l.i(i.removeClass)(a.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&l.i(i.removeClass)(a.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&l.i(i.removeClass)(a.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&l.i(i.removeClass)(a.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),t&&t.ruleTemplate&&s&&this.renderReactTemplates(),a},t.prototype.addRuleElement=function(e,t,l,i,n,o){var r=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,i,n,o)):this.trigger("beforeChange",s,function(s){r.addRuleSuccessCallBack(s,e,t,l,i,n,o)})}},t.prototype.addRuleSuccessCallBack=function(e,t,n,r,s,a,u){var d,p,h,m,f=this.element.className.indexOf("e-device")>-1?"250px":"200px",g=n&&n.field?this.getColumn(n.field):r||this.columns[0],v={label:"",field:"",type:"",operator:""};if(!e.cancel){if(g&&g.ruleTemplate&&n.field){this.selectedColumn=g,p=this.selectedColumn.operators,v={label:g.label,field:g.field,type:g.type,operator:p[0].value};var y=Object.keys(n).length?n:v;m=this.appendRuleElem(t,g,s,a,"field",y);var b={requestType:"template-create",action:"insert-rule",ruleID:m.id,fields:this.fields,rule:y};this.trigger("actionBegin",b)}else{m=this.appendRuleElem(t,g,s,a,"field"),m.querySelector(".e-filter-input").setAttribute("id",m.id+"_filterkey");var C=m.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)C.textContent=this.l10n.getConstant("Remove"),l.i(i.addClass)([C],"e-flat"),l.i(i.addClass)([C],"e-primary");else{l.i(i.addClass)([C],"e-round"),l.i(i.addClass)([C],"e-icon-btn"),C.setAttribute("title",this.l10n.getConstant("DeleteRule"));var S=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});m.querySelector(".e-rule-delete").appendChild(S)}this.showButtons.ruleDelete||C.classList.add("e-button-hide")}if("Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?m.className="e-rule-container e-vertical-mode":m.className="e-rule-container e-horizontal-mode",m.previousElementSibling&&m.previousElementSibling.className.indexOf("e-rule-container")>-1&&(m.className.indexOf("e-joined-rule")<0&&(m.className+=" e-joined-rule"),m.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(m.previousElementSibling.className+=" e-prev-joined-rule")),m.previousElementSibling&&m.previousElementSibling.className.indexOf("e-group-container")>-1&&m.className.indexOf("e-separate-rule")<0&&(m.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(t,n,v,u,a),!g||g&&!g.ruleTemplate||!n.field)if("Default"===this.fieldMode){var x=void 0,O=void 0;O=this.separator&&n.field?this.GetRootColumnName(n.field):this.autoSelectField?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):n.field,x={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?f:"auto",close:this.fieldClose.bind(this,m.id+"_filterkey"),change:this.changeField.bind(this),value:n?O:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(x=c({},x,this.fieldModel)),h=new o.DropDownList(x),h.appendTo("#"+m.id+"_filterkey");var k=void 0;k=this.separator&&n.field?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):h.value,this.selectedColumn=h.getDataByValue(k),Object.keys(n).length&&this.changeRule(n,{element:h.element,itemData:this.selectedColumn})}else{var x=void 0,O=(this.isImportRules,n.field);this.dummyDropdownTreeDs=l.i(i.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),x={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:this.columns.length>5?f:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:l.i(i.isNullOrUndefined)(O)?null:[O],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt"},this.fieldModel&&(x=c({},x,this.fieldModel));var w=new o.DropDownTree(x);if(w.appendTo("#"+m.id+"_filterkey"),!l.i(i.isNullOrUndefined)(w.value)){var q=this.getLabelFromColumn(w.value[0]);w.element.value=q}var k=l.i(i.isNullOrUndefined)(n.field)?w.value:this.GetRootColumnName(n.field);this.selectedColumn=this.getColumn(k),Object.keys(n).length&&this.changeRule(n,{element:w.element,itemData:this.selectedColumn})}d=m.id.replace(this.element.id+"_",""),this.isImportRules||this.trigger("change",{groupID:t.id.replace(this.element.id+"_",""),ruleID:d,type:"insertRule"})}},t.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type&&(e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns))},t.prototype.updateAddedRule=function(e,t,n,o,r){var s,a,u,d=0;if(o){for(s=l.i(i.select)("#"+r,e),a=l.i(i.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,d++;u.rules[d]=t}else{a=l.i(i.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=t.custom;Object.keys(t).length?this.ruleIndex<0?(u.rules.push({field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),p&&(u.rules[u.rules.length-1].custom=p)):(u.rules.splice(this.ruleIndex+1,0,{field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),p&&(u.rules[this.ruleIndex+1].custom=p)):(p&&(n.custom=p),this.autoSelectField&&(t.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u)},t.prototype.changeRuleTemplate=function(e,t){var n=this.selectedColumn.operators;if(!e.ruleTemplate){var o=l.i(i.closest)(t,".e-group-container"),r=l.i(i.closest)(t,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&(l.i(i.detach)(t.closest('[id="'+r+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([r])),e){var s={field:e.field,label:e.label,operator:n[0].value,value:""};this.addRuleElement(o,s,e,"change",r,!0)}}},t.prototype.renderToolTip=function(e){var t=new d.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},t.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation){var n=["isnull","isnotnull","isempty","isnotempty"],o=void 0,r=void 0,s=void 0,a=void 0,u=[],d=void 0,p=void 0,c=void 0,h=void 0,m=void 0,f=this.element.querySelectorAll(".e-rule-container");for(o=0,r=f.length;o<r;o++){var g=void 0;if(d=l.i(i.closest)(f[o],".e-group-container"),m=this.getParentGroup(d),p=0,a=h=f[o],"DropdownTree"===this.fieldMode?(e=l.i(i.getComponent)(f[o].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(c=l.i(i.getComponent)(f[o].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&c.value&&(this.selectedColumn=c.getDataByValue(c.value),g=!l.i(i.isNullOrUndefined)(c.index)&&this.selectedColumn.validation),s=h.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;a&&null!==a.previousElementSibling;)a=a.previousElementSibling,p++;if(s=h.querySelector(".e-rule-operator .e-control"),m.rules[p].operator||(s.parentElement.className.indexOf("e-tooltip")<0&&s.className.indexOf("e-tooltip")<0&&this.renderToolTip(s.parentElement),t=!1),m.rules[p].value instanceof Array&&(u=m.rules[p].value),n.indexOf(m.rules[p].operator)<-1&&l.i(i.isNullOrUndefined)(m.rules[p].value)&&"date"!==m.rules[p].type||""===m.rules[p].value||m.rules[p].value instanceof Array&&u.length<1){var v=h.querySelectorAll(".e-rule-value .e-control");t=!1;for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=l.i(i.closest)(C,".e-multi-select-wrapper"),S.className.indexOf("e-tooltip")<0&&this.renderToolTip(S)):v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(v[y].parentElement),y++}}}else(c&&c.element&&l.i(i.isNullOrUndefined)(c.index)||e&&e.element&&(l.i(i.isNullOrUndefined)(e.value)||e.value.length<1))&&(s.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(s.parentElement),t=!1)}}return t},t.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");if(e){this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)}},t.prototype.refreshLevel=function(e){var t,n,o=e.groupElement.querySelector(".e-rule-list").children,r=e.groupElement,s=o.length,a=0;for(n=0;n<s;n++)t=o[n],t.className.indexOf("e-group-container")>-1&&(e.level.push(a),this.levelColl[t.id]=e.level.slice(),a++,e.groupElement=t,e=this.refreshLevel(e));var u=l.i(i.closest)(r,".e-rule-list");return e.groupElement=u?l.i(i.closest)(u,".e-group-container"):r,e.level=this.levelColl[e.groupElement.id].slice(),e},t.prototype.groupTemplate=function(){var e,t,l,i,n,o=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),s=this.createElement("div",{attrs:{class:"e-group-body"}}),a=this.createElement("div",{attrs:{class:"e-rule-list"}});return o.appendChild(r),s.appendChild(a),o.appendChild(s),this.headerTemplate||(e=this.createElement("div",{attrs:{class:"e-lib e-btn-group",role:"group"}}),this.enableNotCondition&&(t=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),e.appendChild(t)),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),e.appendChild(t),l=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),e.appendChild(l),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),e.appendChild(t),l=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),e.appendChild(l),r.appendChild(e),i=this.createElement("div",{attrs:{class:"e-group-action"}}),n=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(n),r.appendChild(i)),o},t.prototype.ruleTemplate=function(){var e,t,n,o,r=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}});var a=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(a),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",o=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var u=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),d=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});u.appendChild(d);var p=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:o}});d=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),p.appendChild(d),t=this.showButtons.ruleDelete||l.i(i.isNullOrUndefined)(this.showButtons.ruleDelete)?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide";var c=this.createElement("button",{attrs:{type:"button",class:t}});return e.appendChild(u),e.appendChild(p),e.appendChild(c),s.appendChild(e),r.appendChild(s),r},t.prototype.addGroupElement=function(e,t,l,i,n,o,r){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,i,n,o,r)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,l,i,n,o,r)})},t.prototype.addGroupSuccess=function(e,t,o,r,s,a,d,p){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var c=o,h=void 0,m="";m=c.className.indexOf("e-group-container")<0?c.querySelector(".e-group-container")&&c.querySelector(".e-group-container").id:c.id;var f=this.groupElem.cloneNode(!0);if(f.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.headerTemplate&&(d?(t=!1,f.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(f,a,r,p,m),this.groupIdCounter=0):this.headerTemplateFn(f,a,r,p,m)),this.groupIdCounter++,!this.headerTemplate){var g=f.querySelector(".e-btngroup-and"),v=f.querySelector(".e-btngroup-or"),y=f.querySelector(".e-btngroup-and-lbl"),b=f.querySelector(".e-btngroup-or-lbl");g.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),g.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(t){var C=void 0;C=this.showButtons.groupDelete||l.i(i.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}});new n.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),l.i(i.rippleEffect)(h,{selector:".deletegroup"});for(var S=c.querySelector(".e-rule-list"),x=S.children,O=0,k=0,w=x.length;k<w;k++)x[k].className.indexOf("e-group-container")>-1&&(O+=1);this.showButtons.cloneGroup&&this.cloneGrpBtnClick?this.groupIndex===x.length-1?(S.appendChild(f),this.isLastGroup=!0):(x[this.groupIndex+1].parentNode.insertBefore(f,x[this.groupIndex+1]),this.isMiddleGroup=!0):S.appendChild(f);var q=this.levelColl[c.id].slice(0);if(q.push(O),this.levelColl[f.id]=q,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],c.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,s&&this.addRuleToNewGroups&&this.addRuleElement(f,{})),!this.headerTemplate){var N="";N=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var E=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:N}}),R=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});E.appendChild(R),f.querySelector(".e-group-action").appendChild(E),N=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var I=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:N}}),L=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});I.appendChild(L),f.querySelector(".e-group-action").appendChild(I),f.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){var N="";N=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var I=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:N}}),R=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});I.appendChild(R),f.querySelector(".e-group-action").appendChild(I)}c.appendChild(f),this.levelColl[f.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var D=f.querySelector(".e-qb-toggle");new n.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"}).appendTo(D),f.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&l.i(i.addClass)([D],"e-active-toggle")}if(this.updatedRule=null,this.headerTemplate){var T={requestType:"header-template-create",ruleID:f.id,condition:r,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",T)}else{var B=f.querySelector(".e-add-btn");new u.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,B),select:this.selectBtn.bind(this,B)}).appendTo(B),B.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules){var P=c.id.replace(this.element.id+"_",""),M=f.id.replace(this.element.id+"_","");this.trigger("change",{groupID:P,type:"insertGroup",childGroupID:M})}}},t.prototype.headerTemplateFn=function(e,t,n,o,r){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?t:void 0,condition:n,rule:this.getRuleCollection(o,!0),groupID:r},this.trigger("actionBegin",a),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],d.appendChild(s);else if(this.isAngular){var p=this.headerFn(a,this,e.id,u);s=3===p[0].nodeType?p[1]:p[0],d.appendChild(s)}else this.isVue3?(s=this.headerFn(a,this,e.id,u),l.i(i.append)(s,d)):(s=this.headerFn(a,this,"Template",u)[0],d.appendChild(s));this.renderReactTemplates()}return e},t.prototype.notifyChange=function(e,t,n){var o=l.i(i.closest)(t,".e-group-container"),r=this.getParentGroup(o),s=l.i(i.closest)(t,".e-rule-container"),a=0;if("not"===n)return void(r.not=e);if("condition"===n)return void(r.condition=e);for(;s&&null!==s.previousElementSibling;)s=s.previousElementSibling,a++;var u=r.rules[a],d=this.getColumn(u.field),p=this.getFormat(d.format);if("date"===d.type)if(e instanceof Date)e=this.intl.formatDate(e,p);else if(e instanceof Array)for(var c=0;c<e.length;c++)e[c]&&e[c]instanceof Date&&(e[c]=this.intl.formatDate(e[c],p));d.ruleTemplate?this.templateChange(t,e,n):(this.isNotified=!0,this.updateRules(t,e),this.isNotified=!1)},t.prototype.templateChange=function(e,t,n){var o,r=l.i(i.closest)(e,".e-group-container"),s=this.getParentGroup(r),a=l.i(i.closest)(e,".e-rule-container"),u=0;for(this.allowValidation&&this.validateValue(s,a);a&&null!==a.previousElementSibling;)a=a.previousElementSibling,u++;var d=s.rules[u];"field"===n?this.selectedColumn=this.getColumn(t):d&&(this.selectedColumn=this.getColumn(d.field));var p;this.previousColumn=this.getColumn(d.field);var c=this.getValidRules(this.rule);this.selectedColumn&&(p=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var h,m=["in","notin","between","notbetween"];switch(n){case"field":d.field=t,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=p[0].value;break;case"operator":h=d.operator,d.operator=t,m.indexOf(d.operator)>-1?d.value=[]:m.indexOf(h)>-1&&(d.value="");break;case"value":d.value=t}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(c,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var f=l.i(i.closest)(e,".e-rule-container");this.destroyControls(f,!0),l.i(i.detach)(f.querySelector(".e-rule-field"));var g=this.appendRuleElem(l.i(i.closest)(f,".e-group-container"),this.selectedColumn,"change",f.id,n,d);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?g.className="e-rule-container e-vertical-mode":g.className="e-rule-container e-horizontal-mode",g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-rule-container")>-1&&(g.className.indexOf("e-joined-rule")<0&&(g.className+=" e-joined-rule"),g.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(g.previousElementSibling.className+=" e-prev-joined-rule")),g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-group-container")>-1&&g.className.indexOf("e-separate-rule")<0&&(g.className+=" e-separate-rule");var v={requestType:"template-create",action:n,ruleID:f.id,fields:this.fields,rule:d};o={groupID:r.id.replace(this.element.id+"_",""),ruleID:f.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",v),this.trigger("change",o)}},t.prototype.changeValue=function(e,t){var n,o=this;if(t.element&&t.element.classList.contains("e-multiselect")){n=t.element}else n=t.event?t.event.target:t.element;if(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1){n=t.element}var r,s=l.i(i.closest)(n,".e-group-container"),a=l.i(i.closest)(n,".e-rule-container"),u=s&&s.id.replace(this.element.id+"_",""),d=a.id.replace(this.element.id+"_",""),p=t;p.element&&p.element.className.indexOf("e-datepicker")>-1&&(n=p.element,r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),r&&(this.selectedColumn=r.getDataByValue(r.value)),(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(r.value[0])));var c,h;if(n.className.indexOf("e-radio")>-1)if(h=parseInt(n.id.split("valuekey")[1],0),"Default"===this.fieldMode?(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=r.getDataByValue(r.value),this.selectedColumn.columns&&(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(r.value))):(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(r.value[0])),this.selectedColumn.values)c=this.selectedColumn.values[h];else{var m=[!0,!1];c=m[h]}else c=n.className.indexOf("e-multiselect")>-1?l.i(i.getComponent)(n,"multiselect").value:t.value;"input"===t.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){o.filterValue(u,d,c,e,n)},this.immediateModeDelay)):this.filterValue(u,d,c,e,n)},t.prototype.filterValue=function(e,t,l,i,n){var o=this,r={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(r,n,i,e,t):this.trigger("beforeChange",r,function(l){o.changeValueSuccessCallBack(l,n,i,e,t)})},t.prototype.changeValueSuccessCallBack=function(e,t,l,i,n){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:i,ruleID:n,value:e.value,cancel:!1,type:"value"}))},t.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var t=l.i(i.getComponent)(e,"dropdownlist"),n=t.popupObj.element.querySelector(".e-active"),o=t.getItemData();t.value=o.value;var r={element:t.element,value:o.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:o,event:null,e:null};t.previousValue!==t.value&&this.changeField(r),this.isFieldChange=!1}},t.prototype.changeField=function(e){if(e.isInteracted){if(l.i(i.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var t=l.i(i.closest)(e.element,".e-rule-filter")||l.i(i.closest)(e.element,".e-rule-sub-filter"),n="DropdownTree"===this.fieldMode?this.getColumn(e.value[0]):this.getColumn(e.value);if("DropdownTree"===this.fieldMode&&null!==t){var o=t.querySelector(".e-dropdowntree.e-control"),r=l.i(i.getComponent)(o,"dropdowntree");if(!n)return;if("object"===n.type){if(r.value=e.oldValue,r.dataBind(),l.i(i.isNullOrUndefined)(e.oldValue))o.value="";else{var s=this.getLabelFromColumn(e.oldValue[0]);o.value=s}return}if(!l.i(i.isNullOrUndefined)(e.value[0])){r.value=e.value[0],r.dataBind();var s=this.getLabelFromColumn(e.value[0]);o.value=s}}if(this.destroySubFields(t),this.subFieldElem=null,this.isNotValueChange=!0,n&&n.ruleTemplate)this.templateChange(e.element,n.field,"field");else if(n&&n.columns&&n.columns[0].ruleTemplate)this.templateChange(e.element,n.columns[0].field,"field");else{for(var a=l.i(i.closest)(e.element,".e-group-container"),u=this.getParentGroup(a),d=l.i(i.closest)(e.element,".e-rule-container"),p=0;d&&null!==d.previousElementSibling;)d=d.previousElementSibling,p++;u.rules[p].value="",this.changeRule(u.rules[p],e)}}},t.prototype.changeRule=function(e,t){if(!t.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==l.i(i.getComponent)(t.element,"dropdowntree").value)return}var n={},o=l.i(i.closest)(t.element,".e-rule-filter");o=o||l.i(i.closest)(t.element,".e-rule-sub-filter");var r=l.i(i.getComponent)(t.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==o&&(r=l.i(i.getComponent)(t.element,"dropdowntree"));var s=l.i(i.closest)(t.element,".e-group-container"),a=s.id.replace(this.element.id+"_","");this.changeFilter(o,r,a,e,n,t)},t.prototype.changeFilter=function(e,t,n,o,r,s){var a=this;if(e){var u=void 0;u="DropdownTree"===this.fieldMode?t.value[0]:this.isImportRules?this.GetRootColumnName(t.value):t.value,this.selectedColumn=this.getColumn(u);var d=l.i(i.closest)(e,".e-rule-container"),p=d.id.replace(this.element.id+"_",""),c={groupID:n,ruleID:p,selectedField:"DropdownTree"===this.fieldMode?t.value[0]:t.value,cancel:!1,type:"field"};this.isImportRules?this.fieldChangeSuccess(c,r,e,o,s):this.trigger("beforeChange",c,function(t){a.fieldChangeSuccess(t,r,e,o,s)})}else{var h=l.i(i.closest)(s.element,".e-rule-operator");this.changeOperator(e,h,t,n,o,r,s)}},t.prototype.changeOperator=function(e,t,n,o,r,s,a){var u,d,p,c=this;t?(u=l.i(i.closest)(t,".e-rule-container"),d=u.id.replace(this.element.id+"_",""),p={groupID:o,ruleID:d,selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(p,e,s,r,a):this.trigger("beforeChange",p,function(t){c.operatorChangeSuccess(t,e,s,r,a)})):this.changeRuleValues(e,r,s,a)},t.prototype.fieldChangeSuccess=function(e,t,n,o,r){for(var s=l.i(i.closest)(n,".e-rule-container"),a=l.i(i.closest)(r.element,".e-rule-operator"),u=l.i(i.closest)(r.element,".e-group-container"),d=u.id.replace(this.element.id+"_",""),p=l.i(i.getComponent)(r.element,"dropdownlist"),c=s.querySelectorAll(".e-tooltip.e-input-group"),h=0;h<c.length;h++)l.i(i.getComponent)(c[h],"tooltip").destroy();if(e.cancel)this.changeOperator(n,a,p,d,o,t,r);else{if(l.i(i.isNullOrUndefined)(this.selectedColumn))return;if(t.type=this.selectedColumn.type,s.querySelector(".e-template")&&(o.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(t.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,o,t,r);else this.destroySubFields(n),this.changeOperator(n,a,p,d,o,t,r)}},t.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},t.prototype.createSubFields=function(e,t,n,r){var s=!1,a=l.i(i.closest)(e,".e-rule-field"),u=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});a.insertBefore(u,a.querySelector(".e-rule-operator"));var d=l.i(i.closest)(u,".e-rule-container").id,p=this.createElement("input",{attrs:{type:"text",id:d+"_subfilterkey"+this.subFilterCounter}});u.appendChild(p);var h,m=this.element.className.indexOf("e-device")>-1?"250px":"200px";h={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?m:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(h=c({},h,this.fieldModel));var f=new o.DropDownList(h);if(f.appendTo("#"+d+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(t.field)===this.GetRootColumnName(this.previousColumn.field))for(var g=this.selectedColumn.columns,v=0;v<g.length;v++)if(t.field===g[v].field||t.field.indexOf(g[v].field+this.separator)>-1){f.value=g[v].field,this.selectedColumn=g[v],s=!0;break}this.subFilterCounter++,this.subFieldElem=p,r.itemData=r.itemData,!s&&this.selectedColumn.columns&&(!s&&this.isImportRules&&(f.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(u,t,n,r)},t.prototype.operatorChangeSuccess=function(e,t,n,o,r){if(!e.cancel){var s=l.i(i.closest)(r.element,".e-rule-operator"),a=s.nextElementSibling,u=l.i(i.getComponent)(r.element,"dropdownlist"),d=o.operator?o.operator.toString().toLowerCase():"";n.operator=u.value.toString();var p=n.operator.toLowerCase();if(n.operator.toLowerCase().indexOf("between")>-1||n.operator.toLowerCase().indexOf("in")>-1&&n.operator.toLowerCase().indexOf("contains")<0?(t=s.previousElementSibling,n.type=o.type,(n.operator.toLowerCase().indexOf("in")<0||d.indexOf("in")<0)&&(o.value=[])):"object"==typeof o.value&&null!==o.value&&(o.value=o.value.length>0?o.value[0]:"number"===o.type?0:""),r.previousItemData){var c=r.previousItemData.value.toString().toLowerCase();(c.indexOf("between")>-1||(c.indexOf("in")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contains")<0)&&(t=s.previousElementSibling,n.type=o.type)}if(d.indexOf("in")>-1&&d.indexOf("in")<5&&p.indexOf("in")>-1&&p.indexOf("in")<5&&(t=null),n.operator.indexOf("null")>-1||n.operator.indexOf("empty")>-1){var h=s.parentElement.querySelector(".e-rule-value"),m=h.querySelector(".e-tooltip.e-input-group");m&&l.i(i.getComponent)(m,"tooltip").destroy(),l.i(i.removeClass)([h],"e-show"),l.i(i.addClass)([h],"e-hide")}a&&this.getColumn(o.field).template&&(t=s.previousElementSibling),0==a.children.length&&(t=s.previousElementSibling),this.changeRuleValues(t,o,n,r)}},t.prototype.changeRuleValues=function(e,t,n,r){var s,a,u,d,p=l.i(i.closest)(r.element,".e-rule-operator");if(e)if(p=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(n.type=this.selectedColumn.type,s=p.classList.contains("e-rule-sub-filter"),p=s?p.nextElementSibling:p),l.i(i.addClass)([p],"e-operator"),p.childElementCount){a=l.i(i.getComponent)(p.querySelector(".e-dropdownlist"),"dropdownlist"),n.operator=a.value;var h=void 0;h="DropdownTree"===this.fieldMode?l.i(i.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):l.i(i.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),n.type="DropdownTree"===this.fieldMode?this.getColumn(h.value[0]).type:this.getColumn(h.value).type;var m=r.itemData;""!==a.value&&this.renderValues(p,m,r.previousItemData,!0,t,n,r.element)}else{var f=l.i(i.closest)(p,".e-rule-container").id;d=this.createElement("input",{attrs:{type:"text",id:f+"_operatorkey"}}),p.appendChild(d),this.selectedColumn.operators?u=this.selectedColumn.operators:r.itemData&&(u=this.customOperators[this.selectedColumn.type+"Operator"]);var g=this.element.className.indexOf("e-device")>-1?"250px":"200px",v=u[0].value,y=0;this.autoSelectOperator||(v="",y=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1)&&(v=t&&t.operator?t.operator:v);var b=void 0;b={dataSource:u,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:u.length>5?g:"auto",change:this.changeField.bind(this),index:y,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(b=c({},b,this.operatorModel));var C=new o.DropDownList(b);C.appendTo("#"+f+"_operatorkey"),n.operator=t&&""!==t.operator&&!l.i(i.isNullOrUndefined)(t.operator)?t.operator:u[0].value,this.isImportRules&&(n.type=this.selectedColumn.type,n.operator=t.operator),l.i(i.isNullOrUndefined)(v)||""===v?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(p,this.selectedColumn,r.previousItemData,!1,t,n,r.element):this.renderValues(p,this.selectedColumn,r.previousItemData,!1,t,n,r.element)}this.isImportRules||this.updateRules(r.element,r.item)},t.prototype.popupOpen=function(e,t){this.enableRtl&&l.i(i.addClass)([t.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},t.prototype.destroyControls=function(e,t){for(var n=t?e:e.nextElementSibling,o=n.querySelectorAll("input.e-control"),r=n.querySelectorAll("div.e-control:not(.e-handle)"),s=this.columns,a=0,u=o.length;a<u;a++){if(o[a].classList.contains("e-textbox"))l.i(i.getComponent)(o[a],"textbox").destroy(),l.i(i.detach)(l.i(i.select)("input#"+o[a].id,n));else if(o[a].classList.contains("e-dropdownlist"))this.allowValidation&&o[a].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(o[a].parentElement,"tooltip").destroy(),l.i(i.getComponent)(o[a],"dropdownlist").destroy();else if(o[a].classList.contains("e-radio"))l.i(i.getComponent)(o[a],"radio").destroy();else if(o[a].classList.contains("e-numerictextbox"))l.i(i.getComponent)(o[a],"numerictextbox").destroy(),l.i(i.detach)(l.i(i.select)("input#"+o[a].id,n));else if(o[a].classList.contains("e-datepicker"))l.i(i.getComponent)(o[a],"datepicker").destroy();else if(o[a].classList.contains("e-multiselect"))l.i(i.getComponent)(o[a],"multiselect").destroy();else if(o[a].className.indexOf("e-template")>-1)for(var d=o[a].className,p=0,c=s.length;p<c;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],o[a].id);break}document.getElementById(o[a].id)&&l.i(i.detach)(o[a])}for(var a=0,u=r.length;a<u;a++){if(r[a].className.indexOf("e-template")>-1)for(var d=r[a].className,p=0,c=s.length;p<c;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],r[a].id);break}l.i(i.detach)(r[a])}for(var h=n.querySelectorAll(".e-template:not(.e-control)"),a=0,u=h.length;a<u;a++)l.i(i.detach)(h[a])},t.prototype.templateDestroy=function(e,t){var n;if("string"!=typeof e.template||void 0===e.template.destroy){n=e.template;var o=n.destroy;if(n.destroy){var r=void 0;document.getElementById(t)&&(r=l.i(i.closest)(document.getElementById(t),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof o?(o=l.i(i.getValue)(o,window))({field:e.field,elementId:t,elements:r}):n.destroy({field:e.field,elementId:t,elements:r})}}},t.prototype.getValues=function(e){var t,l={},i=[],n=[];this.separator.length>0&&(n=e.split(this.separator));var o=this.dataColl;if(this.dataColl[1])for(var r=0,s=o.length;r<s;r++){var a={};if(n.length>1)for(var u=o[r],d=void 0,p=0,c=n.length;p<c;p++)d=n[p],n.length===p+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=o[r][""+e],Number(o[r][""+e])===o[r][""+e]&&o[r][""+e]%1!=0&&(t=o[r][""+e].toString());t in l||(l[""+t]=1,n.length>1?this.createNestedObject(a,n,t):a[""+e]=t,i.push(a))}return i},t.prototype.createNestedObject=function(e,t,l){for(var i,n=t.length-1,o=0;o<n;++o)i=t[o],i in e||(e[""+i]={}),e=e[""+i];e[t[n]]=l},t.prototype.getDistinctValues=function(e,t){for(var l={},i=[],n=[],o="",r=t.indexOf(this.separator),s=this,a=0,u=e.length;a<u;a++)!function(a,u){0===r?o=e[a][""+t]:(n=t.split(s.separator),n.forEach(function(t){o=o?o[""+t]:e[a][""+t]})),Number(e[a][""+t])===e[a][""+t]&&e[a][""+t]%1!=0&&(o=e[a][""+t].toString());var d={};o in l||(l[""+o]=1,0===r?d[""+t]=o:d[n[n.length-1]]=o,i.push(d))}(a);return i},t.prototype.renderMultiSelect=function(e,t,l,i,n){var s,a=!1,u=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(a=!0,s=this.getDistinctValues(this.dataColl,e.field)),a=!e.columns&&a,!this.dataColl.length&&n.length&&(u=!0);var d;d={dataSource:u?n:a?s:this.dataManager,query:new r.Query([e.field]),fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(d=c({},d,this.valueModel.multiSelectModel));var p=new o.MultiSelect(d);p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},t.prototype.multiSelectOpen=function(e,t){if(this.dataSource instanceof r.DataManager){var n=document.getElementById(e),o=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist");this.selectedColumn=o.getDataByValue(o.value);var s=this.selectedColumn.field,a=!1;if(this.dataColl[1]){Object.keys(this.dataColl[1]).indexOf(s)>-1&&(a=!0);0!==s.indexOf(this.separator)&&this.isGetNestedData&&(a=!0)}a||(t.cancel=!0,this.bindMultiSelectData(n,s))}},t.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},t.prototype.getMultiSelectData=function(e,t){var n,o=this,s=new r.Deferred,a=this.dataManager.executeQuery((new r.Query).select(t)),u=l.i(i.getComponent)(e,"multiselect");u.hideSpinner(),this.createSpinner(l.i(i.closest)(e,".e-multi-select-wrapper").parentElement),l.i(d.showSpinner)(l.i(i.closest)(e,".e-multi-select-wrapper").parentElement),a.then(function(r){n=r.actual&&r.actual.result?r.actual.result:r.result,o.dataColl=l.i(i.extend)(o.dataColl,n,[],!0),u.dataSource=o.getDistinctValues(o.dataColl,t),o.isGetNestedData=!0,l.i(d.hideSpinner)(l.i(i.closest)(e,".e-multi-select-wrapper").parentElement)}).catch(function(e){s.reject(e)})},t.prototype.createSpinner=function(e){var t=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(t),l.i(d.createSpinner)({target:t,width:i.Browser.isDevice?"16px":"14px"})},t.prototype.closePopup=function(e,t){var n=document.getElementById(t.popup.element.id.replace("_popup",""));if(n){var o=l.i(i.getComponent)(n,"multiselect").value;this.updateRules(n,o,e)}},t.prototype.processTemplate=function(e,t,n,o){var r=l.i(i.closest)(e,".e-rule-container"),s=r.querySelectorAll(".e-template"),a=r.querySelector(".e-rule-filter .e-filter-input"),u="DropdownTree"===this.fieldMode?l.i(i.getComponent)(a,"dropdowntree"):l.i(i.getComponent)(r.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);if("string"==typeof t.template||void 0===t.template.write){var p={rule:n,ruleID:r.id,operator:o.operator,field:d.field,requestType:"value-template-create"};this.trigger("actionBegin",p)}else{var c=t.template;"string"==typeof c.write?l.i(i.getValue)(c.write,window)({elements:s.length>1?s:s[0],values:n.value,operator:o.operator,field:d.field,dataSource:d.values}):"function"!=typeof t.template&&t.template.write({elements:s.length>1?s:s[0],values:n.value,operator:o.operator,field:d.field,dataSource:d.values})}},t.prototype.getItemData=function(e){var t=l.i(i.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist");return"DropdownTree"===this.fieldMode&&(t=l.i(i.getComponent)(document.getElementById(e+"_filterkey"),"dropdowntree")),"DropdownTree"===this.fieldMode?this.getColumn(t.value[0]):this.getColumn(t.value)},t.prototype.setDefaultValue=function(e,t,n){var o=this.getItemData(e);if(l.i(i.isNullOrUndefined)(o.value))return n?t?[0,0]:0:t?[]:"";if(t){if(!(o.value instanceof Array))return[o.value]}else if(o.value instanceof Array)return o.value[0];return o.value},t.prototype.renderStringValue=function(e,t,l,i,n){var o,r,a=this.getItemData(e),u="string"==typeof a.template;if(r=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!=t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),r=o.join(","));var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.textBoxModel&&(d=c({},d,this.valueModel.textBoxModel));var p=new s.TextBox(d);p.appendTo("#"+e+"_valuekey"+i),p.value=r,p.dataBind()}else o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,i,o,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px")},t.prototype.renderNumberValue=function(e,t,l,i,n,o,r){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1);var p=d.join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.textBoxModel&&(h=c({},h,this.valueModel.textBoxModel));var m=new s.TextBox(h);m.appendTo("#"+e+"_valuekey"+i),m.value=p,m.dataBind()}else{o=a;var f=o.validation&&o.validation.min?o.validation.min:0,g=o.validation&&o.validation.max?o.validation.max:Number.MAX_VALUE,v=o.format?o.format:"n";r>1&&t&&(d=t.value[i]?t.value[i]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[i]:d,format:v,min:f,max:g,width:"100%",step:o.step?o.step:1,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=c({},y,this.valueModel.numericTextBoxModel));var b=new s.NumericTextBox(y);b.appendTo("#"+e+"_valuekey"+i),b.element.setAttribute("aria-label",o.label+" Value")}else d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,i,d,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?n.style.width="100%":(n.style.minWidth="200px",n.style.width=null)},t.prototype.processValueString=function(e,t){var l=[],i=e.split(",");if("string"===t)return i;for(var n=0,o=i.length;n<o;n++)l.push(Number(i[n]));return l},t.prototype.parseDate=function(e,t){var n,o;if(t){var r=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(t),o=r(e),l.i(i.isNullOrUndefined)(o)&&(o=this.intl.parseDate(e,n))}else o=new Date(e);return o},t.prototype.renderControls=function(e,t,n,o,r){if(l.i(i.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),l.i(i.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),l.i(i.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),t.template&&(t.template.create||r))this.processTemplate(e,t,n,o);else{var s;s="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var u=l.i(i.closest)(e,".e-rule-container").id,d=void 0,p=o.operator.toString();if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){d=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?d.style.width="100%":"in"!==p&&"notin"!==p?l.i(i.addClass)([d],"e-custom-value"):l.i(i.removeClass)([d],"e-custom-value");for(var h=0;h<s;h++)switch(o.type){case"string":this.renderStringValue(u,n,p,h,d);break;case"number":this.renderNumberValue(u,n,p,h,d,t,s);break;case"boolean":this.processBoolValues(t,n,u,h);break;case"date":var m=new Date,f=void 0,g=void 0,v=t.format,y=void 0,b=void 0,C=this.l10n.getConstant("SelectValue"),S="string"==typeof t.template;if(n.value&&!l.i(i.isNullOrUndefined)(v)&&(f=s>1?n.value[h]:n.value,m=this.parseDate(f,v)||new Date),t.field||t.key||!t.value||(m=t.value instanceof Date?t.value:this.parseDate(t.value,t.format)),!t.format&&n&&""!==n.field&&(g=this.getColumn(n.field),v=g.format),(this.isImportRules||this.isPublic||S)&&n&&(g=this.getColumn(n.field),v=g.format,n.value?(f=s>1?n.value[h]:n.value,m=this.parseDate(f,g.format)):m=n.value),v){var x=this.getFormat(v);x.skeleton?(b={locale:this.getLocale(),value:m,placeholder:C,format:x,change:this.changeValue.bind(this,h)},this.valueModel&&this.valueModel.datePickerModel&&(b=c({},b,this.valueModel.datePickerModel)),y=new a.DatePicker(b)):(b={value:m,locale:this.getLocale(),placeholder:C,format:x.format,change:this.changeValue.bind(this,h)},this.valueModel&&this.valueModel.datePickerModel&&(b=c({},b,this.valueModel.datePickerModel)),y=new a.DatePicker(b))}else b={locale:this.getLocale(),value:m,placeholder:C,change:this.changeValue.bind(this,h)},this.valueModel&&this.valueModel.datePickerModel&&(b=c({},b,this.valueModel.datePickerModel)),y=new a.DatePicker(b);if(y.appendTo("#"+u+"_valuekey"+h),!n.value){var O=document.getElementById(u+"_valuekey"+h);this.updateRules(O,m,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},t.prototype.processBoolValues=function(e,t,o,r){var s,a,u=!1;l.i(i.isNullOrUndefined)(t.type)&&e&&(t.type=e.type);var d;if(e.values){var p=e.values;"boolean"!==t.type||l.i(i.isNullOrUndefined)(t.value)?e.value?u=p[r].toLowerCase()===e.value.toString().toLowerCase():0===r&&(u=!0):u=p[r].toLowerCase()===t.value.toString().toLowerCase(),a=s=d=p[r]}else{var p=[!0,!1];"boolean"!==t.type||l.i(i.isNullOrUndefined)(t.value)?e.value?u=p[r].toString().toLowerCase()===e.value.toString().toLowerCase():0===r&&(u="boolean"!=typeof t.value||!!t.value):u=p[r].toString().toLowerCase()===t.value.toString().toLowerCase(),"boolean"==typeof t.value&&1===r&&(u=!t.value),s=p[r].toString(),a=p[r],d=this.l10n.getConstant(["True","False"][r])}var h;h={label:d,name:o+"default",checked:u,value:s,change:this.changeValue.bind(this,r)},this.valueModel&&this.valueModel.radioButtonModel&&(h=c({},h,this.valueModel.radioButtonModel));var m=new n.RadioButton(h);m.appendTo("#"+o+"_valuekey"+r),u&&this.updateRules(m.element,a,0,!0)},t.prototype.getOperatorIndex=function(e,t){var l,i=e.dataSource,n=i.length;for(l=0;l<n;l++)if(t.operator===e.dataSource[l].value)return l;return 0},t.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},t.prototype.renderValues=function(e,t,n,o,r,s,a){var u=e.previousElementSibling,d=u.getElementsByTagName("input")[0],p="DropdownTree"===this.fieldMode?l.i(i.getComponent)(d,"dropdowntree"):l.i(i.getComponent)(d,"dropdownlist"),c="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]):this.getColumn(p.value);this.selectedRule=c;var h=l.i(i.getComponent)(e.querySelector("input"),"dropdownlist");o&&(t=a.id.indexOf("operator")>-1?t:this.selectedRule,t.operators&&(h.value=null,h.dataBind(),h.dataSource=t.operators,h.index=this.getOperatorIndex(h,r),h.value=s.operator=h.dataSource[h.index].value,this.autoSelectOperator?h.dataBind():(h.index=-1,s.operator=h.value="")));var m=s.operator.toString(),f=!1;if(m.indexOf("null")>-1||m.indexOf("isempty")>-1||m.indexOf("isnotempty")>-1){var g=e.parentElement.querySelector(".e-rule-value");g&&(l.i(i.removeClass)([g],"e-show"),l.i(i.addClass)([g],"e-hide"))}else{var v=l.i(i.closest)(e,".e-rule-container").id;if(n=this.getPreviousItemData(n,c),n&&void 0===n.template?n.columns&&(n=this.getColumn(r.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(r.field)),n&&n.template){this.templateDestroy(n,v+"_valuekey0");var y=l.i(i.select)("#"+v+"_valuekey0",e.nextElementSibling);y&&!y.classList.contains("e-control")&&l.i(i.detach)(l.i(i.select)("#"+v+"_valuekey0",e.nextElementSibling)),"string"!=typeof n.template&&void 0!==n.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([v]),e.nextElementSibling.innerHTML="")}if(o&&(this.validateValue(r,l.i(i.closest)(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||h&&""!==h.value){if(c&&(t.template=c.template),t.template&&(l.i(i.addClass)([e.nextElementSibling],"e-template-value"),t.template=c.template,f=this.setColumnTemplate(t,v,c.field,t.value||m,e,r)),f){var g=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?g.style.width="100%":g.style.width="200px"}else{l.i(i.removeClass)([e.nextElementSibling],"e-template-value");var b=1;b="boolean"===s.type?this.selectedColumn.values?this.selectedColumn.values.length:2:m&&m.toLowerCase().indexOf("between")>-1?2:1;for(var C=0;C<b;C++){var S=this.createElement("input",{attrs:{type:"text",id:v+"_valuekey"+C}});e.nextElementSibling.appendChild(S)}}this.renderControls(e,t,r,s,f)}}},t.prototype.setColumnTemplate=function(e,t,n,o,r,s){var a,u=this,d=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return a={requestType:"value-template-initialize",ruleID:t,field:n,operator:o,rule:s,renderTemplate:!0},this.trigger("actionBegin",a,function(l){d=u.actionBeginSuccessCallBack(l,e,t,n,r)}),d;var p=void 0,c=e.template;if((p="string"==typeof c.create?l.i(i.getValue)(c.create,window)({field:n,operator:o}):c.create({field:n,operator:o}))instanceof Element)p.id=t+"_valuekey0",l.i(i.addClass)([p],"e-template"),r.nextElementSibling.appendChild(p),n.indexOf(" ")<0&&l.i(i.addClass)([p],"e-"+n);else if(p instanceof Array){l.i(i.addClass)(p,"e-template");for(var h=0,m=p.length;h<m;h++)p[h].id=t+"_valuekey"+h,r.nextElementSibling.appendChild(p[h])}return l.i(i.addClass)([r.nextElementSibling],"e-template-value"),!0}return!0},t.prototype.actionBeginSuccessCallBack=function(e,t,n,o,r){if(e.renderTemplate){var s=void 0;this.columnTemplateFn=this.templateParser((t.template,t.template));var a=this.element.id+o;if(this.isReact)s=this.columnTemplateFn(e,this,n,a)[0],r.nextElementSibling.appendChild(s);else if(this.isAngular){var u=this.columnTemplateFn(e,this,n,a);s=3===u[0].nodeType?u[1]:u[0],r.nextElementSibling.appendChild(s)}else this.isVue3?(s=this.columnTemplateFn(e,this,"Template",a),l.i(i.append)(s,r.nextElementSibling)):(s=this.columnTemplateFn(e,this,"Template",a)[0],r.nextElementSibling.appendChild(s));return l.i(i.addClass)([r.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},t.prototype.updateValues=function(e,t){var n=1;e.className.indexOf("e-template")>-1&&(n=3);var o=e.className.split(" e-")[n],r=parseInt(e.id.slice(-1),2);switch(o){case"checkbox":var s=l.i(i.getComponent)(e,o).value;t.value=""!==s?s:void 0;break;case"textbox":case"dropdownlist":t.value=l.i(i.getComponent)(e,o).value;break;case"radio":var a=l.i(i.getComponent)(e,o);a.checked&&("boolean"==typeof t.value?t.value="true"===a.value:this.getColumn(t.field).values?t.value=a.value:t.value="true"===a.value),a.refresh();break;case"numerictextbox":t.operator.indexOf("between")>-1?("string"==typeof t.value&&(t.value=[]),t.value[r]=l.i(i.getComponent)(e,o).value):t.value=l.i(i.getComponent)(e,o).value;break;case"datepicker":var u=this.getColumn(t.field),d=this.getFormat(u.format),p=l.i(i.getComponent)(e,o).value;t.operator.indexOf("between")>-1?("string"==typeof t.value&&(t.value=[]),t.value[r]=this.intl.formatDate(p,d)):l.i(i.isNullOrUndefined)(d.format)&&p?t.value=this.intl.formatDate(p):t.value=p?this.intl.formatDate(p,d):p;break;case"multiselect":t.value=l.i(i.getComponent)(e,o).value}},t.prototype.updateRules=function(e,t,n,o){for(var r,s,a=l.i(i.closest)(e,".e-group-container"),u=this.getParentGroup(a),d=l.i(i.closest)(e,".e-rule-container"),p=0,c=a.id.replace(this.element.id+"_",""),h=this.getValidRules(this.rule);d&&null!==d.previousElementSibling;)d=d.previousElementSibling,p++;var m=u.rules[p].operator?u.rules[p].operator.toString():"";d=l.i(i.closest)(e,".e-rule-container");var f=d.id.replace(this.element.id+"_","");if(l.i(i.closest)(e,".e-rule-filter")||l.i(i.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),r="DropdownTree"===this.fieldMode?l.i(i.getComponent)(e,"dropdowntree"):l.i(i.getComponent)(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(r.value[0]):this.getColumn(r.value);!this.isImportRules&&u.rules[p].field&&u.rules[p].field.toLowerCase()!==g.field.toLowerCase()&&(!d.querySelectorAll(".e-template")&&!(m.indexOf("null")>-1)||m.indexOf("empty")>-1)&&(u.rules[p].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),u.rules[p].field=this.selectedColumn.field,u.rules[p].type=this.selectedColumn.type,u.rules[p].label=this.selectedColumn.label;var v=l.i(i.closest)(e,".e-rule-filter");v=v||l.i(i.closest)(e,".e-rule-sub-filter");var y=v.nextElementSibling.querySelector("input.e-control");y=y||v.nextElementSibling.nextElementSibling.querySelector("input.e-control"),m=l.i(i.getComponent)(y,"dropdownlist").value.toString(),u.rules[p].operator=m;var b=v.nextElementSibling.nextElementSibling,C=b.querySelectorAll("input.e-control");C.length<1&&(C=b.querySelectorAll("div.e-control")),C.length<1&&(C=b.querySelectorAll(".e-template")),s={groupID:c,ruleID:f,value:u.rules[p].field,type:"field"};for(var S=0;S<C.length;S++)m.indexOf("null")>-1||m.indexOf("empty")>-1?u.rules[p].value=null:this.updateValues(C[S],u.rules[p]);this.isImportRules||this.trigger("change",s),this.allowValidation&&u.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(h,this.getValidRules(this.rule),"field")}else if(l.i(i.closest)(e,".e-rule-operator")){r=l.i(i.getComponent)(e,"dropdownlist"),u.rules[p].operator=r.value.toString();var x=d.querySelectorAll(".e-rule-value input.e-control");s={groupID:c,ruleID:f,value:r.value,type:"operator"},this.allowValidation&&u.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(e.parentElement,"tooltip").destroy(),x.length>1&&!(x[0].className.indexOf("e-template")>-1)&&(u.rules[p].value=[]);for(var O=0;O<x.length;O++)u.rules[p].operator.indexOf("null")>-1||u.rules[p].operator.indexOf("empty")>-1?u.rules[p].value=null:x[O].classList.contains("e-template")||this.updateValues(x[O],u.rules[p]);this.isImportRules||this.trigger("change",s),this.filterRules(h,this.getValidRules(this.rule),"operator")}else l.i(i.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,t,u,p,a,d,n),o||this.filterRules(h,this.getValidRules(this.rule),"value"))},t.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},t.prototype.ruleValueUpdate=function(e,t,l,i,n,o,r){var s,a,u=["in","between","notin","notbetween"];if(l.rules[i].operator&&(a=l.rules[i].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[i].type&&!this.isNotified){for(var d=[],p=t,c=0,h=p.length;c<h;c++)"string"==typeof p[c]&&d.push(parseFloat(p[c]));d.length&&(t=d)}if(this.isNotified)l.rules[i].value=t,s={groupID:n.id,ruleID:o.id,value:l.rules[i].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[i].value[r]=t:l.rules[i].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[i].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[i].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[i].type,l.rules[i].value=this.processValueString(t,l.rules[i].type)):l.rules[i].value=t;else if(e.className.indexOf("e-datepicker")>-1){var m=this.getFormat(this.getColumn(this.selectedColumn.field).format);m.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[i].value&&(l.rules[i].value=[]),l.rules[i].value[r]=this.intl.formatDate(t,m)):l.rules[i].value=this.intl.formatDate(t,m))}this.validateValue(l,o,i)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[i].value&&(l.rules[i].value=[]),l.rules[i].value[r]=t):l.rules[i].value=t},t.prototype.validateValue=function(e,t,n){l.i(i.isNullOrUndefined)(n)||(e=e.rules[n]);var o="object"==typeof e.value;if(this.allowValidation&&(l.i(i.isNullOrUndefined)(n)||(o?e.value.length>0:e.value))){var r=t.querySelectorAll(".e-rule-value .e-control");r.length>0&&(r[0].className.indexOf("e-tooltip")>-1?l.i(i.getComponent)(r[0],"tooltip").destroy():r[0].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(r[0].parentElement,"tooltip").destroy(),r[1]&&r[1].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(r[1].parentElement,"tooltip").destroy())}},t.prototype.getFormat=function(e){var t;return e?"string"==typeof e?(t={type:"dateTime"},"short"===e||"yMd"===e?(t.type="date",t.skeleton=e):t.format=e):t={type:"dateTime",skeleton:e.skeleton}:t={type:"date",skeleton:"yMd"},t},t.prototype.findGroupByIdx=function(e,t,l){var i=t.rules,n=[];if(!l){for(var o=0,r=i.length;o<r;o++)t=i[o],t.rules&&n.push(t);return n[e]}return t},t.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var t,n,o,r;e.prototype.destroy.call(this);var s;for(t=this.element.querySelectorAll(".e-addrulegroup"),o=t.length,n=0;n<o;n++)l.i(i.getComponent)(t[n],"dropdown-btn").destroy(),l.i(i.detach)(t[n]);for(r=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<r.length;n++)l.i(i.getComponent)(r[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)"),o=t.length,n=0;n<o;n++)l.i(i.getComponent)(t[n],"dropdownlist")?l.i(i.getComponent)(t[n],"dropdownlist").destroy():l.i(i.getComponent)(t[n],"dropdowntree").destroy(),l.i(i.detach)(t[n]);for(r=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<r.length;n++)l.i(i.getComponent)(r[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)"),o=t.length,n=0;n<o;n++)l.i(i.getComponent)(t[n],"dropdownlist")&&(l.i(i.getComponent)(t[n],"dropdownlist").destroy(),l.i(i.detach)(t[n]));for(r=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<r.length;n++)l.i(i.getComponent)(r[n],"tooltip").destroy();if(this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate(),s=document.querySelectorAll(".qb-dropdownlist"))for(n=0;n<s.length;n++)s[n].remove();l.i(i.classList)(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1}},t.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,i=e.length;l<i;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},t.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),i=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var n=0,o=e.length;n<o;n++)this.updatedRule={isLocked:e[n].isLocked,condition:e[n].condition,not:e[n].not},this.importRules(e[n],l,!1,e[n].not);this.isPublic=!1}else{var r="and",s=!1,a=!1;this.updatedRule&&(r=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?i.rules.push({condition:r,not:s,rules:[]}):i.rules.push({condition:r,rules:[]}):this.enableNotCondition?i.rules.splice(this.groupIndex+1,0,{condition:r,not:s,rules:[],isLocked:a}):i.rules.splice(this.groupIndex+1,0,{condition:r,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,i)}},t.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&l.i(i.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableRtl&&l.i(i.addClass)([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),i.Browser.isDevice||"Vertical"===this.displayMode?(i.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),l.i(i.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),l.i(i.addClass)(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();else{if(this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule);var e=l.i(i.extend)({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var t=this.element.querySelectorAll("label.e-btn"),n=void 0,o=0;o<t.length;o++)n=t.item(o),l.i(i.rippleEffect)(n,{selector:".e-btn"})}},t.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),i=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),i.appendChild(l),e.appendChild(i),this.element.appendChild(e)},t.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});this.element.querySelector(".e-group-header").appendChild(e)},t.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortBy("field")))},t.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group").insertBefore(e,this.groupElem.querySelector(".e-btngroup-and"))}}else this.groupElem.querySelector(".e-qb-toggle").remove();this.setProperties({rule:this.checkNotGroup(this.rule)},!0),this.initWrapper()},t.prototype.notGroupRtl=function(){this.enableRtl?l.i(i.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):l.i(i.removeClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},t.prototype.checkNotGroup=function(e){var t;if(e.rules)for(var n=0;n<e.rules.length;n++)t=e.rules[n],t=this.checkNotGroup(t),e.rules[n]=t;return l.i(i.isNullOrUndefined)(e.not)?this.enableNotCondition&&!l.i(i.isNullOrUndefined)(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},t.prototype.onPropertyChanged=function(e,t){for(var n=Object.keys(e),o=0,r=n;o<r.length;o++){switch(r[o]){case"summaryView":var s=this.element.querySelector(".e-group-container"),a=this.element.querySelector(".e-summary-content");e.summaryView?(s.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),a=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),a.style.display="block"):(s.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),s.style.display="block",a.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":l.i(i.isNullOrUndefined)(e.showButtons.lockGroup)||(e.showButtons.lockGroup?l.i(i.removeClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.lockRule)||(e.showButtons.lockRule?l.i(i.removeClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?l.i(i.removeClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.cloneRule)||(e.showButtons.cloneRule?l.i(i.removeClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?l.i(i.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.groupDelete)||(e.showButtons.groupDelete?l.i(i.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":t.cssClass&&l.i(i.removeClass)([this.element],t.cssClass.split(" ")),e.cssClass&&l.i(i.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?(l.i(i.addClass)([this.element],"e-rtl"),this.notGroupRtl()):(l.i(i.removeClass)([this.element],"e-rtl"),this.notGroupRtl());break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource,this.refresh();break;case"columns":this.columns=e.columns,this.columnSort(),this.updateSubFieldsFromColumns(this.columns);break;case"sortDirection":this.sortDirection=e.sortDirection,this.columnSort();break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rule":0!==this.rule.rules.length||l.i(i.isNullOrUndefined)(this.rule)||this.reset(),this.setProperties({rule:e.rule},!0),e.rule=this.getRuleCollection(this.rule,!1),this.setRules(this.rule);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new i.Internationalization(this.locale),this.isLocale=!0,this.refresh(),this.isLocale=!1;break;case"enableNotCondition":this.onChangeNotGroup();break;case"readonly":this.isReadonly=e.readonly,this.enableReadonly()}}},t.prototype.preRender=function(){this.element.id=this.element.id||l.i(i.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",In:"In",NotIn:"Not In",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required",SummaryViewTitle:"Summary View",OtherFields:"Other Fields",AND:"AND",OR:"OR",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new i.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new i.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},t.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof r.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new r.Query).take(1))):(this.dataManager=new r.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new r.Query),this.initControl()),this.renderComplete()},t.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?l.i(i.compile)(document.querySelector(e).innerHTML.trim()):l.i(i.compile)(e)}catch(t){return l.i(i.compile)(e)}},t.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),i=new r.Deferred;l.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){i.reject(e)})},t.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},t.prototype.wireEvents=function(){var e=this.getWrapper();i.EventHandler.add(e,"click",this.clickEventHandler,this),i.EventHandler.add(e,"focusout",this.focusEventHandler,this),i.EventHandler.add(e,"focusin",this.focusEventHandler,this),i.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this)},t.prototype.unWireEvents=function(){var e=this.getWrapper();i.EventHandler.remove(e,"click",this.clickEventHandler),i.EventHandler.remove(e,"focusout",this.focusEventHandler),i.EventHandler.remove(e,"focusin",this.focusEventHandler),i.EventHandler.remove(this.element,"keydown",this.keyBoardHandler)},t.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],i=t?l.length-1:l.length,n=this.rule,o=0;o<i;o++)n=this.findGroupByIdx(l[o],n,0===o);return n},t.prototype.deleteGroup=function(e){var t,l=this,i=e;"string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t)):t=i.id.replace(this.element.id+"_","");var n={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules?this.deleteGroupSuccessCallBack(n,e):this.trigger("beforeChange",n,function(t){l.deleteGroupSuccessCallBack(t,e)})},t.prototype.deleteGroupSuccessCallBack=function(e,t){if(!e.cancel){var n=t,o=this.getParentGroup(n,!0),r=0,s=void 0,a=void 0,u=this.getValidRules(this.rule),d=n.nextElementSibling,p=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),h=n.querySelectorAll(".e-tooltip");for(a=h.length,s=0;s<a;s++)l.i(i.getComponent)(h[s],"tooltip").destroy();for(s=0,a=c.length;s<a;s++)delete this.levelColl[c[s].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,r++;d&&d.className.indexOf("e-separate-rule")>-1&&(l.i(i.removeClass)([d],"e-separate-rule"),l.i(i.addClass)([d],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&l.i(i.addClass)([p],"e-prev-joined-rule"));var m=n.parentElement.parentElement.parentElement,f=[];if(this.isReact||this.isAngular){var g=o.rules[r],v=t.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var y=0;y<g.rules.length;y++){var b=this.getColumn(g.rules[y].field);if(v[y]){var C=v[y].querySelector(".e-template-value");b&&(b.ruleTemplate||this.isPlatformTemplate(b)&&C)&&f.push(v[y].id)}}}l.i(i.detach)(t),this.headerTemplate&&this.clearQBTemplate([t.id]),f.length&&this.clearQBTemplate(f),o.rules.splice(r,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(m,o),this.isImportRules||this.trigger("change",e),this.filterRules(u,this.getValidRules(this.rule),"deleteGroup")}},t.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},t.prototype.deleteRule=function(e){var t=this,n=l.i(i.closest)(e,".e-group-container"),o=n.id.replace(this.element.id+"_",""),r=l.i(i.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),s={groupID:o,ruleID:r,cancel:!1,type:"deleteRule"};this.isImportRules?this.deleteRuleSuccessCallBack(s,e):this.trigger("beforeChange",s,function(l){t.deleteRuleSuccessCallBack(l,e)})},t.prototype.deleteRuleSuccessCallBack=function(e,t){if(!e.cancel){var n=l.i(i.closest)(t,".e-group-container"),o=this.getParentGroup(n),r=l.i(i.closest)(t,".e-rule-container"),s=this.getValidRules(this.rule),a=r,u=r.nextElementSibling,d=r.previousElementSibling,p=0,c=r.querySelectorAll(".e-tooltip"),h=void 0,m=c.length;for(h=0;h<m;h++)l.i(i.getComponent)(c[h],"tooltip").destroy();for(;null!==r.previousElementSibling;)r=r.previousElementSibling,p++;var f=this.getColumn(o.rules[p].field);f&&f.template&&a.querySelector(".e-template")&&this.templateDestroy(f,a.querySelector(".e-template").id),(!d||d.className.indexOf("e-rule-container")<0)&&u&&l.i(i.removeClass)([u],"e-joined-rule"),(!u||u.className.indexOf("e-rule-container")<0)&&d&&l.i(i.removeClass)([d],"e-prev-joined-rule");var g=a.querySelector(".e-template-value");try{l.i(i.detach)(a)}catch(e){e=[];e.error="error"}f&&f.ruleTemplate&&this.clearQBTemplate([a.id]),f&&this.isPlatformTemplate(f)&&g&&this.clearQBTemplate([a.id]),o.rules.splice(p,1),o.rules[0]&&o.rules[0].rules||this.disableRuleCondition(n,o);for(var v=this.element.querySelectorAll(".e-tooltip"),y=0;y<v.length;y++)l.i(i.getComponent)(v[y],"tooltip").refresh(v[y]);this.isImportRules||this.trigger("change",e),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},t.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},t.prototype.keyBoardHandler=function(e){!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode||e.preventDefault()},t.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},t.prototype.disableRuleCondition=function(e,t){if(!this.headerTemplate){if(this.readonly)return;var l=e.querySelector(".e-rule-list").childElementCount,i=e.querySelector(".e-btngroup-and"),n=e.querySelector(".e-btngroup-or");l>1?(i.disabled=!1,n.disabled=!1,(n.nextElementSibling.classList.contains("e-btn-disable")||i.nextElementSibling.classList.contains("e-btn-disable"))&&(n.nextElementSibling.classList.remove("e-btn-disable"),i.nextElementSibling.classList.remove("e-btn-disable")),t&&"or"===t.condition?n.checked=!0:i.checked=!0):(i.checked=!1,i.disabled=!0,n.checked=!1,n.disabled=!0,t&&(n.nextElementSibling.classList.add("e-btn-disable"),i.nextElementSibling.classList.add("e-btn-disable")))}},t.prototype.getValidRules=function(e){e||(e=this.getRules());var t=e.condition,n=e.not,o=l.i(i.extend)([],e.rules,[],!0);return this.getRuleCollection({condition:t,rules:o,not:n},!0)},t.prototype.getRuleCollection=function(e,t){if(l.i(i.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var o=e.rules.length,r=0;r<o;r++)n=e.rules[r],n=this.getRuleCollection(n,t),e.rules[r]=n,Object.keys(n).length<1&&t&&(e.rules.splice(r,1),r--,o--);var s=e.custom;if(e.field&&""!==e.field&&(l.i(i.isNullOrUndefined)(s)||s&&"question"!==s.type&&"answer"!==s.type))if(e.operator&&(e.operator.toString().indexOf("null")>-1||e.operator.toString().indexOf("empty")>-1)&&(e.value=null),this.isRefreshed&&this.enablePersistence||""!==e.field&&""!==e.operator&&""!==e.value&&void 0!==e.value||s&&s.isQuestion){var a=e.condition;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,isLocked:e.isLocked},a&&(e.condition=a),s&&(e.custom=s),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={})}else e={};else if(!s||"question"!==s.type&&"answer"!==s.type)l.i(i.isNullOrUndefined)(e.condition)&&l.i(i.isNullOrUndefined)(e.rules)?e={}:(e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not,isLocked:e.isLocked}:{condition:e.condition,rules:e.rules,isLocked:e.isLocked},s&&(e.custom=s),0===e.rules.length&&(e={}));else{var u=e.not;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules},e.custom=s,this.enableNotCondition&&(e.not=u)}return e},t.prototype.setRules=function(e){var t=l.i(i.extend)({},e,{},!0);this.headerTemplate?this.setGroupRules(t,!0):this.setGroupRules(t)},t.prototype.getRules=function(){var e;return e=this.enableNotCondition?{condition:this.rule.condition,rules:this.rule.rules,not:this.rule.not}:{condition:this.rule.condition,rules:this.rule.rules},this.rule.custom&&(e.custom=this.rule.custom),e},t.prototype.getRule=function(e){var t,n,o=0;if(e instanceof HTMLElement?t=l.i(i.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,t=document.getElementById(n)),l.i(i.isNullOrUndefined)(t))return null;for(var r=l.i(i.closest)(t,".e-group-container"),s=this.getParentGroup(r);null!==t.previousElementSibling;)t=t.previousElementSibling,o++;return s.rules[o]},t.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=l.i(i.closest)(e,".e-group-container"));var t=e instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(t)},t.prototype.deleteGroups=function(e){var t,l,i=e.length;for(t=0;t<i;t++)l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l))},t.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=l.i(i.isNullOrUndefined)(e)?new r.Query:(new r.Query).where(e);return this.dataManager.executeQuery(t)},t.prototype.deleteRules=function(e){var t,l,i=e.length;for(t=0;t<i;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},t.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],i=0,n=Object.keys(this.columns);i<n.length;i++)l.push(this.columns[i].field);return e.rules.length?(new r.Query).select(l).where(t):(new r.Query).select(l)},t.prototype.getPredicate=function(e){var t,n,o,s,a=e.rules,u=!1;if(!a)return t;for(var d=0,p=a.length;d<p;d++){var c=a[d].operator;"notstartswith"===c?c="doesnotstartwith":"notendswith"===c?c="doesnotendwith":"notcontains"===c&&(c="doesnotcontain");var h=Object.keys(a[d]);if(u=!1,h.indexOf("rules")>-1&&a[d].rules)(n=this.getPredicate(a[d]))&&(t=t?"and"===e.condition?t.and(n):t.or(n):n);else if(!l.i(i.isNullOrUndefined)(c)&&!l.i(i.isNullOrUndefined)(c.length)){var m=a[d].operator.toLowerCase(),f=!1,g=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===a[d].type&&(u=!this.matchCase),"date"===a[d].type&&g.indexOf(m)>-1&&(u=!0),s=this.getColumn(a[d].field),m.indexOf("null")>-1||m.indexOf("empty")>-1)a[d].value=null;else if("date"!==a[d].type||a[d].value instanceof Array)o=a[d].value;else{var v=this.getFormat(s.format);l.i(i.isNullOrUndefined)(a[d].value)?o=null:(o=this.getDate(a[d].value,v),g.indexOf(m)>-1&&!this.isTime(a[d].value)&&(f=!0))}if(0===d)if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contain")<0)t=f?this.datePredicate(a[d],o):this.arrayPredicate(a[d]);else{var y=o;""!==y&&(t=new r.Predicate(a[d].field,c,o,u))}else if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contain")<0)t=f?this.datePredicate(a[d],o,t,e.condition):this.arrayPredicate(a[d],t,e.condition);else if("and"===e.condition){var y=o;t&&""!==y?t=t.and(a[d].field,c,o,u):""!==y&&(t=new r.Predicate(a[d].field,c,o,u))}else{var y=o;t&&""!==y?t=t.or(a[d].field,c,o,u):""!==y&&(t=new r.Predicate(a[d].field,c,o,u))}}}return this.dataSource instanceof r.DataManager&&(l.i(i.isNullOrUndefined)(t)||"isnull"!==t.operator&&"isnotnull"!==t.operator||(t.operator="isnull"===t.operator?"equal":"notequal")),t},t.prototype.getLocale=function(){var e=this.locale;return l.i(i.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",i.cldrData)||(e="en"),e},t.prototype.getColumn=function(e,t){var l,i=this.columns;i=t||i;for(var n=0,o=i.length;n<o;n++){if(i[n].field===e){l=i[n];break}if(i[n].columns){if(l=this.getColumn(e,i[n].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&i[n].field===e.split(this.separator)[0]){l=i[n];break}}return l},t.prototype.getOperators=function(e){return this.getColumn(e).operators},t.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},t.prototype.datePredicate=function(e,t,l,i){var n,o=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":n=new r.Predicate(e.field,"greaterthanorequal",o),n=n.and(e.field,"lessthanorequal",s);break;case"notequal":n=new r.Predicate(e.field,"lessthan",o),n=n.or(e.field,"greaterthan",s);break;case"greaterthan":n=new r.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":n=new r.Predicate(e.field,"greaterthanorequal",o);break;case"lessthan":n=new r.Predicate(e.field,"lessthan",o);break;case"lessthanorequal":n=new r.Predicate(e.field,"lessthanorequal",s)}return n&&(l?"and"===i?l=l.and(n):"or"===i&&(l=l.or(n)):l=n),l},t.prototype.arrayPredicate=function(e,t,l){var i,n=e.value,o=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(o.indexOf("null")>-1||o.indexOf("empty")>-1)switch(o){case"isnull":i=new r.Predicate(e.field,"isnull",s);break;case"isnotnull":i=new r.Predicate(e.field,"isnotnull",s);break;case"isempty":i=new r.Predicate(e.field,"equal","");break;case"isnotempty":i=new r.Predicate(e.field,"notequal","")}if(!(o.indexOf("null")>-1||o.indexOf("empty")>-1))for(var d=0,p=n.length;d<p;d++)if(""!==n[d]||("in"===o||"notin"===o)&&"string"===a.type)if(0===d){var c="greaterthanorequal";switch(o){case"between":i="date"!==a.type?new r.Predicate(e.field,c,n[d]):new r.Predicate(e.field,c,n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null);break;case"notbetween":i="date"===a.type?new r.Predicate(e.field,"lessthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null):new r.Predicate(e.field,"lessthan",n[d]);break;case"in":i=new r.Predicate(e.field,"equal",n[d]);break;case"notin":i=new r.Predicate(e.field,"notequal",n[d])}}else{switch(e.operator){case"between":i="date"===a.type?i.and(e.field,"lessthanorequal",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):i.and(e.field,"lessthanorequal",n[d]);break;case"notbetween":i="date"===a.type?i.or(e.field,"greaterthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):i.or(e.field,"greaterthan",n[d]);break;case"in":i=i.or(e.field,"equal",n[d]);break;case"notin":i=i.and(e.field,"notequal",n[d])}}return i&&(t?"and"===l?t=t.and(i):"or"===l&&(t=t.or(i)):t=i),t},t.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&(l=new Date,l.setHours(parseInt(e.split(":")[0])),l.setMinutes(parseInt(e.split(":")[1])),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2]))),l},t.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},t.prototype.importRules=function(e,t,n,o,r){if(n){if(e.rules.length>1&&!this.headerTemplate){var s=t.querySelector(".e-btngroup-or"),a=t.querySelector(".e-btngroup-and");s.disabled=!1,a.disabled=!1,"or"===e.condition?s.checked=!0:a.checked=!0}else this.disableRuleCondition(t);if(this.headerTemplate&&r&&(t=this.renderGroup(e,e.condition,this.element,e.not,r)),this.enableNotCondition&&!this.headerTemplate){var u=t.querySelector(".e-qb-toggle");e.not?l.i(i.addClass)([u],"e-active-toggle"):l.i(i.removeClass)([u],"e-active-toggle")}}else t=this.renderGroup(e,e.condition,t,o);0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var d=e.rules;if(!l.i(i.isNullOrUndefined)(d))for(var p=0,c=d.length;p<c;p++){var h=Object.keys(d[p]);if(!l.i(i.isNullOrUndefined)(d[p].rules)&&h.indexOf("rules")>-1&&0!==d[p].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;t=this.renderGroup(d[p],d[p].condition,t,d[p].not),t=this.importRules(d[p],t,!0)}else this.renderRule(d[p],t);if(!l.i(i.isNullOrUndefined)(d[p].rules)&&d[p].isLocked){var m=t.querySelector(".e-rule-list").children[p].querySelector(".e-lock-grp-btn");this.groupLock(m)}if(l.i(i.isNullOrUndefined)(d[p].rules)&&d[p].isLocked){var f=t.querySelector(".e-rule-list").children[p].querySelector(".e-lock-rule-btn");this.ruleLock(f)}}return t&&(t=l.i(i.closest)(t,".e-rule-list")),t&&(t=l.i(i.closest)(t,".e-group-container")),t},t.prototype.renderGroup=function(e,t,l,i,n){this.addGroupElement(!0,l,t,!1,i,n,e);var o=l.querySelectorAll(".e-group-container"),r=l.querySelector(".e-rule-list").children;return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup?(this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1,r[this.groupIndex+1]):this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,r[r.length-1]):o[o.length-1]},t.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},t.prototype.enableReadonly=function(){for(var e=this.element,t=e.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),r=0;r<t.length;r++)if(t[r].classList.contains("e-dropdownlist")){var u=l.i(i.getInstance)(t[r],o.DropDownList);u.readonly=this.isReadonly}else if(t[r].classList.contains("e-dropdowntree")){var d=l.i(i.getComponent)(t[r],"dropdowntree");d.readonly=this.isReadonly}else if(t[r].classList.contains("e-numerictextbox")){var p=l.i(i.getInstance)(t[r],s.NumericTextBox);p.readonly=this.isReadonly}else if(t[r].classList.contains("e-textbox")){var c=l.i(i.getInstance)(t[r],s.TextBox);c.readonly=this.isReadonly}else if(t[r].classList.contains("e-datepicker")){var h=l.i(i.getInstance)(t[r],a.DatePicker);h.readonly=this.isReadonly}else if(t[r].classList.contains("e-multiselect")){var m=l.i(i.getInstance)(t[r],o.MultiSelect);m.readonly=this.isReadonly}else if(t[r].classList.contains("e-radio")){var f=l.i(i.getInstance)(t[r],n.RadioButton);f.checked||(this.isReadonly?t[r].parentElement.style.display="none":t[r].parentElement.style.display="inherit")}var g=this.element.querySelectorAll(".e-deletegroup"),v=this.element.querySelectorAll(".e-addrulegroup"),y=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");for(var b=[g,v,y],r=0;r<b.length;r++)b[r].forEach(function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")});this.enableBtnGroup()},t.prototype.enableBtnGroup=function(){var e=this,t=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;t.forEach(function(t){!t.classList.contains("e-qb-toggle")||t.classList.contains("e-active-toggle")||t.classList.contains("e-readonly")?t.classList.contains("e-qb-toggle")&&t.classList.contains("e-not-readonly")?t.classList.remove("e-not-readonly"):t.classList.contains("e-qb-toggle")&&t.classList.contains("e-readonly")?t.classList.remove("e-readonly"):t.classList.contains("e-active-toggle")?(t.classList.add("e-not-readonly"),l=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),l?"AND"===t.textContent?t.classList.add("e-readonly-and"):t.classList.add("e-readonly-or"):("AND"===t.textContent&&e.isReadonly?(t.classList.remove("e-not"),t.classList.add("e-readonly-and")):(e.enableNotCondition&&t.classList.add("e-not"),t.classList.remove("e-readonly-and")),"OR"===t.textContent&&e.isReadonly?t.classList.add("e-readonly-or-not"):t.classList.remove("e-readonly-or-not"))):t.classList.contains("e-btn-disable")||t.classList.add("e-readonly"):(t.classList.add("e-readonly"),l=!1)})},t.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,i=t.length;l<i;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},t.prototype.getSqlString=function(e,t,l,i){var n=!1;l||""===l?l+="(":(l="",n=!0);var o=e.condition;if(e.not){var r=void 0;n?(r=i?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (",l+=r):(r=i?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT (",l+=r)}if(e.rules)for(var s=0,a=e.rules.length;s<a;s++){if(e.rules[s].rules)l=this.getSqlString(e.rules[s],t,l,i);else{var u=e.rules[s],d="",p=i?this.sqlOperators[u.operator]:this.operators[u.operator];if(u.value instanceof Array)if(u.operator.toString().indexOf("between")>-1){var c=i?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==u.type||this.isDateFunction(u.value[0])?d+=u.value[0]+c+u.value[1]:d+='"'+u.value[0]+'"'+c+'"'+u.value[1]+'"'}else if("string"==typeof u.value[0]&&null!==u.value){d+='("'+u.value[0]+'"';for(var h=1,m=u.value.length;h<m;h++)d+=',"'+u.value[h]+'"';d+=")"}else d+="("+u.value+")";else u.operator.toString().indexOf("startswith")>-1?d+=u.value?'("'+u.value+'%")':"("+u.value+")":u.operator.toString().indexOf("endswith")>-1?d+=u.value?'("%'+u.value+'")':"("+u.value+")":u.operator.toString().indexOf("contains")>-1?d+=u.value?'("%'+u.value+'%")':"("+u.value+")":"number"===u.type||"boolean"==typeof u.value||null===u.value&&u.operator.toString().indexOf("empty")<-1?d+=u.value:u.operator.toString().indexOf("empty")>-1?d+='""':d+='"'+u.value+'"';if(u.operator.toString().indexOf("null")>-1)t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),l+=u.field+" "+p;else{var f=p;"isempty"===u.operator?f="=":"isnotempty"===u.operator&&(f="!="),t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),l+=u.field+" "+f+" "+d}u.condition&&""!==u.condition&&(o=u.condition)}if(s!==a-1){var u=e.rules[s];(""===o||u&&""!==u.condition&&u.custom&&u.custom.isCustom)&&(o=u.condition),o=i?this.l10n.getConstant(o.toUpperCase()).toUpperCase():o.toUpperCase(),l+=" "+o+" "}}return n||(l+=")"),e.not&&(l+=")"),l},t.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},t.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},t.prototype.getSqlFromRules=function(e,t,l){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},t.prototype.getParameterizedSql=function(e){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql},t.prototype.setParameterizedSql=function(e){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var i=this.getRulesFromSql(l);this.setRules({condition:i.condition,not:i.not,rules:i.rules})}},t.prototype.getParameterizedNamedSql=function(e){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql},t.prototype.setParameterizedNamedSql=function(e){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var i=this.getRulesFromSql(l);this.setRules({condition:i.condition,not:i.not,rules:i.rules})}},t.prototype.setMongoQuery=function(e,t){this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})},t.prototype.getMongoQuery=function(e){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery},t.prototype.cloneRule=function(e,t,l){var i=this.getRule(e.replace(this.element.id+"_","")),n=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:i.label,field:i.field,type:i.type,operator:i.operator,value:i.value}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=n,n=!1},t.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var i=this.getGroup(t),n=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:i.condition,not:i.not,rules:i.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=n,n=!1},t.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},t.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},t.prototype.sqlParser=function(e,t){var l,i=0;do{l=e.slice(i),i+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},t.prototype.parseSqlStrings=function(e,t){var l,i=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"];var n;n=t?[this.l10n.getConstant("In").toUpperCase(),this.l10n.getConstant("NotIn").toUpperCase(),this.l10n.getConstant("Like").toUpperCase(),this.l10n.getConstant("NotLike").toUpperCase(),this.l10n.getConstant("Between").toUpperCase(),this.l10n.getConstant("NotBetween").toUpperCase(),this.l10n.getConstant("IsNull").toUpperCase(),this.l10n.getConstant("IsNotNull").toUpperCase(),this.l10n.getConstant("IsEmpty").toUpperCase(),this.l10n.getConstant("IsNotEmpty").toUpperCase()]:["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"];for(var o,r,s,a=0,u=i.length;a<u;a++)if(o=/^\w+$/.test(i[a])?"\\b":"",r=new RegExp("^("+i[a]+")"+o,"ig"),r.exec(e))return this.parser.push(["Operators",i[a].toLowerCase()]),i[a].length;var d=this.parser[this.parser.length-1];if(!d||d&&"Literal"!==d[0])for(var a=0,u=l.length;a<u;a++)if(o=/^\w+$/.test(l[a])?"\\b":"",r=new RegExp("^("+l[a]+")"+o,"ig"),r.exec(e))return this.parser.push(["Conditions",l[a].toLowerCase()]),l[a].length;for(var a=0,u=n.length;a<u;a++)if(o=/^\w+$/.test(n[a])?"\\b":"",r=new RegExp("^("+n[a]+")"+o,"ig"),r.exec(e))return this.parser.push(["SubOperators",n[a].toLowerCase()]),n[a].length;if(/^\(/.exec(e))return this.parser.push(["Left","("]),1;if(/^\)/.exec(e))return this.parser.push(["Right",")"]),1;if(/^(true|false)/.exec(e))return s=/^(true|false)/.exec(e)[0],this.parser.push(["String",s]),s.length;if(/^null/.exec(e))return s=/^null/.exec(e)[0],this.parser.push(["String",null]),s.length;if(/^`?([a-z_][a-z0-9_.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e))return s=/^`?([a-zåäö_][a-z0-9åäö_.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",s]),s.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(e))return s=/^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",s]),s.length+2;if(this.checkNumberLiteral(e,t))return s=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Literal",s]),s.length;if(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)){if(s=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],"("===s[s.length-2])for(var p=!1,c=s.length;c<e.length&&(s+=e[c],")"===e[c]&&(p=!0),!p||"'"!==e[c]);c++);return this.parser.push(["String",s]),s.length}return/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(s=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",s]),s.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(s=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",s]),s.length):/^-?[0-9]+(\.[0-9]+)?/.exec(e)?(s=/^-?[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",s]),s.length):1},t.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},t.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(\.[0-9]+)?/.exec(e)){var i=this.parser[this.parser.length-2],n=this.parser[this.parser.length-3];if("Left"===l[0]&&i&&"Conditions"===i[0])return!0;var o=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&n&&n[1].indexOf(o)<0)return!0}return!1},t.prototype.getOperator=function(e,t,l){var i={"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween","is empty":"isempty","is null":"isnull","is not null":"isnotnull","is not empty":"isnotempty"};if(l){for(var n=Object.keys(this.sqlOperators),o=0;o<n.length;o++)if(this.sqlOperators[n[o]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[o];return null}if(e){if(0===e.indexOf("%")&&"%"===e[e.length-1])return"not like"===t?"notcontains":"contains";if(0!==e.indexOf("%")&&e.indexOf("%")===e.length-1)return"not like"===t?"notstartswith":"startswith";if(0===e.indexOf("%")&&e.indexOf("%")!==e.length-1)return"not like"===t?"notendswith":"endswith"}else{if("not like"===t)return"notequal";if("like"===t)return"equal"}return i[""+t]},t.prototype.getTypeFromColumn=function(e){var t=this.getColumn(e.field);return l.i(i.isNullOrUndefined)(t)?null:t.type},t.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var i=e.split(this.separator),n=0;n<i.length;n++)t+=this.getLabelFromField(i,n+1),++l<i.length&&(t+=this.separator);return t}return this.getColumn(e).label},t.prototype.getLabelFromField=function(e,t){for(var l="",i=0,n=0;n<t;n++)l+=e[n],++i<t&&(l+=this.separator);return this.getColumn(l).label},t.prototype.processParser=function(e,t,l,i){for(var n,o,r,s,a,u,d,p,c,h,m=[],f=[],g=!1,v=0,y=e.length;v<y;v++)if("Literal"===e[v][0]){var b=this.getColumn(e[v][1]);if(r={label:b&&b.label?b.label:e[v][1],field:e[v][1]},"SubOperators"===e[v+1][0]){if(e[v+1][1].indexOf("null")>-1||e[v+1][1].indexOf("empty")>-1)r.operator=this.getOperator(" ",e[v+1][1],i),r.value=null,r.type=this.getTypeFromColumn(r);else{var C=e[v+3][1]?e[v+3][1].replace(/'/g,""):e[v+3][1];r.operator=this.getOperator(C,e[v+1][1],i)}for(h=e[v+1][1],v++,n=v+1,o=y,i&&"contains"===r.operator||"startswith"===r.operator||"endswith"===r.operator?h="like":i&&"notcontains"===r.operator||"notstartswith"===r.operator||"notendswith"===r.operator?h="not like":i&&(h=r.operator),n=v+1;n<o;n++)if(h.indexOf("between")<0&&"Left"===e[n][0])g=!0;else{if("Right"===e[n][0]&&g){v=n,g=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[n][0]){var S=e[n][1];e[n][1]&&"'"===e[n][1][0]&&(S=e[n][1].substring(1,e[n][1].length-1)),S=S?S.replace(/%/g,""):e[n][1],r.value=S,r.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[n][0]||"Left"===e[n][0])break;if("Number"===e[n][0])m.push(Number(e[n][1]));else if("String"===e[n][0]){var S=e[n][1];e[n][1]&&"'"===e[n][1][0]&&(S=e[n][1].substring(1,e[n][1].length-1)),f.push(S)}}else if("Number"===e[n][0])m.push(Number(e[n][1]));else if("String"===e[n][0]){var S=e[n][1];e[n][1]&&"'"===e[n][1][0]&&(S=e[n][1].substring(1,e[n][1].length-1)),f.push(S)}r.type=this.getTypeFromColumn(r)}h.indexOf("like")<0&&("Number"===e[n-1][0]?(r.value=m,r.type="number"):"String"===e[n-1][0]?(r.value=f,r.type="string"):h.indexOf("between")>-1&&"Conditions"===e[n-1][0]&&(0!==f.length?(r.value=f,r.type="string"):(r.value=m,r.type="number")),m=[],f=[],r.type=this.getTypeFromColumn(r))}else if("Operators"===e[v+1][0]){r.operator=this.getOperator(e[v+2][1],e[v+1][1],i);"equal"==r.operator&&"String"===e[v+2][0]&&"''"===e[v+2][1]?(r.operator="isempty",!0):"notequal"==r.operator&&"String"===e[v+2][0]&&"''"===e[v+2][1]&&(r.operator="isnotempty",!0),"Number"===e[v+2][0]?(r.type="number",r.value=Number(e[v+2][1])):(r.type="string",r.value=e[v+2][1]?e[v+2][1].replace(/'/g,""):e[v+2][1]),r.type=this.getTypeFromColumn(r)}t.rules.push(r)}else{if("Left"===e[v][0]){if("Left"!==e[0][0]&&("not"===e[v-1][1]||i&&this.l10n.getConstant("NOT").toLowerCase()===e[v-1][1]))continue;for(this.parser=e.splice(v+1,y-(v+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},c=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&c++;return l.push(c),t.rules.push(s),s=this.processParser(this.parser,s,l,i),t}if("Conditions"===e[v][0])"not"===e[v][1]||i&&this.l10n.getConstant("NOT").toLowerCase()===e[v][1]?t.not=!0:t.condition=e[v][1];else if("Right"===e[v][0]){for(this.parser=e.splice(v+1,y-(v+1)),l.pop(),t=this.rule,p=l.length,d=0;d<p;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,i)}}return t},t.prototype.groupClone=function(e){var t,l,i=e.closest(".e-rule-list").closest(".e-group-container");"string"==typeof e?(l=this.element.id+"_"+e,e=document.getElementById(l)):(t=e.id.replace(this.element.id+"_",""),l=i.id.replace(this.element.id+"_",""));var n=this.getGroup(t);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],l),this.groupIndex=-1},t.prototype.ruleClone=function(e){for(var t=l.i(i.closest)(e,".e-rule-container"),n=e.closest(".e-rule-list").closest(".e-group-container"),o=this.getRule(e),r=n.id.replace(this.element.id+"_",""),s=n.querySelectorAll(".e-rule-container"),a=0,u=s.length;a<u;a++)t.id===s[a].id&&(this.ruleIndex=a);this.addRules([{label:o.label,field:o.field,type:o.type,operator:o.operator,value:o.value}],r),this.ruleIndex=-1},t.prototype.ruleLock=function(e){var t=l.i(i.closest)(e,".e-rule-container"),n=this.getRule(t.id.replace(this.element.id+"_",""));t.classList.contains("e-disable")?(n.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==t.id}),t.classList.remove("e-disable"),this.disableRuleControls(e,t,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(n.isLocked=!0,this.lockItems.indexOf(t.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,t.id),t.classList.add("e-disable"),this.disableRuleControls(e,t,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},t.prototype.groupLock=function(e){var t=l.i(i.closest)(e,".e-group-container"),n=this.getGroup(t.id.replace(this.element.id+"_","")),o=t.id.indexOf("group0")>-1;if(t.classList.contains("e-disable")){if(o){var r={};r.condition=n.condition,r.not=n.not,r.isLocked=!1,this.setProperties({rule:r},!0)}else n.isLocked=!1;this.lockItems=this.lockItems.filter(function(e){return e!==t.id}),t.classList.remove("e-disable"),this.disableHeaderControls(e,t,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{if(o){var r={};r.condition=n.condition,r.not=n.not,r.isLocked=!0,this.setProperties({rule:r},!0)}else n.isLocked=!0;this.lockItems.indexOf(t.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,t.id),t.classList.add("e-disable"),this.disableHeaderControls(e,t,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},t.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var t=this.element.querySelector("#"+this.lockItems[e]),n=t.querySelector(".e-lock-rule-btn");t=l.i(i.closest)(n,".e-rule-container"),t.classList.contains("e-disable")||this.ruleLock(n)}else{var o=this.element.querySelector("#"+this.lockItems[e]),n=o.querySelector(".e-lock-grp-btn");o=l.i(i.closest)(n,".e-group-container"),o.classList.contains("e-disable")||this.groupLock(n)}}},t.prototype.disableHeaderControls=function(e,t,l){for(var i=t.querySelectorAll(".e-btngroup-and"),n=t.querySelectorAll(".e-btngroup-or"),o=t.querySelectorAll(".e-qb-toggle"),r=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),p=0;p<i.length;p++)l?(d[p]&&d[p].classList.contains("e-disable")&&d[p].classList.add("e-disable"),i[p].disabled=!0,n[p].disabled=!0,r[p].disabled=!0,o[p]&&(o[p].disabled=!0),s[p]&&(s[p].disabled=!0),u[p]&&(u[p].disabled=!0),i[p].parentElement.classList.add("e-disabled"),a[p]!==e&&(a[p].disabled=!0,a[p].children[0].classList.remove("e-unlock"),a[p].children[0].classList.add("e-lock"))):(d[p]&&d[p].classList.remove("e-disable"),i[p].disabled=!1,n[p].disabled=!1,r[p].disabled=!1,a[p].disabled=!1,o[p]&&(o[p].disabled=!1),s[p]&&(s[p].disabled=!1),u[p]&&(u[p].disabled=!1),i[p].parentElement.classList.remove("e-disabled"),a[p].children[0].classList.remove("e-lock"),a[p].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},t.prototype.disableRuleControls=function(e,t,n){for(var o=t.querySelectorAll(".e-control.e-dropdownlist"),r=t.querySelectorAll(".e-control.e-numerictextbox"),s=t.querySelectorAll(".e-control.e-textbox"),a=t.querySelectorAll(".e-control.e-datepicker"),u=t.querySelectorAll(".e-control.e-checkbox"),d=t.querySelectorAll(".e-control.e-radio"),p=t.querySelectorAll(".e-control.e-multiselect"),c=t.querySelectorAll(".e-rule-delete"),h=t.querySelectorAll(".e-lock-rule"),m=t.querySelectorAll(".e-clone-rule"),f=t.querySelectorAll(".e-rule-container"),g=0;g<c.length;g++)n?(f[g]&&f[g].classList.contains("e-disable")&&f[g].classList.add("e-disable"),c[g].disabled=!0,m[g]&&(m[g].disabled=!0),h[g]!==e&&(h[g].disabled=!0,h[g].children[0].classList.remove("e-unlock"),h[g].children[0].classList.add("e-lock"))):(f[g]&&f[g].classList.remove("e-disable"),m[g]&&(m[g].disabled=!1),c[g].disabled=!1,h[g].disabled=!1,h[g].children[0].classList.remove("e-lock"),h[g].children[0].classList.add("e-unlock"));for(var v,y,b,C,S,x,O,g=0;g<o.length;g++)v=l.i(i.getComponent)(o[g],"dropdownlist"),v.enabled=!n;for(var g=0;g<r.length;g++)y=l.i(i.getComponent)(r[g],"numerictextbox"),y.enabled=!n;for(var g=0;g<s.length;g++)b=l.i(i.getComponent)(s[g],"textbox"),b.enabled=!n;for(var g=0;g<a.length;g++)C=l.i(i.getComponent)(a[g],"datepicker"),C.enabled=!n;for(var g=0;g<u.length;g++)S=l.i(i.getComponent)(u[g],"checkbox"),S.disabled=!!n;for(var g=0;g<d.length;g++)x=l.i(i.getComponent)(d[g],"radio"),x.disabled=!!n;for(var g=0;g<p.length;g++)O=l.i(i.getComponent)(p[g],"multiselect"),O.enabled=!n},h([l.i(i.Event)()],t.prototype,"created",void 0),h([l.i(i.Event)()],t.prototype,"actionBegin",void 0),h([l.i(i.Event)()],t.prototype,"beforeChange",void 0),h([l.i(i.Event)()],t.prototype,"change",void 0),h([l.i(i.Event)()],t.prototype,"dataBound",void 0),h([l.i(i.Event)()],t.prototype,"ruleChange",void 0),h([l.i(i.Complex)({},v)],t.prototype,"showButtons",void 0),h([l.i(i.Property)(!1)],t.prototype,"summaryView",void 0),h([l.i(i.Property)(!1)],t.prototype,"allowValidation",void 0),h([l.i(i.Property)("Default")],t.prototype,"fieldMode",void 0),h([l.i(i.Property)([])],t.prototype,"columns",void 0),h([l.i(i.Property)(null)],t.prototype,"fieldModel",void 0),h([l.i(i.Property)(null)],t.prototype,"operatorModel",void 0),h([l.i(i.Property)(null)],t.prototype,"valueModel",void 0),h([l.i(i.Property)()],t.prototype,"headerTemplate",void 0),h([l.i(i.Property)("")],t.prototype,"cssClass",void 0),h([l.i(i.Property)([])],t.prototype,"dataSource",void 0),h([l.i(i.Property)("Horizontal")],t.prototype,"displayMode",void 0),h([l.i(i.Property)(!1)],t.prototype,"enablePersistence",void 0),h([l.i(i.Property)("Default")],t.prototype,"sortDirection",void 0),h([l.i(i.Property)(5)],t.prototype,"maxGroupCount",void 0),h([l.i(i.Property)("auto")],t.prototype,"height",void 0),h([l.i(i.Property)("auto")],t.prototype,"width",void 0),h([l.i(i.Property)(!1)],t.prototype,"matchCase",void 0),h([l.i(i.Property)(0)],t.prototype,"immediateModeDelay",void 0),h([l.i(i.Property)(!1)],t.prototype,"enableNotCondition",void 0),h([l.i(i.Property)(!1)],t.prototype,"readonly",void 0),h([l.i(i.Property)(!0)],t.prototype,"addRuleToNewGroups",void 0),h([l.i(i.Property)(!1)],t.prototype,"autoSelectField",void 0),h([l.i(i.Property)(!0)],t.prototype,"autoSelectOperator",void 0),h([l.i(i.Property)("")],t.prototype,"separator",void 0),h([l.i(i.Complex)({condition:"and",rules:[]},f)],t.prototype,"rule",void 0),t=h([i.NotifyPropertyChanges],t)}(i.Component);!function(){function e(){}}()},function(e,t,l){"use strict";l.d(t,"a",function(){return n});var i=l(0),n=(l.n(i),function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,i=0;return e.forEach(function(n){i++,t+="{",void 0!==n.rules&&("or"===n.condition?(t+=' "$or":[',t=l.convertMongoQuery(n.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(n.rules,t)+"]"));var o="string"===n.type&&"in"!==n.operator&&"notin"!==n.operator&&n.value&&""!==n.value.trim()?n.value.replace(/'/g,"\\"):"";"string"!==n.type||"in"!==n.operator&&"notin"!==n.operator||!n.value||1!==n.value.length||(o=n.value[0].replace(/'/g,"\\"));var r=n.field?n.field.substring(0):"";switch(n.operator){case"contains":t+='"'+r+'":{"$regex":"'+o+'"}';break;case"notcontains":t+='"'+r+'":{"$not":{"$regex":"'+n.value+'"}}';break;case"startswith":t+='"'+r+'":{"$regex":"^'+o+'"}';break;case"notstartswith":t+='"'+r+'":{"$not":{"$regex":"^'+n.value+'"}}';break;case"endswith":t+='"'+r+'":{"$regex":"'+o+'$"}';break;case"notendswith":t+='"'+r+'":{"$not":{"$regex":"'+n.value+'$"}}';break;case"isnull":t+='"'+r+'": null';break;case"isnotnull":t+='"'+r+'":{"$ne": null}';break;case"isempty":t+='"'+r+'": ""';break;case"isnotempty":t+='"'+r+'":{"$ne": ""}';break;case"equal":"string"===n.type?t+='"'+r+'":"'+o+'"':"date"===n.type?t+='"'+r+'":"'+n.value+'"':(n.type,t+='"'+r+'":'+n.value);break;case"notequal":"string"===n.type?t+='"'+r+'":{"$ne":"'+o+'"}':"date"===n.type?t+='"'+r+'":{"$ne":"'+n.value+'"}':t+='"'+r+'":{"$ne":'+n.value+"}";break;case"in":if("string"===n.type)if(n.value.length>1){var s=n.value.map(function(e,t){return t<n.value.length?'"'+e+'"':""}).toString();s=s.endsWith(",")?s.substring(0,s.length-1):s,t+='"'+r+'": { "$in": ['+s+"]}"}else t+='"'+r+'": { "$in": ["'+o+'"]}';else"number"===n.type&&(n.value.length>1?t+='"'+r+'": { "$in": ['+n.value.toString()+"]}":t+='"'+r+'": { "$in": ['+n.value+"]}");break;case"notin":if("string"===n.type)if(n.value.length>1){var s=n.value.map(function(e,t){return t<n.value.length?'"'+e+'"':""}).toString();s=s.endsWith(",")?s.substring(0,s.length-1):s,t+='"'+r+'": { "$nin": ['+s+"]}"}else t+='"'+r+'": { "$nin": ["'+o+'"]}';else"number"===n.type&&(n.value.length>1?t+='"'+r+'": { "$nin": ['+n.value.toString()+"]}":t+='"'+r+'": { "$nin": ['+n.value+"]}");break;case"greaterthan":"number"===n.type?t+='"'+r+'": { "$gt": '+n.value+"}":t+='"'+r+'": { "$gt": "'+n.value+'"}';break;case"greaterthanorequal":"number"===n.type?t+='"'+r+'": { "$gte": '+n.value+"}":t+='"'+r+'": { "$gte": "'+n.value+'"}';break;case"between":"number"===n.type?t+='"'+r+'": {"$gte":'+n.value[0]+', "$lte":'+n.value[1]+"}":t+='"'+r+'": {"$gte": "'+n.value[0]+'", "$lte": "'+n.value[1]+'"}';break;case"notbetween":"number"===n.type?t+='"$or":[{"'+r+'": {"$lt":'+n.value[0]+'}}, {"'+r+'": {"$gt":'+n.value[1]+"}}]":t+='"$or":[{"'+r+'": {"$lt": "'+n.value[0]+'"}}, {"'+r+'": {"$gt": "'+n.value[1]+'"}}]';break;case"lessthan":"number"===n.type?t+='"'+r+'": { "$lt": '+n.value+"}":t+='"'+r+'": { "$lt": "'+n.value+'"}';break;case"lessthanorequal":"number"===n.type?t+='"'+r+'": { "$lte": '+n.value+"}":t+='"'+r+'": { "$lte": "'+n.value+'"}'}t+="}",e.length!==i&&(t+=",")}),t},e.prototype.mongoParser=function(e,t,l){var i;Object.keys(e).indexOf("$and")>-1?(i=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(i=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(i,t.rules,l)},e.prototype.mongoRecursion=function(e,t,n){for(var o,r,s,a,u,d,p,c,h,m,f,g=0,v=e.length;g<v;g++){var y=[],b=[];if(d=Object.keys(e[g])[0],p=e[g][d],"$and"===d)c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},t.push(c),this.mongoRecursion(e[g][d],t[t.length-1].rules,n);else if("$or"===d){var C=void 0,S=[],x=[],O=[],k=[],w=[],q=[],N=[],E=[],R=[];Array.isArray(p)&&2===p.length&&(x=Object.keys(p),E=p[x[0]],R=p[x[1]],"object"==typeof E&&(S=Object.keys(E)[0],w=Object.keys(E[Object.keys(E)[0]]),O=w[0],k=Object.keys(R[Object.keys(R)[0]])[0],"$lt"===O&&"$gt"===k&&(o="notbetween",q=E[S][O],N=R[S][k],r="number"==typeof q?"number":"date",f=[q,N],h={field:S,label:S,value:f,operator:o,type:r},t.push(h),C=!0))),C||(c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},t.push(c),this.mongoRecursion(e[g][d],t[t.length-1].rules,n))}else{if(p=e[g][d],null===p&&(o="isnull"),"boolean"==typeof p&&(o="equal",r="boolean",f=p),"number"==typeof p)f=p,r="number",o="equal";else if("object"==typeof p&&null!==p){m=Object.keys(p);for(var I=0;I<m.length;I++)a=m[I],s=p[m[I]],"$ne"===a&&l.i(i.isNullOrUndefined)(s)&&(o="isnotnull",f=null),"$ne"===a&&"boolean"==typeof s&&(o="notequal",f=s,r="boolean"),m.length>=2&&m[I]?("object"==typeof s?(o="notbetween",d=Object.keys(s)[0],u=[Object.keys(s[d])[0]],y.push(s[d][u]),r="number"):(o="between",y.push(s)),"number"==typeof s&&(r="number")):"object"==typeof s&&null!==s?"$not"===a&&"$regex"===Object.keys(s)[0]?s.$regex.indexOf("^")>-1?(o="notstartswith",f=s.$regex.replace("^","")):s.$regex.indexOf("$")>-1?(o="notendswith",f=s.$regex.replace("$","")):(o="notcontains",f=s.$regex):(o="$in"===a?"in":"notin",b=s,r="number"==typeof s[0]?"number":"string"):"number"==typeof s&&(o=this.getOperatorFromMongoOperator(a),r="number",f=s),"string"==typeof s&&("$regex"===a&&(o="contains",f=s,r="string"),"$ne"===a&&(null!==s&&s.length>0&&isNaN(Date.parse(s))?(o="notequal",f=s):l.i(i.isNullOrUndefined)(s)?(o="isnotnull",f=s):""===s&&(o="isnotempty",f=s),r="string"),s.indexOf("^")>-1&&(o="startswith",f=s.replace("^",""),r="string"),s.indexOf("$")>-1&&"$not"!==a&&(o="endswith",f=s.replace("$",""),r="string"),isNaN(Date.parse(s))||(o=o||this.getOperatorFromMongoOperator(a),r="date",f=s))}else p&&"string"==typeof p&&!isNaN(Date.parse(p))?(o="equal",f=p,r="date"):"string"==typeof p&&""!==p&&"true"!==p&&"false"!==p?(o="equal",f=p,r="string"):"string"==typeof p&&""===p&&(o="isempty",f=p,r="string");h=y&&y.length>1?{field:d,label:d,value:y,operator:o,type:r}:b&&b.length>1?{field:d,label:d,value:b,operator:o,type:r}:{field:d,label:d,value:f,operator:o,type:r},t.push(h),o=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,i=t.split("?"),n=i[0],o=0;o<l.length;o++)n+="string"==typeof l[o]?"'"+l[o]+"'"+i[o+1]:l[o]+i[o+1];return n.length>=2&&"("===n[0]&&")"===n[n.length-1]&&(n=n.slice(1,-1)),n=n.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,i=t;return Object.keys(l).forEach(function(e){var t=l[e];e=":"+e,i=i.replace(e,"string"==typeof t?"'"+t+"'":String(t))}),i.length>=2&&"("===i[0]&&")"===i[i.length-1]&&(i=i.slice(1,-1)),i=i.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var t=l.i(i.extend)({},e,null,!0),n=this.updateRuleValue(t,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(t),n.ruleVal)},e.prototype.getNamedParameterSql=function(e){var t=l.i(i.extend)({},e,null,!0),n=this.updateRuleValue(t,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(t),n.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){var l=[],i={},n=[];return this.updateValue(e.rules,t,l,i,n)},e.prototype.updateValue=function(e,t,n,o,r){if(l.i(i.isNullOrUndefined)(e))return{ruleVal:n,namedRuleVal:o};for(var s=0;s<e.length;s++)if(e[s].rules){var a=this.updateValue(e[s].rules,t,n,o,r);n=a.ruleVal,o=a.namedRuleVal}else{var u=void 0;if(e[s].value instanceof Array)for(var d=0;d<e[s].value.length;d++)t&&(u=this.getNamedParameter(e[s].field,r)),l.i(i.isNullOrUndefined)(e[s].value[d])||("string"===e[s].type||e[s].type,t?o[u]=e[s].value[d]:n.push(e[s].value[d])),e[s].value[d]=t?":"+u:"?";else if(t&&(u=this.getNamedParameter(e[s].field,r)),e[s].operator.indexOf("null")<1&&("string"!==e[s].type||"string"===e[s].type&&(""!==e[s].value||0===e[s].value))){if("string"===e[s].type||"date"===e[s].type)if(e[s].operator.indexOf("empty")<1){var a=e[s].value.toString();switch(e[s].operator){case"startswith":case"notstartswith":a+="%";break;case"endswith":case"notendswith":a="%"+a;break;case"contains":case"notcontains":a="%"+a+"%"}t?o[u]=a:n.push(a)}else t?o[u]="":n.push(""),"isempty"===e[s].operator?e[s].operator="equal":e[s].operator="notequal";else l.i(i.isNullOrUndefined)(e[s].value)||(t?o[u]=e[s].value:n.push(e[s].value));e[s].value=t?":"+u:"?"}}return{ruleVal:n,namedRuleVal:o}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var i=t.length-1;i>=0;i--){var n=t[i];if(n.indexOf(e)>-1){var o=parseInt(n.split("_")[1],10)+1;l=e+"_"+o,t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}())},function(e,t){e.exports=l},function(e,t){e.exports=i},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=r},function(e,t){e.exports=s}])});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionDropdowns"),require("SyncfusionButtons"),require("SyncfusionCalendars"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionPopups"),require("SyncfusionSplitbuttons")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionDropdowns","SyncfusionButtons","SyncfusionCalendars","SyncfusionData","SyncfusionInputs","SyncfusionPopups","SyncfusionSplitbuttons"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionDropdowns"),require("SyncfusionButtons"),require("SyncfusionCalendars"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionPopups"),require("SyncfusionSplitbuttons")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionDropdowns,e.SyncfusionButtons,e.SyncfusionCalendars,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionPopups,e.SyncfusionSplitbuttons)}(this,function(e,t,l,i,n,o,r,s){return function(e){function t(i){if(l[i])return l[i].exports;var n=l[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var l={};return t.m=e,t.c=l,t.i=function(e){return e},t.d=function(e,l,i){t.o(e,l)||Object.defineProperty(e,l,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var l=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(l,"a",l),l},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,l){t.exports=e},function(e,l){e.exports=t},function(e,t,l){"use strict";var i=l(4);l.d(t,"a",function(){return i.a}),l.d(t,"b",function(){return i.b}),l.d(t,"c",function(){return i.c}),l.d(t,"d",function(){return i.d}),l.d(t,"e",function(){return i.e});var n=l(5);l.d(t,"f",function(){return n.a})},function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=l(2);l.d(t,"Columns",function(){return i.a}),l.d(t,"Rule",function(){return i.b}),l.d(t,"Value",function(){return i.c}),l.d(t,"ShowButtons",function(){return i.d}),l.d(t,"QueryBuilder",function(){return i.e}),l.d(t,"QueryLibrary",function(){return i.f})},function(e,t,l){"use strict";l.d(t,"a",function(){return m}),l.d(t,"b",function(){return f}),l.d(t,"c",function(){return g}),l.d(t,"d",function(){return v}),l.d(t,"e",function(){return y});var i=l(0),n=(l.n(i),l(6)),o=(l.n(n),l(1)),r=(l.n(o),l(8)),s=(l.n(r),l(9)),a=(l.n(s),l(7)),u=(l.n(a),l(11)),d=(l.n(u),l(10)),p=(l.n(d),this&&this.__extends||function(){var e=function(t,l){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])})(t,l)};return function(t,l){function i(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(i.prototype=l.prototype,new i)}}()),c=this&&this.__assign||function(){return c=Object.assign||function(e){for(var t,l=1,i=arguments.length;l<i;l++){t=arguments[l];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},c.apply(this,arguments)},h=this&&this.__decorate||function(e,t,l,i){var n,o=arguments.length,r=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,l):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,l,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(r=(o<3?n(r):o>3?n(t,l,r):n(t,l))||r);return o>3&&r&&Object.defineProperty(t,l,r),r},m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(null)],t.prototype,"field",void 0),h([l.i(i.Property)(null)],t.prototype,"label",void 0),h([l.i(i.Property)(null)],t.prototype,"type",void 0),h([l.i(i.Property)(null)],t.prototype,"values",void 0),h([l.i(i.Property)(null)],t.prototype,"operators",void 0),h([l.i(i.Property)()],t.prototype,"ruleTemplate",void 0),h([l.i(i.Property)(null)],t.prototype,"template",void 0),h([l.i(i.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],t.prototype,"validation",void 0),h([l.i(i.Property)(null)],t.prototype,"format",void 0),h([l.i(i.Property)(null)],t.prototype,"step",void 0),h([l.i(i.Property)(null)],t.prototype,"value",void 0),h([l.i(i.Property)(null)],t.prototype,"category",void 0),h([l.i(i.Property)(null)],t.prototype,"columns",void 0),t}(i.ChildProperty),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(null)],t.prototype,"condition",void 0),h([l.i(i.Collection)([],t)],t.prototype,"rules",void 0),h([l.i(i.Property)(null)],t.prototype,"field",void 0),h([l.i(i.Property)(null)],t.prototype,"label",void 0),h([l.i(i.Property)(null)],t.prototype,"type",void 0),h([l.i(i.Property)(null)],t.prototype,"operator",void 0),h([l.i(i.Property)(null)],t.prototype,"value",void 0),h([l.i(i.Property)(!1)],t.prototype,"not",void 0),h([l.i(i.Property)(!1)],t.prototype,"isLocked",void 0),t}(i.ChildProperty),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(null)],t.prototype,"numericTextBoxModel",void 0),h([l.i(i.Property)(null)],t.prototype,"multiSelectModel",void 0),h([l.i(i.Property)(null)],t.prototype,"datePickerModel",void 0),h([l.i(i.Property)(null)],t.prototype,"textBoxModel",void 0),h([l.i(i.Property)(null)],t.prototype,"radioButtonModel",void 0),t}(i.ChildProperty),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),h([l.i(i.Property)(!1)],t.prototype,"cloneRule",void 0),h([l.i(i.Property)(!1)],t.prototype,"cloneGroup",void 0),h([l.i(i.Property)(!1)],t.prototype,"lockRule",void 0),h([l.i(i.Property)(!1)],t.prototype,"lockGroup",void 0),h([l.i(i.Property)(!0)],t.prototype,"ruleDelete",void 0),h([l.i(i.Property)(!0)],t.prototype,"groupInsert",void 0),h([l.i(i.Property)(!0)],t.prototype,"groupDelete",void 0),t}(i.ChildProperty),y=function(e){function t(t,l){var i=e.call(this,t,l)||this;return i.isReadonly=!0,i.fields={text:"label",value:"field"},i.updatedRule={not:!1,condition:"and",isLocked:!1},i.isLocale=!1,i.isRefreshed=!1,i.isNotified=!1,i.isAddSuccess=!1,i.isNotValueChange=!1,i.isFieldChange=!1,i.isFieldClose=!1,i.isDestroy=!1,i.isGetNestedData=!1,i.isCustomOprCols=[],i.groupCounter=0,i.lockItems=[],i.groupIndex=-1,i.ruleIndex=-1,i.isLastGroup=!1,i.cloneGrpBtnClick=!1,i.isMiddleGroup=!1,i.cloneRuleBtnClick=!1,o.MultiSelect.Inject(o.CheckBoxSelection),i}return p(t,e),t.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},t.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),t=this.element.querySelectorAll("input.e-control"),n=0,o=t.length;n<o;n++)t[n].className.indexOf("e-tooltip")>-1?l.i(i.getComponent)(t[n],"tooltip").destroy():t[n].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(t[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var r=this.createElement("div",{attrs:{class:"e-group-container"}}),s=this.createElement("div",{attrs:{class:"e-group-header"}}),a=this.createElement("div",{attrs:{class:"e-group-body"}});r.appendChild(s).appendChild(a),this.element.appendChild(r),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&l.i(i.removeClass)(this.element.querySelectorAll(".e-qb-toggle"),"e-active-toggle"),e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),this.disableRuleCondition(e.parentElement)},t.prototype.getWrapper=function(){return this.element},t.prototype.getModuleName=function(){return"query-builder"},t.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},t.prototype.GetRootColumnName=function(e){return this.separator?e.split(this.separator)[0]:e},t.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],i=void 0,n=!1,o=!1,r=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=this.columns,u=0,d=a.length;u<d;u++)this.updateCustomOperator(a[u],"initial"),a[u].type||(e.indexOf(a[u].field)>-1&&(r=this.dataColl[0][a[u].field],i=typeof r,"string"===i?o=!isNaN(Date.parse(r)):"object"===i&&(o=r instanceof Date&&!isNaN(r.getTime()),i="string"),a[u].type=i,o=!1),i="string"),a[u].validation||(a[u].validation=s),a[u].category?n=!0:a[u].category=this.l10n.getConstant("OtherFields"),l.indexOf(a[u].category)<0&&l.push(a[u].category),(!a[u].operators||this.isLocale&&0!==this.isCustomOprCols.indexOf(a[u].field))&&(a[u].operators=this.customOperators[a[u].type+"Operator"]);n&&(l.length>1||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(var u=0,d=e.length;u<d;u++)r=this.dataColl[0][e[u]],i=typeof r,"string"===i?o=!isNaN(Date.parse(r)):"object"!==i||Object.keys(r).length||(o=r instanceof Date&&!isNaN(r.getTime()),i="string"),t[u]={field:e[u],label:e[u],type:o?"date":i,validation:s},o=!1,t[u].operators=this.customOperators[t[u].type+"Operator"],"object"===i&&this.updateSubFields(r,t[u]);this.columns=t}}else if(this.columns.length){for(var a=this.columns,u=0,d=a.length;u<d;u++)a[u].category?this.fields={text:"label",value:"field",groupBy:"category"}:a[u].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(a[u]),a[u].operators&&!this.isLocale||(a[u].operators=this.customOperators[a[u].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},t.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},t.prototype.updateSubFields=function(e,t,l){var i;t.columns=[];var n,o,r,s,a=Object.keys(e);l=l||this.dataColl[0];for(var u=0,d=a.length;u<d;u++){var p=t.field.split(".");s=l?l[p[p.length-1]][a[u]]:this.dataColl[0][t.field][a[u]];var c=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof s,n=t.field+this.separator+a[u],o=a[u],r="object"!==r||isNaN(Date.parse(s))?r:"date",i={field:n,label:o,type:r},"object"!==r&&(i.operators=this.customOperators[r+"Operator"]),t.columns.push(i),"object"===r&&this.updateSubFields(s,i,c)}},t.prototype.updateCustomOperator=function(e,t){if(e.operators){this.isLocale||"initial"!==t||l.i(i.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=this,o=0;o<e.operators.length;o++)!function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var i=e.operators[t],o=Object.keys(i),r=o.map(function(e){return i[""+e]}).join(",").split(","),s=o.indexOf("value");n.operators[r[s]]=r[l]}}(o)}},t.prototype.focusEventHandler=function(e){this.target=e.target},t.prototype.clickEventHandler=function(e){var t,n=this,o=e.target;this.isImportRules=!1;var r;if("SPAN"===o.tagName&&(o=o.parentElement),o.className.indexOf("e-collapse-rule")>-1){var s=new i.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var a=document.getElementById(this.element.id+"_summary_content"),u=a.querySelector(".e-summary-text");s.animate(".e-query-builder",{name:"SlideLeftIn"});var d=this.element.querySelector(".e-group-container");d.style.display="none",u.textContent=this.getSqlFromRules(this.rule),a.style.display="block",u.style.height=u.scrollHeight+"px"}if("BUTTON"===o.tagName&&o.className.indexOf("e-qb-toggle")<0)switch(!0){case o.className.indexOf("e-removerule")>-1:this.actionButton=o,this.deleteRule(o);break;case o.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=o,this.cloneRuleBtnClick=!0,this.ruleClone(o);break;case o.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=o,this.ruleLock(o);break;case o.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=o,this.groupLock(o);break;case o.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=o,this.cloneGrpBtnClick=!0,this.groupClone(l.i(i.closest)(o,".e-group-container"));break;case o.className.indexOf("e-deletegroup")>-1:this.actionButton=o,this.deleteGroup(l.i(i.closest)(o,".e-group-container"));break;case o.className.indexOf("e-edit-rule")>-1:var s=new i.Animation({duration:1e3,delay:0});if(s.animate(".e-query-builder",{name:"SlideLeftIn"}),document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not);var p=l.i(i.extend)({},this.rule,{},!0);this.setGroupRules(p),this.renderSummaryCollapse()}else{var d=this.element.querySelector(".e-group-container");d.querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}else if("LABEL"===o.tagName&&o.parentElement.className.indexOf("e-btn-group")>-1||o.className.indexOf("e-qb-toggle")>-1){var c=l.i(i.closest)(o,".e-group-container");if(!this.headerTemplate){var h=o.getAttribute("for"),m=void 0;h&&(m=document.getElementById(h).getAttribute("value")),r=c.id.replace(this.element.id+"_","");var f=this.getGroup(r),g=void 0;if(this.enableNotCondition)if(o.className.indexOf("e-qb-toggle")>-1){var v=c.getElementsByClassName("e-qb-toggle")[0];v.className.indexOf("e-active-toggle")>-1?(l.i(i.removeClass)([v],"e-active-toggle"),g=!1):(l.i(i.addClass)([v],"e-active-toggle"),g=!0),m=f.condition}else g=f.not;t={groupID:r,cancel:!1,type:"condition",value:m.toLowerCase()},this.enableNotCondition&&(t={groupID:r,cancel:!1,type:"condition",value:m.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(t,o):this.trigger("beforeChange",t,function(e){n.beforeSuccessCallBack(e,o)}),this.target=o}},t.prototype.beforeSuccessCallBack=function(e,t){if(!e.cancel){var n=l.i(i.closest)(t,".e-group-container"),o=n.id.replace(this.element.id+"_",""),r=this.getValidRules(this.rule),s=this.getParentGroup(n);s.condition=e.value,this.enableNotCondition&&(s.not=e.not),this.isImportRules||this.trigger("change",{groupID:o,type:"condition",value:s.condition}),this.filterRules(r,this.getValidRules(this.rule),"condition")}},t.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||l.i(i.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?l.i(i.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.i(i.removeClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&l.i(i.addClass)([t.element.querySelector("li").parentElement],"e-rtl")):l.i(i.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(l.i(i.closest)(e,".e-group-container"),{}):t.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,l.i(i.closest)(e,".e-group-container"),"",!0)},t.prototype.appendRuleElem=function(e,t,n,o,r,s){var a,u,d,p=e.querySelector(".e-rule-list");if("change"===n?a=l.i(i.select)("#"+o,e):(a=this.createElement("div",{attrs:{class:"e-rule-container"}}),a.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick?(this.ruleIndex<0?p.appendChild(a):p.insertBefore(a,p.children[this.ruleIndex+1]),this.cloneRuleBtnClick=!1):p.appendChild(a),this.ruleIdCounter++),t&&t.ruleTemplate&&s){d={requestType:"template-initialize",ruleID:a.id,action:r,fields:this.fields,rule:s},this.trigger("actionBegin",d),this.ruleTemplateFn=this.templateParser(t.ruleTemplate);var c=this.element.id+t.field,h=void 0;if(d.fields=this.fields,d.columns=this.columns,""===s.field&&(s.field=t.field),d.operators=this.getOperators(s.field),d.operatorFields={text:"key",value:"value"},this.isReact)h=this.ruleTemplateFn(d,this,a.id,c)[0],u=h,u.className+=" e-rule-field",a.appendChild(u);else if(this.isAngular){var m=this.ruleTemplateFn(d,this,a.id,c);h=3===m[0].nodeType?m[1]:m[0],u=h,u.className+=" e-rule-field",a.appendChild(u)}else this.isVue3?(h=this.ruleTemplateFn(d,this,"Template",c),u=h,l.i(i.append)(u,a),a.children[a.children.length-1].className+=" e-rule-field"):(h=this.ruleTemplateFn(d,this,"Template",c)[0],u=h,u.className+=" e-rule-field",a.appendChild(u))}else u=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),a.appendChild(u);return this.showButtons.lockGroup&&l.i(i.removeClass)(a.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&l.i(i.removeClass)(a.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&l.i(i.removeClass)(a.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&l.i(i.removeClass)(a.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&l.i(i.removeClass)(a.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),t&&t.ruleTemplate&&s&&this.renderReactTemplates(),a},t.prototype.addRuleElement=function(e,t,l,i,n,o){var r=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,i,n,o)):this.trigger("beforeChange",s,function(s){r.addRuleSuccessCallBack(s,e,t,l,i,n,o)})}},t.prototype.addRuleSuccessCallBack=function(e,t,n,r,s,a,u){var d,p,h,m,f=this.element.className.indexOf("e-device")>-1?"250px":"200px",g=n&&n.field?this.getColumn(n.field):r||this.columns[0],v={label:"",field:"",type:"",operator:""};if(!e.cancel){if(g&&g.ruleTemplate&&n.field){this.selectedColumn=g,p=this.selectedColumn.operators,v={label:g.label,field:g.field,type:g.type,operator:p[0].value};var y=Object.keys(n).length?n:v;m=this.appendRuleElem(t,g,s,a,"field",y);var b={requestType:"template-create",action:"insert-rule",ruleID:m.id,fields:this.fields,rule:y};this.trigger("actionBegin",b)}else{m=this.appendRuleElem(t,g,s,a,"field"),m.querySelector(".e-filter-input").setAttribute("id",m.id+"_filterkey");var C=m.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)C.textContent=this.l10n.getConstant("Remove"),l.i(i.addClass)([C],"e-flat"),l.i(i.addClass)([C],"e-primary");else{l.i(i.addClass)([C],"e-round"),l.i(i.addClass)([C],"e-icon-btn"),C.setAttribute("title",this.l10n.getConstant("DeleteRule"));var S=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});m.querySelector(".e-rule-delete").appendChild(S)}this.showButtons.ruleDelete||C.classList.add("e-button-hide")}if("Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?m.className="e-rule-container e-vertical-mode":m.className="e-rule-container e-horizontal-mode",m.previousElementSibling&&m.previousElementSibling.className.indexOf("e-rule-container")>-1&&(m.className.indexOf("e-joined-rule")<0&&(m.className+=" e-joined-rule"),m.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(m.previousElementSibling.className+=" e-prev-joined-rule")),m.previousElementSibling&&m.previousElementSibling.className.indexOf("e-group-container")>-1&&m.className.indexOf("e-separate-rule")<0&&(m.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(t,n,v,u,a),!g||g&&!g.ruleTemplate||!n.field)if("Default"===this.fieldMode){var x=void 0,O=void 0;O=this.separator&&n.field?this.GetRootColumnName(n.field):this.autoSelectField?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):n.field,x={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?f:"auto",close:this.fieldClose.bind(this,m.id+"_filterkey"),change:this.changeField.bind(this),value:n?O:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(x=c({},x,this.fieldModel)),h=new o.DropDownList(x),h.appendTo("#"+m.id+"_filterkey");var k=void 0;k=this.separator&&n.field?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):h.value,this.selectedColumn=h.getDataByValue(k),Object.keys(n).length&&this.changeRule(n,{element:h.element,itemData:this.selectedColumn})}else{var x=void 0,O=(this.isImportRules,n.field);this.dummyDropdownTreeDs=l.i(i.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),x={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:this.columns.length>5?f:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:l.i(i.isNullOrUndefined)(O)?null:[O],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt"},this.fieldModel&&(x=c({},x,this.fieldModel));var w=new o.DropDownTree(x);if(w.appendTo("#"+m.id+"_filterkey"),!l.i(i.isNullOrUndefined)(w.value)){var q=this.getLabelFromColumn(w.value[0]);w.element.value=q}var k=l.i(i.isNullOrUndefined)(n.field)?w.value:this.GetRootColumnName(n.field);this.selectedColumn=this.getColumn(k),Object.keys(n).length&&this.changeRule(n,{element:w.element,itemData:this.selectedColumn})}d=m.id.replace(this.element.id+"_",""),this.isImportRules||this.trigger("change",{groupID:t.id.replace(this.element.id+"_",""),ruleID:d,type:"insertRule"})}},t.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type&&(e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns))},t.prototype.updateAddedRule=function(e,t,n,o,r){var s,a,u,d=0;if(o){for(s=l.i(i.select)("#"+r,e),a=l.i(i.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,d++;u.rules[d]=t}else{a=l.i(i.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=t.custom;Object.keys(t).length?this.ruleIndex<0?(u.rules.push({field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),p&&(u.rules[u.rules.length-1].custom=p)):(u.rules.splice(this.ruleIndex+1,0,{field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),p&&(u.rules[this.ruleIndex+1].custom=p)):(p&&(n.custom=p),this.autoSelectField&&(t.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u)},t.prototype.changeRuleTemplate=function(e,t){var n=this.selectedColumn.operators;if(!e.ruleTemplate){var o=l.i(i.closest)(t,".e-group-container"),r=l.i(i.closest)(t,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&(l.i(i.detach)(t.closest('[id="'+r+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([r])),e){var s={field:e.field,label:e.label,operator:n[0].value,value:""};this.addRuleElement(o,s,e,"change",r,!0)}}},t.prototype.renderToolTip=function(e){var t=new d.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},t.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation){var n=["isnull","isnotnull","isempty","isnotempty"],o=void 0,r=void 0,s=void 0,a=void 0,u=[],d=void 0,p=void 0,c=void 0,h=void 0,m=void 0,f=this.element.querySelectorAll(".e-rule-container");for(o=0,r=f.length;o<r;o++){var g=void 0;if(d=l.i(i.closest)(f[o],".e-group-container"),m=this.getParentGroup(d),p=0,a=h=f[o],"DropdownTree"===this.fieldMode?(e=l.i(i.getComponent)(f[o].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(c=l.i(i.getComponent)(f[o].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&c.value&&(this.selectedColumn=c.getDataByValue(c.value),g=!l.i(i.isNullOrUndefined)(c.index)&&this.selectedColumn.validation),s=h.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;a&&null!==a.previousElementSibling;)a=a.previousElementSibling,p++;if(s=h.querySelector(".e-rule-operator .e-control"),m.rules[p].operator||(s.parentElement.className.indexOf("e-tooltip")<0&&s.className.indexOf("e-tooltip")<0&&this.renderToolTip(s.parentElement),t=!1),m.rules[p].value instanceof Array&&(u=m.rules[p].value),n.indexOf(m.rules[p].operator)<-1&&l.i(i.isNullOrUndefined)(m.rules[p].value)&&"date"!==m.rules[p].type||""===m.rules[p].value||m.rules[p].value instanceof Array&&u.length<1){var v=h.querySelectorAll(".e-rule-value .e-control");t=!1;for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=l.i(i.closest)(C,".e-multi-select-wrapper"),S.className.indexOf("e-tooltip")<0&&this.renderToolTip(S)):v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(v[y].parentElement),y++}}}else(c&&c.element&&l.i(i.isNullOrUndefined)(c.index)||e&&e.element&&(l.i(i.isNullOrUndefined)(e.value)||e.value.length<1))&&(s.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(s.parentElement),t=!1)}}return t},t.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");if(e){this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)}},t.prototype.refreshLevel=function(e){var t,n,o=e.groupElement.querySelector(".e-rule-list").children,r=e.groupElement,s=o.length,a=0;for(n=0;n<s;n++)t=o[n],t.className.indexOf("e-group-container")>-1&&(e.level.push(a),this.levelColl[t.id]=e.level.slice(),a++,e.groupElement=t,e=this.refreshLevel(e));var u=l.i(i.closest)(r,".e-rule-list");return e.groupElement=u?l.i(i.closest)(u,".e-group-container"):r,e.level=this.levelColl[e.groupElement.id].slice(),e},t.prototype.groupTemplate=function(){var e,t,l,i,n,o=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),s=this.createElement("div",{attrs:{class:"e-group-body"}}),a=this.createElement("div",{attrs:{class:"e-rule-list"}});return o.appendChild(r),s.appendChild(a),o.appendChild(s),this.headerTemplate||(e=this.createElement("div",{attrs:{class:"e-lib e-btn-group",role:"group"}}),this.enableNotCondition&&(t=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),e.appendChild(t)),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),e.appendChild(t),l=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),e.appendChild(l),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),e.appendChild(t),l=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),e.appendChild(l),r.appendChild(e),i=this.createElement("div",{attrs:{class:"e-group-action"}}),n=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(n),r.appendChild(i)),o},t.prototype.ruleTemplate=function(){var e,t,n,o,r=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}});var a=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(a),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",o=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var u=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),d=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});u.appendChild(d);var p=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:o}});d=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),p.appendChild(d),t=this.showButtons.ruleDelete||l.i(i.isNullOrUndefined)(this.showButtons.ruleDelete)?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide";var c=this.createElement("button",{attrs:{type:"button",class:t}});return e.appendChild(u),e.appendChild(p),e.appendChild(c),s.appendChild(e),r.appendChild(s),r},t.prototype.addGroupElement=function(e,t,l,i,n,o,r){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,i,n,o,r)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,l,i,n,o,r)})},t.prototype.addGroupSuccess=function(e,t,o,r,s,a,d,p){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var c=o,h=void 0,m="";m=c.className.indexOf("e-group-container")<0?c.querySelector(".e-group-container")&&c.querySelector(".e-group-container").id:c.id;var f=this.groupElem.cloneNode(!0);if(f.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.headerTemplate&&(d?(t=!1,f.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(f,a,r,p,m),this.groupIdCounter=0):this.headerTemplateFn(f,a,r,p,m)),this.groupIdCounter++,!this.headerTemplate){var g=f.querySelector(".e-btngroup-and"),v=f.querySelector(".e-btngroup-or"),y=f.querySelector(".e-btngroup-and-lbl"),b=f.querySelector(".e-btngroup-or-lbl");g.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),g.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(t){var C=void 0;C=this.showButtons.groupDelete||l.i(i.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}});new n.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),l.i(i.rippleEffect)(h,{selector:".deletegroup"});for(var S=c.querySelector(".e-rule-list"),x=S.children,O=0,k=0,w=x.length;k<w;k++)x[k].className.indexOf("e-group-container")>-1&&(O+=1);this.showButtons.cloneGroup&&this.cloneGrpBtnClick?this.groupIndex===x.length-1?(S.appendChild(f),this.isLastGroup=!0):(x[this.groupIndex+1].parentNode.insertBefore(f,x[this.groupIndex+1]),this.isMiddleGroup=!0):S.appendChild(f);var q=this.levelColl[c.id].slice(0);if(q.push(O),this.levelColl[f.id]=q,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],c.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,s&&this.addRuleToNewGroups&&this.addRuleElement(f,{})),!this.headerTemplate){var N="";N=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var E=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:N}}),R=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});E.appendChild(R),f.querySelector(".e-group-action").appendChild(E),N=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var I=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:N}}),L=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});I.appendChild(L),f.querySelector(".e-group-action").appendChild(I),f.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){var N="";N=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var I=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:N}}),R=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});I.appendChild(R),f.querySelector(".e-group-action").appendChild(I)}c.appendChild(f),this.levelColl[f.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var D=f.querySelector(".e-qb-toggle");new n.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"}).appendTo(D),f.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&l.i(i.addClass)([D],"e-active-toggle")}if(this.updatedRule=null,this.headerTemplate){var T={requestType:"header-template-create",ruleID:f.id,condition:r,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",T)}else{var B=f.querySelector(".e-add-btn");new u.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,B),select:this.selectBtn.bind(this,B)}).appendTo(B),B.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules){var P=c.id.replace(this.element.id+"_",""),M=f.id.replace(this.element.id+"_","");this.trigger("change",{groupID:P,type:"insertGroup",childGroupID:M})}}},t.prototype.headerTemplateFn=function(e,t,n,o,r){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?t:void 0,condition:n,rule:this.getRuleCollection(o,!0),groupID:r},this.trigger("actionBegin",a),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],d.appendChild(s);else if(this.isAngular){var p=this.headerFn(a,this,e.id,u);s=3===p[0].nodeType?p[1]:p[0],d.appendChild(s)}else this.isVue3?(s=this.headerFn(a,this,e.id,u),l.i(i.append)(s,d)):(s=this.headerFn(a,this,"Template",u)[0],d.appendChild(s));this.renderReactTemplates()}return e},t.prototype.notifyChange=function(e,t,n){var o=l.i(i.closest)(t,".e-group-container"),r=this.getParentGroup(o),s=l.i(i.closest)(t,".e-rule-container"),a=0;if("not"===n)return void(r.not=e);if("condition"===n)return void(r.condition=e);for(;s&&null!==s.previousElementSibling;)s=s.previousElementSibling,a++;var u=r.rules[a],d=this.getColumn(u.field),p=this.getFormat(d.format);if("date"===d.type)if(e instanceof Date)e=this.intl.formatDate(e,p);else if(e instanceof Array)for(var c=0;c<e.length;c++)e[c]&&e[c]instanceof Date&&(e[c]=this.intl.formatDate(e[c],p));d.ruleTemplate?this.templateChange(t,e,n):(this.isNotified=!0,this.updateRules(t,e),this.isNotified=!1)},t.prototype.templateChange=function(e,t,n){var o,r=l.i(i.closest)(e,".e-group-container"),s=this.getParentGroup(r),a=l.i(i.closest)(e,".e-rule-container"),u=0;for(this.allowValidation&&this.validateValue(s,a);a&&null!==a.previousElementSibling;)a=a.previousElementSibling,u++;var d=s.rules[u];"field"===n?this.selectedColumn=this.getColumn(t):d&&(this.selectedColumn=this.getColumn(d.field));var p;this.previousColumn=this.getColumn(d.field);var c=this.getValidRules(this.rule);this.selectedColumn&&(p=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var h,m=["in","notin","between","notbetween"];switch(n){case"field":d.field=t,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=p[0].value;break;case"operator":h=d.operator,d.operator=t,m.indexOf(d.operator)>-1?d.value=[]:m.indexOf(h)>-1&&(d.value="");break;case"value":d.value=t}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(c,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var f=l.i(i.closest)(e,".e-rule-container");this.destroyControls(f,!0),l.i(i.detach)(f.querySelector(".e-rule-field"));var g=this.appendRuleElem(l.i(i.closest)(f,".e-group-container"),this.selectedColumn,"change",f.id,n,d);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?g.className="e-rule-container e-vertical-mode":g.className="e-rule-container e-horizontal-mode",g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-rule-container")>-1&&(g.className.indexOf("e-joined-rule")<0&&(g.className+=" e-joined-rule"),g.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(g.previousElementSibling.className+=" e-prev-joined-rule")),g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-group-container")>-1&&g.className.indexOf("e-separate-rule")<0&&(g.className+=" e-separate-rule");var v={requestType:"template-create",action:n,ruleID:f.id,fields:this.fields,rule:d};o={groupID:r.id.replace(this.element.id+"_",""),ruleID:f.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",v),this.trigger("change",o)}},t.prototype.changeValue=function(e,t){var n,o=this;if(this.isNumInput&&"number"==typeof t.value)return void(this.isNumInput=!1);if(t.element&&t.element.classList.contains("e-multiselect")){n=t.element}else n=t.event?t.event.target:"input"===t.type&&t.currentTarget?t.currentTarget:t.element;if(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1){n=t.element}var r,a=l.i(i.closest)(n,".e-group-container"),u=l.i(i.closest)(n,".e-rule-container"),d=a&&a.id.replace(this.element.id+"_",""),p=u.id.replace(this.element.id+"_",""),c=t;c.element&&c.element.className.indexOf("e-datepicker")>-1&&(n=c.element,r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),r&&(this.selectedColumn=r.getDataByValue(r.value)),(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(r.value[0])));var h,m;if(n.className.indexOf("e-radio")>-1)if(m=parseInt(n.id.split("valuekey")[1],0),"Default"===this.fieldMode?(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=r.getDataByValue(r.value),this.selectedColumn.columns&&(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(r.value))):(r=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(r.value[0])),this.selectedColumn.values)h=this.selectedColumn.values[m];else{var f=[!0,!1];h=f[m]}else if(n.className.indexOf("e-multiselect")>-1)h=l.i(i.getComponent)(n,"multiselect").value;else if(h=t.value,"input"===t.type&&t.currentTarget){h=Number(t.currentTarget.value);var g=l.i(i.getInstance)(t.currentTarget,s.NumericTextBox);g.value=h,this.isNumInput=!0}"input"===t.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){o.filterValue(d,p,h,e,n)},this.immediateModeDelay)):this.filterValue(d,p,h,e,n)},t.prototype.filterValue=function(e,t,l,i,n){var o=this,r={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(r,n,i,e,t):this.trigger("beforeChange",r,function(l){o.changeValueSuccessCallBack(l,n,i,e,t)})},t.prototype.changeValueSuccessCallBack=function(e,t,l,i,n){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:i,ruleID:n,value:e.value,cancel:!1,type:"value"}))},t.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var t=l.i(i.getComponent)(e,"dropdownlist"),n=t.popupObj.element.querySelector(".e-active"),o=t.getItemData();t.value=o.value;var r={element:t.element,value:o.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:o,event:null,e:null};t.previousValue!==t.value&&this.changeField(r),this.isFieldChange=!1}},t.prototype.changeField=function(e){if(e.isInteracted){if(l.i(i.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var t=l.i(i.closest)(e.element,".e-rule-filter")||l.i(i.closest)(e.element,".e-rule-sub-filter"),n="DropdownTree"===this.fieldMode?this.getColumn(e.value[0]):this.getColumn(e.value);if("DropdownTree"===this.fieldMode&&null!==t){var o=t.querySelector(".e-dropdowntree.e-control"),r=l.i(i.getComponent)(o,"dropdowntree");if(!n)return;if("object"===n.type){if(r.value=e.oldValue,r.dataBind(),l.i(i.isNullOrUndefined)(e.oldValue))o.value="";else{var s=this.getLabelFromColumn(e.oldValue[0]);o.value=s}return}if(!l.i(i.isNullOrUndefined)(e.value[0])){r.value=e.value[0],r.dataBind();var s=this.getLabelFromColumn(e.value[0]);o.value=s}}if(this.destroySubFields(t),this.subFieldElem=null,this.isNotValueChange=!0,n&&n.ruleTemplate)this.templateChange(e.element,n.field,"field");else if(n&&n.columns&&n.columns[0].ruleTemplate)this.templateChange(e.element,n.columns[0].field,"field");else{for(var a=l.i(i.closest)(e.element,".e-group-container"),u=this.getParentGroup(a),d=l.i(i.closest)(e.element,".e-rule-container"),p=0;d&&null!==d.previousElementSibling;)d=d.previousElementSibling,p++;u.rules[p].value="",this.changeRule(u.rules[p],e)}}},t.prototype.changeRule=function(e,t){if(!t.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==l.i(i.getComponent)(t.element,"dropdowntree").value)return}var n={},o=l.i(i.closest)(t.element,".e-rule-filter");o=o||l.i(i.closest)(t.element,".e-rule-sub-filter");var r=l.i(i.getComponent)(t.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==o&&(r=l.i(i.getComponent)(t.element,"dropdowntree"));var s=l.i(i.closest)(t.element,".e-group-container"),a=s.id.replace(this.element.id+"_","");this.changeFilter(o,r,a,e,n,t)},t.prototype.changeFilter=function(e,t,n,o,r,s){var a=this;if(e){var u=void 0;u="DropdownTree"===this.fieldMode?t.value[0]:this.isImportRules?this.GetRootColumnName(t.value):t.value,this.selectedColumn=this.getColumn(u);var d=l.i(i.closest)(e,".e-rule-container"),p=d.id.replace(this.element.id+"_",""),c={groupID:n,ruleID:p,selectedField:"DropdownTree"===this.fieldMode?t.value[0]:t.value,cancel:!1,type:"field"};this.isImportRules?this.fieldChangeSuccess(c,r,e,o,s):this.trigger("beforeChange",c,function(t){a.fieldChangeSuccess(t,r,e,o,s)})}else{var h=l.i(i.closest)(s.element,".e-rule-operator");this.changeOperator(e,h,t,n,o,r,s)}},t.prototype.changeOperator=function(e,t,n,o,r,s,a){var u,d,p,c=this;t?(u=l.i(i.closest)(t,".e-rule-container"),d=u.id.replace(this.element.id+"_",""),p={groupID:o,ruleID:d,selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(p,e,s,r,a):this.trigger("beforeChange",p,function(t){c.operatorChangeSuccess(t,e,s,r,a)})):this.changeRuleValues(e,r,s,a)},t.prototype.fieldChangeSuccess=function(e,t,n,o,r){for(var s=l.i(i.closest)(n,".e-rule-container"),a=l.i(i.closest)(r.element,".e-rule-operator"),u=l.i(i.closest)(r.element,".e-group-container"),d=u.id.replace(this.element.id+"_",""),p=l.i(i.getComponent)(r.element,"dropdownlist"),c=s.querySelectorAll(".e-tooltip.e-input-group"),h=0;h<c.length;h++)l.i(i.getComponent)(c[h],"tooltip").destroy();if(e.cancel)this.changeOperator(n,a,p,d,o,t,r);else{if(l.i(i.isNullOrUndefined)(this.selectedColumn))return;if(t.type=this.selectedColumn.type,s.querySelector(".e-template")&&(o.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(t.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,o,t,r);else this.destroySubFields(n),this.changeOperator(n,a,p,d,o,t,r)}},t.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},t.prototype.createSubFields=function(e,t,n,r){var s=!1,a=l.i(i.closest)(e,".e-rule-field"),u=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});a.insertBefore(u,a.querySelector(".e-rule-operator"));var d=l.i(i.closest)(u,".e-rule-container").id,p=this.createElement("input",{attrs:{type:"text",id:d+"_subfilterkey"+this.subFilterCounter}});u.appendChild(p);var h,m=this.element.className.indexOf("e-device")>-1?"250px":"200px";h={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?m:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(h=c({},h,this.fieldModel));var f=new o.DropDownList(h);if(f.appendTo("#"+d+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(t.field)===this.GetRootColumnName(this.previousColumn.field))for(var g=this.selectedColumn.columns,v=0;v<g.length;v++)if(t.field===g[v].field||t.field.indexOf(g[v].field+this.separator)>-1){f.value=g[v].field,this.selectedColumn=g[v],s=!0;break}this.subFilterCounter++,this.subFieldElem=p,r.itemData=r.itemData,!s&&this.selectedColumn.columns&&(!s&&this.isImportRules&&(f.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(u,t,n,r)},t.prototype.operatorChangeSuccess=function(e,t,n,o,r){if(!e.cancel){var s=l.i(i.closest)(r.element,".e-rule-operator"),a=s.nextElementSibling,u=l.i(i.getComponent)(r.element,"dropdownlist"),d=o.operator?o.operator.toString().toLowerCase():"";n.operator=u.value.toString();var p=n.operator.toLowerCase();if(n.operator.toLowerCase().indexOf("between")>-1||n.operator.toLowerCase().indexOf("in")>-1&&n.operator.toLowerCase().indexOf("contains")<0?(t=s.previousElementSibling,n.type=o.type,(n.operator.toLowerCase().indexOf("in")<0||d.indexOf("in")<0)&&(o.value=[])):"object"==typeof o.value&&null!==o.value&&(o.value=o.value.length>0?o.value[0]:"number"===o.type?0:""),r.previousItemData){var c=r.previousItemData.value.toString().toLowerCase();(c.indexOf("between")>-1||(c.indexOf("in")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contains")<0)&&(t=s.previousElementSibling,n.type=o.type)}if(d.indexOf("in")>-1&&d.indexOf("in")<5&&p.indexOf("in")>-1&&p.indexOf("in")<5&&(t=null),n.operator.indexOf("null")>-1||n.operator.indexOf("empty")>-1){var h=s.parentElement.querySelector(".e-rule-value"),m=h.querySelector(".e-tooltip.e-input-group");m&&l.i(i.getComponent)(m,"tooltip").destroy(),l.i(i.removeClass)([h],"e-show"),l.i(i.addClass)([h],"e-hide")}a&&this.getColumn(o.field).template&&(t=s.previousElementSibling),0==a.children.length&&(t=s.previousElementSibling),this.changeRuleValues(t,o,n,r)}},t.prototype.changeRuleValues=function(e,t,n,r){var s,a,u,d,p=l.i(i.closest)(r.element,".e-rule-operator");if(e)if(p=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(n.type=this.selectedColumn.type,s=p.classList.contains("e-rule-sub-filter"),p=s?p.nextElementSibling:p),l.i(i.addClass)([p],"e-operator"),p.childElementCount){a=l.i(i.getComponent)(p.querySelector(".e-dropdownlist"),"dropdownlist"),n.operator=a.value;var h=void 0;h="DropdownTree"===this.fieldMode?l.i(i.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):l.i(i.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),n.type="DropdownTree"===this.fieldMode?this.getColumn(h.value[0]).type:this.getColumn(h.value).type;var m=r.itemData;""!==a.value&&this.renderValues(p,m,r.previousItemData,!0,t,n,r.element)}else{var f=l.i(i.closest)(p,".e-rule-container").id;d=this.createElement("input",{attrs:{type:"text",id:f+"_operatorkey"}}),p.appendChild(d),this.selectedColumn.operators?u=this.selectedColumn.operators:r.itemData&&(u=this.customOperators[this.selectedColumn.type+"Operator"]);var g=this.element.className.indexOf("e-device")>-1?"250px":"200px",v=u[0].value,y=0;this.autoSelectOperator||(v="",y=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1)&&(v=t&&t.operator?t.operator:v);var b=void 0;b={dataSource:u,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:u.length>5?g:"auto",change:this.changeField.bind(this),index:y,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(b=c({},b,this.operatorModel));var C=new o.DropDownList(b);C.appendTo("#"+f+"_operatorkey"),n.operator=t&&""!==t.operator&&!l.i(i.isNullOrUndefined)(t.operator)?t.operator:u[0].value,this.isImportRules&&(n.type=this.selectedColumn.type,n.operator=t.operator),l.i(i.isNullOrUndefined)(v)||""===v?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(p,this.selectedColumn,r.previousItemData,!1,t,n,r.element):this.renderValues(p,this.selectedColumn,r.previousItemData,!1,t,n,r.element)}this.isImportRules||this.updateRules(r.element,r.item)},t.prototype.popupOpen=function(e,t){this.enableRtl&&l.i(i.addClass)([t.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},t.prototype.destroyControls=function(e,t){for(var n=t?e:e.nextElementSibling,o=n.querySelectorAll("input.e-control"),r=n.querySelectorAll("div.e-control:not(.e-handle)"),s=this.columns,a=0,u=o.length;a<u;a++){if(o[a].classList.contains("e-textbox"))l.i(i.getComponent)(o[a],"textbox").destroy(),l.i(i.detach)(l.i(i.select)("input#"+o[a].id,n));else if(o[a].classList.contains("e-dropdownlist"))this.allowValidation&&o[a].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(o[a].parentElement,"tooltip").destroy(),l.i(i.getComponent)(o[a],"dropdownlist").destroy();else if(o[a].classList.contains("e-radio"))l.i(i.getComponent)(o[a],"radio").destroy();else if(o[a].classList.contains("e-numerictextbox"))l.i(i.getComponent)(o[a],"numerictextbox").destroy(),l.i(i.detach)(l.i(i.select)("input#"+o[a].id,n));else if(o[a].classList.contains("e-datepicker"))l.i(i.getComponent)(o[a],"datepicker").destroy();else if(o[a].classList.contains("e-multiselect"))l.i(i.getComponent)(o[a],"multiselect").destroy();else if(o[a].className.indexOf("e-template")>-1)for(var d=o[a].className,p=0,c=s.length;p<c;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],o[a].id);break}document.getElementById(o[a].id)&&l.i(i.detach)(o[a])}for(var a=0,u=r.length;a<u;a++){if(r[a].className.indexOf("e-template")>-1)for(var d=r[a].className,p=0,c=s.length;p<c;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],r[a].id);break}l.i(i.detach)(r[a])}for(var h=n.querySelectorAll(".e-template:not(.e-control)"),a=0,u=h.length;a<u;a++)l.i(i.detach)(h[a])},t.prototype.templateDestroy=function(e,t){var n;if("string"!=typeof e.template||void 0===e.template.destroy){n=e.template;var o=n.destroy;if(n.destroy){var r=void 0;document.getElementById(t)&&(r=l.i(i.closest)(document.getElementById(t),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof o?(o=l.i(i.getValue)(o,window))({field:e.field,elementId:t,elements:r}):n.destroy({field:e.field,elementId:t,elements:r})}}},t.prototype.getValues=function(e){var t,l={},i=[],n=[];this.separator.length>0&&(n=e.split(this.separator));var o=this.dataColl;if(this.dataColl[1])for(var r=0,s=o.length;r<s;r++){var a={};if(n.length>1)for(var u=o[r],d=void 0,p=0,c=n.length;p<c;p++)d=n[p],n.length===p+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=o[r][""+e],Number(o[r][""+e])===o[r][""+e]&&o[r][""+e]%1!=0&&(t=o[r][""+e].toString());t in l||(l[""+t]=1,n.length>1?this.createNestedObject(a,n,t):a[""+e]=t,i.push(a))}return i},t.prototype.createNestedObject=function(e,t,l){for(var i,n=t.length-1,o=0;o<n;++o)i=t[o],i in e||(e[""+i]={}),e=e[""+i];e[t[n]]=l},t.prototype.getDistinctValues=function(e,t){for(var l={},i=[],n=[],o="",r=t.indexOf(this.separator),s=this,a=0,u=e.length;a<u;a++)!function(a,u){0===r?o=e[a][""+t]:(n=t.split(s.separator),n.forEach(function(t){o=o?o[""+t]:e[a][""+t]})),Number(e[a][""+t])===e[a][""+t]&&e[a][""+t]%1!=0&&(o=e[a][""+t].toString());var d={};o in l||(l[""+o]=1,0===r?d[""+t]=o:d[n[n.length-1]]=o,i.push(d))}(a);return i},t.prototype.renderMultiSelect=function(e,t,l,i,n){var s,a=!1,u=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(a=!0,s=this.getDistinctValues(this.dataColl,e.field)),a=!e.columns&&a,!this.dataColl.length&&n.length&&(u=!0);var d;d={dataSource:u?n:a?s:this.dataManager,query:new r.Query([e.field]),fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(d=c({},d,this.valueModel.multiSelectModel));var p=new o.MultiSelect(d);p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},t.prototype.multiSelectOpen=function(e,t){if(this.dataSource instanceof r.DataManager){var n=document.getElementById(e),o=l.i(i.getComponent)(l.i(i.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist");this.selectedColumn=o.getDataByValue(o.value);var s=this.selectedColumn.field,a=!1;if(this.dataColl[1]){Object.keys(this.dataColl[1]).indexOf(s)>-1&&(a=!0);0!==s.indexOf(this.separator)&&this.isGetNestedData&&(a=!0)}a||(t.cancel=!0,this.bindMultiSelectData(n,s))}},t.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},t.prototype.getMultiSelectData=function(e,t){var n,o=this,s=new r.Deferred,a=this.dataManager.executeQuery((new r.Query).select(t)),u=l.i(i.getComponent)(e,"multiselect");u.hideSpinner(),this.createSpinner(l.i(i.closest)(e,".e-multi-select-wrapper").parentElement),l.i(d.showSpinner)(l.i(i.closest)(e,".e-multi-select-wrapper").parentElement),a.then(function(r){n=r.actual&&r.actual.result?r.actual.result:r.result,o.dataColl=l.i(i.extend)(o.dataColl,n,[],!0),u.dataSource=o.getDistinctValues(o.dataColl,t),o.isGetNestedData=!0,l.i(d.hideSpinner)(l.i(i.closest)(e,".e-multi-select-wrapper").parentElement)}).catch(function(e){s.reject(e)})},t.prototype.createSpinner=function(e){var t=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(t),l.i(d.createSpinner)({target:t,width:i.Browser.isDevice?"16px":"14px"})},t.prototype.closePopup=function(e,t){var n=document.getElementById(t.popup.element.id.replace("_popup",""));if(n){var o=l.i(i.getComponent)(n,"multiselect").value;this.updateRules(n,o,e)}},t.prototype.processTemplate=function(e,t,n,o){var r=l.i(i.closest)(e,".e-rule-container"),s=r.querySelectorAll(".e-template"),a=r.querySelector(".e-rule-filter .e-filter-input"),u="DropdownTree"===this.fieldMode?l.i(i.getComponent)(a,"dropdowntree"):l.i(i.getComponent)(r.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);if("string"==typeof t.template||void 0===t.template.write){var p={rule:n,ruleID:r.id,operator:o.operator,field:d.field,requestType:"value-template-create"};this.trigger("actionBegin",p)}else{var c=t.template;"string"==typeof c.write?l.i(i.getValue)(c.write,window)({elements:s.length>1?s:s[0],values:n.value,operator:o.operator,field:d.field,dataSource:d.values}):"function"!=typeof t.template&&t.template.write({elements:s.length>1?s:s[0],values:n.value,operator:o.operator,field:d.field,dataSource:d.values})}},t.prototype.getItemData=function(e){var t=l.i(i.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist");return"DropdownTree"===this.fieldMode&&(t=l.i(i.getComponent)(document.getElementById(e+"_filterkey"),"dropdowntree")),"DropdownTree"===this.fieldMode?this.getColumn(t.value[0]):this.getColumn(t.value)},t.prototype.setDefaultValue=function(e,t,n){var o=this.getItemData(e);if(l.i(i.isNullOrUndefined)(o.value))return n?t?[0,0]:0:t?[]:"";if(t){if(!(o.value instanceof Array))return[o.value]}else if(o.value instanceof Array)return o.value[0];return o.value},t.prototype.renderStringValue=function(e,t,l,i,n){var o,r,a=this.getItemData(e),u="string"==typeof a.template;if(r=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!=t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),r=o.join(","));var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.textBoxModel&&(d=c({},d,this.valueModel.textBoxModel));var p=new s.TextBox(d);p.appendTo("#"+e+"_valuekey"+i),p.value=r,p.dataBind()}else o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,i,o,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px")},t.prototype.renderNumberValue=function(e,t,l,i,n,o,r){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1);var p=d.join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.textBoxModel&&(h=c({},h,this.valueModel.textBoxModel));var m=new s.TextBox(h);m.appendTo("#"+e+"_valuekey"+i),m.value=p,m.dataBind()}else{o=a;var f=o.validation&&o.validation.min?o.validation.min:0,g=o.validation&&o.validation.max?o.validation.max:Number.MAX_VALUE,v=o.format?o.format:"n";r>1&&t&&(d=t.value[i]?t.value[i]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[i]:d,format:v,min:f,max:g,width:"100%",step:o.step?o.step:1,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=c({},y,this.valueModel.numericTextBoxModel));var b=new s.NumericTextBox(y);b.appendTo("#"+e+"_valuekey"+i),b.element.setAttribute("aria-label",o.label+" Value"),b.element.oninput=this.changeValue.bind(this,i)}else d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,i,d,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?n.style.width="100%":(n.style.minWidth="200px",n.style.width=null)},t.prototype.processValueString=function(e,t){var l=[],i=e.split(",");if("string"===t)return i;for(var n=0,o=i.length;n<o;n++)l.push(Number(i[n]));return l},t.prototype.parseDate=function(e,t){var n,o;if(t){var r=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(t),o=r(e),l.i(i.isNullOrUndefined)(o)&&(o=this.intl.parseDate(e,n))}else o=new Date(e);return o},t.prototype.renderControls=function(e,t,n,o,r){if(l.i(i.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),l.i(i.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),l.i(i.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),t.template&&(t.template.create||r))this.processTemplate(e,t,n,o);else{var s;s="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var u=l.i(i.closest)(e,".e-rule-container").id,d=void 0,p=o.operator.toString();if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){d=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?d.style.width="100%":"in"!==p&&"notin"!==p?l.i(i.addClass)([d],"e-custom-value"):l.i(i.removeClass)([d],"e-custom-value");for(var h=0;h<s;h++)switch(o.type){case"string":this.renderStringValue(u,n,p,h,d);break;case"number":this.renderNumberValue(u,n,p,h,d,t,s);break;case"boolean":this.processBoolValues(t,n,u,h);break;case"date":var m=new Date,f=void 0,g=void 0,v=t.format,y=void 0,b=void 0,C=this.l10n.getConstant("SelectValue"),S="string"==typeof t.template;if(n.value&&!l.i(i.isNullOrUndefined)(v)&&(f=s>1?n.value[h]:n.value,m=this.parseDate(f,v)||new Date),t.field||t.key||!t.value||(m=t.value instanceof Date?t.value:this.parseDate(t.value,t.format)),!t.format&&n&&""!==n.field&&(g=this.getColumn(n.field),v=g.format),(this.isImportRules||this.isPublic||S)&&n&&(g=this.getColumn(n.field),v=g.format,n.value?(f=s>1?n.value[h]:n.value,m=this.parseDate(f,g.format)):m=n.value),v){var x=this.getFormat(v);x.skeleton?(b={locale:this.getLocale(),value:m,placeholder:C,format:x,change:this.changeValue.bind(this,h)},this.valueModel&&this.valueModel.datePickerModel&&(b=c({},b,this.valueModel.datePickerModel)),y=new a.DatePicker(b)):(b={value:m,locale:this.getLocale(),placeholder:C,format:x.format,change:this.changeValue.bind(this,h)},this.valueModel&&this.valueModel.datePickerModel&&(b=c({},b,this.valueModel.datePickerModel)),y=new a.DatePicker(b))}else b={locale:this.getLocale(),value:m,placeholder:C,change:this.changeValue.bind(this,h)},this.valueModel&&this.valueModel.datePickerModel&&(b=c({},b,this.valueModel.datePickerModel)),y=new a.DatePicker(b);if(y.appendTo("#"+u+"_valuekey"+h),!n.value){var O=document.getElementById(u+"_valuekey"+h);this.updateRules(O,m,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},t.prototype.processBoolValues=function(e,t,o,r){var s,a,u=!1;l.i(i.isNullOrUndefined)(t.type)&&e&&(t.type=e.type);var d;if(e.values){var p=e.values;"boolean"!==t.type||l.i(i.isNullOrUndefined)(t.value)?e.value?u=p[r].toLowerCase()===e.value.toString().toLowerCase():0===r&&(u=!0):u=p[r].toLowerCase()===t.value.toString().toLowerCase(),a=s=d=p[r]}else{var p=[!0,!1];"boolean"!==t.type||l.i(i.isNullOrUndefined)(t.value)?e.value?u=p[r].toString().toLowerCase()===e.value.toString().toLowerCase():0===r&&(u="boolean"!=typeof t.value||!!t.value):u=p[r].toString().toLowerCase()===t.value.toString().toLowerCase(),"boolean"==typeof t.value&&1===r&&(u=!t.value),s=p[r].toString(),a=p[r],d=this.l10n.getConstant(["True","False"][r])}var h;h={label:d,name:o+"default",checked:u,value:s,change:this.changeValue.bind(this,r)},this.valueModel&&this.valueModel.radioButtonModel&&(h=c({},h,this.valueModel.radioButtonModel));var m=new n.RadioButton(h);m.appendTo("#"+o+"_valuekey"+r),u&&this.updateRules(m.element,a,0,!0)},t.prototype.getOperatorIndex=function(e,t){var l,i=e.dataSource,n=i.length;for(l=0;l<n;l++)if(t.operator===e.dataSource[l].value)return l;return 0},t.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},t.prototype.renderValues=function(e,t,n,o,r,s,a){var u=e.previousElementSibling,d=u.getElementsByTagName("input")[0],p="DropdownTree"===this.fieldMode?l.i(i.getComponent)(d,"dropdowntree"):l.i(i.getComponent)(d,"dropdownlist"),c="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]):this.getColumn(p.value);this.selectedRule=c;var h=l.i(i.getComponent)(e.querySelector("input"),"dropdownlist");o&&(t=a.id.indexOf("operator")>-1?t:this.selectedRule,t.operators&&(h.value=null,h.dataBind(),h.dataSource=t.operators,h.index=this.getOperatorIndex(h,r),h.value=s.operator=h.dataSource[h.index].value,this.autoSelectOperator?h.dataBind():(h.index=-1,s.operator=h.value="")));var m=s.operator.toString(),f=!1;if(m.indexOf("null")>-1||m.indexOf("isempty")>-1||m.indexOf("isnotempty")>-1){var g=e.parentElement.querySelector(".e-rule-value");g&&(l.i(i.removeClass)([g],"e-show"),l.i(i.addClass)([g],"e-hide"))}else{var v=l.i(i.closest)(e,".e-rule-container").id;if(n=this.getPreviousItemData(n,c),n&&void 0===n.template?n.columns&&(n=this.getColumn(r.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(r.field)),n&&n.template){this.templateDestroy(n,v+"_valuekey0");var y=l.i(i.select)("#"+v+"_valuekey0",e.nextElementSibling);y&&!y.classList.contains("e-control")&&l.i(i.detach)(l.i(i.select)("#"+v+"_valuekey0",e.nextElementSibling)),"string"!=typeof n.template&&void 0!==n.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([v]),e.nextElementSibling.innerHTML="")}if(o&&(this.validateValue(r,l.i(i.closest)(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||h&&""!==h.value){if(c&&(t.template=c.template),t.template&&(l.i(i.addClass)([e.nextElementSibling],"e-template-value"),t.template=c.template,f=this.setColumnTemplate(t,v,c.field,t.value||m,e,r)),f){var g=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?g.style.width="100%":g.style.width="200px"}else{l.i(i.removeClass)([e.nextElementSibling],"e-template-value");var b=1;b="boolean"===s.type?this.selectedColumn.values?this.selectedColumn.values.length:2:m&&m.toLowerCase().indexOf("between")>-1?2:1;for(var C=0;C<b;C++){var S=this.createElement("input",{attrs:{type:"text",id:v+"_valuekey"+C}});e.nextElementSibling.appendChild(S)}}this.renderControls(e,t,r,s,f)}}},t.prototype.setColumnTemplate=function(e,t,n,o,r,s){var a,u=this,d=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return a={requestType:"value-template-initialize",ruleID:t,field:n,operator:o,rule:s,renderTemplate:!0},this.trigger("actionBegin",a,function(l){d=u.actionBeginSuccessCallBack(l,e,t,n,r)}),d;var p=void 0,c=e.template;if((p="string"==typeof c.create?l.i(i.getValue)(c.create,window)({field:n,operator:o}):c.create({field:n,operator:o}))instanceof Element)p.id=t+"_valuekey0",l.i(i.addClass)([p],"e-template"),r.nextElementSibling.appendChild(p),n.indexOf(" ")<0&&l.i(i.addClass)([p],"e-"+n);else if(p instanceof Array){l.i(i.addClass)(p,"e-template");for(var h=0,m=p.length;h<m;h++)p[h].id=t+"_valuekey"+h,r.nextElementSibling.appendChild(p[h])}return l.i(i.addClass)([r.nextElementSibling],"e-template-value"),!0}return!0},t.prototype.actionBeginSuccessCallBack=function(e,t,n,o,r){if(e.renderTemplate){var s=void 0;this.columnTemplateFn=this.templateParser((t.template,t.template));var a=this.element.id+o;if(this.isReact)s=this.columnTemplateFn(e,this,n,a)[0],r.nextElementSibling.appendChild(s);else if(this.isAngular){var u=this.columnTemplateFn(e,this,n,a);s=3===u[0].nodeType?u[1]:u[0],r.nextElementSibling.appendChild(s)}else this.isVue3?(s=this.columnTemplateFn(e,this,"Template",a),l.i(i.append)(s,r.nextElementSibling)):(s=this.columnTemplateFn(e,this,"Template",a)[0],r.nextElementSibling.appendChild(s));return l.i(i.addClass)([r.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},t.prototype.updateValues=function(e,t){var n=1;e.className.indexOf("e-template")>-1&&(n=3);var o=e.className.split(" e-")[n],r=parseInt(e.id.slice(-1),2);switch(o){case"checkbox":var s=l.i(i.getComponent)(e,o).value;t.value=""!==s?s:void 0;break;case"textbox":case"dropdownlist":t.value=l.i(i.getComponent)(e,o).value;break;case"radio":var a=l.i(i.getComponent)(e,o);a.checked&&("boolean"==typeof t.value?t.value="true"===a.value:this.getColumn(t.field).values?t.value=a.value:t.value="true"===a.value),a.refresh();break;case"numerictextbox":t.operator.indexOf("between")>-1?("string"==typeof t.value&&(t.value=[]),t.value[r]=l.i(i.getComponent)(e,o).value):t.value=l.i(i.getComponent)(e,o).value;break;case"datepicker":var u=this.getColumn(t.field),d=this.getFormat(u.format),p=l.i(i.getComponent)(e,o).value;t.operator.indexOf("between")>-1?("string"==typeof t.value&&(t.value=[]),t.value[r]=this.intl.formatDate(p,d)):l.i(i.isNullOrUndefined)(d.format)&&p?t.value=this.intl.formatDate(p):t.value=p?this.intl.formatDate(p,d):p;break;case"multiselect":t.value=l.i(i.getComponent)(e,o).value}},t.prototype.updateRules=function(e,t,n,o){for(var r,s,a=l.i(i.closest)(e,".e-group-container"),u=this.getParentGroup(a),d=l.i(i.closest)(e,".e-rule-container"),p=0,c=a.id.replace(this.element.id+"_",""),h=this.getValidRules(this.rule);d&&null!==d.previousElementSibling;)d=d.previousElementSibling,p++;var m=u.rules[p].operator?u.rules[p].operator.toString():"";d=l.i(i.closest)(e,".e-rule-container");var f=d.id.replace(this.element.id+"_","");if(l.i(i.closest)(e,".e-rule-filter")||l.i(i.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),r="DropdownTree"===this.fieldMode?l.i(i.getComponent)(e,"dropdowntree"):l.i(i.getComponent)(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(r.value[0]):this.getColumn(r.value);!this.isImportRules&&u.rules[p].field&&u.rules[p].field.toLowerCase()!==g.field.toLowerCase()&&(!d.querySelectorAll(".e-template")&&!(m.indexOf("null")>-1)||m.indexOf("empty")>-1)&&(u.rules[p].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),u.rules[p].field=this.selectedColumn.field,u.rules[p].type=this.selectedColumn.type,u.rules[p].label=this.selectedColumn.label;var v=l.i(i.closest)(e,".e-rule-filter");v=v||l.i(i.closest)(e,".e-rule-sub-filter");var y=v.nextElementSibling.querySelector("input.e-control");y=y||v.nextElementSibling.nextElementSibling.querySelector("input.e-control"),m=l.i(i.getComponent)(y,"dropdownlist").value.toString(),u.rules[p].operator=m;var b=v.nextElementSibling.nextElementSibling,C=b.querySelectorAll("input.e-control");C.length<1&&(C=b.querySelectorAll("div.e-control")),C.length<1&&(C=b.querySelectorAll(".e-template")),s={groupID:c,ruleID:f,value:u.rules[p].field,type:"field"};for(var S=0;S<C.length;S++)m.indexOf("null")>-1||m.indexOf("empty")>-1?u.rules[p].value=null:this.updateValues(C[S],u.rules[p]);this.isImportRules||this.trigger("change",s),this.allowValidation&&u.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(h,this.getValidRules(this.rule),"field")}else if(l.i(i.closest)(e,".e-rule-operator")){r=l.i(i.getComponent)(e,"dropdownlist"),u.rules[p].operator=r.value.toString();var x=d.querySelectorAll(".e-rule-value input.e-control");s={groupID:c,ruleID:f,value:r.value,type:"operator"},this.allowValidation&&u.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(e.parentElement,"tooltip").destroy(),x.length>1&&!(x[0].className.indexOf("e-template")>-1)&&(u.rules[p].value=[]);for(var O=0;O<x.length;O++)u.rules[p].operator.indexOf("null")>-1||u.rules[p].operator.indexOf("empty")>-1?u.rules[p].value=null:x[O].classList.contains("e-template")||this.updateValues(x[O],u.rules[p]);this.isImportRules||this.trigger("change",s),this.filterRules(h,this.getValidRules(this.rule),"operator")}else l.i(i.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,t,u,p,a,d,n),o||this.filterRules(h,this.getValidRules(this.rule),"value"))},t.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},t.prototype.ruleValueUpdate=function(e,t,l,i,n,o,r){var s,a,u=["in","between","notin","notbetween"];if(l.rules[i].operator&&(a=l.rules[i].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[i].type&&!this.isNotified){for(var d=[],p=t,c=0,h=p.length;c<h;c++)"string"==typeof p[c]&&d.push(parseFloat(p[c]));d.length&&(t=d)}if(this.isNotified)l.rules[i].value=t,s={groupID:n.id,ruleID:o.id,value:l.rules[i].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[i].value[r]=t:l.rules[i].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[i].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[i].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[i].type,l.rules[i].value=this.processValueString(t,l.rules[i].type)):l.rules[i].value=t;else if(e.className.indexOf("e-datepicker")>-1){var m=this.getFormat(this.getColumn(this.selectedColumn.field).format);m.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[i].value&&(l.rules[i].value=[]),l.rules[i].value[r]=this.intl.formatDate(t,m)):l.rules[i].value=this.intl.formatDate(t,m))}this.validateValue(l,o,i)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[i].value&&(l.rules[i].value=[]),l.rules[i].value[r]=t):l.rules[i].value=t},t.prototype.validateValue=function(e,t,n){l.i(i.isNullOrUndefined)(n)||(e=e.rules[n]);var o="object"==typeof e.value;if(this.allowValidation&&(l.i(i.isNullOrUndefined)(n)||(o?e.value.length>0:e.value))){var r=t.querySelectorAll(".e-rule-value .e-control");r.length>0&&(r[0].className.indexOf("e-tooltip")>-1?l.i(i.getComponent)(r[0],"tooltip").destroy():r[0].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(r[0].parentElement,"tooltip").destroy(),r[1]&&r[1].parentElement.className.indexOf("e-tooltip")>-1&&l.i(i.getComponent)(r[1].parentElement,"tooltip").destroy())}},t.prototype.getFormat=function(e){var t;return e?"string"==typeof e?(t={type:"dateTime"},"short"===e||"yMd"===e?(t.type="date",t.skeleton=e):t.format=e):t={type:"dateTime",skeleton:e.skeleton}:t={type:"date",skeleton:"yMd"},t},t.prototype.findGroupByIdx=function(e,t,l){var i=t.rules,n=[];if(!l){for(var o=0,r=i.length;o<r;o++)t=i[o],t.rules&&n.push(t);return n[e]}return t},t.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var t,n,o,r;e.prototype.destroy.call(this);var s;for(t=this.element.querySelectorAll(".e-addrulegroup"),o=t.length,n=0;n<o;n++)l.i(i.getComponent)(t[n],"dropdown-btn").destroy(),l.i(i.detach)(t[n]);for(r=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<r.length;n++)l.i(i.getComponent)(r[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)"),o=t.length,n=0;n<o;n++)l.i(i.getComponent)(t[n],"dropdownlist")?l.i(i.getComponent)(t[n],"dropdownlist").destroy():l.i(i.getComponent)(t[n],"dropdowntree").destroy(),l.i(i.detach)(t[n]);for(r=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<r.length;n++)l.i(i.getComponent)(r[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)"),o=t.length,n=0;n<o;n++)l.i(i.getComponent)(t[n],"dropdownlist")&&(l.i(i.getComponent)(t[n],"dropdownlist").destroy(),l.i(i.detach)(t[n]));for(r=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<r.length;n++)l.i(i.getComponent)(r[n],"tooltip").destroy();if(this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate(),s=document.querySelectorAll(".qb-dropdownlist.e-popup"))for(n=0;n<s.length;n++)s[n].remove();l.i(i.classList)(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1}},t.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,i=e.length;l<i;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},t.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),i=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var n=0,o=e.length;n<o;n++)this.updatedRule={isLocked:e[n].isLocked,condition:e[n].condition,not:e[n].not},this.importRules(e[n],l,!1,e[n].not);this.isPublic=!1}else{var r="and",s=!1,a=!1;this.updatedRule&&(r=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?i.rules.push({condition:r,not:s,rules:[]}):i.rules.push({condition:r,rules:[]}):this.enableNotCondition?i.rules.splice(this.groupIndex+1,0,{condition:r,not:s,rules:[],isLocked:a}):i.rules.splice(this.groupIndex+1,0,{condition:r,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,i)}},t.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&l.i(i.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableRtl&&l.i(i.addClass)([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),i.Browser.isDevice||"Vertical"===this.displayMode?(i.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),l.i(i.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),l.i(i.addClass)(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();else{if(this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule);var e=l.i(i.extend)({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var t=this.element.querySelectorAll("label.e-btn"),n=void 0,o=0;o<t.length;o++)n=t.item(o),l.i(i.rippleEffect)(n,{selector:".e-btn"})}},t.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),i=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),i.appendChild(l),e.appendChild(i),this.element.appendChild(e)},t.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});this.element.querySelector(".e-group-header").appendChild(e)},t.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortBy("field")))},t.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group").insertBefore(e,this.groupElem.querySelector(".e-btngroup-and"))}}else this.groupElem.querySelector(".e-qb-toggle").remove();this.setProperties({rule:this.checkNotGroup(this.rule)},!0),this.initWrapper()},t.prototype.notGroupRtl=function(){this.enableRtl?l.i(i.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):l.i(i.removeClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},t.prototype.checkNotGroup=function(e){var t;if(e.rules)for(var n=0;n<e.rules.length;n++)t=e.rules[n],t=this.checkNotGroup(t),e.rules[n]=t;return l.i(i.isNullOrUndefined)(e.not)?this.enableNotCondition&&!l.i(i.isNullOrUndefined)(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},t.prototype.onPropertyChanged=function(e,t){for(var n=Object.keys(e),o=0,r=n;o<r.length;o++){switch(r[o]){case"summaryView":var s=this.element.querySelector(".e-group-container"),a=this.element.querySelector(".e-summary-content");e.summaryView?(s.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),a=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),a.style.display="block"):(s.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),s.style.display="block",a.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":l.i(i.isNullOrUndefined)(e.showButtons.lockGroup)||(e.showButtons.lockGroup?l.i(i.removeClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.lockRule)||(e.showButtons.lockRule?l.i(i.removeClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?l.i(i.removeClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.cloneRule)||(e.showButtons.cloneRule?l.i(i.removeClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?l.i(i.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),l.i(i.isNullOrUndefined)(e.showButtons.groupDelete)||(e.showButtons.groupDelete?l.i(i.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):l.i(i.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":t.cssClass&&l.i(i.removeClass)([this.element],t.cssClass.split(" ")),e.cssClass&&l.i(i.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?(l.i(i.addClass)([this.element],"e-rtl"),this.notGroupRtl()):(l.i(i.removeClass)([this.element],"e-rtl"),this.notGroupRtl());break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource,this.refresh();break;case"columns":this.columns=e.columns,this.columnSort(),this.updateSubFieldsFromColumns(this.columns);break;case"sortDirection":this.sortDirection=e.sortDirection,this.columnSort();break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rule":0!==this.rule.rules.length||l.i(i.isNullOrUndefined)(this.rule)||this.reset(),this.setProperties({rule:e.rule},!0),e.rule=this.getRuleCollection(this.rule,!1),this.setRules(this.rule);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new i.Internationalization(this.locale),this.isLocale=!0,this.refresh(),this.isLocale=!1;break;case"enableNotCondition":this.onChangeNotGroup();break;case"readonly":this.isReadonly=e.readonly,this.enableReadonly()}}},t.prototype.preRender=function(){this.element.id=this.element.id||l.i(i.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",In:"In",NotIn:"Not In",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required",SummaryViewTitle:"Summary View",OtherFields:"Other Fields",AND:"AND",OR:"OR",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new i.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new i.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},t.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof r.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new r.Query).take(1))):(this.dataManager=new r.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new r.Query),this.initControl()),this.renderComplete()},t.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?l.i(i.compile)(document.querySelector(e).innerHTML.trim()):l.i(i.compile)(e)}catch(t){return l.i(i.compile)(e)}},t.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),i=new r.Deferred;l.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){i.reject(e)})},t.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},t.prototype.wireEvents=function(){var e=this.getWrapper();i.EventHandler.add(e,"click",this.clickEventHandler,this),i.EventHandler.add(e,"focusout",this.focusEventHandler,this),i.EventHandler.add(e,"focusin",this.focusEventHandler,this),i.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this)},t.prototype.unWireEvents=function(){var e=this.getWrapper();i.EventHandler.remove(e,"click",this.clickEventHandler),i.EventHandler.remove(e,"focusout",this.focusEventHandler),i.EventHandler.remove(e,"focusin",this.focusEventHandler),i.EventHandler.remove(this.element,"keydown",this.keyBoardHandler)},t.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],i=t?l.length-1:l.length,n=this.rule,o=0;o<i;o++)n=this.findGroupByIdx(l[o],n,0===o);return n},t.prototype.deleteGroup=function(e){var t,l=this,i=e;"string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t)):t=i.id.replace(this.element.id+"_","");var n={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules?this.deleteGroupSuccessCallBack(n,e):this.trigger("beforeChange",n,function(t){l.deleteGroupSuccessCallBack(t,e)})},t.prototype.deleteGroupSuccessCallBack=function(e,t){if(!e.cancel){var n=t,o=this.getParentGroup(n,!0),r=0,s=void 0,a=void 0,u=this.getValidRules(this.rule),d=n.nextElementSibling,p=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),h=n.querySelectorAll(".e-tooltip");for(a=h.length,s=0;s<a;s++)l.i(i.getComponent)(h[s],"tooltip").destroy();for(s=0,a=c.length;s<a;s++)delete this.levelColl[c[s].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,r++;d&&d.className.indexOf("e-separate-rule")>-1&&(l.i(i.removeClass)([d],"e-separate-rule"),l.i(i.addClass)([d],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&l.i(i.addClass)([p],"e-prev-joined-rule"));var m=n.parentElement.parentElement.parentElement,f=[];if(this.isReact||this.isAngular){var g=o.rules[r],v=t.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var y=0;y<g.rules.length;y++){var b=this.getColumn(g.rules[y].field);if(v[y]){var C=v[y].querySelector(".e-template-value");b&&(b.ruleTemplate||this.isPlatformTemplate(b)&&C)&&f.push(v[y].id)}}}l.i(i.detach)(t),this.headerTemplate&&this.clearQBTemplate([t.id]),f.length&&this.clearQBTemplate(f),o.rules.splice(r,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(m,o),this.isImportRules||this.trigger("change",e),this.filterRules(u,this.getValidRules(this.rule),"deleteGroup")}},t.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},t.prototype.deleteRule=function(e){var t=this,n=l.i(i.closest)(e,".e-group-container"),o=n.id.replace(this.element.id+"_",""),r=l.i(i.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),s={groupID:o,ruleID:r,cancel:!1,type:"deleteRule"};this.isImportRules?this.deleteRuleSuccessCallBack(s,e):this.trigger("beforeChange",s,function(l){t.deleteRuleSuccessCallBack(l,e)})},t.prototype.deleteRuleSuccessCallBack=function(e,t){if(!e.cancel){var n=l.i(i.closest)(t,".e-group-container"),o=this.getParentGroup(n),r=l.i(i.closest)(t,".e-rule-container"),s=this.getValidRules(this.rule),a=r,u=r.nextElementSibling,d=r.previousElementSibling,p=0,c=r.querySelectorAll(".e-tooltip"),h=void 0,m=c.length;for(h=0;h<m;h++)l.i(i.getComponent)(c[h],"tooltip").destroy();for(;null!==r.previousElementSibling;)r=r.previousElementSibling,p++;var f=this.getColumn(o.rules[p].field);f&&f.template&&a.querySelector(".e-template")&&this.templateDestroy(f,a.querySelector(".e-template").id),(!d||d.className.indexOf("e-rule-container")<0)&&u&&l.i(i.removeClass)([u],"e-joined-rule"),(!u||u.className.indexOf("e-rule-container")<0)&&d&&l.i(i.removeClass)([d],"e-prev-joined-rule");var g=a.querySelector(".e-template-value");try{l.i(i.detach)(a)}catch(e){e=[];e.error="error"}f&&f.ruleTemplate&&this.clearQBTemplate([a.id]),f&&this.isPlatformTemplate(f)&&g&&this.clearQBTemplate([a.id]),o.rules.splice(p,1),o.rules[0]&&o.rules[0].rules||this.disableRuleCondition(n,o);for(var v=this.element.querySelectorAll(".e-tooltip"),y=0;y<v.length;y++)l.i(i.getComponent)(v[y],"tooltip").refresh(v[y]);this.isImportRules||this.trigger("change",e),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},t.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},t.prototype.keyBoardHandler=function(e){!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode||e.preventDefault()},t.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},t.prototype.disableRuleCondition=function(e,t){if(!this.headerTemplate){if(this.readonly)return;var l=e.querySelector(".e-rule-list").childElementCount,i=e.querySelector(".e-btngroup-and"),n=e.querySelector(".e-btngroup-or");l>1?(i.disabled=!1,n.disabled=!1,(n.nextElementSibling.classList.contains("e-btn-disable")||i.nextElementSibling.classList.contains("e-btn-disable"))&&(n.nextElementSibling.classList.remove("e-btn-disable"),i.nextElementSibling.classList.remove("e-btn-disable")),t&&"or"===t.condition?n.checked=!0:i.checked=!0):(i.checked=!1,i.disabled=!0,n.checked=!1,n.disabled=!0,t&&(n.nextElementSibling.classList.add("e-btn-disable"),i.nextElementSibling.classList.add("e-btn-disable")))}},t.prototype.getValidRules=function(e){e||(e=this.getRules());var t=e.condition,n=e.not,o=l.i(i.extend)([],e.rules,[],!0);return this.getRuleCollection({condition:t,rules:o,not:n},!0)},t.prototype.getRuleCollection=function(e,t){if(l.i(i.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var o=e.rules.length,r=0;r<o;r++)n=e.rules[r],n=this.getRuleCollection(n,t),e.rules[r]=n,Object.keys(n).length<1&&t&&(e.rules.splice(r,1),r--,o--);var s=e.custom;if(e.field&&""!==e.field&&(l.i(i.isNullOrUndefined)(s)||s&&"question"!==s.type&&"answer"!==s.type))if(e.operator&&(e.operator.toString().indexOf("null")>-1||e.operator.toString().indexOf("empty")>-1)&&(e.value=null),this.isRefreshed&&this.enablePersistence||""!==e.field&&""!==e.operator&&""!==e.value&&void 0!==e.value||s&&s.isQuestion){var a=e.condition;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,isLocked:e.isLocked},a&&(e.condition=a),s&&(e.custom=s),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={})}else e={};else if(!s||"question"!==s.type&&"answer"!==s.type)l.i(i.isNullOrUndefined)(e.condition)&&l.i(i.isNullOrUndefined)(e.rules)?e={}:(e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not,isLocked:e.isLocked}:{condition:e.condition,rules:e.rules,isLocked:e.isLocked},s&&(e.custom=s),0===e.rules.length&&(e={}));else{var u=e.not;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules},e.custom=s,this.enableNotCondition&&(e.not=u)}return e},t.prototype.setRules=function(e){var t=l.i(i.extend)({},e,{},!0);this.headerTemplate?this.setGroupRules(t,!0):this.setGroupRules(t)},t.prototype.getRules=function(){var e;return e=this.enableNotCondition?{condition:this.rule.condition,rules:this.rule.rules,not:this.rule.not}:{condition:this.rule.condition,rules:this.rule.rules},this.rule.custom&&(e.custom=this.rule.custom),e},t.prototype.getRule=function(e){var t,n,o=0;if(e instanceof HTMLElement?t=l.i(i.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,t=document.getElementById(n)),l.i(i.isNullOrUndefined)(t))return null;for(var r=l.i(i.closest)(t,".e-group-container"),s=this.getParentGroup(r);null!==t.previousElementSibling;)t=t.previousElementSibling,o++;return s.rules[o]},t.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=l.i(i.closest)(e,".e-group-container"));var t=e instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(t)},t.prototype.deleteGroups=function(e){var t,l,i=e.length;for(t=0;t<i;t++)l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l))},t.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=l.i(i.isNullOrUndefined)(e)?new r.Query:(new r.Query).where(e);return this.dataManager.executeQuery(t)},t.prototype.deleteRules=function(e){var t,l,i=e.length;for(t=0;t<i;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},t.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],i=0,n=Object.keys(this.columns);i<n.length;i++)l.push(this.columns[i].field);return e.rules.length?(new r.Query).select(l).where(t):(new r.Query).select(l)},t.prototype.getPredicate=function(e){var t,n,o,s,a=e.rules,u=!1;if(!a)return t;for(var d=0,p=a.length;d<p;d++){var c=a[d].operator;"notstartswith"===c?c="doesnotstartwith":"notendswith"===c?c="doesnotendwith":"notcontains"===c&&(c="doesnotcontain");var h=Object.keys(a[d]);if(u=!1,h.indexOf("rules")>-1&&a[d].rules)(n=this.getPredicate(a[d]))&&(t=t?"and"===e.condition?t.and(n):t.or(n):n);else if(!l.i(i.isNullOrUndefined)(c)&&!l.i(i.isNullOrUndefined)(c.length)){var m=a[d].operator.toLowerCase(),f=!1,g=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===a[d].type&&(u=!this.matchCase),"date"===a[d].type&&g.indexOf(m)>-1&&(u=!0),s=this.getColumn(a[d].field),m.indexOf("null")>-1||m.indexOf("empty")>-1)a[d].value=null;else if("date"!==a[d].type||a[d].value instanceof Array)o=a[d].value;else{var v=this.getFormat(s.format);l.i(i.isNullOrUndefined)(a[d].value)?o=null:(o=this.getDate(a[d].value,v),g.indexOf(m)>-1&&!this.isTime(a[d].value)&&(f=!0))}if(0===d)if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contain")<0)t=f?this.datePredicate(a[d],o):this.arrayPredicate(a[d]);else{var y=o;""!==y&&(t=new r.Predicate(a[d].field,c,o,u))}else if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contain")<0)t=f?this.datePredicate(a[d],o,t,e.condition):this.arrayPredicate(a[d],t,e.condition);else if("and"===e.condition){var y=o;t&&""!==y?t=t.and(a[d].field,c,o,u):""!==y&&(t=new r.Predicate(a[d].field,c,o,u))}else{var y=o;t&&""!==y?t=t.or(a[d].field,c,o,u):""!==y&&(t=new r.Predicate(a[d].field,c,o,u))}}}return this.dataSource instanceof r.DataManager&&(l.i(i.isNullOrUndefined)(t)||"isnull"!==t.operator&&"isnotnull"!==t.operator||(t.operator="isnull"===t.operator?"equal":"notequal")),t},t.prototype.getLocale=function(){var e=this.locale;return l.i(i.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",i.cldrData)||(e="en"),e},t.prototype.getColumn=function(e,t){var l,i=this.columns;i=t||i;for(var n=0,o=i.length;n<o;n++){if(i[n].field===e){l=i[n];break}if(i[n].columns){if(l=this.getColumn(e,i[n].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&i[n].field===e.split(this.separator)[0]){l=i[n];break}}return l},t.prototype.getOperators=function(e){return this.getColumn(e).operators},t.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},t.prototype.datePredicate=function(e,t,l,i){var n,o=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":n=new r.Predicate(e.field,"greaterthanorequal",o),n=n.and(e.field,"lessthanorequal",s);break;case"notequal":n=new r.Predicate(e.field,"lessthan",o),n=n.or(e.field,"greaterthan",s);break;case"greaterthan":n=new r.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":n=new r.Predicate(e.field,"greaterthanorequal",o);break;case"lessthan":n=new r.Predicate(e.field,"lessthan",o);break;case"lessthanorequal":n=new r.Predicate(e.field,"lessthanorequal",s)}return n&&(l?"and"===i?l=l.and(n):"or"===i&&(l=l.or(n)):l=n),l},t.prototype.arrayPredicate=function(e,t,l){var i,n=e.value,o=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(o.indexOf("null")>-1||o.indexOf("empty")>-1)switch(o){case"isnull":i=new r.Predicate(e.field,"isnull",s);break;case"isnotnull":i=new r.Predicate(e.field,"isnotnull",s);break;case"isempty":i=new r.Predicate(e.field,"equal","");break;case"isnotempty":i=new r.Predicate(e.field,"notequal","")}if(!(o.indexOf("null")>-1||o.indexOf("empty")>-1))for(var d=0,p=n.length;d<p;d++)if(""!==n[d]||("in"===o||"notin"===o)&&"string"===a.type)if(0===d){var c="greaterthanorequal";switch(o){case"between":i="date"!==a.type?new r.Predicate(e.field,c,n[d]):new r.Predicate(e.field,c,n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null);break;case"notbetween":i="date"===a.type?new r.Predicate(e.field,"lessthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null):new r.Predicate(e.field,"lessthan",n[d]);break;case"in":i=new r.Predicate(e.field,"equal",n[d]);break;case"notin":i=new r.Predicate(e.field,"notequal",n[d])}}else{switch(e.operator){case"between":i="date"===a.type?i.and(e.field,"lessthanorequal",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):i.and(e.field,"lessthanorequal",n[d]);break;case"notbetween":i="date"===a.type?i.or(e.field,"greaterthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):i.or(e.field,"greaterthan",n[d]);break;case"in":i=i.or(e.field,"equal",n[d]);break;case"notin":i=i.and(e.field,"notequal",n[d])}}return i&&(t?"and"===l?t=t.and(i):"or"===l&&(t=t.or(i)):t=i),t},t.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&(l=new Date,l.setHours(parseInt(e.split(":")[0])),l.setMinutes(parseInt(e.split(":")[1])),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2]))),l},t.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},t.prototype.importRules=function(e,t,n,o,r){if(n){if(e.rules.length>1&&!this.headerTemplate){var s=t.querySelector(".e-btngroup-or"),a=t.querySelector(".e-btngroup-and");s.disabled=!1,a.disabled=!1,"or"===e.condition?s.checked=!0:a.checked=!0}else this.disableRuleCondition(t);if(this.headerTemplate&&r&&(t=this.renderGroup(e,e.condition,this.element,e.not,r)),this.enableNotCondition&&!this.headerTemplate){var u=t.querySelector(".e-qb-toggle");e.not?l.i(i.addClass)([u],"e-active-toggle"):l.i(i.removeClass)([u],"e-active-toggle")}}else t=this.renderGroup(e,e.condition,t,o);0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var d=e.rules;if(!l.i(i.isNullOrUndefined)(d))for(var p=0,c=d.length;p<c;p++){var h=Object.keys(d[p]);if(!l.i(i.isNullOrUndefined)(d[p].rules)&&h.indexOf("rules")>-1&&0!==d[p].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;t=this.renderGroup(d[p],d[p].condition,t,d[p].not),t=this.importRules(d[p],t,!0)}else this.renderRule(d[p],t);if(!l.i(i.isNullOrUndefined)(d[p].rules)&&d[p].isLocked){var m=t.querySelector(".e-rule-list").children[p].querySelector(".e-lock-grp-btn");this.groupLock(m)}if(l.i(i.isNullOrUndefined)(d[p].rules)&&d[p].isLocked){var f=t.querySelector(".e-rule-list").children[p].querySelector(".e-lock-rule-btn");this.ruleLock(f)}}return t&&(t=l.i(i.closest)(t,".e-rule-list")),t&&(t=l.i(i.closest)(t,".e-group-container")),t},t.prototype.renderGroup=function(e,t,l,i,n){this.addGroupElement(!0,l,t,!1,i,n,e);var o=l.querySelectorAll(".e-group-container"),r=l.querySelector(".e-rule-list").children;return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup?(this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1,r[this.groupIndex+1]):this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,r[r.length-1]):o[o.length-1]},t.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},t.prototype.enableReadonly=function(){for(var e=this.element,t=e.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),r=0;r<t.length;r++)if(t[r].classList.contains("e-dropdownlist")){var u=l.i(i.getInstance)(t[r],o.DropDownList);u.readonly=this.isReadonly}else if(t[r].classList.contains("e-dropdowntree")){var d=l.i(i.getComponent)(t[r],"dropdowntree");d.readonly=this.isReadonly}else if(t[r].classList.contains("e-numerictextbox")){var p=l.i(i.getInstance)(t[r],s.NumericTextBox);p.readonly=this.isReadonly}else if(t[r].classList.contains("e-textbox")){var c=l.i(i.getInstance)(t[r],s.TextBox);c.readonly=this.isReadonly}else if(t[r].classList.contains("e-datepicker")){var h=l.i(i.getInstance)(t[r],a.DatePicker);h.readonly=this.isReadonly}else if(t[r].classList.contains("e-multiselect")){var m=l.i(i.getInstance)(t[r],o.MultiSelect);m.readonly=this.isReadonly}else if(t[r].classList.contains("e-radio")){var f=l.i(i.getInstance)(t[r],n.RadioButton);f.checked||(this.isReadonly?t[r].parentElement.style.display="none":t[r].parentElement.style.display="inherit")}var g=this.element.querySelectorAll(".e-deletegroup"),v=this.element.querySelectorAll(".e-addrulegroup"),y=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");for(var b=[g,v,y],r=0;r<b.length;r++)b[r].forEach(function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")});this.enableBtnGroup()},t.prototype.enableBtnGroup=function(){var e=this,t=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;t.forEach(function(t){!t.classList.contains("e-qb-toggle")||t.classList.contains("e-active-toggle")||t.classList.contains("e-readonly")?t.classList.contains("e-qb-toggle")&&t.classList.contains("e-not-readonly")?t.classList.remove("e-not-readonly"):t.classList.contains("e-qb-toggle")&&t.classList.contains("e-readonly")?t.classList.remove("e-readonly"):t.classList.contains("e-active-toggle")?(t.classList.add("e-not-readonly"),l=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),l?"AND"===t.textContent?t.classList.add("e-readonly-and"):t.classList.add("e-readonly-or"):("AND"===t.textContent&&e.isReadonly?(t.classList.remove("e-not"),t.classList.add("e-readonly-and")):(e.enableNotCondition&&t.classList.add("e-not"),t.classList.remove("e-readonly-and")),"OR"===t.textContent&&e.isReadonly?t.classList.add("e-readonly-or-not"):t.classList.remove("e-readonly-or-not"))):t.classList.contains("e-btn-disable")||t.classList.add("e-readonly"):(t.classList.add("e-readonly"),l=!1)})},t.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,i=t.length;l<i;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},t.prototype.getSqlString=function(e,t,l,i){var n=!1;l||""===l?l+="(":(l="",n=!0);var o=e.condition;if(e.not){var r=void 0;n?(r=i?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (",l+=r):(r=i?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT (",l+=r)}if(e.rules)for(var s=0,a=e.rules.length;s<a;s++){if(e.rules[s].rules)l=this.getSqlString(e.rules[s],t,l,i);else{var u=e.rules[s],d="",p=i?this.sqlOperators[u.operator]:this.operators[u.operator];if(u.value instanceof Array)if(u.operator.toString().indexOf("between")>-1){var c=i?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==u.type||this.isDateFunction(u.value[0])?d+=u.value[0]+c+u.value[1]:d+='"'+u.value[0]+'"'+c+'"'+u.value[1]+'"'}else if("string"==typeof u.value[0]&&null!==u.value){d+='("'+u.value[0]+'"';for(var h=1,m=u.value.length;h<m;h++)d+=',"'+u.value[h]+'"';d+=")"}else d+="("+u.value+")";else u.operator.toString().indexOf("startswith")>-1?d+=u.value?'("'+u.value+'%")':"("+u.value+")":u.operator.toString().indexOf("endswith")>-1?d+=u.value?'("%'+u.value+'")':"("+u.value+")":u.operator.toString().indexOf("contains")>-1?d+=u.value?'("%'+u.value+'%")':"("+u.value+")":"number"===u.type||"boolean"==typeof u.value||null===u.value&&u.operator.toString().indexOf("empty")<-1?d+=u.value:u.operator.toString().indexOf("empty")>-1?d+='""':d+='"'+u.value+'"';if(u.operator.toString().indexOf("null")>-1)t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),l+=u.field+" "+p;else{var f=p;"isempty"===u.operator?f="=":"isnotempty"===u.operator&&(f="!="),t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),l+=u.field+" "+f+" "+d}u.condition&&""!==u.condition&&(o=u.condition)}if(s!==a-1){var u=e.rules[s];(""===o||u&&""!==u.condition&&u.custom&&u.custom.isCustom)&&(o=u.condition),o=i?this.l10n.getConstant(o.toUpperCase()).toUpperCase():o.toUpperCase(),l+=" "+o+" "}}return n||(l+=")"),e.not&&(l+=")"),l},t.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},t.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},t.prototype.getSqlFromRules=function(e,t,l){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},t.prototype.getParameterizedSql=function(e){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql},t.prototype.setParameterizedSql=function(e){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var i=this.getRulesFromSql(l);this.setRules({condition:i.condition,not:i.not,rules:i.rules})}},t.prototype.getParameterizedNamedSql=function(e){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql},t.prototype.setParameterizedNamedSql=function(e){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var i=this.getRulesFromSql(l);this.setRules({condition:i.condition,not:i.not,rules:i.rules})}},t.prototype.setMongoQuery=function(e,t){this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})},t.prototype.getMongoQuery=function(e){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery},t.prototype.cloneRule=function(e,t,l){var i=this.getRule(e.replace(this.element.id+"_","")),n=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:i.label,field:i.field,type:i.type,operator:i.operator,value:i.value}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=n,n=!1},t.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var i=this.getGroup(t),n=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:i.condition,not:i.not,rules:i.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=n,n=!1},t.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},t.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},t.prototype.sqlParser=function(e,t){var l,i=0;do{l=e.slice(i),i+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},t.prototype.parseSqlStrings=function(e,t){var l,i=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"];var n;n=t?[this.l10n.getConstant("In").toUpperCase(),this.l10n.getConstant("NotIn").toUpperCase(),this.l10n.getConstant("Like").toUpperCase(),this.l10n.getConstant("NotLike").toUpperCase(),this.l10n.getConstant("Between").toUpperCase(),this.l10n.getConstant("NotBetween").toUpperCase(),this.l10n.getConstant("IsNull").toUpperCase(),this.l10n.getConstant("IsNotNull").toUpperCase(),this.l10n.getConstant("IsEmpty").toUpperCase(),this.l10n.getConstant("IsNotEmpty").toUpperCase()]:["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"];for(var o,r,s,a=0,u=i.length;a<u;a++)if(o=/^\w+$/.test(i[a])?"\\b":"",r=new RegExp("^("+i[a]+")"+o,"ig"),r.exec(e))return this.parser.push(["Operators",i[a].toLowerCase()]),i[a].length;var d=this.parser[this.parser.length-1];if(!d||d&&"Literal"!==d[0])for(var a=0,u=l.length;a<u;a++)if(o=/^\w+$/.test(l[a])?"\\b":"",r=new RegExp("^("+l[a]+")"+o,"ig"),r.exec(e))return this.parser.push(["Conditions",l[a].toLowerCase()]),l[a].length;for(var a=0,u=n.length;a<u;a++)if(o=/^\w+$/.test(n[a])?"\\b":"",r=new RegExp("^("+n[a]+")"+o,"ig"),r.exec(e))return this.parser.push(["SubOperators",n[a].toLowerCase()]),n[a].length;if(/^\(/.exec(e))return this.parser.push(["Left","("]),1;if(/^\)/.exec(e))return this.parser.push(["Right",")"]),1;if(/^(true|false)/.exec(e))return s=/^(true|false)/.exec(e)[0],this.parser.push(["String",s]),s.length;if(/^null/.exec(e))return s=/^null/.exec(e)[0],this.parser.push(["String",null]),s.length;if(/^`?([a-z_][a-z0-9_.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e))return s=/^`?([a-zåäö_][a-z0-9åäö_.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",s]),s.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(e))return s=/^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",s]),s.length+2;if(this.checkNumberLiteral(e,t))return s=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Literal",s]),s.length;if(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)){if(s=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],"("===s[s.length-2])for(var p=!1,c=s.length;c<e.length&&(s+=e[c],")"===e[c]&&(p=!0),!p||"'"!==e[c]);c++);else e[s.length]&&")"!==e[s.length]&&!this.checkCondition(e,s)&&(s=this.getSingleQuoteString(e,s));return this.parser.push(["String",s]),s.length}return/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(s=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",s]),s.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(s=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",s]),s.length):/^-?[0-9]+(\.[0-9]+)?/.exec(e)?(s=/^-?[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",s]),s.length):1},t.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},t.prototype.getSingleQuoteString=function(e,t){if(e[t.length]&&")"!==e[t.length]&&!this.checkCondition(e,t)&&","!==e[t.length]){var n=e.replace(t,"");if(l.i(i.isNullOrUndefined)(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(n))){t+=/^((?:[^\\']+?|\\.|'')*)'(?!')/.exec(n)[0],t=this.getSingleQuoteString(e,t)}}return t},t.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},t.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(\.[0-9]+)?/.exec(e)){var i=this.parser[this.parser.length-2],n=this.parser[this.parser.length-3];if("Left"===l[0]&&i&&"Conditions"===i[0])return!0;var o=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&n&&n[1].indexOf(o)<0)return!0}return!1},t.prototype.getOperator=function(e,t,l){var i={"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween","is empty":"isempty","is null":"isnull","is not null":"isnotnull","is not empty":"isnotempty"};if(l){for(var n=Object.keys(this.sqlOperators),o=0;o<n.length;o++)if(this.sqlOperators[n[o]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[o];return null}if(e){if(0===e.indexOf("%")&&"%"===e[e.length-1])return"not like"===t?"notcontains":"contains";if(0!==e.indexOf("%")&&e.indexOf("%")===e.length-1)return"not like"===t?"notstartswith":"startswith";if(0===e.indexOf("%")&&e.indexOf("%")!==e.length-1)return"not like"===t?"notendswith":"endswith"}else{if("not like"===t)return"notequal";if("like"===t)return"equal"}return i[""+t]},t.prototype.getTypeFromColumn=function(e){var t=this.getColumn(e.field);return l.i(i.isNullOrUndefined)(t)?null:t.type},t.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var i=e.split(this.separator),n=0;n<i.length;n++)t+=this.getLabelFromField(i,n+1),++l<i.length&&(t+=this.separator);return t}return this.getColumn(e).label},t.prototype.getLabelFromField=function(e,t){for(var l="",i=0,n=0;n<t;n++)l+=e[n],++i<t&&(l+=this.separator);return this.getColumn(l).label},t.prototype.processParser=function(e,t,l,i){for(var n,o,r,s,a,u,d,p,c,h,m=[],f=[],g=!1,v=0,y=e.length;v<y;v++)if("Literal"===e[v][0]){var b=this.getColumn(e[v][1]);if(r={label:b&&b.label?b.label:e[v][1],field:e[v][1]},"SubOperators"===e[v+1][0]){if(e[v+1][1].indexOf("null")>-1||e[v+1][1].indexOf("empty")>-1)r.operator=this.getOperator(" ",e[v+1][1],i),r.value=null,r.type=this.getTypeFromColumn(r);else{var C=e[v+3][1]?e[v+3][1].replace(/'/g,""):e[v+3][1];r.operator=this.getOperator(C,e[v+1][1],i)}for(h=e[v+1][1],v++,n=v+1,o=y,i&&"contains"===r.operator||"startswith"===r.operator||"endswith"===r.operator?h="like":i&&"notcontains"===r.operator||"notstartswith"===r.operator||"notendswith"===r.operator?h="not like":i&&(h=r.operator),n=v+1;n<o;n++)if(h.indexOf("between")<0&&"Left"===e[n][0])g=!0;else{if("Right"===e[n][0]&&g){v=n,g=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[n][0]){var S=e[n][1];e[n][1]&&"'"===e[n][1][0]&&(S=e[n][1].substring(1,e[n][1].length-1)),S=S?S.replace(/%/g,""):e[n][1],r.value=S,r.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[n][0]||"Left"===e[n][0])break;if("Number"===e[n][0])m.push(Number(e[n][1]));else if("String"===e[n][0]){var S=e[n][1];e[n][1]&&"'"===e[n][1][0]&&(S=e[n][1].substring(1,e[n][1].length-1)),f.push(S)}}else if("Number"===e[n][0])m.push(Number(e[n][1]));else if("String"===e[n][0]){var S=e[n][1];e[n][1]&&"'"===e[n][1][0]&&(S=e[n][1].substring(1,e[n][1].length-1)),f.push(S)}r.type=this.getTypeFromColumn(r)}h.indexOf("like")<0&&("Number"===e[n-1][0]?(r.value=m,r.type="number"):"String"===e[n-1][0]?(r.value=f,r.type="string"):h.indexOf("between")>-1&&"Conditions"===e[n-1][0]&&(0!==f.length?(r.value=f,r.type="string"):(r.value=m,r.type="number")),m=[],f=[],r.type=this.getTypeFromColumn(r))}else if("Operators"===e[v+1][0]){r.operator=this.getOperator(e[v+2][1],e[v+1][1],i);if("equal"==r.operator&&"String"===e[v+2][0]&&"''"===e[v+2][1]?(r.operator="isempty",!0):"notequal"==r.operator&&"String"===e[v+2][0]&&"''"===e[v+2][1]&&(r.operator="isnotempty",!0),"Number"===e[v+2][0])r.type="number",r.value=Number(e[v+2][1]);else{r.type="string";var S=e[v+2][1];S&&"'"===S[0]&&(S=S.substring(1,S.length-1)),r.value=S}r.type=this.getTypeFromColumn(r)}t.rules.push(r)}else{if("Left"===e[v][0]){if("Left"!==e[0][0]&&("not"===e[v-1][1]||i&&this.l10n.getConstant("NOT").toLowerCase()===e[v-1][1]))continue;for(this.parser=e.splice(v+1,y-(v+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},c=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&c++;return l.push(c),t.rules.push(s),s=this.processParser(this.parser,s,l,i),t}if("Conditions"===e[v][0])"not"===e[v][1]||i&&this.l10n.getConstant("NOT").toLowerCase()===e[v][1]?t.not=!0:t.condition=e[v][1];else if("Right"===e[v][0]){for(this.parser=e.splice(v+1,y-(v+1)),l.pop(),t=this.rule,p=l.length,d=0;d<p;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,i)}}return t},t.prototype.getValueFromParser=function(e,t){var l,i="";for(l=t;l<e.length&&("String"===e[l][0]&&","!==e[l][1]&&", "!==e[l][1]);l++)""!==i&&(t+=1),null!==e[l][1]?i+=e[l][1]:i=null;return{value:i,idx:t}},t.prototype.groupClone=function(e){var t,l,i=e.closest(".e-rule-list").closest(".e-group-container");"string"==typeof e?(l=this.element.id+"_"+e,e=document.getElementById(l)):(t=e.id.replace(this.element.id+"_",""),l=i.id.replace(this.element.id+"_",""));var n=this.getGroup(t);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],l),this.groupIndex=-1},t.prototype.ruleClone=function(e){for(var t=l.i(i.closest)(e,".e-rule-container"),n=e.closest(".e-rule-list").closest(".e-group-container"),o=this.getRule(e),r=n.id.replace(this.element.id+"_",""),s=n.querySelectorAll(".e-rule-container"),a=0,u=s.length;a<u;a++)t.id===s[a].id&&(this.ruleIndex=a);this.addRules([{label:o.label,field:o.field,type:o.type,operator:o.operator,value:o.value}],r),this.ruleIndex=-1},t.prototype.ruleLock=function(e){var t=l.i(i.closest)(e,".e-rule-container"),n=this.getRule(t.id.replace(this.element.id+"_",""));t.classList.contains("e-disable")?(n.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==t.id}),t.classList.remove("e-disable"),this.disableRuleControls(e,t,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(n.isLocked=!0,this.lockItems.indexOf(t.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,t.id),t.classList.add("e-disable"),this.disableRuleControls(e,t,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},t.prototype.groupLock=function(e){var t=l.i(i.closest)(e,".e-group-container"),n=this.getGroup(t.id.replace(this.element.id+"_","")),o=t.id.indexOf("group0")>-1;if(t.classList.contains("e-disable")){if(o){var r={};r.condition=n.condition,r.not=n.not,r.isLocked=!1,this.setProperties({rule:r},!0)}else n.isLocked=!1;this.lockItems=this.lockItems.filter(function(e){return e!==t.id}),t.classList.remove("e-disable"),this.disableHeaderControls(e,t,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{if(o){var r={};r.condition=n.condition,r.not=n.not,r.isLocked=!0,this.setProperties({rule:r},!0)}else n.isLocked=!0;this.lockItems.indexOf(t.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,t.id),t.classList.add("e-disable"),this.disableHeaderControls(e,t,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},t.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var t=this.element.querySelector("#"+this.lockItems[e]),n=t.querySelector(".e-lock-rule-btn");t=l.i(i.closest)(n,".e-rule-container"),t.classList.contains("e-disable")||this.ruleLock(n)}else{var o=this.element.querySelector("#"+this.lockItems[e]),n=o.querySelector(".e-lock-grp-btn");o=l.i(i.closest)(n,".e-group-container"),o.classList.contains("e-disable")||this.groupLock(n)}}},t.prototype.disableHeaderControls=function(e,t,l){for(var i=t.querySelectorAll(".e-btngroup-and"),n=t.querySelectorAll(".e-btngroup-or"),o=t.querySelectorAll(".e-qb-toggle"),r=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),p=0;p<i.length;p++)l?(d[p]&&d[p].classList.contains("e-disable")&&d[p].classList.add("e-disable"),i[p].disabled=!0,n[p].disabled=!0,r[p].disabled=!0,o[p]&&(o[p].disabled=!0),s[p]&&(s[p].disabled=!0),u[p]&&(u[p].disabled=!0),i[p].parentElement.classList.add("e-disabled"),a[p]!==e&&(a[p].disabled=!0,a[p].children[0].classList.remove("e-unlock"),a[p].children[0].classList.add("e-lock"))):(d[p]&&d[p].classList.remove("e-disable"),i[p].disabled=!1,n[p].disabled=!1,r[p].disabled=!1,a[p].disabled=!1,o[p]&&(o[p].disabled=!1),s[p]&&(s[p].disabled=!1),u[p]&&(u[p].disabled=!1),i[p].parentElement.classList.remove("e-disabled"),a[p].children[0].classList.remove("e-lock"),a[p].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},t.prototype.disableRuleControls=function(e,t,n){for(var o=t.querySelectorAll(".e-control.e-dropdownlist"),r=t.querySelectorAll(".e-control.e-numerictextbox"),s=t.querySelectorAll(".e-control.e-textbox"),a=t.querySelectorAll(".e-control.e-datepicker"),u=t.querySelectorAll(".e-control.e-checkbox"),d=t.querySelectorAll(".e-control.e-radio"),p=t.querySelectorAll(".e-control.e-multiselect"),c=t.querySelectorAll(".e-rule-delete"),h=t.querySelectorAll(".e-lock-rule"),m=t.querySelectorAll(".e-clone-rule"),f=t.querySelectorAll(".e-rule-container"),g=0;g<c.length;g++)n?(f[g]&&f[g].classList.contains("e-disable")&&f[g].classList.add("e-disable"),c[g].disabled=!0,m[g]&&(m[g].disabled=!0),h[g]!==e&&(h[g].disabled=!0,h[g].children[0].classList.remove("e-unlock"),h[g].children[0].classList.add("e-lock"))):(f[g]&&f[g].classList.remove("e-disable"),m[g]&&(m[g].disabled=!1),c[g].disabled=!1,h[g].disabled=!1,h[g].children[0].classList.remove("e-lock"),h[g].children[0].classList.add("e-unlock"));for(var v,y,b,C,S,x,O,g=0;g<o.length;g++)v=l.i(i.getComponent)(o[g],"dropdownlist"),v.enabled=!n;for(var g=0;g<r.length;g++)y=l.i(i.getComponent)(r[g],"numerictextbox"),y.enabled=!n;for(var g=0;g<s.length;g++)b=l.i(i.getComponent)(s[g],"textbox"),b.enabled=!n;for(var g=0;g<a.length;g++)C=l.i(i.getComponent)(a[g],"datepicker"),C.enabled=!n;for(var g=0;g<u.length;g++)S=l.i(i.getComponent)(u[g],"checkbox"),S.disabled=!!n;for(var g=0;g<d.length;g++)x=l.i(i.getComponent)(d[g],"radio"),x.disabled=!!n;for(var g=0;g<p.length;g++)O=l.i(i.getComponent)(p[g],"multiselect"),O.enabled=!n},h([l.i(i.Event)()],t.prototype,"created",void 0),h([l.i(i.Event)()],t.prototype,"actionBegin",void 0),h([l.i(i.Event)()],t.prototype,"beforeChange",void 0),h([l.i(i.Event)()],t.prototype,"change",void 0),h([l.i(i.Event)()],t.prototype,"dataBound",void 0),h([l.i(i.Event)()],t.prototype,"ruleChange",void 0),h([l.i(i.Complex)({},v)],t.prototype,"showButtons",void 0),h([l.i(i.Property)(!1)],t.prototype,"summaryView",void 0),h([l.i(i.Property)(!1)],t.prototype,"allowValidation",void 0),h([l.i(i.Property)("Default")],t.prototype,"fieldMode",void 0),h([l.i(i.Property)([])],t.prototype,"columns",void 0),h([l.i(i.Property)(null)],t.prototype,"fieldModel",void 0),h([l.i(i.Property)(null)],t.prototype,"operatorModel",void 0),h([l.i(i.Property)(null)],t.prototype,"valueModel",void 0),h([l.i(i.Property)()],t.prototype,"headerTemplate",void 0),h([l.i(i.Property)("")],t.prototype,"cssClass",void 0),h([l.i(i.Property)([])],t.prototype,"dataSource",void 0),h([l.i(i.Property)("Horizontal")],t.prototype,"displayMode",void 0),h([l.i(i.Property)(!1)],t.prototype,"enablePersistence",void 0),h([l.i(i.Property)("Default")],t.prototype,"sortDirection",void 0),h([l.i(i.Property)(5)],t.prototype,"maxGroupCount",void 0),h([l.i(i.Property)("auto")],t.prototype,"height",void 0),h([l.i(i.Property)("auto")],t.prototype,"width",void 0),h([l.i(i.Property)(!1)],t.prototype,"matchCase",void 0),h([l.i(i.Property)(0)],t.prototype,"immediateModeDelay",void 0),h([l.i(i.Property)(!1)],t.prototype,"enableNotCondition",void 0),h([l.i(i.Property)(!1)],t.prototype,"readonly",void 0),h([l.i(i.Property)(!0)],t.prototype,"addRuleToNewGroups",void 0),h([l.i(i.Property)(!1)],t.prototype,"autoSelectField",void 0),h([l.i(i.Property)(!0)],t.prototype,"autoSelectOperator",void 0),h([l.i(i.Property)("")],t.prototype,"separator",void 0),h([l.i(i.Complex)({condition:"and",rules:[]},f)],t.prototype,"rule",void 0),t=h([i.NotifyPropertyChanges],t)}(i.Component);!function(){function e(){}}()},function(e,t,l){"use strict";l.d(t,"a",function(){return n});var i=l(0),n=(l.n(i),function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,i=0;return e.forEach(function(n){i++,t+="{",void 0!==n.rules&&("or"===n.condition?(t+=' "$or":[',t=l.convertMongoQuery(n.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(n.rules,t)+"]"));var o="string"===n.type&&"in"!==n.operator&&"notin"!==n.operator&&n.value&&""!==n.value.trim()?n.value.replace(/'/g,"\\"):"";"string"!==n.type||"in"!==n.operator&&"notin"!==n.operator||!n.value||1!==n.value.length||(o=n.value[0].replace(/'/g,"\\"));var r=n.field?n.field.substring(0):"";switch(n.operator){case"contains":t+='"'+r+'":{"$regex":"'+o+'"}';break;case"notcontains":t+='"'+r+'":{"$not":{"$regex":"'+n.value+'"}}';break;case"startswith":t+='"'+r+'":{"$regex":"^'+o+'"}';break;case"notstartswith":t+='"'+r+'":{"$not":{"$regex":"^'+n.value+'"}}';break;case"endswith":t+='"'+r+'":{"$regex":"'+o+'$"}';break;case"notendswith":t+='"'+r+'":{"$not":{"$regex":"'+n.value+'$"}}';break;case"isnull":t+='"'+r+'": null';break;case"isnotnull":t+='"'+r+'":{"$ne": null}';break;case"isempty":t+='"'+r+'": ""';break;case"isnotempty":t+='"'+r+'":{"$ne": ""}';break;case"equal":"string"===n.type?t+='"'+r+'":"'+o+'"':"date"===n.type?t+='"'+r+'":"'+n.value+'"':(n.type,t+='"'+r+'":'+n.value);break;case"notequal":"string"===n.type?t+='"'+r+'":{"$ne":"'+o+'"}':"date"===n.type?t+='"'+r+'":{"$ne":"'+n.value+'"}':t+='"'+r+'":{"$ne":'+n.value+"}";break;case"in":if("string"===n.type)if(n.value.length>1){var s=n.value.map(function(e,t){return t<n.value.length?'"'+e+'"':""}).toString();s=s.endsWith(",")?s.substring(0,s.length-1):s,t+='"'+r+'": { "$in": ['+s+"]}"}else t+='"'+r+'": { "$in": ["'+o+'"]}';else"number"===n.type&&(n.value.length>1?t+='"'+r+'": { "$in": ['+n.value.toString()+"]}":t+='"'+r+'": { "$in": ['+n.value+"]}");break;case"notin":if("string"===n.type)if(n.value.length>1){var s=n.value.map(function(e,t){return t<n.value.length?'"'+e+'"':""}).toString();s=s.endsWith(",")?s.substring(0,s.length-1):s,t+='"'+r+'": { "$nin": ['+s+"]}"}else t+='"'+r+'": { "$nin": ["'+o+'"]}';else"number"===n.type&&(n.value.length>1?t+='"'+r+'": { "$nin": ['+n.value.toString()+"]}":t+='"'+r+'": { "$nin": ['+n.value+"]}");break;case"greaterthan":"number"===n.type?t+='"'+r+'": { "$gt": '+n.value+"}":t+='"'+r+'": { "$gt": "'+n.value+'"}';break;case"greaterthanorequal":"number"===n.type?t+='"'+r+'": { "$gte": '+n.value+"}":t+='"'+r+'": { "$gte": "'+n.value+'"}';break;case"between":"number"===n.type?t+='"'+r+'": {"$gte":'+n.value[0]+', "$lte":'+n.value[1]+"}":t+='"'+r+'": {"$gte": "'+n.value[0]+'", "$lte": "'+n.value[1]+'"}';break;case"notbetween":"number"===n.type?t+='"$or":[{"'+r+'": {"$lt":'+n.value[0]+'}}, {"'+r+'": {"$gt":'+n.value[1]+"}}]":t+='"$or":[{"'+r+'": {"$lt": "'+n.value[0]+'"}}, {"'+r+'": {"$gt": "'+n.value[1]+'"}}]';break;case"lessthan":"number"===n.type?t+='"'+r+'": { "$lt": '+n.value+"}":t+='"'+r+'": { "$lt": "'+n.value+'"}';break;case"lessthanorequal":"number"===n.type?t+='"'+r+'": { "$lte": '+n.value+"}":t+='"'+r+'": { "$lte": "'+n.value+'"}'}t+="}",e.length!==i&&(t+=",")}),t},e.prototype.mongoParser=function(e,t,l){var i;Object.keys(e).indexOf("$and")>-1?(i=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(i=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(i,t.rules,l)},e.prototype.mongoRecursion=function(e,t,n){for(var o,r,s,a,u,d,p,c,h,m,f,g=0,v=e.length;g<v;g++){var y=[],b=[];if(d=Object.keys(e[g])[0],p=e[g][d],"$and"===d)c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},t.push(c),this.mongoRecursion(e[g][d],t[t.length-1].rules,n);else if("$or"===d){var C=void 0,S=[],x=[],O=[],k=[],w=[],q=[],N=[],E=[],R=[];Array.isArray(p)&&2===p.length&&(x=Object.keys(p),E=p[x[0]],R=p[x[1]],"object"==typeof E&&(S=Object.keys(E)[0],w=Object.keys(E[Object.keys(E)[0]]),O=w[0],k=Object.keys(R[Object.keys(R)[0]])[0],"$lt"===O&&"$gt"===k&&(o="notbetween",q=E[S][O],N=R[S][k],r="number"==typeof q?"number":"date",f=[q,N],h={field:S,label:S,value:f,operator:o,type:r},t.push(h),C=!0))),C||(c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},t.push(c),this.mongoRecursion(e[g][d],t[t.length-1].rules,n))}else{if(p=e[g][d],null===p&&(o="isnull"),"boolean"==typeof p&&(o="equal",r="boolean",f=p),"number"==typeof p)f=p,r="number",o="equal";else if("object"==typeof p&&null!==p){m=Object.keys(p);for(var I=0;I<m.length;I++)a=m[I],s=p[m[I]],"$ne"===a&&l.i(i.isNullOrUndefined)(s)&&(o="isnotnull",f=null),"$ne"===a&&"boolean"==typeof s&&(o="notequal",f=s,r="boolean"),m.length>=2&&m[I]?("object"==typeof s?(o="notbetween",d=Object.keys(s)[0],u=[Object.keys(s[d])[0]],y.push(s[d][u]),r="number"):(o="between",y.push(s)),"number"==typeof s&&(r="number")):"object"==typeof s&&null!==s?"$not"===a&&"$regex"===Object.keys(s)[0]?s.$regex.indexOf("^")>-1?(o="notstartswith",f=s.$regex.replace("^","")):s.$regex.indexOf("$")>-1?(o="notendswith",f=s.$regex.replace("$","")):(o="notcontains",f=s.$regex):(o="$in"===a?"in":"notin",b=s,r="number"==typeof s[0]?"number":"string"):"number"==typeof s&&(o=this.getOperatorFromMongoOperator(a),r="number",f=s),"string"==typeof s&&("$regex"===a&&(o="contains",f=s,r="string"),"$ne"===a&&(null!==s&&s.length>0&&isNaN(Date.parse(s))?(o="notequal",f=s):l.i(i.isNullOrUndefined)(s)?(o="isnotnull",f=s):""===s&&(o="isnotempty",f=s),r="string"),s.indexOf("^")>-1&&(o="startswith",f=s.replace("^",""),r="string"),s.indexOf("$")>-1&&"$not"!==a&&(o="endswith",f=s.replace("$",""),r="string"),isNaN(Date.parse(s))||(o=o||this.getOperatorFromMongoOperator(a),r="date",f=s))}else p&&"string"==typeof p&&!isNaN(Date.parse(p))?(o="equal",f=p,r="date"):"string"==typeof p&&""!==p&&"true"!==p&&"false"!==p?(o="equal",f=p,r="string"):"string"==typeof p&&""===p&&(o="isempty",f=p,r="string");h=y&&y.length>1?{field:d,label:d,value:y,operator:o,type:r}:b&&b.length>1?{field:d,label:d,value:b,operator:o,type:r}:{field:d,label:d,value:f,operator:o,type:r},t.push(h),o=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,i=t.split("?"),n=i[0],o=0;o<l.length;o++)n+="string"==typeof l[o]?"'"+l[o]+"'"+i[o+1]:l[o]+i[o+1];return n.length>=2&&"("===n[0]&&")"===n[n.length-1]&&(n=n.slice(1,-1)),n=n.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,i=t;return Object.keys(l).forEach(function(e){var t=l[e];e=":"+e,i=i.replace(e,"string"==typeof t?"'"+t+"'":String(t))}),i.length>=2&&"("===i[0]&&")"===i[i.length-1]&&(i=i.slice(1,-1)),i=i.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var t=l.i(i.extend)({},e,null,!0),n=this.updateRuleValue(t,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(t),n.ruleVal)},e.prototype.getNamedParameterSql=function(e){var t=l.i(i.extend)({},e,null,!0),n=this.updateRuleValue(t,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(t),n.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){var l=[],i={},n=[];return this.updateValue(e.rules,t,l,i,n)},e.prototype.updateValue=function(e,t,n,o,r){if(l.i(i.isNullOrUndefined)(e))return{ruleVal:n,namedRuleVal:o};for(var s=0;s<e.length;s++)if(e[s].rules){var a=this.updateValue(e[s].rules,t,n,o,r);n=a.ruleVal,o=a.namedRuleVal}else{var u=void 0;if(e[s].value instanceof Array)for(var d=0;d<e[s].value.length;d++)t&&(u=this.getNamedParameter(e[s].field,r)),l.i(i.isNullOrUndefined)(e[s].value[d])||("string"===e[s].type||e[s].type,t?o[u]=e[s].value[d]:n.push(e[s].value[d])),e[s].value[d]=t?":"+u:"?";else if(t&&(u=this.getNamedParameter(e[s].field,r)),e[s].operator.indexOf("null")<1&&("string"!==e[s].type||"string"===e[s].type&&(""!==e[s].value||0===e[s].value))){if("string"===e[s].type||"date"===e[s].type)if(e[s].operator.indexOf("empty")<1){var a=e[s].value.toString();switch(e[s].operator){case"startswith":case"notstartswith":a+="%";break;case"endswith":case"notendswith":a="%"+a;break;case"contains":case"notcontains":a="%"+a+"%"}t?o[u]=a:n.push(a)}else t?o[u]="":n.push(""),"isempty"===e[s].operator?e[s].operator="equal":e[s].operator="notequal";else l.i(i.isNullOrUndefined)(e[s].value)||(t?o[u]=e[s].value:n.push(e[s].value));e[s].value=t?":"+u:"?"}}return{ruleVal:n,namedRuleVal:o}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var i=t.length-1;i>=0;i--){var n=t[i];if(n.indexOf(e)>-1){var o=parseInt(n.split("_")[1],10)+1;l=e+"_"+o,t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}())},function(e,t){e.exports=l},function(e,t){e.exports=i},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=r},function(e,t){e.exports=s}])});