import{e as m}from"./colors.js";import{o,c,b as f,w as h,n as T,a as s,d as p,F as O,i as N,f as x,T as b,_ as C}from"./index.js";import{_ as g}from"./bell.js";const v=s("div",{class:"screen-notification__item-background"},null,-1),E={class:"screen-notification__title"},L=s("img",{src:g},null,-1),S=["innerHTML"],M={class:"screen-notification__text-wrapper"},P={class:"screen-notification__text"},R=["innerHTML"];function q(t,e,n,r,_,i){return o(),c("div",{class:T(["screen-notification iface-container",{"screen-notification_mobile":i.isMobile}])},[f(b,{name:`slide-${i.positionClass?i.positionClass:"top"}`,tag:"div",appear:""},{default:h(()=>[i.currentItem?(o(),c("div",{class:T(["screen-notification__item",`screen-notification__item_${i.positionClass}`]),key:i.currentItem.id},[v,s("div",{class:"screen-notification__circle",style:p({background:i.circleColor})},null,4),s("div",E,[L,s("div",{class:"screen-notification__title-text",innerHTML:i.currentItem.title},null,8,S)]),s("div",M,[s("div",P,[(o(!0),c(O,null,N(i.currentItemLines,(a,l)=>(o(),c("div",{class:"screen-notification__text-line",key:l,innerHTML:a},null,8,R))),128))])])],2)):x("",!0)]),_:1},8,["name"])],2)}const u={TOP:0,LEFT:1,BOTTOM:2},H={[u.TOP]:"top",[u.LEFT]:"left",[u.BOTTOM]:"bottom"},$={props:["openParams"],data:()=>({lastID:0,queue:[]}),computed:{currentItem(){return this.queue[0]?this.queue[0]:null},currentItemLines(){return this.currentItem.text.split("<br>")},positionClass(){if(!this.currentItem)return;const t=this.currentItem.position;return t===void 0?null:H[t]},circleColor(){const t=this.currentItem.color;if(!t)return null;const{r:e,g:n,b:r}=this.hexToRgb(t);return`radial-gradient(39.31% 39.31% at 50% 50%, rgba(${e}, ${n}, ${r}, 0.4) 0%, rgba(${e}, ${n}, ${r}, 0) 100%)`},isMobile(){return this.$root.isMobile}},methods:{hideAll(){this.queue.splice(0,this.queue.length),this.$forceUpdate()},add(t){const e={POSITION:0,TITLE:1,TEXT:2,COLOR:3,DURATION:4},n=JSON.parse(t),r=n[e.POSITION],_=m(n[e.TITLE]),i=m(n[e.TEXT]),a=n[e.COLOR],l=n[e.DURATION],d=++this.lastID,I={id:d,position:r,title:_,text:i,color:a};this.queue.push(I),setTimeout(()=>this.onItemHide(d),l)},onItemHide(t){this.queue=this.queue.filter(e=>e.id!==t),this.$forceUpdate()},hexToRgb(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}}},F=C($,[["render",q]]);export{F as default};
