"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue");var A="M8.27,3L3,8.27V15.73L8.27,21H15.73C17.5,19.24 21,15.73 21,15.73V8.27L15.73,3M9.1,5H14.9L19,9.1V14.9L14.9,19H9.1L5,14.9V9.1M11,15H13V17H11V15M11,7H13V13H11V7",_="M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",O="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z",I="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",T="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";const z={transform:"rotate(var(--r, 0deg)) scale(var(--sx, 1), var(--sy, 1))"},M={fill:"currentColor"},B={mdi:{size:24,viewbox:"0 0 24 24"},"simple-icons":{size:24,viewbox:"0 0 24 24"},default:{size:0,viewbox:"0 0 0 0"}},L={name:"icon",props:{type:{type:String,default:"mdi"},faIcon:{type:Object,default:null},path:{type:[String,Object,Array]},size:{type:[Number,String],default:24},viewbox:String,flip:{type:String,validator:s=>["horizontal","vertical","both"].includes(s)},rotate:{type:[Number,String],default:0}},setup(s){if(!s.path&&!s.faIcon)return console.warn("vue3-icon requires either a 'path' or an 'fa-icon' property"),()=>t.h("div");const o=t.computed(()=>{var d;return((d=s.faIcon)==null?void 0:d.prefix)||s.type}),a=t.computed(()=>parseInt(s.rotate,10)),e=t.computed(()=>B[o.value]||B.default),i=t.computed(()=>parseInt(s.size,10)||e.value.size),l=t.computed(()=>s.faIcon?`0 0 ${s.faIcon.icon[0]} ${s.faIcon.icon[1]}`:!1),c=t.computed(()=>l.value||s.viewbox||e.value.viewbox),f=t.computed(()=>({...z,"--sx":["both","horizontal"].includes(s.flip)?"-1":"1","--sy":["both","vertical"].includes(s.flip)?"-1":"1","--r":isNaN(a.value)?a.value:a.value+"deg"})),u=t.computed(()=>{var d;return s.faIcon?(d=s.faIcon)==null?void 0:d.icon[4]:s.type==="simple-icons"&&typeof s.path=="object"?s.path.path:s.path}),p=t.computed(()=>o.value==="fad"?(console.warn("vue3-icon does not currently support Duotone FontAwesome icons"),t.h("path")):Array.isArray(s.path)?t.h("g",{style:{...M}},s.path.map(d=>typeof d=="string"?t.h("path",{d}):t.h("path",{...d}))):t.h("path",{d:u.value,style:{...M}}));return()=>t.h("svg",{style:f.value,class:["vue3-icon"],width:i.value,height:i.value,viewBox:c.value},[p.value])}},D=["role"],H={class:"vue3-snackbar-message-wrapper"},j={key:0,class:"vue3-snackbar-message-icon"},P={class:"vue3-snackbar-message-content"},q={key:0,class:"vue3-snackbar-message-badge"},R={class:"vue3-snackbar-message-title"},F={key:0,class:"vue3-snackbar-message-additional"},G={class:"vue3-snackbar-message-close"},W={__name:"Vue3SnackbarMessage",props:{borderClass:{type:String,default:""},message:{type:Object,default:()=>({})},messageClass:{type:String,default:""},messageActionClass:{type:String,default:"vue3-snackbar-message-action"},dense:{type:Boolean,default:!1},iconPresets:{type:Object,required:!0}},emits:["dismiss","click:action"],setup(s,{emit:o}){const a=o,e=s;let i=null,l=null,c=t.ref(!1);const f=()=>{const r=!e.message.duration&&!e.message.dismissible?4e3:e.message.duration;i=setTimeout(p,r)};t.onMounted(()=>{f()}),t.watch(()=>e.message.count,r=>{if(r===1)return!1;clearTimeout(i),clearTimeout(l),l=setTimeout(()=>{c.value=!1},1e3),c.value=!0,f()});const u=()=>{i&&clearTimeout(i),p()},p=()=>{a("dismiss",e.message)},d=t.computed(()=>Object.assign({},{success:{path:O},info:{path:T},warning:{path:_},error:{path:A}},e.iconPresets)),g=t.computed(()=>{const r=d.value[e.message.type];return e.message.type&&!r&&console.warn("[Vue3 Snackbar] Couldn't find icon preset for type "+e.message.type),r?(r.type="mdi",r):e.message.icon&&typeof e.message.icon=="object"?e.message.icon:{path:"",type:"default"}}),v=t.computed(()=>{var r;return e.message.type==="error"?"alert":((r=e.message)==null?void 0:r.role)??"status"}),n={name:"RenderedAction",render(){const r=t.computed(()=>t.toRaw(e.message.action));return r.value?t.h(r.value,{message:e.message,isDismissible:e.message.isDismissible,dismiss:u}):null}};return(r,m)=>(t.openBlock(),t.createElementBlock("article",{class:t.normalizeClass(["vue3-snackbar-message",[e.message.type||"custom",e.messageClass,e.borderClass,{"has-background":e.message.background,"has-border":e.borderClass,"is-dense":e.dense,"shake-baby-shake":t.unref(c)}]]),role:v.value,style:t.normalizeStyle({"--message-background":e.message.background,"--message-text-color":e.message.textColor,"--message-icon-color":e.message.iconColor})},[t.renderSlot(r.$slots,"message-inner",{message:e.message},()=>[t.createElementVNode("div",H,[g.value?(t.openBlock(),t.createElementBlock("div",j,[t.renderSlot(r.$slots,"message-icon",{message:e.message,icon:g.value},()=>[t.createVNode(t.unref(L),t.mergeProps(g.value,{role:"img"}),null,16)])])):t.createCommentVNode("",!0),t.createElementVNode("div",P,[t.renderSlot(r.$slots,"message-badge",{message:e.message,count:e.message.count},()=>[e.message.count>1?(t.openBlock(),t.createElementBlock("div",q,t.toDisplayString(e.message.count),1)):t.createCommentVNode("",!0)]),t.renderSlot(r.$slots,"message-content",{message:e.message,title:e.message.title,text:e.message.text},()=>[t.createElementVNode("div",R,t.toDisplayString(e.message.title||e.message.text),1),e.message.title&&e.message.text?(t.openBlock(),t.createElementBlock("div",F,t.toDisplayString(e.message.text),1)):t.createCommentVNode("",!0)]),r.$slots["message-action"]?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(e.messageActionClass),onClick:m[0]||(m[0]=k=>a("click:action",{message:e.message}))},[t.renderSlot(r.$slots,"message-action",{message:e.message,isDismissible:e.message.dismissible,dismiss:u},()=>[t.createVNode(n)])],2)):t.createCommentVNode("",!0)]),m[1]||(m[1]=t.createElementVNode("div",{class:"spacer"},null,-1)),t.createElementVNode("div",G,[t.renderSlot(r.$slots,"message-close-icon",{message:e.message,isDimissible:e.message.dismissible,isDismissible:e.message.dismissible,dismiss:u},()=>[e.message.dismissible!==!1?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:u},[t.createVNode(t.unref(L),{type:"mdi",path:t.unref(I)},null,8,["path"])])):t.createCommentVNode("",!0)])])])])],14,D))}},Z=typeof window<"u"?HTMLElement:Object,U={top:{type:Boolean,default:!1},bottom:{type:Boolean,default:!1},left:{type:Boolean,default:!1},right:{type:Boolean,default:!1},success:{type:String,default:"#4caf50"},error:{type:String,default:"#ff5252"},warning:{type:String,default:"#fb8c00"},info:{type:String,default:"#2196f3"},iconPresets:{type:Object,default:()=>({})},messageTextColor:{type:String,default:"#fff"},messageIconColor:{type:String,default:"currentColor"},attach:{type:[String,Z],default:"body"},border:{type:String,default:"",validator:s=>["top","bottom","left","right",""].includes(s)},backgroundOpacity:{type:[String,Number],default:.12,validator:s=>!isNaN(parseFloat(s))&&isFinite(s)},backgroundColor:{type:String,default:"currentColor"},baseBackgroundColor:{type:String,default:"#fff"},duration:{type:[Number,String],default:null},messageClass:{type:String},messageActionClass:{type:String,default:"vue3-snackbar-message-action"},zIndex:{type:Number,default:1e4},dense:{type:Boolean,default:!1},reverse:{type:Boolean,default:!1},limit:{type:Number,default:null},groups:{type:Boolean,default:!1},shadow:{type:Boolean,default:!1},dismissOnActionClick:{type:Boolean,default:!0}};function J(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var w={exports:{}};function V(){}V.prototype={on:function(s,o,a){var e=this.e||(this.e={});return(e[s]||(e[s]=[])).push({fn:o,ctx:a}),this},once:function(s,o,a){var e=this;function i(){e.off(s,i),o.apply(a,arguments)}return i._=o,this.on(s,i,a)},emit:function(s){var o=[].slice.call(arguments,1),a=((this.e||(this.e={}))[s]||[]).slice(),e=0,i=a.length;for(e;eC.on(...s),$once:(...s)=>C.once(...s),$off:(...s)=>C.off(...s),$emit:(...s)=>C.emit(...s)},y=t.ref([]),$=Symbol();function Y(){const s=t.inject($);if(!s)throw new Error("No Snackbar provided!");return s}const ee={install:(s,o={})=>{const{disableGlobals:a=!1}=o,e={add:i=>{h.$emit("add",i)},clear:()=>{h.$emit("clear")}};a!==!0&&(s.config.globalProperties.$snackbar=e,typeof window<"u"&&(window.$snackbar=e)),s.provide($,e)}};function te(s){return t.getCurrentScope()?(t.onScopeDispose(s),!0):!1}function E(s){return typeof s=="function"?s():t.unref(s)}const N=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const se=s=>s!=null;function oe(s){return t.getCurrentInstance()}function ae(s,o=!0,a){oe()?t.onMounted(s,a):o?s():t.nextTick(s)}function ne(s){var o;const a=E(s);return(o=a==null?void 0:a.$el)!=null?o:a}const re=N?window:void 0,ie=N?window.document:void 0;function le(){const s=t.ref(!1),o=t.getCurrentInstance();return o&&t.onMounted(()=>{s.value=!0},o),s}function ce(s){const o=le();return t.computed(()=>(o.value,!!s()))}function ue(s,o,a={}){const{window:e=re,...i}=a;let l;const c=ce(()=>e&&"MutationObserver"in e),f=()=>{l&&(l.disconnect(),l=void 0)},u=t.computed(()=>{const v=E(s),n=(Array.isArray(v)?v:[v]).map(ne).filter(se);return new Set(n)}),p=t.watch(()=>u.value,v=>{f(),c.value&&v.size&&(l=new MutationObserver(o),v.forEach(n=>l.observe(n,i)))},{immediate:!0,flush:"post"}),d=()=>l==null?void 0:l.takeRecords(),g=()=>{p(),f()};return te(g),{isSupported:c,stop:g,takeRecords:d}}function de(s={}){const{document:o=ie,selector:a="html",observe:e=!1,initialValue:i="ltr"}=s;function l(){var f,u;return(u=(f=o==null?void 0:o.querySelector(a))==null?void 0:f.getAttribute("dir"))!=null?u:i}const c=t.ref(l());return ae(()=>c.value=l()),e&&o&&ue(o.querySelector(a),()=>c.value=l(),{attributes:!0}),t.computed({get(){return c.value},set(f){var u,p;c.value=f,o&&(c.value?(u=o.querySelector(a))==null||u.setAttribute("dir",c.value):(p=o.querySelector(a))==null||p.removeAttribute("dir"))}})}const me={__name:"Vue3Snackbar",props:{...U},emits:["added","dismissed","removed","cleared","click:action"],setup(s,{emit:o}){const a=de(),e=s,i=o,l=t.computed(()=>({"is-top":e.top,"is-bottom":e.top===!1&&e.bottom,"is-left":e.left,"is-right":e.left===!1&&e.right,"is-middle":e.top===!1&&e.bottom===!1,"is-centre":e.left===!1&&e.right===!1,"has-shadow":e.shadow,"is-rtl":a.value==="rtl"})),c=t.computed(()=>({"--success-colour":e.success,"--error-colour":e.error,"--warning-colour":e.warning,"--info-colour":e.info,"--snackbar-zindex":e.zIndex,"--background-opacity":e.backgroundOpacity,"--background-color":e.backgroundColor,"--base-background-color":e.baseBackgroundColor,"--message-text-color":e.messageTextColor,"--message-icon-color":e.messageIconColor})),f=t.computed(()=>e.border?`border-${e.border}`:""),u=n=>Math.abs(n.split("").reduce((r,m)=>(r<<5)-r+m.charCodeAt(0)|0,0));let p=1;t.onMounted(()=>{h.$on("add",n=>{i("added",n),n.group||(n.group=u(`${n.type}${n.title}${n.text}`).toString(16)),e.duration&&!n.duration&&n.duration!==0&&(n.duration=+e.duration);const r=n.group&&y.value.find(m=>m.group===n.group);if(e.groups===!1||!r){const m={...n,id:p,count:1};y.value.push(m),p++}else r.count++})});const d=t.computed(()=>{const n=e.limit?y.value.slice(e.limit*-1):[...y.value];return e.reverse?n.reverse():n});t.watch(d,n=>{const r=n.map(b=>b.id),k=y.value.map(b=>b.id).filter(b=>!r.includes(b));for(const b of k){const S=y.value.find(x=>x.id===b);S&&g(S,!1)}}),h.$on("clear",()=>{i("cleared"),y.value=[]}),t.onUnmounted(()=>{h.$off("add"),h.$off("clear")});const g=(n,r=!1)=>{i(r?"dismissed":"removed",n),y.value=y.value.filter(m=>m.id!==n.id)},v=n=>{i("click:action",n),e.dismissOnActionClick&&g(n.message,!0)};return(n,r)=>(t.openBlock(),t.createBlock(t.Teleport,{to:e.attach},[t.createElementVNode("section",{id:"vue3-snackbar--container",class:t.normalizeClass([[l.value],"vue3-snackbar"]),style:t.normalizeStyle(c.value),"aria-live":"polite"},[t.createVNode(t.TransitionGroup,{name:"vue3-snackbar-message",tag:"div",class:"vue3-snackbar--messages"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,m=>(t.openBlock(),t.createBlock(W,{key:m.id,message:m,"message-class":e.messageClass,"message-action-class":e.messageActionClass,dense:e.dense,"border-class":f.value,"icon-presets":e.iconPresets,onDismiss:r[0]||(r[0]=k=>g(k,!0)),"onClick:action":v},t.createSlots({_:2},[t.renderList(n.$slots,(k,b)=>({name:b,fn:t.withCtx(S=>[t.renderSlot(n.$slots,b,t.mergeProps({ref_for:!0},S))])}))]),1032,["message","message-class","message-action-class","dense","border-class","icon-presets"]))),128))]),_:3})],6)],8,["to"]))}};exports.SnackbarMessages=y;exports.SnackbarService=ee;exports.Vue3Snackbar=me;exports.useSnackbar=Y;