UNPKG

vue-toastify

Version:

<p align="center">Simple and dependency-free notification plugin.</p>

38 lines (37 loc) 22.4 kB
"use strict";/*! ================================ vue-toastify v2.1.0 (c) 2019-present Nandor Kraszlan Released under MIT License ================================== */Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("./useVtEvents.cjs"),t=require("vue"),y=require("./useToast-CKNF-cZZ.cjs"),V=require("./useVtSettings.cjs"),z=t.defineComponent({name:"ProgressBar",props:{isPaused:{type:Boolean},duration:{type:Number,default:0},id:{type:String,required:!0}},emits:["vtFinished"],expose:["progress"],setup:(e,o)=>{const a=t.ref(0),s=t.ref(),l=t.ref(),r=t.ref(new Date),d=t.ref(new Date),i=t.ref(new Date(e.duration+Date.now())),c=N.default(),v=()=>{r.value=new Date(r.value.getTime()+(Date.now()-d.value.getTime())),i.value=new Date(i.value.getTime()+(Date.now()-d.value.getTime())),!l.value&&a.value>0&&c.emit("vtResumed",{id:e.id}),l.value=window.setTimeout(()=>{a.value=100,o.emit("vtFinished")},i.value.getTime()-Date.now()),s.value=requestAnimationFrame(h)},g=()=>{window.clearTimeout(l.value),l.value=void 0,cancelAnimationFrame(s.value),s.value=void 0,c.emit("vtPaused",{id:e.id}),d.value=new Date},h=()=>{if(a.value<100){const p=i.value.getTime()-r.value.getTime(),w=Date.now()-r.value.getTime();a.value=w/p*100,l.value&&(s.value=requestAnimationFrame(h))}else cancelAnimationFrame(s.value),s.value=void 0};return t.watch(()=>e.isPaused,p=>p?g():v()),t.onMounted(()=>{c.emit("vtStarted",{id:e.id}),v()}),t.onBeforeUnmount(()=>{a.value=0,window.clearTimeout(l.value),s.value&&(cancelAnimationFrame(s.value),s.value=void 0)}),{progress:a}}}),I=(e,o)=>{const a=e.__vccOpts||e;for(const[s,l]of o)a[s]=l;return a},q=["aria-valuenow"];function X(e,o,a,s,l,r){return t.openBlock(),t.createElementBlock("div",{class:"vt-progress-bar","aria-valuenow":e.progress,"aria-valuemin":"0","aria-valuemax":"100",role:"progressbar"},[t.createElementVNode("div",{class:"vt-progress",style:t.normalizeStyle({width:e.progress+"%"})},null,4)],8,q)}const U=I(z,[["render",X]]);function P(e){return e.node}const Y=t.defineComponent({name:"VtIcon",components:{Node:P},props:{mode:{type:String},type:{type:String},icon:{type:[Object,String]},baseIconClass:{type:String,default:""},enableHtml:{type:Boolean,required:!0}},setup:e=>{const o=t.computed(()=>{if(!e.icon)return!1;let s={type:"icon",tag:"i",ligature:"",class:e.baseIconClass};return typeof e.icon=="string"?e.enableHtml&&e.icon.toLowerCase().includes("<svg")?(s.tag="div",s.ligature=e.icon):s.class=s.class+" "+e.icon:t.isVNode(e.icon)?s={type:"node",node:e.icon}:y.isObject(e.icon)&&(s=Object.assign(s,e.icon)),s}),a=t.computed(()=>{const s={};return e.mode!=="loader"&&(s["vt-circle"]=!e.icon),s["vt-prompt"]=e.mode==="prompt",(e.mode===void 0||e.mode.length===0)&&(s["vt-"+(e.type?e.type:"info")]=!0),s});return{userIcon:o,containerClasses:a}}}),J={key:1,class:"vt-icon"},W={key:1,class:"vt-spinner"},G={key:2,class:"vt-icon"},K={"aria-hidden":"true",style:{width:"24px",height:"24px"},viewBox:"0 0 24 24"},Q={key:3,class:"vt-icon"},Z={key:4,class:"vt-icon"},_={key:5,class:"vt-icon"},x={key:6,class:"vt-icon"},ee={xmlns:"http://www.w3.org/2000/svg",style:{transform:"rotate(180deg)"},width:"36","aria-hidden":"true",height:"36",viewBox:"0 0 24 24"};function te(e,o,a,s,l,r){const d=t.resolveComponent("Node");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vt-icon-container",e.containerClasses])},[e.userIcon?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.userIcon.type==="icon"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.userIcon.tag),{key:0,class:t.normalizeClass(["vt-icon",e.userIcon.class]),innerHTML:e.userIcon.ligature},null,8,["class","innerHTML"])):(t.openBlock(),t.createElementBlock("div",J,[t.createVNode(d,{node:e.userIcon.node},null,8,["node"])]))],64)):e.mode==="loader"?(t.openBlock(),t.createElementBlock("div",W)):e.mode==="prompt"?(t.openBlock(),t.createElementBlock("div",G,[(t.openBlock(),t.createElementBlock("svg",K,o[0]||(o[0]=[t.createElementVNode("path",{d:`M10,19H13V22H10V19M12,2C17.35,2.22 19.68,7.62 16.5,11.67C15.67,12.67 14.33,13.33 13.67,14.17C13,15 13,16 13,17H10C10,15.33 10,13.92 10.67,12.92C11.33,11.92 12.67,11.33 13.5,10.67C15.92,8.43 15.32,5.26 12,5A3,3 0 0,0 9,8H6A6,6 0 0,1 12,2Z`},null,-1)])))])):e.containerClasses["vt-success"]?(t.openBlock(),t.createElementBlock("div",Q,o[1]||(o[1]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36","aria-hidden":"true",viewBox:"0 0 24 24"},[t.createElementVNode("path",{d:`M9 16.2l-3.5-3.5c-.39-.39-1.01-.39-1.4 0-.39.39-.39 1.01 0 1.4l4.19 4.19c.39.39 1.02.39 1.41 0L20.3 7.7c.39-.39.39-1.01 0-1.4-.39-.39-1.01-.39-1.4 0L9 16.2z`})],-1)]))):e.containerClasses["vt-error"]?(t.openBlock(),t.createElementBlock("div",Z,o[2]||(o[2]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36","aria-hidden":"true",viewBox:"0 0 24 24"},[t.createElementVNode("path",{d:`M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z`})],-1)]))):e.containerClasses["vt-warning"]?(t.openBlock(),t.createElementBlock("div",_,o[3]||(o[3]=[t.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"36",height:"36","aria-hidden":"true",viewBox:"0 0 24 24"},[t.createElementVNode("circle",{cx:"12",cy:"19",r:"2"}),t.createElementVNode("path",{d:"M12 3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2s2-.9 2-2V5c0-1.1-.9-2-2-2z"})],-1)]))):e.containerClasses["vt-info"]?(t.openBlock(),t.createElementBlock("div",x,[(t.openBlock(),t.createElementBlock("svg",ee,o[4]||(o[4]=[t.createElementVNode("path",{d:"M12 3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2s2-.9 2-2V5c0-1.1-.9-2-2-2z"},null,-1),t.createElementVNode("circle",{cx:"12",cy:"19",r:"2"},null,-1)])))])):t.createCommentVNode("",!0)],2)}const ne=I(Y,[["render",te]]);function M(e){return"targetTouches"in e&&e.targetTouches.length>0?e.targetTouches[0].clientX:e.clientX}function O(e){return"targetTouches"in e&&e.targetTouches.length>0?e.targetTouches[0].clientY:e.clientY}function oe(e,o){const a=t.getCurrentInstance(),s=t.ref(),l=t.ref(),r=t.ref(!1),d=t.ref(),i=N.default(),c=t.computed(()=>{var f;return(f=a.proxy)==null?void 0:f.$el}),v=t.computed(()=>{var f;return!!l.value&&((f=s.value)==null?void 0:f.x)!==l.value.x}),g=t.computed(()=>r.value?l.value.x-s.value.x:0),h=t.computed(()=>d.value?d.value.width*e.status.dragThreshold:15),p=t.computed(()=>{if(!r.value||l.value!==void 0&&s.value!==void 0&&s.value.x===l.value.x||!v.value)return{};let f=1-Math.abs(g.value/h.value);return f=isNaN(f)?1:f,{transform:`translateX(${g.value}px)`,opacity:String(f),userSelect:"none"}}),w=f=>{c.value.classList.add("vt-will-change"),r.value=!0,s.value={x:M(f),y:O(f)},d.value=c.value.getBoundingClientRect()},k=f=>{f.preventDefault(),r.value&&(l.value={x:M(f),y:O(f)},v.value?i.emit("vtBeingDragged",{id:e.status.id,position:l.value}):i.emit("vtDragStarted",{id:e.status.id,position:s.value}))},T=()=>{v.value&&(i.emit("vtDragFinished",{id:e.status.id,position:l.value}),c.value.getBoundingClientRect().right>window.innerWidth&&c.value.getBoundingClientRect().right-window.innerWidth>d.value.width*.75,c.value.getBoundingClientRect().right<d.value.width*.25,Math.abs(d.value.left-c.value.getBoundingClientRect().left)>h.value&&o(),r.value=!1,setTimeout(()=>{l.value=void 0,s.value=void 0,d.value=void 0,c.value.classList.remove("vt-will-change")}))};return e.status.draggable&&(t.onMounted(()=>{c.value.addEventListener("touchstart",w),c.value.addEventListener("mousedown",w),addEventListener("touchmove",k),addEventListener("mousemove",k),addEventListener("touchend",T),addEventListener("mouseup",T)}),t.onBeforeUnmount(()=>{c.value.removeEventListener("touchstart",w),c.value.removeEventListener("mousedown",w),removeEventListener("touchmove",k),removeEventListener("mousemove",k),removeEventListener("touchend",T),removeEventListener("mouseup",T)})),{hasMoved:v,draggableStyles:p,isDragged:r}}const se=t.defineComponent({name:"VtToast",components:{ProgressBar:U,VtIcon:ne,Node:P},props:{status:{type:Object,required:!0},baseIconClass:{type:String,default:""},delayed:{type:Boolean,default:!1}},emits:["vtRemove"],setup:(e,o)=>{const a=t.ref(!1),s=t.ref(!0),l=N.default(),r=t.ref(),d=t.computed(()=>{const E={};return e.status.mode==="loader"&&(E["vt-cursor-wait"]=!0),E["vt-theme-"+e.status.theme]=!0,E}),i=t.computed(()=>["prompt","loader"].indexOf(e.status.mode)===-1),c=t.computed(()=>t.isVNode(e.status.body)),v=t.computed(()=>e.status.answers?Object.keys(e.status.answers):[]),g=()=>{i.value&&!k.value&&(l.emit("vtDismissed",{id:e.status.id}),o.emit("vtRemove"))},h=()=>{i.value&&k.value&&(l.emit("vtDismissed",{id:e.status.id}),o.emit("vtRemove"))},p=E=>{l.emit("vtPromptResponse",{id:e.status.id,response:E}),o.emit("vtRemove")},w=()=>{var n;Math.ceil(((n=r.value)==null?void 0:n.progress)??NaN)>=100&&i.value&&(l.emit("vtFinished",{id:e.status.id}),o.emit("vtRemove"))},{hasMoved:k,draggableStyles:T,isDragged:f}=oe(e,h),$=()=>s.value=!1,S=()=>s.value=!0;return t.onMounted(()=>{e.status.pauseOnFocusLoss&&(addEventListener("blur",$),addEventListener("focus",S))}),t.onUnmounted(()=>{e.status.pauseOnFocusLoss&&(removeEventListener("blur",$),removeEventListener("focus",S))}),{isHovered:a,notificationClass:d,isNotification:i,isJSXBody:c,respond:p,dismiss:g,draggableStyles:T,progressBar:r,answers:v,finish:w,isDragged:f,hasFocus:s}}}),re=["role","aria-label","data-delayed"],ae={class:"vt-content"},ie=["textContent"],le={key:0,class:"vt-paragraph"},ue=["innerHTML"],ce={key:2,class:"vt-paragraph"},de={key:2,class:"vt-buttons"},ve=["onClick","textContent"];function me(e,o,a,s,l,r){const d=t.resolveComponent("ProgressBar"),i=t.resolveComponent("Node"),c=t.resolveComponent("VtIcon");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vt-notification",e.notificationClass]),role:e.status.type==="error"||e.status.type==="warning"?"alert":"status",style:t.normalizeStyle(e.draggableStyles),draggable:"false","aria-label":e.status.title||`${e.status.type||"info"} notification`,"data-delayed":e.delayed,onClick:o[0]||(o[0]=(...v)=>e.dismiss&&e.dismiss(...v)),onMouseenter:o[1]||(o[1]=v=>e.isHovered=!0),onMouseleave:o[2]||(o[2]=v=>e.isHovered=!1),onTouchstart:o[3]||(o[3]=v=>e.isHovered=!0),onTouchend:o[4]||(o[4]=v=>e.isHovered=!1)},[e.isNotification&&e.status.canTimeout?t.withDirectives((t.openBlock(),t.createBlock(d,{key:0,id:e.status.id,ref:"progressBar",duration:e.status.duration,"is-paused":e.status.pauseOnHover&&e.isHovered||!e.hasFocus||e.isDragged,onVtFinished:e.finish},null,8,["id","duration","is-paused","onVtFinished"])),[[t.vShow,!e.status.hideProgressbar]]):t.createCommentVNode("",!0),t.createElementVNode("div",ae,[e.status.title?(t.openBlock(),t.createElementBlock("h2",{key:0,class:"vt-title",textContent:t.toDisplayString(e.status.title)},null,8,ie)):t.createCommentVNode("",!0),e.status.body?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.isJSXBody?(t.openBlock(),t.createElementBlock("div",le,[t.createVNode(i,{node:e.status.body},null,8,["node"])])):e.status.enableHtmlInterpretation?(t.openBlock(),t.createElementBlock("p",{key:1,class:"vt-paragraph",innerHTML:e.status.body},null,8,ue)):(t.openBlock(),t.createElementBlock("p",ce,t.toDisplayString(e.status.body),1))],64)):t.createCommentVNode("",!0)]),e.status.iconEnabled?(t.openBlock(),t.createBlock(c,{key:1,mode:e.status.mode,type:e.status.type,icon:e.status.icon,"base-icon-class":e.baseIconClass,"enable-html":e.status.enableHtmlInterpretation},null,8,["mode","type","icon","base-icon-class","enable-html"])):t.createCommentVNode("",!0),e.status.mode==="prompt"?(t.openBlock(),t.createElementBlock("div",de,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.answers,(v,g)=>(t.openBlock(),t.createElementBlock("button",{key:g,onClick:h=>e.respond(e.status.answers[v]),textContent:t.toDisplayString(v)},null,8,ve))),128))])):t.createCommentVNode("",!0)],46,re)}const pe=I(se,[["render",me]]),fe=t.defineComponent({name:"VtTransition",props:{transition:{type:[String,Object],required:!0},position:{type:String,required:!0}},setup:e=>{const{settings:o}=V.default(),a=t.getCurrentInstance();return{beforeEnter:i=>{if(!(i instanceof HTMLElement))return;const c=a==null?void 0:a.vnode.el;for(let v=0;v<c.children.length;v++)delete c.children.item(v).dataset.delayed;i.dataset.delayed&&i.classList.add("vt-move","vt-will-change")},afterEnter:i=>{i instanceof HTMLElement&&(i.removeAttribute("data-delayed"),i.classList.remove("vt-move","vt-will-change"))},beforeLeave:i=>{if(i instanceof HTMLElement){i.classList.add("vt-will-change");for(let c=0;c<i.parentNode.childNodes.length;c++)i.parentNode.childNodes[c].isSameNode(i)||(i.parentElement.children[c].dataset.delayed="true")}},leave:i=>{if(o.singular||o.oneType&&i.parentNode.childNodes.length===1||!(i instanceof HTMLElement))return;const c=e.position.split("-"),{height:v,width:g,marginBottom:h}=window.getComputedStyle(i),p=parseFloat(g)+.01;i.style.left=String(i.offsetLeft-(i.parentNode.childNodes.length===1?p/2:0))+"px",i.style.top=String(i.offsetTop)+"px",c[0]==="center"&&(i.style.top=String(parseInt(i.style.top)-parseInt(v)/2-parseInt(h)/2)+"px"),c[0]==="bottom"&&(i.style.top=String(parseInt(i.style.top)-parseInt(v)-parseInt(h))+"px"),i.style.width=`${p}px`,i.style.position="absolute"}}}});function ge(e,o,a,s,l,r){var d,i;return t.openBlock(),t.createBlock(t.TransitionGroup,{name:typeof e.transition!="string"?(d=e.transition)==null?void 0:d.name:e.transition,css:!0,tag:"div","move-class":(typeof e.transition!="string"?(i=e.transition)==null?void 0:i.moveClass:null)??"vt-move",onLeave:e.leave,onBeforeEnter:e.beforeEnter,onAfterEnter:e.afterEnter,onBeforeLeave:e.beforeLeave},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},8,["name","move-class","onLeave","onBeforeEnter","onAfterEnter","onBeforeLeave"])}const he=I(fe,[["render",ge]]),ye={name:"VueToastify"},be=t.defineComponent({...ye,setup(e,{expose:o}){const a={},s=t.ref([]),l=t.ref([]),{settings:r,updateSettings:d}=V.default(),i=N.default(),c=t.computed(()=>{if(r.transition)return r.transition;const n=r.position.split("-");return n[1]==="left"?"vt-left":n[1]==="center"?"vt-"+n[0]:"vt-right"}),v=t.computed(()=>({flexDirection:r.orderLatest&&r.position.split("-")[0]==="bottom"?"column":"column-reverse"})),g=t.computed(()=>{const n=r.position.split("-"),u={};return n[0]===n[1]?(u["vt-center-center"]=!0,u):(u[n[0]==="center"?"vt-centerY":"vt-"+n[0]]=!0,u[n[1]==="center"?"vt-centerX":"vt-"+n[1]]=!0,u)}),h=n=>s.value.findIndex(u=>u.id===n),p=n=>l.value.findIndex(u=>u.id===n),w=n=>n.title?n.title:n.mode==="prompt"||n.mode==="loader"?"":(y.isBoolean(n.defaultTitle)&&n.defaultTitle||y.isBoolean(r.defaultTitle)&&r.defaultTitle)&&n.type?n.type.charAt(0).toUpperCase()+n.type.slice(1):"",k=n=>!!s.value.find(u=>u.mode&&u.mode===n.mode||u.type&&u.type===n.type),T=n=>{const u=[];return typeof n=="string"?u.push(n):Array.isArray(n)?u.push(...n):u.push(...s.value.filter(m=>m.mode==="loader").map(m=>m.id)),u.forEach(m=>{i.emit("vtLoadStop",{id:m}),E(m)}),u.length},f=n=>{const u=Object.assign({},n,{id:y.uuidV4()});return u.duration=r.warningInfoDuration,Number(n.duration)>0?u.duration=Number(n.duration):n.type&&(u.duration=n.type==="error"?r.errorDuration:n.type==="success"?r.successDuration:r.warningInfoDuration),u.answers=n.answers&&Object.keys(n.answers).length>0?n.answers:{Yes:!0,No:!1},u.pauseOnHover=y.isBoolean(n.pauseOnHover)?n.pauseOnHover:r.pauseOnHover,u.pauseOnFocusLoss=y.isBoolean(n.pauseOnFocusLoss)?n.pauseOnFocusLoss:r.pauseOnFocusLoss,u.hideProgressbar=y.isBoolean(n.hideProgressbar)?n.hideProgressbar:r.hideProgressbar,u.title=w(n),u.canTimeout=y.isBoolean(n.canTimeout)?n.canTimeout:r.canTimeout,u.iconEnabled=y.isBoolean(n.iconEnabled)?n.iconEnabled:r.iconEnabled,u.enableHtmlInterpretation=y.isBoolean(n.enableHtmlInterpretation)?n.enableHtmlInterpretation:r.enableHtmlInterpretation,n.mode==="prompt"||n.mode==="loader"?u.draggable=!1:u.draggable=y.isBoolean(n.draggable)?n.draggable:r.draggable,u.dragThreshold=n.dragThreshold&&y.isBetween(n.dragThreshold,0,5)?n.dragThreshold:r.dragThreshold,(n.mode==="prompt"||n.mode==="loader")&&(u.canTimeout=!1),u.theme=n.theme?n.theme:r.theme,r.singular&&s.value.length>0||r.oneType&&k(u)||s.value.length>=r.maxToasts?(u.delay?setTimeout(()=>{l.value.push({...u,delayed:!0})},u.delay):l.value.push({...u,delayed:!0}),u.id):(u.delay?setTimeout(()=>{s.value.push(u)},u.delay):s.value.push(u),u.id)},$=n=>n?s.value.find(u=>u.id===n)??l.value.find(u=>u.id===n):[...s.value,...l.value],S=(n,u)=>{const m=$(n);return m?h(n)!==-1?(s.value=s.value.map(C=>C.id===n?Object.assign(C,u):C),!0):(s.value[p(n)]=Object.assign(m,u),!0):!1},E=n=>{var m,C,D,H;if(n){let b=p(n);return r.singular&&b!==-1?((C=(m=l.value.splice(b,1)[0]).callback)==null||C.call(m),1):(b=h(n),b!==-1?((H=(D=s.value.splice(b,1)[0]).callback)==null||H.call(D),1):0)}const u=s.value.length+l.value.length;return s.value.forEach(b=>{var L;return(L=b.callback)==null?void 0:L.call(b)}),l.value.forEach(b=>{var L;return(L=b.callback)==null?void 0:L.call(b)}),s.value=[],l.value=[],u};return t.watch(()=>r,(n,u)=>{if(!n.singular){for(let m=0;m<n.maxToasts-1;m++)l.value[m]&&(k(l.value[m])||s.value.push(l.value.splice(m,1)[0]));y.isBoolean(a.orderLatest)&&(d({orderLatest:a.orderLatest}),delete a.orderLatest);return}a.orderLatest=u.orderLatest,d({orderLatest:!1})}),t.watch(()=>s.value,async n=>{if(l.value.length!==0){if(await t.nextTick(),r.singular){n.length===0&&s.value.push({...l.value.shift(),delayed:!0});return}if(r.oneType)return l.value.forEach((u,m)=>{!k(u)&&s.value.length<r.maxToasts&&s.value.push({...l.value.splice(m,1)[0],delayed:!0})});s.value.length<r.maxToasts&&s.value.push({...l.value.shift(),delayed:!0})}},{deep:!0}),o({add:f,get:$,set:S,remove:E,stopLoader:T}),(n,u)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass(["vt-backdrop-hidden",{"vt-backdrop-visible":s.value.length>0&&t.unref(r).withBackdrop}]),style:t.normalizeStyle({backgroundColor:t.unref(r).backdrop})},null,6),t.createVNode(he,{class:t.normalizeClass(["vt-notification-container",g.value]),style:t.normalizeStyle(v.value),transition:c.value,position:t.unref(r).position},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,m=>(t.openBlock(),t.createBlock(pe,{key:m.id,status:m,delayed:!!m.delayed||!1,"base-icon-class":t.unref(r).baseIconClass,onVtRemove:C=>E(m.id)},null,8,["status","delayed","base-icon-class","onVtRemove"]))),128))]),_:1},8,["class","style","transition","position"])]))}}),Be=Symbol("vue-toastify"),ke=(e,o={})=>{V.default().updateSettings(o);const a=document.createElement("div");a.setAttribute("id",Be.toString()),document.body.appendChild(a),y.app.container=t.createApp(be).mount(a),o.customNotifications&&Object.entries(o.customNotifications).length>0&&Object.entries(o.customNotifications).forEach(s=>{Object.defineProperty(y.toastMethods,s[0],{get(){return(l,r)=>{let d=Object.assign({},s[1]);return y.isBody(l)?d.body=l:d={...s[1],...l},r&&(d.title=r),d.type||(d.type="success"),y.app.container.add(d)}}})})};function j(e){e=e.replace(/^#/,"");const o=parseInt(e.slice(0,2),16)/255,a=parseInt(e.slice(2,4),16)/255,s=parseInt(e.slice(4,6),16)/255,l=Math.max(o,a,s),r=Math.min(o,a,s);let d=0,i=0;const c=(l+r)/2;if(l!==r){const v=l-r;switch(i=c>.5?v/(2-l-r):v/(l+r),l){case o:d=(a-s)/v+(a<s?6:0);break;case a:d=(s-o)/v+2;break;case s:d=(o-a)/v+4;break}d/=6}return{h:d,s:i,l:c}}function A(e,o,a){let s,l,r;if(o===0)s=l=r=a;else{const i=(g,h,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?g+(h-g)*6*p:p<.5?h:p<.6666666666666666?g+(h-g)*(.6666666666666666-p)*6:g),c=a<.5?a*(1+o):a+o-a*o,v=2*a-c;s=i(v,c,e+1/3),l=i(v,c,e),r=i(v,c,e-1/3)}const d=i=>{const c=Math.round(i*255).toString(16);return c.length===1?"0"+c:c};return`#${d(s)}${d(l)}${d(r)}`}function we(e,o){const a=j(e);return a.l=Math.max(0,a.l-o/100),A(a.h,a.s,a.l)}function Ee(e,o){const a=j(e);return a.l=Math.min(1,a.l+o/100),A(a.h,a.s,a.l)}function Te(e){const o={red:parseInt(e.slice(1,3),16),green:parseInt(e.slice(3,5),16),blue:parseInt(e.slice(5,7),16)};for(const[r,d]of Object.entries(o)){let i=d/255;i<.03928?i/=12.92:i=((i+.055)/1.055)**2,o[r]=i}const a=o.red*.2126,s=o.green*.7152,l=o.blue*.0722;return a+s+l}function B(e,o){return Te(e)>.4?we(e,o):Ee(e,o)}function R(e,o){return[`.vt-theme-${e} { background-color: ${o}; }`,`.vt-theme-${e} > .vt-progress-bar { background-color: ${B(o,10)}; }`,`.vt-theme-${e} > .vt-progress-bar > .vt-progress { background-color: ${B(o,30)}; }`,`.vt-theme-${e} > .vt-content > .vt-title { color: ${B(o,75)}; }`,`.vt-theme-${e} > .vt-content > .vt-paragraph { color: ${B(o,75)}; }`,`.vt-theme-${e} > .vt-buttons > .button { background-color: ${B(o,10)}; color: ${B(o,75)}; border: 1px solid ${B(o,10)}; transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; }`,`.vt-theme-${e} > .vt-buttons > .button:hover { background-color: ${B(o,65)}; color: ${B(o,5)}; transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; }`,`.vt-theme-${e} > .vt-prompt { border-color: ${B(o,70)}; }`,`.vt-theme-${e} > .vt-prompt > .vt-icon > .svg { fill: ${B(o,70)}; }`,`.vt-theme-${e} > .vt-icon-container > .vt-spinner { border: 2px solid ${B(o,30)}; border-top: 2px solid ${B(o,90)}; }`]}const F=Symbol("vue-toastify-themes");function Ce(e,o){let a=document.getElementById(F.toString());a||(a=document.createElement("style"),a.id=F.toString(),document.head.appendChild(a)),R(e,o).forEach(s=>a.sheet.insertRule(s.replaceAll(" ","").replaceAll(` `," ")))}exports.useVtEvents=N.default;exports.useToast=y.useToast;exports.useVtSettings=V.default;exports.createVtTheme=Ce;exports.default=ke;exports.getCssRules=R;