js-toaster
Version:
Agnostic and responsive notifications javascript module
1 lines • 17.2 kB
JavaScript
var t=Object.defineProperty,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable,s=(o,n,e)=>n in o?t(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,i=(t,i)=>{for(var r in i||(i={}))n.call(i,r)&&s(t,r,i[r]);if(o)for(var r of o(i))e.call(i,r)&&s(t,r,i[r]);return t},r=(t,o,n)=>(s(t,"symbol"!=typeof o?o+"":o,n),n);function a(){}const c=t=>t;function l(t){return t()}function u(){return Object.create(null)}function f(t){t.forEach(l)}function p(t){return"function"==typeof t}function d(t,o){return t!=t?o==o:t!==o||t&&"object"==typeof t||"function"==typeof t}function m(t,...o){if(null==t)return a;const n=t.subscribe(...o);return n.unsubscribe?()=>n.unsubscribe():n}function h(t,o,n){t.$$.on_destroy.push(m(o,n))}const g="undefined"!=typeof window;let $=g?()=>window.performance.now():()=>Date.now(),b=g?t=>requestAnimationFrame(t):a;const y=new Set;function k(t){y.forEach((o=>{o.c(t)||(y.delete(o),o.f())})),0!==y.size&&b(k)}function w(t,o){t.appendChild(o)}function v(t){if(!t)return document;const o=t.getRootNode?t.getRootNode():t.ownerDocument;return o&&o.host?o:t.ownerDocument}function x(t){const o=_("style");return function(t,o){w(t.head||t,o)}(v(t),o),o.sheet}function R(t,o,n){t.insertBefore(o,n||null)}function L(t){t.parentNode.removeChild(t)}function _(t){return document.createElement(t)}function C(t){return document.createTextNode(t)}function T(){return C(" ")}function E(t,o,n,e){return t.addEventListener(o,n,e),()=>t.removeEventListener(o,n,e)}function j(t,o,n){null==n?t.removeAttribute(o):t.getAttribute(o)!==n&&t.setAttribute(o,n)}function M(t,o){o=""+o,t.wholeText!==o&&(t.data=o)}function P(t,o,n,e){null===n?t.style.removeProperty(o):t.style.setProperty(o,n,e?"important":"")}function O(t,o,n){t.classList[n?"add":"remove"](o)}function A(t,o,n=!1){const e=document.createEvent("CustomEvent");return e.initCustomEvent(t,n,!1,o),e}const S=new Map;let H,z=0;function D(t,o,n,e,s,i,r,a=0){const c=16.666/e;let l="{\n";for(let t=0;t<=1;t+=c){const e=o+(n-o)*i(t);l+=100*t+`%{${r(e,1-e)}}\n`}const u=l+`100% {${r(n,1-n)}}\n}`,f=`__svelte_${function(t){let o=5381,n=t.length;for(;n--;)o=(o<<5)-o^t.charCodeAt(n);return o>>>0}(u)}_${a}`,p=v(t),{stylesheet:d,rules:m}=S.get(p)||function(t,o){const n={stylesheet:x(o),rules:{}};return S.set(t,n),n}(p,t);m[f]||(m[f]=!0,d.insertRule(`@keyframes ${f} ${u}`,d.cssRules.length));const h=t.style.animation||"";return t.style.animation=`${h?`${h}, `:""}${f} ${e}ms linear ${s}ms 1 both`,z+=1,f}function N(t,o){const n=(t.style.animation||"").split(", "),e=n.filter(o?t=>t.indexOf(o)<0:t=>-1===t.indexOf("__svelte")),s=n.length-e.length;s&&(t.style.animation=e.join(", "),z-=s,z||b((()=>{z||(S.forEach((t=>{const{stylesheet:o}=t;let n=o.cssRules.length;for(;n--;)o.deleteRule(n);t.rules={}})),S.clear())})))}function q(t){H=t}function B(){if(!H)throw new Error("Function called outside component initialization");return H}function U(t){B().$$.on_destroy.push(t)}function F(t,o){const n=t.$$.callbacks[o.type];n&&n.slice().forEach((t=>t.call(this,o)))}const I=[],G=[],J=[],K=[],Q=Promise.resolve();let V=!1;function W(t){J.push(t)}const X=new Set;let Y,Z=0;function tt(){const t=H;do{for(;Z<I.length;){const t=I[Z];Z++,q(t),ot(t.$$)}for(q(null),I.length=0,Z=0;G.length;)G.pop()();for(let t=0;t<J.length;t+=1){const o=J[t];X.has(o)||(X.add(o),o())}J.length=0}while(I.length);for(;K.length;)K.pop()();V=!1,X.clear(),q(t)}function ot(t){if(null!==t.fragment){t.update(),f(t.before_update);const o=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,o),t.after_update.forEach(W)}}function nt(t,o,n){t.dispatchEvent(A(`${o?"intro":"outro"}${n}`))}const et=new Set;let st;function it(t,o){t&&t.i&&(et.delete(t),t.i(o))}function rt(t,o,n,e){if(t&&t.o){if(et.has(t))return;et.add(t),st.c.push((()=>{et.delete(t),e&&(n&&t.d(1),e())})),t.o(o)}}const at={duration:0};function ct(t,o,n,e){let s=o(t,n),i=e?0:1,r=null,l=null,u=null;function d(){u&&N(t,u)}function m(t,o){const n=t.b-i;return o*=Math.abs(n),{a:i,b:t.b,d:n,duration:o,start:t.start,end:t.start+o,group:t.group}}function h(o){const{delay:n=0,duration:e=300,easing:p=c,tick:h=a,css:g}=s||at,w={start:$()+n,b:o};o||(w.group=st,st.r+=1),r||l?l=w:(g&&(d(),u=D(t,i,o,e,n,p,g)),o&&h(0,1),r=m(w,e),W((()=>nt(t,o,"start"))),function(t){let o;0===y.size&&b(k),new Promise((n=>{y.add(o={c:t,f:n})}))}((o=>{if(l&&o>l.start&&(r=m(l,e),l=null,nt(t,r.b,"start"),g&&(d(),u=D(t,i,r.b,r.duration,0,p,s.css))),r)if(o>=r.end)h(i=r.b,1-i),nt(t,r.b,"end"),l||(r.b?d():--r.group.r||f(r.group.c)),r=null;else if(o>=r.start){const t=o-r.start;i=r.a+r.d*p(t/r.duration),h(i,1-i)}return!(!r&&!l)})))}return{run(t){p(s)?(Y||(Y=Promise.resolve(),Y.then((()=>{Y=null}))),Y).then((()=>{s=s(),h(t)})):h(t)},end(){d(),r=l=null}}}function lt(t,o){rt(t,1,1,(()=>{o.delete(t.key)}))}function ut(t){t&&t.c()}function ft(t,o,n,e){const{fragment:s,on_mount:i,on_destroy:r,after_update:a}=t.$$;s&&s.m(o,n),e||W((()=>{const o=i.map(l).filter(p);r?r.push(...o):f(o),t.$$.on_mount=[]})),a.forEach(W)}function pt(t,o){const n=t.$$;null!==n.fragment&&(f(n.on_destroy),n.fragment&&n.fragment.d(o),n.on_destroy=n.fragment=null,n.ctx=[])}function dt(t,o){-1===t.$$.dirty[0]&&(I.push(t),V||(V=!0,Q.then(tt)),t.$$.dirty.fill(0)),t.$$.dirty[o/31|0]|=1<<o%31}function mt(t,o,n,e,s,i,r,c=[-1]){const l=H;q(t);const p=t.$$={fragment:null,ctx:null,props:i,update:a,not_equal:s,bound:u(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(o.context||(l?l.$$.context:[])),callbacks:u(),dirty:c,skip_bound:!1,root:o.target||l.$$.root};r&&r(p.root);let d=!1;if(p.ctx=n?n(t,o.props||{},((o,n,...e)=>{const i=e.length?e[0]:n;return p.ctx&&s(p.ctx[o],p.ctx[o]=i)&&(!p.skip_bound&&p.bound[o]&&p.bound[o](i),d&&dt(t,o)),n})):[],p.update(),d=!0,f(p.before_update),p.fragment=!!e&&e(p.ctx),o.target){if(o.hydrate){const t=(m=o.target,Array.from(m.childNodes));p.fragment&&p.fragment.l(t),t.forEach(L)}else p.fragment&&p.fragment.c();o.intro&&it(t.$$.fragment),ft(t,o.target,o.anchor,o.customElement),tt()}var m;q(l)}class ht{$destroy(){pt(this,1),this.$destroy=a}$on(t,o){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(o),()=>{const t=n.indexOf(o);-1!==t&&n.splice(t,1)}}$set(t){var o;this.$$set&&(o=t,0!==Object.keys(o).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}var gt=(t=>(t.topLeft="topLeft",t.topRight="topRight",t.bottomRight="bottomRight",t.bottomLeft="bottomLeft",t))(gt||{}),$t=(t=>(t.top="top",t.bottom="bottom",t))($t||{}),bt=(t=>(t.info="info",t.success="success",t.warning="warning",t.danger="danger",t))(bt||{});const yt=[];function kt(t,o=a){let n;const e=new Set;function s(o){if(d(t,o)&&(t=o,n)){const o=!yt.length;for(const o of e)o[1](),yt.push(o,t);if(o){for(let t=0;t<yt.length;t+=2)yt[t][0](yt[t+1]);yt.length=0}}}return{set:s,update:function(o){s(o(t))},subscribe:function(i,r=a){const c=[i,r];return e.add(c),1===e.size&&(n=o(s)||a),i(t),()=>{e.delete(c),0===e.size&&(n(),n=null)}}}}function wt(t,o,n){const e=!Array.isArray(t),s=e?[t]:t,i=o.length<2;return r=t=>{let n=!1;const r=[];let c=0,l=a;const u=()=>{if(c)return;l();const n=o(e?r[0]:r,t);i?t(n):l=p(n)?n:a},d=s.map(((t,o)=>m(t,(t=>{r[o]=t,c&=~(1<<o),n&&u()}),(()=>{c|=1<<o}))));return n=!0,u(),function(){f(d),l()}},{subscribe:kt(n,r).subscribe};var r}let vt=kt([]),xt=wt(vt,(t=>t.filter((t=>t.position===gt.topLeft)))),Rt=wt(vt,(t=>t.filter((t=>t.position===gt.topRight)))),Lt=wt(vt,(t=>t.filter((t=>t.position===gt.bottomLeft)))),_t=wt(vt,(t=>t.filter((t=>t.position===gt.bottomRight))));const Ct=new class{constructor(){r(this,"toastConf"),r(this,"timeout",null)}set conf(t){this.toastConf={position:t.position||this.toastConf.position,type:t.type||this.toastConf.type,displayTime:t.displayTime>=0?t.displayTime:this.toastConf.displayTime,dark:void 0!==t.dark||null!==t.dark?t.dark:this.toastConf.dark}}toast(t){return(t=i(i({},this.toastConf),t)).timestamp=(new Date).getTime()+1e3*t.displayTime,t.id=parseInt(`${Math.round(1e3*Math.random())}${t.timestamp}`),vt.update((o=>[...o,t])),this.toastsUpdated(),t.id}closeToast(t){t&&(vt.update((o=>o.filter((o=>o.id!==t.id)))),this.toastsUpdated())}toastsUpdated(){let t=function(t){let o;return m(t,(t=>o=t))(),o}(vt);if(t&&t.length>0&&(this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null),t=t.filter((t=>t.displayTime>0)).sort(((t,o)=>t.timestamp-o.timestamp)),t.length>0)){const o=t[0];let n=o.timestamp-(new Date).getTime();n<0&&(n=0),this.timeout=window.setTimeout((()=>{vt.update((t=>t.filter((t=>t.id!==o.id)))),this.toastsUpdated()}),n)}}};function Tt(t){const o=t-1;return o*o*o+1}function Et(t,{delay:o=0,duration:n=400,easing:e=Tt,x:s=0,y:i=0,opacity:r=0}={}){const a=getComputedStyle(t),c=+a.opacity,l="none"===a.transform?"":a.transform,u=c*(1-r);return{delay:o,duration:n,easing:e,css:(t,o)=>`\n\t\t\ttransform: ${l} translate(${(1-t)*s}px, ${(1-t)*i}px);\n\t\t\topacity: ${c-u*o}`}}function jt(t){let o,n,e,s,i,r,a,c,l,u,p,d,m,h=(t[0].title||"")+"",g=t[0].message+"";return{c(){o=_("li"),n=_("div"),e=_("div"),s=C(h),i=T(),r=_("div"),a=T(),c=_("div"),l=C(g),j(e,"class","title svelte-l021am"),j(r,"class","close svelte-l021am"),j(n,"class","header svelte-l021am"),j(c,"class","message svelte-l021am"),j(o,"class","toast svelte-l021am"),O(o,"danger",t[0].type===bt.danger),O(o,"success",t[0].type===bt.success),O(o,"warning",t[0].type===bt.warning),O(o,"info",t[0].type===bt.info),O(o,"left",t[1]===gt.topLeft||t[1]===gt.bottomLeft),O(o,"right",t[1]===gt.topRight||t[1]===gt.bottomRight),O(o,"dark",t[0].dark),P(o,"cursor",t[0].link?"pointer":"default",!1)},m(u,f){var h;R(u,o,f),w(o,n),w(n,e),w(e,s),w(n,i),w(n,r),w(o,a),w(o,c),w(c,l),p=!0,d||(m=[E(r,"click",(h=t[2],function(t){return t.stopPropagation(),h.call(this,t)}),!0),E(o,"click",t[3])],d=!0)},p(n,[e]){t=n,(!p||1&e)&&h!==(h=(t[0].title||"")+"")&&M(s,h),(!p||1&e)&&g!==(g=t[0].message+"")&&M(l,g),1&e&&O(o,"danger",t[0].type===bt.danger),1&e&&O(o,"success",t[0].type===bt.success),1&e&&O(o,"warning",t[0].type===bt.warning),1&e&&O(o,"info",t[0].type===bt.info),2&e&&O(o,"left",t[1]===gt.topLeft||t[1]===gt.bottomLeft),2&e&&O(o,"right",t[1]===gt.topRight||t[1]===gt.bottomRight),1&e&&O(o,"dark",t[0].dark),1&e&&P(o,"cursor",t[0].link?"pointer":"default",!1)},i(n){p||(W((()=>{u||(u=ct(o,Et,{x:t[0].position===gt.topLeft||t[0].position===gt.bottomLeft?-500:500,duration:500},!0)),u.run(1)})),p=!0)},o(n){u||(u=ct(o,Et,{x:t[0].position===gt.topLeft||t[0].position===gt.bottomLeft?-500:500,duration:500},!1)),u.run(0),p=!1},d(t){t&&L(o),t&&u&&u.end(),d=!1,f(m)}}}function Mt(t,o,n){const e=function(){const t=B();return(o,n)=>{const e=t.$$.callbacks[o];if(e){const s=A(o,n);e.slice().forEach((o=>{o.call(t,s)}))}}}();let{toast:s}=o,{position:i=gt.topRight}=o;return U((()=>{e("toast-closed",s.id)})),t.$$set=t=>{"toast"in t&&n(0,s=t.toast),"position"in t&&n(1,i=t.position)},[s,i,function(){s&&Ct.closeToast(s)},function(){s.link&&("string"==typeof s.link?document.location.href=s.link:(e("toast-clicked",s.id),Ct.closeToast(s)))}]}class Pt extends ht{constructor(t){super(),mt(this,t,Mt,jt,d,{toast:0,position:1})}}function Ot(t,o,n){const e=t.slice();return e[6]=o[n],e}function At(t,o){let n,e,s;return e=new Pt({props:{toast:o[6],position:o[1]}}),e.$on("toast-clicked",o[4]),e.$on("toast-closed",o[3]),e.$on("toast-closed",o[5]),{key:t,first:null,c(){n=C(""),ut(e.$$.fragment),this.first=n},m(t,o){R(t,n,o),ft(e,t,o),s=!0},p(t,n){o=t;const s={};1&n&&(s.toast=o[6]),2&n&&(s.position=o[1]),e.$set(s)},i(t){s||(it(e.$$.fragment,t),s=!0)},o(t){rt(e.$$.fragment,t),s=!1},d(t){t&&L(n),pt(e,t)}}}function St(t){let o,n,e=[],s=new Map,i=t[0];const r=t=>t[6].id;for(let o=0;o<i.length;o+=1){let n=Ot(t,i,o),a=r(n);s.set(a,e[o]=At(a,n))}return{c(){o=_("ul");for(let t=0;t<e.length;t+=1)e[t].c();j(o,"class","toast-list svelte-1ajyjqe"),O(o,"hidden",t[2]),O(o,"top",t[1]===gt.topLeft||t[1]===gt.topRight),O(o,"bottom",t[1]===gt.bottomLeft||t[1]===gt.bottomRight),O(o,"left",t[1]===gt.bottomLeft||t[1]===gt.topLeft),O(o,"right",t[1]===gt.bottomRight||t[1]===gt.topRight)},m(t,s){R(t,o,s);for(let t=0;t<e.length;t+=1)e[t].m(o,null);n=!0},p(t,[n]){11&n&&(i=t[0],st={r:0,c:[],p:st},e=function(t,o,n,e,s,i,r,a,c,l,u,f){let p=t.length,d=i.length,m=p;const h={};for(;m--;)h[t[m].key]=m;const g=[],$=new Map,b=new Map;for(m=d;m--;){const t=f(s,i,m),a=n(t);let c=r.get(a);c?e&&c.p(t,o):(c=l(a,t),c.c()),$.set(a,g[m]=c),a in h&&b.set(a,Math.abs(m-h[a]))}const y=new Set,k=new Set;function w(t){it(t,1),t.m(a,u),r.set(t.key,t),u=t.first,d--}for(;p&&d;){const o=g[d-1],n=t[p-1],e=o.key,s=n.key;o===n?(u=o.first,p--,d--):$.has(s)?!r.has(e)||y.has(e)?w(o):k.has(s)?p--:b.get(e)>b.get(s)?(k.add(e),w(o)):(y.add(s),p--):(c(n,r),p--)}for(;p--;){const o=t[p];$.has(o.key)||c(o,r)}for(;d;)w(g[d-1]);return g}(e,n,r,1,t,i,s,o,lt,At,null,Ot),st.r||f(st.c),st=st.p),4&n&&O(o,"hidden",t[2]),2&n&&O(o,"top",t[1]===gt.topLeft||t[1]===gt.topRight),2&n&&O(o,"bottom",t[1]===gt.bottomLeft||t[1]===gt.bottomRight),2&n&&O(o,"left",t[1]===gt.bottomLeft||t[1]===gt.topLeft),2&n&&O(o,"right",t[1]===gt.bottomRight||t[1]===gt.topRight)},i(t){if(!n){for(let t=0;t<i.length;t+=1)it(e[t]);n=!0}},o(t){for(let t=0;t<e.length;t+=1)rt(e[t]);n=!1},d(t){t&&L(o);for(let t=0;t<e.length;t+=1)e[t].d()}}}function Ht(t,o,n){let{toasts:e}=o,{position:s=gt.topRight}=o,i=!0;return t.$$set=t=>{"toasts"in t&&n(0,e=t.toasts),"position"in t&&n(1,s=t.position)},t.$$.update=()=>{1&t.$$.dirty&&e.length&&n(2,i=!1)},[e,s,i,function(){n(2,i=!e.length)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)}]}class zt extends ht{constructor(t){super(),mt(this,t,Ht,St,d,{toasts:0,position:1})}}const Dt={position:gt.topRight,type:bt.info,displayTime:20,dark:!1,marginBottom:0,marginTop:0,mobilePosition:$t.bottom};function Nt(t){let o,n,e,s,i,r,a,c,l;return n=new zt({props:{toasts:t[6],position:gt.topLeft}}),n.$on("toast-clicked",t[11]),n.$on("toast-closed",t[10]),n.$on("toast-closed",t[12]),s=new zt({props:{toasts:t[7],position:gt.topRight}}),s.$on("toast-clicked",t[13]),s.$on("toast-closed",t[10]),s.$on("toast-closed",t[14]),r=new zt({props:{toasts:t[8],position:gt.bottomRight}}),r.$on("toast-clicked",t[15]),r.$on("toast-closed",t[10]),r.$on("toast-closed",t[16]),c=new zt({props:{toasts:t[9],position:gt.bottomLeft}}),c.$on("toast-clicked",t[17]),c.$on("toast-closed",t[10]),c.$on("toast-closed",t[18]),{c(){o=_("div"),ut(n.$$.fragment),e=T(),ut(s.$$.fragment),i=T(),ut(r.$$.fragment),a=T(),ut(c.$$.fragment),j(o,"class","jstoaster svelte-11ehapq"),P(o,"--jstoaster-margin-top",t[1]),P(o,"--jstoaster-margin-bottom",t[2]),P(o,"--jstoaster-mob-margin-top",t[3]),P(o,"--jstoaster-mob-margin-bottom",t[4]),O(o,"bottom",t[0].mobilePosition===$t.bottom),O(o,"hidden",t[5])},m(t,u){R(t,o,u),ft(n,o,null),w(o,e),ft(s,o,null),w(o,i),ft(r,o,null),w(o,a),ft(c,o,null),l=!0},p(t,[e]){const i={};64&e&&(i.toasts=t[6]),n.$set(i);const a={};128&e&&(a.toasts=t[7]),s.$set(a);const u={};256&e&&(u.toasts=t[8]),r.$set(u);const f={};512&e&&(f.toasts=t[9]),c.$set(f),(!l||2&e)&&P(o,"--jstoaster-margin-top",t[1]),(!l||4&e)&&P(o,"--jstoaster-margin-bottom",t[2]),(!l||8&e)&&P(o,"--jstoaster-mob-margin-top",t[3]),(!l||16&e)&&P(o,"--jstoaster-mob-margin-bottom",t[4]),1&e&&O(o,"bottom",t[0].mobilePosition===$t.bottom),32&e&&O(o,"hidden",t[5])},i(t){l||(it(n.$$.fragment,t),it(s.$$.fragment,t),it(r.$$.fragment,t),it(c.$$.fragment,t),l=!0)},o(t){rt(n.$$.fragment,t),rt(s.$$.fragment,t),rt(r.$$.fragment,t),rt(c.$$.fragment,t),l=!1},d(t){t&&L(o),pt(n),pt(s),pt(r),pt(c)}}}function qt(t,o,n){let e,s,i,r,a;h(t,vt,(t=>n(19,e=t))),h(t,xt,(t=>n(6,s=t))),h(t,Rt,(t=>n(7,i=t))),h(t,_t,(t=>n(8,r=t))),h(t,Lt,(t=>n(9,a=t)));let c,l,u,f,{conf:p=Dt}=o,d=!0;const m=vt.subscribe((t=>{t.length&&n(5,d=!1)}));return U((()=>m())),t.$$set=t=>{"conf"in t&&n(0,p=t.conf)},t.$$.update=()=>{1&t.$$.dirty&&(n(1,c=`${p.marginTop}px`),n(2,l=`${p.marginBottom}px`),p.mobilePosition===$t.top?(n(3,u=`${p.mobileMargin>=0?p.mobileMargin:p.marginTop}px`),n(4,f="0px")):(n(4,f=`${p.mobileMargin>=0?p.mobileMargin:p.marginBottom}px`),n(3,u="0px")))},[p,c,l,u,f,d,s,i,r,a,function(){n(5,d=!e.length)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)},function(o){F.call(this,t,o)}]}class Bt extends ht{constructor(t){super(),mt(this,t,qt,Nt,d,{conf:0})}}const Ut=new class{constructor(){r(this,"app"),r(this,"service"),r(this,"clickHandlers",[]),r(this,"closeHandlers",[]),r(this,"toasterConf"),this.app=new Bt({target:document.body}),this.app.$on("toast-clicked",(t=>{this.clickHandlers.forEach((o=>o(t.detail)))})),this.app.$on("toast-closed",(t=>{this.closeHandlers.forEach((o=>o(t.detail)))})),this.service=Ct,this.toasterConf=Dt,this.service.conf=Dt}set conf(t){this.toasterConf=i(i({},this.toasterConf),t),this.service.conf=this.toasterConf,this.app.$set({conf:this.toasterConf})}toast(t){let o;return o="string"==typeof t?{message:t}:t,this.service?this.service.toast(o):0}onClickToast(t){this.clickHandlers.push(t)}onCloseToast(t){this.closeHandlers.push(t)}};export{Ut as jsToaster};