import{$ as e,A as t,C as n,E as r,M as i,Qt as a,R as o,S as s,St as c,T as l,Ut as u,X as d,_ as f,cn as p,dt as m,ft as h,h as g,in as _,kt as v,nn as y,nt as b,p as x,q as S,r as C,s as w,w as T,zt as E}from"./_plugin-vue_export-helper-C0lsYS1a.js";import{C as D,J as O,M as k,V as A,Z as j,b as M,c as N,tt as P,y as F}from"./style-Bvb0L3Ww.js";import{H as I,It as L,cn as R,dn as z,xn as B,xt as V,yt as H,z as U}from"./GxPagination-DaT0MOF0.js";var W=[`primary`,`success`,`info`,`warning`,`error`],G=F({customClass:{type:String,default:``},dangerouslyUseHTMLString:Boolean,duration:{type:Number,default:4500},icon:{type:V},id:{type:String,default:``},message:{type:M([String,Object,Function]),default:``},offset:{type:Number,default:0},onClick:{type:M(Function),default:()=>void 0},onClose:{type:M(Function),required:!0},position:{type:String,values:[`top-right`,`top-left`,`bottom-right`,`bottom-left`],default:`top-right`},showClose:{type:Boolean,default:!0},title:{type:String,default:``},type:{type:String,values:[...W,``],default:``},zIndex:Number,closeIcon:{type:V,default:L}}),K={destroy:()=>!0},q=B(i({...i({name:`ElNotification`}),props:G,emits:K,setup(t,{expose:i}){let a=t,{ns:o,zIndex:u}=N(`notification`),{nextZIndex:w,currentZIndex:E}=u,D=c(!1),A,j=s(()=>{let e=a.type;return e&&H[a.type]?o.m(e):``}),M=s(()=>a.type&&H[a.type]||a.icon),P=s(()=>a.position.endsWith(`right`)?`right`:`left`),F=s(()=>a.position.startsWith(`top`)?`top`:`bottom`),L=s(()=>({[F.value]:`${a.offset}px`,zIndex:a.zIndex??E.value}));function z(){a.duration>0&&({stop:A}=O(()=>{D.value&&V()},a.duration))}function B(){A?.()}function V(){D.value=!1}function W(e){switch(U(e)){case I.delete:case I.backspace:B();break;case I.esc:D.value&&V();break;default:z();break}}return S(()=>{z(),w(),D.value=!0}),k(document,`keydown`,W),i({visible:D,close:V}),(t,i)=>(d(),T(C,{name:v(o).b(`fade`),onBeforeLeave:t.onClose,onAfterLeave:e=>t.$emit(`destroy`),persisted:``},{default:m(()=>[h(n(`div`,{id:t.id,class:y([v(o).b(),t.customClass,v(P)]),style:_(v(L)),role:`alert`,onMouseenter:B,onMouseleave:z,onClick:t.onClick},[v(M)?(d(),T(v(R),{key:0,class:y([v(o).e(`icon`),v(j)])},{default:m(()=>[(d(),T(b(v(M))))]),_:1},8,[`class`])):l(`v-if`,!0),n(`div`,{class:y(v(o).e(`group`))},[n(`h2`,{class:y(v(o).e(`title`)),textContent:p(t.title)},null,10,[`textContent`]),h(n(`div`,{class:y(v(o).e(`content`)),style:_(t.title?void 0:{margin:0})},[e(t.$slots,`default`,{},()=>[t.dangerouslyUseHTMLString?(d(),r(f,{key:1},[l(` Caution here, message could've been compromised, never use user's input as message `),n(`p`,{innerHTML:t.message},null,8,[`innerHTML`])],2112)):(d(),r(`p`,{key:0},p(t.message),1))])],6),[[x,t.message]]),t.showClose?(d(),T(v(R),{key:0,class:y(v(o).e(`closeBtn`)),onClick:g(V,[`stop`])},{default:m(()=>[(d(),T(b(t.closeIcon)))]),_:1},8,[`class`,`onClick`])):l(`v-if`,!0)],2)],46,[`id`,`onClick`]),[[x,D.value]])]),_:3},8,[`name`,`onBeforeLeave`,`onAfterLeave`]))}}),[[`__file`,`notification.vue`]]);E();var J={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[]},Y=16,X=1,Z=function(e={},n){if(!A)return{close:()=>void 0};(a(e)||o(e))&&(e={message:e});let r=e.position||`top-right`,i=e.offset||0;J[r].forEach(({vm:e})=>{i+=(e.el?.offsetHeight||0)+Y}),i+=Y;let s=`notification_${X++}`,c=e.onClose,l={...e,offset:i,id:s,onClose:()=>{Q(s,r,c)}},d=document.body;j(e.appendTo)?d=e.appendTo:a(e.appendTo)&&(d=document.querySelector(e.appendTo)),j(d)||(D(`ElNotification`,`the appendTo option is not an HTMLElement. Falling back to document.body.`),d=document.body);let f=document.createElement(`div`),p=t(q,l,u(l.message)?l.message:o(l.message)?()=>l.message:null);return p.appContext=P(n)?Z._context:n,p.props.onDestroy=()=>{w(null,f)},w(p,f),J[r].push({vm:p}),d.appendChild(f.firstElementChild),{close:()=>{p.component.exposed.visible.value=!1}}};W.forEach(e=>{Z[e]=(t={},n)=>((a(t)||o(t))&&(t={message:t}),Z({...t,type:e},n))});function Q(e,t,n){let r=J[t],i=r.findIndex(({vm:t})=>t.component?.props.id===e);if(i===-1)return;let{vm:a}=r[i];if(!a)return;n?.(a);let o=a.el.offsetHeight,s=t.split(`-`)[0];r.splice(i,1);let c=r.length;if(!(c<1))for(let e=i;e<c;e++){let{el:t,component:n}=r[e].vm,i=Number.parseInt(t.style[s],10)-o-Y;n.props.offset=i}}function $(){for(let e of Object.values(J))e.forEach(({vm:e})=>{e.component.exposed.visible.value=!1})}function ee(e=`top-right`){let t=J[e][0]?.vm.component?.props?.offset||0;for(let{vm:n}of J[e])n.component.props.offset=t,t+=(n.el?.offsetHeight||0)+Y}Z.closeAll=$,Z.updateOffsets=ee,Z._context=null;var te=z(Z,`$notify`);export{te as t};