UNPKG

@syncfusion/ej2-buttons

Version:

A package of feature-rich Essential JS 2 components such as Button, CheckBox, RadioButton and Switch.

10 lines 85.1 kB
/*! * filename: ej2-buttons.min.js * version : 23.1.39 * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ this.ej=this.ej||{},this.ej.buttons=function(e,t){"use strict";function i(e,i,s,o,n,r){var l=o;if(o.tagName===i){var a=t.getValue("ej2_instances",o);l=e("input",{attrs:{type:s}});for(var p=["change","cssClass","label","labelPosition","id"],h=0,c=o.attributes.length;h<c;h++)-1===p.indexOf(o.attributes[h].nodeName)&&l.setAttribute(o.attributes[h].nodeName,o.attributes[h].nodeValue);t.attributes(o,{class:n}),o.appendChild(l),t.setValue("ej2_instances",a,l),t.deleteObject(o,"ej2_instances")}return l}function s(e){for(var t,i=e.childNodes,s=0;s<i.length;s++)if(3===(t=i[s]).nodeType)return t;return null}function o(e,i,s){"INPUT"===s?(i.parentNode.insertBefore(e.element,i),t.detach(i),e.element.checked=!1,["name","value","disabled"].forEach(function(t){e.element.removeAttribute(t)})):(["role","aria-checked","class"].forEach(function(e){i.removeAttribute(e)}),i.innerHTML="")}function n(e,s,o,n,r){n=i(e.createElement,s,"checkbox",n,o,r),e.element=n,"checkbox"!==e.element.getAttribute("type")&&e.element.setAttribute("type","checkbox"),e.element.id||(e.element.id=t.getUniqueID("e-"+r))}function r(e,i,s){void 0===i&&(i=!1),void 0===s&&(s={});var o=e("div",{className:"e-checkbox-wrapper e-css"});if(s.cssClass&&t.addClass([o],s.cssClass.split(" ")),s.enableRtl&&o.classList.add("e-rtl"),i){var n=e("span",{className:"e-ripple-container"});t.rippleEffect(n,{isCenterRipple:!0,duration:400}),o.appendChild(n)}var r=e("span",{className:"e-frame e-icons"});if(s.checked&&r.classList.add("e-check"),o.appendChild(r),s.label){var l=e("span",{className:"e-label"});s.disableHtmlEncode?l.textContent=s.label:l.innerHTML=s.label,o.appendChild(l)}return o}function l(e,t){if(t){var i=document.createEvent("MouseEvents");i.initEvent(e.type,!1,!0),t.dispatchEvent(i)}}function a(e,t){e.element.getAttribute("ejs-for")&&t.appendChild(e.createElement("input",{attrs:{name:e.name||e.element.name,value:"false",type:"hidden"}}))}var p=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),h=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};!function(e){e.Left="Left",e.Right="Right",e.Top="Top",e.Bottom="Bottom"}(e.IconPosition||(e.IconPosition={}));var c=new t.Observer,d={RTL:"e-rtl",BUTTON:"e-btn",PRIMARY:"e-primary",ICONBTN:"e-icon-btn"},u=function(e){function i(t,i){return e.call(this,t,i)||this}return p(i,e),i.prototype.preRender=function(){},i.prototype.render=function(){this.initialize(),this.removeRippleEffect=t.rippleEffect(this.element,{selector:"."+d.BUTTON}),this.renderComplete()},i.prototype.initialize=function(){if(this.cssClass&&t.addClass([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.isPrimary&&this.element.classList.add(d.PRIMARY),!t.isBlazor()||t.isBlazor()&&"progress-btn"!==this.getModuleName()){if(this.content){var e=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(this.content):this.content;this.element.innerHTML=e}this.setIconCss()}this.enableRtl&&this.element.classList.add(d.RTL),this.disabled?this.controlStatus(this.disabled):this.wireEvents()},i.prototype.controlStatus=function(e){this.element.disabled=e},i.prototype.setIconCss=function(){if(this.iconCss){var e=this.createElement("span",{className:"e-btn-icon "+this.iconCss});this.element.textContent.trim()?(e.classList.add("e-icon-"+this.iconPosition.toLowerCase()),"Top"!==this.iconPosition&&"Bottom"!==this.iconPosition||this.element.classList.add("e-"+this.iconPosition.toLowerCase()+"-icon-btn")):this.element.classList.add(d.ICONBTN);var t=this.element.childNodes[0];!t||"Left"!==this.iconPosition&&"Top"!==this.iconPosition?this.element.appendChild(e):this.element.insertBefore(e,t)}},i.prototype.wireEvents=function(){this.isToggle&&t.EventHandler.add(this.element,"click",this.btnClickHandler,this)},i.prototype.unWireEvents=function(){this.isToggle&&t.EventHandler.remove(this.element,"click",this.btnClickHandler)},i.prototype.btnClickHandler=function(){this.element.classList.contains("e-active")?this.element.classList.remove("e-active"):this.element.classList.add("e-active")},i.prototype.destroy=function(){var i=[d.PRIMARY,d.RTL,d.ICONBTN,"e-success","e-info","e-danger","e-warning","e-flat","e-outline","e-small","e-bigger","e-active","e-round","e-top-icon-btn","e-bottom-icon-btn"];this.cssClass&&(i=i.concat(this.cssClass.split(" "))),e.prototype.destroy.call(this),t.removeClass([this.element],i),this.element.getAttribute("class")||this.element.removeAttribute("class"),this.disabled&&this.element.removeAttribute("disabled"),this.content&&(this.element.innerHTML=this.element.innerHTML.replace(this.content,""));var s=this.element.querySelector("span.e-btn-icon");s&&t.detach(s),this.unWireEvents(),t.isRippleEnabled&&this.removeRippleEffect()},i.prototype.getModuleName=function(){return"btn"},i.prototype.getPersistData=function(){return this.addOnPersist([])},i.Inject=function(){},i.prototype.onPropertyChanged=function(e,i){for(var o=this.element.querySelector("span.e-btn-icon"),n=0,r=Object.keys(e);n<r.length;n++)switch(r[n]){case"isPrimary":e.isPrimary?this.element.classList.add(d.PRIMARY):this.element.classList.remove(d.PRIMARY);break;case"disabled":this.controlStatus(e.disabled);break;case"iconCss":o?e.iconCss?(o.className="e-btn-icon "+e.iconCss,this.element.textContent.trim()&&("Left"===this.iconPosition?o.classList.add("e-icon-left"):o.classList.add("e-icon-right"))):t.detach(o):this.setIconCss();break;case"iconPosition":t.removeClass([this.element],["e-top-icon-btn","e-bottom-icon-btn"]),(o=this.element.querySelector("span.e-btn-icon"))&&t.detach(o),this.setIconCss();break;case"cssClass":i.cssClass&&t.removeClass([this.element],i.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add(d.RTL):this.element.classList.remove(d.RTL);break;case"content":s(this.element)||this.element.classList.remove(d.ICONBTN),(!t.isBlazor()||t.isBlazor()&&!this.isServerRendered&&"progress-btn"!==this.getModuleName())&&(this.enableHtmlSanitizer&&(e.content=t.SanitizeHtmlHelper.sanitize(e.content)),this.element.innerHTML=e.content,this.setIconCss());break;case"isToggle":e.isToggle?t.EventHandler.add(this.element,"click",this.btnClickHandler,this):(t.EventHandler.remove(this.element,"click",this.btnClickHandler),t.removeClass([this.element],["e-active"]))}},i.prototype.click=function(){this.element.click()},i.prototype.focusIn=function(){this.element.focus()},h([t.Property("Left")],i.prototype,"iconPosition",void 0),h([t.Property("")],i.prototype,"iconCss",void 0),h([t.Property(!1)],i.prototype,"disabled",void 0),h([t.Property(!1)],i.prototype,"isPrimary",void 0),h([t.Property("")],i.prototype,"cssClass",void 0),h([t.Property("")],i.prototype,"content",void 0),h([t.Property(!1)],i.prototype,"isToggle",void 0),h([t.Property()],i.prototype,"locale",void 0),h([t.Property(!1)],i.prototype,"enableHtmlSanitizer",void 0),h([t.Event()],i.prototype,"created",void 0),i=h([t.NotifyPropertyChanges],i)}(t.Component),m=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),f=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r},v="e-frame",y="e-ripple-container",b="e-checkbox-wrapper",g=["title","class","style","disabled","readonly","name","value"],E=function(e){function s(t,i){var s=e.call(this,t,i)||this;return s.isFocused=!1,s.isMouseClick=!1,s.clickTriggered=!1,s.validCheck=!0,s}return m(s,e),s.prototype.changeState=function(e,i){var s,o=this.getWrapper().getElementsByClassName(v)[0];t.isRippleEnabled&&(s=this.getWrapper().getElementsByClassName(y)[0]),"check"===e?(o&&(o.classList.remove("e-stop"),o.classList.add("e-check")),s&&(s.classList.remove("e-ripple-stop"),s.classList.add("e-ripple-check")),this.element.checked=!0,(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&this.validCheck&&!i?(this.element.checked=!1,this.validCheck=!1):(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&(this.validCheck=!0)):"uncheck"===e?(o&&t.removeClass([o],["e-check","e-stop"]),s&&t.removeClass([s],["e-ripple-check","e-ripple-stop"]),this.element.checked=!1,(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&this.validCheck&&!i?(this.element.checked=!0,this.validCheck=!1):(this.element.required||t.closest(this.element,"form")&&t.closest(this.element,"form").classList.contains("e-formvalidator"))&&(this.validCheck=!0)):(o&&(o.classList.remove("e-check"),o.classList.add("e-stop")),s&&(s.classList.remove("e-ripple-check"),s.classList.add("e-ripple-stop")),this.element.indeterminate=!0,this.indeterminate=!0)},s.prototype.clickHandler=function(e){if("INPUT"===e.target.tagName&&this.clickTriggered)return this.isVue&&this.changeState(this.checked?"check":"uncheck"),void(this.clickTriggered=!1);"SPAN"!==e.target.tagName&&"LABEL"!==e.target.tagName||(this.clickTriggered=!0),this.isMouseClick&&(this.focusOutHandler(),this.isMouseClick=!1),this.indeterminate?(this.changeState(this.checked?"check":"uncheck"),this.indeterminate=!1,this.element.indeterminate=!1):this.checked?(this.changeState("uncheck"),this.checked=!1):(this.changeState("check"),this.checked=!0);var t={checked:this.updateVueArrayModel(!1),event:e};this.trigger("change",t),e.stopPropagation()},s.prototype.destroy=function(){var i=this,s=this.getWrapper();e.prototype.destroy.call(this),this.wrapper&&(s=this.wrapper,this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(this.getWrapper()&&s.parentNode&&s.parentNode.insertBefore(this.element,s),t.detach(s),this.element.checked=!1,this.indeterminate&&(this.element.indeterminate=!1),["name","value","disabled"].forEach(function(e){i.element.removeAttribute(e)})):(["class"].forEach(function(e){s.removeAttribute(e)}),s.innerHTML=""))},s.prototype.focusHandler=function(){this.isFocused=!0},s.prototype.focusOutHandler=function(){var e=this.getWrapper();e&&e.classList.remove("e-focus"),this.isFocused=!1},s.prototype.getModuleName=function(){return"checkbox"},s.prototype.getPersistData=function(){return this.addOnPersist(["checked","indeterminate"])},s.prototype.getWrapper=function(){return this.element&&this.element.parentElement?this.element.parentElement.parentElement:null},s.prototype.initialize=function(){t.isNullOrUndefined(this.initialCheckedValue)&&(this.initialCheckedValue=this.checked),this.name&&this.element.setAttribute("name",this.name),this.value&&(this.element.setAttribute("value",this.value),this.isVue&&"boolean"==typeof this.value&&!0===this.value&&this.setProperties({checked:!0},!0)),this.checked&&this.changeState("check",!0),this.indeterminate&&this.changeState(),this.disabled&&this.setDisabled()},s.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains(b)||(e=this.createElement("div",{className:b}),this.element.parentNode.insertBefore(e,this.element));var i=this.createElement("label",{attrs:{for:this.element.id}}),s=this.createElement("span",{className:"e-icons "+v});if(e.classList.add("e-wrapper"),this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" ")),e.appendChild(i),i.appendChild(this.element),a(this,i),i.appendChild(s),t.isRippleEnabled){var o=this.createElement("span",{className:y});"Before"===this.labelPosition?i.appendChild(o):i.insertBefore(o,s),t.rippleEffect(o,{duration:400,isCenterRipple:!0})}this.label&&this.setText(this.label)},s.prototype.keyUpHandler=function(){this.isFocused&&this.getWrapper().classList.add("e-focus")},s.prototype.labelMouseDownHandler=function(e){this.isMouseClick=!0,l(e,this.getWrapper().getElementsByClassName(y)[0])},s.prototype.labelMouseUpHandler=function(e){this.isMouseClick=!0;var t=this.getWrapper().getElementsByClassName(y)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element"),s=0;s<i.length-1;s++)t.removeChild(t.childNodes[s]);l(e,t)}},s.prototype.onPropertyChanged=function(e,i){for(var s=this.getWrapper(),o=0,n=Object.keys(e);o<n.length;o++)switch(n[o]){case"checked":this.indeterminate=!1,this.element.indeterminate=!1,this.changeState(e.checked?"check":"uncheck");break;case"indeterminate":e.indeterminate?this.changeState():(this.element.indeterminate=!1,this.changeState(this.checked?"check":"uncheck"));break;case"disabled":e.disabled?(this.setDisabled(),this.wrapper=this.getWrapper(),this.unWireEvents()):(this.element.disabled=!1,s.classList.remove("e-checkbox-disabled"),s.setAttribute("aria-disabled","false"),this.wireEvents());break;case"cssClass":i.cssClass&&t.removeClass([s],i.cssClass.split(" ")),e.cssClass&&t.addClass([s],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?s.classList.add("e-rtl"):s.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":var r=s.getElementsByClassName("e-label")[0],l=s.getElementsByTagName("label")[0];t.detach(r),"After"===e.labelPosition?l.appendChild(r):l.insertBefore(r,s.getElementsByClassName(v)[0]);break;case"name":this.element.setAttribute("name",e.name);break;case"value":if(this.isVue&&"object"==typeof e.value)break;this.element.setAttribute("value",e.value);break;case"htmlAttributes":this.updateHtmlAttributeToWrapper()}},s.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=i(this.createElement,"EJS-CHECKBOX","checkbox",e,b,"checkbox"),this.element=e,"checkbox"!==this.element.getAttribute("type")&&this.element.setAttribute("type","checkbox"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName()))},s.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents(),this.updateHtmlAttributeToWrapper(),this.updateVueArrayModel(!0),this.renderComplete(),this.wrapper=this.getWrapper()},s.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add("e-checkbox-disabled"),e.setAttribute("aria-disabled","true")},s.prototype.setText=function(e){var i=this.getWrapper();if(i){var s=i.getElementsByClassName("e-label")[0];if(s)s.textContent=e;else{e=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e,s=this.createElement("span",{className:"e-label",innerHTML:e});var o=i.getElementsByTagName("label")[0];"Before"===this.labelPosition?o.insertBefore(s,i.getElementsByClassName(v)[0]):o.appendChild(s)}}},s.prototype.changeHandler=function(e){e.stopPropagation()},s.prototype.formResetHandler=function(){this.checked=this.initialCheckedValue,this.element.checked=this.initialCheckedValue},s.prototype.unWireEvents=function(){var e=this.wrapper;t.EventHandler.remove(e,"click",this.clickHandler),t.EventHandler.remove(this.element,"keyup",this.keyUpHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler);var i=e.getElementsByTagName("label")[0];t.EventHandler.remove(i,"mousedown",this.labelMouseDownHandler),t.EventHandler.remove(i,"mouseup",this.labelMouseUpHandler);var s=t.closest(this.element,"form");s&&t.EventHandler.remove(s,"reset",this.formResetHandler),"EJS-CHECKBOX"===this.tagName&&t.EventHandler.remove(this.element,"change",this.changeHandler)},s.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickHandler,this),t.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var i=e.getElementsByTagName("label")[0];t.EventHandler.add(i,"mousedown",this.labelMouseDownHandler,this),t.EventHandler.add(i,"mouseup",this.labelMouseUpHandler,this);var s=t.closest(this.element,"form");s&&t.EventHandler.add(s,"reset",this.formResetHandler,this),"EJS-CHECKBOX"===this.tagName&&t.EventHandler.add(this.element,"change",this.changeHandler,this)},s.prototype.updateVueArrayModel=function(e){if(this.isVue&&"object"==typeof this.value){var t=this.element.value;if(t&&this.value){if(!e){var i=this.value.indexOf(t);return this.checked?i<0&&this.value.push(t):i>-1&&this.value.splice(i,1),this.value}for(var s=0;s<this.value.length;s++)t===this.value[s]&&(this.changeState("check"),this.setProperties({checked:!0},!0))}}return this.validCheck?this.element.checked:!this.element.checked},s.prototype.updateHtmlAttributeToWrapper=function(){if(!t.isNullOrUndefined(this.htmlAttributes))for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e];if(g.indexOf(s)>-1){var o=this.getWrapper();"class"===s?t.addClass([o],this.htmlAttributes[""+s].split(" ")):"title"===s?o.setAttribute(s,this.htmlAttributes[""+s]):"style"===s?this.getWrapper().getElementsByClassName(v)[0].setAttribute(s,this.htmlAttributes[""+s]):"disabled"===s?("true"===this.htmlAttributes[""+s]&&this.setDisabled(),this.element.setAttribute(s,this.htmlAttributes[""+s])):this.element.setAttribute(s,this.htmlAttributes[""+s])}}},s.prototype.click=function(){this.element.click()},s.prototype.focusIn=function(){this.element.focus()},f([t.Event()],s.prototype,"change",void 0),f([t.Event()],s.prototype,"created",void 0),f([t.Property(!1)],s.prototype,"checked",void 0),f([t.Property("")],s.prototype,"cssClass",void 0),f([t.Property(!1)],s.prototype,"disabled",void 0),f([t.Property(!1)],s.prototype,"indeterminate",void 0),f([t.Property("")],s.prototype,"label",void 0),f([t.Property("After")],s.prototype,"labelPosition",void 0),f([t.Property("")],s.prototype,"name",void 0),f([t.Property("")],s.prototype,"value",void 0),f([t.Property(!1)],s.prototype,"enableHtmlSanitizer",void 0),f([t.Property({})],s.prototype,"htmlAttributes",void 0),s=f([t.NotifyPropertyChanges],s)}(t.Component),C=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),k=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r},P="e-ripple-container",H=["title","class","style","disabled","readonly","name","value"],L=function(e){function s(t,i){var s=e.call(this,t,i)||this;return s.isFocused=!1,s}C(s,e),o=s,s.prototype.changeHandler=function(e){this.checked=!0,this.dataBind();var t=this.element.getAttribute("value");t=this.isVue&&t?this.element.value:this.value;var i=typeof this.value;this.isVue&&"boolean"===i&&(t="true"===t),this.trigger("change",{value:t,event:e}),this.isAngular&&e.stopPropagation()},s.prototype.updateChange=function(){for(var e,i,s=this.getRadioGroup(),n=0;n<s.length;n++)(e=s[n])!==this.element&&((i=t.getInstance(e,o)).checked=!1,"EJS-RADIOBUTTON"===this.tagName&&(i.angularValue=this.value))},s.prototype.destroy=function(){var i=this,s=this.wrapper;e.prototype.destroy.call(this),s&&(this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(s.parentNode&&s.parentNode.insertBefore(this.element,s),t.detach(s),this.element.checked=!1,["name","value","disabled"].forEach(function(e){i.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){s.removeAttribute(e)}),s.innerHTML=""))},s.prototype.focusHandler=function(){this.isFocused=!0},s.prototype.focusOutHandler=function(){var e=this.getLabel();e&&e.classList.remove("e-focus")},s.prototype.getModuleName=function(){return"radio"},s.prototype.getSelectedValue=function(){for(var e,t=this.getRadioGroup(),i=0,s=t.length;i<s;i++)if((e=t[i]).checked)return e.value;return""},s.prototype.getRadioGroup=function(){return document.querySelectorAll('input.e-radio[name="'+this.element.getAttribute("name")+'"]')},s.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},s.prototype.getWrapper=function(){return this.element?this.element.parentElement:null},s.prototype.getLabel=function(){return this.element?this.element.nextElementSibling:null},s.prototype.initialize=function(){t.isNullOrUndefined(this.initialCheckedValue)&&(this.initialCheckedValue=this.checked),this.initWrapper(),this.updateHtmlAttribute(),this.name&&this.element.setAttribute("name",this.name);var e=this.element.getAttribute("value"),i=typeof this.value;this.isVue&&"boolean"===i&&(e="true"===e),(this.isVue?this.value&&"boolean"!==i&&!e:this.value)&&this.element.setAttribute("value",this.value),this.checked&&(this.element.checked=!0),this.disabled&&this.setDisabled()},s.prototype.initWrapper=function(){var e,i=this.element.parentElement;i.classList.contains("e-radio-wrapper")||(i=this.createElement("div",{className:"e-radio-wrapper"}),this.element.parentNode.insertBefore(i,this.element));var s=this.createElement("label",{attrs:{for:this.element.id}});i.appendChild(this.element),i.appendChild(s),t.isRippleEnabled&&(e=this.createElement("span",{className:P}),s.appendChild(e),t.rippleEffect(e,{duration:400,isCenterRipple:!0})),i.classList.add("e-wrapper"),this.enableRtl&&s.classList.add("e-rtl"),this.cssClass&&t.addClass([i],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.label&&this.setText(this.label)},s.prototype.keyUpHandler=function(){this.isFocused&&this.getLabel().classList.add("e-focus")},s.prototype.labelMouseDownHandler=function(e){l(e,this.getLabel().getElementsByClassName(P)[0])},s.prototype.labelMouseLeaveHandler=function(e){var t=this.getLabel().getElementsByClassName(P)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;i>0;i--)t.removeChild(t.childNodes[i]);l(e,t)}},s.prototype.labelMouseUpHandler=function(e){var t=this.getLabel().getElementsByClassName(P)[0];if(t){for(var i=t.querySelectorAll(".e-ripple-element").length-1;i>0;i--)t.removeChild(t.childNodes[i]);l(e,t)}},s.prototype.formResetHandler=function(){this.checked=this.initialCheckedValue,this.initialCheckedValue&&t.attributes(this.element,{checked:"true"})},s.prototype.onPropertyChanged=function(e,i){for(var s=this.getWrapper(),o=this.getLabel(),n=0,r=Object.keys(e);n<r.length;n++)switch(r[n]){case"checked":e.checked&&this.updateChange(),this.element.checked=e.checked;break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,this.wireEvents());break;case"cssClass":i.cssClass&&t.removeClass([s],i.cssClass.split(" ")),e.cssClass&&t.addClass([s],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?o.classList.add("e-rtl"):o.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":"Before"===e.labelPosition?o.classList.add("e-right"):o.classList.remove("e-right");break;case"name":this.element.setAttribute("name",e.name);break;case"value":var l=typeof this.htmlAttributes.value;if(!t.isNullOrUndefined(this.htmlAttributes)&&(this.htmlAttributes.value||"boolean"===l&&!this.htmlAttributes.value))break;this.element.setAttribute("value",e.value);break;case"htmlAttributes":this.updateHtmlAttribute()}},s.prototype.preRender=function(){var e=this.element;if(this.formElement=t.closest(this.element,"form"),this.tagName=this.element.tagName,e=i(this.createElement,"EJS-RADIOBUTTON","radio",e,"e-radio-wrapper","radio"),this.element=e,"radio"!==this.element.getAttribute("type")&&this.element.setAttribute("type","radio"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName())),"EJS-RADIOBUTTON"===this.tagName){var s=this.element.getAttribute("formcontrolname");s&&(this.setProperties({name:s},!0),this.element.setAttribute("name",s))}},s.prototype.render=function(){this.initialize(),this.disabled||this.wireEvents(),this.renderComplete(),this.wrapper=this.getWrapper()},s.prototype.setDisabled=function(){this.element.disabled=!0},s.prototype.setText=function(e){var i=this.getLabel(),s=i.getElementsByClassName("e-label")[0];s?s.textContent=e:(e=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e,s=this.createElement("span",{className:"e-label",innerHTML:e}),i.appendChild(s)),"Before"===this.labelPosition?this.getLabel().classList.add("e-right"):this.getLabel().classList.remove("e-right")},s.prototype.updateHtmlAttribute=function(){if(!t.isNullOrUndefined(this.htmlAttributes))for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e];if(H.indexOf(s)>-1){var o=this.element.parentElement;"class"===s?t.addClass([o],this.htmlAttributes[""+s].replace(/\s+/g," ").trim().split(" ")):"title"===s||"style"===s?o.setAttribute(s,this.htmlAttributes[""+s]):this.element.setAttribute(s,this.htmlAttributes[""+s])}}},s.prototype.unWireEvents=function(){var e=this.wrapper;t.EventHandler.remove(this.element,"change",this.changeHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),t.EventHandler.remove(this.element,"keyup",this.keyUpHandler);var i=e.getElementsByTagName("label")[0];i&&(t.EventHandler.remove(i,"mousedown",this.labelMouseDownHandler),t.EventHandler.remove(i,"mouseup",this.labelMouseUpHandler),t.EventHandler.remove(i,"mouseleave",this.labelMouseLeaveHandler)),this.formElement&&t.EventHandler.remove(this.formElement,"reset",this.formResetHandler)},s.prototype.wireEvents=function(){var e=this.getLabel();t.EventHandler.add(this.element,"change",this.changeHandler,this),t.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var i=e.getElementsByClassName("e-label")[0];i&&(t.EventHandler.add(i,"mousedown",this.labelMouseDownHandler,this),t.EventHandler.add(i,"mouseup",this.labelMouseUpHandler,this),t.EventHandler.add(i,"mouseleave",this.labelMouseLeaveHandler,this)),this.formElement&&t.EventHandler.add(this.formElement,"reset",this.formResetHandler,this)},s.prototype.click=function(){this.element.click()},s.prototype.focusIn=function(){this.element.focus()};var o;return k([t.Event()],s.prototype,"change",void 0),k([t.Event()],s.prototype,"created",void 0),k([t.Property(!1)],s.prototype,"checked",void 0),k([t.Property("")],s.prototype,"cssClass",void 0),k([t.Property(!1)],s.prototype,"disabled",void 0),k([t.Property("")],s.prototype,"label",void 0),k([t.Property("After")],s.prototype,"labelPosition",void 0),k([t.Property("")],s.prototype,"name",void 0),k([t.Property("")],s.prototype,"value",void 0),k([t.Property(!1)],s.prototype,"enableHtmlSanitizer",void 0),k([t.Property({})],s.prototype,"htmlAttributes",void 0),s=o=k([t.NotifyPropertyChanges],s)}(t.Component),A=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),w=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r},R="e-ripple-container",x=["title","class","style","disabled","readonly","name","value","aria-label","id","role"],T=function(e){function i(t,i){var s=e.call(this,t,i)||this;return s.isFocused=!1,s.isDrag=!1,s.isWireEvents=!1,s}return A(i,e),i.prototype.changeState=function(e){var i,s=this.getWrapper(),o=s.querySelector(".e-switch-inner"),n=s.querySelector(".e-switch-handle");t.isRippleEnabled&&(i=s.getElementsByClassName(R)[0]),e?(t.addClass([o,n],"e-switch-active"),this.element.checked=!0,this.checked=!0,i&&t.addClass([i],["e-ripple-check"])):(t.removeClass([o,n],"e-switch-active"),this.element.checked=!1,this.checked=!1,i&&t.removeClass([i],["e-ripple-check"]))},i.prototype.clickHandler=function(e){this.isDrag=!1,this.focusOutHandler(),this.changeState(!this.checked),this.element.focus();var t={checked:this.element.checked,event:e};this.trigger("change",t),this.isAngular&&(e.stopPropagation(),e.preventDefault())},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),o(this,this.getWrapper(),this.tagName)},i.prototype.focusHandler=function(){this.isFocused=!0},i.prototype.focusOutHandler=function(){this.getWrapper().classList.remove("e-focus")},i.prototype.getModuleName=function(){return"switch"},i.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},i.prototype.getWrapper=function(){return this.element.parentElement},i.prototype.initialize=function(){t.isNullOrUndefined(this.initialSwitchCheckedValue)&&(this.initialSwitchCheckedValue=this.checked),this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&this.changeState(!0),this.disabled&&this.setDisabled(),(this.onLabel||this.offLabel)&&this.setLabel(this.onLabel,this.offLabel)},i.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains("e-switch-wrapper")||(e=this.createElement("div",{className:"e-switch-wrapper"}),this.element.parentNode.insertBefore(e,this.element));var i=this.createElement("span",{className:"e-switch-inner"}),s=this.createElement("span",{className:"e-switch-on"}),o=this.createElement("span",{className:"e-switch-off"}),n=this.createElement("span",{className:"e-switch-handle"});if(e.appendChild(this.element),a(this,e),i.appendChild(s),i.appendChild(o),e.appendChild(i),e.appendChild(n),t.isRippleEnabled){var r=this.createElement("span",{className:R});n.appendChild(r),t.rippleEffect(r,{duration:400,isCenterRipple:!0})}e.classList.add("e-wrapper"),this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" "))},i.prototype.onPropertyChanged=function(e,i){for(var s=this.getWrapper(),o=0,n=Object.keys(e);o<n.length;o++)switch(n[o]){case"checked":this.changeState(e.checked);break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents(),this.isWireEvents=!1):(this.element.disabled=!1,s.classList.remove("e-switch-disabled"),s.setAttribute("aria-disabled","false"),this.isWireEvents||(this.wireEvents(),this.isWireEvents=!0));break;case"value":this.element.setAttribute("value",e.value);break;case"name":this.element.setAttribute("name",e.name);break;case"onLabel":case"offLabel":this.setLabel(e.onLabel,e.offLabel);break;case"enableRtl":e.enableRtl?s.classList.add("e-rtl"):s.classList.remove("e-rtl");break;case"cssClass":i.cssClass&&t.removeClass([s],i.cssClass.split(" ")),e.cssClass&&t.addClass([s],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"htmlAttributes":this.updateHtmlAttribute()}},i.prototype.preRender=function(){var e=this.element;this.formElement=t.closest(this.element,"form"),this.tagName=this.element.tagName,n(this,"EJS-SWITCH","e-switch-wrapper",e,this.getModuleName())},i.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents(),this.renderComplete(),this.updateHtmlAttribute()},i.prototype.rippleHandler=function(e){l(e,this.getWrapper().getElementsByClassName(R)[0]),"mousedown"===e.type&&e.currentTarget.classList.contains("e-switch-wrapper")&&1===e.which&&(this.isDrag=!0,this.isFocused=!1)},i.prototype.rippleTouchHandler=function(e){var t=this.getWrapper().getElementsByClassName(R)[0];if(t){var i=document.createEvent("MouseEvents");i.initEvent(e,!1,!0),t.dispatchEvent(i)}},i.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add("e-switch-disabled"),e.setAttribute("aria-disabled","true")},i.prototype.setLabel=function(e,t){var i=this.getWrapper();e&&(i.querySelector(".e-switch-on").textContent=e),t&&(i.querySelector(".e-switch-off").textContent=t)},i.prototype.updateHtmlAttribute=function(){if(!t.isNullOrUndefined(this.htmlAttributes))for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e];if(x.indexOf(s)>-1){var o=this.getWrapper();"class"===s?t.addClass([o],this.htmlAttributes[""+s].split(" ")):"title"===s?o.setAttribute(s,this.htmlAttributes[""+s]):"style"===s?o.setAttribute(s,this.htmlAttributes[""+s]):"disabled"===s?("true"===this.htmlAttributes[""+s]&&this.setDisabled(),this.element.setAttribute(s,this.htmlAttributes[""+s])):this.element.setAttribute(s,this.htmlAttributes[""+s])}}},i.prototype.switchFocusHandler=function(){this.isFocused&&this.getWrapper().classList.add("e-focus")},i.prototype.switchMouseUp=function(e){var t=e.target;"touchmove"===e.type&&e.preventDefault(),"touchstart"===e.type&&(this.isDrag=!0,this.rippleTouchHandler("mousedown")),this.isDrag&&("mouseup"===e.type&&t.className.indexOf("e-switch")<0||"touchend"===e.type)&&(this.clickHandler(e),this.rippleTouchHandler("mouseup"),e.preventDefault())},i.prototype.formResetHandler=function(){this.checked=this.initialSwitchCheckedValue,this.element.checked=this.initialSwitchCheckedValue},i.prototype.toggle=function(){this.clickHandler()},i.prototype.wireEvents=function(){var e=this.getWrapper();this.delegateMouseUpHandler=this.switchMouseUp.bind(this),this.delegateKeyUpHandler=this.switchFocusHandler.bind(this),t.EventHandler.add(e,"click",this.clickHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),t.EventHandler.add(this.element,"mouseup",this.delegateMouseUpHandler,this),t.EventHandler.add(this.element,"keyup",this.delegateKeyUpHandler,this),t.EventHandler.add(e,"mousedown mouseup",this.rippleHandler,this),t.EventHandler.add(e,"touchstart touchmove touchend",this.switchMouseUp,this),this.formElement&&t.EventHandler.add(this.formElement,"reset",this.formResetHandler,this)},i.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),t.EventHandler.remove(this.element,"mouseup",this.delegateMouseUpHandler),t.EventHandler.remove(this.element,"keyup",this.delegateKeyUpHandler),t.EventHandler.remove(e,"mousedown mouseup",this.rippleHandler),t.EventHandler.remove(e,"touchstart touchmove touchend",this.switchMouseUp),this.formElement&&t.EventHandler.remove(this.formElement,"reset",this.formResetHandler)},i.prototype.click=function(){this.element.click()},i.prototype.focusIn=function(){this.element.focus()},w([t.Event()],i.prototype,"change",void 0),w([t.Event()],i.prototype,"created",void 0),w([t.Property(!1)],i.prototype,"checked",void 0),w([t.Property("")],i.prototype,"cssClass",void 0),w([t.Property(!1)],i.prototype,"disabled",void 0),w([t.Property("")],i.prototype,"name",void 0),w([t.Property("")],i.prototype,"onLabel",void 0),w([t.Property("")],i.prototype,"offLabel",void 0),w([t.Property("")],i.prototype,"value",void 0),w([t.Property({})],i.prototype,"htmlAttributes",void 0),i=w([t.NotifyPropertyChanges],i)}(t.Component),O=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),S=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r},N={chipSet:"e-chip-set",chip:"e-chip",avatar:"e-chip-avatar",text:"e-chip-text",icon:"e-chip-icon",delete:"e-chip-delete",deleteIcon:"e-dlt-btn",multiSelection:"e-multi-selection",singleSelection:"e-selection",active:"e-active",chipWrapper:"e-chip-avatar-wrap",iconWrapper:"e-chip-icon-wrap",focused:"e-focused",disabled:"e-disabled",rtl:"e-rtl"},M=function(e){function i(t,i){var s=e.call(this,t,i)||this;return s.multiSelectedChip=[],s}return O(i,e),i.prototype.preRender=function(){},i.prototype.chipType=function(){return this.chips&&this.chips.length&&this.chips.length>0},i.prototype.render=function(){this.type=this.chips.length?"chipset":this.text||this.element.innerText?"chip":"chipset",this.setAttributes(),this.createChip(),this.setRtl(),this.select(this.selectedChips,void 0),this.wireEvent(!1),this.rippleFunction=t.rippleEffect(this.element,{selector:".e-chip"}),this.renderComplete()},i.prototype.createChip=function(){this.innerText=this.element.innerText&&0!==this.element.innerText.length?this.element.innerText.trim():this.element.innerText,this.element.innerHTML="",this.chipCreation("chip"===this.type?[this.innerText?this.innerText:this.text]:this.chips)},i.prototype.setAttributes=function(){"chip"===this.type?(this.enabled&&(this.element.tabIndex=0),this.element.setAttribute("role","option")):(this.element.classList.add(N.chipSet),this.element.setAttribute("role","listbox"),"Multiple"===this.selection?(this.element.classList.add(N.multiSelection),this.element.setAttribute("aria-multiselectable","true")):"Single"===this.selection?(this.element.classList.add(N.singleSelection),this.element.setAttribute("aria-multiselectable","false")):this.element.setAttribute("aria-multiselectable","false"))},i.prototype.setRtl=function(){this.element.classList[this.enableRtl?"add":"remove"](N.rtl)},i.prototype.chipCreation=function(e){for(var i=[],s=[],o=0;o<e.length;o++){var n=this.getFieldValues(e[o]),r=n.htmlAttributes;s.push(r);var l=this.elementCreation(n),a=(N.chip+" "+(n.enabled?" ":N.disabled)+" "+(n.avatarIconCss||n.avatarText?N.chipWrapper:n.leadingIconCss?N.iconWrapper:" ")+" "+n.cssClass).split(" ").filter(function(e){return e});if(this.chipType()){var p=this.createElement("DIV",{className:a.join(" "),attrs:{tabIndex:"0",role:"option","aria-label":n.text,"aria-selected":"false"}});if(n.value&&p.setAttribute("data-value",n.value.toString()),n.enabled?p.setAttribute("aria-disabled","false"):(p.removeAttribute("tabindex"),p.setAttribute("aria-disabled","true")),!t.isNullOrUndefined(s[o])&&s.length>o&&Object.keys(s[o]).length){var h=[];h=Object.keys(s[o]);for(var c=0;c<h.length;c++)p.setAttribute(h[c],s[o][h[c]])}t.append(l,p),i.push(p)}else i=l,t.addClass([this.element],a),this.element.setAttribute("aria-label",n.text),n.value&&this.element.setAttribute("data-value",n.value.toString())}t.append(i,this.element)},i.prototype.getFieldValues=function(e){var i=!("false"===this.enabled.toString());return{text:"object"==typeof e?e.text?e.text.toString():this.text.toString():this.chipType()?e.toString():this.innerText?this.innerText:this.text.toString(),cssClass:"object"==typeof e&&e.cssClass?e.cssClass.toString():this.cssClass.toString(),leadingIconCss:"object"==typeof e&&e.leadingIconCss?e.leadingIconCss.toString():this.leadingIconCss.toString(),avatarIconCss:"object"==typeof e&&e.avatarIconCss?e.avatarIconCss.toString():this.avatarIconCss.toString(),avatarText:"object"==typeof e&&e.avatarText?e.avatarText.toString():this.avatarText.toString(),trailingIconCss:"object"==typeof e&&e.trailingIconCss?e.trailingIconCss.toString():this.trailingIconCss.toString(),enabled:"object"==typeof e?t.isNullOrUndefined(e.enabled)?i:"false"!==e.enabled.toString():i,value:"object"==typeof e&&e.value?e.value.toString():null,leadingIconUrl:"object"==typeof e&&e.leadingIconUrl?e.leadingIconUrl.toString():this.leadingIconUrl,trailingIconUrl:"object"==typeof e&&e.trailingIconUrl?e.trailingIconUrl.toString():this.trailingIconUrl,htmlAttributes:"object"==typeof e&&e.htmlAttributes?e.htmlAttributes:this.htmlAttributes}},i.prototype.elementCreation=function(e){var t=[];if(e.avatarText||e.avatarIconCss){var i=(N.avatar+" "+e.avatarIconCss).trim(),s=this.createElement("span",{className:i});s.innerText=e.avatarText,t.push(s)}else if(e.leadingIconCss){var i=(N.icon+" "+e.leadingIconCss).trim(),o=this.createElement("span",{className:i});t.push(o)}else if(e.leadingIconUrl){i=(N.avatar+" image-url").trim();(o=this.createElement("span",{className:i})).style.backgroundImage="url("+e.leadingIconUrl+")",t.push(o)}var n=this.createElement("span",{className:N.text});if(n.innerText=e.text,t.push(n),e.trailingIconCss||this.chipType()&&this.enableDelete){var i=(N.delete+" "+(e.trailingIconCss?e.trailingIconCss:N.deleteIcon)).trim(),r=this.createElement("span",{className:i});t.push(r)}else if(e.trailingIconUrl){var i="trailing-icon-url".trim(),l=this.createElement("span",{className:i});l.style.backgroundImage="url("+e.trailingIconUrl+")",t.push(l)}return t},i.prototype.find=function(e){var t,i=e instanceof HTMLElement?e:this.element.querySelectorAll("."+N.chip)[e];return i&&this.chipType()&&((t={text:void 0,index:void 0,element:void 0,data:void 0}).index=Array.prototype.slice.call(this.element.querySelectorAll("."+N.chip)).indexOf(i),t.text="object"==typeof this.chips[t.index]?this.chips[t.index].text?this.chips[t.index].text.toString():"":this.chips[t.index].toString(),t.data=this.chips[t.index],t.element=i),t},i.prototype.add=function(e){var t;if("chip"!==this.type){var i=e instanceof Array?e:[e];(t=this.chips).push.apply(t,i),this.chipCreation(i)}},i.prototype.select=function(e,t){this.onSelect(e,!1,t)},i.prototype.multiSelection=function(e){for(var t=this.element.querySelectorAll(".e-chip"),i=0;i<e.length;i++)if("string"==typeof e[i]){for(var s=0;s<t.length;s++)if(e[i]!==s&&e[i]===t[s].attributes[5].value){this.multiSelectedChip.push(s);break}}else this.multiSelectedChip.push(e[i])},i.prototype.onSelect=function(e,t,i){var s,o,n;if(this.chipType()&&"None"!==this.selection){if(t)for(var r=this.element.querySelectorAll("."+N.chip),l=0;l<r.length;l++)r[l].setAttribute("aria-selected","false"),r[l].classList.remove(N.active);for(var a=e instanceof Array?e:[e],l=0;l<a.length;l++){var p=a[l]instanceof HTMLElement?a[l]:this.element.querySelectorAll("."+N.chip)[a[l]];if("index"!==i)for(var h=0;h<this.chips.length;h++){o=this.element.querySelectorAll("."+N.chip)[h];var c=this.getFieldValues(this.chips[h]);"value"===i?null!==c.value&&(n=o.dataset.value):"text"===i&&(n=o.innerText),n===a[l].toString()&&(s=h,p=this.element.querySelectorAll("."+N.chip)[s])}p instanceof HTMLElement&&this.selectionHandler(p)}}},i.prototype.remove=function(e){var t=this;if(this.chipType()){var i=e instanceof Array?e:[e],s=[],o=this.element.querySelectorAll("."+N.chip);i.forEach(function(e){var t=e instanceof HTMLElement?e:o[e];t instanceof HTMLElement&&s.push(t)}),s.forEach(function(e){var i=t.element.querySelectorAll("."+N.chip),s=Array.prototype.slice.call(i).indexOf(e);t.deleteHandler(e,s)})}},i.prototype.getSelectedChips=function(){var e;if(this.chipType()&&"None"!==this.selection){for(var i={texts:[],Indexes:[],data:[],elements:[]},s=this.element.querySelectorAll("."+N.active),o=0;o<s.length;o++){var n=s[o];i.elements.push(n);var r=Array.prototype.slice.call(this.element.querySelectorAll("."+N.chip)).indexOf(n);i.Indexes.push(r),i.data.push(this.chips[r]);var l="object"==typeof this.chips[r]?this.chips[r].text?this.chips[r].text.toString():null:this.chips[r].toString();i.texts.push(l)}var a={text:i.texts[0],index:i.Indexes[0],data:i.data[0],element:i.elements[0]};e=t.isNullOrUndefined(a.index)?void 0:"Multiple"===this.selection?i:a}return e},i.prototype.wireEvent=function(e){e?(t.EventHandler.remove(this.element,"click",this.clickHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),t.EventHandler.remove(this.element,"keydown",this.keyHandler),t.EventHandler.remove(this.element,"keyup",this.keyHandler)):(t.EventHandler.add(this.element,"click",this.clickHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),t.EventHandler.add(this.element,"keydown",this.keyHandler,this),t.EventHandler.add(this.element,"keyup",this.keyHandler,this))},i.prototype.keyHandler=function(e){e.target.classList.contains(N.chip)&&("keydown"===e.type?13===e.keyCode||32===e.keyCode?this.clickHandler(e):46===e.keyCode&&this.enableDelete&&this.clickHandler(e,!0):9===e.keyCode&&this.focusInHandler(e.target))},i.prototype.focusInHandler=function(e){e.classList.contains(N.focused)||e.classList.add(N.focused)},i.prototype.focusOutHandler=function(e){var i=t.closest(e.target,"."+N.chip),s=this.chipType()?this.element.querySelector("."+N.focused):this.element.classList.contains(N.focused)?this.element:null;i&&s&&s.classList.remove(N.focused)},i.prototype.clickHandler=function(e,i){var s=this;void 0===i&&(i=!1);var o=t.closest(e.target,"."+N.chip);if(o){var n=void 0;if(this.chipType())n=this.find(o);else{var r=Array.prototype.slice.call(this.element.querySelectorAll("."+N.chip)).indexOf(o);n={text:this.innerText?this.innerText:this.text,element:o,data:this.text,index:r}}n.event=e,n.cancel=!1,this.trigger("beforeClick",n,function(t){t.cancel||s.clickEventHandler(t.element,e,i)})}},i.prototype.clickEventHandler=function(e,t,i){var s=this;if(this.chipType()){var o=this.find(e);if(o.event=t,(t.target.classList.contains(N.deleteIcon)?t.target:i?e.querySelector("."+N.deleteIcon):void 0)&&this.enableDelete){o.cancel=!1;var n=o;this.trigger("delete",n,function(t){if(!t.cancel){s.deleteHandler(t.element,t.index),s.selectionHandler(e),o.selected=t.element.classList.contains(N.active);var i=o;s.trigger("click",i);var n=s.element.querySelectorAll("."+N.chip)[t.index];n&&(n.focus(),s.focusInHandler(n))}})}else if("None"!==this.selection){this.selectionHandler(e),o.selected=e.classList.contains(N.active);var r=o;this.trigger("click",r)}else{this.focusInHandler(e);l=o;this.trigger("click",l)}}else{this.focusInHandler(e);var l={text:this.innerText?this.innerText:this.text,element:e,data:this.text,event:t};this.trigger("click",l)}},i.prototype.selectionHandler=function(e){if("Single"===this.selection){var t=this.element.querySelector("."+N.active);t&&t!==e&&(t.classList.remove(N.active),t.setAttribute("aria-selected","false")),this.setProperties({selectedChips:null},!0)}else this.setProperties({selectedChips:[]},!0);e.classList.contains(N.active)?(e.classList.remove(N.active),e.setAttribute("aria-selected","false")):(e.classList.add(N.active),e.setAttribute("aria-selected","true")),this.updateSelectedChips()},i.prototype.updateSelectedChips=function(){for(var e,t=this.element.querySelectorAll(".e-chip"),i=[],s=[],o=null,n=0;n<t.length;n++){var r=this.element.querySelectorAll(".e-chip")[n];if("true"===r.getAttribute("aria-selected")){if(e=r.getAttribute("data-value"),"Single"===this.selection&&r.classList.contains("e-active")){o=e||n;break}o=e?s.push(e):i.push(n)}}this.setProperties({selectedChips:"Single"===this.selection?o:e?s:i},!0)},i.prototype.deleteHandler=function(e,i){var s=this.find(e);this.chips.splice(i,1),this.setProperties({chips:this.chips},!0),t.detach(e),this.trigger("deleted",s)},i.prototype.destroy=function(){t.removeClass([this.element],[N.chipSet,N.chip,N.rtl,N.multiSelection,N.singleSelection,N.disabled,N.chipWrapper,N.iconWrapper,N.active,N.focused].concat(this.cssClass.toString().split(" ").filter(function(e){return e}))),this.removeMultipleAttributes(["tabindex","role","aria-label","aria-multiselectable"],this.element),this.wireEvent(!0),this.rippleFunction(),e.prototype.destroy.call(this),this.element.innerHTML="",this.element.innerText=this.innerText},i.prototype.removeMultipleAttributes=function(e,t){e.forEach(function(e){t.removeAttribute(e)})},i.prototype.getPersistData=function(){return this.addOnPersist([])},i.prototype.getModuleName=function(){return"chip-list"},i.prototype.onPropertyChanged=function(e,i){for(var s=0,o=Object.keys(e);s<o.length;s++)switch(o[s]){case"chips":case"text":case"avatarText":case"avatarIconCss":case"leadingIconCss":case"trailingIconCss":case"selection":case"enableDelete":case"enabled":this.refresh();break;case"cssClass":this.chipType()?this.refresh():(t.removeClass([this.element],i.cssClass.toString().split(" ").filter(function(e){return e})),t.addClass([this.element],e.cssClass.toString().split(" ").filter(function(e){return e})));break;case"selectedChips":t.removeClass(this.element.querySelectorAll(".e-active"),"e-active"),"Multiple"===this.selection?(this.multiSelectedChip=[],this.multiSelection(e.select