import{L as t}from"./p-810f5dfd.js";import{g as s}from"./p-c5b591fd.js";import{S as o,T as i,Q as e}from"./p-07dc3dc6.js";class c{constructor(t=null,o=null){this.topContainer=t,this.bottomContainer=o,this.topContainer=s("top"),this.bottomContainer=s("bottom")}call(t){this.prepareNotification("string"==typeof t?{message:t}:t)}shouldQueue(t){return this.topContainer||"top"!==t.position||(this.topContainer=s("top")),this.bottomContainer||"bottom"!==t.position||(this.bottomContainer=s("bottom")),("bottom"===t.position?this.bottomContainer:this.topContainer).childElementCount>=4}prepareNotification(t){if(this.shouldQueue(t))setTimeout((()=>this.prepareNotification(t)),250);else{const s=document.createElement("x-notification");if(t.label){const o=document.createElement("h4");o.innerText=t.label,s.appendChild(o)}t.onclose&&s.addEventListener("close",t.onclose);const o=document.createElement("p");o.innerHTML=t.message,s.appendChild(o),t.color&&s.setAttribute("color",t.color),t.icon&&s.setAttribute("icon",t.icon),t.interval&&s.setAttribute("interval",t.interval.toString()),("bottom"===t.position?this.bottomContainer:this.topContainer).insertAdjacentElement("afterbegin",s)}}success(s,o,i,e){this.prepareNotification({color:"success",label:o||t("alert.success"),message:s,icon:i,interval:e})}fail(s,o,i,e){this.prepareNotification({color:"danger",label:o||t("alert.danger"),message:s,icon:i,interval:e})}static create(){const t=new c;return Object.assign((s=>t.call(s)),{success:(s,o,i,e)=>t.success(s,o,i,e),fail:(s,o,i,e)=>t.fail(s,o,i,e)})}}const n=c.create();window.lang=t,window.notification=n,window.store=o,window.theme=i,window.query=e;const r={lang:t,notification:n,store:o,theme:i,query:e};export{r as UI}