import{d as v,b as l,s as g,x as w,o as d,c as x,a as _,A as u,u as c,j as y,t as b,C as I,_ as E,a3 as h,a4 as T}from"./_plugin-vue_export-helper-0830d71a.js";import k from"./icon-info-743677ba.js";import C from"./icon-success-c208a482.js";import B from"./tree-loading-d274abdc.js";const L={style:{"background-color":"#303030","white-space":"nowrap",display:"flex","align-items":"center",gap:"6px",color:"white","max-width":"300px","border-radius":"6px",padding:"12px",border:"solid 1px rgba(255, 255, 255, 0.09)"}},S={style:{"font-weight":"600","font-size":"14px",color:"white","min-width":"0px","text-overflow":"ellipsis",overflow:"hidden"}},z=v({__name:"Toast",props:{toastId:null,state:null,title:null,duration:null},setup(m){const e=m,o=l(),t=l(0),s=l(e.state),i=l(e.title),r=l(e.duration??2e3),n=a=>{s.value=a.detail.state,i.value=a.detail.title,r.value=a.detail.duration,t.value=a.detail.duration};return g(()=>{t.value=e.duration,setTimeout(()=>{o.value="translateX(-100%)"},200);const a=()=>{setTimeout(()=>{t.value-=200,t.value<0?(o.value="none",setTimeout(()=>{const p=document.getElementById(e.toastId);p&&document.body.removeChild(p)},1e3)):a()},200)};a(),window.addEventListener("bmp-plugin-toast-update-"+e.toastId,n)}),w(()=>{window.removeEventListener("bmp-plugin-toast-update-"+e.toastId,n)}),(a,p)=>(d(),x("div",{class:"bm-plugin-toast-container",style:I({transform:o.value})},[_("div",L,[s.value==="loading"?(d(),u(c(B),{key:0,style:{width:"18px",height:"18px"},class:"bm-plugin-toast-animate-spin"})):s.value==="info"?(d(),u(c(k),{key:1,style:{width:"18px",height:"18px"}})):s.value==="success"?(d(),u(c(C),{key:2,style:{width:"18px",height:"18px"}})):y("",!0),_("span",S,b(i.value),1)])],4))}});const A=E(z,[["__scopeId","data-v-4e56665c"]]),D=v({__name:"ToastContainer",setup(m){const e=o=>{var i;const t="bm_plugin_toast_"+(((i=o.detail)==null?void 0:i.toastId)??new Date().getTime());if(document.getElementById(t))window.dispatchEvent(new CustomEvent("bmp-plugin-toast-update-"+t,{detail:{...o.detail,toastId:t}}));else{const r=h(A,{...o.detail,toastId:t}),n=document.createElement("div");n.id=t.toString(),r.mount(n),document.body.appendChild(n)}};return g(()=>{window.addEventListener("bmp-plugin-toast-show",e)}),w(()=>{window.removeEventListener("bmp-plugin-toast-show",e)}),(o,t)=>null}}),f=h(D);f.use(T());f.mount("#bm-plugin-toast-app");
