@syncfusion/ej2-querybuilder 29.1.33 → 29.1.41

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 : 29.1.33
3
+ * version : 29.1.41
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. 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("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionButtons","SyncfusionDropdowns","SyncfusionData","SyncfusionInputs","SyncfusionCalendars","SyncfusionSplitbuttons","SyncfusionPopups"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionButtons,e.SyncfusionDropdowns,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionCalendars,e.SyncfusionSplitbuttons,e.SyncfusionPopups)}(self,((e,t,l,n,r,i,o,s)=>(()=>{"use strict";var a={766:t=>{t.exports=e},741:e=>{e.exports=t},570:e=>{e.exports=i},74:e=>{e.exports=n},778:e=>{e.exports=l},323:e=>{e.exports=r},197:e=>{e.exports=s},295:e=>{e.exports=o}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var l=u[e]={exports:{}};return a[e](l,l.exports,d),l.exports}d.d=(e,t)=>{for(var l in t)d.o(t,l)&&!d.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return(()=>{d.r(p),d.d(p,{Columns:()=>g,QueryBuilder:()=>y,QueryLibrary:()=>b,Rule:()=>m,ShowButtons:()=>v,Value:()=>f});var e,t=d(766),l=d(741),n=d(778),r=d(74),i=d(323),o=d(570),s=d(295),a=d(197),u=(e=function(t,l){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])},e(t,l)},function(t,l){function n(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(n.prototype=l.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)},h=function(e,t,l,n){var r,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,l,o):r(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o},g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"values",void 0),h([(0,t.Property)(null)],l.prototype,"operators",void 0),h([(0,t.Property)()],l.prototype,"ruleTemplate",void 0),h([(0,t.Property)(null)],l.prototype,"template",void 0),h([(0,t.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),h([(0,t.Property)(null)],l.prototype,"format",void 0),h([(0,t.Property)(null)],l.prototype,"step",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(null)],l.prototype,"category",void 0),h([(0,t.Property)(null)],l.prototype,"columns",void 0),l}(t.ChildProperty),m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"condition",void 0),h([(0,t.Collection)([],l)],l.prototype,"rules",void 0),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"operator",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(!1)],l.prototype,"not",void 0),h([(0,t.Property)(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),f=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"numericTextBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"multiSelectModel",void 0),h([(0,t.Property)(null)],l.prototype,"datePickerModel",void 0),h([(0,t.Property)(null)],l.prototype,"textBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),v=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(!1)],l.prototype,"cloneRule",void 0),h([(0,t.Property)(!1)],l.prototype,"cloneGroup",void 0),h([(0,t.Property)(!1)],l.prototype,"lockRule",void 0),h([(0,t.Property)(!1)],l.prototype,"lockGroup",void 0),h([(0,t.Property)(!0)],l.prototype,"ruleDelete",void 0),h([(0,t.Property)(!0)],l.prototype,"groupInsert",void 0),h([(0,t.Property)(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),y=function(e){function d(t,l){var r=e.call(this,t,l)||this;return r.isReadonly=!0,r.fields={text:"label",value:"field"},r.updatedRule={not:!1,condition:"and",isLocked:!1},r.isLocale=!1,r.isRefreshed=!1,r.isNotified=!1,r.isAddSuccess=!1,r.isNotValueChange=!1,r.isFieldChange=!1,r.isFieldClose=!1,r.isDestroy=!1,r.isGetNestedData=!1,r.isCustomOprCols=[],r.groupCounter=0,r.lockItems=[],r.groupIndex=-1,r.ruleIndex=-1,r.isLastGroup=!1,r.cloneGrpBtnClick=!1,r.isMiddleGroup=!1,r.cloneRuleBtnClick=!1,r.isValueEmpty=!1,n.MultiSelect.Inject(n.CheckBoxSelection),r}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=l.length;n<r;n++)l[n].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(l[n],"tooltip").destroy():l[n].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(l[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var i=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"}});i.appendChild(o).appendChild(s),this.element.appendChild(i),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&(0,t.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)},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},d.prototype.GetRootColumnName=function(e){return this.separator?e.split(this.separator)[0]:e},d.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],n=void 0,r=!1,i=!1,o=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=0,u=(d=this.columns).length;a<u;a++)this.updateCustomOperator(d[a],"initial"),d[a].type||(e.indexOf(d[a].field)>-1&&("string"===(n=typeof(o=this.dataColl[0][d[a].field]))?i=!isNaN(Date.parse(o)):"object"===n&&(i=o instanceof Date&&!isNaN(o.getTime()),n="string"),d[a].type=n,i=!1),n="string"),d[a].validation||(d[a].validation=s),d[a].category?r=!0:d[a].category=this.l10n.getConstant("OtherFields"),l.indexOf(d[a].category)<0&&l.push(d[a].category),(!d[a].operators||this.isLocale&&-1===this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);r&&(l.length>1||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(a=0,u=e.length;a<u;a++)"string"===(n=typeof(o=this.dataColl[0][e[a]]))?i=!isNaN(Date.parse(o)):"object"!==n||Object.keys(o).length||(i=o instanceof Date&&!isNaN(o.getTime()),n="string"),t[a]={field:e[a],label:e[a],type:i?"date":n,validation:s},i=!1,t[a].operators=this.customOperators[t[a].type+"Operator"],"object"===n&&this.updateSubFields(o,t[a]);this.columns=t}}else if(this.columns&&this.columns.length){var d;for(a=0,u=(d=this.columns).length;a<u;a++)d[a].category?this.fields={text:"label",value:"field",groupBy:"category"}:d[a].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(d[a],"initial"),(!d[a].operators||this.isLocale&&-1===this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},d.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},d.prototype.updateSubFields=function(e,t,l){var n;t.columns=[];var r,i,o=Object.keys(e);l=l||this.dataColl[0];for(var s=0,a=o.length;s<a;s++){var u=t.field.split(".");i=l?l[u[u.length-1]][o[s]]:this.dataColl[0][t.field][o[s]];var d=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof i,n={field:t.field+this.separator+o[s],label:o[s],type:r="object"!==r||isNaN(Date.parse(i))?r:"date"},"object"!==r&&(n.operators=this.customOperators[r+"Operator"]),t.columns.push(n),"object"===r&&this.updateSubFields(i,n,d)}},d.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||(0,t.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var n=e.operators[t],i=Object.keys(n),o=i.map((function(e){return n[""+e]})).join(",").split(","),s=i.indexOf("value");r.operators[o[s]]=o[l]}},r=this,i=0;i<e.operators.length;i++)n(i)}},d.prototype.focusEventHandler=function(e){this.target=e.target},d.prototype.clickEventHandler=function(e){var l,n,r=this,i=e.target;if(this.isImportRules=!1,"SPAN"===i.tagName&&(i=i.parentElement),"string"==typeof i.className&&i.className.indexOf("e-collapse-rule")>-1){var o=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var s=document.getElementById(this.element.id+"_summary_content"),a=s.querySelector(".e-summary-text");o.animate(".e-query-builder",{name:"SlideLeftIn"}),(d=this.element.querySelector(".e-group-container")).style.display="none",a.textContent=this.getSqlFromRules(this.rule),s.style.display="block",a.style.height=a.scrollHeight+"px"}if("BUTTON"===i.tagName&&"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")<0){o=new t.Animation({duration:1e3,delay:0});switch(!0){case i.className.indexOf("e-removerule")>-1:this.actionButton=i,this.deleteRule(i);break;case i.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=i,this.cloneRuleBtnClick=!0,this.ruleClone(i);break;case i.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=i,this.ruleLock(i);break;case i.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=i,this.groupLock(i);break;case i.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=i,this.cloneGrpBtnClick=!0,this.groupClone((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-deletegroup")>-1:this.actionButton=i,this.deleteGroup((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-edit-rule")>-1:if(o.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 u=(0,t.extend)({},this.rule,{},!0);this.setGroupRules(u),this.renderSummaryCollapse()}else{var d;(d=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}}else if("LABEL"===i.tagName&&i.parentElement.className.indexOf("e-btn-group")>-1||"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")>-1){var p=(0,t.closest)(i,".e-group-container");if(!this.headerTemplate){var c=i.getAttribute("for"),h=void 0;c?h=document.getElementById(c).getAttribute("value"):this.enableSeparateConnector&&(h=i.textContent),n=p.id.replace(this.element.id+"_","");var g=this.getGroup(n),m=void 0;if(this.enableNotCondition)if(i.className.indexOf("e-qb-toggle")>-1){var f=p.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?((0,t.removeClass)([f],"e-active-toggle"),m=!1):((0,t.addClass)([f],"e-active-toggle"),m=!0),h=g.condition}else m=g.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:m})}this.isImportRules?this.beforeSuccessCallBack(l,i):this.trigger("beforeChange",l,(function(e){r.beforeSuccessCallBack(e,i)})),this.target=i}},d.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=n.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(n);if(this.enableSeparateConnector){var s=(n=(0,t.isNullOrUndefined)((0,t.closest)(l,".e-rule-container"))&&n.classList.contains("e-group-container")?null!==l.parentElement.previousElementSibling?l.parentElement.previousElementSibling:n:(0,t.closest)(l,".e-rule-container")).id.replace(this.element.id+"_","");n.classList.contains("e-rule-container")?(o=this.getRule(n)).condition=e.value:n.classList.contains("e-group-container")&&((o=this.getGroup(n)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,ruleID:s,type:"condition",value:o.condition})}else o.condition=e.value,this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:o.condition});if(this.filterRules(i,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector){var a=l.parentElement.querySelector(".e-btngroup-and"),u=l.parentElement.querySelector(".e-btngroup-or");a&&u&&("and"===e.value?(a.checked=!0,u.checked=!1):"or"===e.value&&(u.checked=!0,a.checked=!1))}}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||(0,t.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):(0,t.removeClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&(0,t.addClass)([l.element.querySelector("li").parentElement],"e-rtl")):(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement((0,t.closest)(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,(0,t.closest)(e,".e-group-container"),"",!0)},d.prototype.appendRuleElem=function(e,l,n,r,i,o){var s,a,u,d=e.querySelector(".e-rule-list");if("change"===n)s=(0,t.select)("#"+r,e);else{if((s=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)d.appendChild(s);else if(this.enableSeparateConnector){for(var p=-1,c=this.ruleIndex+1,h=0;h<c&&h!==d.children.length;h++)d.children[h].classList.contains("e-rule-container")&&(c++,p++);d.insertBefore(s,d.children[this.ruleIndex+p+1])}else d.insertBefore(s,d.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else d.appendChild(s);this.ruleIdCounter++}if(l&&l.ruleTemplate&&o){u={requestType:"template-initialize",ruleID:s.id,action:i,fields:this.fields,rule:o},this.trigger("actionBegin",u),this.ruleTemplateFn=this.templateParser(l.ruleTemplate);var g=this.element.id+l.field;if(u.fields=this.fields,u.columns=this.columns,""===o.field&&(o.field=l.field),u.operators=this.getOperators(o.field),u.operatorFields={text:"key",value:"value"},this.isReact)(a=this.ruleTemplateFn(u,this,s.id,g)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var m=this.ruleTemplateFn(u,this,s.id,g);(a=3===m[0].nodeType?m[1]:m[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",g),(0,t.append)(a,s),s.children.length&&(s.children[s.children.length-1].className+=" e-rule-field")):((a=this.ruleTemplateFn(u,this,"Template",g)[0]).className+=" e-rule-field",s.appendChild(a))}else a=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),s.appendChild(a);return this.showButtons.lockGroup&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&(0,t.removeClass)(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&(0,t.removeClass)(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&(0,t.removeClass)(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&(0,t.removeClass)(s.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),l&&l.ruleTemplate&&o&&this.renderReactTemplates(),s},d.prototype.addRuleElement=function(e,t,l,n,r,i){var o=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,n,r,i)):this.trigger("beforeChange",s,(function(s){o.addRuleSuccessCallBack(s,e,t,l,n,r,i)}))}},d.prototype.addRuleSuccessCallBack=function(e,l,r,i,o,s,a){var u,d,p,h,g=this.element.className.indexOf("e-device")>-1?"250px":"200px",m=r&&r.field?this.getColumn(r.field):i||this.columns[0],f={label:"",field:"",type:"",operator:""};if(!e.cancel){if(m&&m.ruleTemplate&&r.field){this.selectedColumn=m,d=this.selectedColumn.operators,f={label:m.label,field:m.field,type:m.type,operator:d[0].value};var v=Object.keys(r).length?r:f,y={requestType:"template-create",action:"insert-rule",ruleID:(h=this.appendRuleElem(l,m,o,s,"field",v)).id,fields:this.fields,rule:v};this.trigger("actionBegin",y)}else{(h=this.appendRuleElem(l,m,o,s,"field")).querySelector(".e-filter-input").setAttribute("id",h.id+"_filterkey");var b=h.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)b.textContent=this.l10n.getConstant("Remove"),(0,t.addClass)([b],"e-flat"),(0,t.addClass)([b],"e-primary");else{(0,t.addClass)([b],"e-round"),(0,t.addClass)([b],"e-icon-btn"),b.setAttribute("title",this.l10n.getConstant("DeleteRule"));var C=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});h.querySelector(".e-rule-delete").appendChild(C)}this.showButtons.ruleDelete||b.classList.add("e-button-hide")}"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?h.className="e-rule-container e-vertical-mode":h.className="e-rule-container e-horizontal-mode";var S=h.previousElementSibling;if(this.enableSeparateConnector){var x=void 0,q=void 0;if(S&&S.classList.contains("e-group-container")&&(q=S.querySelectorAll(".e-rule-container"),S=q[q.length-1]),S&&S.classList.contains("e-rule-container")&&(x=this.getRule(S)),this.headerTemplate&&S&&x)this.headerTemplateFn(S,!1,x.condition,x,S.id);else if((0,t.isNullOrUndefined)(S)&&h.id!==this.element.id+"_group0_rule0"){if((B=h.closest(".e-group-container"))&&B.previousElementSibling){var O=(D=B.previousElementSibling).querySelectorAll(".e-rule-container");if(D.classList.contains("e-group-container")&&(D=O[O.length-1]),D.classList.contains("e-rule-container")){var E=this.getRule(D);this.headerTemplateFn(D,!1,E.condition,E,D.id,!0)}}else this.headerTemplateFn(h,!1,r.condition,r,h.id,!0)}}else S&&S.className.indexOf("e-rule-container")>-1&&(h.className.indexOf("e-joined-rule")<0&&(h.className+=" e-joined-rule"),S.className.indexOf("e-prev-joined-rule")<0&&(S.className+=" e-prev-joined-rule"));if(S&&S.className.indexOf("e-group-container")>-1&&h.className.indexOf("e-separate-rule")<0&&(h.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(l,r,f,a,s,!!this.enableSeparateConnector||null),!m||m&&!m.ruleTemplate||!r.field)if("Default"===this.fieldMode){var k=void 0,w=void 0;w=this.separator&&r.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(r.field):r.field,k={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?g:"auto",close:this.fieldClose.bind(this,h.id+"_filterkey"),change:this.changeField.bind(this),value:r?w:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(k=c({},k,this.fieldModel)),(p=new n.DropDownList(k)).appendTo("#"+h.id+"_filterkey");var N=void 0;N=this.separator&&r.field||this.isImportRules?this.GetRootColumnName(r.field):p.value,this.selectedColumn=p.getDataByValue(N),Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.selectedColumn})}else{k=void 0,w=(this.isImportRules,r.field);this.dummyDropdownTreeDs=(0,t.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),k={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?g:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:(0,t.isNullOrUndefined)(w)?null:[w],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt",filtering:this.dropdownTreeFiltering.bind(this),close:this.dropdownTreeClose.bind(this)},this.fieldModel&&(k=c({},k,this.fieldModel));var L=new n.DropDownTree(k);if(L.appendTo("#"+h.id+"_filterkey"),!(0,t.isNullOrUndefined)(L.value)){var R=this.getLabelFromColumn(L.value[0]);L.element.value=R}N=(0,t.isNullOrUndefined)(r.field)?L.value:this.GetRootColumnName(r.field);this.selectedColumn=this.getColumn(N),Object.keys(r).length&&this.changeRule(r,{element:L.element,itemData:this.selectedColumn})}if(u=h.id.replace(this.element.id+"_",""),r&&r.isLocked){var T=h.querySelector(".e-lock-rule-btn");this.ruleLock(T)}this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:u,type:"insertRule"})}if(this.enableSeparateConnector&&(0,t.isNullOrUndefined)(r.condition)&&u&&(r=this.getRule(u)),this.enableSeparateConnector){var D=h.previousElementSibling;for(q=void 0;D&&!D.classList.contains("e-rule-container");){if(D.classList.contains("e-group-container")){q=D.querySelectorAll(".e-rule-container"),D=q[q.length-1];break}D=D.previousElementSibling}if(this.headerTemplate&&D){x=this.getRule(D);var I={requestType:"rule-template-create",ruleID:D.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",I)}else if((0,t.isNullOrUndefined)(D)&&h.id!==this.element.id+"_group0_rule0"){var B;if((B=h.closest(".e-group-container"))&&B.previousElementSibling&&B.previousElementSibling.previousElementSibling){var A=B.previousElementSibling.previousElementSibling;if(A.classList.contains("e-group-container")){var P=A.querySelectorAll(".e-rule-container");A=P[P.length-1]}if(A.classList.contains("e-rule-container")){x=this.getRule(A);var G={requestType:"rule-template-create",ruleID:A.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",G)}}}this.setMultiConnector(h)}},d.prototype.dropdownTreeFiltering=function(e){var l,n=this,r=this,i=e.event.srcElement;l=(i.classList.contains("e-clear-icon")?i.parentElement.querySelector(".e-textbox"):i).id.split("_filterkey")[0];var o=document.getElementById(l);this.ddTree=(0,t.getComponent)(o.querySelector("input.e-dropdowntree"),"dropdowntree");var s=(0,t.extend)([],this.columns,[],!0);if(e.cancel=!0,""===e.text)this.changeDataSource(s);else{var a=s.map((function(t){return n.nestedChildFilter(e.text,t)})).filter((function(e){return null!==e}));this.changeDataSource(a),setTimeout((function(){(0,t.isNullOrUndefined)(r.ddTree)||(0,t.isNullOrUndefined)(r.ddTree.treeObj)||r.ddTree.treeObj.expandAll()}),100)}},d.prototype.changeDataSource=function(e){this.updateDropdowntreeDS(e),this.ddTree.treeObj.fields={dataSource:e,value:"field",text:"label",child:"columns",expanded:"expanded"},this.ddTree.treeObj.refresh()},d.prototype.nestedChildFilter=function(e,t){var l=this,n=t[this.ddTree.fields.child];if(!n)return this.isMatchedNode(e,t)?t:null;var r=n.map((function(t){return l.nestedChildFilter(e,t)})).filter((function(e){return null!==e}));return r.length?(t[this.ddTree.fields.child]=r,t):(t[this.ddTree.fields.child]=n,this.isMatchedNode(e,t)?t:null)},d.prototype.isMatchedNode=function(e,t){var l=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==l.indexOf(e)},d.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource((0,t.extend)([],this.columns,[],!0)),this.ddTree=null},d.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type?(this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template,e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns)):this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template},d.prototype.updateAddedRule=function(e,l,n,r,i,o){var s,a,u,d=0;if(r){for(s=(0,t.select)("#"+i,e),a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var p=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!p||d++}u.rules[d]=l}else{a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);var c=l.custom;Object.keys(l).length?this.ruleIndex<0?(u.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),c&&(u.rules[u.rules.length-1].custom=c),this.enableSeparateConnector&&(u.rules[u.rules.length-1].condition=l.condition?l.condition:n.condition)):(u.rules.splice(this.ruleIndex+1,0,{field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),c&&(u.rules[this.ruleIndex+1].custom=c),this.enableSeparateConnector&&(u.rules[this.ruleIndex+1].condition=l.condition?l.condition:n.condition)):(c&&(n.custom=c),this.autoSelectField&&(l.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u,o)},d.prototype.changeRuleTemplate=function(e,l){var n=this.selectedColumn.operators;if(!e.ruleTemplate){var r=(0,t.closest)(l,".e-group-container"),i=(0,t.closest)(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&((0,t.detach)(l.closest('[id="'+i+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([i])),e){var o={field:e.field,label:e.label,operator:n[0].value,value:""};this.addRuleElement(r,o,e,"change",i,!0)}}},d.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},d.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var n,r=["isnull","isnotnull","isempty","isnotempty"],i=void 0,o=void 0,s=void 0,a=[],u=void 0,d=void 0,p=void 0,c=void 0,h=void 0,g=this.element.querySelectorAll(".e-rule-container");for(i=0,n=g.length;i<n;i++){var m=void 0;if(u=(0,t.closest)(g[i],".e-group-container"),h=this.getParentGroup(u),d=0,s=c=g[i],"DropdownTree"===this.fieldMode?(e=(0,t.getComponent)(g[i].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),m=this.selectedColumn.validation):(p=(0,t.getComponent)(g[i].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&p.value&&(this.selectedColumn=p.getDataByValue(p.value),m=!(0,t.isNullOrUndefined)(p.value)&&this.selectedColumn.validation),o=c.querySelector(".e-rule-field input.e-control"),m&&m.isRequired){for(;s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var f=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!f||d++}if(o=c.querySelector(".e-rule-operator .e-control"),h.rules[d].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1),h.rules[d].value instanceof Array&&(a=h.rules[d].value),r.indexOf(h.rules[d].operator)<-1&&(0,t.isNullOrUndefined)(h.rules[d].value)&&"date"!==h.rules[d].type||""===h.rules[d].value||null===h.rules[d].value||h.rules[d].value instanceof Array&&a.length<1){var v=c.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=(0,t.closest)(C,".e-multi-select-wrapper")).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 if("date"===h.rules[d].type&&(null===h.rules[d].value||h.rules[d].value.indexOf(null)>-1)){v=c.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(y=0,b=v.length;y<b;y++)v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&((0,t.isNullOrUndefined)(h.rules[d].value)||null==h.rules[d].value[y])&&this.renderToolTip(v[y].parentElement)}}else(p&&p.element&&(0,t.isNullOrUndefined)(p.value)||e&&e.element&&((0,t.isNullOrUndefined)(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1)}}return l},d.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)}},d.prototype.refreshLevel=function(e){var l,n,r=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=r.length,s=0;for(n=0;n<o;n++)(l=r[n]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=(0,t.closest)(i,".e-rule-list");return e.groupElement=a?(0,t.closest)(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(e){var t,l,n,r,i,o,s=this.createElement("div",{attrs:{class:"e-group-container"}}),a=this.createElement("div",{attrs:{class:"e-group-header"}}),u=this.createElement("div",{attrs:{class:"e-group-body"}}),d=this.createElement("div",{attrs:{class:"e-rule-list"}});if(s.appendChild(a),u.appendChild(d),s.appendChild(u),!this.headerTemplate){n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var p=this.createElement("span",{attrs:{class:n,"aria-lable":"drag handle",title:"drag handle"}});a.appendChild(p);var c=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group";t=this.createElement("div",{attrs:{class:c,role:"group"}}),this.enableSeparateConnector&&t.classList.add("e-multi-connector"),this.enableNotCondition&&(l=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),t.appendChild(l)),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),t.appendChild(r),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),t.appendChild(r),a.appendChild(t),i=this.createElement("div",{attrs:{class:"e-group-action"}}),this.enableSeparateConnector?(o=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),i.appendChild(o),o=this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}}),i.appendChild(o)):(o=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(o)),a.appendChild(i)}return s},d.prototype.ruleTemplate=function(){var e,l,n,r,i,o=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}}),i=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var a=this.createElement("span",{attrs:{class:i,"aria-lable":"drag handle",title:"drag handle"}});s.appendChild(a);var u=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(u),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",r=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var d=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),p=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});d.appendChild(p);var c=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}});p=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),c.appendChild(p),l=this.showButtons.ruleDelete||(0,t.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 h=this.createElement("button",{attrs:{type:"button",class:l}});return e.appendChild(d),e.appendChild(c),e.appendChild(h),s.appendChild(e),o.appendChild(s),o},d.prototype.addGroupElement=function(e,t,l,n,r,i,o){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,n,r,i,o)):this.trigger("beforeChange",a,(function(a){s.addGroupSuccess(a,e,t,l,n,r,i,o)}))},d.prototype.addGroupSuccess=function(e,n,r,i,o,a,u,d){var p=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var c=r,h=void 0,g="";g=c.className.indexOf("e-group-container")<0?c.querySelector(".e-group-container")&&c.querySelector(".e-group-container").id:c.id,this.enableSeparateConnector&&(this.groupElem=this.groupTemplate());var m=this.groupElem.cloneNode(!0);if(m.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&m.querySelector(".e-drag-qb-rule")&&(m&&m.children[0]&&m.children[0].classList.add("e-parent-header"),(0,t.addClass)([m.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(u?(n=!1,m.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(m,a,i,d,g),this.groupIdCounter=0):this.headerTemplateFn(m,a,i,d,g)),this.groupIdCounter++,!this.headerTemplate){var f=m.querySelector(".e-btngroup-and"),v=m.querySelector(".e-btngroup-or"),y=m.querySelector(".e-btngroup-and-lbl"),b=m.querySelector(".e-btngroup-or-lbl");f.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),f.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(n){var C=void 0;C=this.showButtons.groupDelete||(0,t.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),(0,t.rippleEffect)(h,{selector:".deletegroup"});for(var S=c.querySelector(".e-rule-list"),x=S.children,q=0,O=0,E=x.length;O<E;O++)x[O].className.indexOf("e-group-container")>-1&&(q+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===x.length-1)S.appendChild(m),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var k=0,w=this.groupIndex+1,N=0;N<w;N++)x[N].classList.contains("e-rule-container")&&(w++,k++);k>0&&k--,x[L=this.groupIndex+k+1].parentNode.insertBefore(m,x[L])}else{var L;x[L=this.groupIndex+1].parentNode.insertBefore(m,x[L])}this.isMiddleGroup=!0}else S.appendChild(m);var R=this.levelColl[c.id].slice(0);if(R.push(q),this.levelColl[m.id]=R,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],c.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(m,{})),!this.headerTemplate){var T="";T=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var D=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:T}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});D.appendChild(I),m.querySelector(".e-group-action").appendChild(D),T=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:T}}),A=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(A),m.querySelector(".e-group-action").appendChild(B),m.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){T="";T=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:T}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(I),m.querySelector(".e-group-action").appendChild(B)}c.appendChild(m),this.levelColl[m.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var P=m.querySelector(".e-qb-toggle");(this.enableSeparateConnector?new l.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new l.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(P),m.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&(0,t.addClass)([P],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){var G=m.querySelector(".e-btngroup-and"),M=m.querySelector(".e-btngroup-or"),V=m.querySelector(".e-btn-group");for(N=0;N<V.childNodes.length;N++)"not"===m.querySelector(".e-btn-group").childNodes[N].textContent.toLowerCase()&&this.enableNotCondition?V.childNodes[N].classList.add("e-multiconnector"):V.childNodes[N].style.display="none";if(m.previousElementSibling){if((0,t.isNullOrUndefined)(this.headerTemplate))m.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),m),(P=m.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(P.style.display="none");if(!this.isImportRules){var F=m.previousElementSibling,U=F.querySelector(".e-btngroup-and"),_=F.querySelector(".e-btngroup-or");if(G.checked||M.checked)this.enableSeparateConnector&&(G.checked&&(U.checked=!0),M.checked&&(_.checked=!0));else{var j=m.nextElementSibling;j&&j.classList.contains("e-btn-group")&&(G=j.querySelector(".e-btngroup-and"),M=j.querySelector(".e-btngroup-or"),U.checked=G.checked,_.checked=M.checked)}}}}if(this.updatedRule=null,this.headerTemplate){var $={requestType:"header-template-create",ruleID:m.id,condition:i,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",$)}else if(this.enableSeparateConnector){var Q=m.querySelector(".e-add-condition-btn");(W=new l.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(Q),W.element.onclick=function(){p.addRuleElement((0,t.closest)(Q,".e-group-container"),{})};var H=m.querySelector(".e-add-group-btn");(W=new l.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(H),W.element.onclick=function(){p.addGroupElement(!0,(0,t.closest)(H,".e-group-container"),"",!0)}}else{var W,z=m.querySelector(".e-add-btn");(W=new s.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,z),select:this.selectBtn.bind(this,z)})).appendTo(z),z.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules&&!this.prvtEvtTgrDaD){var Y=c.id.replace(this.element.id+"_",""),K=m.id.replace(this.element.id+"_","");this.trigger("change",{groupID:Y,type:"insertGroup",childGroupID:K})}}},d.prototype.setMultiConnector=function(e){if(this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling&&this.groupElem.querySelector(".e-btn-group")){e.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),e);var t=e.previousElementSibling.childNodes[0];t.classList.contains("e-qb-toggle")&&(t.style.display="none"),this.addHeaderDiv(e)}},d.prototype.addHeaderDiv=function(e){var l,n=e.previousElementSibling.previousElementSibling;if(n){l=n.id.indexOf("rule")>-1?this.getRule(n):this.getGroup(n),(0,t.isNullOrUndefined)(l.condition)&&(l.condition="and");var r=e.previousElementSibling.querySelector(".e-btngroup-or"),i=e.previousElementSibling.querySelector(".e-btngroup-and");r.disabled=!1,i.disabled=!1,"or"===l.condition?r.checked=!0:i.checked=!0}},d.prototype.headerTemplateFn=function(e,l,n,r,i,o){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(d=e),this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?l:void 0,condition:n,rule:this.getRuleCollection(r,!1),groupID:i},this.trigger("actionBegin",a),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(a.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):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],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s)}else if(this.isVue3){if(s=this.headerFn(a,this,e.id,u),this.enableSeparateConnector&&(o||-1!==e.id.indexOf("rule")))for(var c=0;c<s.length;c++)if("DIV"===s[c].nodeName){s=s[c];break}this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):(0,t.append)(s,d)}else s=this.headerFn(a,this,"Template",u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);this.renderReactTemplates()}return e},d.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling?e.nextElementSibling:e).closest(".e-group-container");!e.nextElementSibling&&l&&(l=l.nextElementSibling?l.nextElementSibling:l),l&&l.parentElement.insertBefore(t,l)},d.prototype.notifyChange=function(e,l,n){var r=(0,t.closest)(l,".e-group-container"),i=this.getParentGroup(r),o=(0,t.closest)(l,".e-rule-container"),s=0;if("not"!==n)if("condition"!==n){for(;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&s++;var a=i.rules[s],u=this.getColumn(a.field),d=this.getFormat(u.format);if("date"===u.type)if(e instanceof Date)e=this.intl.formatDate(e,d);else if(e instanceof Array)for(var p=0;p<e.length;p++)e[p]&&e[p]instanceof Date&&(e[p]=this.intl.formatDate(e[p],d));u.ruleTemplate?this.templateChange(l,e,n):(this.isNotified=!0,this.updateRules(l,e),this.isNotified=!1)}else this.enableSeparateConnector?((o=l.parentElement.previousElementSibling)&&o.classList.contains("e-group-container")&&(o=o.querySelectorAll(".e-rule-container")[o.querySelectorAll(".e-rule-container").length-1]),o&&o.classList.contains("e-rule-container")&&(i=this.getRule(o)),i.condition=e):i.condition=e;else i.not=e},d.prototype.templateChange=function(e,l,n){var r,i=(0,t.closest)(e,".e-group-container"),o=this.getParentGroup(i),s=(0,t.closest)(e,".e-rule-container"),a=0;for(this.allowValidation&&this.validateValue(o,s);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container"))))&&a++;var u,d=o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):d&&(this.selectedColumn=this.getColumn(d.field)),this.previousColumn=this.getColumn(d.field);var p=this.getValidRules(this.rule);this.selectedColumn&&(u=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,h=["in","notin","between","notbetween"];switch(n){case"field":d.field=l,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=u[0].value;break;case"operator":c=d.operator,d.operator=l,h.indexOf(d.operator)>-1?d.value=[]:h.indexOf(c)>-1&&(d.value="");break;case"value":d.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(p,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var g=(0,t.closest)(e,".e-rule-container");this.destroyControls(g,!0),(0,t.detach)(g.querySelector(".e-rule-field"));var m=this.appendRuleElem((0,t.closest)(g,".e-group-container"),this.selectedColumn,"change",g.id,n,d);"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",this.enableSeparateConnector||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");var f={requestType:"template-create",action:n,ruleID:g.id,fields:this.fields,rule:d};r={groupID:i.id.replace(this.element.id+"_",""),ruleID:g.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",r)}},d.prototype.changeValue=function(e,l){var n,r=this;if(this.isNumInput&&"number"==typeof l.value||"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||this.selectedColumn.validation.min>0))this.isNumInput=!1;else{if(l.element&&l.element.classList.contains("e-multiselect"))n=l.element;else n=l.event?l.event.target:"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")?l.currentTarget:l.element;if(n){if(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1)n=l.element;var o,s,a,u=(0,t.closest)(n,".e-group-container"),d=(0,t.closest)(n,".e-rule-container"),p=u&&u.id.replace(this.element.id+"_",""),c=d.id.replace(this.element.id+"_",""),h=l;if(h.element&&h.element.className.indexOf("e-datepicker")>-1&&(n=h.element,(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=o.getDataByValue(o.value)),(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0]))),n.className.indexOf("e-radio")>-1)if(a=parseInt(n.id.split("valuekey")[1],10),"Default"===this.fieldMode?(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value),this.selectedColumn.columns&&(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(o.value))):(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),this.selectedColumn.values)s=this.selectedColumn.values[a];else{s=[!0,!1][a]}else if(n.className.indexOf("e-multiselect")>-1)s=(0,t.getComponent)(n,"multiselect").value;else if(s=l.value,"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")){s=Number(l.currentTarget.value);var g=l.currentTarget,m=(0,t.getInstance)(g,i.NumericTextBox),f=(0,t.getValue)("decimal",(0,t.getNumericObject)(this.locale));isNaN(s)&&-1!==g.value.indexOf(f)&&(s=this.intl.getNumberParser({format:"n"})(g.value)),isNaN(s)||(m.value=s),this.isNumInput=!0}"input"===l.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval((function(){r.filterValue(p,c,s,e,n)}),this.immediateModeDelay)):this.filterValue(p,c,s,e,n)}}},d.prototype.filterValue=function(e,t,l,n,r){var i=this,o={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(o,r,n,e,t):this.trigger("beforeChange",o,(function(l){i.changeValueSuccessCallBack(l,r,n,e,t)}))},d.prototype.changeValueSuccessCallBack=function(e,t,l,n,r){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:n,ruleID:r,value:e.value,cancel:!1,type:"value"}))},d.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var l=(0,t.getComponent)(e,"dropdownlist"),n=l.popupObj&&l.popupObj.element.querySelector(".e-active"),r=l.getItemData();l.value=r.value;var i={element:l.element,value:r.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:r,event:null,e:null};l.previousValue!==l.value&&this.changeField(i),this.isFieldChange=!1}},d.prototype.changeField=function(e){if(e.isInteracted){if((0,t.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var l=(0,t.closest)(e.element,".e-rule-filter")||(0,t.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!==l){var r=l.querySelector(".e-dropdowntree.e-control"),i=(0,t.getComponent)(r,"dropdowntree");if(!n)return;if("object"===n.type){if(i.value=e.oldValue,i.dataBind(),(0,t.isNullOrUndefined)(e.oldValue))r.value="";else{var o=this.getLabelFromColumn(e.oldValue[0]);r.value=o}return}if(!(0,t.isNullOrUndefined)(e.value[0])){i.value=e.value[0],i.dataBind();o=this.getLabelFromColumn(e.value[0]);r.value=o}}if(this.destroySubFields(l),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 s=(0,t.closest)(e.element,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e.element,".e-rule-container"),d=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;a.rules[d].value="",this.changeRule(a.rules[d],e)}}},d.prototype.changeRule=function(e,l){if(!l.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==(0,t.getComponent)(l.element,"dropdowntree").value)return}var n=(0,t.closest)(l.element,".e-rule-filter");n=n||(0,t.closest)(l.element,".e-rule-sub-filter");var r=(0,t.getComponent)(l.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==n&&(r=(0,t.getComponent)(l.element,"dropdowntree"));var i=(0,t.closest)(l.element,".e-group-container").id.replace(this.element.id+"_","");this.changeFilter(n,r,i,e,{},l)},d.prototype.changeFilter=function(e,l,n,r,i,o){var s=this;if(e){var a=void 0;a="DropdownTree"===this.fieldMode?l.value[0]:this.isImportRules?this.GetRootColumnName(l.value):l.value,this.selectedColumn=this.getColumn(a);var u={groupID:n,ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:"DropdownTree"===this.fieldMode?l.value[0]:l.value,cancel:!1,type:"field"};this.isImportRules||this.prvtEvtTgrDaD?this.fieldChangeSuccess(u,i,e,r,o):this.trigger("beforeChange",u,(function(t){s.fieldChangeSuccess(t,i,e,r,o)}))}else{var d=(0,t.closest)(o.element,".e-rule-operator");this.changeOperator(e,d,l,n,r,i,o)}},d.prototype.changeOperator=function(e,l,n,r,i,o,s){var a,u=this;l?(a={groupID:r,ruleID:(0,t.closest)(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,o,i,s):this.trigger("beforeChange",a,(function(t){u.operatorChangeSuccess(t,e,o,i,s)}))):this.changeRuleValues(e,i,o,s)},d.prototype.fieldChangeSuccess=function(e,l,n,r,i){for(var o=(0,t.closest)(n,".e-rule-container"),s=(0,t.closest)(i.element,".e-rule-operator"),a=(0,t.closest)(i.element,".e-group-container").id.replace(this.element.id+"_",""),u=(0,t.getComponent)(i.element,"dropdownlist"),d=o.querySelectorAll(".e-tooltip.e-input-group"),p=0;p<d.length;p++)(0,t.getComponent)(d[p],"tooltip").destroy();if(e.cancel)this.changeOperator(n,s,u,a,r,l,i);else{if((0,t.isNullOrUndefined)(this.selectedColumn))return;if(l.type=this.selectedColumn.type,o.querySelector(".e-template")&&(r.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(l.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,r,l,i);else this.destroySubFields(n),this.changeOperator(n,s,u,a,r,l,i)}},d.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},d.prototype.createSubFields=function(e,l,r,i){var o=!1,s=(0,t.closest)(e,".e-rule-field"),a=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});s.insertBefore(a,s.querySelector(".e-rule-operator"));var u=(0,t.closest)(a,".e-rule-container").id,d=this.createElement("input",{attrs:{type:"text",id:u+"_subfilterkey"+this.subFilterCounter}});a.appendChild(d);var p,h=this.element.className.indexOf("e-device")>-1?"250px":"200px";p={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?h:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(p=c({},p,this.fieldModel));var g=new n.DropDownList(p);if(g.appendTo("#"+u+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(l.field)===this.GetRootColumnName(this.previousColumn.field))for(var m=this.selectedColumn.columns,f=0;f<m.length;f++)if(l.field===m[f].field||l.field.indexOf(m[f].field+this.separator)>-1){g.value=m[f].field,this.selectedColumn=m[f],o=!0;break}this.subFilterCounter++,this.subFieldElem=d,i.itemData=i.itemData,!o&&this.selectedColumn.columns&&(!o&&this.isImportRules&&(g.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(a,l,r,i)},d.prototype.operatorChangeSuccess=function(e,l,n,r,i){if(!e.cancel){var o=(0,t.closest)(i.element,".e-rule-operator"),s=o.nextElementSibling,a=(0,t.getComponent)(i.element,"dropdownlist"),u=r.operator?r.operator.toString().toLowerCase():"";n.operator=a.value.toString();var d=n.operator.toLowerCase();if(n.operator.toLowerCase().indexOf("between")>-1||n.operator.toLowerCase().indexOf("in")>-1&&n.operator.toLowerCase().indexOf("contains")<0?(l=o.previousElementSibling,n.type=r.type,(n.operator.toLowerCase().indexOf("in")<0||u.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:""),i.previousItemData){var p=i.previousItemData.value.toString().toLowerCase();(p.indexOf("between")>-1||(p.indexOf("in")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contains")<0)&&(l=o.previousElementSibling,n.type=r.type)}if(u.indexOf("in")>-1&&u.indexOf("in")<5&&d.indexOf("in")>-1&&d.indexOf("in")<5&&(l=null),n.operator.indexOf("null")>-1||n.operator.indexOf("empty")>-1){var c=o.parentElement.querySelector(".e-rule-value"),h=c.querySelector(".e-tooltip.e-input-group");h&&(0,t.getComponent)(h,"tooltip").destroy(),(0,t.removeClass)([c],"e-show"),(0,t.addClass)([c],"e-hide")}s&&this.getColumn(r.field).template&&(l=o.previousElementSibling),0===s.children.length&&(l=o.previousElementSibling),this.changeRuleValues(l,r,n,i)}},d.prototype.changeRuleValues=function(e,l,r,i){var o,s,a,u,d=(0,t.closest)(i.element,".e-rule-operator");if(e)if(d=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(r.type=this.selectedColumn.type,o=d.classList.contains("e-rule-sub-filter"),d=o?d.nextElementSibling:d),(0,t.addClass)([d],"e-operator"),d.childElementCount){s=(0,t.getComponent)(d.querySelector(".e-dropdownlist"),"dropdownlist"),r.operator=s.value;var p=void 0;p="DropdownTree"===this.fieldMode?(0,t.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):(0,t.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),r.type="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]).type:this.getColumn(p.value).type;var h=i.itemData;""!==s.value&&this.renderValues(d,h,i.previousItemData,!0,l,r,i.element)}else{var g=(0,t.closest)(d,".e-rule-container").id;u=this.createElement("input",{attrs:{type:"text",id:g+"_operatorkey"}}),d.appendChild(u),this.selectedColumn.operators?a=this.selectedColumn.operators:i.itemData&&(a=this.customOperators[this.selectedColumn.type+"Operator"]);var m,f=this.element.className.indexOf("e-device")>-1?"250px":"200px";l.operator&&a.forEach((function(e){"value"in e&&"string"==typeof e.value&&e.value.toLowerCase()===l.operator.toLowerCase()&&(m=e.value)}));var v=m||a[0].value,y=0;this.autoSelectOperator||(v="",y=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.prvtEvtTgrDaD)&&(v=l&&l.operator?l.operator:v);var b=void 0;b={dataSource:a,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:a.length>5?f:"auto",change:this.changeField.bind(this),index:y,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(b=c({},b,this.operatorModel)),new n.DropDownList(b).appendTo("#"+g+"_operatorkey"),r.operator=l&&""!==l.operator&&!(0,t.isNullOrUndefined)(l.operator)?l.operator:a[0].value,this.isImportRules&&(r.type=this.selectedColumn.type,r.operator=l.operator),(0,t.isNullOrUndefined)(v)||""===v?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element):this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element)}this.isImportRules||this.updateRules(i.element,i.item)},d.prototype.popupOpen=function(e,l){this.enableRtl&&(0,t.addClass)([l.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},d.prototype.destroyControls=function(e,l){for(var n=l?e:e.nextElementSibling,r=n.querySelectorAll("input.e-control"),i=n.querySelectorAll("div.e-control:not(.e-handle)"),o=this.columns,s=0,a=r.length;s<a;s++){if(r[s].classList.contains("e-textbox"))(0,t.getComponent)(r[s],"textbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-dropdownlist"))this.allowValidation&&r[s].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(r[s].parentElement,"tooltip").destroy(),(0,t.getComponent)(r[s],"dropdownlist").destroy();else if(r[s].classList.contains("e-radio"))(0,t.getComponent)(r[s],"radio").destroy();else if(r[s].classList.contains("e-numerictextbox"))(0,t.getComponent)(r[s],"numerictextbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-datepicker"))(0,t.getComponent)(r[s],"datepicker").destroy();else if(r[s].classList.contains("e-multiselect"))(0,t.getComponent)(r[s],"multiselect").destroy();else if(r[s].className.indexOf("e-template")>-1)for(var u=r[s].className,d=0,p=o.length;d<p;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],r[s].id);break}document.getElementById(r[s].id)&&(0,t.detach)(r[s])}for(s=0,a=i.length;s<a;s++){if(i[s].className.indexOf("e-template")>-1)for(u=i[s].className,d=0,p=o.length;d<p;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],i[s].id);break}(0,t.detach)(i[s])}var c=n.querySelectorAll(".e-template:not(.e-control)");for(s=0,a=c.length;s<a;s++)(0,t.detach)(c[s])},d.prototype.templateDestroy=function(e,l){var n;if("string"!=typeof e.template||void 0===e.template.destroy){var r=(n=e.template).destroy;if(n.destroy){var i=void 0;document.getElementById(l)&&(i=(0,t.closest)(document.getElementById(l),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof r?(r=(0,t.getValue)(r,window))({field:e.field,elementId:l,elements:i}):n.destroy({field:e.field,elementId:l,elements:i})}}},d.prototype.getValues=function(e){var t,l={},n=[],r=[];this.separator.length>0&&(r=e.split(this.separator));var i=this.dataColl;if(this.dataColl[1])for(var o=0,s=i.length;o<s;o++){var a={};if(r.length>1)for(var u=i[o],d=void 0,p=0,c=r.length;p<c;p++)d=r[p],r.length===p+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=i[o][""+e],Number(i[o][""+e])===i[o][""+e]&&i[o][""+e]%1!=0&&(t=i[o][""+e].toString());t in l||(l[""+t]=1,r.length>1?this.createNestedObject(a,r,t):a[""+e]=t,n.push(a))}return n},d.prototype.createNestedObject=function(e,t,l){for(var n,r=t.length-1,i=0;i<r;++i)(n=t[i])in e||(e[""+n]={}),e=e[""+n];e[t[r]]=l},d.prototype.getDistinctValues=function(e,t){for(var l={},n=[],r=[],i="",o=t.indexOf(this.separator),s=function(s,u){i="",0===o?i=e[s][""+t]:(r=t.split(a.separator)).forEach((function(t){i=i?i[""+t]:e[s][""+t]})),Number(e[s][""+t])===e[s][""+t]&&e[s][""+t]%1!=0&&(i=e[s][""+t].toString());var d={};i in l||(l[""+i]=1,0===o?d[""+t]=i:d[r[r.length-1]]=i,n.push(d))},a=this,u=0,d=e.length;u<d;u++)s(u);return n},d.prototype.renderMultiSelect=function(e,t,l,i,o){var s,a,u=!1,d=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(u=!0,s=this.getDistinctValues(this.dataColl,e.field)),u=!e.columns&&u,!this.dataColl.length&&o.length&&(d=!0),a={dataSource:d?o:u?s:this.dataManager,query:new r.Query([e.field]),fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(a=c({},a,this.valueModel.multiSelectModel));var p=new n.MultiSelect(a);p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},d.prototype.multiSelectOpen=function(e,l){if(this.dataSource instanceof r.DataManager){var n=document.getElementById(e),i=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"DropdownTree"===this.fieldMode?"dropdowntree":"dropdownlist");"DropdownTree"===this.fieldMode?this.selectedColumn=this.getColumn(i.value[0]):this.selectedColumn=i.getDataByValue(i.value);var o=this.selectedColumn.field,s=!1;if(this.dataColl[1])Object.keys(this.dataColl[1]).indexOf(o)>-1&&(s=!0),0!==o.indexOf(this.separator)&&this.isGetNestedData&&(s=!0);s||(l.cancel=!0,this.bindMultiSelectData(n,o))}},d.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},d.prototype.getMultiSelectData=function(e,l){var n,i=this,o=new r.Deferred,s=this.dataManager.executeQuery((new r.Query).select(l)),u=(0,t.getComponent)(e,"multiselect");u.hideSpinner(),this.createSpinner((0,t.closest)(e,".e-multi-select-wrapper").parentElement),(0,a.showSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement),s.then((function(r){n=r.actual&&r.actual.result?r.actual.result:r.result,i.dataColl=(0,t.extend)(i.dataColl,n,[],!0),u.dataSource=i.getDistinctValues(i.dataColl,l),i.isGetNestedData=!0,(0,a.hideSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement)})).catch((function(e){o.reject(e)}))},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),(0,a.createSpinner)({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var n=document.getElementById(l.popup.element.id.replace("_popup",""));if(n){var r=(0,t.getComponent)(n,"multiselect");if(r){var i=r.value;this.updateRules(n,i,e)}}},d.prototype.processTemplate=function(e,l,n,r){var i=(0,t.closest)(e,".e-rule-container"),o=i.querySelectorAll(".e-template"),s=i.querySelector(".e-rule-filter .e-filter-input"),a="DropdownTree"===this.fieldMode?(0,t.getComponent)(s,"dropdowntree"):(0,t.getComponent)(i.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),u="DropdownTree"===this.fieldMode?this.getColumn(a.value[0]):this.getColumn(a.value);if("string"==typeof l.template||void 0===l.template.write){var d={rule:n,ruleID:i.id,operator:r.operator,field:u.field,requestType:"value-template-create"};this.trigger("actionBegin",d)}else{var p=l.template;"string"==typeof p.write?(0,t.getValue)(p.write,window)({elements:o.length>1?o:o[0],values:n.value,operator:r.operator,field:u.field,dataSource:u.values}):"function"!=typeof l.template&&l.template.write({elements:o.length>1?o:o[0],values:n.value,operator:r.operator,field:u.field,dataSource:u.values})}},d.prototype.getItemData=function(e){var l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist"),n=this.element.querySelector("#"+e);if("DropdownTree"===this.fieldMode)l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdowntree");else if(n){var r=n.querySelectorAll(".e-rule-sub-filter");if(r.length>0){var i=r[r.length-1].querySelector(".e-dropdownlist");l=(0,t.getComponent)(i,"dropdownlist")}}return"DropdownTree"===this.fieldMode?this.getColumn(l.value[0]):this.getColumn(l.value)},d.prototype.setDefaultValue=function(e,l,n){var r=this.getItemData(e);if((0,t.isNullOrUndefined)(r.value))return n?l?[0,0]:0:l?[]:"";if(l){if(!(r.value instanceof Array))return[r.value]}else if(r.value instanceof Array)return r.value[0];return r.value},d.prototype.renderStringValue=function(e,t,l,n,r){var o,s,a=this.getItemData(e),u="string"==typeof a.template;if(s=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!==t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(",")),"between"!==l&&"notbetween"!==l||s.length>1&&(s=s[n]);var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(d=c({},d,this.valueModel.textBoxModel));var p=new i.TextBox(d);p.appendTo("#"+e+"_valuekey"+n),p.value=s,p.dataBind()}else o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,o,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?r.style.width="100%":(r.style.width=null,r.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,t,l,n,r,o,s){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){var p=(d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(h=c({},h,this.valueModel.textBoxModel));var g=new i.TextBox(h);g.appendTo("#"+e+"_valuekey"+n),g.value=p,g.dataBind()}else{var m=(o=a).validation&&o.validation.min?o.validation.min:0,f=o.validation&&o.validation.max?o.validation.max:Number.MAX_VALUE,v=o.format?o.format:"n";s>1&&t&&(d=t.value[n]?t.value[n]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[n]:d,format:v,min:m,max:f,width:"100%",step:o.step?o.step:1,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=c({},y,this.valueModel.numericTextBoxModel));var b=new i.NumericTextBox(y);b.appendTo("#"+e+"_valuekey"+n),b.element.setAttribute("aria-label",o.label+" Value"),b.element.oninput=this.changeValue.bind(this,n)}else d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,d,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?r.style.width="100%":(r.style.minWidth="200px",r.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],n=e.split(",");if("string"===t)return n;for(var r=0,i=n.length;r<i;r++)l.push(Number(n[r]));return l},d.prototype.parseDate=function(e,l){var n,r;if(l){var i=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(l),r=i(e),(0,t.isNullOrUndefined)(r)&&(r=this.intl.parseDate(e,n))}else r=new Date(e);return r},d.prototype.renderControls=function(e,l,n,r,i){if((0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),(0,t.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),(0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),l.template&&(l.template.create||i))this.processTemplate(e,l,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 a=(0,t.closest)(e,".e-rule-container").id,u=void 0,d=r.operator.toString();if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){u=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?u.style.width="100%":"in"!==d&&"notin"!==d?(0,t.addClass)([u],"e-custom-value"):(0,t.removeClass)([u],"e-custom-value");for(var p=0;p<s;p++)switch(r.type){case"string":this.renderStringValue(a,n,d,p,u);break;case"number":this.renderNumberValue(a,n,d,p,u,l,s);break;case"boolean":this.processBoolValues(l,n,a,p);break;case"date":var h=new Date,g=void 0,m=void 0,f=l.format,v=void 0,y=void 0,b=this.l10n.getConstant("SelectValue"),C="string"==typeof l.template;if(n.value&&!(0,t.isNullOrUndefined)(f)&&(g=s>1?n.value[p]:n.value,h=this.parseDate(g,f)||new Date),l.field||l.key||!l.value||(h=l.value instanceof Date?l.value:this.parseDate(l.value,l.format)),!l.format&&n&&""!==n.field&&(f=(m=this.getColumn(n.field)).format),(this.isImportRules||this.isPublic||C)&&n&&(f=(m=this.getColumn(n.field)).format,n.value?(g=s>1?n.value[p]:n.value,h=this.parseDate(g,m.format)):h=n.value),f){var S=this.getFormat(f);S.skeleton?(y={locale:this.getLocale(),value:h,placeholder:b,format:S,change:this.changeValue.bind(this,p)},this.valueModel&&this.valueModel.datePickerModel&&(y=c({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y)):(y={value:h,locale:this.getLocale(),placeholder:b,format:S.format,change:this.changeValue.bind(this,p)},this.valueModel&&this.valueModel.datePickerModel&&(y=c({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y))}else y={locale:this.getLocale(),value:h,placeholder:b,change:this.changeValue.bind(this,p)},this.valueModel&&this.valueModel.datePickerModel&&(y=c({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y);if(v.appendTo("#"+a+"_valuekey"+p),!n.value){var x=document.getElementById(a+"_valuekey"+p);this.updateRules(x,h,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},d.prototype.processBoolValues=function(e,n,r,i){var o,s,a,u,d=!1;if((0,t.isNullOrUndefined)(n.type)&&e&&(n.type=e.type),e.values){var p=e.values;"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=p[i].toLowerCase()===e.value.toString().toLowerCase():0===i&&(d=!0):d=p[i].toLowerCase()===n.value.toString().toLowerCase(),s=o=a=p[i]}else{p=[!0,!1];"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=p[i].toString().toLowerCase()===e.value.toString().toLowerCase():0===i&&(d="boolean"!=typeof n.value||!!n.value):d=p[i].toString().toLowerCase()===n.value.toString().toLowerCase(),"boolean"==typeof n.value&&1===i&&(d=!n.value),o=p[i].toString(),s=p[i],a=this.l10n.getConstant(["True","False"][i])}u={label:a,name:r+"default",checked:d,value:o,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.radioButtonModel&&(u=c({},u,this.valueModel.radioButtonModel));var h=new l.RadioButton(u);h.appendTo("#"+r+"_valuekey"+i),d&&this.updateRules(h.element,s,0,!0)},d.prototype.getOperatorIndex=function(e,t){var l,n=e.dataSource.length;for(l=0;l<n;l++)if(t.operator===e.dataSource[l].value)return l;return 0},d.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value?e.value:e.field)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},d.prototype.renderValues=function(e,l,n,r,i,o,s){var a=e.previousElementSibling.getElementsByTagName("input")[0],u="DropdownTree"===this.fieldMode?(0,t.getComponent)(a,"dropdowntree"):(0,t.getComponent)(a,"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);this.selectedRule=d;var p=(0,t.getComponent)(e.querySelector("input"),"dropdownlist");r&&(l=s.id.indexOf("operator")>-1?l:this.selectedRule).operators&&(p.value=null,p.dataBind(),p.dataSource=l.operators,p.index=this.getOperatorIndex(p,i),p.value=o.operator=p.dataSource[p.index].value,this.autoSelectOperator?p.dataBind():(p.index=-1,o.operator=p.value=""));var c=o.operator.toString(),h=!1;if(c.indexOf("null")>-1||c.indexOf("isempty")>-1||c.indexOf("isnotempty")>-1){(f=e.parentElement.querySelector(".e-rule-value"))&&((0,t.removeClass)([f],"e-show"),(0,t.addClass)([f],"e-hide"))}else{var g=(0,t.closest)(e,".e-rule-container").id;if((n=this.getPreviousItemData(n,d))&&void 0===n.template?n.columns&&(n=this.getColumn(i.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(i.field)),n&&n.template){this.templateDestroy(n,g+"_valuekey0");var m=(0,t.select)("#"+g+"_valuekey0",e.nextElementSibling);m&&!m.classList.contains("e-control")&&(0,t.detach)((0,t.select)("#"+g+"_valuekey0",e.nextElementSibling)),"string"!=typeof n.template&&void 0!==n.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([g]),e.nextElementSibling.innerHTML=""),this.isAngular&&!(0,t.isNullOrUndefined)(n.key)&&"DropdownTree"===this.fieldMode&&delete n.template}if(r&&(this.validateValue(i,(0,t.closest)(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||p&&""!==p.value){if(d&&(l.template=d.template),l.template&&((0,t.addClass)([e.nextElementSibling],"e-template-value"),l.template=d.template,h=this.setColumnTemplate(l,g,d.field,l.value||c,e,i)),h){var f=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?f.style.width="100%":f.style.width="200px"}else{(0,t.removeClass)([e.nextElementSibling],"e-template-value");var v=1;v="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:c&&c.toLowerCase().indexOf("between")>-1?2:1;for(var y=0;y<v;y++){var b=this.createElement("input",{attrs:{type:"text",id:g+"_valuekey"+y}});e.nextElementSibling.appendChild(b)}}this.renderControls(e,l,i,o,h),this.isAngular&&!(0,t.isNullOrUndefined)(l.key)&&l.template&&"DropdownTree"===this.fieldMode&&delete l.template}}},d.prototype.setColumnTemplate=function(e,l,n,r,i,o){var s,a=this,u=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return s={requestType:"value-template-initialize",ruleID:l,field:n,operator:r,rule:o,renderTemplate:!0},this.trigger("actionBegin",s,(function(t){u=a.actionBeginSuccessCallBack(t,e,l,n,i)})),u;var d=void 0,p=e.template;if((d="string"==typeof p.create?(0,t.getValue)(p.create,window)({field:n,operator:r}):p.create({field:n,operator:r}))instanceof Element)d.id=l+"_valuekey0",(0,t.addClass)([d],"e-template"),i.nextElementSibling.appendChild(d),n.indexOf(" ")<0&&(0,t.addClass)([d],"e-"+n);else if(d instanceof Array){(0,t.addClass)(d,"e-template");for(var c=0,h=d.length;c<h;c++)d[c].id=l+"_valuekey"+c,i.nextElementSibling.appendChild(d[c])}return(0,t.addClass)([i.nextElementSibling],"e-template-value"),!0}return!0},d.prototype.actionBeginSuccessCallBack=function(e,l,n,r,i){if(e.renderTemplate){var o=void 0;this.columnTemplateFn=this.templateParser((l.template,l.template));var s=this.element.id+r;if(this.isReact)o=this.columnTemplateFn(e,this,n,s)[0],i.nextElementSibling.appendChild(o);else if(this.isAngular){var a=this.columnTemplateFn(e,this,n,s);o=3===a[0].nodeType?a[1]:a[0],i.nextElementSibling.appendChild(o)}else this.isVue3?(o=this.columnTemplateFn(e,this,"Template",s),(0,t.append)(o,i.nextElementSibling)):(o=this.columnTemplateFn(e,this,"Template",s)[0],i.nextElementSibling.appendChild(o));return(0,t.addClass)([i.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},d.prototype.updateValues=function(e,l){var n=1;e.className.indexOf("e-template")>-1&&(n=3);var r,i,o,s,a,u,d=e.className.split(" e-")[n],p=parseInt(e.id.slice(-1),2);switch(d){case"checkbox":s=(0,t.getComponent)(e,d).value,l.value=""!==s?s:void 0;break;case"textbox":u=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[p]=u):l.value=u;break;case"dropdownlist":case"multiselect":l.value=(0,t.getComponent)(e,d).value;break;case"radio":(a=(0,t.getComponent)(e,d)).checked&&("boolean"==typeof l.value?l.value="true"===a.value:this.getColumn(l.field).values?l.value=a.value:l.value="true"===a.value),a.refresh();break;case"numerictextbox":l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[p]=(0,t.getComponent)(e,d).value):l.value=(0,t.getComponent)(e,d).value;break;case"datepicker":r=this.getColumn(l.field),i=this.getFormat(r.format),o=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[p]=this.intl.formatDate(o,i)):(0,t.isNullOrUndefined)(i.format)&&o?l.value=this.intl.formatDate(o):l.value=o?this.intl.formatDate(o,i):o}},d.prototype.updateRules=function(e,l,n,r){for(var i,o,s=(0,t.closest)(e,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e,".e-rule-container"),d=0,p=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;var h=a.rules[d].operator?a.rules[d].operator.toString():"",g=(u=(0,t.closest)(e,".e-rule-container")).id.replace(this.element.id+"_","");if((0,t.closest)(e,".e-rule-filter")||(0,t.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),i="DropdownTree"===this.fieldMode?(0,t.getComponent)(e,"dropdowntree"):(0,t.getComponent)(e,"dropdownlist");var m="DropdownTree"===this.fieldMode?this.getColumn(i.value[0]):this.getColumn(i.value);!this.isImportRules&&a.rules[d].field&&a.rules[d].field.toLowerCase()!==m.field.toLowerCase()&&(!u.querySelectorAll(".e-template")&&!(h.indexOf("null")>-1)||h.indexOf("empty")>-1)&&(a.rules[d].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),a.rules[d].field=this.selectedColumn.field,a.rules[d].type=this.selectedColumn.type,a.rules[d].label=this.selectedColumn.label;var f=(0,t.closest)(e,".e-rule-filter"),v=(f=f||(0,t.closest)(e,".e-rule-sub-filter")).nextElementSibling.querySelector("input.e-control");v=v||f.nextElementSibling.nextElementSibling.querySelector("input.e-control"),h=(0,t.getComponent)(v,"dropdownlist").value.toString(),a.rules[d].operator=h;var y=f.nextElementSibling.nextElementSibling,b=y.querySelectorAll("input.e-control");b.length<1&&(b=y.querySelectorAll("div.e-control")),b.length<1&&(b=y.querySelectorAll(".e-template")),o={groupID:p,ruleID:g,value:a.rules[d].field,type:"field"};for(var C=0;C<b.length;C++)h.indexOf("null")>-1||h.indexOf("empty")>-1?a.rules[d].value=null:this.updateValues(b[C],a.rules[d]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",o),this.allowValidation&&a.rules[d].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if((0,t.closest)(e,".e-rule-operator")){i=(0,t.getComponent)(e,"dropdownlist"),a.rules[d].operator=i.value.toString();var S=u.querySelectorAll(".e-rule-value input.e-control");o={groupID:p,ruleID:g,value:i.value,type:"operator"},this.allowValidation&&a.rules[d].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),S.length>1&&!(S[0].className.indexOf("e-template")>-1)&&(a.rules[d].value=[]);for(var x=0;x<S.length;x++)a.rules[d].operator.indexOf("null")>-1||a.rules[d].operator.indexOf("empty")>-1?a.rules[d].value=null:S[x].classList.contains("e-template")||this.updateValues(S[x],a.rules[d]);this.isImportRules||this.trigger("change",o),this.filterRules(c,this.getValidRules(this.rule),"operator")}else(0,t.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,d,s,u,n),r||this.filterRules(c,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.prvtEvtTgrDaD||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},d.prototype.ruleValueUpdate=function(e,t,l,n,r,i,o){var s,a,u=["in","between","notin","notbetween"];if(l.rules[n].operator&&(a=l.rules[n].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[n].type&&!this.isNotified){for(var d=[],p=t,c=0,h=p.length;c<h;c++)"string"==typeof p[c]&&d.push(parseFloat(p[c]));d.length&&(t=d)}if(this.isNotified)l.rules[n].value=t,s={groupID:r.id,ruleID:i.id,value:l.rules[n].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[n].value[o]=t:l.rules[n].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[n].type,l.rules[n].value=this.processValueString(t,l.rules[n].type)):"between"===a||"notbetween"===a?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t;else if(e.className.indexOf("e-datepicker")>-1){var g=this.getFormat(this.getColumn(this.selectedColumn.field).format);g.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=this.intl.formatDate(t,g)):l.rules[n].value=this.intl.formatDate(t,g))}this.validateValue(l,i,n)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t},d.prototype.validateValue=function(e,l,n){(0,t.isNullOrUndefined)(n)||(e=e.rules[n]);var r="object"==typeof e.value;if(this.allowValidation&&((0,t.isNullOrUndefined)(n)||(r?e.value.length>0:e.value))){var i=l.querySelectorAll(".e-rule-value .e-control");i.length>0&&(i[0].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(i[0],"tooltip").destroy():i[0].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[0].parentElement,"tooltip").destroy(),i[1]&&i[1].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[1].parentElement,"tooltip").destroy(),i[2]&&i[2].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[2].parentElement,"tooltip").destroy())}},d.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},d.prototype.findGroupByIdx=function(e,t,l){var n=t.rules,r=[];if(!l){for(var i=0,o=n.length;i<o;i++)(t=n[i]).rules&&r.push(t);return r[e]}return t},d.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var l,n,r,i;for(e.prototype.destroy.call(this),r=(l=this.element.querySelectorAll(".e-addrulegroup")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdown-btn").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")?(0,t.getComponent)(l[n],"dropdownlist").destroy():(0,t.getComponent)(l[n],"dropdowntree").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")&&((0,t.getComponent)(l[n],"dropdownlist").destroy(),(0,t.detach)(l[n]));for(i=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[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();var o=document.querySelectorAll(".qb-dropdownlist.e-popup");if(o)for(n=0;n<o.length;n++)o[n].remove();(0,t.classList)(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1}},d.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),n=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var r=0,i=e.length;r<i;r++)this.updatedRule={isLocked:e[r].isLocked,condition:e[r].condition,not:e[r].not},this.importRules(e[r],l,!1,e[r].not);this.isPublic=!1}else{var o="and",s=!1,a=!1;this.updatedRule&&(o=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?n.rules.push({condition:o,not:s,rules:[]}):n.rules.push({condition:o,rules:[]}):this.enableNotCondition?n.rules.splice(this.groupIndex+1,0,{condition:o,not:s,rules:[],isLocked:a}):n.rules.splice(this.groupIndex+1,0,{condition:o,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,n,null,!!this.enableSeparateConnector||null)}},d.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&(0,t.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableSeparateConnector&&(0,t.addClass)([this.element],"e-multi-connector"),this.enableRtl&&(0,t.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),t.Browser.isDevice||"Vertical"===this.displayMode?(t.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),(0,t.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),(0,t.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&&this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule);var e=(0,t.extend)({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns&&this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var l=this.element.querySelectorAll("label.e-btn"),n=void 0,r=0;r<l.length;r++)n=l.item(r),(0,t.rippleEffect)(n,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),n=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),n.appendChild(l),e.appendChild(n),this.element.appendChild(e)},d.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)},d.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortBy("field")))},d.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group")&&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()},d.prototype.notGroupRtl=function(){this.enableRtl?(0,t.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):(0,t.removeClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},d.prototype.checkNotGroup=function(e){var l;if(e.rules)for(var n=0;n<e.rules.length;n++)l=e.rules[n],l=this.checkNotGroup(l),e.rules[n]=l;return(0,t.isNullOrUndefined)(e.not)?this.enableNotCondition&&!(0,t.isNullOrUndefined)(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},d.prototype.onPropertyChanged=function(e,l){for(var n=Object.keys(e),r=this.element.querySelector(".e-group-container"),i=this.element.querySelector(".e-summary-content"),o=0,s=n;o<s.length;o++){switch(s[o]){case"summaryView":e.summaryView?(r.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),i=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),i.style.display="block"):(r.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),r.style.display="block",i.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":(0,t.isNullOrUndefined)(e.showButtons.lockGroup)||(e.showButtons.lockGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.lockRule)||(e.showButtons.lockRule?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneRule)||(e.showButtons.cloneRule?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.groupDelete)||(e.showButtons.groupDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":l.cssClass&&(0,t.removeClass)([this.element],l.cssClass.split(" ")),e.cssClass&&(0,t.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?((0,t.addClass)([this.element],"e-rtl"),this.notGroupRtl()):((0,t.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||(0,t.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 t.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();break;case"allowDragAndDrop":this.allowDragAndDrop=e.allowDragAndDrop,this.refresh();break;case"enableSeparateConnector":this.enableSeparateConnector=e.enableSeparateConnector,this.refresh()}}},d.prototype.preRender=function(){this.element.id=this.element.id||(0,t.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",In:"In",NotIn:"Not In",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required",SummaryViewTitle:"Summary View",OtherFields:"Other Fields",AND:"AND",OR:"OR",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof r.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new r.Query).take(1))):(this.dataManager=new r.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new r.Query),this.initControl()),this.renderComplete(),this.allowDragAndDrop&&this.initializeDrag()},d.prototype.initializeDrag=function(){this.draggable=new t.Draggable(this.element,{dragTarget:".e-drag-qb-rule",distance:5,helper:this.helper.bind(this),dragStart:this.dragStartHandler.bind(this),drag:this.dragHandler.bind(this),dragStop:this.dragStopHandler.bind(this),isReplaceDragEle:!0,isPreventSelect:!1,abort:".e-parent-header",isDragScroll:!0})},d.prototype.helper=function(e){var l=this.draggable.currentStateTarget;if(!l.classList.contains("e-drag-qb-rule")||l.classList.contains("e-drag-qb-rule")&&(0,t.closest)(l,".e-disable"))return!1;var n,r=this.createElement("div",{className:"e-cloneproperties e-draganddrop e-dragclone",styles:'height:"auto", z-index:2, width:'+this.element.offsetWidth});if(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header"))n=(0,t.closest)(l,".e-group-container").cloneNode(!0),(0,t.closest)(l,".e-group-container").classList.add("e-qb-dragging-rule");else{r.classList.add("e-group-body"),n=this.createElement("div",{className:"e-rule-container"});var i=(0,t.closest)(l,".e-rule-field").cloneNode(!0);n.appendChild(i),(0,t.closest)(l,".e-rule-field").classList.add("e-qb-dragging-rule")}return r.appendChild(n),r.querySelectorAll("*").forEach((function(e){e.removeAttribute("id")})),this.element.appendChild(r),r},d.prototype.dragStartHandler=function(e){this.draggedRule=e.target,this.isDragEventPrevent=!1,document.body.classList.add("e-prevent-select"),this.dragElement=e.dragElement;var l=(0,t.closest)(e.target,".e-rule-container"),n=(0,t.closest)(e.target,".e-group-container"),r={dragRuleID:null!==l?l.id:n.id,dragGroupID:n.id,cancel:!1};this.trigger("dragStart",r),this.isDragEventPrevent=r.cancel},d.prototype.dragHandler=function(e){if(!this.isDragEventPrevent){var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");if(l.forEach((function(e){e.classList.remove("e-drag-rule-bottom-line")})),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach((function(e){e.classList.remove("e-drag-rule-top-line")})),!(0,t.isNullOrUndefined)(e.target))if("HTML"===e.target.nodeName||(0,t.closest)(e.target,".e-qb-dragging-rule")||(0,t.closest)(e.target,".e-group-header")||!(0,t.closest)(e.target,"#"+this.element.id)||(0,t.closest)(e.target,".e-disable")||e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector)this.dragElement.classList.add("e-notallowedcur");else{this.dragElement.classList.remove("e-notallowedcur");var n=(0,t.closest)(e.target,".e-rule-container"),r=(0,t.closest)(e.target,".e-group-container");if(n){var i=n.getBoundingClientRect(),o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top,s=i.bottom-u;o<(a=20)?n.classList.add("e-drag-rule-top-line"):s<a&&n.classList.add("e-drag-rule-bottom-line")}else if(e.target.classList.contains("e-rule-list")&&0===e.target.children.length)e.target.classList.add("e-drag-rule-bottom-line");else if(e.target.classList.contains("e-rule-list")&&e.target.children[0].classList.contains("e-group-container")){i=e.target.children[0].getBoundingClientRect();(o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top)<(a=20)&&e.target.classList.add("e-drag-rule-top-line")}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&(r||(r=e.target),r.id.indexOf("group0")>-1)){i=e.target.getBoundingClientRect();var a,u=e.event.clientY||e.event.changedTouches[0].clientY;(s=i.bottom-u)<(a=20)&&e.target.classList.add("e-drag-rule-bottom-line")}var d={dragRuleID:null!==n?n.id:null!==r?r.id:null,dragGroupID:null!==r?r.id:null,cancel:!1};this.trigger("drag",d),this.isDragEventPrevent=d.cancel}}},d.prototype.dragStopHandler=function(e){var l=this;if(!this.isDragEventPrevent){var n,r,i=(0,t.closest)(e.target,".e-rule-container");if((0,t.isNullOrUndefined)(i)&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector&&(i=(0,t.closest)(e.target.parentElement.previousElementSibling,".e-rule-container")),(0,t.isNullOrUndefined)(e.helper)||(n=(0,t.closest)(e.helper,".e-notallowedcur")),!n){var o=(0,t.closest)(e.target,".e-group-container"),s={cancel:!1,dropRuleID:null!==i?i.id:null!==o?o.id:null,dropGroupID:null!==o?o.id:null};this.trigger("drop",s),s.cancel&&(n=!0),r=this.getValidRules()}this.prvtEvtTgrDaD=!0;var a=this.enableSeparateConnector&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")?e.target.parentElement.previousElementSibling:e.target;if(i&&!n){var u=i.id.split(this.element.id+"_")[1].split("_")[0];if(this.draggable.currentStateTarget.parentElement.classList.contains("e-rule-field")||this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")){var d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(i),[],!0)).properties&&(v=v.properties),(f=(0,t.closest)(i,".e-group-container")).querySelectorAll(".e-group-container").forEach((function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)}));for(var p=f.querySelectorAll(".e-rule-container"),c=[],h=void 0,g=0;g<p.length;g++)(p[g].classList.contains("e-drag-rule-top-line")||p[g].classList.contains("e-drag-rule-bottom-line"))&&(h=g),c.push(p[g].id.split(this.element.id+"_")[1]);this.deleteRules(c),i.classList.contains("e-drag-rule-top-line")?v.rules.splice(h,0,d):v.rules.splice(h+1,0,d),v.rules.forEach((function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],u):l.addRules([e],u):e.condition?l.addGroups([e],u):l.addRules([e],u)}))}}else if(a.classList.contains("e-rule-list")&&0===a.children.length&&!n){var m=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],m):this.addRules([d],m):d.condition?this.addGroups([d],m):this.addRules([d],m)}else if(a.classList.contains("e-rule-list")&&a.children[0].classList.contains("e-group-container")&&!n){var f,v,y=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(a),[],!0)).properties&&(v=v.properties),a.querySelectorAll(".e-group-container").forEach((function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)})),(p=f.querySelectorAll(".e-rule-container")).forEach((function(e){l.element.querySelector("#"+e.id)&&l.deleteRule(e)})),this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?this.addGroups([d],y):this.addRules([d],y),v.rules.forEach((function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],y):l.addRules([e],y):e.condition?l.addGroups([e],y):l.addRules([e],y)}))}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&!n){d=void 0;!(i=(0,t.closest)(e.target,".e-group-container"))&&e.target.classList.contains("e-group-container")&&(i=e.target),"group0"===(m=i.id.split(this.element.id+"_")[1].split("_")[0])&&(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],m):this.addRules([d],m):d.condition?this.addGroups([d],m):this.addRules([d],m))}n||this.trigger("ruleChange",{previousRule:r,rule:this.getValidRules(),type:"drag-and-drop"}),this.prvtEvtTgrDaD=!1,document.body.classList.remove("e-prevent-select");var b=this.element.querySelectorAll(".e-drag-rule-bottom-line");b.forEach((function(e){e.classList.remove("e-drag-rule-bottom-line")})),(b=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach((function(e){e.classList.remove("e-drag-rule-top-line")})),(b=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach((function(e){e.classList.remove("e-qb-dragging-rule")})),e.helper&&e.helper.classList.contains("e-cloneproperties")&&document.querySelector("."+e.helper.classList[0])&&(0,t.remove)(e.helper),this.enableSeparateConnector&&this.refresh()}},d.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?(0,t.compile)(document.querySelector(e).innerHTML.trim()):(0,t.compile)(e)}catch(l){return(0,t.compile)(e)}},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),n=new r.Deferred;l.then((function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()})).catch((function(e){n.reject(e)}))},d.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this),t.EventHandler.add(e,"focusout",this.focusEventHandler,this),t.EventHandler.add(e,"focusin",this.focusEventHandler,this),t.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this),t.EventHandler.add(document,"keydown",this.keyBoardHandler,this)},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler),t.EventHandler.remove(e,"focusout",this.focusEventHandler),t.EventHandler.remove(e,"focusin",this.focusEventHandler),t.EventHandler.remove(this.element,"keydown",this.keyBoardHandler),t.EventHandler.remove(document,"keydown",this.keyBoardHandler)},d.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],n=t?l.length-1:l.length,r=this.rule,i=0;i<n;i++)r=this.findGroupByIdx(l[i],r,0===i);return r},d.prototype.deleteGroup=function(e){var t,l=this,n=e;if("string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t),t=t.replace(this.element.id+"_","")):t=n.id.replace(this.element.id+"_",""),"group0"!==t&&e){var r={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteGroupSuccessCallBack(r,e):this.trigger("beforeChange",r,(function(t){l.deleteGroupSuccessCallBack(t,e)}))}},d.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){var n=l,r=this.getParentGroup(n,!0),i=0,o=void 0,s=void 0,a=this.getValidRules(this.rule),u=n.nextElementSibling,d=n.previousElementSibling,p=n.querySelectorAll(".e-group-container"),c=n.querySelectorAll(".e-tooltip");for(s=c.length,o=0;o<s;o++)(0,t.getComponent)(c[o],"tooltip").destroy();for(o=0,s=p.length;o<s;o++)delete this.levelColl[p[o].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!n.classList.contains("e-btn-group")||this.headerTemplate&&(n.classList.contains("e-rule-container")||n.classList.contains("e-group-container"))))&&i++;this.enableSeparateConnector||u&&u.className.indexOf("e-separate-rule")>-1&&((0,t.removeClass)([u],"e-separate-rule"),(0,t.addClass)([u],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&(0,t.addClass)([d],"e-prev-joined-rule"));var h=n.parentElement.parentElement.parentElement,g=[];if(this.isReact||this.isAngular){var m=r.rules[i],f=l.querySelectorAll(".e-rule-container");if(m&&m.rules)for(var v=0;v<m.rules.length;v++){var y=this.getColumn(m.rules[v].field);if(f[v]){var b=f[v].querySelector(".e-template-value");y&&(y.ruleTemplate||this.isPlatformTemplate(y)&&b)&&g.push(f[v].id)}}}(0,t.detach)(l),this.headerTemplate&&this.clearQBTemplate([l.id]),g.length&&this.clearQBTemplate(g),r.rules.splice(i,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(h,r),this.enableSeparateConnector&&d&&(!this.headerTemplate&&d.classList.contains("e-btn-group")||this.headerTemplate&&d.classList.contains("e-custom-group-btn"))&&(0,t.detach)(d),this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},d.prototype.deleteRule=function(e){var l=this,n={groupID:(0,t.closest)(e,".e-group-container").id.replace(this.element.id+"_",""),ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteRuleSuccessCallBack(n,e):this.trigger("beforeChange",n,(function(t){l.deleteRuleSuccessCallBack(t,e)}))},d.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=this.getParentGroup(n),i=(0,t.closest)(l,".e-rule-container"),o=this.getValidRules(this.rule),s=i.previousElementSibling,a=0,u=i,d=i.nextElementSibling,p=i.querySelectorAll(".e-tooltip"),c=void 0,h=p.length;for(c=0;c<h;c++)(0,t.getComponent)(p[c],"tooltip").destroy();for(;null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&a++;var g=this.getColumn(r.rules[a].field);g&&g.template&&u.querySelector(".e-template")&&this.templateDestroy(g,u.querySelector(".e-template").id),(!s||s.className.indexOf("e-rule-container")<0)&&d&&(0,t.removeClass)([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&s&&(0,t.removeClass)([s],"e-prev-joined-rule");var m=u.querySelector(".e-template-value");try{if(this.enableSeparateConnector&&(u.previousElementSibling||u.nextElementSibling)){var f=u.previousElementSibling,v=u.nextElementSibling;if((0,t.isNullOrUndefined)(v)&&(!this.headerTemplate&&f.classList.contains("e-btn-group")||this.headerTemplate&&f.classList.contains("e-custom-group-btn"))){if(f&&f.previousElementSibling&&f.previousElementSibling.classList.contains("e-rule-container"))this.getRule(f.previousElementSibling).condition=null;(0,t.detach)(f)}else(!this.headerTemplate&&v.classList.contains("e-btn-group")||this.headerTemplate&&v.classList.contains("e-custom-group-btn"))&&(0,t.detach)(v)}(0,t.detach)(u)}catch(e){return}g&&g.ruleTemplate&&this.clearQBTemplate([u.id]),g&&this.isPlatformTemplate(g)&&m&&this.clearQBTemplate([u.id]),r.rules.splice(a,1),r.rules[0]&&r.rules[0].rules||this.disableRuleCondition(n,r,!!this.enableSeparateConnector);for(var y=this.element.querySelectorAll(".e-tooltip"),b=0;b<y.length;b++)(0,t.getComponent)(y[b],"tooltip").refresh(y[b]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(o,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},d.prototype.keyBoardHandler=function(e){if(e.currentTarget!==this.element||!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode){if("Escape"===e.code&&this.allowDragAndDrop){this.isDragEventPrevent=!0,document.body.classList.remove("e-prevent-select");var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");l.forEach((function(e){e.classList.remove("e-drag-rule-bottom-line")})),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach((function(e){e.classList.remove("e-drag-rule-top-line")})),(l=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach((function(e){e.classList.remove("e-qb-dragging-rule")}));var n=this.element.querySelector(".e-cloneproperties");n&&(0,t.remove)(n),this.enableSeparateConnector&&this.refresh()}}else e.preventDefault()},d.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},d.prototype.disableRuleCondition=function(e,l,n,r){if(!this.headerTemplate){if(this.readonly)return;var i=e.querySelector(".e-rule-list").childElementCount,o=e.querySelector(".e-btngroup-and"),s=e.querySelector(".e-btngroup-or");if(i>1)if(o.disabled=!1,s.disabled=!1,(s.nextElementSibling.classList.contains("e-btn-disable")||o.nextElementSibling.classList.contains("e-btn-disable"))&&(s.nextElementSibling.classList.remove("e-btn-disable"),o.nextElementSibling.classList.remove("e-btn-disable")),this.enableSeparateConnector&&!n){for(var a=0,u=void 0;;){var d=e.parentElement.querySelectorAll(".e-btngroup-and"),p=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=p[p.length-(1+a)],!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}for(var c=e.previousElementSibling;c&&!c.classList.contains("e-rule-container");){if(c.classList.contains("e-group-container")){c=c.querySelectorAll(".e-rule-container")[c.querySelectorAll(".e-rule-container").length-1];break}c=c.previousElementSibling}if(r&&e.classList.contains("e-group-container"))c=e,"or"===this.getGroup(c).condition?s.checked=!0:o.checked=!0;else if(c&&c.classList.contains("e-rule-container")){var h=c.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition?s.checked=!0:o.checked=!0}}else n||(l&&"or"===l.condition?s.checked=!0:o.checked=!0);else if(this.enableSeparateConnector&&!n){for(a=0,u=void 0;;){d=e.parentElement.querySelectorAll(".e-btngroup-and"),p=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=p[p.length-(1+a)],!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}c=void 0;for(var g=e.previousElementSibling;g;){if(g.classList.contains("e-group-container")&&(g=g.querySelectorAll(".e-rule-container")[g.querySelectorAll(".e-rule-container").length-1]),g.classList.contains("e-rule-container")){c=g;break}g=g.previousElementSibling}if((0,t.isNullOrUndefined)(c)&&e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]&&(c=e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]),r&&e.classList.contains("e-group-container"))c=e,"or"===this.getGroup(c).condition?s.checked=!0:o.checked=!0;else if(c){h=c.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition&&s?s.checked=!0:o&&(o.checked=!0)}}else n||(0,t.isNullOrUndefined)(o)||(o.checked=!1,o.disabled=!0,s.checked=!1,s.disabled=!0,l&&(s.nextElementSibling.classList.add("e-btn-disable"),o.nextElementSibling.classList.add("e-btn-disable")))}},d.prototype.getValidRules=function(e){this.isValueEmpty=!0,e||(e=this.getRules());var l=e.condition,n=e.not,r=(0,t.extend)([],e.rules,[],!0),i=(0,t.isNullOrUndefined)(e.isLocked)?this.getRuleCollection({condition:l,rules:r,not:n},!0):this.getRuleCollection({condition:l,rules:r,not:n,isLocked:e.isLocked},!0);return this.isValueEmpty=!1,i},d.prototype.getRuleCollection=function(e,l){if((0,t.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||l))for(var r=e.rules.length,i=0;i<r;i++)n=e.rules[i],n=this.getRuleCollection(n,l),e.rules[i]=n,Object.keys(n).length<1&&l&&(e.rules.splice(i,1),i--,r--);var o=e.custom;if(e.field&&""!==e.field&&((0,t.isNullOrUndefined)(o)||o&&"question"!==o.type&&"answer"!==o.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&&(this.isValueEmpty?""!==e.value&&void 0!==e.value:void 0!==e.value)||o&&o.isQuestion){var s=e.condition,a=e.isLocked;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value},(0,t.isNullOrUndefined)(a)||(e.isLocked=a),s&&(e.condition=s),o&&(e.custom=o),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={}),("between"===e.operator||"notbetween"===e.operator)&&Array.isArray(e.value)&&(e.value.length<2||e.value.some((function(e){return""===e||null===e})))&&(e={})}else e={};else if(!o||"question"!==o.type&&"answer"!==o.type)if((0,t.isNullOrUndefined)(e.condition)&&(0,t.isNullOrUndefined)(e.rules))e={};else{var u=e.isLocked;e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},(0,t.isNullOrUndefined)(u)||(e.isLocked=u),o&&(e.custom=o),e.rules&&0===e.rules.length&&(e={})}else{var d=e.not;(e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules}).custom=o,this.enableNotCondition&&(e.not=d)}return e},d.prototype.setRules=function(e){var l=(0,t.extend)({},e,{},!0);this.headerTemplate?this.setGroupRules(l,!0):this.setGroupRules(l)},d.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},(0,t.isNullOrUndefined)(this.rule.isLocked)||(e.isLocked=this.rule.isLocked),this.rule.custom&&(e.custom=this.rule.custom),e},d.prototype.getRule=function(e){var l,n,r=0;if(e instanceof HTMLElement?l=(0,t.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,l=document.getElementById(n)),(0,t.isNullOrUndefined)(l))return null;for(var i=(0,t.closest)(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!l.classList.contains("e-btn-group")||this.headerTemplate&&(l.classList.contains("e-rule-container")||l.classList.contains("e-group-container"))))&&r++;return o.rules[r]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=(0,t.closest)(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(l)},d.prototype.deleteGroups=function(e){var t,l,n=e.length;for(t=0;t<n;t++)"group0"!==e[t]&&(l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l)))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),l=(0,t.isNullOrUndefined)(e)?new r.Query:(new r.Query).where(e);return this.dataManager.executeQuery(l)},d.prototype.deleteRules=function(e){var t,l,n=e.length;for(t=0;t<n;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],n=0,i=Object.keys(this.columns);n<i.length;n++)l.push(this.columns[n].field);return e.rules.length?(new r.Query).select(l).where(t):(new r.Query).select(l)},d.prototype.getPredicate=function(e){var l,n,i,o,s=e.rules,a=!1;if(!s)return l;for(var u=0,d=s.length;u<d;u++){var p=s[u].operator;if("notstartswith"===p?p="doesnotstartwith":"notendswith"===p?p="doesnotendwith":"notcontains"===p&&(p="doesnotcontain"),a=!1,Object.keys(s[u]).indexOf("rules")>-1&&s[u].rules)(n=this.getPredicate(s[u]))&&(l=l?"and"===e.condition?l.and(n):l.or(n):n);else if(!(0,t.isNullOrUndefined)(p)&&!(0,t.isNullOrUndefined)(p.length)){var c=s[u].operator.toLowerCase(),h=!1,g=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===s[u].type&&(a=!this.matchCase),"date"===s[u].type&&g.indexOf(c)>-1&&(a=!0),o=this.getColumn(s[u].field),c.indexOf("null")>-1||c.indexOf("empty")>-1)s[u].value=null;else if("date"!==s[u].type||s[u].value instanceof Array)i=s[u].value;else{var m=this.getFormat(o.format);(0,t.isNullOrUndefined)(s[u].value)?i=null:(i=this.getDate(s[u].value,m),g.indexOf(c)>-1&&!this.isTime(s[u].value)&&(h=!0))}if(0===u)if(h||(c.indexOf("in")>-1||c.indexOf("between")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contain")<0)l=h?this.datePredicate(s[u],i):this.arrayPredicate(s[u]);else""!==(f=i)&&(l=new r.Predicate(s[u].field,p,i,a));else if(h||(c.indexOf("in")>-1||c.indexOf("between")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contain")<0)l=h?this.datePredicate(s[u],i,l,e.condition):this.arrayPredicate(s[u],l,e.condition);else if("and"===e.condition){var f=i;l&&""!==f?l=l.and(s[u].field,p,i,a):""!==f&&(l=new r.Predicate(s[u].field,p,i,a))}else{f=i;l&&""!==f?l=l.or(s[u].field,p,i,a):""!==f&&(l=new r.Predicate(s[u].field,p,i,a))}}}return this.dataSource instanceof r.DataManager&&((0,t.isNullOrUndefined)(l)||"isnull"!==l.operator&&"isnotnull"!==l.operator||(l.operator="isnull"===l.operator?"equal":"notequal")),l},d.prototype.getLocale=function(){var e=this.locale;return(0,t.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",t.cldrData)||(e="en"),e},d.prototype.getColumn=function(e,t){for(var l,n=this.columns,r=0,i=(n=t||n).length;r<i;r++){if(n[r].field===e){l=n[r];break}if(n[r].columns){if(l=this.getColumn(e,n[r].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&n[r].field===e.split(this.separator)[0]){l=n[r];break}}return l},d.prototype.getOperators=function(e){return this.getColumn(e).operators},d.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},d.prototype.datePredicate=function(e,t,l,n){var i,o=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":i=(i=new r.Predicate(e.field,"greaterthanorequal",o)).and(e.field,"lessthanorequal",s);break;case"notequal":i=(i=new r.Predicate(e.field,"lessthan",o)).or(e.field,"greaterthan",s);break;case"greaterthan":i=new r.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":i=new r.Predicate(e.field,"greaterthanorequal",o);break;case"lessthan":i=new r.Predicate(e.field,"lessthan",o);break;case"lessthanorequal":i=new r.Predicate(e.field,"lessthanorequal",s)}return i&&(l?"and"===n?l=l.and(i):"or"===n&&(l=l.or(i)):l=i),l},d.prototype.arrayPredicate=function(e,t,l){var n,i=e.value,o=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(o.indexOf("null")>-1||o.indexOf("empty")>-1)switch(o){case"isnull":n=new r.Predicate(e.field,"isnull",s);break;case"isnotnull":n=new r.Predicate(e.field,"isnotnull",s);break;case"isempty":n=new r.Predicate(e.field,"equal","");break;case"isnotempty":n=new r.Predicate(e.field,"notequal","")}if(!(o.indexOf("null")>-1||o.indexOf("empty")>-1))for(var d=0,p=i.length;d<p;d++)if(""!==i[d]||("in"===o||"notin"===o)&&"string"===a.type)if(0===d){var c="greaterthanorequal";switch(o){case"between":n="date"!==a.type?new r.Predicate(e.field,c,i[d]):new r.Predicate(e.field,c,i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null);break;case"notbetween":n="date"===a.type?new r.Predicate(e.field,"lessthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null):new r.Predicate(e.field,"lessthan",i[d]);break;case"in":n=new r.Predicate(e.field,"equal",i[d]);break;case"notin":n=new r.Predicate(e.field,"notequal",i[d])}}else{switch(e.operator){case"between":n="date"===a.type?n.and(e.field,"lessthanorequal",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.and(e.field,"lessthanorequal",i[d]);break;case"notbetween":n="date"===a.type?n.or(e.field,"greaterthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.or(e.field,"greaterthan",i[d]);break;case"in":n=n.or(e.field,"equal",i[d]);break;case"notin":n=n.and(e.field,"notequal",i[d])}}return n&&(t?"and"===l?t=t.and(n):"or"===l&&(t=t.or(n)):t=n),t},d.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&((l=new Date).setHours(parseInt(e.split(":")[0],10)),l.setMinutes(parseInt(e.split(":")[1],10)),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2],10))),l},d.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},d.prototype.importRules=function(e,l,n,r,i){if(n){if(e.rules&&e.rules.length>1&&!this.headerTemplate){var o=l.querySelector(".e-btngroup-or"),s=l.querySelector(".e-btngroup-and");if(this.enableSeparateConnector&&l.previousElementSibling&&(o=l.previousElementSibling.querySelector(".e-btngroup-or"),s=l.previousElementSibling.querySelector(".e-btngroup-and")),o.disabled=!1,s.disabled=!1,this.enableSeparateConnector){for(var a=l.previousElementSibling;a&&!a.classList.contains("e-rule-container");){if(a.classList.contains("e-group-container")){a=a.querySelectorAll(".e-rule-container")[a.querySelectorAll(".e-rule-container").length-1];break}a=a.previousElementSibling}if(a&&a.classList.contains("e-rule-container")){var u=a.id.replace(this.element.id+"_","");"or"===this.getRule(u).condition?o.checked=!0:s.checked=!0}}else"or"===e.condition?o.checked=!0:s.checked=!0}else this.disableRuleCondition(l);if(this.headerTemplate&&i&&(l=this.renderGroup(e,e.condition,this.element,e.not,i)),this.enableNotCondition&&!this.headerTemplate){var d=l.querySelector(".e-qb-toggle");e.not?(0,t.addClass)([d],"e-active-toggle"):(0,t.removeClass)([d],"e-active-toggle")}}else l=this.renderGroup(e,e.condition,l,r);e.rules&&0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var p=e.rules;if(!(0,t.isNullOrUndefined)(p))for(var c=0,h=p.length;c<h;c++){var g=Object.keys(p[c]);if(!(0,t.isNullOrUndefined)(p[c].rules)&&g.indexOf("rules")>-1&&0!==p[c].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;l=this.renderGroup(p[c],p[c].condition,l,p[c].not),l=this.importRules(p[c],l,!0)}else this.renderRule(p[c],l);if(!(0,t.isNullOrUndefined)(p[c].rules)&&p[c].isLocked){var m=l.querySelector(".e-rule-list").children[c].querySelector(".e-lock-grp-btn");this.groupLock(m)}}return l&&(l=(0,t.closest)(l,".e-rule-list")),l&&(l=(0,t.closest)(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t,l,n,r){this.addGroupElement(!0,l,t,!1,n,r,e);var i=l.querySelectorAll(".e-group-container"),o=l.querySelector(".e-rule-list").children;if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup){this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1;var s=0,a=this.groupIndex+1;if(this.enableSeparateConnector)for(var u=0;u<a;u++)o[u].classList.contains("e-rule-container")&&(a++,s++);return o[this.groupIndex+s+1]}return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,o[o.length-1]):i[i.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.enableReadonly=function(){for(var e=this.element.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),r=0;r<e.length;r++){if(e[r].classList.contains("e-dropdownlist"))(0,t.getInstance)(e[r],n.DropDownList).readonly=this.isReadonly;else if(e[r].classList.contains("e-dropdowntree")){(0,t.getComponent)(e[r],"dropdowntree").readonly=this.isReadonly}else if(e[r].classList.contains("e-numerictextbox")){(0,t.getInstance)(e[r],i.NumericTextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-textbox")){(0,t.getInstance)(e[r],i.TextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-datepicker")){(0,t.getInstance)(e[r],o.DatePicker).readonly=this.isReadonly}else if(e[r].classList.contains("e-multiselect")){(0,t.getInstance)(e[r],n.MultiSelect).readonly=this.isReadonly}else if(e[r].classList.contains("e-radio")){(0,t.getInstance)(e[r],l.RadioButton).checked||(this.isReadonly?e[r].parentElement.style.display="none":e[r].parentElement.style.display="inherit")}}var s=this.element.querySelectorAll(".e-deletegroup"),a=this.element.querySelectorAll(".e-addrulegroup"),u=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");var d=[s,a,u];for(r=0;r<d.length;r++)d[r].forEach((function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")}));this.enableBtnGroup()},d.prototype.enableBtnGroup=function(){var e=this,t=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;t.forEach((function(t){!t.classList.contains("e-qb-toggle")||t.classList.contains("e-active-toggle")||t.classList.contains("e-readonly")?t.classList.contains("e-qb-toggle")&&t.classList.contains("e-not-readonly")?t.classList.remove("e-not-readonly"):t.classList.contains("e-qb-toggle")&&t.classList.contains("e-readonly")?t.classList.remove("e-readonly"):t.classList.contains("e-active-toggle")?(t.classList.add("e-not-readonly"),l=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),l?"AND"===t.textContent?t.classList.add("e-readonly-and"):t.classList.add("e-readonly-or"):("AND"===t.textContent&&e.isReadonly?(t.classList.remove("e-not"),t.classList.add("e-readonly-and")):(e.enableNotCondition&&t.classList.add("e-not"),t.classList.remove("e-readonly-and")),"OR"===t.textContent&&e.isReadonly?t.classList.add("e-readonly-or-not"):t.classList.remove("e-readonly-or-not"))):t.classList.contains("e-btn-disable")||t.classList.add("e-readonly"):(t.classList.add("e-readonly"),l=!1)}))},d.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,n=t.length;l<n;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},d.prototype.getSqlString=function(e,t,l,n){var r=!1;l||""===l?l+="(":(l="",r=!0);var i=e.condition;if(e.not){l+=r?n?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (":n?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT ("}if(e.rules)for(var o=0,s=e.rules.length;o<s;o++){if(e.rules[o].rules)l=this.getSqlString(e.rules[o],t,l,n),this.enableSeparateConnector&&(i=e.rules[o].condition);else{var a=e.rules[o],u="",d=n?this.sqlOperators[a.operator]:this.operators[a.operator];if(a.value instanceof Array)if(a.operator.toString().indexOf("between")>-1){var p=n?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==a.type||this.isDateFunction(a.value[0])?u+=a.value[0]+p+a.value[1]:u+='"'+a.value[0]+'"'+p+'"'+a.value[1]+'"'}else if("string"==typeof a.value[0]&&null!==a.value){u+='("'+a.value[0]+'"';for(var c=1,h=a.value.length;c<h;c++)u+=',"'+a.value[c]+'"';u+=")"}else u+="("+a.value+")";else a.operator.toString().indexOf("startswith")>-1?u+=a.value?'("'+a.value+'%")':"("+a.value+")":a.operator.toString().indexOf("endswith")>-1?u+=a.value?'("%'+a.value+'")':"("+a.value+")":a.operator.toString().indexOf("contains")>-1?u+=a.value?'("%'+a.value+'%")':"("+a.value+")":"number"===a.type||"boolean"==typeof a.value||null===a.value&&a.operator.toString().indexOf("empty")<-1?u+=a.value:a.operator.toString().indexOf("empty")>-1?u+='""':u+='"'+a.value+'"';if(a.operator.toString().indexOf("null")>-1)t?a.field="`"+a.field+"`":a.field.indexOf(" ")>-1&&(a.field='"'+a.field+'"'),l+=a.field+" "+d;else{var g=d;"isempty"===a.operator?g="=":"isnotempty"===a.operator&&(g="!="),t?a.field="`"+a.field+"`":a.field.indexOf(" ")>-1&&(a.field='"'+a.field+'"'),l+=a.field+" "+g+" "+u}a.condition&&""!==a.condition&&(i=a.condition)}if(o!==s-1){a=e.rules[o];(""===i||a&&""!==a.condition&&a.custom&&a.custom.isCustom)&&(i=a.condition),i&&(l+=" "+(i=n?this.l10n.getConstant(i.toUpperCase()).toUpperCase():i.toUpperCase())+" ")}}return r||(l+=")"),e.not&&(l+=")"),l},d.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},d.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},d.prototype.getSqlFromRules=function(e,t,l){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},d.prototype.getParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.setMongoQuery=function(e,t){this.moduleLoader.loadedModules.length?(this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getMongoQuery=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),""},d.prototype.cloneRule=function(e,t,l){var n=this.getRule(e.replace(this.element.id+"_","")),r=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:n.label,field:n.field,type:n.type,operator:n.operator,value:n.value,condition:n.condition}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=r,r=!1},d.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var n=this.getGroup(t),r=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=r,r=!1},d.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},d.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},d.prototype.sqlParser=function(e,t){var l,n=0;do{l=e.slice(n),n+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},d.prototype.parseSqlStrings=function(e,t){var l,n,r,i,o=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"],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 s=0,a=o.length;s<a;s++){if(r=/^\w+$/.test(o[s])?"\\b":"",new RegExp("^("+o[s]+")"+r,"ig").exec(e))return this.parser.push(["Operators",o[s].toLowerCase()]),o[s].length}var u=this.parser[this.parser.length-1];if(!u||u&&"Literal"!==u[0])for(s=0,a=l.length;s<a;s++){if(r=/^\w+$/.test(l[s])?"\\b":"",new RegExp("^("+l[s]+")"+r,"ig").exec(e))return this.parser.push(["Conditions",l[s].toLowerCase()]),l[s].length}for(s=0,a=n.length;s<a;s++){if(r=/^\w+$/.test(n[s])?"\\b":"",new RegExp("^("+n[s]+")"+r,"ig").exec(e))return this.parser.push(["SubOperators",n[s].toLowerCase()]),n[s].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 i=/^(true|false)/.exec(e)[0],this.parser.push(["String",i]),i.length;if(/^null/.exec(e))return i=/^null/.exec(e)[0],this.parser.push(["String",null]),i.length;if(/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e))return i=/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e))return i=/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length+2;if(this.checkNumberLiteral(e,t)){var d=/^[0-9]+(\.[0-9]+)$/.exec(e);if(d)return i=d[0],this.parser.push(["Literal",i]),i.length}var p=this.getSingleQuoteString(e);if(""!==p){if("("===(i=p)[i.length-2])for(var c=!1,h=i.length;h<e.length&&(i+=e[h],")"===e[h]&&(c=!0),!c||"'"!==e[h]);h++);else e[i.length]&&")"!==e[i.length]&&!this.checkCondition(e,i)&&(i=this.combineSingleQuoteString(e,i));return this.parser.push(["String",i]),i.length}var g=this.getDoubleQuoteString(e);return""!==g?(i=g,this.parser.push(["DoubleString",i]),i.length):/^\d*\.?\d+/.exec(e)?(i=/^\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):/^-?\d*\.?\d+/.exec(e)?(i=/^-?\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):1},d.prototype.getDoubleQuoteString=function(e){var t=e.indexOf('"');if(0===t){var l=e.indexOf('"',t+1);if(-1!==l)return e.substring(t,l+1)}return""},d.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},d.prototype.getSingleQuoteString=function(e,t){var l=e.indexOf("'");if(-1!==l&&t||0===l&&!t){var n=e.indexOf("'",l+1);if(-1!==n)return e.substring(l,n+1)}return""},d.prototype.combineSingleQuoteString=function(e,t){if(e[t.length]&&")"!==e[t.length]&&!this.checkCondition(e,t)&&","!==e[t.length]){var l=t.substring(0,t.length-1),n=e.replace(l,""),r=this.getSingleQuoteString(n,!0);if(""!==r)t+=r.substring(1,r.length),t=this.combineSingleQuoteString(e,t)}return t},d.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},d.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(?:\.[0-9]+)$/.exec(e)){var n=this.parser[this.parser.length-2],r=this.parser[this.parser.length-3];if("Left"===l[0]&&n&&"Conditions"===n[0])return!0;var i=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&r&&r[1].indexOf(i)<0)return!0}return!1},d.prototype.getOperator=function(e,t,l){if(l){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]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[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{"=":"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"}[""+t]},d.prototype.getTypeFromColumn=function(e){var l=this.getColumn(e.field);return(0,t.isNullOrUndefined)(l)?null:l.type},d.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var n=e.split(this.separator),r=0;r<n.length;r++)t+=this.getLabelFromField(n,r+1),++l<n.length&&(t+=this.separator);return t}return this.getColumn(e).label},d.prototype.getLabelFromField=function(e,t){for(var l="",n=0,r=0;r<t;r++)l+=e[r],++n<t&&(l+=this.separator);return this.getColumn(l).label},d.prototype.processParser=function(e,t,l,n){for(var r,i,o,s,a,u,d,p,c,h,g=[],m=[],f=!1,v=!1,y=0,b=e.length;y<b;y++)if("Literal"===e[y][0]){var C=this.getColumn(e[y][1]);if(o={label:C&&C.label?C.label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){if(e[y+1][1].indexOf("null")>-1||e[y+1][1].indexOf("empty")>-1)o.operator=this.getOperator(" ",e[y+1][1],n),o.value=null,o.type=this.getTypeFromColumn(o);else{var S=e[y+3][1]?e[y+3][1].replace(/'/g,""):e[y+3][1];o.operator=this.getOperator(S,e[y+1][1],n)}for(h=e[y+1][1],r=++y+1,i=b,n&&"contains"===o.operator||"startswith"===o.operator||"endswith"===o.operator?h="like":n&&"notcontains"===o.operator||"notstartswith"===o.operator||"notendswith"===o.operator?h="not like":n&&(h=o.operator),r=y+1;r<i;r++)if(h.indexOf("between")<0&&"Left"===e[r][0])f=!0;else{if("Right"===e[r][0]&&f){y=r,f=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[r][0]){var x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),x=x?x.replace(/%/g,""):e[r][1],o.value=x,o.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[r][0]||"Left"===e[r][0])break;if("Number"===e[r][0])g.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),m.push(x)}}else if("Number"===e[r][0])g.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),m.push(x)}o.type=this.getTypeFromColumn(o)}h.indexOf("like")<0&&("Number"===e[r-1][0]?(o.value=g,o.type="number"):"String"===e[r-1][0]?(o.value=m,o.type="string"):h.indexOf("between")>-1&&"Conditions"===e[r-1][0]&&(0!==m.length?(o.value=m,o.type="string"):(o.value=g,o.type="number")),g=[],m=[],o.type=this.getTypeFromColumn(o)),this.enableSeparateConnector&&"Conditions"===e[y+1][0]&&(o.condition=e[y+1][1])}else if("Operators"===e[y+1][0]){if(o.operator=this.getOperator(e[y+2][1],e[y+1][1],n),"equal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]?o.operator="isempty":"notequal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]&&(o.operator="isnotempty"),"Number"===e[y+2][0])o.type="number",o.value=Number(e[y+2][1]);else o.type="string",(x=e[y+2][1])&&"'"===x[0]&&(x=x.substring(1,x.length-1)),o.value=x;this.enableSeparateConnector&&"Conditions"===e[y+3][0]&&(o.condition=e[y+3][1]),o.type=this.getTypeFromColumn(o)}t.rules.push(o)}else{if("Left"===e[y][0]){if("Left"!==e[0][0]&&("not"===e[y-1][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y-1][1])){v=!0;continue}for(this.parser=e.splice(y+1,b-(y+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},c=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&c++;return l.push(c),t.rules.push(s),s=this.processParser(this.parser,s,l,n),t}if("Conditions"!==e[y][0]||this.enableSeparateConnector){if("Right"===e[y][0]){if(v&&"Right"===e[y+1][0]){v=!1;continue}for(this.parser=e.splice(y+1,b-(y+1)),l.pop(),t=this.rule,p=l.length,d=0;d<p;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,n)}}else"not"===e[y][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y][1]?t.not=!0:t.condition=e[y][1]}return t},d.prototype.groupClone=function(e){var t=e.closest(".e-rule-list").closest(".e-group-container"),l=e.id.replace(this.element.id+"_",""),n=t.id.replace(this.element.id+"_",""),r=this.getGroup(l);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:r.condition,not:r.not,rules:r.rules}],n),this.groupIndex=-1},d.prototype.ruleClone=function(e){for(var l=(0,t.closest)(e,".e-rule-container"),n=e.closest(".e-rule-list").closest(".e-group-container"),r=this.getRule(e),i=n.id.replace(this.element.id+"_",""),o=n.querySelectorAll(".e-rule-container"),s=0,a=o.length;s<a;s++)l.id===o[s].id&&(this.ruleIndex=s);this.enableSeparateConnector?this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value,condition:r.condition}],i):this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value}],i),this.ruleIndex=-1},d.prototype.ruleLock=function(e){var l=(0,t.closest)(e,".e-rule-container"),n=this.getRule(l.id.replace(this.element.id+"_",""));l.classList.contains("e-disable")?(n.isLocked=!1,this.lockItems=this.lockItems.filter((function(e){return e!==l.id})),l.classList.remove("e-disable"),this.disableRuleControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(n.isLocked=!0,this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableRuleControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},d.prototype.groupLock=function(e){var l=(0,t.closest)(e,".e-group-container"),n=this.getGroup(l.id.replace(this.element.id+"_","")),r=l.id.indexOf("group0")>-1;if(l.classList.contains("e-disable")){if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!1,this.setProperties({rule:i},!0);else n.isLocked=!1;this.lockItems=this.lockItems.filter((function(e){return e!==l.id})),l.classList.remove("e-disable"),this.disableHeaderControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{var i;if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!0,this.setProperties({rule:i},!0);else n.isLocked=!0;this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableHeaderControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},d.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var l=this.element.querySelector("#"+this.lockItems[e]),n=l.querySelector(".e-lock-rule-btn");(l=(0,t.closest)(n,".e-rule-container")).classList.contains("e-disable")||this.ruleLock(n)}else{var r=this.element.querySelector("#"+this.lockItems[e]);n=r.querySelector(".e-lock-grp-btn");(r=(0,t.closest)(n,".e-group-container")).classList.contains("e-disable")||this.groupLock(n)}}},d.prototype.disableHeaderControls=function(e,t,l){for(var n=t.querySelectorAll(".e-btngroup-and"),r=t.querySelectorAll(".e-btngroup-or"),i=t.querySelectorAll(".e-qb-toggle"),o=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),p=t.querySelectorAll(".e-add-condition-btn"),c=t.querySelectorAll(".e-add-group-btn"),h=0;h<n.length;h++)l?(d[h]&&d[h].classList.contains("e-disable")&&d[h].classList.add("e-disable"),n[h].disabled=!0,r[h].disabled=!0,o[h]&&(o[h].disabled=!0),p[h]&&(p[h].disabled=!0),c[h]&&(c[h].disabled=!0),i[h]&&(i[h].disabled=!0),s[h]&&(s[h].disabled=!0),u[h]&&(u[h].disabled=!0),n[h].parentElement.classList.add("e-disabled"),a[h]&&a[h]!==e&&(a[h].disabled=!0,a[h].children[0].classList.remove("e-unlock"),a[h].children[0].classList.add("e-lock"))):(d[h]&&d[h].classList.remove("e-disable"),n[h].disabled=!1,r[h].disabled=!1,o[h]&&(o[h].disabled=!1),p[h]&&(p[h].disabled=!1),c[h]&&(c[h].disabled=!1),a[h]&&(a[h].disabled=!1),i[h]&&(i[h].disabled=!1),s[h]&&(s[h].disabled=!1),u[h]&&(u[h].disabled=!1),n[h].parentElement.classList.remove("e-disabled"),a[h]&&a[h].children[0].classList.remove("e-lock"),a[h]&&a[h].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},d.prototype.disableRuleControls=function(e,l,n){for(var r=l.querySelectorAll(".e-control.e-dropdownlist"),i=l.querySelectorAll(".e-control.e-numerictextbox"),o=l.querySelectorAll(".e-control.e-textbox"),s=l.querySelectorAll(".e-control.e-datepicker"),a=l.querySelectorAll(".e-control.e-checkbox"),u=l.querySelectorAll(".e-control.e-radio"),d=l.querySelectorAll(".e-control.e-multiselect"),p=l.querySelectorAll(".e-rule-delete"),c=l.querySelectorAll(".e-lock-rule"),h=l.querySelectorAll(".e-clone-rule"),g=l.querySelectorAll(".e-rule-container"),m=0;m<p.length;m++)n?(g[m]&&g[m].classList.contains("e-disable")&&g[m].classList.add("e-disable"),p[m].disabled=!0,h[m]&&(h[m].disabled=!0),c[m]!==e&&(c[m].disabled=!0,c[m].children[0].classList.remove("e-unlock"),c[m].children[0].classList.add("e-lock"))):(g[m]&&g[m].classList.remove("e-disable"),h[m]&&(h[m].disabled=!1),p[m].disabled=!1,c[m].disabled=!1,c[m].children[0].classList.remove("e-lock"),c[m].children[0].classList.add("e-unlock"));for(m=0;m<r.length;m++)(0,t.getComponent)(r[m],"dropdownlist").enabled=!n;for(m=0;m<i.length;m++)(0,t.getComponent)(i[m],"numerictextbox").enabled=!n;for(m=0;m<o.length;m++)(0,t.getComponent)(o[m],"textbox").enabled=!n;for(m=0;m<s.length;m++)(0,t.getComponent)(s[m],"datepicker").enabled=!n;for(m=0;m<a.length;m++)(0,t.getComponent)(a[m],"checkbox").disabled=!!n;for(m=0;m<u.length;m++)(0,t.getComponent)(u[m],"radio").disabled=!!n;for(m=0;m<d.length;m++)(0,t.getComponent)(d[m],"multiselect").enabled=!n},h([(0,t.Event)()],d.prototype,"created",void 0),h([(0,t.Event)()],d.prototype,"actionBegin",void 0),h([(0,t.Event)()],d.prototype,"beforeChange",void 0),h([(0,t.Event)()],d.prototype,"change",void 0),h([(0,t.Event)()],d.prototype,"dataBound",void 0),h([(0,t.Event)()],d.prototype,"ruleChange",void 0),h([(0,t.Event)()],d.prototype,"dragStart",void 0),h([(0,t.Event)()],d.prototype,"drag",void 0),h([(0,t.Event)()],d.prototype,"drop",void 0),h([(0,t.Complex)({},v)],d.prototype,"showButtons",void 0),h([(0,t.Property)(!1)],d.prototype,"summaryView",void 0),h([(0,t.Property)(!1)],d.prototype,"allowValidation",void 0),h([(0,t.Property)("Default")],d.prototype,"fieldMode",void 0),h([(0,t.Property)([])],d.prototype,"columns",void 0),h([(0,t.Property)(null)],d.prototype,"fieldModel",void 0),h([(0,t.Property)(null)],d.prototype,"operatorModel",void 0),h([(0,t.Property)(null)],d.prototype,"valueModel",void 0),h([(0,t.Property)()],d.prototype,"headerTemplate",void 0),h([(0,t.Property)("")],d.prototype,"cssClass",void 0),h([(0,t.Property)([])],d.prototype,"dataSource",void 0),h([(0,t.Property)("Horizontal")],d.prototype,"displayMode",void 0),h([(0,t.Property)(!1)],d.prototype,"enablePersistence",void 0),h([(0,t.Property)("Default")],d.prototype,"sortDirection",void 0),h([(0,t.Property)(5)],d.prototype,"maxGroupCount",void 0),h([(0,t.Property)("auto")],d.prototype,"height",void 0),h([(0,t.Property)("auto")],d.prototype,"width",void 0),h([(0,t.Property)(!1)],d.prototype,"matchCase",void 0),h([(0,t.Property)(0)],d.prototype,"immediateModeDelay",void 0),h([(0,t.Property)(!1)],d.prototype,"enableNotCondition",void 0),h([(0,t.Property)(!1)],d.prototype,"readonly",void 0),h([(0,t.Property)(!0)],d.prototype,"addRuleToNewGroups",void 0),h([(0,t.Property)(!1)],d.prototype,"autoSelectField",void 0),h([(0,t.Property)(!0)],d.prototype,"autoSelectOperator",void 0),h([(0,t.Property)("")],d.prototype,"separator",void 0),h([(0,t.Property)(!1)],d.prototype,"enableSeparateConnector",void 0),h([(0,t.Complex)({condition:"and",rules:[]},m)],d.prototype,"rule",void 0),h([(0,t.Property)(!1)],d.prototype,"allowDragAndDrop",void 0),d=h([t.NotifyPropertyChanges],d)}(t.Component),b=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,n=0;return e.forEach((function(r){n++,t+="{",void 0!==r.rules&&("or"===r.condition?(t+=' "$or":[',t=l.convertMongoQuery(r.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(r.rules,t)+"]"));var i="string"===r.type&&"in"!==r.operator&&"notin"!==r.operator&&r.value&&""!==r.value.trim()?r.value.replace(/'/g,"\\"):"";"string"!==r.type||"in"!==r.operator&&"notin"!==r.operator||!r.value||1!==r.value.length||(i=r.value[0].replace(/'/g,"\\"));var o=r.field?r.field.substring(0):"";switch(r.operator){case"contains":t+='"'+o+'":{"$regex":"'+i+'"}';break;case"notcontains":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'"}}';break;case"startswith":t+='"'+o+'":{"$regex":"^'+i+'"}';break;case"notstartswith":t+='"'+o+'":{"$not":{"$regex":"^'+r.value+'"}}';break;case"endswith":t+='"'+o+'":{"$regex":"'+i+'$"}';break;case"notendswith":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'$"}}';break;case"isnull":t+='"'+o+'": null';break;case"isnotnull":t+='"'+o+'":{"$ne": null}';break;case"isempty":t+='"'+o+'": ""';break;case"isnotempty":t+='"'+o+'":{"$ne": ""}';break;case"equal":"string"===r.type?t+='"'+o+'":"'+i+'"':"date"===r.type?t+='"'+o+'":"'+r.value+'"':(r.type,t+='"'+o+'":'+r.value);break;case"notequal":"string"===r.type?t+='"'+o+'":{"$ne":"'+i+'"}':"date"===r.type?t+='"'+o+'":{"$ne":"'+r.value+'"}':t+='"'+o+'":{"$ne":'+r.value+"}";break;case"in":if("string"===r.type)if(r.value.length>1)s=(s=r.value.map((function(e,t){return t<r.value.length?'"'+e+'"':""})).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$in": ['+s+"]}";else t+='"'+o+'": { "$in": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$in": ['+r.value.toString()+"]}":t+='"'+o+'": { "$in": ['+r.value+"]}");break;case"notin":var s;if("string"===r.type)if(r.value.length>1)s=(s=r.value.map((function(e,t){return t<r.value.length?'"'+e+'"':""})).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$nin": ['+s+"]}";else t+='"'+o+'": { "$nin": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$nin": ['+r.value.toString()+"]}":t+='"'+o+'": { "$nin": ['+r.value+"]}");break;case"greaterthan":"number"===r.type?t+='"'+o+'": { "$gt": '+r.value+"}":t+='"'+o+'": { "$gt": "'+r.value+'"}';break;case"greaterthanorequal":"number"===r.type?t+='"'+o+'": { "$gte": '+r.value+"}":t+='"'+o+'": { "$gte": "'+r.value+'"}';break;case"between":"number"===r.type?t+='"'+o+'": {"$gte":'+r.value[0]+', "$lte":'+r.value[1]+"}":t+='"'+o+'": {"$gte": "'+r.value[0]+'", "$lte": "'+r.value[1]+'"}';break;case"notbetween":"number"===r.type?t+='"$or":[{"'+o+'": {"$lt":'+r.value[0]+'}}, {"'+o+'": {"$gt":'+r.value[1]+"}}]":t+='"$or":[{"'+o+'": {"$lt": "'+r.value[0]+'"}}, {"'+o+'": {"$gt": "'+r.value[1]+'"}}]';break;case"lessthan":"number"===r.type?t+='"'+o+'": { "$lt": '+r.value+"}":t+='"'+o+'": { "$lt": "'+r.value+'"}';break;case"lessthanorequal":"number"===r.type?t+='"'+o+'": { "$lte": '+r.value+"}":t+='"'+o+'": { "$lte": "'+r.value+'"}'}t+="}",e.length!==n&&(t+=",")})),t},e.prototype.mongoParser=function(e,t,l){var n;Object.keys(e).indexOf("$and")>-1?(n=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(n=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(n,t.rules,l)},e.prototype.mongoRecursion=function(e,l,n){for(var r,i,o,s,a,u,d,p,c,h,g,m,f=0,v=e.length;f<v;f++){var y=[],b=[];if(d=Object.keys(e[f])[0],p=e[f][d],"$and"===d)c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(c),this.mongoRecursion(e[f][d],l[l.length-1].rules,n);else if("$or"===d){var C=void 0,S=[],x=[],q=[],O=[],E=[],k=[],w=[];Array.isArray(p)&&2===p.length&&(k=p[(x=Object.keys(p))[0]],w=p[x[1]],"object"==typeof k&&(S=Object.keys(k)[0],q=Object.keys(k[Object.keys(k)[0]])[0],O=Object.keys(w[Object.keys(w)[0]])[0],"$lt"===q&&"$gt"===O&&(r="notbetween",h={field:S,label:S,value:m=[E=k[S][q],w[S][O]],operator:r,type:i="number"==typeof E?"number":"date"},l.push(h),C=!0))),C||(c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(c),this.mongoRecursion(e[f][d],l[l.length-1].rules,n))}else{if(null===(p=e[f][d])&&(r="isnull"),"boolean"==typeof p&&(r="equal",i="boolean",m=p),"number"==typeof p)m=p,i="number",r="equal";else if("object"==typeof p&&null!==p){g=Object.keys(p);for(var N=0;N<g.length;N++)if(s=g[N],o=p[g[N]],"$ne"===s&&(0,t.isNullOrUndefined)(o)&&(r="isnotnull",m=null),"$ne"===s&&"boolean"==typeof o&&(r="notequal",m=o,i="boolean"),g.length>=2&&g[N]?("object"==typeof o?(r="notbetween",d=Object.keys(o)[0],a=[Object.keys(o[d])[0]],y.push(o[d][a]),i="number"):(r="between",y.push(o)),"number"==typeof o&&(i="number")):"object"==typeof o&&null!==o?"$not"===s&&"$regex"===Object.keys(o)[0]?o.$regex.indexOf("^")>-1?(r="notstartswith",m=o.$regex.replace("^","")):o.$regex.indexOf("$")>-1?(r="notendswith",m=o.$regex.replace("$","")):(r="notcontains",m=o.$regex):(r="$in"===s?"in":"notin",b=o,i="number"==typeof o[0]?"number":"string"):"number"==typeof o&&(r=this.getOperatorFromMongoOperator(s),i="number",m=o),"string"==typeof o){"$regex"===s&&(r="contains",m=o,i="string"),"$ne"===s&&(null!==o&&o.length>0&&isNaN(Date.parse(o))?(r="notequal",m=o):(0,t.isNullOrUndefined)(o)?(r="isnotnull",m=o):""===o&&(r="isnotempty",m=o),i="string"),o.indexOf("^")>-1&&(r="startswith",m=o.replace("^",""),i="string"),o.indexOf("$")>-1&&"$not"!==s&&(r="endswith",m=o.replace("$",""),i="string");for(var L=0,R=this.parent.columns;L<R.length;L++){var T=R[L];if(T.field===d){u=T.type;break}}isNaN(Date.parse(o))&&"date"!==u||(r=r||this.getOperatorFromMongoOperator(s),i="date",m=o)}}else p&&"string"==typeof p&&!isNaN(Date.parse(p))?(r="equal",m=p,i="date"):"string"==typeof p&&""!==p&&"true"!==p&&"false"!==p?(r="equal",m=p,i="string"):"string"==typeof p&&""===p&&(r="isempty",m=p,i="string");h=y&&y.length>1?{field:d,label:d,value:y,operator:r,type:i}:b&&b.length>1?{field:d,label:d,value:b,operator:r,type:i}:{field:d,label:d,value:m,operator:r,type:i},l.push(h),r=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,n=t.split("?"),r=n[0],i=0;i<l.length;i++)r+="string"==typeof l[i]?"'"+l[i]+"'"+n[i+1]:l[i]+n[i+1];return r.length>=2&&"("===r[0]&&")"===r[r.length-1]&&(r=r.slice(1,-1)),r=r.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,n=t;return Object.keys(l).forEach((function(e){var t=l[e];e=":"+e,n=n.replace(e,"string"==typeof t?"'"+t+"'":String(t))})),n.length>=2&&"("===n[0]&&")"===n[n.length-1]&&(n=n.slice(1,-1)),n=n.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(l),n.ruleVal)},e.prototype.getNamedParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(l),n.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){return this.updateValue(e.rules,t,[],{},[])},e.prototype.updateValue=function(e,l,n,r,i){if((0,t.isNullOrUndefined)(e))return{ruleVal:n,namedRuleVal:r};for(var o=0;o<e.length;o++)if(e[o].rules){n=(u=this.updateValue(e[o].rules,l,n,r,i)).ruleVal,r=u.namedRuleVal}else{var s=void 0;if(e[o].value instanceof Array)for(var a=0;a<e[o].value.length;a++)l&&(s=this.getNamedParameter(e[o].field,i)),(0,t.isNullOrUndefined)(e[o].value[a])||("string"===e[o].type||e[o].type,l?r[s]=e[o].value[a]:n.push(e[o].value[a])),e[o].value[a]=l?":"+s:"?";else if(l&&(s=this.getNamedParameter(e[o].field,i)),e[o].operator.indexOf("null")<1&&("string"!==e[o].type||"string"===e[o].type&&(""!==e[o].value||0===e[o].value))){if("string"===e[o].type||"date"===e[o].type)if(e[o].operator.indexOf("empty")<1){var u=e[o].value.toString();switch(e[o].operator){case"startswith":case"notstartswith":u+="%";break;case"endswith":case"notendswith":u="%"+u;break;case"contains":case"notcontains":u="%"+u+"%"}l?r[s]=u:n.push(u)}else l?r[s]="":n.push(""),"isempty"===e[o].operator?e[o].operator="equal":e[o].operator="notequal";else(0,t.isNullOrUndefined)(e[o].value)||(l?r[s]=e[o].value:n.push(e[o].value));e[o].value=l?":"+s:"?"}}return{ruleVal:n,namedRuleVal:r}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var n=t.length-1;n>=0;n--){var r=t[n];if(r.indexOf(e)>-1){l=e+"_"+(parseInt(r.split("_")[1],10)+1),t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}()})(),p})()));
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionButtons","SyncfusionDropdowns","SyncfusionData","SyncfusionInputs","SyncfusionCalendars","SyncfusionSplitbuttons","SyncfusionPopups"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionButtons,e.SyncfusionDropdowns,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionCalendars,e.SyncfusionSplitbuttons,e.SyncfusionPopups)}(self,((e,t,l,n,r,i,o,s)=>(()=>{"use strict";var a={766:t=>{t.exports=e},741:e=>{e.exports=t},570:e=>{e.exports=i},74:e=>{e.exports=n},778:e=>{e.exports=l},323:e=>{e.exports=r},197:e=>{e.exports=s},295:e=>{e.exports=o}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var l=u[e]={exports:{}};return a[e](l,l.exports,d),l.exports}d.d=(e,t)=>{for(var l in t)d.o(t,l)&&!d.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return(()=>{d.r(p),d.d(p,{Columns:()=>g,QueryBuilder:()=>y,QueryLibrary:()=>b,Rule:()=>m,ShowButtons:()=>v,Value:()=>f});var e,t=d(766),l=d(741),n=d(778),r=d(74),i=d(323),o=d(570),s=d(295),a=d(197),u=(e=function(t,l){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])},e(t,l)},function(t,l){function n(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(n.prototype=l.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)},h=function(e,t,l,n){var r,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,l,o):r(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o},g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"values",void 0),h([(0,t.Property)(null)],l.prototype,"operators",void 0),h([(0,t.Property)()],l.prototype,"ruleTemplate",void 0),h([(0,t.Property)(null)],l.prototype,"template",void 0),h([(0,t.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),h([(0,t.Property)(null)],l.prototype,"format",void 0),h([(0,t.Property)(null)],l.prototype,"step",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(null)],l.prototype,"category",void 0),h([(0,t.Property)(null)],l.prototype,"columns",void 0),l}(t.ChildProperty),m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"condition",void 0),h([(0,t.Collection)([],l)],l.prototype,"rules",void 0),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"operator",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(!1)],l.prototype,"not",void 0),h([(0,t.Property)(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),f=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"numericTextBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"multiSelectModel",void 0),h([(0,t.Property)(null)],l.prototype,"datePickerModel",void 0),h([(0,t.Property)(null)],l.prototype,"textBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),v=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(!1)],l.prototype,"cloneRule",void 0),h([(0,t.Property)(!1)],l.prototype,"cloneGroup",void 0),h([(0,t.Property)(!1)],l.prototype,"lockRule",void 0),h([(0,t.Property)(!1)],l.prototype,"lockGroup",void 0),h([(0,t.Property)(!0)],l.prototype,"ruleDelete",void 0),h([(0,t.Property)(!0)],l.prototype,"groupInsert",void 0),h([(0,t.Property)(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),y=function(e){function d(t,l){var r=e.call(this,t,l)||this;return r.isReadonly=!0,r.fields={text:"label",value:"field"},r.updatedRule={not:!1,condition:"and",isLocked:!1},r.isLocale=!1,r.isRefreshed=!1,r.isNotified=!1,r.isAddSuccess=!1,r.isNotValueChange=!1,r.isFieldChange=!1,r.isFieldClose=!1,r.isDestroy=!1,r.isGetNestedData=!1,r.isCustomOprCols=[],r.groupCounter=0,r.lockItems=[],r.groupIndex=-1,r.ruleIndex=-1,r.isLastGroup=!1,r.cloneGrpBtnClick=!1,r.isMiddleGroup=!1,r.cloneRuleBtnClick=!1,r.isValueEmpty=!1,n.MultiSelect.Inject(n.CheckBoxSelection),r}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=l.length;n<r;n++)l[n].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(l[n],"tooltip").destroy():l[n].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(l[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var i=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"}});i.appendChild(o).appendChild(s),this.element.appendChild(i),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&(0,t.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)},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},d.prototype.GetRootColumnName=function(e){return(0,t.isNullOrUndefined)(e)?"":this.separator?e.split(this.separator)[0]:e},d.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],n=void 0,r=!1,i=!1,o=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=0,u=(d=this.columns).length;a<u;a++)this.updateCustomOperator(d[a],"initial"),d[a].type||(e.indexOf(d[a].field)>-1&&("string"===(n=typeof(o=this.dataColl[0][d[a].field]))?i=!isNaN(Date.parse(o)):"object"===n&&(i=o instanceof Date&&!isNaN(o.getTime()),n="string"),d[a].type=n,i=!1),n="string"),d[a].validation||(d[a].validation=s),d[a].category?r=!0:d[a].category=this.l10n.getConstant("OtherFields"),l.indexOf(d[a].category)<0&&l.push(d[a].category),(!d[a].operators||this.isLocale&&-1===this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);r&&(l.length>1||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(a=0,u=e.length;a<u;a++)"string"===(n=typeof(o=this.dataColl[0][e[a]]))?i=!isNaN(Date.parse(o)):"object"!==n||Object.keys(o).length||(i=o instanceof Date&&!isNaN(o.getTime()),n="string"),t[a]={field:e[a],label:e[a],type:i?"date":n,validation:s},i=!1,t[a].operators=this.customOperators[t[a].type+"Operator"],"object"===n&&this.updateSubFields(o,t[a]);this.columns=t}}else if(this.columns&&this.columns.length){var d;for(a=0,u=(d=this.columns).length;a<u;a++)d[a].category?this.fields={text:"label",value:"field",groupBy:"category"}:d[a].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(d[a],"initial"),(!d[a].operators||this.isLocale&&-1===this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},d.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},d.prototype.updateSubFields=function(e,t,l){var n;t.columns=[];var r,i,o=Object.keys(e);l=l||this.dataColl[0];for(var s=0,a=o.length;s<a;s++){var u=t.field.split(".");i=l?l[u[u.length-1]][o[s]]:this.dataColl[0][t.field][o[s]];var d=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof i,n={field:t.field+this.separator+o[s],label:o[s],type:r="object"!==r||isNaN(Date.parse(i))?r:"date"},"object"!==r&&(n.operators=this.customOperators[r+"Operator"]),t.columns.push(n),"object"===r&&this.updateSubFields(i,n,d)}},d.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||(0,t.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var n=e.operators[t],i=Object.keys(n),o=i.map((function(e){return n[""+e]})).join(",").split(","),s=i.indexOf("value");r.operators[o[s]]=o[l]}},r=this,i=0;i<e.operators.length;i++)n(i)}},d.prototype.focusEventHandler=function(e){this.target=e.target},d.prototype.clickEventHandler=function(e){var l,n,r=this,i=e.target;if(this.isImportRules=!1,"SPAN"===i.tagName&&(i=i.parentElement),"string"==typeof i.className&&i.className.indexOf("e-collapse-rule")>-1){var o=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var s=document.getElementById(this.element.id+"_summary_content"),a=s.querySelector(".e-summary-text");o.animate(".e-query-builder",{name:"SlideLeftIn"}),(d=this.element.querySelector(".e-group-container")).style.display="none",a.textContent=this.getSqlFromRules(this.rule),s.style.display="block",a.style.height=a.scrollHeight+"px"}if("BUTTON"===i.tagName&&"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")<0){o=new t.Animation({duration:1e3,delay:0});switch(!0){case i.className.indexOf("e-removerule")>-1:this.actionButton=i,this.deleteRule(i);break;case i.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=i,this.cloneRuleBtnClick=!0,this.ruleClone(i);break;case i.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=i,this.ruleLock(i);break;case i.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=i,this.groupLock(i);break;case i.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=i,this.cloneGrpBtnClick=!0,this.groupClone((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-deletegroup")>-1:this.actionButton=i,this.deleteGroup((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-edit-rule")>-1:if(o.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 u=(0,t.extend)({},this.rule,{},!0);this.setGroupRules(u),this.renderSummaryCollapse()}else{var d;(d=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}}else if("LABEL"===i.tagName&&i.parentElement.className.indexOf("e-btn-group")>-1||"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")>-1){var p=(0,t.closest)(i,".e-group-container");if(!this.headerTemplate){var c=i.getAttribute("for"),h=void 0;c?h=document.getElementById(c).getAttribute("value"):this.enableSeparateConnector&&(h=i.textContent),n=p.id.replace(this.element.id+"_","");var g=this.getGroup(n),m=void 0;if(this.enableNotCondition)if(i.className.indexOf("e-qb-toggle")>-1){var f=p.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?((0,t.removeClass)([f],"e-active-toggle"),m=!1):((0,t.addClass)([f],"e-active-toggle"),m=!0),h=g.condition}else m=g.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:m})}this.isImportRules?this.beforeSuccessCallBack(l,i):this.trigger("beforeChange",l,(function(e){r.beforeSuccessCallBack(e,i)})),this.target=i}},d.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=n.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(n);if(this.enableSeparateConnector){var s=(n=(0,t.isNullOrUndefined)((0,t.closest)(l,".e-rule-container"))&&n.classList.contains("e-group-container")?null!==l.parentElement.previousElementSibling?l.parentElement.previousElementSibling:n:(0,t.closest)(l,".e-rule-container")).id.replace(this.element.id+"_","");n.classList.contains("e-rule-container")?(o=this.getRule(n)).condition=e.value:n.classList.contains("e-group-container")&&((o=this.getGroup(n)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,ruleID:s,type:"condition",value:o.condition})}else o.condition=e.value,this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:o.condition});if(this.filterRules(i,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector){var a=l.parentElement.querySelector(".e-btngroup-and"),u=l.parentElement.querySelector(".e-btngroup-or");a&&u&&("and"===e.value?(a.checked=!0,u.checked=!1):"or"===e.value&&(u.checked=!0,a.checked=!1))}}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||(0,t.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):(0,t.removeClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&(0,t.addClass)([l.element.querySelector("li").parentElement],"e-rtl")):(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement((0,t.closest)(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,(0,t.closest)(e,".e-group-container"),"",!0)},d.prototype.appendRuleElem=function(e,l,n,r,i,o){var s,a,u,d=e.querySelector(".e-rule-list");if("change"===n)s=(0,t.select)("#"+r,e);else{if((s=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)d.appendChild(s);else if(this.enableSeparateConnector){for(var p=-1,c=this.ruleIndex+1,h=0;h<c&&h!==d.children.length;h++)d.children[h].classList.contains("e-rule-container")&&(c++,p++);d.insertBefore(s,d.children[this.ruleIndex+p+1])}else d.insertBefore(s,d.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else d.appendChild(s);this.ruleIdCounter++}if(l&&l.ruleTemplate&&o){u={requestType:"template-initialize",ruleID:s.id,action:i,fields:this.fields,rule:o},this.trigger("actionBegin",u),this.ruleTemplateFn=this.templateParser(l.ruleTemplate);var g=this.element.id+l.field;if(u.fields=this.fields,u.columns=this.columns,""===o.field&&(o.field=l.field),u.operators=this.getOperators(o.field),u.operatorFields={text:"key",value:"value"},this.isReact)(a=this.ruleTemplateFn(u,this,s.id,g)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var m=this.ruleTemplateFn(u,this,s.id,g);(a=3===m[0].nodeType?m[1]:m[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",g),(0,t.append)(a,s),s.children.length&&(s.children[s.children.length-1].className+=" e-rule-field")):((a=this.ruleTemplateFn(u,this,"Template",g)[0]).className+=" e-rule-field",s.appendChild(a))}else a=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),s.appendChild(a);return this.showButtons.lockGroup&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&(0,t.removeClass)(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&(0,t.removeClass)(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&(0,t.removeClass)(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&(0,t.removeClass)(s.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),l&&l.ruleTemplate&&o&&this.renderReactTemplates(),s},d.prototype.addRuleElement=function(e,t,l,n,r,i){var o=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,n,r,i)):this.trigger("beforeChange",s,(function(s){o.addRuleSuccessCallBack(s,e,t,l,n,r,i)}))}},d.prototype.addRuleSuccessCallBack=function(e,l,r,i,o,s,a){var u,d,p,h,g=this.element.className.indexOf("e-device")>-1?"250px":"200px",m=r&&r.field?this.getColumn(r.field):i||this.columns[0],f={label:"",field:"",type:"",operator:""};if(!e.cancel){if(m&&m.ruleTemplate&&r.field){this.selectedColumn=m,d=this.selectedColumn.operators,f={label:m.label,field:m.field,type:m.type,operator:d[0].value};var v=Object.keys(r).length?r:f,y={requestType:"template-create",action:"insert-rule",ruleID:(h=this.appendRuleElem(l,m,o,s,"field",v)).id,fields:this.fields,rule:v};this.trigger("actionBegin",y)}else{(h=this.appendRuleElem(l,m,o,s,"field")).querySelector(".e-filter-input").setAttribute("id",h.id+"_filterkey");var b=h.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)b.textContent=this.l10n.getConstant("Remove"),(0,t.addClass)([b],"e-flat"),(0,t.addClass)([b],"e-primary");else{(0,t.addClass)([b],"e-round"),(0,t.addClass)([b],"e-icon-btn"),b.setAttribute("title",this.l10n.getConstant("DeleteRule"));var C=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});h.querySelector(".e-rule-delete").appendChild(C)}this.showButtons.ruleDelete||b.classList.add("e-button-hide")}"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?h.className="e-rule-container e-vertical-mode":h.className="e-rule-container e-horizontal-mode";var S=h.previousElementSibling;if(this.enableSeparateConnector){var x=void 0,q=void 0;if(S&&S.classList.contains("e-group-container")&&(q=S.querySelectorAll(".e-rule-container"),S=q[q.length-1]),S&&S.classList.contains("e-rule-container")&&(x=this.getRule(S)),this.headerTemplate&&S&&x)this.headerTemplateFn(S,!1,x.condition,x,S.id);else if((0,t.isNullOrUndefined)(S)&&h.id!==this.element.id+"_group0_rule0"){if((B=h.closest(".e-group-container"))&&B.previousElementSibling){var O=(D=B.previousElementSibling).querySelectorAll(".e-rule-container");if(D.classList.contains("e-group-container")&&(D=O[O.length-1]),D.classList.contains("e-rule-container")){var E=this.getRule(D);this.headerTemplateFn(D,!1,E.condition,E,D.id,!0)}}else this.headerTemplateFn(h,!1,r.condition,r,h.id,!0)}}else S&&S.className.indexOf("e-rule-container")>-1&&(h.className.indexOf("e-joined-rule")<0&&(h.className+=" e-joined-rule"),S.className.indexOf("e-prev-joined-rule")<0&&(S.className+=" e-prev-joined-rule"));if(S&&S.className.indexOf("e-group-container")>-1&&h.className.indexOf("e-separate-rule")<0&&(h.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(l,r,f,a,s,!!this.enableSeparateConnector||null),!m||m&&!m.ruleTemplate||!r.field)if("Default"===this.fieldMode){var k=void 0,w=void 0;w=this.separator&&r.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(r.field):r.field,k={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?g:"auto",close:this.fieldClose.bind(this,h.id+"_filterkey"),change:this.changeField.bind(this),value:r?w:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(k=c({},k,this.fieldModel)),(p=new n.DropDownList(k)).appendTo("#"+h.id+"_filterkey");var N=void 0;N=this.separator&&r.field||this.isImportRules?this.GetRootColumnName(r.field):p.value,this.selectedColumn=p.getDataByValue(N),Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.selectedColumn})}else{k=void 0,w=(this.isImportRules,r.field);this.dummyDropdownTreeDs=(0,t.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),k={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?g:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:(0,t.isNullOrUndefined)(w)?null:[w],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt",filtering:this.dropdownTreeFiltering.bind(this),close:this.dropdownTreeClose.bind(this)},this.fieldModel&&(k=c({},k,this.fieldModel));var L=new n.DropDownTree(k);if(L.appendTo("#"+h.id+"_filterkey"),!(0,t.isNullOrUndefined)(L.value)){var R=this.getLabelFromColumn(L.value[0]);L.element.value=R}N=(0,t.isNullOrUndefined)(r.field)?L.value:this.GetRootColumnName(r.field);this.selectedColumn=this.getColumn(N),Object.keys(r).length&&this.changeRule(r,{element:L.element,itemData:this.selectedColumn})}if(u=h.id.replace(this.element.id+"_",""),r&&r.isLocked){var T=h.querySelector(".e-lock-rule-btn");this.ruleLock(T)}this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:u,type:"insertRule"})}if(this.enableSeparateConnector&&(0,t.isNullOrUndefined)(r.condition)&&u&&(r=this.getRule(u)),this.enableSeparateConnector){var D=h.previousElementSibling;for(q=void 0;D&&!D.classList.contains("e-rule-container");){if(D.classList.contains("e-group-container")){q=D.querySelectorAll(".e-rule-container"),D=q[q.length-1];break}D=D.previousElementSibling}if(this.headerTemplate&&D){x=this.getRule(D);var I={requestType:"rule-template-create",ruleID:D.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",I)}else if((0,t.isNullOrUndefined)(D)&&h.id!==this.element.id+"_group0_rule0"){var B;if((B=h.closest(".e-group-container"))&&B.previousElementSibling&&B.previousElementSibling.previousElementSibling){var A=B.previousElementSibling.previousElementSibling;if(A.classList.contains("e-group-container")){var P=A.querySelectorAll(".e-rule-container");A=P[P.length-1]}if(A.classList.contains("e-rule-container")){x=this.getRule(A);var G={requestType:"rule-template-create",ruleID:A.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",G)}}}this.setMultiConnector(h)}},d.prototype.dropdownTreeFiltering=function(e){var l,n=this,r=this,i=e.event.srcElement;l=(i.classList.contains("e-clear-icon")?i.parentElement.querySelector(".e-textbox"):i).id.split("_filterkey")[0];var o=document.getElementById(l);this.ddTree=(0,t.getComponent)(o.querySelector("input.e-dropdowntree"),"dropdowntree");var s=(0,t.extend)([],this.columns,[],!0);if(e.cancel=!0,""===e.text)this.changeDataSource(s);else{var a=s.map((function(t){return n.nestedChildFilter(e.text,t)})).filter((function(e){return null!==e}));this.changeDataSource(a),setTimeout((function(){(0,t.isNullOrUndefined)(r.ddTree)||(0,t.isNullOrUndefined)(r.ddTree.treeObj)||r.ddTree.treeObj.expandAll()}),100)}},d.prototype.changeDataSource=function(e){this.updateDropdowntreeDS(e),this.ddTree.treeObj.fields={dataSource:e,value:"field",text:"label",child:"columns",expanded:"expanded"},this.ddTree.treeObj.refresh()},d.prototype.nestedChildFilter=function(e,t){var l=this,n=t[this.ddTree.fields.child];if(!n)return this.isMatchedNode(e,t)?t:null;var r=n.map((function(t){return l.nestedChildFilter(e,t)})).filter((function(e){return null!==e}));return r.length?(t[this.ddTree.fields.child]=r,t):(t[this.ddTree.fields.child]=n,this.isMatchedNode(e,t)?t:null)},d.prototype.isMatchedNode=function(e,t){var l=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==l.indexOf(e)},d.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource((0,t.extend)([],this.columns,[],!0)),this.ddTree=null},d.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type?(this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template,e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns)):this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template},d.prototype.updateAddedRule=function(e,l,n,r,i,o){var s,a,u,d=0;if(r){for(s=(0,t.select)("#"+i,e),a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var p=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!p||d++}u.rules[d]=l}else{a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);var c=l.custom;Object.keys(l).length?this.ruleIndex<0?(u.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),c&&(u.rules[u.rules.length-1].custom=c),this.enableSeparateConnector&&(u.rules[u.rules.length-1].condition=l.condition?l.condition:n.condition)):(u.rules.splice(this.ruleIndex+1,0,{field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),c&&(u.rules[this.ruleIndex+1].custom=c),this.enableSeparateConnector&&(u.rules[this.ruleIndex+1].condition=l.condition?l.condition:n.condition)):(c&&(n.custom=c),this.autoSelectField&&(l.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u,o)},d.prototype.changeRuleTemplate=function(e,l){if(!e||!e.ruleTemplate){var n=(0,t.closest)(l,".e-group-container"),r=(0,t.closest)(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&((0,t.detach)(l.closest('[id="'+r+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([r])),e){var i=this.selectedColumn.operators,o={field:e.field,label:e.label,operator:i[0].value,value:""};this.addRuleElement(n,o,e,"change",r,!0)}else{o={field:"",label:"",operator:"",value:""};this.addRuleElement(n,o,e,"change",r,!0)}}},d.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},d.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var n,r=["isnull","isnotnull","isempty","isnotempty"],i=void 0,o=void 0,s=void 0,a=[],u=void 0,d=void 0,p=void 0,c=void 0,h=void 0,g=this.element.querySelectorAll(".e-rule-container");for(i=0,n=g.length;i<n;i++){var m=void 0;if(u=(0,t.closest)(g[i],".e-group-container"),h=this.getParentGroup(u),d=0,s=c=g[i],"DropdownTree"===this.fieldMode?(e=(0,t.getComponent)(g[i].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),m=this.selectedColumn.validation):(p=(0,t.getComponent)(g[i].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&p.value&&(this.selectedColumn=p.getDataByValue(p.value),m=!(0,t.isNullOrUndefined)(p.value)&&this.selectedColumn.validation),o=c.querySelector(".e-rule-field input.e-control"),m&&m.isRequired){for(;s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var f=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!f||d++}if(o=c.querySelector(".e-rule-operator .e-control"),h.rules[d].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1),h.rules[d].value instanceof Array&&(a=h.rules[d].value),r.indexOf(h.rules[d].operator)<-1&&(0,t.isNullOrUndefined)(h.rules[d].value)&&"date"!==h.rules[d].type||""===h.rules[d].value||null===h.rules[d].value||h.rules[d].value instanceof Array&&a.length<1){var v=c.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=(0,t.closest)(C,".e-multi-select-wrapper")).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 if("date"===h.rules[d].type&&(null===h.rules[d].value||h.rules[d].value.indexOf(null)>-1)){v=c.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(y=0,b=v.length;y<b;y++)v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&((0,t.isNullOrUndefined)(h.rules[d].value)||null==h.rules[d].value[y])&&this.renderToolTip(v[y].parentElement)}}else(p&&p.element&&(0,t.isNullOrUndefined)(p.value)||e&&e.element&&((0,t.isNullOrUndefined)(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1)}}return l},d.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)}},d.prototype.refreshLevel=function(e){var l,n,r=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=r.length,s=0;for(n=0;n<o;n++)(l=r[n]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=(0,t.closest)(i,".e-rule-list");return e.groupElement=a?(0,t.closest)(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(e){var t,l,n,r,i,o,s=this.createElement("div",{attrs:{class:"e-group-container"}}),a=this.createElement("div",{attrs:{class:"e-group-header"}}),u=this.createElement("div",{attrs:{class:"e-group-body"}}),d=this.createElement("div",{attrs:{class:"e-rule-list"}});if(s.appendChild(a),u.appendChild(d),s.appendChild(u),!this.headerTemplate){n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var p=this.createElement("span",{attrs:{class:n,"aria-lable":"drag handle",title:"drag handle"}});a.appendChild(p);var c=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group";t=this.createElement("div",{attrs:{class:c,role:"group"}}),this.enableSeparateConnector&&t.classList.add("e-multi-connector"),this.enableNotCondition&&(l=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),t.appendChild(l)),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),t.appendChild(r),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),t.appendChild(r),a.appendChild(t),i=this.createElement("div",{attrs:{class:"e-group-action"}}),this.enableSeparateConnector?(o=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),i.appendChild(o),o=this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}}),i.appendChild(o)):(o=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(o)),a.appendChild(i)}return s},d.prototype.ruleTemplate=function(){var e,l,n,r,i,o=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}}),i=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var a=this.createElement("span",{attrs:{class:i,"aria-lable":"drag handle",title:"drag handle"}});s.appendChild(a);var u=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(u),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",r=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var d=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),p=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});d.appendChild(p);var c=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}});p=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),c.appendChild(p),l=this.showButtons.ruleDelete||(0,t.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 h=this.createElement("button",{attrs:{type:"button",class:l}});return e.appendChild(d),e.appendChild(c),e.appendChild(h),s.appendChild(e),o.appendChild(s),o},d.prototype.addGroupElement=function(e,t,l,n,r,i,o){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,n,r,i,o)):this.trigger("beforeChange",a,(function(a){s.addGroupSuccess(a,e,t,l,n,r,i,o)}))},d.prototype.addGroupSuccess=function(e,n,r,i,o,a,u,d){var p=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var c=r,h=void 0,g="";g=c.className.indexOf("e-group-container")<0?c.querySelector(".e-group-container")&&c.querySelector(".e-group-container").id:c.id,this.enableSeparateConnector&&(this.groupElem=this.groupTemplate());var m=this.groupElem.cloneNode(!0);if(m.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&m.querySelector(".e-drag-qb-rule")&&(m&&m.children[0]&&m.children[0].classList.add("e-parent-header"),(0,t.addClass)([m.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(u?(n=!1,m.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(m,a,i,d,g),this.groupIdCounter=0):this.headerTemplateFn(m,a,i,d,g)),this.groupIdCounter++,!this.headerTemplate){var f=m.querySelector(".e-btngroup-and"),v=m.querySelector(".e-btngroup-or"),y=m.querySelector(".e-btngroup-and-lbl"),b=m.querySelector(".e-btngroup-or-lbl");f.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),f.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(n){var C=void 0;C=this.showButtons.groupDelete||(0,t.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),(0,t.rippleEffect)(h,{selector:".deletegroup"});for(var S=c.querySelector(".e-rule-list"),x=S.children,q=0,O=0,E=x.length;O<E;O++)x[O].className.indexOf("e-group-container")>-1&&(q+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===x.length-1)S.appendChild(m),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var k=0,w=this.groupIndex+1,N=0;N<w;N++)x[N].classList.contains("e-rule-container")&&(w++,k++);k>0&&k--,x[L=this.groupIndex+k+1].parentNode.insertBefore(m,x[L])}else{var L;x[L=this.groupIndex+1].parentNode.insertBefore(m,x[L])}this.isMiddleGroup=!0}else S.appendChild(m);var R=this.levelColl[c.id].slice(0);if(R.push(q),this.levelColl[m.id]=R,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],c.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(m,{})),!this.headerTemplate){var T="";T=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var D=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:T}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});D.appendChild(I),m.querySelector(".e-group-action").appendChild(D),T=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:T}}),A=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(A),m.querySelector(".e-group-action").appendChild(B),m.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){T="";T=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:T}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(I),m.querySelector(".e-group-action").appendChild(B)}c.appendChild(m),this.levelColl[m.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var P=m.querySelector(".e-qb-toggle");(this.enableSeparateConnector?new l.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new l.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(P),m.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&(0,t.addClass)([P],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){var G=m.querySelector(".e-btngroup-and"),M=m.querySelector(".e-btngroup-or"),V=m.querySelector(".e-btn-group");for(N=0;N<V.childNodes.length;N++)"not"===m.querySelector(".e-btn-group").childNodes[N].textContent.toLowerCase()&&this.enableNotCondition?V.childNodes[N].classList.add("e-multiconnector"):V.childNodes[N].style.display="none";if(m.previousElementSibling){if((0,t.isNullOrUndefined)(this.headerTemplate))m.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),m),(P=m.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(P.style.display="none");if(!this.isImportRules){var U=m.previousElementSibling,F=U.querySelector(".e-btngroup-and"),_=U.querySelector(".e-btngroup-or");if(G.checked||M.checked)this.enableSeparateConnector&&(G.checked&&(F.checked=!0),M.checked&&(_.checked=!0));else{var j=m.nextElementSibling;j&&j.classList.contains("e-btn-group")&&(G=j.querySelector(".e-btngroup-and"),M=j.querySelector(".e-btngroup-or"),F.checked=G.checked,_.checked=M.checked)}}}}if(this.updatedRule=null,this.headerTemplate){var $={requestType:"header-template-create",ruleID:m.id,condition:i,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",$)}else if(this.enableSeparateConnector){var Q=m.querySelector(".e-add-condition-btn");(W=new l.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(Q),W.element.onclick=function(){p.addRuleElement((0,t.closest)(Q,".e-group-container"),{})};var H=m.querySelector(".e-add-group-btn");(W=new l.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(H),W.element.onclick=function(){p.addGroupElement(!0,(0,t.closest)(H,".e-group-container"),"",!0)}}else{var W,z=m.querySelector(".e-add-btn");(W=new s.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,z),select:this.selectBtn.bind(this,z)})).appendTo(z),z.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules&&!this.prvtEvtTgrDaD){var Y=c.id.replace(this.element.id+"_",""),K=m.id.replace(this.element.id+"_","");this.trigger("change",{groupID:Y,type:"insertGroup",childGroupID:K})}}},d.prototype.setMultiConnector=function(e){if(this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling&&this.groupElem.querySelector(".e-btn-group")){e.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),e);var t=e.previousElementSibling.childNodes[0];t.classList.contains("e-qb-toggle")&&(t.style.display="none"),this.addHeaderDiv(e)}},d.prototype.addHeaderDiv=function(e){var l,n=e.previousElementSibling.previousElementSibling;if(n){l=n.id.indexOf("rule")>-1?this.getRule(n):this.getGroup(n),(0,t.isNullOrUndefined)(l.condition)&&(l.condition="and");var r=e.previousElementSibling.querySelector(".e-btngroup-or"),i=e.previousElementSibling.querySelector(".e-btngroup-and");r.disabled=!1,i.disabled=!1,"or"===l.condition?r.checked=!0:i.checked=!0}},d.prototype.headerTemplateFn=function(e,l,n,r,i,o){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(d=e),this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?l:void 0,condition:n,rule:this.getRuleCollection(r,!1),groupID:i},this.trigger("actionBegin",a),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(a.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):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],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s)}else if(this.isVue3){if(s=this.headerFn(a,this,e.id,u),this.enableSeparateConnector&&(o||-1!==e.id.indexOf("rule")))for(var c=0;c<s.length;c++)if("DIV"===s[c].nodeName){s=s[c];break}this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):(0,t.append)(s,d)}else s=this.headerFn(a,this,"Template",u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);this.renderReactTemplates()}return e},d.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling?e.nextElementSibling:e).closest(".e-group-container");!e.nextElementSibling&&l&&(l=l.nextElementSibling?l.nextElementSibling:l),l&&l.parentElement.insertBefore(t,l)},d.prototype.notifyChange=function(e,l,n){var r=(0,t.closest)(l,".e-group-container"),i=this.getParentGroup(r),o=(0,t.closest)(l,".e-rule-container"),s=0;if("not"!==n)if("condition"!==n){for(;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&s++;var a=i.rules[s],u=this.getColumn(a.field),d=this.getFormat(u.format);if("date"===u.type)if(e instanceof Date)e=this.intl.formatDate(e,d);else if(e instanceof Array)for(var p=0;p<e.length;p++)e[p]&&e[p]instanceof Date&&(e[p]=this.intl.formatDate(e[p],d));u.ruleTemplate?this.templateChange(l,e,n):(this.isNotified=!0,this.updateRules(l,e),this.isNotified=!1)}else this.enableSeparateConnector?((o=l.parentElement.previousElementSibling)&&o.classList.contains("e-group-container")&&(o=o.querySelectorAll(".e-rule-container")[o.querySelectorAll(".e-rule-container").length-1]),o&&o.classList.contains("e-rule-container")&&(i=this.getRule(o)),i.condition=e):i.condition=e;else i.not=e},d.prototype.templateChange=function(e,l,n){var r,i=(0,t.closest)(e,".e-group-container"),o=this.getParentGroup(i),s=(0,t.closest)(e,".e-rule-container"),a=0;for(this.allowValidation&&this.validateValue(o,s);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container"))))&&a++;var u,d=o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):d&&(this.selectedColumn=this.getColumn(d.field)),this.previousColumn=this.getColumn(d.field);var p=this.getValidRules(this.rule);this.selectedColumn&&(u=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,h=["in","notin","between","notbetween"];switch(n){case"field":(0,t.isNullOrUndefined)(l)?(d.field="",d.label="",d.type="",d.value="",d.operator=""):(d.field=l,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=u[0].value);break;case"operator":c=d.operator,d.operator=l,h.indexOf(d.operator)>-1?d.value=[]:h.indexOf(c)>-1&&(d.value="");break;case"value":d.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(p,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var g=(0,t.closest)(e,".e-rule-container");this.destroyControls(g,!0),(0,t.detach)(g.querySelector(".e-rule-field"));var m=this.appendRuleElem((0,t.closest)(g,".e-group-container"),this.selectedColumn,"change",g.id,n,d);"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",this.enableSeparateConnector||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");var f={requestType:"template-create",action:n,ruleID:g.id,fields:this.fields,rule:d};r={groupID:i.id.replace(this.element.id+"_",""),ruleID:g.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",r)}},d.prototype.changeValue=function(e,l){var n,r=this;if(this.isNumInput&&"number"==typeof l.value||"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||this.selectedColumn.validation.min>0))this.isNumInput=!1;else{if(l.element&&l.element.classList.contains("e-multiselect"))n=l.element;else n=l.event?l.event.target:"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")?l.currentTarget:l.element;if(n){if(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1)n=l.element;var o,s,a,u=(0,t.closest)(n,".e-group-container"),d=(0,t.closest)(n,".e-rule-container"),p=u&&u.id.replace(this.element.id+"_",""),c=d.id.replace(this.element.id+"_",""),h=l;if(h.element&&h.element.className.indexOf("e-datepicker")>-1&&(n=h.element,(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=o.getDataByValue(o.value)),(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0]))),n.className.indexOf("e-radio")>-1)if(a=parseInt(n.id.split("valuekey")[1],10),"Default"===this.fieldMode?(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value),this.selectedColumn.columns&&(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(o.value))):(o=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),this.selectedColumn.values)s=this.selectedColumn.values[a];else{s=[!0,!1][a]}else if(n.className.indexOf("e-multiselect")>-1)s=(0,t.getComponent)(n,"multiselect").value;else if(s=l.value,"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")){s=Number(l.currentTarget.value);var g=l.currentTarget,m=(0,t.getInstance)(g,i.NumericTextBox),f=(0,t.getValue)("decimal",(0,t.getNumericObject)(this.locale));isNaN(s)&&-1!==g.value.indexOf(f)&&(s=this.intl.getNumberParser({format:"n"})(g.value)),isNaN(s)||(m.value=s),this.isNumInput=!0}"input"===l.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval((function(){r.filterValue(p,c,s,e,n)}),this.immediateModeDelay)):this.filterValue(p,c,s,e,n)}}},d.prototype.filterValue=function(e,t,l,n,r){var i=this,o={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(o,r,n,e,t):this.trigger("beforeChange",o,(function(l){i.changeValueSuccessCallBack(l,r,n,e,t)}))},d.prototype.changeValueSuccessCallBack=function(e,t,l,n,r){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:n,ruleID:r,value:e.value,cancel:!1,type:"value"}))},d.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var l=(0,t.getComponent)(e,"dropdownlist"),n=l.popupObj&&l.popupObj.element.querySelector(".e-active"),r=l.getItemData();l.value=r.value;var i={element:l.element,value:r.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:n,itemData:r,event:null,e:null};l.previousValue!==l.value&&this.changeField(i),this.isFieldChange=!1}},d.prototype.changeField=function(e){if(e.isInteracted){if((0,t.isNullOrUndefined)(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var l=(0,t.closest)(e.element,".e-rule-filter")||(0,t.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!==l){var r=l.querySelector(".e-dropdowntree.e-control"),i=(0,t.getComponent)(r,"dropdowntree");if(!n)return;if("object"===n.type){if(i.value=e.oldValue,i.dataBind(),(0,t.isNullOrUndefined)(e.oldValue))r.value="";else{var o=this.getLabelFromColumn(e.oldValue[0]);r.value=o}return}if(!(0,t.isNullOrUndefined)(e.value[0])){i.value=e.value[0],i.dataBind();o=this.getLabelFromColumn(e.value[0]);r.value=o}}if(this.destroySubFields(l),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 s=(0,t.closest)(e.element,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e.element,".e-rule-container"),d=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;a.rules[d].value="",this.changeRule(a.rules[d],e)}}},d.prototype.changeRule=function(e,l){if(!l.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==(0,t.getComponent)(l.element,"dropdowntree").value)return}var n=(0,t.closest)(l.element,".e-rule-filter");n=n||(0,t.closest)(l.element,".e-rule-sub-filter");var r=(0,t.getComponent)(l.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==n&&(r=(0,t.getComponent)(l.element,"dropdowntree"));var i=(0,t.closest)(l.element,".e-group-container").id.replace(this.element.id+"_","");this.changeFilter(n,r,i,e,{},l)},d.prototype.changeFilter=function(e,l,n,r,i,o){var s=this;if(e){var a=void 0;a="DropdownTree"===this.fieldMode?l.value[0]:this.isImportRules?this.GetRootColumnName(l.value):l.value,this.selectedColumn=this.getColumn(a);var u={groupID:n,ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:"DropdownTree"===this.fieldMode?l.value[0]:l.value,cancel:!1,type:"field"};this.isImportRules||this.prvtEvtTgrDaD?this.fieldChangeSuccess(u,i,e,r,o):this.trigger("beforeChange",u,(function(t){s.fieldChangeSuccess(t,i,e,r,o)}))}else{var d=(0,t.closest)(o.element,".e-rule-operator");this.changeOperator(e,d,l,n,r,i,o)}},d.prototype.changeOperator=function(e,l,n,r,i,o,s){var a,u=this;l?(a={groupID:r,ruleID:(0,t.closest)(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:n.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,o,i,s):this.trigger("beforeChange",a,(function(t){u.operatorChangeSuccess(t,e,o,i,s)}))):this.changeRuleValues(e,i,o,s)},d.prototype.fieldChangeSuccess=function(e,l,n,r,i){for(var o=(0,t.closest)(n,".e-rule-container"),s=(0,t.closest)(i.element,".e-rule-operator"),a=(0,t.closest)(i.element,".e-group-container").id.replace(this.element.id+"_",""),u=(0,t.getComponent)(i.element,"dropdownlist"),d=o.querySelectorAll(".e-tooltip.e-input-group"),p=0;p<d.length;p++)(0,t.getComponent)(d[p],"tooltip").destroy();if(e.cancel)this.changeOperator(n,s,u,a,r,l,i);else{if((0,t.isNullOrUndefined)(this.selectedColumn))return;if(l.type=this.selectedColumn.type,o.querySelector(".e-template")&&(r.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(l.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(n,r,l,i);else this.destroySubFields(n),this.changeOperator(n,s,u,a,r,l,i)}},d.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},d.prototype.createSubFields=function(e,l,r,i){var o=!1,s=(0,t.closest)(e,".e-rule-field"),a=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});s.insertBefore(a,s.querySelector(".e-rule-operator"));var u=(0,t.closest)(a,".e-rule-container").id,d=this.createElement("input",{attrs:{type:"text",id:u+"_subfilterkey"+this.subFilterCounter}});a.appendChild(d);var p,h=this.element.className.indexOf("e-device")>-1?"250px":"200px";p={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?h:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(p=c({},p,this.fieldModel));var g=new n.DropDownList(p);if(g.appendTo("#"+u+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(l.field)===this.GetRootColumnName(this.previousColumn.field))for(var m=this.selectedColumn.columns,f=0;f<m.length;f++)if(l.field===m[f].field||l.field.indexOf(m[f].field+this.separator)>-1){g.value=m[f].field,this.selectedColumn=m[f],o=!0;break}this.subFilterCounter++,this.subFieldElem=d,i.itemData=i.itemData,!o&&this.selectedColumn.columns&&(!o&&this.isImportRules&&(g.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(a,l,r,i)},d.prototype.operatorChangeSuccess=function(e,l,n,r,i){if(!e.cancel){var o=(0,t.closest)(i.element,".e-rule-operator"),s=o.nextElementSibling,a=(0,t.getComponent)(i.element,"dropdownlist"),u=r.operator?r.operator.toString().toLowerCase():"";n.operator=a.value.toString();var d=n.operator.toLowerCase();if(n.operator.toLowerCase().indexOf("between")>-1||n.operator.toLowerCase().indexOf("in")>-1&&n.operator.toLowerCase().indexOf("contains")<0?(l=o.previousElementSibling,n.type=r.type,(n.operator.toLowerCase().indexOf("in")<0||u.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:""),i.previousItemData){var p=i.previousItemData.value.toString().toLowerCase();(p.indexOf("between")>-1||(p.indexOf("in")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contains")<0)&&(l=o.previousElementSibling,n.type=r.type)}if(u.indexOf("in")>-1&&u.indexOf("in")<5&&d.indexOf("in")>-1&&d.indexOf("in")<5&&(l=null),n.operator.indexOf("null")>-1||n.operator.indexOf("empty")>-1){var c=o.parentElement.querySelector(".e-rule-value"),h=c.querySelector(".e-tooltip.e-input-group");h&&(0,t.getComponent)(h,"tooltip").destroy(),(0,t.removeClass)([c],"e-show"),(0,t.addClass)([c],"e-hide")}s&&this.getColumn(r.field).template&&(l=o.previousElementSibling),0===s.children.length&&(l=o.previousElementSibling),this.changeRuleValues(l,r,n,i)}},d.prototype.changeRuleValues=function(e,l,r,i){var o,s,a,u,d=(0,t.closest)(i.element,".e-rule-operator");if(e)if(d=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(r.type=this.selectedColumn.type,o=d.classList.contains("e-rule-sub-filter"),d=o?d.nextElementSibling:d),(0,t.addClass)([d],"e-operator"),d.childElementCount){s=(0,t.getComponent)(d.querySelector(".e-dropdownlist"),"dropdownlist"),r.operator=s.value;var p=void 0;p="DropdownTree"===this.fieldMode?(0,t.getComponent)(e.querySelector(".e-dropdowntree"),"dropdowntree"):(0,t.getComponent)(e.querySelector(".e-dropdownlist"),"dropdownlist"),r.type="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]).type:this.getColumn(p.value).type;var h=i.itemData;""!==s.value&&this.renderValues(d,h,i.previousItemData,!0,l,r,i.element)}else{var g=(0,t.closest)(d,".e-rule-container").id;u=this.createElement("input",{attrs:{type:"text",id:g+"_operatorkey"}}),d.appendChild(u),this.selectedColumn.operators?a=this.selectedColumn.operators:i.itemData&&(a=this.customOperators[this.selectedColumn.type+"Operator"]);var m,f=this.element.className.indexOf("e-device")>-1?"250px":"200px";l.operator&&a.forEach((function(e){"value"in e&&"string"==typeof e.value&&e.value.toLowerCase()===l.operator.toLowerCase()&&(m=e.value)}));var v=m||a[0].value,y=0;this.autoSelectOperator||(v="",y=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.prvtEvtTgrDaD)&&(v=l&&l.operator?l.operator:v);var b=void 0;b={dataSource:a,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:a.length>5?f:"auto",change:this.changeField.bind(this),index:y,value:v,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(b=c({},b,this.operatorModel)),new n.DropDownList(b).appendTo("#"+g+"_operatorkey"),r.operator=l&&""!==l.operator&&!(0,t.isNullOrUndefined)(l.operator)?l.operator:a[0].value,this.isImportRules&&(r.type=this.selectedColumn.type,r.operator=l.operator),(0,t.isNullOrUndefined)(v)||""===v?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element):this.renderValues(d,this.selectedColumn,i.previousItemData,!1,l,r,i.element)}this.isImportRules||this.updateRules(i.element,i.item)},d.prototype.popupOpen=function(e,l){this.enableRtl&&(0,t.addClass)([l.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},d.prototype.destroyControls=function(e,l){for(var n=l?e:e.nextElementSibling,r=n.querySelectorAll("input.e-control"),i=n.querySelectorAll("div.e-control:not(.e-handle)"),o=this.columns,s=0,a=r.length;s<a;s++){if(r[s].classList.contains("e-textbox"))(0,t.getComponent)(r[s],"textbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-dropdownlist"))this.allowValidation&&r[s].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(r[s].parentElement,"tooltip").destroy(),(0,t.getComponent)(r[s],"dropdownlist").destroy();else if(r[s].classList.contains("e-radio"))(0,t.getComponent)(r[s],"radio").destroy();else if(r[s].classList.contains("e-numerictextbox"))(0,t.getComponent)(r[s],"numerictextbox").destroy(),(0,t.detach)((0,t.select)("input#"+r[s].id,n));else if(r[s].classList.contains("e-datepicker"))(0,t.getComponent)(r[s],"datepicker").destroy();else if(r[s].classList.contains("e-multiselect"))(0,t.getComponent)(r[s],"multiselect").destroy();else if(r[s].className.indexOf("e-template")>-1)for(var u=r[s].className,d=0,p=o.length;d<p;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],r[s].id);break}document.getElementById(r[s].id)&&(0,t.detach)(r[s])}for(s=0,a=i.length;s<a;s++){if(i[s].className.indexOf("e-template")>-1)for(u=i[s].className,d=0,p=o.length;d<p;d++)if(o[d].template&&u.indexOf(o[d].field)>-1){this.templateDestroy(o[d],i[s].id);break}(0,t.detach)(i[s])}var c=n.querySelectorAll(".e-template:not(.e-control)");for(s=0,a=c.length;s<a;s++)(0,t.detach)(c[s])},d.prototype.templateDestroy=function(e,l){var n;if("string"!=typeof e.template||void 0===e.template.destroy){var r=(n=e.template).destroy;if(n.destroy){var i=void 0;document.getElementById(l)&&(i=(0,t.closest)(document.getElementById(l),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof r?(r=(0,t.getValue)(r,window))({field:e.field,elementId:l,elements:i}):n.destroy({field:e.field,elementId:l,elements:i})}}},d.prototype.getValues=function(e){var t,l={},n=[],r=[];this.separator.length>0&&(r=e.split(this.separator));var i=this.dataColl;if(this.dataColl[1])for(var o=0,s=i.length;o<s;o++){var a={};if(r.length>1)for(var u=i[o],d=void 0,p=0,c=r.length;p<c;p++)d=r[p],r.length===p+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=i[o][""+e],Number(i[o][""+e])===i[o][""+e]&&i[o][""+e]%1!=0&&(t=i[o][""+e].toString());t in l||(l[""+t]=1,r.length>1?this.createNestedObject(a,r,t):a[""+e]=t,n.push(a))}return n},d.prototype.createNestedObject=function(e,t,l){for(var n,r=t.length-1,i=0;i<r;++i)(n=t[i])in e||(e[""+n]={}),e=e[""+n];e[t[r]]=l},d.prototype.getDistinctValues=function(e,t){for(var l={},n=[],r=[],i="",o=t.indexOf(this.separator),s=function(s,u){i="",0===o?i=e[s][""+t]:(r=t.split(a.separator)).forEach((function(t){i=i?i[""+t]:e[s][""+t]})),Number(e[s][""+t])===e[s][""+t]&&e[s][""+t]%1!=0&&(i=e[s][""+t].toString());var d={};i in l||(l[""+i]=1,0===o?d[""+t]=i:d[r[r.length-1]]=i,n.push(d))},a=this,u=0,d=e.length;u<d;u++)s(u);return n},d.prototype.renderMultiSelect=function(e,t,l,i,o){var s,a,u=!1,d=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(u=!0,s=this.getDistinctValues(this.dataColl,e.field)),u=!e.columns&&u,!this.dataColl.length&&o.length&&(d=!0),a={dataSource:d?o:u?s:this.dataManager,query:new r.Query([e.field]),fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(a=c({},a,this.valueModel.multiSelectModel));var p=new n.MultiSelect(a);p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},d.prototype.multiSelectOpen=function(e,l){if(this.dataSource instanceof r.DataManager){var n=document.getElementById(e),i=(0,t.getComponent)((0,t.closest)(n,".e-rule-container").querySelector(".e-filter-input"),"DropdownTree"===this.fieldMode?"dropdowntree":"dropdownlist");"DropdownTree"===this.fieldMode?this.selectedColumn=this.getColumn(i.value[0]):this.selectedColumn=i.getDataByValue(i.value);var o=this.selectedColumn.field,s=!1;if(this.dataColl[1])Object.keys(this.dataColl[1]).indexOf(o)>-1&&(s=!0),0!==o.indexOf(this.separator)&&this.isGetNestedData&&(s=!0);s||(l.cancel=!0,this.bindMultiSelectData(n,o))}},d.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},d.prototype.getMultiSelectData=function(e,l){var n,i=this,o=new r.Deferred,s=this.dataManager.executeQuery((new r.Query).select(l)),u=(0,t.getComponent)(e,"multiselect");u.hideSpinner(),this.createSpinner((0,t.closest)(e,".e-multi-select-wrapper").parentElement),(0,a.showSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement),s.then((function(r){n=r.actual&&r.actual.result?r.actual.result:r.result,i.dataColl=(0,t.extend)(i.dataColl,n,[],!0),u.dataSource=i.getDistinctValues(i.dataColl,l),i.isGetNestedData=!0,(0,a.hideSpinner)((0,t.closest)(e,".e-multi-select-wrapper").parentElement)})).catch((function(e){o.reject(e)}))},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),(0,a.createSpinner)({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var n=document.getElementById(l.popup.element.id.replace("_popup",""));if(n){var r=(0,t.getComponent)(n,"multiselect");if(r){var i=r.value;this.updateRules(n,i,e)}}},d.prototype.processTemplate=function(e,l,n,r){var i=(0,t.closest)(e,".e-rule-container"),o=i.querySelectorAll(".e-template"),s=i.querySelector(".e-rule-filter .e-filter-input"),a="DropdownTree"===this.fieldMode?(0,t.getComponent)(s,"dropdowntree"):(0,t.getComponent)(i.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),u="DropdownTree"===this.fieldMode?this.getColumn(a.value[0]):this.getColumn(a.value);if("string"==typeof l.template||void 0===l.template.write){var d={rule:n,ruleID:i.id,operator:r.operator,field:u.field,requestType:"value-template-create"};this.trigger("actionBegin",d)}else{var p=l.template;"string"==typeof p.write?(0,t.getValue)(p.write,window)({elements:o.length>1?o:o[0],values:n.value,operator:r.operator,field:u.field,dataSource:u.values}):"function"!=typeof l.template&&l.template.write({elements:o.length>1?o:o[0],values:n.value,operator:r.operator,field:u.field,dataSource:u.values})}},d.prototype.getItemData=function(e){var l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdownlist"),n=this.element.querySelector("#"+e);if("DropdownTree"===this.fieldMode)l=(0,t.getComponent)(document.getElementById(e+"_filterkey"),"dropdowntree");else if(n){var r=n.querySelectorAll(".e-rule-sub-filter");if(r.length>0){var i=r[r.length-1].querySelector(".e-dropdownlist");l=(0,t.getComponent)(i,"dropdownlist")}}return"DropdownTree"===this.fieldMode?this.getColumn(l.value[0]):this.getColumn(l.value)},d.prototype.setDefaultValue=function(e,l,n){var r=this.getItemData(e);if((0,t.isNullOrUndefined)(r.value))return n?l?[0,0]:0:l?[]:"";if(l){if(!(r.value instanceof Array))return[r.value]}else if(r.value instanceof Array)return r.value[0];return r.value},d.prototype.renderStringValue=function(e,t,l,n,r){var o,s,a=this.getItemData(e),u="string"==typeof a.template;if(s=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!==t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(",")),"between"!==l&&"notbetween"!==l||s.length>1&&(s=s[n]);var d=void 0;d={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(d=c({},d,this.valueModel.textBoxModel));var p=new i.TextBox(d);p.appendTo("#"+e+"_valuekey"+n),p.value=s,p.dataBind()}else o=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,o,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?r.style.width="100%":(r.style.width=null,r.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,t,l,n,r,o,s){var a=this.getItemData(e),u="string"==typeof a.template,d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){var p=(d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(h=c({},h,this.valueModel.textBoxModel));var g=new i.TextBox(h);g.appendTo("#"+e+"_valuekey"+n),g.value=p,g.dataBind()}else{var m=(o=a).validation&&o.validation.min?o.validation.min:0,f=o.validation&&o.validation.max?o.validation.max:Number.MAX_VALUE,v=o.format?o.format:"n";s>1&&t&&(d=t.value[n]?t.value[n]:this.setDefaultValue(e,!0,!0));var y=void 0;y={value:d instanceof Array?d[n]:d,format:v,min:m,max:f,width:"100%",step:o.step?o.step:1,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.numericTextBoxModel&&(y=c({},y,this.valueModel.numericTextBoxModel));var b=new i.NumericTextBox(y);b.appendTo("#"+e+"_valuekey"+n),b.element.setAttribute("aria-label",o.label+" Value"),b.element.oninput=this.changeValue.bind(this,n)}else d=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,n,d,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?r.style.width="100%":(r.style.minWidth="200px",r.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],n=e.split(",");if("string"===t)return n;for(var r=0,i=n.length;r<i;r++)l.push(Number(n[r]));return l},d.prototype.parseDate=function(e,l){var n,r;if(l){var i=this.intl.getDateParser({skeleton:"full",type:"dateTime"});n=this.getFormat(l),r=i(e),(0,t.isNullOrUndefined)(r)&&(r=this.intl.parseDate(e,n))}else r=new Date(e);return r},d.prototype.renderControls=function(e,l,n,r,i){if((0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-value"),(0,t.removeClass)([e.parentElement.querySelector(".e-rule-value")],"e-hide"),(0,t.addClass)([e.parentElement.querySelector(".e-rule-value")],"e-show"),l.template&&(l.template.create||i))this.processTemplate(e,l,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 a=(0,t.closest)(e,".e-rule-container").id,u=void 0,d=r.operator.toString();if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){u=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?u.style.width="100%":"in"!==d&&"notin"!==d?(0,t.addClass)([u],"e-custom-value"):(0,t.removeClass)([u],"e-custom-value");for(var p=0;p<s;p++)switch(r.type){case"string":this.renderStringValue(a,n,d,p,u);break;case"number":this.renderNumberValue(a,n,d,p,u,l,s);break;case"boolean":this.processBoolValues(l,n,a,p);break;case"date":var h=new Date,g=void 0,m=void 0,f=l.format,v=void 0,y=void 0,b=this.l10n.getConstant("SelectValue"),C="string"==typeof l.template;if(n.value&&!(0,t.isNullOrUndefined)(f)&&(g=s>1?n.value[p]:n.value,h=this.parseDate(g,f)||new Date),l.field||l.key||!l.value||(h=l.value instanceof Date?l.value:this.parseDate(l.value,l.format)),!l.format&&n&&""!==n.field&&(f=(m=this.getColumn(n.field)).format),(this.isImportRules||this.isPublic||C)&&n&&(f=(m=this.getColumn(n.field)).format,n.value?(g=s>1?n.value[p]:n.value,h=this.parseDate(g,m.format)):h=n.value),f){var S=this.getFormat(f);S.skeleton?(y={locale:this.getLocale(),value:h,placeholder:b,format:S,change:this.changeValue.bind(this,p)},this.valueModel&&this.valueModel.datePickerModel&&(y=c({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y)):(y={value:h,locale:this.getLocale(),placeholder:b,format:S.format,change:this.changeValue.bind(this,p)},this.valueModel&&this.valueModel.datePickerModel&&(y=c({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y))}else y={locale:this.getLocale(),value:h,placeholder:b,change:this.changeValue.bind(this,p)},this.valueModel&&this.valueModel.datePickerModel&&(y=c({},y,this.valueModel.datePickerModel)),v=new o.DatePicker(y);if(v.appendTo("#"+a+"_valuekey"+p),!n.value){var x=document.getElementById(a+"_valuekey"+p);this.updateRules(x,h,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},d.prototype.processBoolValues=function(e,n,r,i){var o,s,a,u,d=!1;if((0,t.isNullOrUndefined)(n.type)&&e&&(n.type=e.type),e.values){var p=e.values;"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=p[i].toLowerCase()===e.value.toString().toLowerCase():0===i&&(d=!0):d=p[i].toLowerCase()===n.value.toString().toLowerCase(),s=o=a=p[i]}else{p=[!0,!1];"boolean"!==n.type||(0,t.isNullOrUndefined)(n.value)?e.value?d=p[i].toString().toLowerCase()===e.value.toString().toLowerCase():0===i&&(d="boolean"!=typeof n.value||!!n.value):d=p[i].toString().toLowerCase()===n.value.toString().toLowerCase(),"boolean"==typeof n.value&&1===i&&(d=!n.value),o=p[i].toString(),s=p[i],a=this.l10n.getConstant(["True","False"][i])}u={label:a,name:r+"default",checked:d,value:o,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.radioButtonModel&&(u=c({},u,this.valueModel.radioButtonModel));var h=new l.RadioButton(u);h.appendTo("#"+r+"_valuekey"+i),d&&this.updateRules(h.element,s,0,!0)},d.prototype.getOperatorIndex=function(e,t){var l,n=e.dataSource.length;for(l=0;l<n;l++)if(t.operator===e.dataSource[l].value)return l;return 0},d.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value?e.value:e.field)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},d.prototype.renderValues=function(e,l,n,r,i,o,s){var a=e.previousElementSibling.getElementsByTagName("input")[0],u="DropdownTree"===this.fieldMode?(0,t.getComponent)(a,"dropdowntree"):(0,t.getComponent)(a,"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);this.selectedRule=d;var p=(0,t.getComponent)(e.querySelector("input"),"dropdownlist");r&&(l=s.id.indexOf("operator")>-1?l:this.selectedRule).operators&&(p.value=null,p.dataBind(),p.dataSource=l.operators,p.index=this.getOperatorIndex(p,i),p.value=o.operator=p.dataSource[p.index].value,this.autoSelectOperator?p.dataBind():(p.index=-1,o.operator=p.value=""));var c=o.operator.toString(),h=!1;if(c.indexOf("null")>-1||c.indexOf("isempty")>-1||c.indexOf("isnotempty")>-1){(f=e.parentElement.querySelector(".e-rule-value"))&&((0,t.removeClass)([f],"e-show"),(0,t.addClass)([f],"e-hide"))}else{var g=(0,t.closest)(e,".e-rule-container").id;if((n=this.getPreviousItemData(n,d))&&void 0===n.template?n.columns&&(n=this.getColumn(i.field)):"DropdownTree"===this.fieldMode&&void 0===n&&(n=this.getColumn(i.field)),n&&n.template){this.templateDestroy(n,g+"_valuekey0");var m=(0,t.select)("#"+g+"_valuekey0",e.nextElementSibling);m&&!m.classList.contains("e-control")&&(0,t.detach)((0,t.select)("#"+g+"_valuekey0",e.nextElementSibling)),"string"!=typeof n.template&&void 0!==n.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([g]),e.nextElementSibling.innerHTML=""),this.isAngular&&!(0,t.isNullOrUndefined)(n.key)&&"DropdownTree"===this.fieldMode&&delete n.template}if(r&&(this.validateValue(i,(0,t.closest)(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||p&&""!==p.value){if(d&&(l.template=d.template),l.template&&((0,t.addClass)([e.nextElementSibling],"e-template-value"),l.template=d.template,h=this.setColumnTemplate(l,g,d.field,l.value||c,e,i)),h){var f=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?f.style.width="100%":f.style.width="200px"}else{(0,t.removeClass)([e.nextElementSibling],"e-template-value");var v=1;v="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:c&&c.toLowerCase().indexOf("between")>-1?2:1;for(var y=0;y<v;y++){var b=this.createElement("input",{attrs:{type:"text",id:g+"_valuekey"+y}});e.nextElementSibling.appendChild(b)}}this.renderControls(e,l,i,o,h),this.isAngular&&!(0,t.isNullOrUndefined)(l.key)&&l.template&&"DropdownTree"===this.fieldMode&&delete l.template}}},d.prototype.setColumnTemplate=function(e,l,n,r,i,o){var s,a=this,u=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return s={requestType:"value-template-initialize",ruleID:l,field:n,operator:r,rule:o,renderTemplate:!0},this.trigger("actionBegin",s,(function(t){u=a.actionBeginSuccessCallBack(t,e,l,n,i)})),u;var d=void 0,p=e.template;if((d="string"==typeof p.create?(0,t.getValue)(p.create,window)({field:n,operator:r}):p.create({field:n,operator:r}))instanceof Element)d.id=l+"_valuekey0",(0,t.addClass)([d],"e-template"),i.nextElementSibling.appendChild(d),n.indexOf(" ")<0&&(0,t.addClass)([d],"e-"+n);else if(d instanceof Array){(0,t.addClass)(d,"e-template");for(var c=0,h=d.length;c<h;c++)d[c].id=l+"_valuekey"+c,i.nextElementSibling.appendChild(d[c])}return(0,t.addClass)([i.nextElementSibling],"e-template-value"),!0}return!0},d.prototype.actionBeginSuccessCallBack=function(e,l,n,r,i){if(e.renderTemplate){var o=void 0;this.columnTemplateFn=this.templateParser((l.template,l.template));var s=this.element.id+r;if(this.isReact)o=this.columnTemplateFn(e,this,n,s)[0],i.nextElementSibling.appendChild(o);else if(this.isAngular){var a=this.columnTemplateFn(e,this,n,s);o=3===a[0].nodeType?a[1]:a[0],i.nextElementSibling.appendChild(o)}else this.isVue3?(o=this.columnTemplateFn(e,this,"Template",s),(0,t.append)(o,i.nextElementSibling)):(o=this.columnTemplateFn(e,this,"Template",s)[0],i.nextElementSibling.appendChild(o));return(0,t.addClass)([i.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},d.prototype.updateValues=function(e,l){var n=1;e.className.indexOf("e-template")>-1&&(n=3);var r,i,o,s,a,u,d=e.className.split(" e-")[n],p=parseInt(e.id.slice(-1),2);switch(d){case"checkbox":s=(0,t.getComponent)(e,d).value,l.value=""!==s?s:void 0;break;case"textbox":u=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[p]=u):["in","notin"].some((function(e){return-1!==l.operator.indexOf(e)}))&&-1===l.operator.indexOf("contains")&&(l.value=u?"string"===l.type?u.split(",").map((function(e){return e.trim()})):u.split(",").map(Number):[]);break;case"dropdownlist":case"multiselect":l.value=(0,t.getComponent)(e,d).value;break;case"radio":(a=(0,t.getComponent)(e,d)).checked&&("boolean"==typeof l.value?l.value="true"===a.value:this.getColumn(l.field).values?l.value=a.value:l.value="true"===a.value),a.refresh();break;case"numerictextbox":l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[p]=(0,t.getComponent)(e,d).value):l.value=(0,t.getComponent)(e,d).value;break;case"datepicker":r=this.getColumn(l.field),i=this.getFormat(r.format),o=(0,t.getComponent)(e,d).value,l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[p]=this.intl.formatDate(o,i)):(0,t.isNullOrUndefined)(i.format)&&o?l.value=this.intl.formatDate(o):l.value=o?this.intl.formatDate(o,i):o}},d.prototype.updateRules=function(e,l,n,r){for(var i,o,s=(0,t.closest)(e,".e-group-container"),a=this.getParentGroup(s),u=(0,t.closest)(e,".e-rule-container"),d=0,p=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!u.classList.contains("e-btn-group")||this.headerTemplate&&(u.classList.contains("e-rule-container")||u.classList.contains("e-group-container"))))&&d++;var h=a.rules[d].operator?a.rules[d].operator.toString():"",g=(u=(0,t.closest)(e,".e-rule-container")).id.replace(this.element.id+"_","");if((0,t.closest)(e,".e-rule-filter")||(0,t.closest)(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),i="DropdownTree"===this.fieldMode?(0,t.getComponent)(e,"dropdowntree"):(0,t.getComponent)(e,"dropdownlist");var m="DropdownTree"===this.fieldMode?this.getColumn(i.value[0]):this.getColumn(i.value);!this.isImportRules&&a.rules[d].field&&a.rules[d].field.toLowerCase()!==m.field.toLowerCase()&&(!u.querySelectorAll(".e-template")&&!(h.indexOf("null")>-1)||h.indexOf("empty")>-1)&&(a.rules[d].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),a.rules[d].field=this.selectedColumn.field,a.rules[d].type=this.selectedColumn.type,a.rules[d].label=this.selectedColumn.label;var f=(0,t.closest)(e,".e-rule-filter"),v=(f=f||(0,t.closest)(e,".e-rule-sub-filter")).nextElementSibling.querySelector("input.e-control");v=v||f.nextElementSibling.nextElementSibling.querySelector("input.e-control"),h=(0,t.getComponent)(v,"dropdownlist").value.toString(),a.rules[d].operator=h;var y=f.nextElementSibling.nextElementSibling,b=y.querySelectorAll("input.e-control");b.length<1&&(b=y.querySelectorAll("div.e-control")),b.length<1&&(b=y.querySelectorAll(".e-template")),o={groupID:p,ruleID:g,value:a.rules[d].field,type:"field"};for(var C=0;C<b.length;C++)h.indexOf("null")>-1||h.indexOf("empty")>-1?a.rules[d].value=null:this.updateValues(b[C],a.rules[d]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",o),this.allowValidation&&a.rules[d].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if((0,t.closest)(e,".e-rule-operator")){i=(0,t.getComponent)(e,"dropdownlist"),a.rules[d].operator=i.value.toString();var S=u.querySelectorAll(".e-rule-value input.e-control");o={groupID:p,ruleID:g,value:i.value,type:"operator"},this.allowValidation&&a.rules[d].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(e.parentElement,"tooltip").destroy(),S.length>1&&!(S[0].className.indexOf("e-template")>-1)&&(a.rules[d].value=[]);for(var x=0;x<S.length;x++)a.rules[d].operator.indexOf("null")>-1||a.rules[d].operator.indexOf("empty")>-1?a.rules[d].value=null:S[x].classList.contains("e-template")||this.updateValues(S[x],a.rules[d]);this.isImportRules||this.trigger("change",o),this.filterRules(c,this.getValidRules(this.rule),"operator")}else(0,t.closest)(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,d,s,u,n),r||this.filterRules(c,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.prvtEvtTgrDaD||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},d.prototype.ruleValueUpdate=function(e,t,l,n,r,i,o){var s,a,u=["in","between","notin","notbetween"];if(l.rules[n].operator&&(a=l.rules[n].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[n].type&&!this.isNotified){for(var d=[],p=t,c=0,h=p.length;c<h;c++)"string"==typeof p[c]&&d.push(parseFloat(p[c]));d.length&&(t=d)}if(this.isNotified)l.rules[n].value=t,s={groupID:r.id,ruleID:i.id,value:l.rules[n].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[n].value[o]=t:l.rules[n].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[n].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[n].type,l.rules[n].value=this.processValueString(t,l.rules[n].type)):"between"===a||"notbetween"===a?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t;else if(e.className.indexOf("e-datepicker")>-1){var g=this.getFormat(this.getColumn(this.selectedColumn.field).format);g.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=this.intl.formatDate(t,g)):l.rules[n].value=this.intl.formatDate(t,g))}this.validateValue(l,i,n)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[o]=t):l.rules[n].value=t},d.prototype.validateValue=function(e,l,n){(0,t.isNullOrUndefined)(n)||(e=e.rules[n]);var r="object"==typeof e.value;if(this.allowValidation&&((0,t.isNullOrUndefined)(n)||(r?e.value.length>0:e.value))){var i=l.querySelectorAll(".e-rule-value .e-control");i.length>0&&(i[0].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(i[0],"tooltip").destroy():i[0].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[0].parentElement,"tooltip").destroy(),i[1]&&i[1].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[1].parentElement,"tooltip").destroy(),i[2]&&i[2].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(i[2].parentElement,"tooltip").destroy())}},d.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},d.prototype.findGroupByIdx=function(e,t,l){var n=t.rules,r=[];if(!l){for(var i=0,o=n.length;i<o;i++)(t=n[i]).rules&&r.push(t);return r[e]}return t},d.prototype.destroy=function(){if(this.isDestroy=!0,this.element){var l,n,r,i;for(e.prototype.destroy.call(this),r=(l=this.element.querySelectorAll(".e-addrulegroup")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdown-btn").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")?(0,t.getComponent)(l[n],"dropdownlist").destroy():(0,t.getComponent)(l[n],"dropdowntree").destroy(),(0,t.detach)(l[n]);for(i=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[n],"tooltip").destroy();for(r=(l=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)")).length,n=0;n<r;n++)(0,t.getComponent)(l[n],"dropdownlist")&&((0,t.getComponent)(l[n],"dropdownlist").destroy(),(0,t.detach)(l[n]));for(i=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),n=0;n<i.length;n++)(0,t.getComponent)(i[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();var o=document.querySelectorAll(".qb-dropdownlist.e-popup");if(o)for(n=0;n<o.length;n++)o[n].remove();(0,t.classList)(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1}},d.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),n=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var r=0,i=e.length;r<i;r++)this.updatedRule={isLocked:e[r].isLocked,condition:e[r].condition,not:e[r].not},this.importRules(e[r],l,!1,e[r].not);this.isPublic=!1}else{var o="and",s=!1,a=!1;this.updatedRule&&(o=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?n.rules.push({condition:o,not:s,rules:[]}):n.rules.push({condition:o,rules:[]}):this.enableNotCondition?n.rules.splice(this.groupIndex+1,0,{condition:o,not:s,rules:[],isLocked:a}):n.rules.splice(this.groupIndex+1,0,{condition:o,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,n,null,!!this.enableSeparateConnector||null)}},d.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&(0,t.addClass)([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableSeparateConnector&&(0,t.addClass)([this.element],"e-multi-connector"),this.enableRtl&&(0,t.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),t.Browser.isDevice||"Vertical"===this.displayMode?(t.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),(0,t.removeClass)(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),(0,t.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&&this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule);var e=(0,t.extend)({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns&&this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var l=this.element.querySelectorAll("label.e-btn"),n=void 0,r=0;r<l.length;r++)n=l.item(r),(0,t.rippleEffect)(n,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),n=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),n.appendChild(l),e.appendChild(n),this.element.appendChild(e)},d.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)},d.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new r.DataManager(this.columns).executeLocal((new r.Query).sortBy("field")))},d.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group")&&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()},d.prototype.notGroupRtl=function(){this.enableRtl?(0,t.addClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):(0,t.removeClass)(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},d.prototype.checkNotGroup=function(e){var l;if(e.rules)for(var n=0;n<e.rules.length;n++)l=e.rules[n],l=this.checkNotGroup(l),e.rules[n]=l;return(0,t.isNullOrUndefined)(e.not)?this.enableNotCondition&&!(0,t.isNullOrUndefined)(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},d.prototype.onPropertyChanged=function(e,l){for(var n=Object.keys(e),r=this.element.querySelector(".e-group-container"),i=this.element.querySelector(".e-summary-content"),o=0,s=n;o<s.length;o++){switch(s[o]){case"summaryView":e.summaryView?(r.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),i=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),i.style.display="block"):(r.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),r.style.display="block",i.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":(0,t.isNullOrUndefined)(e.showButtons.lockGroup)||(e.showButtons.lockGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.lockRule)||(e.showButtons.lockRule?(0,t.removeClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.cloneRule)||(e.showButtons.cloneRule?(0,t.removeClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),(0,t.isNullOrUndefined)(e.showButtons.groupDelete)||(e.showButtons.groupDelete?(0,t.removeClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):(0,t.addClass)(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":l.cssClass&&(0,t.removeClass)([this.element],l.cssClass.split(" ")),e.cssClass&&(0,t.addClass)([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?((0,t.addClass)([this.element],"e-rtl"),this.notGroupRtl()):((0,t.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||(0,t.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 t.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();break;case"allowDragAndDrop":this.allowDragAndDrop=e.allowDragAndDrop,this.refresh();break;case"enableSeparateConnector":this.enableSeparateConnector=e.enableSeparateConnector,this.refresh()}}},d.prototype.preRender=function(){this.element.id=this.element.id||(0,t.getUniqueID)("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",In:"In",NotIn:"Not In",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required",SummaryViewTitle:"Summary View",OtherFields:"Other Fields",AND:"AND",OR:"OR",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof r.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new r.Query).take(1))):(this.dataManager=new r.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new r.Query),this.initControl()),this.renderComplete(),this.allowDragAndDrop&&this.initializeDrag()},d.prototype.initializeDrag=function(){this.draggable=new t.Draggable(this.element,{dragTarget:".e-drag-qb-rule",distance:5,helper:this.helper.bind(this),dragStart:this.dragStartHandler.bind(this),drag:this.dragHandler.bind(this),dragStop:this.dragStopHandler.bind(this),isReplaceDragEle:!0,isPreventSelect:!1,abort:".e-parent-header",isDragScroll:!0})},d.prototype.helper=function(e){var l=this.draggable.currentStateTarget;if(!l.classList.contains("e-drag-qb-rule")||l.classList.contains("e-drag-qb-rule")&&(0,t.closest)(l,".e-disable"))return!1;var n,r=this.createElement("div",{className:"e-cloneproperties e-draganddrop e-dragclone",styles:'height:"auto", z-index:2, width:'+this.element.offsetWidth});if(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header"))n=(0,t.closest)(l,".e-group-container").cloneNode(!0),(0,t.closest)(l,".e-group-container").classList.add("e-qb-dragging-rule");else{r.classList.add("e-group-body"),n=this.createElement("div",{className:"e-rule-container"});var i=(0,t.closest)(l,".e-rule-field").cloneNode(!0);n.appendChild(i),(0,t.closest)(l,".e-rule-field").classList.add("e-qb-dragging-rule")}return r.appendChild(n),r.querySelectorAll("*").forEach((function(e){e.removeAttribute("id")})),this.element.appendChild(r),r},d.prototype.dragStartHandler=function(e){this.draggedRule=e.target,this.isDragEventPrevent=!1,document.body.classList.add("e-prevent-select"),this.dragElement=e.dragElement;var l=(0,t.closest)(e.target,".e-rule-container"),n=(0,t.closest)(e.target,".e-group-container"),r={dragRuleID:null!==l?l.id:n.id,dragGroupID:n.id,cancel:!1};this.trigger("dragStart",r),this.isDragEventPrevent=r.cancel},d.prototype.dragHandler=function(e){if(!this.isDragEventPrevent){var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");if(l.forEach((function(e){e.classList.remove("e-drag-rule-bottom-line")})),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach((function(e){e.classList.remove("e-drag-rule-top-line")})),!(0,t.isNullOrUndefined)(e.target))if("HTML"===e.target.nodeName||(0,t.closest)(e.target,".e-qb-dragging-rule")||(0,t.closest)(e.target,".e-group-header")||!(0,t.closest)(e.target,"#"+this.element.id)||(0,t.closest)(e.target,".e-disable")||e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector)this.dragElement.classList.add("e-notallowedcur");else{this.dragElement.classList.remove("e-notallowedcur");var n=(0,t.closest)(e.target,".e-rule-container"),r=(0,t.closest)(e.target,".e-group-container");if(n){var i=n.getBoundingClientRect(),o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top,s=i.bottom-u;o<(a=20)?n.classList.add("e-drag-rule-top-line"):s<a&&n.classList.add("e-drag-rule-bottom-line")}else if(e.target.classList.contains("e-rule-list")&&0===e.target.children.length)e.target.classList.add("e-drag-rule-bottom-line");else if(e.target.classList.contains("e-rule-list")&&e.target.children[0].classList.contains("e-group-container")){i=e.target.children[0].getBoundingClientRect();(o=(u=e.event.clientY||e.event.changedTouches[0].clientY)-i.top)<(a=20)&&e.target.classList.add("e-drag-rule-top-line")}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&(r||(r=e.target),r.id.indexOf("group0")>-1)){i=e.target.getBoundingClientRect();var a,u=e.event.clientY||e.event.changedTouches[0].clientY;(s=i.bottom-u)<(a=20)&&e.target.classList.add("e-drag-rule-bottom-line")}var d={dragRuleID:null!==n?n.id:null!==r?r.id:null,dragGroupID:null!==r?r.id:null,cancel:!1};this.trigger("drag",d),this.isDragEventPrevent=d.cancel}}},d.prototype.dragStopHandler=function(e){var l=this;if(!this.isDragEventPrevent){var n,r,i=(0,t.closest)(e.target,".e-rule-container");if((0,t.isNullOrUndefined)(i)&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector&&(i=(0,t.closest)(e.target.parentElement.previousElementSibling,".e-rule-container")),(0,t.isNullOrUndefined)(e.helper)||(n=(0,t.closest)(e.helper,".e-notallowedcur")),!n){var o=(0,t.closest)(e.target,".e-group-container"),s={cancel:!1,dropRuleID:null!==i?i.id:null!==o?o.id:null,dropGroupID:null!==o?o.id:null};this.trigger("drop",s),s.cancel&&(n=!0),r=this.getValidRules()}this.prvtEvtTgrDaD=!0;var a=this.enableSeparateConnector&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")?e.target.parentElement.previousElementSibling:e.target;if(i&&!n){var u=i.id.split(this.element.id+"_")[1].split("_")[0];if(this.draggable.currentStateTarget.parentElement.classList.contains("e-rule-field")||this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")){var d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(i),[],!0)).properties&&(v=v.properties),(f=(0,t.closest)(i,".e-group-container")).querySelectorAll(".e-group-container").forEach((function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)}));for(var p=f.querySelectorAll(".e-rule-container"),c=[],h=void 0,g=0;g<p.length;g++)(p[g].classList.contains("e-drag-rule-top-line")||p[g].classList.contains("e-drag-rule-bottom-line"))&&(h=g),c.push(p[g].id.split(this.element.id+"_")[1]);this.deleteRules(c),i.classList.contains("e-drag-rule-top-line")?v.rules.splice(h,0,d):v.rules.splice(h+1,0,d),v.rules.forEach((function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],u):l.addRules([e],u):e.condition?l.addGroups([e],u):l.addRules([e],u)}))}}else if(a.classList.contains("e-rule-list")&&0===a.children.length&&!n){var m=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],m):this.addRules([d],m):d.condition?this.addGroups([d],m):this.addRules([d],m)}else if(a.classList.contains("e-rule-list")&&a.children[0].classList.contains("e-group-container")&&!n){var f,v,y=(f=(0,t.closest)(a,".e-group-container")).id.split(this.element.id+"_")[1].split("_")[0];d=void 0;this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),(v=(0,t.extend)([],this.getGroup(a),[],!0)).properties&&(v=v.properties),a.querySelectorAll(".e-group-container").forEach((function(e){l.element.querySelector("#"+e.id)&&l.deleteGroup(e)})),(p=f.querySelectorAll(".e-rule-container")).forEach((function(e){l.element.querySelector("#"+e.id)&&l.deleteRule(e)})),this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?this.addGroups([d],y):this.addRules([d],y),v.rules.forEach((function(e){l.enableSeparateConnector?e.rules?l.addGroups([e],y):l.addRules([e],y):e.condition?l.addGroups([e],y):l.addRules([e],y)}))}else if(((0,t.closest)(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&!n){d=void 0;!(i=(0,t.closest)(e.target,".e-group-container"))&&e.target.classList.contains("e-group-container")&&(i=e.target),"group0"===(m=i.id.split(this.element.id+"_")[1].split("_")[0])&&(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(d=this.getGroup(this.draggedRule),this.deleteGroup((0,t.closest)(this.draggedRule,".e-group-container"))):(d=this.getRule(this.draggedRule),this.deleteRule(this.draggedRule)),this.enableSeparateConnector?d.rules?this.addGroups([d],m):this.addRules([d],m):d.condition?this.addGroups([d],m):this.addRules([d],m))}n||this.trigger("ruleChange",{previousRule:r,rule:this.getValidRules(),type:"drag-and-drop"}),this.prvtEvtTgrDaD=!1,document.body.classList.remove("e-prevent-select");var b=this.element.querySelectorAll(".e-drag-rule-bottom-line");b.forEach((function(e){e.classList.remove("e-drag-rule-bottom-line")})),(b=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach((function(e){e.classList.remove("e-drag-rule-top-line")})),(b=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach((function(e){e.classList.remove("e-qb-dragging-rule")})),e.helper&&e.helper.classList.contains("e-cloneproperties")&&document.querySelector("."+e.helper.classList[0])&&(0,t.remove)(e.helper),this.enableSeparateConnector&&this.refresh()}},d.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?(0,t.compile)(document.querySelector(e).innerHTML.trim()):(0,t.compile)(e)}catch(l){return(0,t.compile)(e)}},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),n=new r.Deferred;l.then((function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()})).catch((function(e){n.reject(e)}))},d.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this),t.EventHandler.add(e,"focusout",this.focusEventHandler,this),t.EventHandler.add(e,"focusin",this.focusEventHandler,this),t.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this),t.EventHandler.add(document,"keydown",this.keyBoardHandler,this)},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler),t.EventHandler.remove(e,"focusout",this.focusEventHandler),t.EventHandler.remove(e,"focusin",this.focusEventHandler),t.EventHandler.remove(this.element,"keydown",this.keyBoardHandler),t.EventHandler.remove(document,"keydown",this.keyBoardHandler)},d.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],n=t?l.length-1:l.length,r=this.rule,i=0;i<n;i++)r=this.findGroupByIdx(l[i],r,0===i);return r},d.prototype.deleteGroup=function(e){var t,l=this,n=e;if("string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t),t=t.replace(this.element.id+"_","")):t=n.id.replace(this.element.id+"_",""),"group0"!==t&&e){var r={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteGroupSuccessCallBack(r,e):this.trigger("beforeChange",r,(function(t){l.deleteGroupSuccessCallBack(t,e)}))}},d.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){var n=l,r=this.getParentGroup(n,!0),i=0,o=void 0,s=void 0,a=this.getValidRules(this.rule),u=n.nextElementSibling,d=n.previousElementSibling,p=n.querySelectorAll(".e-group-container"),c=n.querySelectorAll(".e-tooltip");for(s=c.length,o=0;o<s;o++)(0,t.getComponent)(c[o],"tooltip").destroy();for(o=0,s=p.length;o<s;o++)delete this.levelColl[p[o].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!n.classList.contains("e-btn-group")||this.headerTemplate&&(n.classList.contains("e-rule-container")||n.classList.contains("e-group-container"))))&&i++;this.enableSeparateConnector||u&&u.className.indexOf("e-separate-rule")>-1&&((0,t.removeClass)([u],"e-separate-rule"),(0,t.addClass)([u],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&(0,t.addClass)([d],"e-prev-joined-rule"));var h=n.parentElement.parentElement.parentElement,g=[];if(this.isReact||this.isAngular){var m=r.rules[i],f=l.querySelectorAll(".e-rule-container");if(m&&m.rules)for(var v=0;v<m.rules.length;v++){var y=this.getColumn(m.rules[v].field);if(f[v]){var b=f[v].querySelector(".e-template-value");y&&(y.ruleTemplate||this.isPlatformTemplate(y)&&b)&&g.push(f[v].id)}}}(0,t.detach)(l),this.headerTemplate&&this.clearQBTemplate([l.id]),g.length&&this.clearQBTemplate(g),r.rules.splice(i,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(h,r),this.enableSeparateConnector&&d&&(!this.headerTemplate&&d.classList.contains("e-btn-group")||this.headerTemplate&&d.classList.contains("e-custom-group-btn"))&&(0,t.detach)(d),this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},d.prototype.deleteRule=function(e){var l=this,n={groupID:(0,t.closest)(e,".e-group-container").id.replace(this.element.id+"_",""),ruleID:(0,t.closest)(e,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteRuleSuccessCallBack(n,e):this.trigger("beforeChange",n,(function(t){l.deleteRuleSuccessCallBack(t,e)}))},d.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=this.getParentGroup(n),i=(0,t.closest)(l,".e-rule-container"),o=this.getValidRules(this.rule),s=i.previousElementSibling,a=0,u=i,d=i.nextElementSibling,p=i.querySelectorAll(".e-tooltip"),c=void 0,h=p.length;for(c=0;c<h;c++)(0,t.getComponent)(p[c],"tooltip").destroy();for(;null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&a++;var g=this.getColumn(r.rules[a].field);g&&g.template&&u.querySelector(".e-template")&&this.templateDestroy(g,u.querySelector(".e-template").id),(!s||s.className.indexOf("e-rule-container")<0)&&d&&(0,t.removeClass)([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&s&&(0,t.removeClass)([s],"e-prev-joined-rule");var m=u.querySelector(".e-template-value");try{if(this.enableSeparateConnector&&(u.previousElementSibling||u.nextElementSibling)){var f=u.previousElementSibling,v=u.nextElementSibling;if((0,t.isNullOrUndefined)(v)&&(!this.headerTemplate&&f.classList.contains("e-btn-group")||this.headerTemplate&&f.classList.contains("e-custom-group-btn"))){if(f&&f.previousElementSibling&&f.previousElementSibling.classList.contains("e-rule-container"))this.getRule(f.previousElementSibling).condition=null;(0,t.detach)(f)}else(!this.headerTemplate&&v.classList.contains("e-btn-group")||this.headerTemplate&&v.classList.contains("e-custom-group-btn"))&&(0,t.detach)(v)}(0,t.detach)(u)}catch(e){return}g&&g.ruleTemplate&&this.clearQBTemplate([u.id]),g&&this.isPlatformTemplate(g)&&m&&this.clearQBTemplate([u.id]),r.rules.splice(a,1),r.rules[0]&&r.rules[0].rules||this.disableRuleCondition(n,r,!!this.enableSeparateConnector);for(var y=this.element.querySelectorAll(".e-tooltip"),b=0;b<y.length;b++)(0,t.getComponent)(y[b],"tooltip").refresh(y[b]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(o,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},d.prototype.keyBoardHandler=function(e){if(e.currentTarget!==this.element||!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode){if("Escape"===e.code&&this.allowDragAndDrop){this.isDragEventPrevent=!0,document.body.classList.remove("e-prevent-select");var l=this.element.querySelectorAll(".e-drag-rule-bottom-line");l.forEach((function(e){e.classList.remove("e-drag-rule-bottom-line")})),(l=this.element.querySelectorAll(".e-drag-rule-top-line")).forEach((function(e){e.classList.remove("e-drag-rule-top-line")})),(l=this.element.querySelectorAll(".e-qb-dragging-rule")).forEach((function(e){e.classList.remove("e-qb-dragging-rule")}));var n=this.element.querySelector(".e-cloneproperties");n&&(0,t.remove)(n),this.enableSeparateConnector&&this.refresh()}}else e.preventDefault()},d.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},d.prototype.disableRuleCondition=function(e,l,n,r){if(!this.headerTemplate){if(this.readonly)return;var i=e.querySelector(".e-rule-list").childElementCount,o=e.querySelector(".e-btngroup-and"),s=e.querySelector(".e-btngroup-or");if(i>1)if(o.disabled=!1,s.disabled=!1,(s.nextElementSibling.classList.contains("e-btn-disable")||o.nextElementSibling.classList.contains("e-btn-disable"))&&(s.nextElementSibling.classList.remove("e-btn-disable"),o.nextElementSibling.classList.remove("e-btn-disable")),this.enableSeparateConnector&&!n){for(var a=0,u=void 0;;){var d=e.parentElement.querySelectorAll(".e-btngroup-and"),p=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=p[p.length-(1+a)],!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}for(var c=e.previousElementSibling;c&&!c.classList.contains("e-rule-container");){if(c.classList.contains("e-group-container")){c=c.querySelectorAll(".e-rule-container")[c.querySelectorAll(".e-rule-container").length-1];break}c=c.previousElementSibling}if(r&&e.classList.contains("e-group-container"))c=e,"or"===this.getGroup(c).condition?s.checked=!0:o.checked=!0;else if(c&&c.classList.contains("e-rule-container")){var h=c.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition?s.checked=!0:o.checked=!0}}else n||(l&&"or"===l.condition?s.checked=!0:o.checked=!0);else if(this.enableSeparateConnector&&!n){for(a=0,u=void 0;;){d=e.parentElement.querySelectorAll(".e-btngroup-and"),p=e.parentElement.querySelectorAll(".e-btngroup-or");if(o=d[d.length-(1+a)],s=p[p.length-(1+a)],!(u=d[d.length-(1+a)])||!u.parentElement||"none"!==u.parentElement.style.display)break;a++}c=void 0;for(var g=e.previousElementSibling;g;){if(g.classList.contains("e-group-container")&&(g=g.querySelectorAll(".e-rule-container")[g.querySelectorAll(".e-rule-container").length-1]),g.classList.contains("e-rule-container")){c=g;break}g=g.previousElementSibling}if((0,t.isNullOrUndefined)(c)&&e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]&&(c=e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]),r&&e.classList.contains("e-group-container"))c=e,"or"===this.getGroup(c).condition?s.checked=!0:o.checked=!0;else if(c){h=c.id.replace(this.element.id+"_","");"or"===this.getRule(h).condition&&s?s.checked=!0:o&&(o.checked=!0)}}else n||(0,t.isNullOrUndefined)(o)||(o.checked=!1,o.disabled=!0,s.checked=!1,s.disabled=!0,l&&(s.nextElementSibling.classList.add("e-btn-disable"),o.nextElementSibling.classList.add("e-btn-disable")))}},d.prototype.getValidRules=function(e){this.isValueEmpty=!0,e||(e=this.getRules());var l=e.condition,n=e.not,r=(0,t.extend)([],e.rules,[],!0),i=(0,t.isNullOrUndefined)(e.isLocked)?this.getRuleCollection({condition:l,rules:r,not:n},!0):this.getRuleCollection({condition:l,rules:r,not:n,isLocked:e.isLocked},!0);return this.isValueEmpty=!1,i},d.prototype.getRuleCollection=function(e,l){if((0,t.isNullOrUndefined)(e))return null;var n;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||l))for(var r=e.rules.length,i=0;i<r;i++)n=e.rules[i],n=this.getRuleCollection(n,l),e.rules[i]=n,Object.keys(n).length<1&&l&&(e.rules.splice(i,1),i--,r--);var o=e.custom;if(e.field&&""!==e.field&&((0,t.isNullOrUndefined)(o)||o&&"question"!==o.type&&"answer"!==o.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&&(this.isValueEmpty?""!==e.value&&void 0!==e.value:void 0!==e.value)||o&&o.isQuestion){var s=e.condition,a=e.isLocked;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value},(0,t.isNullOrUndefined)(a)||(e.isLocked=a),s&&(e.condition=s),o&&(e.custom=o),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={}),("between"===e.operator||"notbetween"===e.operator)&&Array.isArray(e.value)&&(e.value.length<2||e.value.some((function(e){return""===e||null===e})))&&(e={})}else e={};else if(!o||"question"!==o.type&&"answer"!==o.type)if((0,t.isNullOrUndefined)(e.condition)&&(0,t.isNullOrUndefined)(e.rules))e={};else{var u=e.isLocked;e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},(0,t.isNullOrUndefined)(u)||(e.isLocked=u),o&&(e.custom=o),e.rules&&0===e.rules.length&&(e={})}else{var d=e.not;(e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules}).custom=o,this.enableNotCondition&&(e.not=d)}return e},d.prototype.setRules=function(e){var l=(0,t.extend)({},e,{},!0);this.headerTemplate?this.setGroupRules(l,!0):this.setGroupRules(l)},d.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},(0,t.isNullOrUndefined)(this.rule.isLocked)||(e.isLocked=this.rule.isLocked),this.rule.custom&&(e.custom=this.rule.custom),e},d.prototype.getRule=function(e){var l,n,r=0;if(e instanceof HTMLElement?l=(0,t.closest)(e,".e-rule-container"):(n=this.element.id+"_"+e,l=document.getElementById(n)),(0,t.isNullOrUndefined)(l))return null;for(var i=(0,t.closest)(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!l.classList.contains("e-btn-group")||this.headerTemplate&&(l.classList.contains("e-rule-container")||l.classList.contains("e-group-container"))))&&r++;return o.rules[r]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=(0,t.closest)(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(l)},d.prototype.deleteGroups=function(e){var t,l,n=e.length;for(t=0;t<n;t++)"group0"!==e[t]&&(l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l)))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),l=(0,t.isNullOrUndefined)(e)?new r.Query:(new r.Query).where(e);return this.dataManager.executeQuery(l)},d.prototype.deleteRules=function(e){var t,l,n=e.length;for(t=0;t<n;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],n=0,i=Object.keys(this.columns);n<i.length;n++)l.push(this.columns[n].field);return e.rules.length?(new r.Query).select(l).where(t):(new r.Query).select(l)},d.prototype.getPredicate=function(e){var l,n,i,o,s=e.rules,a=!1;if(!s)return l;for(var u=0,d=s.length;u<d;u++){var p=s[u].operator;if("notstartswith"===p?p="doesnotstartwith":"notendswith"===p?p="doesnotendwith":"notcontains"===p&&(p="doesnotcontain"),a=!1,Object.keys(s[u]).indexOf("rules")>-1&&s[u].rules)(n=this.getPredicate(s[u]))&&(l=l?"and"===e.condition?l.and(n):l.or(n):n);else if(!(0,t.isNullOrUndefined)(p)&&!(0,t.isNullOrUndefined)(p.length)){var c=s[u].operator.toLowerCase(),h=!1,g=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===s[u].type&&(a=!this.matchCase),"date"===s[u].type&&g.indexOf(c)>-1&&(a=!0),o=this.getColumn(s[u].field),c.indexOf("null")>-1||c.indexOf("empty")>-1)s[u].value=null;else if("date"!==s[u].type||s[u].value instanceof Array)i=s[u].value;else{var m=this.getFormat(o.format);(0,t.isNullOrUndefined)(s[u].value)?i=null:(i=this.getDate(s[u].value,m),g.indexOf(c)>-1&&!this.isTime(s[u].value)&&(h=!0))}if(0===u)if(h||(c.indexOf("in")>-1||c.indexOf("between")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contain")<0)l=h?this.datePredicate(s[u],i):this.arrayPredicate(s[u]);else""!==(f=i)&&(l=new r.Predicate(s[u].field,p,i,a));else if(h||(c.indexOf("in")>-1||c.indexOf("between")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contain")<0)l=h?this.datePredicate(s[u],i,l,e.condition):this.arrayPredicate(s[u],l,e.condition);else if("and"===e.condition){var f=i;l&&""!==f?l=l.and(s[u].field,p,i,a):""!==f&&(l=new r.Predicate(s[u].field,p,i,a))}else{f=i;l&&""!==f?l=l.or(s[u].field,p,i,a):""!==f&&(l=new r.Predicate(s[u].field,p,i,a))}}}return this.dataSource instanceof r.DataManager&&((0,t.isNullOrUndefined)(l)||"isnull"!==l.operator&&"isnotnull"!==l.operator||(l.operator="isnull"===l.operator?"equal":"notequal")),l},d.prototype.getLocale=function(){var e=this.locale;return(0,t.getValue)("main."+this.locale+".dates.calendars.gregorian.days.format.short",t.cldrData)||(e="en"),e},d.prototype.getColumn=function(e,t){for(var l,n=this.columns,r=0,i=(n=t||n).length;r<i;r++){if(n[r].field===e){l=n[r];break}if(n[r].columns){if(l=this.getColumn(e,n[r].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&n[r].field===e.split(this.separator)[0]){l=n[r];break}}return l},d.prototype.getOperators=function(e){return this.getColumn(e).operators},d.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},d.prototype.datePredicate=function(e,t,l,n){var i,o=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":i=(i=new r.Predicate(e.field,"greaterthanorequal",o)).and(e.field,"lessthanorequal",s);break;case"notequal":i=(i=new r.Predicate(e.field,"lessthan",o)).or(e.field,"greaterthan",s);break;case"greaterthan":i=new r.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":i=new r.Predicate(e.field,"greaterthanorequal",o);break;case"lessthan":i=new r.Predicate(e.field,"lessthan",o);break;case"lessthanorequal":i=new r.Predicate(e.field,"lessthanorequal",s)}return i&&(l?"and"===n?l=l.and(i):"or"===n&&(l=l.or(i)):l=i),l},d.prototype.arrayPredicate=function(e,t,l){var n,i=e.value,o=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(o.indexOf("null")>-1||o.indexOf("empty")>-1)switch(o){case"isnull":n=new r.Predicate(e.field,"isnull",s);break;case"isnotnull":n=new r.Predicate(e.field,"isnotnull",s);break;case"isempty":n=new r.Predicate(e.field,"equal","");break;case"isnotempty":n=new r.Predicate(e.field,"notequal","")}if(!(o.indexOf("null")>-1||o.indexOf("empty")>-1))for(var d=0,p=i.length;d<p;d++)if(""!==i[d]||("in"===o||"notin"===o)&&"string"===a.type)if(0===d){var c="greaterthanorequal";switch(o){case"between":n="date"!==a.type?new r.Predicate(e.field,c,i[d]):new r.Predicate(e.field,c,i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null);break;case"notbetween":n="date"===a.type?new r.Predicate(e.field,"lessthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u),!0):null):new r.Predicate(e.field,"lessthan",i[d]);break;case"in":n=new r.Predicate(e.field,"equal",i[d]);break;case"notin":n=new r.Predicate(e.field,"notequal",i[d])}}else{switch(e.operator){case"between":n="date"===a.type?n.and(e.field,"lessthanorequal",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.and(e.field,"lessthanorequal",i[d]);break;case"notbetween":n="date"===a.type?n.or(e.field,"greaterthan",i[d]?this.isTime(i[d])?this.getDate(i[d],u):this.setTime(this.getDate(i[d],u)):i[d]):n.or(e.field,"greaterthan",i[d]);break;case"in":n=n.or(e.field,"equal",i[d]);break;case"notin":n=n.and(e.field,"notequal",i[d])}}return n&&(t?"and"===l?t=t.and(n):"or"===l&&(t=t.or(n)):t=n),t},d.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&((l=new Date).setHours(parseInt(e.split(":")[0],10)),l.setMinutes(parseInt(e.split(":")[1],10)),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2],10))),l},d.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},d.prototype.importRules=function(e,l,n,r,i){if(n){if(e.rules&&e.rules.length>1&&!this.headerTemplate){var o=l.querySelector(".e-btngroup-or"),s=l.querySelector(".e-btngroup-and");if(this.enableSeparateConnector&&l.previousElementSibling&&(o=l.previousElementSibling.querySelector(".e-btngroup-or"),s=l.previousElementSibling.querySelector(".e-btngroup-and")),o.disabled=!1,s.disabled=!1,this.enableSeparateConnector){for(var a=l.previousElementSibling;a&&!a.classList.contains("e-rule-container");){if(a.classList.contains("e-group-container")){a=a.querySelectorAll(".e-rule-container")[a.querySelectorAll(".e-rule-container").length-1];break}a=a.previousElementSibling}if(a&&a.classList.contains("e-rule-container")){var u=a.id.replace(this.element.id+"_","");"or"===this.getRule(u).condition?o.checked=!0:s.checked=!0}}else"or"===e.condition?o.checked=!0:s.checked=!0}else this.disableRuleCondition(l);if(this.headerTemplate&&i&&(l=this.renderGroup(e,e.condition,this.element,e.not,i)),this.enableNotCondition&&!this.headerTemplate){var d=l.querySelector(".e-qb-toggle");e.not?(0,t.addClass)([d],"e-active-toggle"):(0,t.removeClass)([d],"e-active-toggle")}}else l=this.renderGroup(e,e.condition,l,r);e.rules&&0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var p=e.rules;if(!(0,t.isNullOrUndefined)(p))for(var c=0,h=p.length;c<h;c++){var g=Object.keys(p[c]);if(!(0,t.isNullOrUndefined)(p[c].rules)&&g.indexOf("rules")>-1&&0!==p[c].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;l=this.renderGroup(p[c],p[c].condition,l,p[c].not),l=this.importRules(p[c],l,!0)}else this.renderRule(p[c],l);if(!(0,t.isNullOrUndefined)(p[c].rules)&&p[c].isLocked){var m=l.querySelector(".e-rule-list").children[c].querySelector(".e-lock-grp-btn");this.groupLock(m)}}return l&&(l=(0,t.closest)(l,".e-rule-list")),l&&(l=(0,t.closest)(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t,l,n,r){this.addGroupElement(!0,l,t,!1,n,r,e);var i=l.querySelectorAll(".e-group-container"),o=l.querySelector(".e-rule-list").children;if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup){this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1;var s=0,a=this.groupIndex+1;if(this.enableSeparateConnector)for(var u=0;u<a;u++)o[u].classList.contains("e-rule-container")&&(a++,s++);return o[this.groupIndex+s+1]}return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,o[o.length-1]):i[i.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.enableReadonly=function(){for(var e=this.element.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),r=0;r<e.length;r++){if(e[r].classList.contains("e-dropdownlist"))(0,t.getInstance)(e[r],n.DropDownList).readonly=this.isReadonly;else if(e[r].classList.contains("e-dropdowntree")){(0,t.getComponent)(e[r],"dropdowntree").readonly=this.isReadonly}else if(e[r].classList.contains("e-numerictextbox")){(0,t.getInstance)(e[r],i.NumericTextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-textbox")){(0,t.getInstance)(e[r],i.TextBox).readonly=this.isReadonly}else if(e[r].classList.contains("e-datepicker")){(0,t.getInstance)(e[r],o.DatePicker).readonly=this.isReadonly}else if(e[r].classList.contains("e-multiselect")){(0,t.getInstance)(e[r],n.MultiSelect).readonly=this.isReadonly}else if(e[r].classList.contains("e-radio")){(0,t.getInstance)(e[r],l.RadioButton).checked||(this.isReadonly?e[r].parentElement.style.display="none":e[r].parentElement.style.display="inherit")}}var s=this.element.querySelectorAll(".e-deletegroup"),a=this.element.querySelectorAll(".e-addrulegroup"),u=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");var d=[s,a,u];for(r=0;r<d.length;r++)d[r].forEach((function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")}));this.enableBtnGroup()},d.prototype.enableBtnGroup=function(){var e=this,t=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;t.forEach((function(t){!t.classList.contains("e-qb-toggle")||t.classList.contains("e-active-toggle")||t.classList.contains("e-readonly")?t.classList.contains("e-qb-toggle")&&t.classList.contains("e-not-readonly")?t.classList.remove("e-not-readonly"):t.classList.contains("e-qb-toggle")&&t.classList.contains("e-readonly")?t.classList.remove("e-readonly"):t.classList.contains("e-active-toggle")?(t.classList.add("e-not-readonly"),l=!0):t.previousElementSibling.checked||t.classList.contains("e-readonly")?(t.classList.remove("e-readonly"),l?"AND"===t.textContent?t.classList.add("e-readonly-and"):t.classList.add("e-readonly-or"):("AND"===t.textContent&&e.isReadonly?(t.classList.remove("e-not"),t.classList.add("e-readonly-and")):(e.enableNotCondition&&t.classList.add("e-not"),t.classList.remove("e-readonly-and")),"OR"===t.textContent&&e.isReadonly?t.classList.add("e-readonly-or-not"):t.classList.remove("e-readonly-or-not"))):t.classList.contains("e-btn-disable")||t.classList.add("e-readonly"):(t.classList.add("e-readonly"),l=!1)}))},d.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,n=t.length;l<n;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},d.prototype.getSqlString=function(e,t,l,n){var r=!1;l||""===l?l+="(":(l="",r=!0);var i=e.condition;if(e.not){l+=r?n?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (":n?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT ("}if(e.rules)for(var o=0,s=e.rules.length;o<s;o++){if(e.rules[o].rules)l=this.getSqlString(e.rules[o],t,l,n),this.enableSeparateConnector&&(i=e.rules[o].condition);else{var a=e.rules[o],u="",d=n?this.sqlOperators[a.operator]:this.operators[a.operator];if(a.value instanceof Array)if(a.operator.toString().indexOf("between")>-1){var p=n?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==a.type||this.isDateFunction(a.value[0])?u+=a.value[0]+p+a.value[1]:u+='"'+a.value[0]+'"'+p+'"'+a.value[1]+'"'}else if("string"==typeof a.value[0]&&null!==a.value){u+='("'+a.value[0]+'"';for(var c=1,h=a.value.length;c<h;c++)u+=',"'+a.value[c]+'"';u+=")"}else u+="("+a.value+")";else a.operator.toString().indexOf("startswith")>-1?u+=a.value?'("'+a.value+'%")':"("+a.value+")":a.operator.toString().indexOf("endswith")>-1?u+=a.value?'("%'+a.value+'")':"("+a.value+")":a.operator.toString().indexOf("contains")>-1?u+=a.value?'("%'+a.value+'%")':"("+a.value+")":"number"===a.type||"boolean"==typeof a.value||null===a.value&&a.operator.toString().indexOf("empty")<-1?u+=a.value:a.operator.toString().indexOf("empty")>-1?u+='""':u+='"'+a.value+'"';if(a.operator.toString().indexOf("null")>-1)t?a.field="`"+a.field+"`":a.field.indexOf(" ")>-1&&(a.field='"'+a.field+'"'),l+=a.field+" "+d;else{var g=d;"isempty"===a.operator?g="=":"isnotempty"===a.operator&&(g="!="),t?a.field="`"+a.field+"`":a.field.indexOf(" ")>-1&&(a.field='"'+a.field+'"'),l+=a.field+" "+g+" "+u}a.condition&&""!==a.condition&&(i=a.condition)}if(o!==s-1){a=e.rules[o];(""===i||a&&""!==a.condition&&a.custom&&a.custom.isCustom)&&(i=a.condition),i&&(l+=" "+(i=n?this.l10n.getConstant(i.toUpperCase()).toUpperCase():i.toUpperCase())+" ")}}return r||(l+=")"),e.not&&(l+=")"),l},d.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},d.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},d.prototype.getSqlFromRules=function(e,t,l){return e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},d.prototype.getParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null},d.prototype.setParameterizedNamedSql=function(e){if(this.moduleLoader.loadedModules.length){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var n=this.getRulesFromSql(l);this.setRules({condition:n.condition,not:n.not,rules:n.rules})}}else console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.setMongoQuery=function(e,t){this.moduleLoader.loadedModules.length?(this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},d.prototype.getMongoQuery=function(e){if(this.moduleLoader.loadedModules.length){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery}return console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),""},d.prototype.cloneRule=function(e,t,l){var n=this.getRule(e.replace(this.element.id+"_","")),r=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:n.label,field:n.field,type:n.type,operator:n.operator,value:n.value,condition:n.condition}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=r,r=!1},d.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var n=this.getGroup(t),r=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=r,r=!1},d.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},d.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},d.prototype.sqlParser=function(e,t){var l,n=0;do{l=e.slice(n),n+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},d.prototype.parseSqlStrings=function(e,t){var l,n,r,i,o=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"],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 s=0,a=o.length;s<a;s++){if(r=/^\w+$/.test(o[s])?"\\b":"",new RegExp("^("+o[s]+")"+r,"ig").exec(e))return this.parser.push(["Operators",o[s].toLowerCase()]),o[s].length}var u=this.parser[this.parser.length-1];if(!u||u&&"Literal"!==u[0])for(s=0,a=l.length;s<a;s++){if(r=/^\w+$/.test(l[s])?"\\b":"",new RegExp("^("+l[s]+")"+r,"ig").exec(e))return this.parser.push(["Conditions",l[s].toLowerCase()]),l[s].length}for(s=0,a=n.length;s<a;s++){if(r=/^\w+$/.test(n[s])?"\\b":"",new RegExp("^("+n[s]+")"+r,"ig").exec(e))return this.parser.push(["SubOperators",n[s].toLowerCase()]),n[s].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 i=/^(true|false)/.exec(e)[0],this.parser.push(["String",i]),i.length;if(/^null/.exec(e))return i=/^null/.exec(e)[0],this.parser.push(["String",null]),i.length;if(/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e))return i=/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e))return i=/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",i]),i.length+2;if(this.checkNumberLiteral(e,t)){var d=/^[0-9]+(\.[0-9]+)$/.exec(e);if(d)return i=d[0],this.parser.push(["Literal",i]),i.length}var p=this.getSingleQuoteString(e);if(""!==p){if("("===(i=p)[i.length-2])for(var c=!1,h=i.length;h<e.length&&(i+=e[h],")"===e[h]&&(c=!0),!c||"'"!==e[h]);h++);else e[i.length]&&")"!==e[i.length]&&!this.checkCondition(e,i)&&(i=this.combineSingleQuoteString(e,i));return this.parser.push(["String",i]),i.length}var g=this.getDoubleQuoteString(e);return""!==g?(i=g,this.parser.push(["DoubleString",i]),i.length):/^\d*\.?\d+/.exec(e)?(i=/^\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):/^-?\d*\.?\d+/.exec(e)?(i=/^-?\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",i]),i.length):1},d.prototype.getDoubleQuoteString=function(e){var t=e.indexOf('"');if(0===t){var l=e.indexOf('"',t+1);if(-1!==l)return e.substring(t,l+1)}return""},d.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},d.prototype.getSingleQuoteString=function(e,t){var l=e.indexOf("'");if(-1!==l&&t||0===l&&!t){var n=e.indexOf("'",l+1);if(-1!==n)return e.substring(l,n+1)}return""},d.prototype.combineSingleQuoteString=function(e,t){if(e[t.length]&&")"!==e[t.length]&&!this.checkCondition(e,t)&&","!==e[t.length]){var l=t.substring(0,t.length-1),n=e.replace(l,""),r=this.getSingleQuoteString(n,!0);if(""!==r)t+=r.substring(1,r.length),t=this.combineSingleQuoteString(e,t)}return t},d.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},d.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(?:\.[0-9]+)$/.exec(e)){var n=this.parser[this.parser.length-2],r=this.parser[this.parser.length-3];if("Left"===l[0]&&n&&"Conditions"===n[0])return!0;var i=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&r&&r[1].indexOf(i)<0)return!0}return!1},d.prototype.getOperator=function(e,t,l){if(l){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]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[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{"=":"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"}[""+t]},d.prototype.getTypeFromColumn=function(e){var l=this.getColumn(e.field);return(0,t.isNullOrUndefined)(l)?null:l.type},d.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var n=e.split(this.separator),r=0;r<n.length;r++)t+=this.getLabelFromField(n,r+1),++l<n.length&&(t+=this.separator);return t}return this.getColumn(e).label},d.prototype.getLabelFromField=function(e,t){for(var l="",n=0,r=0;r<t;r++)l+=e[r],++n<t&&(l+=this.separator);return this.getColumn(l).label},d.prototype.processParser=function(e,t,l,n){for(var r,i,o,s,a,u,d,p,c,h,g=[],m=[],f=!1,v=!1,y=0,b=e.length;y<b;y++)if("Literal"===e[y][0]){var C=this.getColumn(e[y][1]);if(o={label:C&&C.label?C.label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){if(e[y+1][1].indexOf("null")>-1||e[y+1][1].indexOf("empty")>-1)o.operator=this.getOperator(" ",e[y+1][1],n),o.value=null,o.type=this.getTypeFromColumn(o);else{var S=e[y+3][1]?e[y+3][1].replace(/'/g,""):e[y+3][1];o.operator=this.getOperator(S,e[y+1][1],n)}for(h=e[y+1][1],r=++y+1,i=b,n&&"contains"===o.operator||"startswith"===o.operator||"endswith"===o.operator?h="like":n&&"notcontains"===o.operator||"notstartswith"===o.operator||"notendswith"===o.operator?h="not like":n&&(h=o.operator),r=y+1;r<i;r++)if(h.indexOf("between")<0&&"Left"===e[r][0])f=!0;else{if("Right"===e[r][0]&&f){y=r,f=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[r][0]){var x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),x=x?x.replace(/%/g,""):e[r][1],o.value=x,o.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[r][0]||"Left"===e[r][0])break;if("Number"===e[r][0])g.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),m.push(x)}}else if("Number"===e[r][0])g.push(Number(e[r][1]));else if("String"===e[r][0]){x=e[r][1];e[r][1]&&"'"===e[r][1][0]&&(x=e[r][1].substring(1,e[r][1].length-1)),m.push(x)}o.type=this.getTypeFromColumn(o)}h.indexOf("like")<0&&("Number"===e[r-1][0]?(o.value=g,o.type="number"):"String"===e[r-1][0]?(o.value=m,o.type="string"):h.indexOf("between")>-1&&"Conditions"===e[r-1][0]&&(0!==m.length?(o.value=m,o.type="string"):(o.value=g,o.type="number")),g=[],m=[],o.type=this.getTypeFromColumn(o)),this.enableSeparateConnector&&"Conditions"===e[y+1][0]&&(o.condition=e[y+1][1])}else if("Operators"===e[y+1][0]){if(o.operator=this.getOperator(e[y+2][1],e[y+1][1],n),"equal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]?o.operator="isempty":"notequal"===o.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]&&(o.operator="isnotempty"),"Number"===e[y+2][0])o.type="number",o.value=Number(e[y+2][1]);else o.type="string",(x=e[y+2][1])&&"'"===x[0]&&(x=x.substring(1,x.length-1)),o.value=x;this.enableSeparateConnector&&"Conditions"===e[y+3][0]&&(o.condition=e[y+3][1]),o.type=this.getTypeFromColumn(o)}t.rules.push(o)}else{if("Left"===e[y][0]){if("Left"!==e[0][0]&&("not"===e[y-1][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y-1][1])){v=!0;continue}for(this.parser=e.splice(y+1,b-(y+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},c=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&c++;return l.push(c),t.rules.push(s),s=this.processParser(this.parser,s,l,n),t}if("Conditions"!==e[y][0]||this.enableSeparateConnector){if("Right"===e[y][0]){if(v&&"Right"===e[y+1][0]){v=!1;continue}for(this.parser=e.splice(y+1,b-(y+1)),l.pop(),t=this.rule,p=l.length,d=0;d<p;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,n)}}else"not"===e[y][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[y][1]?t.not=!0:t.condition=e[y][1]}return t},d.prototype.groupClone=function(e){var t=e.closest(".e-rule-list").closest(".e-group-container"),l=e.id.replace(this.element.id+"_",""),n=t.id.replace(this.element.id+"_",""),r=this.getGroup(l);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:r.condition,not:r.not,rules:r.rules}],n),this.groupIndex=-1},d.prototype.ruleClone=function(e){for(var l=(0,t.closest)(e,".e-rule-container"),n=e.closest(".e-rule-list").closest(".e-group-container"),r=this.getRule(e),i=n.id.replace(this.element.id+"_",""),o=n.querySelectorAll(".e-rule-container"),s=0,a=o.length;s<a;s++)l.id===o[s].id&&(this.ruleIndex=s);this.enableSeparateConnector?this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value,condition:r.condition}],i):this.addRules([{label:r.label,field:r.field,type:r.type,operator:r.operator,value:r.value}],i),this.ruleIndex=-1},d.prototype.ruleLock=function(e){var l=(0,t.closest)(e,".e-rule-container"),n=this.getRule(l.id.replace(this.element.id+"_",""));l.classList.contains("e-disable")?(n.isLocked=!1,this.lockItems=this.lockItems.filter((function(e){return e!==l.id})),l.classList.remove("e-disable"),this.disableRuleControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(n.isLocked=!0,this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableRuleControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},d.prototype.groupLock=function(e){var l=(0,t.closest)(e,".e-group-container"),n=this.getGroup(l.id.replace(this.element.id+"_","")),r=l.id.indexOf("group0")>-1;if(l.classList.contains("e-disable")){if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!1,this.setProperties({rule:i},!0);else n.isLocked=!1;this.lockItems=this.lockItems.filter((function(e){return e!==l.id})),l.classList.remove("e-disable"),this.disableHeaderControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{var i;if(r)(i={}).condition=n.condition,i.not=n.not,i.isLocked=!0,this.setProperties({rule:i},!0);else n.isLocked=!0;this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableHeaderControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},d.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var l=this.element.querySelector("#"+this.lockItems[e]),n=l.querySelector(".e-lock-rule-btn");(l=(0,t.closest)(n,".e-rule-container")).classList.contains("e-disable")||this.ruleLock(n)}else{var r=this.element.querySelector("#"+this.lockItems[e]);n=r.querySelector(".e-lock-grp-btn");(r=(0,t.closest)(n,".e-group-container")).classList.contains("e-disable")||this.groupLock(n)}}},d.prototype.disableHeaderControls=function(e,t,l){for(var n=t.querySelectorAll(".e-btngroup-and"),r=t.querySelectorAll(".e-btngroup-or"),i=t.querySelectorAll(".e-qb-toggle"),o=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),p=t.querySelectorAll(".e-add-condition-btn"),c=t.querySelectorAll(".e-add-group-btn"),h=0;h<n.length;h++)l?(d[h]&&d[h].classList.contains("e-disable")&&d[h].classList.add("e-disable"),n[h].disabled=!0,r[h].disabled=!0,o[h]&&(o[h].disabled=!0),p[h]&&(p[h].disabled=!0),c[h]&&(c[h].disabled=!0),i[h]&&(i[h].disabled=!0),s[h]&&(s[h].disabled=!0),u[h]&&(u[h].disabled=!0),n[h].parentElement.classList.add("e-disabled"),a[h]&&a[h]!==e&&(a[h].disabled=!0,a[h].children[0].classList.remove("e-unlock"),a[h].children[0].classList.add("e-lock"))):(d[h]&&d[h].classList.remove("e-disable"),n[h].disabled=!1,r[h].disabled=!1,o[h]&&(o[h].disabled=!1),p[h]&&(p[h].disabled=!1),c[h]&&(c[h].disabled=!1),a[h]&&(a[h].disabled=!1),i[h]&&(i[h].disabled=!1),s[h]&&(s[h].disabled=!1),u[h]&&(u[h].disabled=!1),n[h].parentElement.classList.remove("e-disabled"),a[h]&&a[h].children[0].classList.remove("e-lock"),a[h]&&a[h].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},d.prototype.disableRuleControls=function(e,l,n){for(var r=l.querySelectorAll(".e-control.e-dropdownlist"),i=l.querySelectorAll(".e-control.e-numerictextbox"),o=l.querySelectorAll(".e-control.e-textbox"),s=l.querySelectorAll(".e-control.e-datepicker"),a=l.querySelectorAll(".e-control.e-checkbox"),u=l.querySelectorAll(".e-control.e-radio"),d=l.querySelectorAll(".e-control.e-multiselect"),p=l.querySelectorAll(".e-rule-delete"),c=l.querySelectorAll(".e-lock-rule"),h=l.querySelectorAll(".e-clone-rule"),g=l.querySelectorAll(".e-rule-container"),m=0;m<p.length;m++)n?(g[m]&&g[m].classList.contains("e-disable")&&g[m].classList.add("e-disable"),p[m].disabled=!0,h[m]&&(h[m].disabled=!0),c[m]!==e&&(c[m].disabled=!0,c[m].children[0].classList.remove("e-unlock"),c[m].children[0].classList.add("e-lock"))):(g[m]&&g[m].classList.remove("e-disable"),h[m]&&(h[m].disabled=!1),p[m].disabled=!1,c[m].disabled=!1,c[m].children[0].classList.remove("e-lock"),c[m].children[0].classList.add("e-unlock"));for(m=0;m<r.length;m++)(0,t.getComponent)(r[m],"dropdownlist").enabled=!n;for(m=0;m<i.length;m++)(0,t.getComponent)(i[m],"numerictextbox").enabled=!n;for(m=0;m<o.length;m++)(0,t.getComponent)(o[m],"textbox").enabled=!n;for(m=0;m<s.length;m++)(0,t.getComponent)(s[m],"datepicker").enabled=!n;for(m=0;m<a.length;m++)(0,t.getComponent)(a[m],"checkbox").disabled=!!n;for(m=0;m<u.length;m++)(0,t.getComponent)(u[m],"radio").disabled=!!n;for(m=0;m<d.length;m++)(0,t.getComponent)(d[m],"multiselect").enabled=!n},h([(0,t.Event)()],d.prototype,"created",void 0),h([(0,t.Event)()],d.prototype,"actionBegin",void 0),h([(0,t.Event)()],d.prototype,"beforeChange",void 0),h([(0,t.Event)()],d.prototype,"change",void 0),h([(0,t.Event)()],d.prototype,"dataBound",void 0),h([(0,t.Event)()],d.prototype,"ruleChange",void 0),h([(0,t.Event)()],d.prototype,"dragStart",void 0),h([(0,t.Event)()],d.prototype,"drag",void 0),h([(0,t.Event)()],d.prototype,"drop",void 0),h([(0,t.Complex)({},v)],d.prototype,"showButtons",void 0),h([(0,t.Property)(!1)],d.prototype,"summaryView",void 0),h([(0,t.Property)(!1)],d.prototype,"allowValidation",void 0),h([(0,t.Property)("Default")],d.prototype,"fieldMode",void 0),h([(0,t.Property)([])],d.prototype,"columns",void 0),h([(0,t.Property)(null)],d.prototype,"fieldModel",void 0),h([(0,t.Property)(null)],d.prototype,"operatorModel",void 0),h([(0,t.Property)(null)],d.prototype,"valueModel",void 0),h([(0,t.Property)()],d.prototype,"headerTemplate",void 0),h([(0,t.Property)("")],d.prototype,"cssClass",void 0),h([(0,t.Property)([])],d.prototype,"dataSource",void 0),h([(0,t.Property)("Horizontal")],d.prototype,"displayMode",void 0),h([(0,t.Property)(!1)],d.prototype,"enablePersistence",void 0),h([(0,t.Property)("Default")],d.prototype,"sortDirection",void 0),h([(0,t.Property)(5)],d.prototype,"maxGroupCount",void 0),h([(0,t.Property)("auto")],d.prototype,"height",void 0),h([(0,t.Property)("auto")],d.prototype,"width",void 0),h([(0,t.Property)(!1)],d.prototype,"matchCase",void 0),h([(0,t.Property)(0)],d.prototype,"immediateModeDelay",void 0),h([(0,t.Property)(!1)],d.prototype,"enableNotCondition",void 0),h([(0,t.Property)(!1)],d.prototype,"readonly",void 0),h([(0,t.Property)(!0)],d.prototype,"addRuleToNewGroups",void 0),h([(0,t.Property)(!1)],d.prototype,"autoSelectField",void 0),h([(0,t.Property)(!0)],d.prototype,"autoSelectOperator",void 0),h([(0,t.Property)("")],d.prototype,"separator",void 0),h([(0,t.Property)(!1)],d.prototype,"enableSeparateConnector",void 0),h([(0,t.Complex)({condition:"and",rules:[]},m)],d.prototype,"rule",void 0),h([(0,t.Property)(!1)],d.prototype,"allowDragAndDrop",void 0),d=h([t.NotifyPropertyChanges],d)}(t.Component),b=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,n=0;return e.forEach((function(r){n++,t+="{",void 0!==r.rules&&("or"===r.condition?(t+=' "$or":[',t=l.convertMongoQuery(r.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(r.rules,t)+"]"));var i="string"===r.type&&"in"!==r.operator&&"notin"!==r.operator&&r.value&&""!==r.value.trim()?r.value.replace(/'/g,"\\"):"";"string"!==r.type||"in"!==r.operator&&"notin"!==r.operator||!r.value||1!==r.value.length||(i=r.value[0].replace(/'/g,"\\"));var o=r.field?r.field.substring(0):"";switch(r.operator){case"contains":t+='"'+o+'":{"$regex":"'+i+'"}';break;case"notcontains":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'"}}';break;case"startswith":t+='"'+o+'":{"$regex":"^'+i+'"}';break;case"notstartswith":t+='"'+o+'":{"$not":{"$regex":"^'+r.value+'"}}';break;case"endswith":t+='"'+o+'":{"$regex":"'+i+'$"}';break;case"notendswith":t+='"'+o+'":{"$not":{"$regex":"'+r.value+'$"}}';break;case"isnull":t+='"'+o+'": null';break;case"isnotnull":t+='"'+o+'":{"$ne": null}';break;case"isempty":t+='"'+o+'": ""';break;case"isnotempty":t+='"'+o+'":{"$ne": ""}';break;case"equal":"string"===r.type?t+='"'+o+'":"'+i+'"':"date"===r.type?t+='"'+o+'":"'+r.value+'"':(r.type,t+='"'+o+'":'+r.value);break;case"notequal":"string"===r.type?t+='"'+o+'":{"$ne":"'+i+'"}':"date"===r.type?t+='"'+o+'":{"$ne":"'+r.value+'"}':t+='"'+o+'":{"$ne":'+r.value+"}";break;case"in":if("string"===r.type)if(r.value.length>1)s=(s=r.value.map((function(e,t){return t<r.value.length?'"'+e+'"':""})).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$in": ['+s+"]}";else t+='"'+o+'": { "$in": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$in": ['+r.value.toString()+"]}":t+='"'+o+'": { "$in": ['+r.value+"]}");break;case"notin":var s;if("string"===r.type)if(r.value.length>1)s=(s=r.value.map((function(e,t){return t<r.value.length?'"'+e+'"':""})).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+o+'": { "$nin": ['+s+"]}";else t+='"'+o+'": { "$nin": ["'+i+'"]}';else"number"===r.type&&(r.value.length>1?t+='"'+o+'": { "$nin": ['+r.value.toString()+"]}":t+='"'+o+'": { "$nin": ['+r.value+"]}");break;case"greaterthan":"number"===r.type?t+='"'+o+'": { "$gt": '+r.value+"}":t+='"'+o+'": { "$gt": "'+r.value+'"}';break;case"greaterthanorequal":"number"===r.type?t+='"'+o+'": { "$gte": '+r.value+"}":t+='"'+o+'": { "$gte": "'+r.value+'"}';break;case"between":"number"===r.type?t+='"'+o+'": {"$gte":'+r.value[0]+', "$lte":'+r.value[1]+"}":t+='"'+o+'": {"$gte": "'+r.value[0]+'", "$lte": "'+r.value[1]+'"}';break;case"notbetween":"number"===r.type?t+='"$or":[{"'+o+'": {"$lt":'+r.value[0]+'}}, {"'+o+'": {"$gt":'+r.value[1]+"}}]":t+='"$or":[{"'+o+'": {"$lt": "'+r.value[0]+'"}}, {"'+o+'": {"$gt": "'+r.value[1]+'"}}]';break;case"lessthan":"number"===r.type?t+='"'+o+'": { "$lt": '+r.value+"}":t+='"'+o+'": { "$lt": "'+r.value+'"}';break;case"lessthanorequal":"number"===r.type?t+='"'+o+'": { "$lte": '+r.value+"}":t+='"'+o+'": { "$lte": "'+r.value+'"}'}t+="}",e.length!==n&&(t+=",")})),t},e.prototype.mongoParser=function(e,t,l){var n;Object.keys(e).indexOf("$and")>-1?(n=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(n=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(n,t.rules,l)},e.prototype.mongoRecursion=function(e,l,n){for(var r,i,o,s,a,u,d,p,c,h,g,m,f=0,v=e.length;f<v;f++){var y=[],b=[];if(d=Object.keys(e[f])[0],p=e[f][d],"$and"===d)c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(c),this.mongoRecursion(e[f][d],l[l.length-1].rules,n);else if("$or"===d){var C=void 0,S=[],x=[],q=[],O=[],E=[],k=[],w=[];Array.isArray(p)&&2===p.length&&(k=p[(x=Object.keys(p))[0]],w=p[x[1]],"object"==typeof k&&(S=Object.keys(k)[0],q=Object.keys(k[Object.keys(k)[0]])[0],O=Object.keys(w[Object.keys(w)[0]])[0],"$lt"===q&&"$gt"===O&&(r="notbetween",h={field:S,label:S,value:m=[E=k[S][q],w[S][O]],operator:r,type:i="number"==typeof E?"number":"date"},l.push(h),C=!0))),C||(c=this.parent.enableNotCondition?{condition:d.replace("$",""),rules:[],not:!1}:{condition:d.replace("$",""),rules:[]},l.push(c),this.mongoRecursion(e[f][d],l[l.length-1].rules,n))}else{if(null===(p=e[f][d])&&(r="isnull"),"boolean"==typeof p&&(r="equal",i="boolean",m=p),"number"==typeof p)m=p,i="number",r="equal";else if("object"==typeof p&&null!==p){g=Object.keys(p);for(var N=0;N<g.length;N++)if(s=g[N],o=p[g[N]],"$ne"===s&&(0,t.isNullOrUndefined)(o)&&(r="isnotnull",m=null),"$ne"===s&&"boolean"==typeof o&&(r="notequal",m=o,i="boolean"),g.length>=2&&g[N]?("object"==typeof o?(r="notbetween",d=Object.keys(o)[0],a=[Object.keys(o[d])[0]],y.push(o[d][a]),i="number"):(r="between",y.push(o)),"number"==typeof o&&(i="number")):"object"==typeof o&&null!==o?"$not"===s&&"$regex"===Object.keys(o)[0]?o.$regex.indexOf("^")>-1?(r="notstartswith",m=o.$regex.replace("^","")):o.$regex.indexOf("$")>-1?(r="notendswith",m=o.$regex.replace("$","")):(r="notcontains",m=o.$regex):(r="$in"===s?"in":"notin",b=o,i="number"==typeof o[0]?"number":"string"):"number"==typeof o&&(r=this.getOperatorFromMongoOperator(s),i="number",m=o),"string"==typeof o){"$regex"===s&&(r="contains",m=o,i="string"),"$ne"===s&&(null!==o&&o.length>0&&isNaN(Date.parse(o))?(r="notequal",m=o):(0,t.isNullOrUndefined)(o)?(r="isnotnull",m=o):""===o&&(r="isnotempty",m=o),i="string"),o.indexOf("^")>-1&&(r="startswith",m=o.replace("^",""),i="string"),o.indexOf("$")>-1&&"$not"!==s&&(r="endswith",m=o.replace("$",""),i="string");for(var L=0,R=this.parent.columns;L<R.length;L++){var T=R[L];if(T.field===d){u=T.type;break}}isNaN(Date.parse(o))&&"date"!==u||(r=r||this.getOperatorFromMongoOperator(s),i="date",m=o)}}else p&&"string"==typeof p&&!isNaN(Date.parse(p))?(r="equal",m=p,i="date"):"string"==typeof p&&""!==p&&"true"!==p&&"false"!==p?(r="equal",m=p,i="string"):"string"==typeof p&&""===p&&(r="isempty",m=p,i="string");h=y&&y.length>1?{field:d,label:d,value:y,operator:r,type:i}:b&&b.length>1?{field:d,label:d,value:b,operator:r,type:i}:{field:d,label:d,value:m,operator:r,type:i},l.push(h),r=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,n=t.split("?"),r=n[0],i=0;i<l.length;i++)r+="string"==typeof l[i]?"'"+l[i]+"'"+n[i+1]:l[i]+n[i+1];return r.length>=2&&"("===r[0]&&")"===r[r.length-1]&&(r=r.slice(1,-1)),r=r.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,n=t;return Object.keys(l).forEach((function(e){var t=l[e];e=":"+e,n=n.replace(e,"string"==typeof t?"'"+t+"'":String(t))})),n.length>=2&&"("===n[0]&&")"===n[n.length-1]&&(n=n.slice(1,-1)),n=n.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(l),n.ruleVal)},e.prototype.getNamedParameterSql=function(e){var l=(0,t.extend)({},e,null,!0),n=this.updateRuleValue(l,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(l),n.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){return this.updateValue(e.rules,t,[],{},[])},e.prototype.updateValue=function(e,l,n,r,i){if((0,t.isNullOrUndefined)(e))return{ruleVal:n,namedRuleVal:r};for(var o=0;o<e.length;o++)if(e[o].rules){n=(u=this.updateValue(e[o].rules,l,n,r,i)).ruleVal,r=u.namedRuleVal}else{var s=void 0;if(e[o].value instanceof Array)for(var a=0;a<e[o].value.length;a++)l&&(s=this.getNamedParameter(e[o].field,i)),(0,t.isNullOrUndefined)(e[o].value[a])||("string"===e[o].type||e[o].type,l?r[s]=e[o].value[a]:n.push(e[o].value[a])),e[o].value[a]=l?":"+s:"?";else if(l&&(s=this.getNamedParameter(e[o].field,i)),e[o].operator.indexOf("null")<1&&("string"!==e[o].type||"string"===e[o].type&&(""!==e[o].value||0===e[o].value))){if("string"===e[o].type||"date"===e[o].type)if(e[o].operator.indexOf("empty")<1){var u=e[o].value.toString();switch(e[o].operator){case"startswith":case"notstartswith":u+="%";break;case"endswith":case"notendswith":u="%"+u;break;case"contains":case"notcontains":u="%"+u+"%"}l?r[s]=u:n.push(u)}else l?r[s]="":n.push(""),"isempty"===e[o].operator?e[o].operator="equal":e[o].operator="notequal";else(0,t.isNullOrUndefined)(e[o].value)||(l?r[s]=e[o].value:n.push(e[o].value));e[o].value=l?":"+s:"?"}}return{ruleVal:n,namedRuleVal:r}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var n=t.length-1;n>=0;n--){var r=t[n];if(r.indexOf(e)>-1){l=e+"_"+(parseInt(r.split("_")[1],10)+1),t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}()})(),p})()));