import N from"./Icon.30f6becb.js";import P from"./Avatar.a7ca17e7.js";import j from"./Button.8a478b7a.js";import{r as z,j as $,g as D,E as k,G as E,H as F,O as A,s as I,B as q,A as L,o as i,k as f,w as G,a as p,y as u,l as d,L as C,I as M,d as S,t as h,c as v,F as T,x as U,P as w,V as H,T as R}from"./entry.eb978f24.js";import{d as J}from"./index.83f60940.js";import{_ as K}from"./_plugin-vue_export-helper.c27b6911.js";import"./Link.a86a4ec7.js";import"./nuxt-link.0033bf2d.js";import"./_baseIsEqual.8f3c5dea.js";import"./_MapCache.e1952f2e.js";import"./index.d18b209b.js";function Q(e,a,B){let n=null;const{pause:o,resume:g,timestamp:m}=J({...B||{},controls:!0}),s=z(null),l=$(()=>s.value?a-(m.value-s.value):0);function t(...V){n=setTimeout(()=>{n=null,s.value=null,e(...V)},l.value)}function r(){n&&(clearTimeout(n),n=null)}function c(){s.value=Date.now(),t()}function b(){r(),o()}function y(){r(),o()}function O(){t(),g(),s.value=(s.value||0)+(Date.now()-m.value)}return c(),{start:c,stop:b,pause:y,resume:O,remaining:l}}const W=D({components:{UIcon:N,UAvatar:P,UButton:j},props:{id:{type:[String,Number],required:!0},title:{type:String,required:!0},description:{type:String,default:null},icon:{type:String,default:()=>k.ui.notification.default.icon},avatar:{type:Object,default:null},closeButton:{type:Object,default:()=>k.ui.notification.default.closeButton},timeout:{type:Number,default:5e3},actions:{type:Array,default:()=>[]},callback:{type:Function,default:null},color:{type:String,default:()=>k.ui.notification.default.color,validator(e){return["gray",...k.ui.colors].includes(e)}},ui:{type:Object,default:()=>k.ui.notification}},emits:["close"],setup(e,{emit:a}){const B=E(),n=$(()=>F({},e.ui,B.ui.notification));let o=null;const g=z(e.timeout),m=$(()=>({width:`${g.value/e.timeout*100||0}%`})),s=$(()=>A(n.value.progress.base,n.value.progress.background?.replaceAll("{color}",e.color))),l=$(()=>A(n.value.icon.base,n.value.icon.color?.replaceAll("{color}",e.color)));function t(){o&&o.pause()}function r(){o&&o.resume()}function c(){o&&o.stop(),e.callback&&e.callback(),a("close")}function b(y){o&&o.stop(),y.click&&y.click(),a("close")}return I(()=>{e.timeout&&(o=Q(()=>{c()},e.timeout),q(()=>{g.value=o.remaining.value}))}),L(()=>{o&&o.stop()}),{ui:n,progressStyle:m,progressClass:s,iconClass:l,onMouseover:t,onMouseleave:r,onClose:c,onAction:b}}}),X={class:"w-0 flex-1"},Y={key:1,class:"mt-3 flex items-center gap-2"},Z={class:"flex-shrink-0 flex items-center gap-3"},_={key:0,class:"flex items-center gap-2"};function x(e,a,B,n,o,g){const m=N,s=P,l=j;return i(),f(R,C({appear:""},e.ui.transition),{default:G(()=>[p("div",{class:u([e.ui.wrapper,e.ui.background,e.ui.rounded,e.ui.shadow]),onMouseover:a[0]||(a[0]=(...t)=>e.onMouseover&&e.onMouseover(...t)),onMouseleave:a[1]||(a[1]=(...t)=>e.onMouseleave&&e.onMouseleave(...t))},[p("div",{class:u([e.ui.container,e.ui.rounded,e.ui.ring])},[p("div",{class:u(e.ui.padding)},[p("div",{class:u(["flex gap-3",{"items-start":e.description||e.$slots.description,"items-center":!e.description&&!e.$slots.description}])},[e.icon?(i(),f(m,{key:0,name:e.icon,class:u(e.iconClass)},null,8,["name","class"])):d("",!0),e.avatar?(i(),f(s,C({key:1},{size:e.ui.avatar.size,...e.avatar},{class:e.ui.avatar.base}),null,16,["class"])):d("",!0),p("div",X,[p("p",{class:u(e.ui.title)},[M(e.$slots,"title",{title:e.title},()=>[S(h(e.title),1)])],2),e.description||e.$slots.description?(i(),v("p",{key:0,class:u(e.ui.description)},[M(e.$slots,"description",{description:e.description},()=>[S(h(e.description),1)])],2)):d("",!0),(e.description||e.$slots.description)&&e.actions.length?(i(),v("div",Y,[(i(!0),v(T,null,U(e.actions,(t,r)=>(i(),f(l,C({key:r},{...e.ui.default.actionButton,...t},{onClick:w(c=>e.onAction(t),["stop"])}),null,16,["onClick"]))),128))])):d("",!0)]),p("div",Z,[!e.description&&!e.$slots.description&&e.actions.length?(i(),v("div",_,[(i(!0),v(T,null,U(e.actions,(t,r)=>(i(),f(l,C({key:r},{...e.ui.default.actionButton,...t},{onClick:w(c=>e.onAction(t),["stop"])}),null,16,["onClick"]))),128))])):d("",!0),e.closeButton?(i(),f(l,C({key:1},{...e.ui.default.closeButton,...e.closeButton},{onClick:w(e.onClose,["stop"])}),null,16,["onClick"])):d("",!0)])],2)],2),e.timeout?(i(),v("div",{key:0,class:u(e.progressClass),style:H(e.progressStyle)},null,6)):d("",!0)],2)],34)]),_:3},16)}const pe=K(W,[["render",x]]);export{pe as default};
