@syncfusion/ej2-notifications
Version:
A package of Essential JS 2 notification components such as Toast and Badge which used to notify important information to end-users.
10 lines • 32.4 kB
JavaScript
/*!
* filename: ej2-notifications.min.js
* version : 29.1.33
* Copyright Syncfusion Inc. 2001 - 2024. 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.
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionPopups")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionButtons","SyncfusionPopups"],e):"object"==typeof exports?exports.SyncfusionNotifications=e(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionPopups")):t.SyncfusionNotifications=e(t.SyncfusionBase,t.SyncfusionButtons,t.SyncfusionPopups)}(self,((t,e,s)=>(()=>{"use strict";var i={766:e=>{e.exports=t},741:t=>{t.exports=e},197:t=>{t.exports=s}},o={};function n(t){var e=o[t];if(void 0!==e)return e.exports;var s=o[t]={exports:{}};return i[t](s,s.exports,n),s.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{ButtonModelProps:()=>g,Message:()=>_,Severity:()=>T,ShimmerEffect:()=>I,Skeleton:()=>q,SkeletonType:()=>S,Toast:()=>O,ToastAnimationSettings:()=>b,ToastAnimations:()=>E,ToastPosition:()=>C,ToastUtility:()=>e,Variant:()=>P});var t,e,s=n(766),i=n(741),o=n(197),l=(t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])},t(e,s)},function(e,s){function i(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}),a=function(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,s,r):o(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r},h="e-toast",c="e-toast-container",p="e-toast-title",d="e-toast-full-width",u="e-toast-content",f="e-toast-message",m="e-toast-progress",y="e-toast-close-icon",v="e-rtl",C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),a([(0,s.Property)("Left")],e.prototype,"X",void 0),a([(0,s.Property)("Top")],e.prototype,"Y",void 0),e}(s.ChildProperty),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),a([(0,s.Property)(null)],e.prototype,"model",void 0),a([(0,s.Property)(null)],e.prototype,"click",void 0),e}(s.ChildProperty),E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),a([(0,s.Property)("FadeIn")],e.prototype,"effect",void 0),a([(0,s.Property)(600)],e.prototype,"duration",void 0),a([(0,s.Property)("ease")],e.prototype,"easing",void 0),e}(s.ChildProperty),b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),a([(0,s.Complex)({effect:"FadeIn",duration:600,easing:"ease"},E)],e.prototype,"show",void 0),a([(0,s.Complex)({effect:"FadeOut",duration:600,easing:"ease"},E)],e.prototype,"hide",void 0),e}(s.ChildProperty),O=function(t){function e(e,s){var i=t.call(this,e,s)||this;return i.toastCollection=[],i.needsID=!0,i}return l(e,t),e.prototype.getModuleName=function(){return"toast"},e.prototype.getPersistData=function(){return this.addOnPersist([])},e.prototype.destroy=function(){this.hide("All"),this.element.classList.remove(c),(0,s.setStyleAttribute)(this.element,{position:"","z-index":""}),(0,s.isNullOrUndefined)(this.refElement)||(0,s.isNullOrUndefined)(this.refElement.parentElement)||(this.refElement.parentElement.insertBefore(this.element,this.refElement),(0,s.detach)(this.refElement),this.refElement=void 0),this.isBlazorServer()||t.prototype.destroy.call(this)},e.prototype.preRender=function(){this.isDevice=s.Browser.isDevice,"300px"===this.width&&(this.width=this.isDevice&&screen.width<768?"100%":"300px"),(0,s.isNullOrUndefined)(this.target)&&(this.target=document.body),this.enableRtl&&!this.isBlazorServer()&&this.element.classList.add(v)},e.prototype.render=function(){this.progressObj=[],this.intervalId=[],this.contentTemplate=null,this.toastTemplate=null,this.renderComplete(),this.initRenderClass=this.element.className},e.prototype.show=function(t){var e;if((0,s.isNullOrUndefined)(t)||(this.templateChanges(t),e=JSON.parse(JSON.stringify(t)),(0,s.extend)(this,this,t)),(0,s.isNullOrUndefined)(this.toastContainer)){this.toastContainer=this.getContainer();var i="string"==typeof this.target?document.querySelector(this.target):"object"==typeof this.target?this.target:document.body;if((0,s.isNullOrUndefined)(i))return;"BODY"===i.tagName?this.toastContainer.style.position="fixed":(this.toastContainer.style.position="absolute",i.style.position="relative"),this.setPositioning(this.position),i.appendChild(this.toastContainer)}this.isBlazorServer()&&this.element.classList.contains("e-control")?this.isToastModel(t):(this.toastEle=this.createElement("div",{className:h,id:(0,s.getUniqueID)("toast")}),this.setWidthHeight(),this.setCSSClass(this.cssClass),(0,s.isNullOrUndefined)(this.template)||""===this.template?this.personalizeToast():this.templateRendering(),this.setProgress(),this.setCloseButton(),this.setAria(),this.appendToTarget(t),this.isDevice&&screen.width<768&&new s.Touch(this.toastEle,{swipe:this.swipeHandler.bind(this)}),(0,s.isNullOrUndefined)(e)||((0,s.extend)(e,{element:[this.toastEle]},!0),this.toastCollection.push(e)),this.isReact&&this.renderReactTemplates())},e.prototype.showToast=function(t,e){this.toastEle=this.element.querySelector("#"+t),this.show(e)},e.prototype.isToastModel=function(t){this.toastContainer=this.element,this.setPositioning(this.position);(0,s.isNullOrUndefined)(this.element.lastElementChild)||this.setProgress(),this.setAria(),this.appendToTarget(t)},e.prototype.swipeHandler=function(t){var e=(0,s.closest)(t.originalEvent.target,"."+h+":not(."+c+")"),i=this.animation.hide.effect;(0,s.isNullOrUndefined)(e)||("Right"===t.swipeDirection?(this.animation.hide.effect="SlideRightOut",this.hideToast("swipe",e)):"Left"===t.swipeDirection&&(this.animation.hide.effect="SlideLeftOut",this.hideToast("swipe",e)),this.animation.hide.effect=i)},e.prototype.templateChanges=function(t){(0,s.isUndefined)(t.content)||(0,s.isNullOrUndefined)(this.contentTemplate)||this.content===t.content||this.clearContentTemplate(),(0,s.isUndefined)(t.template)||(0,s.isNullOrUndefined)(this.toastTemplate)||this.template===t.template||this.clearToastTemplate()},e.prototype.setCSSClass=function(t){if(t){var e=-1!==t.indexOf(",")?",":" ";(0,s.classList)(this.toastEle,t.split(e),[]),this.toastContainer&&(0,s.classList)(this.toastContainer,t.split(e),[])}},e.prototype.setWidthHeight=function(){"300px"===this.width?this.toastEle.style.width=(0,s.formatUnit)(this.width):"100%"===this.width?this.toastContainer.classList.add(d):(this.toastEle.style.width=(0,s.formatUnit)(this.width),this.toastContainer.classList.remove(d)),this.toastEle.style.height=(0,s.formatUnit)(this.height)},e.prototype.templateRendering=function(){this.fetchEle(this.toastEle,this.template,"template")},e.prototype.sanitizeHelper=function(t){if(this.enableHtmlSanitizer){var e=s.SanitizeHtmlHelper.beforeSanitize();(0,s.extend)(e,e,{cancel:!1,helper:null}),this.trigger("beforeSanitizeHtml",e),e.cancel&&!(0,s.isNullOrUndefined)(e.helper)?t=e.helper(t):e.cancel||(t=s.SanitizeHtmlHelper.serializeValue(e,t))}return t},e.prototype.hide=function(t){this.hideToast("",t)},e.prototype.hideToast=function(t,e){if(!(0,s.isNullOrUndefined)(this.toastContainer)&&0!==this.toastContainer.childElementCount)if("string"!=typeof e||"All"!==e)(0,s.isNullOrUndefined)(e)&&(e=this.newestOnTop?this.toastContainer.lastElementChild:this.toastContainer.firstElementChild),this.destroyToast(e,t);else for(var i=0;i<this.toastContainer.childElementCount;i++)this.destroyToast(this.toastContainer.children[i],t)},e.prototype.fetchEle=function(t,e,i){var o,n,r,l;if(e="string"==typeof e?this.sanitizeHelper(e):e,l=t.classList.contains(p)?this.element.id+"title":t.classList.contains(u)?this.element.id+"content":this.element.id+"template",n="content"===i?this.contentTemplate:this.toastTemplate,!(0,s.isNullOrUndefined)(n))return t.appendChild(n.cloneNode(!0)),t;try{if("function"!=typeof e&&document.querySelectorAll(e).length>0){var a=null;"title"!==i&&(a=document.querySelector(e),t.appendChild(a),a.style.display="");var h=(0,s.isNullOrUndefined)(a)?n:a.cloneNode(!0);"content"===i?this.contentTemplate=h:this.toastTemplate=h}else o=(0,s.compile)(e)}catch(t){o="object"==typeof e?(0,s.compile)(e):(0,s.compile)((0,s.initializeCSPTemplate)((function(){return e})))}if(!(0,s.isNullOrUndefined)(o))if(this.isBlazorServer()){r=o({},this,i,l,!0)}else r=o({},this,i,null,!0);return(0,s.isNullOrUndefined)(r)||!(r.length>0)||(0,s.isNullOrUndefined)(r[0].tagName)&&1===r.length?"function"!=typeof e&&0===t.childElementCount&&(t.innerHTML=e):[].slice.call(r).forEach((function(e){(0,s.isNullOrUndefined)(e.tagName)||(e.style.display=""),t.appendChild(e)})),t},e.prototype.clearProgress=function(t){(0,s.isNullOrUndefined)(this.intervalId[t])||(clearInterval(this.intervalId[t]),delete this.intervalId[t]),(0,s.isNullOrUndefined)(this.progressObj[t])||(clearInterval(this.progressObj[t].intervalId),delete this.progressObj[t])},e.prototype.removeToastContainer=function(t){t&&this.toastContainer.classList.contains("e-toast-util")&&(0,s.detach)(this.toastContainer)},e.prototype.clearContainerPos=function(t){var e=this;this.isBlazorServer()?this.toastContainer=null:(this.customPosition?((0,s.setStyleAttribute)(this.toastContainer,{left:"",top:""}),this.removeToastContainer(t),this.toastContainer=null,this.customPosition=!1):([h+"-top-left",h+"-top-right",h+"-bottom-left",h+"-bottom-right",h+"-bottom-center",h+"-top-center",h+"-full-width"].forEach((function(t){!(0,s.isNullOrUndefined)(e.toastContainer)&&e.toastContainer.classList.contains(t)&&e.toastContainer.classList.remove(t)})),this.removeToastContainer(t),this.toastContainer=null),(0,s.isNullOrUndefined)(this.contentTemplate)||this.clearContentTemplate(),(0,s.isNullOrUndefined)(this.toastTemplate)||this.clearToastTemplate())},e.prototype.clearContentTemplate=function(){this.contentTemplate.style.display="none",document.body.appendChild(this.contentTemplate),this.contentTemplate=null},e.prototype.clearToastTemplate=function(){this.toastTemplate.style.display="none",document.body.appendChild(this.toastTemplate),this.toastTemplate=null},e.prototype.isBlazorServer=function(){return(0,s.isBlazor)()&&this.isServerRendered},e.prototype.destroyToast=function(t,e){for(var i,o=this,n=0;n<this.toastCollection.length;n++)this.toastCollection[n].element[0]===t&&(i=this.toastCollection[n],this.toastCollection.splice(n,1));var r={options:this,cancel:!1,type:e,element:t,toastContainer:this.toastContainer},l=this.animation.hide,a={duration:l.duration,name:"None"===l.effect&&"Enable"===s.animationMode?"FadeOut":l.effect,timingFunction:l.easing},h=parseInt(t.id.split("toast_")[1],10),c=this.isBlazorServer()?{options:i,toastContainer:this.toastContainer}:{options:i,toastContainer:this.toastContainer,toastObj:this};this.trigger("beforeClose",r,(function(e){e.cancel||((0,s.isNullOrUndefined)(o.progressObj[h])||(0,s.isNullOrUndefined)(t.querySelector("."+m))||(o.progressObj[h].progressEle.style.width="0%"),a.end=function(){o.clearProgress(h),o.isBlazorServer()&&!(0,s.isNullOrUndefined)(i)||(0,s.detach)(t),o.trigger("close",c),0===o.toastContainer.childElementCount&&o.clearContainerPos(!0),l=null,a=null},new s.Animation(a).animate(t))}))},e.prototype.personalizeToast=function(){this.setIcon(),this.setTitle(),this.setContent(),this.actionButtons()},e.prototype.setAria=function(){(0,s.attributes)(this.toastEle,{role:"alert"})},e.prototype.setPositioning=function(t){this.isBlazorServer()||(isNaN(parseFloat(t.X))&&isNaN(parseFloat(t.Y))?this.toastContainer.classList.add(h+"-"+t.Y.toString().toLowerCase()+"-"+t.X.toString().toLowerCase()):(this.customPosition=!0,(0,s.setStyleAttribute)(this.toastContainer,{left:(0,s.formatUnit)(t.X),top:(0,s.formatUnit)(t.Y)})))},e.prototype.setCloseButton=function(){if(this.showCloseButton){this.l10n=new s.L10n("toast",{close:"Close"},this.locale),this.l10n.setLocale(this.locale);var t=this.l10n.getConstant("close"),e=this.createElement("div",{className:y+" e-icons ",attrs:{tabindex:"0","aria-label":t,role:"button"}});this.toastEle.classList.add("e-toast-header-close-icon"),this.toastEle.appendChild(e)}},e.prototype.setProgress=function(){if(this.timeOut>0){var t=parseInt(this.toastEle.id.split("toast_")[1],10);this.intervalId[t]=window.setTimeout(this.destroyToast.bind(this,this.toastEle),this.timeOut),this.progressObj[t]={hideEta:null,intervalId:null,maxHideTime:null,element:null,timeOutId:null,progressEle:null},this.progressObj[t].maxHideTime=parseFloat(this.timeOut+""),this.progressObj[t].hideEta=(new Date).getTime()+this.progressObj[t].maxHideTime,this.progressObj[t].element=this.toastEle,this.extendedTimeout>0&&(s.EventHandler.add(this.toastEle,"mouseover",this.toastHoverAction.bind(this,t)),s.EventHandler.add(this.toastEle,"mouseleave",this.delayedToastProgress.bind(this,t)),this.progressObj[t].timeOutId=this.intervalId[t]),this.showProgressBar&&(this.progressBarEle=this.createElement("div",{className:m}),this.toastEle.insertBefore(this.progressBarEle,this.toastEle.children[0]),this.progressObj[t].intervalId=setInterval(this.updateProgressBar.bind(this,this.progressObj[t]),10),this.progressObj[t].progressEle=this.progressBarEle)}},e.prototype.toastHoverAction=function(t){clearTimeout(this.progressObj[t].timeOutId),clearInterval(this.progressObj[t].intervalId),this.progressObj[t].hideEta=0;var e=this.progressObj[t].element;(0,s.isNullOrUndefined)(e.querySelector("."+m))||(this.progressObj[t].progressEle.style.width="0%")},e.prototype.delayedToastProgress=function(t){var e=this.progressObj[t];if(!(0,s.isNullOrUndefined)(e)){var i=e.element;e.timeOutId=window.setTimeout(this.destroyToast.bind(this,i),this.extendedTimeout),e.maxHideTime=parseFloat(this.extendedTimeout+""),e.hideEta=(new Date).getTime()+e.maxHideTime,(0,s.isNullOrUndefined)(i.querySelector("."+m))||(e.intervalId=setInterval(this.updateProgressBar.bind(this,e),10))}},e.prototype.updateProgressBar=function(t){var e=(t.hideEta-(new Date).getTime())/t.maxHideTime*100;e="Ltr"===this.progressDirection?100-e:e,t.progressEle.style.width=e+"%"},e.prototype.setIcon=function(){if(!(0,s.isNullOrUndefined)(this.icon)&&0!==this.icon.length){var t=this.createElement("div",{className:"e-toast-icon e-icons "+this.icon});this.toastEle.classList.add("e-toast-header-icon"),this.toastEle.appendChild(t)}},e.prototype.setTitle=function(){if(!(0,s.isNullOrUndefined)(this.title)){var t=this.createElement("div",{className:p});t=this.fetchEle(t,this.title,"title");var e=this.createElement("div",{className:f});e.appendChild(t),this.toastEle.appendChild(e)}},e.prototype.setContent=function(){var t=this.createElement("div",{className:u}),e=this.element;if((0,s.isNullOrUndefined)(this.content)||""===this.content){var i=""!==this.element.innerHTML.replace(/\s/g,"");if((e.children.length>0||i)&&(!e.firstElementChild||!e.firstElementChild.classList.contains(h))){this.innerEle=document.createDocumentFragment();for(var o=this.createElement("div");0!==e.childNodes.length;)this.innerEle.appendChild(this.element.childNodes[0]);t.appendChild(this.innerEle),[].slice.call(t.children).forEach((function(t){o.appendChild(t.cloneNode(!0))})),this.content=o,this.appendMessageContainer(t)}}else"object"!=typeof this.content||(0,s.isNullOrUndefined)(this.content.tagName)?(t=this.fetchEle(t,this.content,"content"),this.appendMessageContainer(t)):(t.appendChild(this.content),this.content=this.content.cloneNode(!0),this.appendMessageContainer(t))},e.prototype.appendMessageContainer=function(t){if(this.toastEle.querySelectorAll("."+f).length>0)this.toastEle.querySelector("."+f).appendChild(t);else{var e=this.createElement("div",{className:f});e.appendChild(t),this.toastEle.appendChild(e)}},e.prototype.actionButtons=function(){var t=this,e=this.createElement("div",{className:"e-toast-actions"});[].slice.call(this.buttons).forEach((function(o){if(!(0,s.isNullOrUndefined)(o.model)){var n=t.createElement("button");n.setAttribute("type","button"),((0,s.isNullOrUndefined)(o.model.cssClass)||0===o.model.cssClass.length)&&(o.model.cssClass="e-primary "+t.cssClass),n.classList.add("e-small"),new i.Button(o.model,n),(0,s.isNullOrUndefined)(o.click)||"function"!=typeof o.click||s.EventHandler.add(n,"click",o.click),e.appendChild(n)}})),e.childElementCount>0&&this.appendMessageContainer(e)},e.prototype.appendToTarget=function(t){var e=this,i=this.isBlazorServer()?{options:t,element:this.toastEle,cancel:!1}:{options:t,toastObj:this,element:this.toastEle,cancel:!1};this.trigger("beforeOpen",i,(function(i){if(i.cancel){if(e.isBlazorServer()){var n=parseInt(e.toastEle.id.split("toast_")[1],10);e.clearProgress(n),(0,s.detach)(e.toastEle),0===e.toastContainer.childElementCount&&e.clearContainerPos()}}else e.isBlazorServer()||(e.toastEle.style.display="none"),e.newestOnTop&&0!==e.toastContainer.childElementCount?e.toastContainer.insertBefore(e.toastEle,e.toastContainer.children[0]):e.isBlazorServer()||e.toastContainer.appendChild(e.toastEle),(0,s.removeClass)([e.toastEle],"e-blazor-toast-hidden"),s.EventHandler.add(e.toastEle,"click",e.clickHandler,e),s.EventHandler.add(e.toastEle,"keydown",e.keyDownHandler,e),e.toastContainer.style.zIndex=(0,o.getZindexPartial)(e.toastContainer)+"",e.displayToast(e.toastEle,t)}))},e.prototype.clickHandler=function(t){var e=this;this.isBlazorServer()||t.stopPropagation();var i=t.target,o=(0,s.closest)(i,"."+h),n=this.isBlazorServer()?{element:o,cancel:!1,clickToClose:!1,originalEvent:t}:{element:o,cancel:!1,clickToClose:!1,originalEvent:t,toastObj:this},r=i.classList.contains(y);this.trigger("click",n,(function(t){(r&&!t.cancel||t.clickToClose)&&e.destroyToast(o,"click")}))},e.prototype.keyDownHandler=function(t){if(t.target.classList.contains(y)&&(13===t.keyCode||32===t.keyCode)){var e=t.target,i=(0,s.closest)(e,"."+h);this.destroyToast(i,"key")}},e.prototype.displayToast=function(t,e){var i=this,o=this.animation.show,n={duration:o.duration,name:"None"===o.effect&&"Enable"===s.animationMode?"FadeIn":o.effect,timingFunction:o.easing},r=this.isBlazorServer()?{options:e,element:this.toastEle}:{options:e,toastObj:this,element:this.toastEle};n.begin=function(){t.style.display=""},n.end=function(){i.trigger("open",r)},new s.Animation(n).animate(t)},e.prototype.getContainer=function(){return this.element.classList.add(c),this.element},e.prototype.onPropertyChanged=function(t,e){for(var s=this.element,i=0,o=Object.keys(t);i<o.length;i++){if("enableRtl"===o[i])t.enableRtl?s.classList.add(v):s.classList.remove(v)}},a([(0,s.Property)("300px")],e.prototype,"width",void 0),a([(0,s.Property)("auto")],e.prototype,"height",void 0),a([(0,s.Property)(null)],e.prototype,"title",void 0),a([(0,s.Property)(null)],e.prototype,"content",void 0),a([(0,s.Property)(!0)],e.prototype,"enableHtmlSanitizer",void 0),a([(0,s.Property)(null)],e.prototype,"icon",void 0),a([(0,s.Property)(null)],e.prototype,"cssClass",void 0),a([(0,s.Property)(null)],e.prototype,"template",void 0),a([(0,s.Property)(!0)],e.prototype,"newestOnTop",void 0),a([(0,s.Property)(!1)],e.prototype,"showCloseButton",void 0),a([(0,s.Property)(!1)],e.prototype,"showProgressBar",void 0),a([(0,s.Property)(5e3)],e.prototype,"timeOut",void 0),a([(0,s.Property)("Rtl")],e.prototype,"progressDirection",void 0),a([(0,s.Property)(1e3)],e.prototype,"extendedTimeout",void 0),a([(0,s.Complex)({},b)],e.prototype,"animation",void 0),a([(0,s.Complex)({},C)],e.prototype,"position",void 0),a([(0,s.Collection)([{}],g)],e.prototype,"buttons",void 0),a([(0,s.Property)(null)],e.prototype,"target",void 0),a([(0,s.Event)()],e.prototype,"created",void 0),a([(0,s.Event)()],e.prototype,"beforeSanitizeHtml",void 0),a([(0,s.Event)()],e.prototype,"destroyed",void 0),a([(0,s.Event)()],e.prototype,"open",void 0),a([(0,s.Event)()],e.prototype,"beforeOpen",void 0),a([(0,s.Event)()],e.prototype,"beforeClose",void 0),a([(0,s.Event)()],e.prototype,"close",void 0),a([(0,s.Event)()],e.prototype,"click",void 0),e=a([s.NotifyPropertyChanges],e)}(s.Component);!function(t){t.show=function(t,e,i){var o,n;if(document.querySelector("."+c)?o=document.querySelector("."+c):(o=(0,s.createElement)("div",{className:h+" "+c+" e-toast-util"}),document.body.appendChild(o)),"string"==typeof t){var r=void 0,l=void 0;if((0,s.isNullOrUndefined)(e))r="",l="";else switch(e){case"Warning":r="e-toast-warning",l="e-toast-warning-icon";break;case"Success":r="e-toast-success",l="e-toast-success-icon";break;case"Error":r="e-toast-danger",l="e-toast-error-icon";break;case"Information":r="e-toast-info",l="e-toast-info-icon"}n={content:t,cssClass:r,icon:l,timeOut:(0,s.isNullOrUndefined)(i)?5e3:i}}else n=t;var a=new O(n);return a.appendTo(o),a.show(),a}}(e||(e={}));var T,P,N=function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])},t(e,s)};return function(e,s){function i(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),w=function(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,s,r):o(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r};!function(t){t.Normal="Normal",t.Success="Success",t.Info="Info",t.Warning="Warning",t.Error="Error"}(T||(T={})),function(t){t.Text="Text",t.Outlined="Outlined",t.Filled="Filled"}(P||(P={}));var S,I,U="e-msg-icon",k="e-content-center",x="e-rtl",L="e-success",j="e-warning",H="e-info",B="e-error",R="e-outlined",z="e-filled",A="e-hidden",_=function(t){function e(e,s){var i=t.call(this,e,s)||this;return i.initialRender=!0,i}return N(e,t),e.prototype.getModuleName=function(){return"message"},e.prototype.getPersistData=function(){return this.addOnPersist([])},e.prototype.preRender=function(){this.l10n=new s.L10n("message",{close:"Close"},this.locale)},e.prototype.render=function(){this.innerContent=this.element.innerHTML,this.element.innerHTML="",this.msgElement=this.createElement("div",{className:"e-msg-content-wrap"}),this.initialize(),this.wireEvents(),this.renderComplete(),this.renderReactTemplates(),this.initialRender=!1},e.prototype.initialize=function(){this.element.setAttribute("role","alert"),this.setCssClass(),this.setIcon(),this.setContent(),this.setCloseIcon(),this.setSeverity(),this.setVariant(),this.setVisible(),this.enableRtl&&this.element.classList.add(x)},e.prototype.setIcon=function(){this.showIcon&&(this.iconElement=this.createElement("span",{className:U}),this.element.classList.contains(k)?this.msgElement.appendChild(this.iconElement):this.element.appendChild(this.iconElement))},e.prototype.setCloseIcon=function(){this.showCloseIcon&&(this.closeIcon=this.createElement("button",{attrs:{type:"button",class:"e-msg-close-icon"}}),this.element.appendChild(this.closeIcon),this.setTitle())},e.prototype.setTitle=function(){this.l10n.setLocale(this.locale);var t=this.l10n.getConstant("close");this.closeIcon.setAttribute("title",t),this.closeIcon.setAttribute("aria-label",t)},e.prototype.setContent=function(){this.txtElement=this.createElement("div",{className:"e-msg-content"}),this.element.classList.contains(k)?(this.msgElement.appendChild(this.txtElement),this.element.appendChild(this.msgElement)):this.element.appendChild(this.txtElement),this.setTemplate()},e.prototype.setTemplate=function(){var t;if((0,s.isNullOrUndefined)(this.content)||""===this.content)this.txtElement.innerHTML=this.innerContent;else if(!(0,s.isNullOrUndefined)(this.content)&&""!==this.content&&("string"==typeof this.content||"string"!=typeof this.content))if(this.isVue||"string"!=typeof this.content){if(t=(0,s.compile)(this.content),!(0,s.isNullOrUndefined)(t)){var e=t({},this,"content",this.element.id+"content",!0);e&&(e=Array.prototype.slice.call(e),(0,s.append)(e,this.txtElement),this.renderReactTemplates())}}else this.txtElement.innerHTML=this.content},e.prototype.setSeverity=function(){var t=[L,j,H,B];(0,s.removeClass)([this.element],t),"Success"===this.severity?(0,s.addClass)([this.element],L):"Warning"===this.severity?(0,s.addClass)([this.element],j):"Error"===this.severity?(0,s.addClass)([this.element],B):"Info"===this.severity&&(0,s.addClass)([this.element],H)},e.prototype.setVariant=function(){var t=[z,R];(0,s.removeClass)([this.element],t),"Outlined"===this.variant?(0,s.addClass)([this.element],R):"Filled"===this.variant&&(0,s.addClass)([this.element],z)},e.prototype.setCssClass=function(t){t&&(0,s.removeClass)([this.element],t.split(" ")),this.cssClass&&(0,s.addClass)([this.element],this.cssClass.split(" "))},e.prototype.setVisible=function(){this.visible?(0,s.removeClass)([this.element],A):((0,s.addClass)([this.element],A),this.initialRender||this.trigger("closed",{event,isInteracted:!1,element:this.element}))},e.prototype.clickHandler=function(t){this.closeMessage(t)},e.prototype.keyboardHandler=function(t){32!==t.keyCode&&13!==t.keyCode||this.closeMessage(t)},e.prototype.closeMessage=function(t){(0,s.addClass)([this.element],A),this.setProperties({visible:!1},!0);var e={event:t,isInteracted:!0,element:this.element};this.trigger("closed",e)},e.prototype.wireEvents=function(){this.showCloseIcon&&(s.EventHandler.add(this.closeIcon,"click",this.clickHandler,this),s.EventHandler.add(this.closeIcon,"keydown",this.keyboardHandler,this))},e.prototype.unWireEvents=function(){this.showCloseIcon&&(s.EventHandler.remove(this.closeIcon,"click",this.clickHandler),s.EventHandler.remove(this.closeIcon,"keydown",this.keyboardHandler))},e.prototype.onPropertyChanged=function(t,e){for(var i=0,o=Object.keys(t);i<o.length;i++){switch(o[i]){case"cssClass":this.setCssClass(e.cssClass);break;case"content":this.txtElement.innerHTML="",this.setTemplate();break;case"enableRtl":this.enableRtl?this.element.classList.add(x):this.element.classList.remove(x);break;case"locale":this.showCloseIcon&&this.setTitle();break;case"showIcon":!this.showIcon&&this.element.getElementsByClassName(U).length>0&&(0,s.detach)(this.iconElement),this.showIcon&&(this.iconElement=this.createElement("span",{className:U}),this.element.insertBefore(this.iconElement,this.txtElement));break;case"showCloseIcon":this.showCloseIcon||(0,s.isNullOrUndefined)(this.closeIcon)?(this.setCloseIcon(),this.wireEvents()):(this.unWireEvents(),(0,s.detach)(this.closeIcon));break;case"severity":this.setSeverity();break;case"variant":this.setVariant();break;case"visible":this.setVisible()}}},e.prototype.destroy=function(){var e=(0,s.isNullOrUndefined)(this.cssClass)?[""]:this.cssClass.split(" "),i=[L,j,H,B,x,A,R,z],o=1===e.length&&""===e[0]?i:i.concat(e);(0,s.removeClass)([this.element],o),this.element.removeAttribute("role"),this.unWireEvents(),(0,s.isNullOrUndefined)(this.iconElement)||(0,s.detach)(this.iconElement),(0,s.detach)(this.txtElement),(0,s.isNullOrUndefined)(this.closeIcon)||(0,s.detach)(this.closeIcon),t.prototype.destroy.call(this)},w([(0,s.Property)(null)],e.prototype,"content",void 0),w([(0,s.Property)("")],e.prototype,"cssClass",void 0),w([(0,s.Property)(!0)],e.prototype,"showIcon",void 0),w([(0,s.Property)(!1)],e.prototype,"showCloseIcon",void 0),w([(0,s.Property)("Normal")],e.prototype,"severity",void 0),w([(0,s.Property)("Text")],e.prototype,"variant",void 0),w([(0,s.Property)(!0)],e.prototype,"visible",void 0),w([(0,s.Event)()],e.prototype,"created",void 0),w([(0,s.Event)()],e.prototype,"destroyed",void 0),w([(0,s.Event)()],e.prototype,"closed",void 0),e=w([s.NotifyPropertyChanges],e)}(s.Component),D=function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])},t(e,s)};return function(e,s){function i(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),M=function(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(e,s,r):o(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r},F={TEXTSHAPE:"e-skeleton-text",CIRCLESHAPE:"e-skeleton-circle",SQUARESHAPE:"e-skeleton-square",RECTANGLESHAPE:"e-skeleton-rectangle",WAVEEFFECT:"e-shimmer-wave",PULSEEFFECT:"e-shimmer-pulse",FADEEFFECT:"e-shimmer-fade",VISIBLENONE:"e-visible-none"};!function(t){t.Text="Text",t.Circle="Circle",t.Square="Square",t.Rectangle="Rectangle"}(S||(S={})),function(t){t.Wave="Wave",t.Fade="Fade",t.Pulse="Pulse",t.None="None"}(I||(I={}));var q=function(t){function e(e,s){return t.call(this,e,s)||this}return D(e,t),e.prototype.getModuleName=function(){return"skeleton"},e.prototype.getPersistData=function(){return this.addOnPersist([])},e.prototype.preRender=function(){this.element.id||(this.element.id=(0,s.getUniqueID)("e-"+this.getModuleName())),this.updateCssClass(),(0,s.attributes)(this.element,{role:"alert","aria-busy":"true","aria-live":"polite","aria-label":this.label})},e.prototype.render=function(){this.initialize()},e.prototype.onPropertyChanged=function(t,e){for(var i=0,o=Object.keys(t);i<o.length;i++){switch(o[i]){case"width":case"height":this.updateDimension();break;case"shape":this.updateShape();break;case"shimmerEffect":this.updateEffect();break;case"visible":this.updateVisibility();break;case"label":this.element.setAttribute("aria-label",this.label);break;case"cssClass":e.cssClass&&(0,s.removeClass)([this.element],e.cssClass.split(" ")),this.updateCssClass()}}},e.prototype.destroy=function(){t.prototype.destroy.call(this);var e=["role","aria-live","aria-busy","aria-label"],i=[];this.cssClass&&(i=i.concat(this.cssClass.split(" ")));for(var o=0;o<e.length;o++)this.element.removeAttribute(e[parseInt(o.toString(),10)]);i=(i=i.concat(this.element.classList.value.match(/(e-skeleton-[^\s]+)/g)||[])).concat(this.element.classList.value.match(/(e-shimmer-[^\s]+)/g)||[]),(0,s.removeClass)([this.element],i)},e.prototype.initialize=function(){this.updateShape(),this.updateEffect(),this.updateVisibility()},e.prototype.updateShape=function(){if(!(0,s.isNullOrUndefined)(this.shape)){var t=F[this.shape.toUpperCase()+"SHAPE"],e=this.element.classList.value.match(/(e-skeleton-[^\s]+)/g)||[];this.updateDimension(),e&&(0,s.removeClass)([this.element],e),(0,s.addClass)([this.element],[t])}},e.prototype.updateDimension=function(){var t=!this.width&&["Text","Rectangle"].indexOf(this.shape)>-1?"100%":(0,s.formatUnit)(this.width),e=["Circle","Square"].indexOf(this.shape)>-1?t:(0,s.formatUnit)(this.height);this.element.style.width=t,this.element.style.height=e},e.prototype.updateEffect=function(){var t=this.element.classList.value.match(/(e-shimmer-[^\s]+)/g)||[];t&&(0,s.removeClass)([this.element],t),(0,s.isNullOrUndefined)(this.shimmerEffect)||(0,s.addClass)([this.element],[F[this.shimmerEffect.toUpperCase()+"EFFECT"]])},e.prototype.updateVisibility=function(){this.element.classList[this.visible?"remove":"add"](F.VISIBLENONE)},e.prototype.updateCssClass=function(){this.cssClass&&(0,s.addClass)([this.element],this.cssClass.split(" "))},M([(0,s.Property)("")],e.prototype,"width",void 0),M([(0,s.Property)("")],e.prototype,"height",void 0),M([(0,s.Property)(!0)],e.prototype,"visible",void 0),M([(0,s.Property)("Text")],e.prototype,"shape",void 0),M([(0,s.Property)("Wave")],e.prototype,"shimmerEffect",void 0),M([(0,s.Property)("Loading...")],e.prototype,"label",void 0),M([(0,s.Property)("")],e.prototype,"cssClass",void 0),e=M([s.NotifyPropertyChanges],e)}(s.Component)})(),r})()));