@syncfusion/ej2-querybuilder 24.1.46 → 24.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 : 24.1.46
3
+ * version : 24.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,i,l,n,r,o,s){return function(e){function t(l){if(i[l])return i[l].exports;var n=i[l]={i:l,l:!1,exports:{}};return e[l].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,l){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:l})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t,i){"use strict";var l=i(4);i.d(t,"a",function(){return l.a}),i.d(t,"b",function(){return l.b}),i.d(t,"c",function(){return l.c}),i.d(t,"d",function(){return l.d}),i.d(t,"e",function(){return l.e})},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l=i(2);i.d(t,"Columns",function(){return l.a}),i.d(t,"Rule",function(){return l.b}),i.d(t,"Value",function(){return l.c}),i.d(t,"ShowButtons",function(){return l.d}),i.d(t,"QueryBuilder",function(){return l.e})},function(e,t,i){"use strict";i.d(t,"a",function(){return m}),i.d(t,"b",function(){return f}),i.d(t,"c",function(){return g}),i.d(t,"d",function(){return v}),i.d(t,"e",function(){return y});var l=i(0),n=(i.n(l),i(5)),r=(i.n(n),i(1)),o=(i.n(r),i(7)),s=(i.n(o),i(8)),a=(i.n(s),i(6)),u=(i.n(a),i(10)),d=(i.n(u),i(9)),p=(i.n(d),this&&this.__extends||function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function l(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(l.prototype=i.prototype,new l)}}()),h=this&&this.__assign||function(){return h=Object.assign||function(e){for(var t,i=1,l=arguments.length;i<l;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},h.apply(this,arguments)},c=this&&this.__decorate||function(e,t,i,l){var n,r=arguments.length,o=r<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,i):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,l);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o},m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(null)],t.prototype,"field",void 0),c([i.i(l.Property)(null)],t.prototype,"label",void 0),c([i.i(l.Property)(null)],t.prototype,"type",void 0),c([i.i(l.Property)(null)],t.prototype,"values",void 0),c([i.i(l.Property)(null)],t.prototype,"operators",void 0),c([i.i(l.Property)()],t.prototype,"ruleTemplate",void 0),c([i.i(l.Property)(null)],t.prototype,"template",void 0),c([i.i(l.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],t.prototype,"validation",void 0),c([i.i(l.Property)(null)],t.prototype,"format",void 0),c([i.i(l.Property)(null)],t.prototype,"step",void 0),c([i.i(l.Property)(null)],t.prototype,"value",void 0),c([i.i(l.Property)(null)],t.prototype,"category",void 0),c([i.i(l.Property)(null)],t.prototype,"columns",void 0),t}(l.ChildProperty),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(null)],t.prototype,"condition",void 0),c([i.i(l.Collection)([],t)],t.prototype,"rules",void 0),c([i.i(l.Property)(null)],t.prototype,"field",void 0),c([i.i(l.Property)(null)],t.prototype,"label",void 0),c([i.i(l.Property)(null)],t.prototype,"type",void 0),c([i.i(l.Property)(null)],t.prototype,"operator",void 0),c([i.i(l.Property)(null)],t.prototype,"value",void 0),c([i.i(l.Property)(!1)],t.prototype,"not",void 0),t}(l.ChildProperty),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(null)],t.prototype,"numericTextBoxModel",void 0),c([i.i(l.Property)(null)],t.prototype,"multiSelectModel",void 0),c([i.i(l.Property)(null)],t.prototype,"datePickerModel",void 0),c([i.i(l.Property)(null)],t.prototype,"textBoxModel",void 0),c([i.i(l.Property)(null)],t.prototype,"radioButtonModel",void 0),t}(l.ChildProperty),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(!0)],t.prototype,"ruleDelete",void 0),c([i.i(l.Property)(!0)],t.prototype,"groupInsert",void 0),c([i.i(l.Property)(!0)],t.prototype,"groupDelete",void 0),t}(l.ChildProperty),y=function(e){function t(t,i){var l=e.call(this,t,i)||this;return l.isReadonly=!0,l.fields={text:"label",value:"field"},l.updatedRule={not:!1,condition:"and"},l.isLocale=!1,l.isRefreshed=!1,l.isNotified=!1,l.isAddSuccess=!1,l.isNotValueChange=!1,l.isFieldChange=!1,l.isFieldClose=!1,l.isDestroy=!1,l.isGetNestedData=!1,l.isCustomOprCols=[],r.MultiSelect.Inject(r.CheckBoxSelection),l}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,r=t.length;n<r;n++)t[n].className.indexOf("e-tooltip")>-1?i.i(l.getComponent)(t[n],"tooltip").destroy():t[n].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(t[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var o=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"}});o.appendChild(s).appendChild(a),this.element.appendChild(o),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&i.i(l.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.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=[],i=[],l=void 0,n=!1,r=!1,o=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&&(o=this.dataColl[0][a[u].field],l=typeof o,"string"===l?r=!isNaN(Date.parse(o)):"object"===l&&(r=o instanceof Date&&!isNaN(o.getTime()),l="string"),a[u].type=l,r=!1),l="string"),a[u].validation||(a[u].validation=s),a[u].category?n=!0:a[u].category=this.l10n.getConstant("OtherFields"),i.indexOf(a[u].category)<0&&i.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&&(i.length>1||i[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++)o=this.dataColl[0][e[u]],l=typeof o,"string"===l?r=!isNaN(Date.parse(o)):"object"!==l||Object.keys(o).length||(r=o instanceof Date&&!isNaN(o.getTime()),l="string"),t[u]={field:e[u],label:e[u],type:r?"date":l,validation:s},r=!1,t[u].operators=this.customOperators[t[u].type+"Operator"],"object"===l&&this.updateSubFields(o,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 i=0;i<e.length;i++)""!==this.separator&&e[i].field.indexOf(this.separator)<0&&(e[i].field=t?t+this.separator+e[i].field:e[i].field),e[i].operators?this.updateCustomOperator(e[i]):e[i].type&&"object"!==e[i].type&&(e[i].operators=this.customOperators[e[i].type+"Operator"]),e[i].columns&&(e[i].type="object",this.updateSubFieldsFromColumns(e[i].columns,e[i].field))},t.prototype.updateSubFields=function(e,t,i){var l;t.columns=[];var n,r,o,s,a=Object.keys(e);i=i||this.dataColl[0];for(var u=0,d=a.length;u<d;u++){var p=t.field.split(".");s=i?i[p[p.length-1]][a[u]]:this.dataColl[0][t.field][a[u]];var h=i[t.field.split(this.separator)[t.field.split(this.separator).length-1]];o=typeof s,n=t.field+this.separator+a[u],r=a[u],o="object"!==o||isNaN(Date.parse(s))?o:"date",l={field:n,label:r,type:o},"object"!==o&&(l.operators=this.customOperators[o+"Operator"]),t.columns.push(l),"object"===o&&this.updateSubFields(s,l,h)}},t.prototype.updateCustomOperator=function(e,t){if(e.operators){this.isLocale||"initial"!==t||i.i(l.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=this,r=0;r<e.operators.length;r++)!function(t){var i=Object.keys(e.operators[t]).indexOf("sqlOperator");if(i>-1){var l=e.operators[t],r=Object.keys(l),o=r.map(function(e){return l[""+e]}).join(",").split(","),s=r.indexOf("value");n.operators[o[s]]=o[i]}}(r)}},t.prototype.focusEventHandler=function(e){this.target=e.target},t.prototype.clickEventHandler=function(e){var t,n=this,r=e.target;this.isImportRules=!1;var o;if("SPAN"===r.tagName&&(r=r.parentElement),r.className.indexOf("e-collapse-rule")>-1){var s=new l.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"===r.tagName&&r.className.indexOf("e-qb-toggle")<0){if(r.className.indexOf("e-removerule")>-1)this.actionButton=r,this.deleteRule(r);else if(r.className.indexOf("e-deletegroup")>-1)this.actionButton=r,this.deleteGroup(i.i(l.closest)(r,".e-group-container"));else if(r.className.indexOf("e-edit-rule")>-1){var s=new l.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=i.i(l.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"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1||r.className.indexOf("e-qb-toggle")>-1){var h=i.i(l.closest)(r,".e-group-container");if(!this.headerTemplate){var c=r.getAttribute("for"),m=void 0;c&&(m=document.getElementById(c).getAttribute("value")),o=h.id.replace(this.element.id+"_","");var f=this.getGroup(o),g=void 0;if(this.enableNotCondition)if(r.className.indexOf("e-qb-toggle")>-1){var v=h.getElementsByClassName("e-qb-toggle")[0];v.className.indexOf("e-active-toggle")>-1?(i.i(l.removeClass)([v],"e-active-toggle"),g=!1):(i.i(l.addClass)([v],"e-active-toggle"),g=!0),m=f.condition}else g=f.not;t={groupID:o,cancel:!1,type:"condition",value:m.toLowerCase()},this.enableNotCondition&&(t={groupID:o,cancel:!1,type:"condition",value:m.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(t,r):this.trigger("beforeChange",t,function(e){n.beforeSuccessCallBack(e,r)}),this.target=r}},t.prototype.beforeSuccessCallBack=function(e,t){if(!e.cancel){var n=i.i(l.closest)(t,".e-group-container"),r=n.id.replace(this.element.id+"_",""),o=this.getValidRules(this.rule),s=this.getParentGroup(n);s.condition=e.value,this.enableNotCondition&&(s.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:s.condition}),this.filterRules(o,this.getValidRules(this.rule),"condition")}},t.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||i.i(l.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?i.i(l.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):i.i(l.removeClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&i.i(l.addClass)([t.element.querySelector("li").parentElement],"e-rtl")):i.i(l.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(i.i(l.closest)(e,".e-group-container"),{}):t.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,i.i(l.closest)(e,".e-group-container"),"",!0)},t.prototype.appendRuleElem=function(e,t,n,r,o,s){var a,u,d,p=e.querySelector(".e-rule-list");if("change"===n?a=i.i(l.select)("#"+r,e):(a=this.createElement("div",{attrs:{class:"e-rule-container"}}),a.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),p.appendChild(a),this.ruleIdCounter++),t&&t.ruleTemplate&&s){d={requestType:"template-initialize",ruleID:a.id,action:o,fields:this.fields,rule:s},this.trigger("actionBegin",d),this.ruleTemplateFn=this.templateParser(t.ruleTemplate);var h=this.element.id+t.field,c=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)c=this.ruleTemplateFn(d,this,a.id,h)[0],u=c,u.className+=" e-rule-field",a.appendChild(u);else if(this.isAngular){var m=this.ruleTemplateFn(d,this,a.id,h);c=3===m[0].nodeType?m[1]:m[0],u=c,u.className+=" e-rule-field",a.appendChild(u)}else this.isVue3?(c=this.ruleTemplateFn(d,this,"Template",h),u=c,i.i(l.append)(u,a),a.children[a.children.length-1].className+=" e-rule-field"):(c=this.ruleTemplateFn(d,this,"Template",h)[0],u=c,u.className+=" e-rule-field",a.appendChild(u))}else u=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),a.appendChild(u);return t&&t.ruleTemplate&&s&&this.renderReactTemplates(),a},t.prototype.addRuleElement=function(e,t,i,l,n,r){var o=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,i,l,n,r)):this.trigger("beforeChange",s,function(s){o.addRuleSuccessCallBack(s,e,t,i,l,n,r)})}},t.prototype.addRuleSuccessCallBack=function(e,t,n,o,s,a,u){var d,p,c,m,f=this.element.className.indexOf("e-device")>-1?"250px":"200px",g=n&&n.field?this.getColumn(n.field):o||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 C={requestType:"template-create",action:"insert-rule",ruleID:m.id,fields:this.fields,rule:y};this.trigger("actionBegin",C)}else{m=this.appendRuleElem(t,g,s,a,"field"),m.querySelector(".e-filter-input").setAttribute("id",m.id+"_filterkey");var b=m.querySelector("button");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?(b.textContent=this.l10n.getConstant("Remove"),i.i(l.addClass)([b],"e-flat"),i.i(l.addClass)([b],"e-primary")):(i.i(l.addClass)([b],"e-round"),i.i(l.addClass)([b],"e-icon-btn"),b.setAttribute("title",this.l10n.getConstant("DeleteRule")),b=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),m.querySelector("button").appendChild(b))}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 S=void 0,x=void 0;x=this.separator&&n.field?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):n.field,S={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?x:null,open:this.popupOpen.bind(this,!0)},this.fieldModel&&(S=h({},S,this.fieldModel)),c=new r.DropDownList(S),c.appendTo("#"+m.id+"_filterkey");var O=void 0;O=this.separator&&n.field?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):c.value,this.selectedColumn=c.getDataByValue(O),Object.keys(n).length&&this.changeRule(n,{element:c.element,itemData:this.selectedColumn})}else{var S=void 0,x=(this.isImportRules,n.field);this.dummyDropdownTreeDs=i.i(l.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),S={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:i.i(l.isNullOrUndefined)(x)?null:[x],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt"},this.fieldModel&&(S=h({},S,this.fieldModel));var w=new r.DropDownTree(S);if(w.appendTo("#"+m.id+"_filterkey"),!i.i(l.isNullOrUndefined)(w.value)){var N=this.getLabelFromColumn(w.value[0]);w.element.value=N}var O=i.i(l.isNullOrUndefined)(n.field)?w.value:this.GetRootColumnName(n.field);this.selectedColumn=this.getColumn(O),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,r,o){var s,a,u,d=0;if(r){for(s=i.i(l.select)("#"+o,e),a=i.i(l.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,d++;u.rules[d]=t}else{a=i.i(l.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=t.custom;Object.keys(t).length?(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)):(p&&(n.custom=p),u.rules.push(n))}this.disableRuleCondition(e,u)},t.prototype.changeRuleTemplate=function(e,t){var n=this.selectedColumn.operators;if(!e.ruleTemplate){var r=i.i(l.closest)(t,".e-group-container"),o=i.i(l.closest)(t,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&(i.i(l.detach)(t.closest('[id="'+o+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([o])),e){var s={field:e.field,label:e.label,operator:n[0].value,value:""};this.addRuleElement(r,s,e,"change",o,!0)}}},t.prototype.renderToolTip=function(e){var t=new d.Tooltip({content:this.l10n.getConstant("ValidationMessage"),position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()}});t.appendTo(e),t.open(e)},t.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation){var n=["isnull","isnotnull","isempty","isnotempty"],r=void 0,o=void 0,s=void 0,a=void 0,u=[],d=void 0,p=void 0,h=void 0,c=void 0,m=void 0,f=this.element.querySelectorAll(".e-rule-container");for(r=0,o=f.length;r<o;r++){var g=void 0;if(d=i.i(l.closest)(f[r],".e-group-container"),m=this.getParentGroup(d),p=0,a=c=f[r],"DropdownTree"===this.fieldMode?(e=i.i(l.getComponent)(f[r].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(h=i.i(l.getComponent)(f[r].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&h.value&&(this.selectedColumn=h.getDataByValue(h.value),g=!i.i(l.isNullOrUndefined)(h.index)&&this.selectedColumn.validation),s=c.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;a&&null!==a.previousElementSibling;)a=a.previousElementSibling,p++;if(s=c.querySelector(".e-rule-operator .e-control"),m.rules[p].operator||(s.parentElement.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&&i.i(l.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=c.querySelectorAll(".e-rule-value .e-control");t=!1;for(var y=0,C=v.length;y<C;y++){var b=v[y],S=void 0;b.parentElement.className.indexOf("e-searcher")>-1?(S=i.i(l.closest)(b,".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(h&&h.element&&i.i(l.isNullOrUndefined)(h.index)||e&&e.element&&(i.i(l.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,r=e.groupElement.querySelector(".e-rule-list").children,o=e.groupElement,s=r.length,a=0;for(n=0;n<s;n++)t=r[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=i.i(l.closest)(o,".e-rule-list");return e.groupElement=u?i.i(l.closest)(u,".e-group-container"):o,e.level=this.levelColl[e.groupElement.id].slice(),e},t.prototype.groupTemplate=function(){var e,t,i,l,n,r=this.createElement("div",{attrs:{class:"e-group-container"}}),o=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 r.appendChild(o),s.appendChild(a),r.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),i=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),e.appendChild(i),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),e.appendChild(t),i=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),e.appendChild(i),o.appendChild(e),l=this.createElement("div",{attrs:{class:"e-group-action"}}),n=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),l.appendChild(n),o.appendChild(l)),r},t.prototype.ruleTemplate=function(){var e,t,n=this.createElement("div"),r=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}});var o=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(o),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),t=this.showButtons.ruleDelete||i.i(l.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 s=this.createElement("button",{attrs:{type:"button",class:t}});return e.appendChild(s),r.appendChild(e),n.appendChild(r),n},t.prototype.addGroupElement=function(e,t,i,l,n,r,o){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,i,l,n,r,o)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,i,l,n,r,o)})},t.prototype.addGroupSuccess=function(e,t,r,o,s,a,d,p){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var h=r,c=void 0,m="";m=h.className.indexOf("e-group-container")<0?h.querySelector(".e-group-container")&&h.querySelector(".e-group-container").id:h.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,o,p,m),this.groupIdCounter=0):this.headerTemplateFn(f,a,o,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"),C=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),C.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(t){var b=void 0;b=this.showButtons.groupDelete||i.i(l.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",c=this.createElement("button",{attrs:{type:"button",class:b}});new n.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(c),c.setAttribute("title",this.l10n.getConstant("DeleteGroup")),i.i(l.rippleEffect)(c,{selector:".deletegroup"}),this.headerTemplate||f.querySelector(".e-group-action").appendChild(c);for(var S=h.querySelector(".e-rule-list"),x=S.children,O=0,w=0,N=x.length;w<N;w++)x[w].className.indexOf("e-group-container")>-1&&(O+=1);S.appendChild(f);var E=this.levelColl[h.id].slice(0);E.push(O),this.levelColl[f.id]=E,this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],h.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,s&&this.addRuleElement(f,{}))}else h.appendChild(f),this.levelColl[f.id]=[0];if(this.enableNotCondition&&!this.headerTemplate){var q=f.querySelector(".e-qb-toggle");new n.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"}).appendTo(q),f.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&i.i(l.addClass)([q],"e-active-toggle")}if(this.updatedRule=null,this.headerTemplate){var R={requestType:"header-template-create",ruleID:f.id,condition:o,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",R)}else{var D=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,D),select:this.selectBtn.bind(this,D)}).appendTo(D),D.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules){var T=h.id.replace(this.element.id+"_",""),I=f.id.replace(this.element.id+"_","");this.trigger("change",{groupID:T,type:"insertGroup",childGroupID:I})}}},t.prototype.headerTemplateFn=function(e,t,n,r,o){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(r,!0),groupID:o},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),i.i(l.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 r=i.i(l.closest)(t,".e-group-container"),o=this.getParentGroup(r),s=i.i(l.closest)(t,".e-rule-container"),a=0;if("not"===n)return void(o.not=e);if("condition"===n)return void(o.condition=e);for(;s&&null!==s.previousElementSibling;)s=s.previousElementSibling,a++;var u=o.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 h=0;h<e.length;h++)e[h]&&e[h]instanceof Date&&(e[h]=this.intl.formatDate(e[h],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 r,o=i.i(l.closest)(e,".e-group-container"),s=this.getParentGroup(o),a=i.i(l.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 h=this.getValidRules(this.rule);this.selectedColumn&&(p=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,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":c=d.operator,d.operator=t,m.indexOf(d.operator)>-1?d.value=[]:m.indexOf(c)>-1&&(d.value="");break;case"value":d.value=t}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(h,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var f=i.i(l.closest)(e,".e-rule-container");this.destroyControls(f,!0),i.i(l.detach)(f.querySelector(".e-rule-field"));var g=this.appendRuleElem(i.i(l.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};r={groupID:o.id.replace(this.element.id+"_",""),ruleID:f.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",v),this.trigger("change",r)}},t.prototype.changeValue=function(e,t){var n,r=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 o,s=i.i(l.closest)(n,".e-group-container"),a=i.i(l.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,o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),o&&(this.selectedColumn=o.getDataByValue(o.value)),(o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0])));var h,c;if(n.className.indexOf("e-radio")>-1)if(c=parseInt(n.id.split("valuekey")[1],0),"Default"===this.fieldMode?(o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value)):(o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),this.selectedColumn.values)h=this.selectedColumn.values[c];else{var m=[!0,!1];h=m[c]}else h=n.className.indexOf("e-multiselect")>-1?i.i(l.getComponent)(n,"multiselect").value:t.value;"input"===t.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){r.filterValue(u,d,h,e,n)},this.immediateModeDelay)):this.filterValue(u,d,h,e,n)},t.prototype.filterValue=function(e,t,i,l,n){var r=this,o={groupID:e,ruleID:t,value:i,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(o,n,l,e,t):this.trigger("beforeChange",o,function(i){r.changeValueSuccessCallBack(i,n,l,e,t)})},t.prototype.changeValueSuccessCallBack=function(e,t,i,l,n){e.cancel||(this.updateRules(t,e.value,i),this.isImportRules||this.trigger("change",{groupID:l,ruleID:n,value:e.value,cancel:!1,type:"value"}))},t.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var t=i.i(l.getComponent)(e,"dropdownlist"),n=t.popupObj.element.querySelector(".e-active"),r=t.getItemData();t.value=r.value;var o={element:t.element,value:r.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:r,event:null,e:null};t.previousValue!==t.value&&this.changeField(o),this.isFieldChange=!1}},t.prototype.changeField=function(e){if(e.isInteracted){if(i.i(l.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var t=i.i(l.closest)(e.element,".e-rule-filter")||i.i(l.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 r=t.querySelector(".e-dropdowntree.e-control"),o=i.i(l.getComponent)(r,"dropdowntree");if(!n)return;if("object"===n.type){if(o.value=e.oldValue,o.dataBind(),i.i(l.isNullOrUndefined)(e.oldValue))r.value="";else{var s=this.getLabelFromColumn(e.oldValue[0]);r.value=s}return}if(!i.i(l.isNullOrUndefined)(e.value[0])){o.value=e.value[0],o.dataBind();var s=this.getLabelFromColumn(e.value[0]);r.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=i.i(l.closest)(e.element,".e-group-container"),u=this.getParentGroup(a),d=i.i(l.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==i.i(l.getComponent)(t.element,"dropdowntree").value)return}var n={},r=i.i(l.closest)(t.element,".e-rule-filter");r=r||i.i(l.closest)(t.element,".e-rule-sub-filter");var o=i.i(l.getComponent)(t.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!=r&&(o=i.i(l.getComponent)(t.element,"dropdowntree"));var s=i.i(l.closest)(t.element,".e-group-container"),a=s.id.replace(this.element.id+"_","");this.changeFilter(r,o,a,e,n,t)},t.prototype.changeFilter=function(e,t,n,r,o,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=i.i(l.closest)(e,".e-rule-container"),p=d.id.replace(this.element.id+"_",""),h={groupID:n,ruleID:p,selectedField:"DropdownTree"===this.fieldMode?t.value[0]:t.value,cancel:!1,type:"field"};this.isImportRules?this.fieldChangeSuccess(h,o,e,r,s):this.trigger("beforeChange",h,function(t){a.fieldChangeSuccess(t,o,e,r,s)})}else{var c=i.i(l.closest)(s.element,".e-rule-operator");this.changeOperator(e,c,t,n,r,o,s)}},t.prototype.changeOperator=function(e,t,n,r,o,s,a){var u,d,p,h=this;t?(u=i.i(l.closest)(t,".e-rule-container"),d=u.id.replace(this.element.id+"_",""),p={groupID:r,ruleID:d,selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(p,e,s,o,a):this.trigger("beforeChange",p,function(t){h.operatorChangeSuccess(t,e,s,o,a)})):this.changeRuleValues(e,o,s,a)},t.prototype.fieldChangeSuccess=function(e,t,n,r,o){for(var s=i.i(l.closest)(n,".e-rule-container"),a=i.i(l.closest)(o.element,".e-rule-operator"),u=i.i(l.closest)(o.element,".e-group-container"),d=u.id.replace(this.element.id+"_",""),p=i.i(l.getComponent)(o.element,"dropdownlist"),h=s.querySelectorAll(".e-tooltip.e-input-group"),c=0;c<h.length;c++)i.i(l.getComponent)(h[c],"tooltip").destroy();if(e.cancel)this.changeOperator(n,a,p,d,r,t,o);else{if(i.i(l.isNullOrUndefined)(this.selectedColumn))return;if(t.type=this.selectedColumn.type,s.querySelector(".e-template")&&(r.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(t.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,r,t,o);else this.destroySubFields(n),this.changeOperator(n,a,p,d,r,t,o)}},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,o){var s=!1,a=i.i(l.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=i.i(l.closest)(u,".e-rule-container").id,p=this.createElement("input",{attrs:{type:"text",id:d+"_subfilterkey"+this.subFilterCounter}});u.appendChild(p);var c,m=this.element.className.indexOf("e-device")>-1?"250px":"200px",f=Object.keys(this.selectedColumn.columns[0]);c={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:f.length>5?m:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(c=h({},c,this.fieldModel));var g=new r.DropDownList(c);if(g.appendTo("#"+d+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(t.field)===this.GetRootColumnName(this.previousColumn.field))for(var v=this.selectedColumn.columns,y=0;y<v.length;y++)if(t.field===v[y].field||t.field.indexOf(v[y].field)>-1){g.value=v[y].field,this.selectedColumn=v[y],s=!0;break}this.subFilterCounter++,this.subFieldElem=p,o.itemData=o.itemData,!s&&this.selectedColumn.columns&&(!s&&this.isImportRules&&(g.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(u,t,n,o)},t.prototype.operatorChangeSuccess=function(e,t,n,r,o){if(!e.cancel){var s=i.i(l.closest)(o.element,".e-rule-operator"),a=s.nextElementSibling,u=i.i(l.getComponent)(o.element,"dropdownlist"),d=r.operator?r.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=r.type,(n.operator.toLowerCase().indexOf("in")<0||d.indexOf("in")<0)&&(r.value=[])):"object"==typeof r.value&&null!=r.value&&(r.value=r.value.length>0?r.value[0]:"number"===r.type?0:""),o.previousItemData){var h=o.previousItemData.value.toString().toLowerCase();(h.indexOf("between")>-1||(h.indexOf("in")>-1||h.indexOf("null")>-1||h.indexOf("empty")>-1)&&h.indexOf("contains")<0)&&(t=s.previousElementSibling,n.type=r.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 c=s.parentElement.querySelector(".e-rule-value"),m=c.querySelector(".e-tooltip.e-input-group");m&&i.i(l.getComponent)(m,"tooltip").destroy(),i.i(l.removeClass)([c],"e-show"),i.i(l.addClass)([c],"e-hide")}a&&this.getColumn(r.field).template&&(t=s.previousElementSibling),this.changeRuleValues(t,r,n,o)}},t.prototype.changeRuleValues=function(e,t,n,o){var s,a,u,d,p=i.i(l.closest)(o.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),i.i(l.addClass)([p],"e-operator"),p.childElementCount){a=i.i(l.getComponent)(p.querySelector(".e-dropdownlist"),"dropdownlist"),n.operator=a.value;var c=void 0;c="DropdownTree"===this.fieldMode?i.i(l.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):i.i(l.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),n.type="DropdownTree"===this.fieldMode?this.getColumn(c.value[0]).type:this.getColumn(c.value).type;var m=o.itemData;this.renderValues(p,m,o.previousItemData,!0,t,n,o.element)}else{var f=i.i(l.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:o.itemData&&(u=this.customOperators[this.selectedColumn.type+"Operator"]);var g=this.element.className.indexOf("e-device")>-1?"250px":"200px",v=u[0].value;v=t&&""!==t.operator?t.operator:v;var y=void 0;y={dataSource:u,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:u.length>5?g:"auto",change:this.changeField.bind(this),index:0,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(y=h({},y,this.operatorModel));var C=new r.DropDownList(y);C.appendTo("#"+f+"_operatorkey"),n.operator=t&&""!==t.operator&&!i.i(l.isNullOrUndefined)(t.operator)?t.operator:u[0].value,this.isImportRules&&(n.type=this.selectedColumn.type,n.operator=t.operator),this.renderValues(p,this.selectedColumn,o.previousItemData,!1,t,n,o.element)}this.isImportRules||this.updateRules(o.element,o.item)},t.prototype.popupOpen=function(e,t){this.enableRtl&&i.i(l.addClass)([t.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},t.prototype.destroyControls=function(e,t){for(var n=t?e:e.nextElementSibling,r=n.querySelectorAll("input.e-control"),o=n.querySelectorAll("div.e-control:not(.e-handle)"),s=this.columns,a=0,u=r.length;a<u;a++){if(r[a].classList.contains("e-textbox"))i.i(l.getComponent)(r[a],"textbox").destroy(),i.i(l.detach)(i.i(l.select)("input#"+r[a].id,n));else if(r[a].classList.contains("e-dropdownlist"))this.allowValidation&&r[a].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(r[a].parentElement,"tooltip").destroy(),i.i(l.getComponent)(r[a],"dropdownlist").destroy();else if(r[a].classList.contains("e-radio"))i.i(l.getComponent)(r[a],"radio").destroy();else if(r[a].classList.contains("e-numerictextbox"))i.i(l.getComponent)(r[a],"numerictextbox").destroy(),i.i(l.detach)(i.i(l.select)("input#"+r[a].id,n));else if(r[a].classList.contains("e-datepicker"))i.i(l.getComponent)(r[a],"datepicker").destroy();else if(r[a].classList.contains("e-multiselect"))i.i(l.getComponent)(r[a],"multiselect").destroy();else if(r[a].className.indexOf("e-template")>-1)for(var d=r[a].className,p=0,h=s.length;p<h;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],r[a].id);break}document.getElementById(r[a].id)&&i.i(l.detach)(r[a])}for(var a=0,u=o.length;a<u;a++){if(o[a].className.indexOf("e-template")>-1)for(var d=o[a].className,p=0,h=s.length;p<h;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],o[a].id);break}i.i(l.detach)(o[a])}for(var c=n.querySelectorAll(".e-template:not(.e-control)"),a=0,u=c.length;a<u;a++)i.i(l.detach)(c[a])},t.prototype.templateDestroy=function(e,t){var n;if("string"!=typeof e.template||void 0===e.template.destroy){n=e.template;var r=n.destroy;if(n.destroy){var o=void 0;document.getElementById(t)&&(o=i.i(l.closest)(document.getElementById(t),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof r?(r=i.i(l.getValue)(r,window))({field:e.field,elementId:t,elements:o}):n.destroy({field:e.field,elementId:t,elements:o})}}},t.prototype.getValues=function(e){var t,i={},l=[],n=[];this.separator.length>0&&(n=e.split(this.separator));var r=this.dataColl;if(this.dataColl[1])for(var o=0,s=r.length;o<s;o++){var a={};if(n.length>1)for(var u=r[o],d=void 0,p=0,h=n.length;p<h;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=r[o][""+e],Number(r[o][""+e])===r[o][""+e]&&r[o][""+e]%1!=0&&(t=r[o][""+e].toString());t in i||(i[""+t]=1,n.length>1?this.createNestedObject(a,n,t):a[""+e]=t,l.push(a))}return l},t.prototype.createNestedObject=function(e,t,i){for(var l,n=t.length-1,r=0;r<n;++r)l=t[r],l in e||(e[""+l]={}),e=e[""+l];e[t[n]]=i},t.prototype.getDistinctValues=function(e,t){for(var i={},l=[],n=[],r="",o=t.indexOf(this.separator),s=this,a=0,u=e.length;a<u;a++)!function(a,u){0===o?r=e[a][""+t]:(n=t.split(s.separator),n.forEach(function(t){r=r?r[""+t]:e[a][""+t]})),Number(e[a][""+t])===e[a][""+t]&&e[a][""+t]%1!=0&&(r=e[a][""+t].toString());var d={};r in i||(i[""+r]=1,0===o?d[""+t]=r:d[n[n.length-1]]=r,l.push(d))}(a);return l},t.prototype.renderMultiSelect=function(e,t,i,l,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=this.selectedRule.field;if(0!==this.selectedRule.field.indexOf(this.separator)&&"DropdownTree"!==this.fieldMode){var p=this.selectedRule.field.split(this.separator);d=p[p.length-1]}var c;c={dataSource:u?n:a?s:this.dataManager,query:new o.Query([e.field]),fields:{text:d,value:d},placeholder:this.l10n.getConstant("SelectValue"),value:l,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,i),close:this.closePopup.bind(this,i),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+i),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(c=h({},c,this.valueModel.multiSelectModel));var m=new r.MultiSelect(c);m.appendTo("#"+t+"_valuekey"+i),this.updateRules(m.element,l,0)},t.prototype.multiSelectOpen=function(e,t){if(this.dataSource instanceof o.DataManager){var n=document.getElementById(e),r=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist");this.selectedColumn=r.getDataByValue(r.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,r=this,s=new o.Deferred,a=this.dataManager.executeQuery((new o.Query).select(t)),u=i.i(l.getComponent)(e,"multiselect");u.hideSpinner(),this.createSpinner(i.i(l.closest)(e,".e-multi-select-wrapper").parentElement),i.i(d.showSpinner)(i.i(l.closest)(e,".e-multi-select-wrapper").parentElement),a.then(function(o){n=o.actual&&o.actual.result?o.actual.result:o.result,r.dataColl=i.i(l.extend)(r.dataColl,n,[],!0),u.dataSource=r.getDistinctValues(r.dataColl,t),r.isGetNestedData=!0,i.i(d.hideSpinner)(i.i(l.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),i.i(d.createSpinner)({target:t,width:l.Browser.isDevice?"16px":"14px"})},t.prototype.closePopup=function(e,t){var n=document.getElementById(t.popup.element.id.replace("_popup",""));if(n){var r=i.i(l.getComponent)(n,"multiselect").value;this.updateRules(n,r,e)}},t.prototype.processTemplate=function(e,t,n,r){var o=i.i(l.closest)(e,".e-rule-container"),s=o.querySelectorAll(".e-template"),a=o.querySelector(".e-rule-filter .e-filter-input"),u="DropdownTree"===this.fieldMode?i.i(l.getComponent)(a,"dropdowntree"):i.i(l.getComponent)(o.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:o.id,operator:r.operator,field:d.field,requestType:"value-template-create"};this.trigger("actionBegin",p)}else{var h=t.template;"string"==typeof h.write?i.i(l.getValue)(h.write,window)({elements:s.length>1?s:s[0],values:n.value,operator:r.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:r.operator,field:d.field,dataSource:d.values})}},t.prototype.getItemData=function(e){var t=i.i(l.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist");return"DropdownTree"===this.fieldMode&&(t=i.i(l.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 r=this.getItemData(e);if(i.i(l.isNullOrUndefined)(r.value))return n?t?[0,0]:0:t?[]:"";if(t){if(!(r.value instanceof Array))return[r.value]}else if(r.value instanceof Array)return r.value[0];return r.value},t.prototype.renderStringValue=function(e,t,i,l,n){var r,o,a=this.getItemData(e),u="string"==typeof a.template;if(o=this.isImportRules||this.isPublic||u?t.value:this.setDefaultValue(e,!1,!1),"in"!==i&&"notin"!==i||!this.dataColl.length&&!a.values){"in"!==i&&"notin"!==i||(r=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),o=r.join(","));var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,l)},this.valueModel&&this.valueModel.textBoxModel&&(d=h({},d,this.valueModel.textBoxModel));var p=new s.TextBox(d);p.appendTo("#"+e+"_valuekey"+l),p.value=o,p.dataBind()}else r=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,l,r,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,i,l,n,r,o){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.isPublic||u?t.value:this.setDefaultValue(e,!1,!0);if("in"!==i&&"notin"!==i||!this.dataColl.length&&!a.values)if("in"===i||"notin"===i){d=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1);var p=d.join(","),c=void 0;c={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,l)},this.valueModel&&this.valueModel.textBoxModel&&(c=h({},c,this.valueModel.textBoxModel));var m=new s.TextBox(c);m.appendTo("#"+e+"_valuekey"+l),m.value=p,m.dataBind()}else{r=a;var f=r.validation&&r.validation.min?r.validation.min:0,g=r.validation&&r.validation.max?r.validation.max:Number.MAX_VALUE,v=r.format?r.format:"n";o>1&&t&&(d=t.value[l]?t.value[l]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[l]:d,format:v,min:f,max:g,width:"100%",step:r.step?r.step:1,change:this.changeValue.bind(this,l)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=h({},y,this.valueModel.numericTextBoxModel));var C=new s.NumericTextBox(y);C.appendTo("#"+e+"_valuekey"+l),C.element.setAttribute("aria-label",r.label+" Value")}else d=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,l,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 i=[],l=e.split(",");if("string"===t)return l;for(var n=0,r=l.length;n<r;n++)i.push(Number(l[n]));return i},t.prototype.parseDate=function(e,t){var n,r;if(t){var o=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(t),r=o(e),i.i(l.isNullOrUndefined)(r)&&(r=this.intl.parseDate(e,n))}else r=new Date(e);return r},t.prototype.renderControls=function(e,t,n,r,o){if(i.i(l.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),i.i(l.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),i.i(l.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),t.template&&(t.template.create||o))this.processTemplate(e,t,n,r);else{var s;s="boolean"===r.type?this.selectedColumn.values?this.selectedColumn.values.length:2:r.operator&&r.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var u=i.i(l.closest)(e,".e-rule-container").id,d=void 0,p=r.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?i.i(l.addClass)([d],"e-custom-value"):i.i(l.removeClass)([d],"e-custom-value");for(var c=0;c<s;c++)switch(r.type){case"string":this.renderStringValue(u,n,p,c,d);break;case"number":this.renderNumberValue(u,n,p,c,d,t,s);break;case"boolean":this.processBoolValues(t,n,u,c);break;case"date":var m=new Date,f=void 0,g=void 0,v=t.format,y=void 0,C=void 0,b=this.l10n.getConstant("SelectValue"),S="string"==typeof t.template;if(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[c]:n.value,m=this.parseDate(f,g.format)):m=n.value),v){var x=this.getFormat(v);x.skeleton?(C={locale:this.getLocale(),value:m,placeholder:b,format:x,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(C=h({},C,this.valueModel.datePickerModel)),y=new a.DatePicker(C)):(C={value:m,locale:this.getLocale(),placeholder:b,format:x.format,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(C=h({},C,this.valueModel.datePickerModel)),y=new a.DatePicker(C))}else C={locale:this.getLocale(),value:m,placeholder:b,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(C=h({},C,this.valueModel.datePickerModel)),y=new a.DatePicker(C);if(y.appendTo("#"+u+"_valuekey"+c),!n.value){var O=document.getElementById(u+"_valuekey"+c);this.updateRules(O,m,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},t.prototype.processBoolValues=function(e,t,r,o){var s,a,u=!1;i.i(l.isNullOrUndefined)(t.type)&&e&&(t.type=e.type);var d;if(e.values){var p=e.values;"boolean"!==t.type||i.i(l.isNullOrUndefined)(t.value)?e.value?u=p[o].toLowerCase()===e.value.toString().toLowerCase():0===o&&(u=!0):u=p[o].toLowerCase()===t.value.toString().toLowerCase(),a=s=d=p[o]}else{var p=[!0,!1];"boolean"!==t.type||i.i(l.isNullOrUndefined)(t.value)?e.value?u=p[o].toString().toLowerCase()===e.value.toString().toLowerCase():0===o&&(u=!0):u=p[o].toString().toLowerCase()===t.value.toString().toLowerCase(),s=p[o].toString(),a=p[o],d=this.l10n.getConstant(["True","False"][o])}var c;c={label:d,name:r+"default",checked:u,value:s,change:this.changeValue.bind(this,o)},this.valueModel&&this.valueModel.radioButtonModel&&(c=h({},c,this.valueModel.radioButtonModel));var m=new n.RadioButton(c);m.appendTo("#"+r+"_valuekey"+o),u&&this.updateRules(m.element,a,0)},t.prototype.getOperatorIndex=function(e,t){var i,l=e.dataSource,n=l.length;for(i=0;i<n;i++)if(t.operator===e.dataSource[i].value)return i;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,r,o,s,a){var u=e.previousElementSibling,d=u.getElementsByTagName("input")[0],p="DropdownTree"===this.fieldMode?i.i(l.getComponent)(d,"dropdowntree"):i.i(l.getComponent)(d,"dropdownlist"),h="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]):this.getColumn(p.value);if(this.selectedRule=h,r){var c=i.i(l.getComponent)(e.querySelector("input"),"dropdownlist");t=a.id.indexOf("operator")>-1?t:this.selectedRule,t.operators&&(c.value=null,c.dataBind(),c.dataSource=t.operators,c.index=this.getOperatorIndex(c,o),c.value=s.operator=c.dataSource[c.index].value,c.dataBind())}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&&(i.i(l.removeClass)([g],"e-show"),i.i(l.addClass)([g],"e-hide"))}else{var v=i.i(l.closest)(e,".e-rule-container").id;if(n=this.getPreviousItemData(n,h),n&&void 0===n.template?n.columns&&(n=this.getColumn(o.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(o.field)),n&&n.template){this.templateDestroy(n,v+"_valuekey0");var y=i.i(l.select)("#"+v+"_valuekey0",e.nextElementSibling);y&&!y.classList.contains("e-control")&&i.i(l.detach)(i.i(l.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(r&&(this.validateValue(o,i.i(l.closest)(e,".e-rule-container")),this.destroyControls(e)),h&&(t.template=h.template),t.template&&(i.i(l.addClass)([e.nextElementSibling],"e-template-value"),t.template=h.template,f=this.setColumnTemplate(t,v,h.field,t.value||m,e,o)),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{i.i(l.removeClass)([e.nextElementSibling],"e-template-value");var C=1;C="boolean"===s.type?this.selectedColumn.values?this.selectedColumn.values.length:2:m&&m.toLowerCase().indexOf("between")>-1?2:1;for(var b=0;b<C;b++){var S=this.createElement("input",{attrs:{type:"text",id:v+"_valuekey"+b}});e.nextElementSibling.appendChild(S)}}this.renderControls(e,t,o,s,f)}},t.prototype.setColumnTemplate=function(e,t,n,r,o,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:r,rule:s,renderTemplate:!0},this.trigger("actionBegin",a,function(i){d=u.actionBeginSuccessCallBack(i,e,t,n,o)}),d;var p=void 0,h=e.template;if((p="string"==typeof h.create?i.i(l.getValue)(h.create,window)({field:n,operator:r}):h.create({field:n,operator:r}))instanceof Element)p.id=t+"_valuekey0",i.i(l.addClass)([p],"e-template"),o.nextElementSibling.appendChild(p),n.indexOf(" ")<0&&i.i(l.addClass)([p],"e-"+n);else if(p instanceof Array){i.i(l.addClass)(p,"e-template");for(var c=0,m=p.length;c<m;c++)p[c].id=t+"_valuekey"+c,o.nextElementSibling.appendChild(p[c])}return i.i(l.addClass)([o.nextElementSibling],"e-template-value"),!0}return!0},t.prototype.actionBeginSuccessCallBack=function(e,t,n,r,o){if(e.renderTemplate){var s=void 0;this.columnTemplateFn=this.templateParser((t.template,t.template));var a=this.element.id+r;if(this.isReact)s=this.columnTemplateFn(e,this,n,a)[0],o.nextElementSibling.appendChild(s);else if(this.isAngular){var u=this.columnTemplateFn(e,this,n,a);s=3===u[0].nodeType?u[1]:u[0],o.nextElementSibling.appendChild(s)}else this.isVue3?(s=this.columnTemplateFn(e,this,"Template",a),i.i(l.append)(s,o.nextElementSibling)):(s=this.columnTemplateFn(e,this,"Template",a)[0],o.nextElementSibling.appendChild(s));return i.i(l.addClass)([o.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 r=e.className.split(" e-")[n],o=parseInt(e.id.slice(-1),2);switch(r){case"checkbox":var s=i.i(l.getComponent)(e,r).value;t.value=""!==s?s:void 0;break;case"textbox":case"dropdownlist":t.value=i.i(l.getComponent)(e,r).value;break;case"radio":var a=i.i(l.getComponent)(e,r);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[o]=i.i(l.getComponent)(e,r).value):t.value=i.i(l.getComponent)(e,r).value;break;case"datepicker":var u=this.getColumn(t.field),d=this.getFormat(u.format),p=i.i(l.getComponent)(e,r).value;t.operator.indexOf("between")>-1?("string"==typeof t.value&&(t.value=[]),t.value[o]=this.intl.formatDate(p,d)):i.i(l.isNullOrUndefined)(d.format)&&p?t.value=this.intl.formatDate(p):t.value=p?this.intl.formatDate(p,d):p;break;case"multiselect":t.value=i.i(l.getComponent)(e,r).value}},t.prototype.updateRules=function(e,t,n,r){for(var o,s,a=i.i(l.closest)(e,".e-group-container"),u=this.getParentGroup(a),d=i.i(l.closest)(e,".e-rule-container"),p=0,h=a.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);d&&null!==d.previousElementSibling;)d=d.previousElementSibling,p++;var m=u.rules[p].operator?u.rules[p].operator.toString():"";d=i.i(l.closest)(e,".e-rule-container");var f=d.id.replace(this.element.id+"_","");if(i.i(l.closest)(e,".e-rule-filter")||i.i(l.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),o="DropdownTree"===this.fieldMode?i.i(l.getComponent)(e,"dropdowntree"):i.i(l.getComponent)(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(o.value[0]):this.getColumn(o.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=i.i(l.closest)(e,".e-rule-filter");v=v||i.i(l.closest)(e,".e-rule-sub-filter");var y=v.nextElementSibling.querySelector("input.e-control");y=y||v.nextElementSibling.nextElementSibling.querySelector("input.e-control"),m=i.i(l.getComponent)(y,"dropdownlist").value.toString(),u.rules[p].operator=m;var C=v.nextElementSibling.nextElementSibling,b=C.querySelectorAll("input.e-control");b.length<1&&(b=C.querySelectorAll("div.e-control")),b.length<1&&(b=C.querySelectorAll(".e-template")),s={groupID:h,ruleID:f,value:u.rules[p].field,type:"field"};for(var S=0;S<b.length;S++)m.indexOf("null")>-1||m.indexOf("empty")>-1?u.rules[p].value=null:this.updateValues(b[S],u.rules[p]);this.isImportRules||this.trigger("change",s),this.allowValidation&&u.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if(i.i(l.closest)(e,".e-rule-operator")){o=i.i(l.getComponent)(e,"dropdownlist"),u.rules[p].operator=o.value.toString();var x=d.querySelectorAll(".e-rule-value input.e-control");s={groupID:h,ruleID:f,value:o.value,type:"operator"},this.allowValidation&&u.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.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(c,this.getValidRules(this.rule),"operator")}else i.i(l.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,t,u,p,a,d,n),r||this.filterRules(c,this.getValidRules(this.rule),"value"))},t.prototype.filterRules=function(e,t,i){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:i}))},t.prototype.ruleValueUpdate=function(e,t,i,l,n,r,o){var s,a,u=["in","between","notin","notbetween"];if(i.rules[l].operator&&(a=i.rules[l].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===i.rules[l].type&&!this.isNotified){for(var d=[],p=t,h=0,c=p.length;h<c;h++)"string"==typeof p[h]&&d.push(parseFloat(p[h]));d.length&&(t=d)}if(this.isNotified)i.rules[l].value=t,s={groupID:n.id,ruleID:r.id,value:i.rules[l].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?i.rules[l].value[o]=t:i.rules[l].value=t;else if(e.className.indexOf("e-radio")>-1)i.rules[l].value=t;else if(e.className.indexOf("e-multiselect")>-1)i.rules[l].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(i.rules[l].type,i.rules[l].value=this.processValueString(t,i.rules[l].type)):i.rules[l].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 i.rules[l].value&&(i.rules[l].value=[]),i.rules[l].value[o]=this.intl.formatDate(t,m)):i.rules[l].value=this.intl.formatDate(t,m))}this.validateValue(i,r,l)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof i.rules[l].value&&(i.rules[l].value=[]),i.rules[l].value[o]=t):i.rules[l].value=t},t.prototype.validateValue=function(e,t,n){i.i(l.isNullOrUndefined)(n)||(e=e.rules[n]);var r="object"==typeof e.value;if(this.allowValidation&&(i.i(l.isNullOrUndefined)(n)||(r?e.value.length>0:e.value))){var o=t.querySelectorAll(".e-rule-value .e-control");o.length>0&&(o[0].className.indexOf("e-tooltip")>-1?i.i(l.getComponent)(o[0],"tooltip").destroy():o[0].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(o[0].parentElement,"tooltip").destroy(),o[1]&&o[1].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(o[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,i){var l=t.rules,n=[];if(!i){for(var r=0,o=l.length;r<o;r++)t=l[r],t.rules&&n.push(t);return n[e]}return t},t.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var t,n,r,o;for(e.prototype.destroy.call(this),t=this.element.querySelectorAll(".e-addrulegroup"),r=t.length,n=0;n<r;n++)i.i(l.getComponent)(t[n],"dropdown-btn").destroy(),i.i(l.detach)(t[n]);for(o=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<o.length;n++)i.i(l.getComponent)(o[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)"),r=t.length,n=0;n<r;n++)i.i(l.getComponent)(t[n],"dropdownlist")?i.i(l.getComponent)(t[n],"dropdownlist").destroy():i.i(l.getComponent)(t[n],"dropdowntree").destroy(),i.i(l.detach)(t[n]);for(o=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<o.length;n++)i.i(l.getComponent)(o[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)"),r=t.length,n=0;n<r;n++)i.i(l.getComponent)(t[n],"dropdownlist")&&(i.i(l.getComponent)(t[n],"dropdownlist").destroy(),i.i(l.detach)(t[n]));for(o=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<o.length;n++)i.i(l.getComponent)(o[n],"tooltip").destroy();this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate(),i.i(l.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 i=0,l=e.length;i<l;i++)this.addRuleElement(document.getElementById(t),e[i]);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 i=document.getElementById(t),l=this.getParentGroup(i);if(e.length){this.isPublic=!0;for(var n=0,r=e.length;n<r;n++)this.updatedRule={condition:e[n].condition,not:e[n].not},this.importRules(e[n],i,!1,e[n].not);this.isPublic=!1}else{var o="and",s=!1;this.updatedRule&&(o=this.updatedRule.condition,s=this.updatedRule.not),this.enableNotCondition?l.rules.push({condition:o,not:s,rules:[]}):l.rules.push({condition:o,rules:[]})}this.headerTemplate||this.disableRuleCondition(i,l)}},t.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&i.i(l.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableRtl&&i.i(l.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),l.Browser.isDevice||"Vertical"===this.displayMode?(l.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),i.i(l.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),i.i(l.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=i.i(l.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,r=0;r<t.length;r++)n=t.item(r),i.i(l.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"}),i=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),l=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),i.textContent=this.l10n.getConstant("Edit"),l.appendChild(i),e.appendChild(l),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 o.DataManager(this.columns).executeLocal((new o.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new o.DataManager(this.columns).executeLocal((new o.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?i.i(l.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):i.i(l.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 i.i(l.isNullOrUndefined)(e.not)?this.enableNotCondition&&!i.i(l.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),r=0,o=n;r<o.length;r++){switch(o[r]){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":e.showButtons.ruleDelete?i.i(l.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):i.i(l.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"),e.showButtons.groupDelete?i.i(l.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):i.i(l.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide");break;case"cssClass":t.cssClass&&i.i(l.removeClass)([this.element],t.cssClass.split(" ")),e.cssClass&&i.i(l.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?(i.i(l.addClass)([this.element],"e-rtl"),this.notGroupRtl()):(i.i(l.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||i.i(l.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 l.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||i.i(l.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",EndsWith:"Ends With",Contains:"Contains",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"},this.l10n=new l.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new l.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:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{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")}],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 o.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new o.Query).take(1))):(this.dataManager=new o.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new o.Query),this.initControl()),this.renderComplete()},t.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?i.i(l.compile)(document.querySelector(e).innerHTML.trim()):i.i(l.compile)(e)}catch(t){return i.i(l.compile)(e)}},t.prototype.executeDataManager=function(e){var t=this,i=this.dataManager.executeQuery(e),l=new o.Deferred;i.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){l.reject(e)})},t.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},t.prototype.wireEvents=function(){var e=this.getWrapper();l.EventHandler.add(e,"click",this.clickEventHandler,this),l.EventHandler.add(e,"focusout",this.focusEventHandler,this),l.EventHandler.add(e,"focusin",this.focusEventHandler,this),l.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this)},t.prototype.unWireEvents=function(){var e=this.getWrapper();l.EventHandler.remove(e,"click",this.clickEventHandler),l.EventHandler.remove(e,"focusout",this.focusEventHandler),l.EventHandler.remove(e,"focusin",this.focusEventHandler),l.EventHandler.remove(this.element,"keydown",this.keyBoardHandler)},t.prototype.getParentGroup=function(e,t){for(var i=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],l=t?i.length-1:i.length,n=this.rule,r=0;r<l;r++)n=this.findGroupByIdx(i[r],n,0===r);return n},t.prototype.deleteGroup=function(e){var t,i=this,l=e;"string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t)):t=l.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){i.deleteGroupSuccessCallBack(t,e)})},t.prototype.deleteGroupSuccessCallBack=function(e,t){if(!e.cancel){var n=t,r=this.getParentGroup(n,!0),o=0,s=void 0,a=void 0,u=this.getValidRules(this.rule),d=n.nextElementSibling,p=n.previousElementSibling,h=n.querySelectorAll(".e-group-container"),c=n.querySelectorAll(".e-tooltip");for(a=c.length,s=0;s<a;s++)i.i(l.getComponent)(c[s],"tooltip").destroy();for(s=0,a=h.length;s<a;s++)delete this.levelColl[h[s].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,o++;d&&d.className.indexOf("e-separate-rule")>-1&&(i.i(l.removeClass)([d],"e-separate-rule"),i.i(l.addClass)([d],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&i.i(l.addClass)([p],"e-prev-joined-rule"));var m=n.parentElement.parentElement.parentElement,f=[];if(this.isReact||this.isAngular){var g=r.rules[o],v=t.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var y=0;y<g.rules.length;y++){var C=this.getColumn(g.rules[y].field),b=v[y].querySelector(".e-template-value");C&&(C.ruleTemplate||this.isPlatformTemplate(C)&&b)&&f.push(v[y].id)}}i.i(l.detach)(t),this.headerTemplate&&this.clearQBTemplate([t.id]),f.length&&this.clearQBTemplate(f),r.rules.splice(o,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(m,r),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=i.i(l.closest)(e,".e-group-container"),r=n.id.replace(this.element.id+"_",""),o=i.i(l.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),s={groupID:r,ruleID:o,cancel:!1,type:"deleteRule"};this.isImportRules?this.deleteRuleSuccessCallBack(s,e):this.trigger("beforeChange",s,function(i){t.deleteRuleSuccessCallBack(i,e)})},t.prototype.deleteRuleSuccessCallBack=function(e,t){if(!e.cancel){var n=i.i(l.closest)(t,".e-group-container"),r=this.getParentGroup(n),o=i.i(l.closest)(t,".e-rule-container"),s=this.getValidRules(this.rule),a=o,u=o.nextElementSibling,d=o.previousElementSibling,p=0,h=o.querySelectorAll(".e-tooltip"),c=void 0,m=h.length;for(c=0;c<m;c++)i.i(l.getComponent)(h[c],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,p++;var f=this.getColumn(r.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&&i.i(l.removeClass)([u],"e-joined-rule"),(!u||u.className.indexOf("e-rule-container")<0)&&d&&i.i(l.removeClass)([d],"e-prev-joined-rule");var g=a.querySelector(".e-template-value");try{i.i(l.detach)(a)}catch(e){e=[];e.error="error"}f&&f.ruleTemplate&&this.clearQBTemplate([a.id]),f&&this.isPlatformTemplate(f)&&g&&this.clearQBTemplate([a.id]),r.rules.splice(p,1),r.rules[0]&&r.rules[0].rules||this.disableRuleCondition(n,r),this.isImportRules||this.trigger("change",e),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},t.prototype.setGroupRules=function(e,t){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),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 i=e.querySelector(".e-rule-list").childElementCount,l=e.querySelector(".e-btngroup-and"),n=e.querySelector(".e-btngroup-or");i>1?(l.disabled=!1,n.disabled=!1,(n.nextElementSibling.classList.contains("e-btn-disable")||l.nextElementSibling.classList.contains("e-btn-disable"))&&(n.nextElementSibling.classList.remove("e-btn-disable"),l.nextElementSibling.classList.remove("e-btn-disable")),t&&"or"===t.condition?n.checked=!0:l.checked=!0):(l.checked=!1,l.disabled=!0,n.checked=!1,n.disabled=!0,t&&(n.nextElementSibling.classList.add("e-btn-disable"),l.nextElementSibling.classList.add("e-btn-disable")))}},t.prototype.getValidRules=function(e){e||(e=this.getRules());var t=e.condition,n=e.not,r=i.i(l.extend)([],e.rules,[],!0);return this.getRuleCollection({condition:t,rules:r,not:n},!0)},t.prototype.getRuleCollection=function(e,t){if(i.i(l.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var r=e.rules.length,o=0;o<r;o++)n=e.rules[o],n=this.getRuleCollection(n,t),e.rules[o]=n,Object.keys(n).length<1&&t&&(e.rules.splice(o,1),o--,r--);var s=e.custom;if(e.field&&""!==e.field&&(i.i(l.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},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)i.i(l.isNullOrUndefined)(e.condition)&&i.i(l.isNullOrUndefined)(e.rules)?e={}:(e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},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=i.i(l.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,r=0;if(e instanceof HTMLElement?t=i.i(l.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,t=document.getElementById(n)),i.i(l.isNullOrUndefined)(t))return null;for(var o=i.i(l.closest)(t,".e-group-container"),s=this.getParentGroup(o);null!==t.previousElementSibling;)t=t.previousElementSibling,r++;return s.rules[r]},t.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=i.i(l.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,i,l=e.length;for(t=0;t<l;t++)i=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(i))},t.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=i.i(l.isNullOrUndefined)(e)?new o.Query:(new o.Query).where(e);return this.dataManager.executeQuery(t)},t.prototype.deleteRules=function(e){var t,i,l=e.length;for(t=0;t<l;t++)i=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(i))},t.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),i=[],l=0,n=Object.keys(this.columns);l<n.length;l++)i.push(this.columns[l].field);return e.rules.length?(new o.Query).select(i).where(t):(new o.Query).select(i)},t.prototype.getPredicate=function(e){var t,n,r,s,a=e.rules,u=!1,d=["notcontains","notstartswith","notendswith"];if(!a)return t;for(var p=0,h=a.length;p<h;p++){var c=Object.keys(a[p]);if(u=!1,c.indexOf("rules")>-1&&a[p].rules)(n=this.getPredicate(a[p]))&&(t=t?"and"===e.condition?t.and(n):t.or(n):n);else if(!i.i(l.isNullOrUndefined)(a[p].operator)&&!i.i(l.isNullOrUndefined)(a[p].operator.length)){var m=a[p].operator.toLowerCase(),f=!1,g=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===a[p].type&&(u=!this.matchCase),"date"===a[p].type&&g.indexOf(m)>-1&&(u=!0),s=this.getColumn(a[p].field),m.indexOf("null")>-1||m.indexOf("empty")>-1)a[p].value=null;else if("date"!==a[p].type||a[p].value instanceof Array)r=a[p].value;else{var v=this.getFormat(s.format);i.i(l.isNullOrUndefined)(a[p].value)?r=null:(r=this.getDate(a[p].value,v),g.indexOf(m)>-1&&!this.isTime(a[p].value)&&(f=!0))}if(0===p)if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contains")<0)t=f?this.datePredicate(a[p],r):this.arrayPredicate(a[p]);else{var y=r;""!==y&&d.indexOf(m)<0&&(t=new o.Predicate(a[p].field,a[p].operator,r,u))}else{if(d.indexOf(m)>-1)continue;if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contains")<0)t=f?this.datePredicate(a[p],r,t,e.condition):this.arrayPredicate(a[p],t,e.condition);else if("and"===e.condition){var y=r;t&&""!==y?t=t.and(a[p].field,a[p].operator,r,u):""!==y&&(t=new o.Predicate(a[p].field,a[p].operator,r,u))}else{var y=r;t&&""!==y?t=t.or(a[p].field,a[p].operator,r,u):""!==y&&(t=new o.Predicate(a[p].field,a[p].operator,r,u))}}}}return this.dataSource instanceof o.DataManager&&(i.i(l.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 i.i(l.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",l.cldrData)||(e="en"),e},t.prototype.getColumn=function(e,t){var i,l=this.columns;l=t||l;for(var n=0,r=l.length;n<r;n++){if(l[n].field===e){i=l[n];break}if(l[n].columns){if(i=this.getColumn(e,l[n].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&l[n].field===e.split(this.separator)[0]){i=l[n];break}}return i},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,i,l){var n,r=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":n=new o.Predicate(e.field,"greaterthanorequal",r),n=n.and(e.field,"lessthanorequal",s);break;case"notequal":n=new o.Predicate(e.field,"lessthan",r),n=n.or(e.field,"greaterthan",s);break;case"greaterthan":n=new o.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":n=new o.Predicate(e.field,"greaterthanorequal",r);break;case"lessthan":n=new o.Predicate(e.field,"lessthan",r);break;case"lessthanorequal":n=new o.Predicate(e.field,"lessthanorequal",s)}return n&&(i?"and"===l?i=i.and(n):"or"===l&&(i=i.or(n)):i=n),i},t.prototype.arrayPredicate=function(e,t,i){var l,n=e.value,r=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(r.indexOf("null")>-1||r.indexOf("empty")>-1)switch(r){case"isnull":l=new o.Predicate(e.field,"isnull",s);break;case"isnotnull":l=new o.Predicate(e.field,"isnotnull",s);break;case"isempty":l=new o.Predicate(e.field,"equal","");break;case"isnotempty":l=new o.Predicate(e.field,"notequal","")}if(!(r.indexOf("null")>-1||r.indexOf("empty")>-1))for(var d=0,p=n.length;d<p;d++)if(""!==n[d]||("in"===r||"notin"===r)&&"string"===a.type)if(0===d){var h="greaterthanorequal";switch(r){case"between":l="date"!==a.type?new o.Predicate(e.field,h,n[d]):new o.Predicate(e.field,h,n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null);break;case"notbetween":l="date"===a.type?new o.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 o.Predicate(e.field,"lessthan",n[d]);break;case"in":l=new o.Predicate(e.field,"equal",n[d]);break;case"notin":l=new o.Predicate(e.field,"notequal",n[d])}}else{switch(e.operator){case"between":l="date"===a.type?l.and(e.field,"lessthanorequal",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):l.and(e.field,"lessthanorequal",n[d]);break;case"notbetween":l="date"===a.type?l.or(e.field,"greaterthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):l.or(e.field,"greaterthan",n[d]);break;case"in":l=l.or(e.field,"equal",n[d]);break;case"notin":l=l.and(e.field,"notequal",n[d])}}return l&&(t?"and"===i?t=t.and(l):"or"===i&&(t=t.or(l)):t=l),t},t.prototype.getDate=function(e,t){var i=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&(i=new Date,i.setHours(parseInt(e.split(":")[0])),i.setMinutes(parseInt(e.split(":")[1])),e.split(":")[2]&&i.setSeconds(parseInt(e.split(":")[2]))),i},t.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},t.prototype.importRules=function(e,t,n,r,o){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&&o&&(t=this.renderGroup(e,e.condition,this.element,e.not,o)),this.enableNotCondition&&!this.headerTemplate){var u=t.querySelector(".e-qb-toggle");e.not?i.i(l.addClass)([u],"e-active-toggle"):i.i(l.removeClass)([u],"e-active-toggle")}}else t=this.renderGroup(e,e.condition,t,r);0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var d=e.rules;if(!i.i(l.isNullOrUndefined)(d))for(var p=0,h=d.length;p<h;p++){var c=Object.keys(d[p]);!i.i(l.isNullOrUndefined)(d[p].rules)&&c.indexOf("rules")>-1&&0!==d[p].rules.length?(t=this.renderGroup(d[p],d[p].condition,t,d[p].not),t=this.importRules(d[p],t,!0)):this.renderRule(d[p],t)}return t=i.i(l.closest)(t,".e-rule-list"),t&&(t=i.i(l.closest)(t,".e-group-container")),t},t.prototype.renderGroup=function(e,t,i,l,n){this.addGroupElement(!0,i,t,!1,l,n,e);var r=i.querySelectorAll(".e-group-container");return r[r.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"),o=0;o<t.length;o++)if(t[o].classList.contains("e-dropdownlist")){var u=i.i(l.getInstance)(t[o],r.DropDownList);u.readonly=this.isReadonly}else if(t[o].classList.contains("e-dropdowntree")){var d=i.i(l.getComponent)(t[o],"dropdowntree");d.readonly=this.isReadonly}else if(t[o].classList.contains("e-numerictextbox")){var p=i.i(l.getInstance)(t[o],s.NumericTextBox);p.readonly=this.isReadonly}else if(t[o].classList.contains("e-textbox")){var h=i.i(l.getInstance)(t[o],s.TextBox);h.readonly=this.isReadonly}else if(t[o].classList.contains("e-datepicker")){var c=i.i(l.getInstance)(t[o],a.DatePicker);c.readonly=this.isReadonly}else if(t[o].classList.contains("e-multiselect")){var m=i.i(l.getInstance)(t[o],r.MultiSelect);m.readonly=this.isReadonly}else if(t[o].classList.contains("e-radio")){var f=i.i(l.getInstance)(t[o],n.RadioButton);f.checked||(this.isReadonly?t[o].parentElement.style.display="none":t[o].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 C=[g,v,y],o=0;o<C.length;o++)C[o].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"),i=!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"),i=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),i?"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"),i=!1)})},t.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],i=0,l=t.length;i<l;i++)if(e.toLowerCase().indexOf(t[i])>-1)return!0;return!1},t.prototype.getSqlString=function(e,t,i,l){var n=!1;i||""===i?i+="(":(i="",n=!0);var r=e.condition;if(e.not){var o=void 0;n?(o=l?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (",i+=o):(o=l?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT (",i+=o)}if(e.rules)for(var s=0,a=e.rules.length;s<a;s++){if(e.rules[s].rules)i=this.getSqlString(e.rules[s],t,i,l);else{var u=e.rules[s],d="",p=l?this.sqlOperators[u.operator]:this.operators[u.operator];if(u.value instanceof Array)if(u.operator.toString().indexOf("between")>-1){var h=l?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==u.type||this.isDateFunction(u.value[0])?d+=u.value[0]+h+u.value[1]:d+='"'+u.value[0]+'"'+h+'"'+u.value[1]+'"'}else if("string"==typeof u.value[0]&&null!==u.value){d+='("'+u.value[0]+'"';for(var c=1,m=u.value.length;c<m;c++)d+=',"'+u.value[c]+'"';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?d+=u.value:d+='"'+u.value+'"';u.operator.toString().indexOf("null")>-1||u.operator.toString().indexOf("empty")>-1?(t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),i+=u.field+" "+p):(t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),i+=u.field+" "+p+" "+d),u.condition&&""!==u.condition&&(r=u.condition)}if(s!==a-1){var u=e.rules[s];(""===r||u&&""!==u.condition&&u.custom&&u.custom.isCustom)&&(r=u.condition),r=l?this.l10n.getConstant(r.toUpperCase()).toUpperCase():r.toUpperCase(),i+=" "+r+" "}}return n||(i+=")"),e.not&&(i+=")"),i},t.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var i=this.getRulesFromSql(e,t);this.setRules({condition:i.condition,not:i.not,rules:i.rules})},t.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var i=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:i.condition,not:i.not,rules:i.rules}:{condition:i.condition,rules:i.rules}},t.prototype.getSqlFromRules=function(e,t,i){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,i).replace(/"/g,"'")},t.prototype.sqlParser=function(e,t){var i,l=0;do{i=e.slice(l),l+=this.parseSqlStrings(i,t)}while(""!==i);return this.parser},t.prototype.parseSqlStrings=function(e,t){var i,l=["=","!=","<=",">=","<",">"];i=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 r,o,s,a=0,u=l.length;a<u;a++)if(r=/^\w+$/.test(l[a])?"\\b":"",o=new RegExp("^("+l[a]+")"+r,"ig"),o.exec(e))return this.parser.push(["Operators",l[a].toLowerCase()]),l[a].length;var d=this.parser[this.parser.length-1];if(!d||d&&"Literal"!==d[0])for(var a=0,u=i.length;a<u;a++)if(r=/^\w+$/.test(i[a])?"\\b":"",o=new RegExp("^("+i[a]+")"+r,"ig"),o.exec(e))return this.parser.push(["Conditions",i[a].toLowerCase()]),i[a].length;for(var a=0,u=n.length;a<u;a++)if(r=/^\w+$/.test(n[a])?"\\b":"",o=new RegExp("^("+n[a]+")"+r,"ig"),o.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,h=s.length;h<e.length&&(s+=e[h],")"===e[h]&&(p=!0),!p||"'"!==e[h]);h++);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],i=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&i&&i[1].indexOf("between")<0)},t.prototype.checkNumberLiteral=function(e,t){var i=this.parser[this.parser.length-1];if(!i)return!0;if(/^[0-9]+(\.[0-9]+)?/.exec(e)){var l=this.parser[this.parser.length-2],n=this.parser[this.parser.length-3];if("Left"===i[0]&&l&&"Conditions"===l[0])return!0;var r=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===i[0]&&n&&n[1].indexOf(r)<0)return!0}return!1},t.prototype.getOperator=function(e,t,i){var l={"=":"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(i){for(var n=Object.keys(this.sqlOperators),r=0;r<n.length;r++)if(this.sqlOperators[n[r]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"notcontains"===n[r]?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"notstartswith"===n[r]?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"notendswith"===n[r]?"notendswith":"endswith":n[r];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 l[""+t]},t.prototype.getTypeFromColumn=function(e){var t=this.getColumn(e.field);return i.i(l.isNullOrUndefined)(t)?null:t.type},t.prototype.getLabelFromColumn=function(e){var t="",i=0;if(""!==this.separator){for(var l=e.split(this.separator),n=0;n<l.length;n++)t+=this.getLabelFromField(l,n+1),++i<l.length&&(t+=this.separator);return t}return this.getColumn(e).label},t.prototype.getLabelFromField=function(e,t){for(var i="",l=0,n=0;n<t;n++)i+=e[n],++l<t&&(i+=this.separator);return this.getColumn(i).label},t.prototype.processParser=function(e,t,i,l){for(var n,r,o,s,a,u,d,p,h,c,m=[],f=[],g=!1,v=0,y=e.length;v<y;v++)if("Literal"===e[v][0]){var C=this.getColumn(e[v][1]);if(o={label:C&&C.label?C.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)o.operator=this.getOperator(" ",e[v+1][1],l),o.value=null,o.type=this.getTypeFromColumn(o);else{var b=e[v+3][1]?e[v+3][1].replace(/'/g,""):e[v+3][1];o.operator=this.getOperator(b,e[v+1][1],l)}for(c=e[v+1][1],v++,n=v+1,r=y,l&&"contains"===o.operator||"startswith"===o.operator||"endswith"===o.operator?c="like":l&&"notcontains"===o.operator||"notstartswith"===o.operator||"notendswith"===o.operator?c="not like":l&&(c=o.operator),n=v+1;n<r;n++)if(c.indexOf("between")<0&&"Left"===e[n][0])g=!0;else{if("Right"===e[n][0]&&g){v=n,g=!1;break}if(c.indexOf("null")>-1||c.indexOf("empty")>-1)break;if(c.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],o.value=S,o.type="string"}else if(c.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)}o.type=this.getTypeFromColumn(o)}c.indexOf("like")<0&&("Number"===e[n-1][0]?(o.value=m,o.type="number"):"String"===e[n-1][0]?(o.value=f,o.type="string"):c.indexOf("between")>-1&&"Conditions"===e[n-1][0]&&(0!==f.length?(o.value=f,o.type="string"):(o.value=m,o.type="number")),m=[],f=[],o.type=this.getTypeFromColumn(o))}else"Operators"===e[v+1][0]&&(o.operator=this.getOperator(e[v+2][1],e[v+1][1],l),"Number"===e[v+2][0]?(o.type="number",o.value=Number(e[v+2][1])):(o.type="string",o.value=e[v+2][1]?e[v+2][1].replace(/'/g,""):e[v+2][1]),o.type=this.getTypeFromColumn(o));t.rules.push(o)}else{if("Left"===e[v][0]){if("Left"!==e[0][0]&&("not"===e[v-1][1]||l&&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:[]},h=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&h++;return i.push(h),t.rules.push(s),s=this.processParser(this.parser,s,i,l),t}if("Conditions"===e[v][0])"not"===e[v][1]||l&&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)),i.pop(),t=this.rule,p=i.length,d=0;d<p;d++)t=this.findGroupByIdx(i[d],t,0===d);return this.processParser(this.parser,t,i,l)}}return t},c([i.i(l.Event)()],t.prototype,"created",void 0),c([i.i(l.Event)()],t.prototype,"actionBegin",void 0),c([i.i(l.Event)()],t.prototype,"beforeChange",void 0),c([i.i(l.Event)()],t.prototype,"change",void 0),c([i.i(l.Event)()],t.prototype,"dataBound",void 0),c([i.i(l.Event)()],t.prototype,"ruleChange",void 0),c([i.i(l.Property)({ruleDelete:!0,groupInsert:!0,groupDelete:!0})],t.prototype,"showButtons",void 0),c([i.i(l.Property)(!1)],t.prototype,"summaryView",void 0),c([i.i(l.Property)(!1)],t.prototype,"allowValidation",void 0),c([i.i(l.Property)("Default")],t.prototype,"fieldMode",void 0),c([i.i(l.Property)([])],t.prototype,"columns",void 0),c([i.i(l.Property)(null)],t.prototype,"fieldModel",void 0),c([i.i(l.Property)(null)],t.prototype,"operatorModel",void 0),c([i.i(l.Property)(null)],t.prototype,"valueModel",void 0),c([i.i(l.Property)()],t.prototype,"headerTemplate",void 0),c([i.i(l.Property)("")],t.prototype,"cssClass",void 0),c([i.i(l.Property)([])],t.prototype,"dataSource",void 0),c([i.i(l.Property)("Horizontal")],t.prototype,"displayMode",void 0),c([i.i(l.Property)(!1)],t.prototype,"enablePersistence",void 0),c([i.i(l.Property)("Default")],t.prototype,"sortDirection",void 0),c([i.i(l.Property)(5)],t.prototype,"maxGroupCount",void 0),c([i.i(l.Property)("auto")],t.prototype,"height",void 0),c([i.i(l.Property)("auto")],t.prototype,"width",void 0),c([i.i(l.Property)(!1)],t.prototype,"matchCase",void 0),c([i.i(l.Property)(0)],t.prototype,"immediateModeDelay",void 0),c([i.i(l.Property)(!1)],t.prototype,"enableNotCondition",void 0),c([i.i(l.Property)(!1)],t.prototype,"readonly",void 0),c([i.i(l.Property)("")],t.prototype,"separator",void 0),c([i.i(l.Complex)({condition:"and",rules:[]},f)],t.prototype,"rule",void 0),t=c([l.NotifyPropertyChanges],t)}(l.Component);!function(){function e(){}}()},function(e,t){e.exports=i},function(e,t){e.exports=l},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=o},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,i,l,n,r,o,s){return function(e){function t(l){if(i[l])return i[l].exports;var n=i[l]={i:l,l:!1,exports:{}};return e[l].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,l){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:l})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t,i){"use strict";var l=i(4);i.d(t,"a",function(){return l.a}),i.d(t,"b",function(){return l.b}),i.d(t,"c",function(){return l.c}),i.d(t,"d",function(){return l.d}),i.d(t,"e",function(){return l.e})},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l=i(2);i.d(t,"Columns",function(){return l.a}),i.d(t,"Rule",function(){return l.b}),i.d(t,"Value",function(){return l.c}),i.d(t,"ShowButtons",function(){return l.d}),i.d(t,"QueryBuilder",function(){return l.e})},function(e,t,i){"use strict";i.d(t,"a",function(){return m}),i.d(t,"b",function(){return f}),i.d(t,"c",function(){return g}),i.d(t,"d",function(){return v}),i.d(t,"e",function(){return y});var l=i(0),n=(i.n(l),i(5)),r=(i.n(n),i(1)),o=(i.n(r),i(7)),s=(i.n(o),i(8)),a=(i.n(s),i(6)),u=(i.n(a),i(10)),d=(i.n(u),i(9)),p=(i.n(d),this&&this.__extends||function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function l(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(l.prototype=i.prototype,new l)}}()),h=this&&this.__assign||function(){return h=Object.assign||function(e){for(var t,i=1,l=arguments.length;i<l;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},h.apply(this,arguments)},c=this&&this.__decorate||function(e,t,i,l){var n,r=arguments.length,o=r<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,i):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,l);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(r<3?n(o):r>3?n(t,i,o):n(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o},m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(null)],t.prototype,"field",void 0),c([i.i(l.Property)(null)],t.prototype,"label",void 0),c([i.i(l.Property)(null)],t.prototype,"type",void 0),c([i.i(l.Property)(null)],t.prototype,"values",void 0),c([i.i(l.Property)(null)],t.prototype,"operators",void 0),c([i.i(l.Property)()],t.prototype,"ruleTemplate",void 0),c([i.i(l.Property)(null)],t.prototype,"template",void 0),c([i.i(l.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],t.prototype,"validation",void 0),c([i.i(l.Property)(null)],t.prototype,"format",void 0),c([i.i(l.Property)(null)],t.prototype,"step",void 0),c([i.i(l.Property)(null)],t.prototype,"value",void 0),c([i.i(l.Property)(null)],t.prototype,"category",void 0),c([i.i(l.Property)(null)],t.prototype,"columns",void 0),t}(l.ChildProperty),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(null)],t.prototype,"condition",void 0),c([i.i(l.Collection)([],t)],t.prototype,"rules",void 0),c([i.i(l.Property)(null)],t.prototype,"field",void 0),c([i.i(l.Property)(null)],t.prototype,"label",void 0),c([i.i(l.Property)(null)],t.prototype,"type",void 0),c([i.i(l.Property)(null)],t.prototype,"operator",void 0),c([i.i(l.Property)(null)],t.prototype,"value",void 0),c([i.i(l.Property)(!1)],t.prototype,"not",void 0),t}(l.ChildProperty),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(null)],t.prototype,"numericTextBoxModel",void 0),c([i.i(l.Property)(null)],t.prototype,"multiSelectModel",void 0),c([i.i(l.Property)(null)],t.prototype,"datePickerModel",void 0),c([i.i(l.Property)(null)],t.prototype,"textBoxModel",void 0),c([i.i(l.Property)(null)],t.prototype,"radioButtonModel",void 0),t}(l.ChildProperty),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),c([i.i(l.Property)(!0)],t.prototype,"ruleDelete",void 0),c([i.i(l.Property)(!0)],t.prototype,"groupInsert",void 0),c([i.i(l.Property)(!0)],t.prototype,"groupDelete",void 0),t}(l.ChildProperty),y=function(e){function t(t,i){var l=e.call(this,t,i)||this;return l.isReadonly=!0,l.fields={text:"label",value:"field"},l.updatedRule={not:!1,condition:"and"},l.isLocale=!1,l.isRefreshed=!1,l.isNotified=!1,l.isAddSuccess=!1,l.isNotValueChange=!1,l.isFieldChange=!1,l.isFieldClose=!1,l.isDestroy=!1,l.isGetNestedData=!1,l.isCustomOprCols=[],r.MultiSelect.Inject(r.CheckBoxSelection),l}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,r=t.length;n<r;n++)t[n].className.indexOf("e-tooltip")>-1?i.i(l.getComponent)(t[n],"tooltip").destroy():t[n].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(t[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var o=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"}});o.appendChild(s).appendChild(a),this.element.appendChild(o),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&i.i(l.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.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=[],i=[],l=void 0,n=!1,r=!1,o=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&&(o=this.dataColl[0][a[u].field],l=typeof o,"string"===l?r=!isNaN(Date.parse(o)):"object"===l&&(r=o instanceof Date&&!isNaN(o.getTime()),l="string"),a[u].type=l,r=!1),l="string"),a[u].validation||(a[u].validation=s),a[u].category?n=!0:a[u].category=this.l10n.getConstant("OtherFields"),i.indexOf(a[u].category)<0&&i.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&&(i.length>1||i[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++)o=this.dataColl[0][e[u]],l=typeof o,"string"===l?r=!isNaN(Date.parse(o)):"object"!==l||Object.keys(o).length||(r=o instanceof Date&&!isNaN(o.getTime()),l="string"),t[u]={field:e[u],label:e[u],type:r?"date":l,validation:s},r=!1,t[u].operators=this.customOperators[t[u].type+"Operator"],"object"===l&&this.updateSubFields(o,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 i=0;i<e.length;i++)""!==this.separator&&e[i].field.indexOf(this.separator)<0&&(e[i].field=t?t+this.separator+e[i].field:e[i].field),e[i].operators?this.updateCustomOperator(e[i]):e[i].type&&"object"!==e[i].type&&(e[i].operators=this.customOperators[e[i].type+"Operator"]),e[i].columns&&(e[i].type="object",this.updateSubFieldsFromColumns(e[i].columns,e[i].field))},t.prototype.updateSubFields=function(e,t,i){var l;t.columns=[];var n,r,o,s,a=Object.keys(e);i=i||this.dataColl[0];for(var u=0,d=a.length;u<d;u++){var p=t.field.split(".");s=i?i[p[p.length-1]][a[u]]:this.dataColl[0][t.field][a[u]];var h=i[t.field.split(this.separator)[t.field.split(this.separator).length-1]];o=typeof s,n=t.field+this.separator+a[u],r=a[u],o="object"!==o||isNaN(Date.parse(s))?o:"date",l={field:n,label:r,type:o},"object"!==o&&(l.operators=this.customOperators[o+"Operator"]),t.columns.push(l),"object"===o&&this.updateSubFields(s,l,h)}},t.prototype.updateCustomOperator=function(e,t){if(e.operators){this.isLocale||"initial"!==t||i.i(l.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=this,r=0;r<e.operators.length;r++)!function(t){var i=Object.keys(e.operators[t]).indexOf("sqlOperator");if(i>-1){var l=e.operators[t],r=Object.keys(l),o=r.map(function(e){return l[""+e]}).join(",").split(","),s=r.indexOf("value");n.operators[o[s]]=o[i]}}(r)}},t.prototype.focusEventHandler=function(e){this.target=e.target},t.prototype.clickEventHandler=function(e){var t,n=this,r=e.target;this.isImportRules=!1;var o;if("SPAN"===r.tagName&&(r=r.parentElement),r.className.indexOf("e-collapse-rule")>-1){var s=new l.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"===r.tagName&&r.className.indexOf("e-qb-toggle")<0){if(r.className.indexOf("e-removerule")>-1)this.actionButton=r,this.deleteRule(r);else if(r.className.indexOf("e-deletegroup")>-1)this.actionButton=r,this.deleteGroup(i.i(l.closest)(r,".e-group-container"));else if(r.className.indexOf("e-edit-rule")>-1){var s=new l.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=i.i(l.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"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1||r.className.indexOf("e-qb-toggle")>-1){var h=i.i(l.closest)(r,".e-group-container");if(!this.headerTemplate){var c=r.getAttribute("for"),m=void 0;c&&(m=document.getElementById(c).getAttribute("value")),o=h.id.replace(this.element.id+"_","");var f=this.getGroup(o),g=void 0;if(this.enableNotCondition)if(r.className.indexOf("e-qb-toggle")>-1){var v=h.getElementsByClassName("e-qb-toggle")[0];v.className.indexOf("e-active-toggle")>-1?(i.i(l.removeClass)([v],"e-active-toggle"),g=!1):(i.i(l.addClass)([v],"e-active-toggle"),g=!0),m=f.condition}else g=f.not;t={groupID:o,cancel:!1,type:"condition",value:m.toLowerCase()},this.enableNotCondition&&(t={groupID:o,cancel:!1,type:"condition",value:m.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(t,r):this.trigger("beforeChange",t,function(e){n.beforeSuccessCallBack(e,r)}),this.target=r}},t.prototype.beforeSuccessCallBack=function(e,t){if(!e.cancel){var n=i.i(l.closest)(t,".e-group-container"),r=n.id.replace(this.element.id+"_",""),o=this.getValidRules(this.rule),s=this.getParentGroup(n);s.condition=e.value,this.enableNotCondition&&(s.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:s.condition}),this.filterRules(o,this.getValidRules(this.rule),"condition")}},t.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||i.i(l.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?i.i(l.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):i.i(l.removeClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&i.i(l.addClass)([t.element.querySelector("li").parentElement],"e-rtl")):i.i(l.addClass)([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(i.i(l.closest)(e,".e-group-container"),{}):t.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,i.i(l.closest)(e,".e-group-container"),"",!0)},t.prototype.appendRuleElem=function(e,t,n,r,o,s){var a,u,d,p=e.querySelector(".e-rule-list");if("change"===n?a=i.i(l.select)("#"+r,e):(a=this.createElement("div",{attrs:{class:"e-rule-container"}}),a.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),p.appendChild(a),this.ruleIdCounter++),t&&t.ruleTemplate&&s){d={requestType:"template-initialize",ruleID:a.id,action:o,fields:this.fields,rule:s},this.trigger("actionBegin",d),this.ruleTemplateFn=this.templateParser(t.ruleTemplate);var h=this.element.id+t.field,c=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)c=this.ruleTemplateFn(d,this,a.id,h)[0],u=c,u.className+=" e-rule-field",a.appendChild(u);else if(this.isAngular){var m=this.ruleTemplateFn(d,this,a.id,h);c=3===m[0].nodeType?m[1]:m[0],u=c,u.className+=" e-rule-field",a.appendChild(u)}else this.isVue3?(c=this.ruleTemplateFn(d,this,"Template",h),u=c,i.i(l.append)(u,a),a.children[a.children.length-1].className+=" e-rule-field"):(c=this.ruleTemplateFn(d,this,"Template",h)[0],u=c,u.className+=" e-rule-field",a.appendChild(u))}else u=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),a.appendChild(u);return t&&t.ruleTemplate&&s&&this.renderReactTemplates(),a},t.prototype.addRuleElement=function(e,t,i,l,n,r){var o=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,i,l,n,r)):this.trigger("beforeChange",s,function(s){o.addRuleSuccessCallBack(s,e,t,i,l,n,r)})}},t.prototype.addRuleSuccessCallBack=function(e,t,n,o,s,a,u){var d,p,c,m,f=this.element.className.indexOf("e-device")>-1?"250px":"200px",g=n&&n.field?this.getColumn(n.field):o||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 C={requestType:"template-create",action:"insert-rule",ruleID:m.id,fields:this.fields,rule:y};this.trigger("actionBegin",C)}else{m=this.appendRuleElem(t,g,s,a,"field"),m.querySelector(".e-filter-input").setAttribute("id",m.id+"_filterkey");var b=m.querySelector("button");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?(b.textContent=this.l10n.getConstant("Remove"),i.i(l.addClass)([b],"e-flat"),i.i(l.addClass)([b],"e-primary")):(i.i(l.addClass)([b],"e-round"),i.i(l.addClass)([b],"e-icon-btn"),b.setAttribute("title",this.l10n.getConstant("DeleteRule")),b=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),m.querySelector("button").appendChild(b))}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 S=void 0,x=void 0;x=this.separator&&n.field?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):n.field,S={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?x:null,open:this.popupOpen.bind(this,!0)},this.fieldModel&&(S=h({},S,this.fieldModel)),c=new r.DropDownList(S),c.appendTo("#"+m.id+"_filterkey");var O=void 0;O=this.separator&&n.field?this.GetRootColumnName(n.field):this.isImportRules?this.GetRootColumnName(n.field):c.value,this.selectedColumn=c.getDataByValue(O),Object.keys(n).length&&this.changeRule(n,{element:c.element,itemData:this.selectedColumn})}else{var S=void 0,x=(this.isImportRules,n.field);this.dummyDropdownTreeDs=i.i(l.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),S={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:i.i(l.isNullOrUndefined)(x)?null:[x],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt"},this.fieldModel&&(S=h({},S,this.fieldModel));var w=new r.DropDownTree(S);if(w.appendTo("#"+m.id+"_filterkey"),!i.i(l.isNullOrUndefined)(w.value)){var N=this.getLabelFromColumn(w.value[0]);w.element.value=N}var O=i.i(l.isNullOrUndefined)(n.field)?w.value:this.GetRootColumnName(n.field);this.selectedColumn=this.getColumn(O),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,r,o){var s,a,u,d=0;if(r){for(s=i.i(l.select)("#"+o,e),a=i.i(l.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,d++;u.rules[d]=t}else{a=i.i(l.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=t.custom;Object.keys(t).length?(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)):(p&&(n.custom=p),u.rules.push(n))}this.disableRuleCondition(e,u)},t.prototype.changeRuleTemplate=function(e,t){var n=this.selectedColumn.operators;if(!e.ruleTemplate){var r=i.i(l.closest)(t,".e-group-container"),o=i.i(l.closest)(t,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&(i.i(l.detach)(t.closest('[id="'+o+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([o])),e){var s={field:e.field,label:e.label,operator:n[0].value,value:""};this.addRuleElement(r,s,e,"change",o,!0)}}},t.prototype.renderToolTip=function(e){var t=new d.Tooltip({content:this.l10n.getConstant("ValidationMessage"),position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()}});t.appendTo(e),t.open(e)},t.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation){var n=["isnull","isnotnull","isempty","isnotempty"],r=void 0,o=void 0,s=void 0,a=void 0,u=[],d=void 0,p=void 0,h=void 0,c=void 0,m=void 0,f=this.element.querySelectorAll(".e-rule-container");for(r=0,o=f.length;r<o;r++){var g=void 0;if(d=i.i(l.closest)(f[r],".e-group-container"),m=this.getParentGroup(d),p=0,a=c=f[r],"DropdownTree"===this.fieldMode?(e=i.i(l.getComponent)(f[r].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(h=i.i(l.getComponent)(f[r].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&h.value&&(this.selectedColumn=h.getDataByValue(h.value),g=!i.i(l.isNullOrUndefined)(h.index)&&this.selectedColumn.validation),s=c.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;a&&null!==a.previousElementSibling;)a=a.previousElementSibling,p++;if(s=c.querySelector(".e-rule-operator .e-control"),m.rules[p].operator||(s.parentElement.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&&i.i(l.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=c.querySelectorAll(".e-rule-value .e-control");t=!1;for(var y=0,C=v.length;y<C;y++){var b=v[y],S=void 0;b.parentElement.className.indexOf("e-searcher")>-1?(S=i.i(l.closest)(b,".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(h&&h.element&&i.i(l.isNullOrUndefined)(h.index)||e&&e.element&&(i.i(l.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,r=e.groupElement.querySelector(".e-rule-list").children,o=e.groupElement,s=r.length,a=0;for(n=0;n<s;n++)t=r[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=i.i(l.closest)(o,".e-rule-list");return e.groupElement=u?i.i(l.closest)(u,".e-group-container"):o,e.level=this.levelColl[e.groupElement.id].slice(),e},t.prototype.groupTemplate=function(){var e,t,i,l,n,r=this.createElement("div",{attrs:{class:"e-group-container"}}),o=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 r.appendChild(o),s.appendChild(a),r.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),i=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),e.appendChild(i),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),e.appendChild(t),i=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),e.appendChild(i),o.appendChild(e),l=this.createElement("div",{attrs:{class:"e-group-action"}}),n=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),l.appendChild(n),o.appendChild(l)),r},t.prototype.ruleTemplate=function(){var e,t,n=this.createElement("div"),r=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}});var o=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(o),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),t=this.showButtons.ruleDelete||i.i(l.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 s=this.createElement("button",{attrs:{type:"button",class:t}});return e.appendChild(s),r.appendChild(e),n.appendChild(r),n},t.prototype.addGroupElement=function(e,t,i,l,n,r,o){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,i,l,n,r,o)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,i,l,n,r,o)})},t.prototype.addGroupSuccess=function(e,t,r,o,s,a,d,p){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var h=r,c=void 0,m="";m=h.className.indexOf("e-group-container")<0?h.querySelector(".e-group-container")&&h.querySelector(".e-group-container").id:h.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,o,p,m),this.groupIdCounter=0):this.headerTemplateFn(f,a,o,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"),C=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),C.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(t){var b=void 0;b=this.showButtons.groupDelete||i.i(l.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",c=this.createElement("button",{attrs:{type:"button",class:b}});new n.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(c),c.setAttribute("title",this.l10n.getConstant("DeleteGroup")),i.i(l.rippleEffect)(c,{selector:".deletegroup"}),this.headerTemplate||f.querySelector(".e-group-action").appendChild(c);for(var S=h.querySelector(".e-rule-list"),x=S.children,O=0,w=0,N=x.length;w<N;w++)x[w].className.indexOf("e-group-container")>-1&&(O+=1);S.appendChild(f);var E=this.levelColl[h.id].slice(0);E.push(O),this.levelColl[f.id]=E,this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],h.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,s&&this.addRuleElement(f,{}))}else h.appendChild(f),this.levelColl[f.id]=[0];if(this.enableNotCondition&&!this.headerTemplate){var q=f.querySelector(".e-qb-toggle");new n.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"}).appendTo(q),f.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&i.i(l.addClass)([q],"e-active-toggle")}if(this.updatedRule=null,this.headerTemplate){var R={requestType:"header-template-create",ruleID:f.id,condition:o,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",R)}else{var D=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,D),select:this.selectBtn.bind(this,D)}).appendTo(D),D.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules){var T=h.id.replace(this.element.id+"_",""),I=f.id.replace(this.element.id+"_","");this.trigger("change",{groupID:T,type:"insertGroup",childGroupID:I})}}},t.prototype.headerTemplateFn=function(e,t,n,r,o){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(r,!0),groupID:o},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),i.i(l.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 r=i.i(l.closest)(t,".e-group-container"),o=this.getParentGroup(r),s=i.i(l.closest)(t,".e-rule-container"),a=0;if("not"===n)return void(o.not=e);if("condition"===n)return void(o.condition=e);for(;s&&null!==s.previousElementSibling;)s=s.previousElementSibling,a++;var u=o.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 h=0;h<e.length;h++)e[h]&&e[h]instanceof Date&&(e[h]=this.intl.formatDate(e[h],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 r,o=i.i(l.closest)(e,".e-group-container"),s=this.getParentGroup(o),a=i.i(l.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 h=this.getValidRules(this.rule);this.selectedColumn&&(p=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,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":c=d.operator,d.operator=t,m.indexOf(d.operator)>-1?d.value=[]:m.indexOf(c)>-1&&(d.value="");break;case"value":d.value=t}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(h,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var f=i.i(l.closest)(e,".e-rule-container");this.destroyControls(f,!0),i.i(l.detach)(f.querySelector(".e-rule-field"));var g=this.appendRuleElem(i.i(l.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};r={groupID:o.id.replace(this.element.id+"_",""),ruleID:f.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",v),this.trigger("change",r)}},t.prototype.changeValue=function(e,t){var n,r=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 o,s=i.i(l.closest)(n,".e-group-container"),a=i.i(l.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,o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),o&&(this.selectedColumn=o.getDataByValue(o.value)),(o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0])));var h,c;if(n.className.indexOf("e-radio")>-1)if(c=parseInt(n.id.split("valuekey")[1],0),"Default"===this.fieldMode?(o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value)):(o=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),this.selectedColumn.values)h=this.selectedColumn.values[c];else{var m=[!0,!1];h=m[c]}else h=n.className.indexOf("e-multiselect")>-1?i.i(l.getComponent)(n,"multiselect").value:t.value;"input"===t.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){r.filterValue(u,d,h,e,n)},this.immediateModeDelay)):this.filterValue(u,d,h,e,n)},t.prototype.filterValue=function(e,t,i,l,n){var r=this,o={groupID:e,ruleID:t,value:i,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(o,n,l,e,t):this.trigger("beforeChange",o,function(i){r.changeValueSuccessCallBack(i,n,l,e,t)})},t.prototype.changeValueSuccessCallBack=function(e,t,i,l,n){e.cancel||(this.updateRules(t,e.value,i),this.isImportRules||this.trigger("change",{groupID:l,ruleID:n,value:e.value,cancel:!1,type:"value"}))},t.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var t=i.i(l.getComponent)(e,"dropdownlist"),n=t.popupObj.element.querySelector(".e-active"),r=t.getItemData();t.value=r.value;var o={element:t.element,value:r.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:r,event:null,e:null};t.previousValue!==t.value&&this.changeField(o),this.isFieldChange=!1}},t.prototype.changeField=function(e){if(e.isInteracted){if(i.i(l.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var t=i.i(l.closest)(e.element,".e-rule-filter")||i.i(l.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 r=t.querySelector(".e-dropdowntree.e-control"),o=i.i(l.getComponent)(r,"dropdowntree");if(!n)return;if("object"===n.type){if(o.value=e.oldValue,o.dataBind(),i.i(l.isNullOrUndefined)(e.oldValue))r.value="";else{var s=this.getLabelFromColumn(e.oldValue[0]);r.value=s}return}if(!i.i(l.isNullOrUndefined)(e.value[0])){o.value=e.value[0],o.dataBind();var s=this.getLabelFromColumn(e.value[0]);r.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=i.i(l.closest)(e.element,".e-group-container"),u=this.getParentGroup(a),d=i.i(l.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==i.i(l.getComponent)(t.element,"dropdowntree").value)return}var n={},r=i.i(l.closest)(t.element,".e-rule-filter");r=r||i.i(l.closest)(t.element,".e-rule-sub-filter");var o=i.i(l.getComponent)(t.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!=r&&(o=i.i(l.getComponent)(t.element,"dropdowntree"));var s=i.i(l.closest)(t.element,".e-group-container"),a=s.id.replace(this.element.id+"_","");this.changeFilter(r,o,a,e,n,t)},t.prototype.changeFilter=function(e,t,n,r,o,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=i.i(l.closest)(e,".e-rule-container"),p=d.id.replace(this.element.id+"_",""),h={groupID:n,ruleID:p,selectedField:"DropdownTree"===this.fieldMode?t.value[0]:t.value,cancel:!1,type:"field"};this.isImportRules?this.fieldChangeSuccess(h,o,e,r,s):this.trigger("beforeChange",h,function(t){a.fieldChangeSuccess(t,o,e,r,s)})}else{var c=i.i(l.closest)(s.element,".e-rule-operator");this.changeOperator(e,c,t,n,r,o,s)}},t.prototype.changeOperator=function(e,t,n,r,o,s,a){var u,d,p,h=this;t?(u=i.i(l.closest)(t,".e-rule-container"),d=u.id.replace(this.element.id+"_",""),p={groupID:r,ruleID:d,selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(p,e,s,o,a):this.trigger("beforeChange",p,function(t){h.operatorChangeSuccess(t,e,s,o,a)})):this.changeRuleValues(e,o,s,a)},t.prototype.fieldChangeSuccess=function(e,t,n,r,o){for(var s=i.i(l.closest)(n,".e-rule-container"),a=i.i(l.closest)(o.element,".e-rule-operator"),u=i.i(l.closest)(o.element,".e-group-container"),d=u.id.replace(this.element.id+"_",""),p=i.i(l.getComponent)(o.element,"dropdownlist"),h=s.querySelectorAll(".e-tooltip.e-input-group"),c=0;c<h.length;c++)i.i(l.getComponent)(h[c],"tooltip").destroy();if(e.cancel)this.changeOperator(n,a,p,d,r,t,o);else{if(i.i(l.isNullOrUndefined)(this.selectedColumn))return;if(t.type=this.selectedColumn.type,s.querySelector(".e-template")&&(r.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(t.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,r,t,o);else this.destroySubFields(n),this.changeOperator(n,a,p,d,r,t,o)}},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,o){var s=!1,a=i.i(l.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=i.i(l.closest)(u,".e-rule-container").id,p=this.createElement("input",{attrs:{type:"text",id:d+"_subfilterkey"+this.subFilterCounter}});u.appendChild(p);var c,m=this.element.className.indexOf("e-device")>-1?"250px":"200px",f=Object.keys(this.selectedColumn.columns[0]);c={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:f.length>5?m:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(c=h({},c,this.fieldModel));var g=new r.DropDownList(c);if(g.appendTo("#"+d+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(t.field)===this.GetRootColumnName(this.previousColumn.field))for(var v=this.selectedColumn.columns,y=0;y<v.length;y++)if(t.field===v[y].field||t.field.indexOf(v[y].field)>-1){g.value=v[y].field,this.selectedColumn=v[y],s=!0;break}this.subFilterCounter++,this.subFieldElem=p,o.itemData=o.itemData,!s&&this.selectedColumn.columns&&(!s&&this.isImportRules&&(g.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(u,t,n,o)},t.prototype.operatorChangeSuccess=function(e,t,n,r,o){if(!e.cancel){var s=i.i(l.closest)(o.element,".e-rule-operator"),a=s.nextElementSibling,u=i.i(l.getComponent)(o.element,"dropdownlist"),d=r.operator?r.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=r.type,(n.operator.toLowerCase().indexOf("in")<0||d.indexOf("in")<0)&&(r.value=[])):"object"==typeof r.value&&null!=r.value&&(r.value=r.value.length>0?r.value[0]:"number"===r.type?0:""),o.previousItemData){var h=o.previousItemData.value.toString().toLowerCase();(h.indexOf("between")>-1||(h.indexOf("in")>-1||h.indexOf("null")>-1||h.indexOf("empty")>-1)&&h.indexOf("contains")<0)&&(t=s.previousElementSibling,n.type=r.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 c=s.parentElement.querySelector(".e-rule-value"),m=c.querySelector(".e-tooltip.e-input-group");m&&i.i(l.getComponent)(m,"tooltip").destroy(),i.i(l.removeClass)([c],"e-show"),i.i(l.addClass)([c],"e-hide")}a&&this.getColumn(r.field).template&&(t=s.previousElementSibling),this.changeRuleValues(t,r,n,o)}},t.prototype.changeRuleValues=function(e,t,n,o){var s,a,u,d,p=i.i(l.closest)(o.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),i.i(l.addClass)([p],"e-operator"),p.childElementCount){a=i.i(l.getComponent)(p.querySelector(".e-dropdownlist"),"dropdownlist"),n.operator=a.value;var c=void 0;c="DropdownTree"===this.fieldMode?i.i(l.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):i.i(l.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),n.type="DropdownTree"===this.fieldMode?this.getColumn(c.value[0]).type:this.getColumn(c.value).type;var m=o.itemData;this.renderValues(p,m,o.previousItemData,!0,t,n,o.element)}else{var f=i.i(l.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:o.itemData&&(u=this.customOperators[this.selectedColumn.type+"Operator"]);var g=this.element.className.indexOf("e-device")>-1?"250px":"200px",v=u[0].value;v=t&&""!==t.operator?t.operator:v;var y=void 0;y={dataSource:u,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:u.length>5?g:"auto",change:this.changeField.bind(this),index:0,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(y=h({},y,this.operatorModel));var C=new r.DropDownList(y);C.appendTo("#"+f+"_operatorkey"),n.operator=t&&""!==t.operator&&!i.i(l.isNullOrUndefined)(t.operator)?t.operator:u[0].value,this.isImportRules&&(n.type=this.selectedColumn.type,n.operator=t.operator),this.renderValues(p,this.selectedColumn,o.previousItemData,!1,t,n,o.element)}this.isImportRules||this.updateRules(o.element,o.item)},t.prototype.popupOpen=function(e,t){this.enableRtl&&i.i(l.addClass)([t.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},t.prototype.destroyControls=function(e,t){for(var n=t?e:e.nextElementSibling,r=n.querySelectorAll("input.e-control"),o=n.querySelectorAll("div.e-control:not(.e-handle)"),s=this.columns,a=0,u=r.length;a<u;a++){if(r[a].classList.contains("e-textbox"))i.i(l.getComponent)(r[a],"textbox").destroy(),i.i(l.detach)(i.i(l.select)("input#"+r[a].id,n));else if(r[a].classList.contains("e-dropdownlist"))this.allowValidation&&r[a].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(r[a].parentElement,"tooltip").destroy(),i.i(l.getComponent)(r[a],"dropdownlist").destroy();else if(r[a].classList.contains("e-radio"))i.i(l.getComponent)(r[a],"radio").destroy();else if(r[a].classList.contains("e-numerictextbox"))i.i(l.getComponent)(r[a],"numerictextbox").destroy(),i.i(l.detach)(i.i(l.select)("input#"+r[a].id,n));else if(r[a].classList.contains("e-datepicker"))i.i(l.getComponent)(r[a],"datepicker").destroy();else if(r[a].classList.contains("e-multiselect"))i.i(l.getComponent)(r[a],"multiselect").destroy();else if(r[a].className.indexOf("e-template")>-1)for(var d=r[a].className,p=0,h=s.length;p<h;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],r[a].id);break}document.getElementById(r[a].id)&&i.i(l.detach)(r[a])}for(var a=0,u=o.length;a<u;a++){if(o[a].className.indexOf("e-template")>-1)for(var d=o[a].className,p=0,h=s.length;p<h;p++)if(s[p].template&&d.indexOf(s[p].field)>-1){this.templateDestroy(s[p],o[a].id);break}i.i(l.detach)(o[a])}for(var c=n.querySelectorAll(".e-template:not(.e-control)"),a=0,u=c.length;a<u;a++)i.i(l.detach)(c[a])},t.prototype.templateDestroy=function(e,t){var n;if("string"!=typeof e.template||void 0===e.template.destroy){n=e.template;var r=n.destroy;if(n.destroy){var o=void 0;document.getElementById(t)&&(o=i.i(l.closest)(document.getElementById(t),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof r?(r=i.i(l.getValue)(r,window))({field:e.field,elementId:t,elements:o}):n.destroy({field:e.field,elementId:t,elements:o})}}},t.prototype.getValues=function(e){var t,i={},l=[],n=[];this.separator.length>0&&(n=e.split(this.separator));var r=this.dataColl;if(this.dataColl[1])for(var o=0,s=r.length;o<s;o++){var a={};if(n.length>1)for(var u=r[o],d=void 0,p=0,h=n.length;p<h;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=r[o][""+e],Number(r[o][""+e])===r[o][""+e]&&r[o][""+e]%1!=0&&(t=r[o][""+e].toString());t in i||(i[""+t]=1,n.length>1?this.createNestedObject(a,n,t):a[""+e]=t,l.push(a))}return l},t.prototype.createNestedObject=function(e,t,i){for(var l,n=t.length-1,r=0;r<n;++r)l=t[r],l in e||(e[""+l]={}),e=e[""+l];e[t[n]]=i},t.prototype.getDistinctValues=function(e,t){for(var i={},l=[],n=[],r="",o=t.indexOf(this.separator),s=this,a=0,u=e.length;a<u;a++)!function(a,u){0===o?r=e[a][""+t]:(n=t.split(s.separator),n.forEach(function(t){r=r?r[""+t]:e[a][""+t]})),Number(e[a][""+t])===e[a][""+t]&&e[a][""+t]%1!=0&&(r=e[a][""+t].toString());var d={};r in i||(i[""+r]=1,0===o?d[""+t]=r:d[n[n.length-1]]=r,l.push(d))}(a);return l},t.prototype.renderMultiSelect=function(e,t,i,l,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=this.selectedRule.field;if(0!==this.selectedRule.field.indexOf(this.separator)&&"DropdownTree"!==this.fieldMode){var p=this.selectedRule.field.split(this.separator);d=p[p.length-1]}var c;c={dataSource:u?n:a?s:this.dataManager,query:new o.Query([e.field]),fields:{text:d,value:d},placeholder:this.l10n.getConstant("SelectValue"),value:l,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,i),close:this.closePopup.bind(this,i),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+i),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(c=h({},c,this.valueModel.multiSelectModel));var m=new r.MultiSelect(c);m.appendTo("#"+t+"_valuekey"+i),this.updateRules(m.element,l,0)},t.prototype.multiSelectOpen=function(e,t){if(this.dataSource instanceof o.DataManager){var n=document.getElementById(e),r=i.i(l.getComponent)(i.i(l.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist");this.selectedColumn=r.getDataByValue(r.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,r=this,s=new o.Deferred,a=this.dataManager.executeQuery((new o.Query).select(t)),u=i.i(l.getComponent)(e,"multiselect");u.hideSpinner(),this.createSpinner(i.i(l.closest)(e,".e-multi-select-wrapper").parentElement),i.i(d.showSpinner)(i.i(l.closest)(e,".e-multi-select-wrapper").parentElement),a.then(function(o){n=o.actual&&o.actual.result?o.actual.result:o.result,r.dataColl=i.i(l.extend)(r.dataColl,n,[],!0),u.dataSource=r.getDistinctValues(r.dataColl,t),r.isGetNestedData=!0,i.i(d.hideSpinner)(i.i(l.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),i.i(d.createSpinner)({target:t,width:l.Browser.isDevice?"16px":"14px"})},t.prototype.closePopup=function(e,t){var n=document.getElementById(t.popup.element.id.replace("_popup",""));if(n){var r=i.i(l.getComponent)(n,"multiselect").value;this.updateRules(n,r,e)}},t.prototype.processTemplate=function(e,t,n,r){var o=i.i(l.closest)(e,".e-rule-container"),s=o.querySelectorAll(".e-template"),a=o.querySelector(".e-rule-filter .e-filter-input"),u="DropdownTree"===this.fieldMode?i.i(l.getComponent)(a,"dropdowntree"):i.i(l.getComponent)(o.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:o.id,operator:r.operator,field:d.field,requestType:"value-template-create"};this.trigger("actionBegin",p)}else{var h=t.template;"string"==typeof h.write?i.i(l.getValue)(h.write,window)({elements:s.length>1?s:s[0],values:n.value,operator:r.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:r.operator,field:d.field,dataSource:d.values})}},t.prototype.getItemData=function(e){var t=i.i(l.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist");return"DropdownTree"===this.fieldMode&&(t=i.i(l.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 r=this.getItemData(e);if(i.i(l.isNullOrUndefined)(r.value))return n?t?[0,0]:0:t?[]:"";if(t){if(!(r.value instanceof Array))return[r.value]}else if(r.value instanceof Array)return r.value[0];return r.value},t.prototype.renderStringValue=function(e,t,i,l,n){var r,o,a=this.getItemData(e),u="string"==typeof a.template;if(o=this.isImportRules||this.isPublic||u?t.value:this.setDefaultValue(e,!1,!1),"in"!==i&&"notin"!==i||!this.dataColl.length&&!a.values){"in"!==i&&"notin"!==i||(r=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),o=r.join(","));var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,l)},this.valueModel&&this.valueModel.textBoxModel&&(d=h({},d,this.valueModel.textBoxModel));var p=new s.TextBox(d);p.appendTo("#"+e+"_valuekey"+l),p.value=o,p.dataBind()}else r=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,l,r,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,i,l,n,r,o){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.isPublic||u?t.value:this.setDefaultValue(e,!1,!0);if("in"!==i&&"notin"!==i||!this.dataColl.length&&!a.values)if("in"===i||"notin"===i){d=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1);var p=d.join(","),c=void 0;c={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,l)},this.valueModel&&this.valueModel.textBoxModel&&(c=h({},c,this.valueModel.textBoxModel));var m=new s.TextBox(c);m.appendTo("#"+e+"_valuekey"+l),m.value=p,m.dataBind()}else{r=a;var f=r.validation&&r.validation.min?r.validation.min:0,g=r.validation&&r.validation.max?r.validation.max:Number.MAX_VALUE,v=r.format?r.format:"n";o>1&&t&&(d=t.value[l]?t.value[l]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[l]:d,format:v,min:f,max:g,width:"100%",step:r.step?r.step:1,change:this.changeValue.bind(this,l)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=h({},y,this.valueModel.numericTextBoxModel));var C=new s.NumericTextBox(y);C.appendTo("#"+e+"_valuekey"+l),C.element.setAttribute("aria-label",r.label+" Value")}else d=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,l,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 i=[],l=e.split(",");if("string"===t)return l;for(var n=0,r=l.length;n<r;n++)i.push(Number(l[n]));return i},t.prototype.parseDate=function(e,t){var n,r;if(t){var o=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(t),r=o(e),i.i(l.isNullOrUndefined)(r)&&(r=this.intl.parseDate(e,n))}else r=new Date(e);return r},t.prototype.renderControls=function(e,t,n,r,o){if(i.i(l.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),i.i(l.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),i.i(l.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),t.template&&(t.template.create||o))this.processTemplate(e,t,n,r);else{var s;s="boolean"===r.type?this.selectedColumn.values?this.selectedColumn.values.length:2:r.operator&&r.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var u=i.i(l.closest)(e,".e-rule-container").id,d=void 0,p=r.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?i.i(l.addClass)([d],"e-custom-value"):i.i(l.removeClass)([d],"e-custom-value");for(var c=0;c<s;c++)switch(r.type){case"string":this.renderStringValue(u,n,p,c,d);break;case"number":this.renderNumberValue(u,n,p,c,d,t,s);break;case"boolean":this.processBoolValues(t,n,u,c);break;case"date":var m=new Date,f=void 0,g=void 0,v=t.format,y=void 0,C=void 0,b=this.l10n.getConstant("SelectValue"),S="string"==typeof t.template;if(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[c]:n.value,m=this.parseDate(f,g.format)):m=n.value),v){var x=this.getFormat(v);x.skeleton?(C={locale:this.getLocale(),value:m,placeholder:b,format:x,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(C=h({},C,this.valueModel.datePickerModel)),y=new a.DatePicker(C)):(C={value:m,locale:this.getLocale(),placeholder:b,format:x.format,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(C=h({},C,this.valueModel.datePickerModel)),y=new a.DatePicker(C))}else C={locale:this.getLocale(),value:m,placeholder:b,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(C=h({},C,this.valueModel.datePickerModel)),y=new a.DatePicker(C);if(y.appendTo("#"+u+"_valuekey"+c),!n.value){var O=document.getElementById(u+"_valuekey"+c);this.updateRules(O,m,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},t.prototype.processBoolValues=function(e,t,r,o){var s,a,u=!1;i.i(l.isNullOrUndefined)(t.type)&&e&&(t.type=e.type);var d;if(e.values){var p=e.values;"boolean"!==t.type||i.i(l.isNullOrUndefined)(t.value)?e.value?u=p[o].toLowerCase()===e.value.toString().toLowerCase():0===o&&(u=!0):u=p[o].toLowerCase()===t.value.toString().toLowerCase(),a=s=d=p[o]}else{var p=[!0,!1];"boolean"!==t.type||i.i(l.isNullOrUndefined)(t.value)?e.value?u=p[o].toString().toLowerCase()===e.value.toString().toLowerCase():0===o&&(u=!0):u=p[o].toString().toLowerCase()===t.value.toString().toLowerCase(),s=p[o].toString(),a=p[o],d=this.l10n.getConstant(["True","False"][o])}var c;c={label:d,name:r+"default",checked:u,value:s,change:this.changeValue.bind(this,o)},this.valueModel&&this.valueModel.radioButtonModel&&(c=h({},c,this.valueModel.radioButtonModel));var m=new n.RadioButton(c);m.appendTo("#"+r+"_valuekey"+o),u&&this.updateRules(m.element,a,0)},t.prototype.getOperatorIndex=function(e,t){var i,l=e.dataSource,n=l.length;for(i=0;i<n;i++)if(t.operator===e.dataSource[i].value)return i;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,r,o,s,a){var u=e.previousElementSibling,d=u.getElementsByTagName("input")[0],p="DropdownTree"===this.fieldMode?i.i(l.getComponent)(d,"dropdowntree"):i.i(l.getComponent)(d,"dropdownlist"),h="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]):this.getColumn(p.value);if(this.selectedRule=h,r){var c=i.i(l.getComponent)(e.querySelector("input"),"dropdownlist");t=a.id.indexOf("operator")>-1?t:this.selectedRule,t.operators&&(c.value=null,c.dataBind(),c.dataSource=t.operators,c.index=this.getOperatorIndex(c,o),c.value=s.operator=c.dataSource[c.index].value,c.dataBind())}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&&(i.i(l.removeClass)([g],"e-show"),i.i(l.addClass)([g],"e-hide"))}else{var v=i.i(l.closest)(e,".e-rule-container").id;if(n=this.getPreviousItemData(n,h),n&&void 0===n.template?n.columns&&(n=this.getColumn(o.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(o.field)),n&&n.template){this.templateDestroy(n,v+"_valuekey0");var y=i.i(l.select)("#"+v+"_valuekey0",e.nextElementSibling);y&&!y.classList.contains("e-control")&&i.i(l.detach)(i.i(l.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(r&&(this.validateValue(o,i.i(l.closest)(e,".e-rule-container")),this.destroyControls(e)),h&&(t.template=h.template),t.template&&(i.i(l.addClass)([e.nextElementSibling],"e-template-value"),t.template=h.template,f=this.setColumnTemplate(t,v,h.field,t.value||m,e,o)),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{i.i(l.removeClass)([e.nextElementSibling],"e-template-value");var C=1;C="boolean"===s.type?this.selectedColumn.values?this.selectedColumn.values.length:2:m&&m.toLowerCase().indexOf("between")>-1?2:1;for(var b=0;b<C;b++){var S=this.createElement("input",{attrs:{type:"text",id:v+"_valuekey"+b}});e.nextElementSibling.appendChild(S)}}this.renderControls(e,t,o,s,f)}},t.prototype.setColumnTemplate=function(e,t,n,r,o,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:r,rule:s,renderTemplate:!0},this.trigger("actionBegin",a,function(i){d=u.actionBeginSuccessCallBack(i,e,t,n,o)}),d;var p=void 0,h=e.template;if((p="string"==typeof h.create?i.i(l.getValue)(h.create,window)({field:n,operator:r}):h.create({field:n,operator:r}))instanceof Element)p.id=t+"_valuekey0",i.i(l.addClass)([p],"e-template"),o.nextElementSibling.appendChild(p),n.indexOf(" ")<0&&i.i(l.addClass)([p],"e-"+n);else if(p instanceof Array){i.i(l.addClass)(p,"e-template");for(var c=0,m=p.length;c<m;c++)p[c].id=t+"_valuekey"+c,o.nextElementSibling.appendChild(p[c])}return i.i(l.addClass)([o.nextElementSibling],"e-template-value"),!0}return!0},t.prototype.actionBeginSuccessCallBack=function(e,t,n,r,o){if(e.renderTemplate){var s=void 0;this.columnTemplateFn=this.templateParser((t.template,t.template));var a=this.element.id+r;if(this.isReact)s=this.columnTemplateFn(e,this,n,a)[0],o.nextElementSibling.appendChild(s);else if(this.isAngular){var u=this.columnTemplateFn(e,this,n,a);s=3===u[0].nodeType?u[1]:u[0],o.nextElementSibling.appendChild(s)}else this.isVue3?(s=this.columnTemplateFn(e,this,"Template",a),i.i(l.append)(s,o.nextElementSibling)):(s=this.columnTemplateFn(e,this,"Template",a)[0],o.nextElementSibling.appendChild(s));return i.i(l.addClass)([o.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 r=e.className.split(" e-")[n],o=parseInt(e.id.slice(-1),2);switch(r){case"checkbox":var s=i.i(l.getComponent)(e,r).value;t.value=""!==s?s:void 0;break;case"textbox":case"dropdownlist":t.value=i.i(l.getComponent)(e,r).value;break;case"radio":var a=i.i(l.getComponent)(e,r);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[o]=i.i(l.getComponent)(e,r).value):t.value=i.i(l.getComponent)(e,r).value;break;case"datepicker":var u=this.getColumn(t.field),d=this.getFormat(u.format),p=i.i(l.getComponent)(e,r).value;t.operator.indexOf("between")>-1?("string"==typeof t.value&&(t.value=[]),t.value[o]=this.intl.formatDate(p,d)):i.i(l.isNullOrUndefined)(d.format)&&p?t.value=this.intl.formatDate(p):t.value=p?this.intl.formatDate(p,d):p;break;case"multiselect":t.value=i.i(l.getComponent)(e,r).value}},t.prototype.updateRules=function(e,t,n,r){for(var o,s,a=i.i(l.closest)(e,".e-group-container"),u=this.getParentGroup(a),d=i.i(l.closest)(e,".e-rule-container"),p=0,h=a.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);d&&null!==d.previousElementSibling;)d=d.previousElementSibling,p++;var m=u.rules[p].operator?u.rules[p].operator.toString():"";d=i.i(l.closest)(e,".e-rule-container");var f=d.id.replace(this.element.id+"_","");if(i.i(l.closest)(e,".e-rule-filter")||i.i(l.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),o="DropdownTree"===this.fieldMode?i.i(l.getComponent)(e,"dropdowntree"):i.i(l.getComponent)(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(o.value[0]):this.getColumn(o.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=i.i(l.closest)(e,".e-rule-filter");v=v||i.i(l.closest)(e,".e-rule-sub-filter");var y=v.nextElementSibling.querySelector("input.e-control");y=y||v.nextElementSibling.nextElementSibling.querySelector("input.e-control"),m=i.i(l.getComponent)(y,"dropdownlist").value.toString(),u.rules[p].operator=m;var C=v.nextElementSibling.nextElementSibling,b=C.querySelectorAll("input.e-control");b.length<1&&(b=C.querySelectorAll("div.e-control")),b.length<1&&(b=C.querySelectorAll(".e-template")),s={groupID:h,ruleID:f,value:u.rules[p].field,type:"field"};for(var S=0;S<b.length;S++)m.indexOf("null")>-1||m.indexOf("empty")>-1?u.rules[p].value=null:this.updateValues(b[S],u.rules[p]);this.isImportRules||this.trigger("change",s),this.allowValidation&&u.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if(i.i(l.closest)(e,".e-rule-operator")){o=i.i(l.getComponent)(e,"dropdownlist"),u.rules[p].operator=o.value.toString();var x=d.querySelectorAll(".e-rule-value input.e-control");s={groupID:h,ruleID:f,value:o.value,type:"operator"},this.allowValidation&&u.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.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(c,this.getValidRules(this.rule),"operator")}else i.i(l.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,t,u,p,a,d,n),r||this.filterRules(c,this.getValidRules(this.rule),"value"))},t.prototype.filterRules=function(e,t,i){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:i}))},t.prototype.ruleValueUpdate=function(e,t,i,l,n,r,o){var s,a,u=["in","between","notin","notbetween"];if(i.rules[l].operator&&(a=i.rules[l].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===i.rules[l].type&&!this.isNotified){for(var d=[],p=t,h=0,c=p.length;h<c;h++)"string"==typeof p[h]&&d.push(parseFloat(p[h]));d.length&&(t=d)}if(this.isNotified)i.rules[l].value=t,s={groupID:n.id,ruleID:r.id,value:i.rules[l].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?i.rules[l].value[o]=t:i.rules[l].value=t;else if(e.className.indexOf("e-radio")>-1)i.rules[l].value=t;else if(e.className.indexOf("e-multiselect")>-1)i.rules[l].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(i.rules[l].type,i.rules[l].value=this.processValueString(t,i.rules[l].type)):i.rules[l].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 i.rules[l].value&&(i.rules[l].value=[]),i.rules[l].value[o]=this.intl.formatDate(t,m)):i.rules[l].value=this.intl.formatDate(t,m))}this.validateValue(i,r,l)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof i.rules[l].value&&(i.rules[l].value=[]),i.rules[l].value[o]=t):i.rules[l].value=t},t.prototype.validateValue=function(e,t,n){i.i(l.isNullOrUndefined)(n)||(e=e.rules[n]);var r="object"==typeof e.value;if(this.allowValidation&&(i.i(l.isNullOrUndefined)(n)||(r?e.value.length>0:e.value))){var o=t.querySelectorAll(".e-rule-value .e-control");o.length>0&&(o[0].className.indexOf("e-tooltip")>-1?i.i(l.getComponent)(o[0],"tooltip").destroy():o[0].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(o[0].parentElement,"tooltip").destroy(),o[1]&&o[1].parentElement.className.indexOf("e-tooltip")>-1&&i.i(l.getComponent)(o[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,i){var l=t.rules,n=[];if(!i){for(var r=0,o=l.length;r<o;r++)t=l[r],t.rules&&n.push(t);return n[e]}return t},t.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var t,n,r,o;for(e.prototype.destroy.call(this),t=this.element.querySelectorAll(".e-addrulegroup"),r=t.length,n=0;n<r;n++)i.i(l.getComponent)(t[n],"dropdown-btn").destroy(),i.i(l.detach)(t[n]);for(o=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<o.length;n++)i.i(l.getComponent)(o[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)"),r=t.length,n=0;n<r;n++)i.i(l.getComponent)(t[n],"dropdownlist")?i.i(l.getComponent)(t[n],"dropdownlist").destroy():i.i(l.getComponent)(t[n],"dropdowntree").destroy(),i.i(l.detach)(t[n]);for(o=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<o.length;n++)i.i(l.getComponent)(o[n],"tooltip").destroy();for(t=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)"),r=t.length,n=0;n<r;n++)i.i(l.getComponent)(t[n],"dropdownlist")&&(i.i(l.getComponent)(t[n],"dropdownlist").destroy(),i.i(l.detach)(t[n]));for(o=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<o.length;n++)i.i(l.getComponent)(o[n],"tooltip").destroy();this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate(),i.i(l.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 i=0,l=e.length;i<l;i++)this.addRuleElement(document.getElementById(t),e[i]);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 i=document.getElementById(t),l=this.getParentGroup(i);if(e.length){this.isPublic=!0;for(var n=0,r=e.length;n<r;n++)this.updatedRule={condition:e[n].condition,not:e[n].not},this.importRules(e[n],i,!1,e[n].not);this.isPublic=!1}else{var o="and",s=!1;this.updatedRule&&(o=this.updatedRule.condition,s=this.updatedRule.not),this.enableNotCondition?l.rules.push({condition:o,not:s,rules:[]}):l.rules.push({condition:o,rules:[]})}this.headerTemplate||this.disableRuleCondition(i,l)}},t.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&i.i(l.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableRtl&&i.i(l.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),l.Browser.isDevice||"Vertical"===this.displayMode?(l.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),i.i(l.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),i.i(l.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=i.i(l.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,r=0;r<t.length;r++)n=t.item(r),i.i(l.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"}),i=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),l=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),i.textContent=this.l10n.getConstant("Edit"),l.appendChild(i),e.appendChild(l),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 o.DataManager(this.columns).executeLocal((new o.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new o.DataManager(this.columns).executeLocal((new o.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?i.i(l.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):i.i(l.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 i.i(l.isNullOrUndefined)(e.not)?this.enableNotCondition&&!i.i(l.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),r=0,o=n;r<o.length;r++){switch(o[r]){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":e.showButtons.ruleDelete?i.i(l.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):i.i(l.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"),e.showButtons.groupDelete?i.i(l.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):i.i(l.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide");break;case"cssClass":t.cssClass&&i.i(l.removeClass)([this.element],t.cssClass.split(" ")),e.cssClass&&i.i(l.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?(i.i(l.addClass)([this.element],"e-rtl"),this.notGroupRtl()):(i.i(l.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||i.i(l.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 l.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||i.i(l.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",EndsWith:"Ends With",Contains:"Contains",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"},this.l10n=new l.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new l.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:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{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")}],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 o.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new o.Query).take(1))):(this.dataManager=new o.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new o.Query),this.initControl()),this.renderComplete()},t.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?i.i(l.compile)(document.querySelector(e).innerHTML.trim()):i.i(l.compile)(e)}catch(t){return i.i(l.compile)(e)}},t.prototype.executeDataManager=function(e){var t=this,i=this.dataManager.executeQuery(e),l=new o.Deferred;i.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){l.reject(e)})},t.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},t.prototype.wireEvents=function(){var e=this.getWrapper();l.EventHandler.add(e,"click",this.clickEventHandler,this),l.EventHandler.add(e,"focusout",this.focusEventHandler,this),l.EventHandler.add(e,"focusin",this.focusEventHandler,this),l.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this)},t.prototype.unWireEvents=function(){var e=this.getWrapper();l.EventHandler.remove(e,"click",this.clickEventHandler),l.EventHandler.remove(e,"focusout",this.focusEventHandler),l.EventHandler.remove(e,"focusin",this.focusEventHandler),l.EventHandler.remove(this.element,"keydown",this.keyBoardHandler)},t.prototype.getParentGroup=function(e,t){for(var i=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],l=t?i.length-1:i.length,n=this.rule,r=0;r<l;r++)n=this.findGroupByIdx(i[r],n,0===r);return n},t.prototype.deleteGroup=function(e){var t,i=this,l=e;"string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t)):t=l.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){i.deleteGroupSuccessCallBack(t,e)})},t.prototype.deleteGroupSuccessCallBack=function(e,t){if(!e.cancel){var n=t,r=this.getParentGroup(n,!0),o=0,s=void 0,a=void 0,u=this.getValidRules(this.rule),d=n.nextElementSibling,p=n.previousElementSibling,h=n.querySelectorAll(".e-group-container"),c=n.querySelectorAll(".e-tooltip");for(a=c.length,s=0;s<a;s++)i.i(l.getComponent)(c[s],"tooltip").destroy();for(s=0,a=h.length;s<a;s++)delete this.levelColl[h[s].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,o++;d&&d.className.indexOf("e-separate-rule")>-1&&(i.i(l.removeClass)([d],"e-separate-rule"),i.i(l.addClass)([d],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&i.i(l.addClass)([p],"e-prev-joined-rule"));var m=n.parentElement.parentElement.parentElement,f=[];if(this.isReact||this.isAngular){var g=r.rules[o],v=t.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var y=0;y<g.rules.length;y++){var C=this.getColumn(g.rules[y].field);if(v[y]){var b=v[y].querySelector(".e-template-value");C&&(C.ruleTemplate||this.isPlatformTemplate(C)&&b)&&f.push(v[y].id)}}}i.i(l.detach)(t),this.headerTemplate&&this.clearQBTemplate([t.id]),f.length&&this.clearQBTemplate(f),r.rules.splice(o,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(m,r),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=i.i(l.closest)(e,".e-group-container"),r=n.id.replace(this.element.id+"_",""),o=i.i(l.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),s={groupID:r,ruleID:o,cancel:!1,type:"deleteRule"};this.isImportRules?this.deleteRuleSuccessCallBack(s,e):this.trigger("beforeChange",s,function(i){t.deleteRuleSuccessCallBack(i,e)})},t.prototype.deleteRuleSuccessCallBack=function(e,t){if(!e.cancel){var n=i.i(l.closest)(t,".e-group-container"),r=this.getParentGroup(n),o=i.i(l.closest)(t,".e-rule-container"),s=this.getValidRules(this.rule),a=o,u=o.nextElementSibling,d=o.previousElementSibling,p=0,h=o.querySelectorAll(".e-tooltip"),c=void 0,m=h.length;for(c=0;c<m;c++)i.i(l.getComponent)(h[c],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,p++;var f=this.getColumn(r.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&&i.i(l.removeClass)([u],"e-joined-rule"),(!u||u.className.indexOf("e-rule-container")<0)&&d&&i.i(l.removeClass)([d],"e-prev-joined-rule");var g=a.querySelector(".e-template-value");try{i.i(l.detach)(a)}catch(e){e=[];e.error="error"}f&&f.ruleTemplate&&this.clearQBTemplate([a.id]),f&&this.isPlatformTemplate(f)&&g&&this.clearQBTemplate([a.id]),r.rules.splice(p,1),r.rules[0]&&r.rules[0].rules||this.disableRuleCondition(n,r),this.isImportRules||this.trigger("change",e),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},t.prototype.setGroupRules=function(e,t){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),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 i=e.querySelector(".e-rule-list").childElementCount,l=e.querySelector(".e-btngroup-and"),n=e.querySelector(".e-btngroup-or");i>1?(l.disabled=!1,n.disabled=!1,(n.nextElementSibling.classList.contains("e-btn-disable")||l.nextElementSibling.classList.contains("e-btn-disable"))&&(n.nextElementSibling.classList.remove("e-btn-disable"),l.nextElementSibling.classList.remove("e-btn-disable")),t&&"or"===t.condition?n.checked=!0:l.checked=!0):(l.checked=!1,l.disabled=!0,n.checked=!1,n.disabled=!0,t&&(n.nextElementSibling.classList.add("e-btn-disable"),l.nextElementSibling.classList.add("e-btn-disable")))}},t.prototype.getValidRules=function(e){e||(e=this.getRules());var t=e.condition,n=e.not,r=i.i(l.extend)([],e.rules,[],!0);return this.getRuleCollection({condition:t,rules:r,not:n},!0)},t.prototype.getRuleCollection=function(e,t){if(i.i(l.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var r=e.rules.length,o=0;o<r;o++)n=e.rules[o],n=this.getRuleCollection(n,t),e.rules[o]=n,Object.keys(n).length<1&&t&&(e.rules.splice(o,1),o--,r--);var s=e.custom;if(e.field&&""!==e.field&&(i.i(l.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},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)i.i(l.isNullOrUndefined)(e.condition)&&i.i(l.isNullOrUndefined)(e.rules)?e={}:(e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},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=i.i(l.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,r=0;if(e instanceof HTMLElement?t=i.i(l.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,t=document.getElementById(n)),i.i(l.isNullOrUndefined)(t))return null;for(var o=i.i(l.closest)(t,".e-group-container"),s=this.getParentGroup(o);null!==t.previousElementSibling;)t=t.previousElementSibling,r++;return s.rules[r]},t.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=i.i(l.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,i,l=e.length;for(t=0;t<l;t++)i=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(i))},t.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=i.i(l.isNullOrUndefined)(e)?new o.Query:(new o.Query).where(e);return this.dataManager.executeQuery(t)},t.prototype.deleteRules=function(e){var t,i,l=e.length;for(t=0;t<l;t++)i=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(i))},t.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),i=[],l=0,n=Object.keys(this.columns);l<n.length;l++)i.push(this.columns[l].field);return e.rules.length?(new o.Query).select(i).where(t):(new o.Query).select(i)},t.prototype.getPredicate=function(e){var t,n,r,s,a=e.rules,u=!1,d=["notcontains","notstartswith","notendswith"];if(!a)return t;for(var p=0,h=a.length;p<h;p++){var c=Object.keys(a[p]);if(u=!1,c.indexOf("rules")>-1&&a[p].rules)(n=this.getPredicate(a[p]))&&(t=t?"and"===e.condition?t.and(n):t.or(n):n);else if(!i.i(l.isNullOrUndefined)(a[p].operator)&&!i.i(l.isNullOrUndefined)(a[p].operator.length)){var m=a[p].operator.toLowerCase(),f=!1,g=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===a[p].type&&(u=!this.matchCase),"date"===a[p].type&&g.indexOf(m)>-1&&(u=!0),s=this.getColumn(a[p].field),m.indexOf("null")>-1||m.indexOf("empty")>-1)a[p].value=null;else if("date"!==a[p].type||a[p].value instanceof Array)r=a[p].value;else{var v=this.getFormat(s.format);i.i(l.isNullOrUndefined)(a[p].value)?r=null:(r=this.getDate(a[p].value,v),g.indexOf(m)>-1&&!this.isTime(a[p].value)&&(f=!0))}if(0===p)if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contains")<0)t=f?this.datePredicate(a[p],r):this.arrayPredicate(a[p]);else{var y=r;""!==y&&d.indexOf(m)<0&&(t=new o.Predicate(a[p].field,a[p].operator,r,u))}else{if(d.indexOf(m)>-1)continue;if(f||(m.indexOf("in")>-1||m.indexOf("between")>-1||m.indexOf("null")>-1||m.indexOf("empty")>-1)&&m.indexOf("contains")<0)t=f?this.datePredicate(a[p],r,t,e.condition):this.arrayPredicate(a[p],t,e.condition);else if("and"===e.condition){var y=r;t&&""!==y?t=t.and(a[p].field,a[p].operator,r,u):""!==y&&(t=new o.Predicate(a[p].field,a[p].operator,r,u))}else{var y=r;t&&""!==y?t=t.or(a[p].field,a[p].operator,r,u):""!==y&&(t=new o.Predicate(a[p].field,a[p].operator,r,u))}}}}return this.dataSource instanceof o.DataManager&&(i.i(l.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 i.i(l.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",l.cldrData)||(e="en"),e},t.prototype.getColumn=function(e,t){var i,l=this.columns;l=t||l;for(var n=0,r=l.length;n<r;n++){if(l[n].field===e){i=l[n];break}if(l[n].columns){if(i=this.getColumn(e,l[n].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&l[n].field===e.split(this.separator)[0]){i=l[n];break}}return i},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,i,l){var n,r=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":n=new o.Predicate(e.field,"greaterthanorequal",r),n=n.and(e.field,"lessthanorequal",s);break;case"notequal":n=new o.Predicate(e.field,"lessthan",r),n=n.or(e.field,"greaterthan",s);break;case"greaterthan":n=new o.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":n=new o.Predicate(e.field,"greaterthanorequal",r);break;case"lessthan":n=new o.Predicate(e.field,"lessthan",r);break;case"lessthanorequal":n=new o.Predicate(e.field,"lessthanorequal",s)}return n&&(i?"and"===l?i=i.and(n):"or"===l&&(i=i.or(n)):i=n),i},t.prototype.arrayPredicate=function(e,t,i){var l,n=e.value,r=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(r.indexOf("null")>-1||r.indexOf("empty")>-1)switch(r){case"isnull":l=new o.Predicate(e.field,"isnull",s);break;case"isnotnull":l=new o.Predicate(e.field,"isnotnull",s);break;case"isempty":l=new o.Predicate(e.field,"equal","");break;case"isnotempty":l=new o.Predicate(e.field,"notequal","")}if(!(r.indexOf("null")>-1||r.indexOf("empty")>-1))for(var d=0,p=n.length;d<p;d++)if(""!==n[d]||("in"===r||"notin"===r)&&"string"===a.type)if(0===d){var h="greaterthanorequal";switch(r){case"between":l="date"!==a.type?new o.Predicate(e.field,h,n[d]):new o.Predicate(e.field,h,n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null);break;case"notbetween":l="date"===a.type?new o.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 o.Predicate(e.field,"lessthan",n[d]);break;case"in":l=new o.Predicate(e.field,"equal",n[d]);break;case"notin":l=new o.Predicate(e.field,"notequal",n[d])}}else{switch(e.operator){case"between":l="date"===a.type?l.and(e.field,"lessthanorequal",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):l.and(e.field,"lessthanorequal",n[d]);break;case"notbetween":l="date"===a.type?l.or(e.field,"greaterthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):l.or(e.field,"greaterthan",n[d]);break;case"in":l=l.or(e.field,"equal",n[d]);break;case"notin":l=l.and(e.field,"notequal",n[d])}}return l&&(t?"and"===i?t=t.and(l):"or"===i&&(t=t.or(l)):t=l),t},t.prototype.getDate=function(e,t){var i=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&(i=new Date,i.setHours(parseInt(e.split(":")[0])),i.setMinutes(parseInt(e.split(":")[1])),e.split(":")[2]&&i.setSeconds(parseInt(e.split(":")[2]))),i},t.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},t.prototype.importRules=function(e,t,n,r,o){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&&o&&(t=this.renderGroup(e,e.condition,this.element,e.not,o)),this.enableNotCondition&&!this.headerTemplate){var u=t.querySelector(".e-qb-toggle");e.not?i.i(l.addClass)([u],"e-active-toggle"):i.i(l.removeClass)([u],"e-active-toggle")}}else t=this.renderGroup(e,e.condition,t,r);0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var d=e.rules;if(!i.i(l.isNullOrUndefined)(d))for(var p=0,h=d.length;p<h;p++){var c=Object.keys(d[p]);!i.i(l.isNullOrUndefined)(d[p].rules)&&c.indexOf("rules")>-1&&0!==d[p].rules.length?(t=this.renderGroup(d[p],d[p].condition,t,d[p].not),t=this.importRules(d[p],t,!0)):this.renderRule(d[p],t)}return t=i.i(l.closest)(t,".e-rule-list"),t&&(t=i.i(l.closest)(t,".e-group-container")),t},t.prototype.renderGroup=function(e,t,i,l,n){this.addGroupElement(!0,i,t,!1,l,n,e);var r=i.querySelectorAll(".e-group-container");return r[r.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"),o=0;o<t.length;o++)if(t[o].classList.contains("e-dropdownlist")){var u=i.i(l.getInstance)(t[o],r.DropDownList);u.readonly=this.isReadonly}else if(t[o].classList.contains("e-dropdowntree")){var d=i.i(l.getComponent)(t[o],"dropdowntree");d.readonly=this.isReadonly}else if(t[o].classList.contains("e-numerictextbox")){var p=i.i(l.getInstance)(t[o],s.NumericTextBox);p.readonly=this.isReadonly}else if(t[o].classList.contains("e-textbox")){var h=i.i(l.getInstance)(t[o],s.TextBox);h.readonly=this.isReadonly}else if(t[o].classList.contains("e-datepicker")){var c=i.i(l.getInstance)(t[o],a.DatePicker);c.readonly=this.isReadonly}else if(t[o].classList.contains("e-multiselect")){var m=i.i(l.getInstance)(t[o],r.MultiSelect);m.readonly=this.isReadonly}else if(t[o].classList.contains("e-radio")){var f=i.i(l.getInstance)(t[o],n.RadioButton);f.checked||(this.isReadonly?t[o].parentElement.style.display="none":t[o].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 C=[g,v,y],o=0;o<C.length;o++)C[o].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"),i=!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"),i=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),i?"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"),i=!1)})},t.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],i=0,l=t.length;i<l;i++)if(e.toLowerCase().indexOf(t[i])>-1)return!0;return!1},t.prototype.getSqlString=function(e,t,i,l){var n=!1;i||""===i?i+="(":(i="",n=!0);var r=e.condition;if(e.not){var o=void 0;n?(o=l?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (",i+=o):(o=l?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT (",i+=o)}if(e.rules)for(var s=0,a=e.rules.length;s<a;s++){if(e.rules[s].rules)i=this.getSqlString(e.rules[s],t,i,l);else{var u=e.rules[s],d="",p=l?this.sqlOperators[u.operator]:this.operators[u.operator];if(u.value instanceof Array)if(u.operator.toString().indexOf("between")>-1){var h=l?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==u.type||this.isDateFunction(u.value[0])?d+=u.value[0]+h+u.value[1]:d+='"'+u.value[0]+'"'+h+'"'+u.value[1]+'"'}else if("string"==typeof u.value[0]&&null!==u.value){d+='("'+u.value[0]+'"';for(var c=1,m=u.value.length;c<m;c++)d+=',"'+u.value[c]+'"';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?d+=u.value:d+='"'+u.value+'"';u.operator.toString().indexOf("null")>-1||u.operator.toString().indexOf("empty")>-1?(t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),i+=u.field+" "+p):(t?u.field="`"+u.field+"`":u.field.indexOf(" ")>-1&&(u.field='"'+u.field+'"'),i+=u.field+" "+p+" "+d),u.condition&&""!==u.condition&&(r=u.condition)}if(s!==a-1){var u=e.rules[s];(""===r||u&&""!==u.condition&&u.custom&&u.custom.isCustom)&&(r=u.condition),r=l?this.l10n.getConstant(r.toUpperCase()).toUpperCase():r.toUpperCase(),i+=" "+r+" "}}return n||(i+=")"),e.not&&(i+=")"),i},t.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var i=this.getRulesFromSql(e,t);this.setRules({condition:i.condition,not:i.not,rules:i.rules})},t.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var i=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:i.condition,not:i.not,rules:i.rules}:{condition:i.condition,rules:i.rules}},t.prototype.getSqlFromRules=function(e,t,i){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,i).replace(/"/g,"'")},t.prototype.sqlParser=function(e,t){var i,l=0;do{i=e.slice(l),l+=this.parseSqlStrings(i,t)}while(""!==i);return this.parser},t.prototype.parseSqlStrings=function(e,t){var i,l=["=","!=","<=",">=","<",">"];i=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 r,o,s,a=0,u=l.length;a<u;a++)if(r=/^\w+$/.test(l[a])?"\\b":"",o=new RegExp("^("+l[a]+")"+r,"ig"),o.exec(e))return this.parser.push(["Operators",l[a].toLowerCase()]),l[a].length;var d=this.parser[this.parser.length-1];if(!d||d&&"Literal"!==d[0])for(var a=0,u=i.length;a<u;a++)if(r=/^\w+$/.test(i[a])?"\\b":"",o=new RegExp("^("+i[a]+")"+r,"ig"),o.exec(e))return this.parser.push(["Conditions",i[a].toLowerCase()]),i[a].length;for(var a=0,u=n.length;a<u;a++)if(r=/^\w+$/.test(n[a])?"\\b":"",o=new RegExp("^("+n[a]+")"+r,"ig"),o.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,h=s.length;h<e.length&&(s+=e[h],")"===e[h]&&(p=!0),!p||"'"!==e[h]);h++);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],i=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&i&&i[1].indexOf("between")<0)},t.prototype.checkNumberLiteral=function(e,t){var i=this.parser[this.parser.length-1];if(!i)return!0;if(/^[0-9]+(\.[0-9]+)?/.exec(e)){var l=this.parser[this.parser.length-2],n=this.parser[this.parser.length-3];if("Left"===i[0]&&l&&"Conditions"===l[0])return!0;var r=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===i[0]&&n&&n[1].indexOf(r)<0)return!0}return!1},t.prototype.getOperator=function(e,t,i){var l={"=":"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(i){for(var n=Object.keys(this.sqlOperators),r=0;r<n.length;r++)if(this.sqlOperators[n[r]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"notcontains"===n[r]?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"notstartswith"===n[r]?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"notendswith"===n[r]?"notendswith":"endswith":n[r];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 l[""+t]},t.prototype.getTypeFromColumn=function(e){var t=this.getColumn(e.field);return i.i(l.isNullOrUndefined)(t)?null:t.type},t.prototype.getLabelFromColumn=function(e){var t="",i=0;if(""!==this.separator){for(var l=e.split(this.separator),n=0;n<l.length;n++)t+=this.getLabelFromField(l,n+1),++i<l.length&&(t+=this.separator);return t}return this.getColumn(e).label},t.prototype.getLabelFromField=function(e,t){for(var i="",l=0,n=0;n<t;n++)i+=e[n],++l<t&&(i+=this.separator);return this.getColumn(i).label},t.prototype.processParser=function(e,t,i,l){for(var n,r,o,s,a,u,d,p,h,c,m=[],f=[],g=!1,v=0,y=e.length;v<y;v++)if("Literal"===e[v][0]){var C=this.getColumn(e[v][1]);if(o={label:C&&C.label?C.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)o.operator=this.getOperator(" ",e[v+1][1],l),o.value=null,o.type=this.getTypeFromColumn(o);else{var b=e[v+3][1]?e[v+3][1].replace(/'/g,""):e[v+3][1];o.operator=this.getOperator(b,e[v+1][1],l)}for(c=e[v+1][1],v++,n=v+1,r=y,l&&"contains"===o.operator||"startswith"===o.operator||"endswith"===o.operator?c="like":l&&"notcontains"===o.operator||"notstartswith"===o.operator||"notendswith"===o.operator?c="not like":l&&(c=o.operator),n=v+1;n<r;n++)if(c.indexOf("between")<0&&"Left"===e[n][0])g=!0;else{if("Right"===e[n][0]&&g){v=n,g=!1;break}if(c.indexOf("null")>-1||c.indexOf("empty")>-1)break;if(c.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],o.value=S,o.type="string"}else if(c.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)}o.type=this.getTypeFromColumn(o)}c.indexOf("like")<0&&("Number"===e[n-1][0]?(o.value=m,o.type="number"):"String"===e[n-1][0]?(o.value=f,o.type="string"):c.indexOf("between")>-1&&"Conditions"===e[n-1][0]&&(0!==f.length?(o.value=f,o.type="string"):(o.value=m,o.type="number")),m=[],f=[],o.type=this.getTypeFromColumn(o))}else"Operators"===e[v+1][0]&&(o.operator=this.getOperator(e[v+2][1],e[v+1][1],l),"Number"===e[v+2][0]?(o.type="number",o.value=Number(e[v+2][1])):(o.type="string",o.value=e[v+2][1]?e[v+2][1].replace(/'/g,""):e[v+2][1]),o.type=this.getTypeFromColumn(o));t.rules.push(o)}else{if("Left"===e[v][0]){if("Left"!==e[0][0]&&("not"===e[v-1][1]||l&&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:[]},h=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&h++;return i.push(h),t.rules.push(s),s=this.processParser(this.parser,s,i,l),t}if("Conditions"===e[v][0])"not"===e[v][1]||l&&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)),i.pop(),t=this.rule,p=i.length,d=0;d<p;d++)t=this.findGroupByIdx(i[d],t,0===d);return this.processParser(this.parser,t,i,l)}}return t},c([i.i(l.Event)()],t.prototype,"created",void 0),c([i.i(l.Event)()],t.prototype,"actionBegin",void 0),c([i.i(l.Event)()],t.prototype,"beforeChange",void 0),c([i.i(l.Event)()],t.prototype,"change",void 0),c([i.i(l.Event)()],t.prototype,"dataBound",void 0),c([i.i(l.Event)()],t.prototype,"ruleChange",void 0),c([i.i(l.Property)({ruleDelete:!0,groupInsert:!0,groupDelete:!0})],t.prototype,"showButtons",void 0),c([i.i(l.Property)(!1)],t.prototype,"summaryView",void 0),c([i.i(l.Property)(!1)],t.prototype,"allowValidation",void 0),c([i.i(l.Property)("Default")],t.prototype,"fieldMode",void 0),c([i.i(l.Property)([])],t.prototype,"columns",void 0),c([i.i(l.Property)(null)],t.prototype,"fieldModel",void 0),c([i.i(l.Property)(null)],t.prototype,"operatorModel",void 0),c([i.i(l.Property)(null)],t.prototype,"valueModel",void 0),c([i.i(l.Property)()],t.prototype,"headerTemplate",void 0),c([i.i(l.Property)("")],t.prototype,"cssClass",void 0),c([i.i(l.Property)([])],t.prototype,"dataSource",void 0),c([i.i(l.Property)("Horizontal")],t.prototype,"displayMode",void 0),c([i.i(l.Property)(!1)],t.prototype,"enablePersistence",void 0),c([i.i(l.Property)("Default")],t.prototype,"sortDirection",void 0),c([i.i(l.Property)(5)],t.prototype,"maxGroupCount",void 0),c([i.i(l.Property)("auto")],t.prototype,"height",void 0),c([i.i(l.Property)("auto")],t.prototype,"width",void 0),c([i.i(l.Property)(!1)],t.prototype,"matchCase",void 0),c([i.i(l.Property)(0)],t.prototype,"immediateModeDelay",void 0),c([i.i(l.Property)(!1)],t.prototype,"enableNotCondition",void 0),c([i.i(l.Property)(!1)],t.prototype,"readonly",void 0),c([i.i(l.Property)("")],t.prototype,"separator",void 0),c([i.i(l.Complex)({condition:"and",rules:[]},f)],t.prototype,"rule",void 0),t=c([l.NotifyPropertyChanges],t)}(l.Component);!function(){function e(){}}()},function(e,t){e.exports=i},function(e,t){e.exports=l},function(e,t){e.exports=n},function(e,t){e.exports=r},function(e,t){e.exports=o},function(e,t){e.exports=s}])});