@soft-toast/vue 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +31 -0
- package/README.md +210 -0
- package/dist/animations/gsapConfig.d.ts +42 -0
- package/dist/animations/gsapConfig.d.ts.map +1 -0
- package/dist/composables/useFlash.d.ts +41 -0
- package/dist/composables/useFlash.d.ts.map +1 -0
- package/dist/composables/useFlash.test.d.ts +2 -0
- package/dist/composables/useFlash.test.d.ts.map +1 -0
- package/dist/composables/useToast.d.ts +53 -0
- package/dist/composables/useToast.d.ts.map +1 -0
- package/dist/composables/useToast.test.d.ts +2 -0
- package/dist/composables/useToast.test.d.ts.map +1 -0
- package/dist/exports.test.d.ts +2 -0
- package/dist/exports.test.d.ts.map +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2100 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/stores/toastStore.d.ts +25 -0
- package/dist/stores/toastStore.d.ts.map +1 -0
- package/dist/stores/toastStore.test.d.ts +2 -0
- package/dist/stores/toastStore.test.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +107 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/sound.d.ts +9 -0
- package/dist/utils/sound.d.ts.map +1 -0
- package/package.json +70 -0
- package/src/animations/gsapConfig.ts +303 -0
- package/src/components/ToastContainer.vue +36 -0
- package/src/components/ToastIcon.vue +33 -0
- package/src/components/ToastItem.vue +342 -0
- package/src/components/ToastProgress.vue +50 -0
- package/src/components/ToastRegion.vue +381 -0
- package/src/composables/useFlash.test.ts +164 -0
- package/src/composables/useFlash.ts +118 -0
- package/src/composables/useToast.test.ts +230 -0
- package/src/composables/useToast.ts +95 -0
- package/src/exports.test.ts +72 -0
- package/src/icons.ts +38 -0
- package/src/index.ts +25 -0
- package/src/plugin.ts +85 -0
- package/src/stores/toastStore.test.ts +129 -0
- package/src/stores/toastStore.ts +288 -0
- package/src/styles/toast.css +353 -0
- package/src/styles/variables.css +83 -0
- package/src/types/index.ts +115 -0
- package/src/utils/sound.ts +140 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2100 @@
|
|
|
1
|
+
import { ref as O, computed as $, defineComponent as X, shallowRef as At, onMounted as he, watch as N, onUnmounted as me, h as xe, nextTick as Ee, openBlock as S, createElementBlock as L, createVNode as Ae, unref as at, createElementVNode as j, normalizeStyle as ct, normalizeClass as re, renderSlot as Q, withModifiers as Re, createCommentVNode as H, createBlock as q, resolveDynamicComponent as $e, toDisplayString as J, Fragment as ue, createTextVNode as Ct, renderList as ne, Teleport as lt, withDirectives as Ot, createSlots as ut, withCtx as ft, mergeProps as be, vShow as Lt, createApp as Dt } from "vue";
|
|
2
|
+
import { gsap as A } from "gsap";
|
|
3
|
+
let Z = null, dt = !1;
|
|
4
|
+
const Ft = () => {
|
|
5
|
+
dt = !0;
|
|
6
|
+
};
|
|
7
|
+
typeof window < "u" && ["click", "keydown", "pointerdown", "touchstart"].forEach(
|
|
8
|
+
(e) => window.addEventListener(e, Ft, { once: !0, passive: !0 })
|
|
9
|
+
);
|
|
10
|
+
const Mt = () => typeof window > "u" || typeof AudioContext > "u" ? null : (Z || (Z = new AudioContext()), Z.state === "suspended" && Z.resume().catch(() => {
|
|
11
|
+
}), Z), B = (e, t, n, o = "sine", s = 0) => {
|
|
12
|
+
const i = Mt();
|
|
13
|
+
if (i)
|
|
14
|
+
try {
|
|
15
|
+
const r = i.createOscillator(), a = i.createGain();
|
|
16
|
+
r.connect(a), a.connect(i.destination), r.type = o, r.frequency.setValueAtTime(e, i.currentTime + s), a.gain.setValueAtTime(0, i.currentTime + s), a.gain.linearRampToValueAtTime(n, i.currentTime + s + 0.01), a.gain.exponentialRampToValueAtTime(1e-3, i.currentTime + s + t), r.start(i.currentTime + s), r.stop(i.currentTime + s + t + 0.02);
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}, Ne = {
|
|
20
|
+
success: (e) => {
|
|
21
|
+
B(523.25, 0.12, e * 0.45, "sine", 0), B(659.25, 0.14, e * 0.5, "sine", 0.08), B(783.99, 0.2, e * 0.55, "sine", 0.16);
|
|
22
|
+
},
|
|
23
|
+
error: (e) => {
|
|
24
|
+
B(329.63, 0.18, e * 0.6, "triangle", 0), B(277.18, 0.28, e * 0.55, "triangle", 0.12);
|
|
25
|
+
},
|
|
26
|
+
warning: (e) => {
|
|
27
|
+
B(440, 0.14, e * 0.5, "sine", 0), B(440, 0.18, e * 0.4, "sine", 0.22);
|
|
28
|
+
},
|
|
29
|
+
info: (e) => {
|
|
30
|
+
B(659.25, 0.12, e * 0.38, "sine", 0), B(880, 0.18, e * 0.42, "sine", 0.1);
|
|
31
|
+
},
|
|
32
|
+
default: (e) => {
|
|
33
|
+
B(523.25, 0.15, e * 0.35, "sine", 0);
|
|
34
|
+
},
|
|
35
|
+
// promise → same as info while loading
|
|
36
|
+
promise: (e) => {
|
|
37
|
+
B(523.25, 0.12, e * 0.3, "sine", 0);
|
|
38
|
+
}
|
|
39
|
+
}, He = (e, t, n = 0.5) => {
|
|
40
|
+
if (!t || typeof window > "u" || !dt) return;
|
|
41
|
+
const o = Math.max(0, Math.min(1, n));
|
|
42
|
+
if (typeof t == "string") {
|
|
43
|
+
try {
|
|
44
|
+
const i = new Audio(t);
|
|
45
|
+
i.volume = o, i.play().catch(() => {
|
|
46
|
+
});
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
(Ne[e] ?? Ne.default)(o);
|
|
52
|
+
}, jt = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, V = {
|
|
53
|
+
type: "default",
|
|
54
|
+
duration: 4e3,
|
|
55
|
+
position: "top-right",
|
|
56
|
+
preset: "smooth",
|
|
57
|
+
bounce: 0.4,
|
|
58
|
+
spring: !0,
|
|
59
|
+
showTimestamp: !1,
|
|
60
|
+
showProgress: !1
|
|
61
|
+
}, b = O([]), Bt = (e) => $(() => b.value.filter((t) => t.position === e)), Rt = $(() => b.value), U = (e) => {
|
|
62
|
+
const t = e.id || jt(), n = b.value.findIndex((r) => r.id === t);
|
|
63
|
+
if (n !== -1 && !b.value[n].isLeaving) {
|
|
64
|
+
const r = b.value[n];
|
|
65
|
+
b.value[n] = {
|
|
66
|
+
...r,
|
|
67
|
+
...e,
|
|
68
|
+
id: t,
|
|
69
|
+
// Reset timer so user has time to read the updated content
|
|
70
|
+
remainingTime: e.duration ?? r.duration,
|
|
71
|
+
isPaused: r.isPaused,
|
|
72
|
+
isLeaving: !1
|
|
73
|
+
};
|
|
74
|
+
const a = e.sound, l = e.soundVolume ?? 0.5;
|
|
75
|
+
return a && He(e.type ?? r.type, a, l), t;
|
|
76
|
+
}
|
|
77
|
+
const o = {
|
|
78
|
+
...V,
|
|
79
|
+
...e,
|
|
80
|
+
id: t,
|
|
81
|
+
createdAt: Date.now(),
|
|
82
|
+
remainingTime: e.duration ?? V.duration,
|
|
83
|
+
isPaused: !1,
|
|
84
|
+
isExpanded: !0,
|
|
85
|
+
isLeaving: !1,
|
|
86
|
+
preset: e.preset ?? V.preset,
|
|
87
|
+
bounce: e.bounce ?? V.bounce,
|
|
88
|
+
spring: e.spring ?? V.spring,
|
|
89
|
+
showTimestamp: e.showTimestamp ?? V.showTimestamp,
|
|
90
|
+
showProgress: e.showProgress ?? V.showProgress
|
|
91
|
+
};
|
|
92
|
+
b.value.unshift(o), zt();
|
|
93
|
+
const s = e.sound, i = e.soundVolume ?? 0.5;
|
|
94
|
+
return s && He(o.type, s, i), t;
|
|
95
|
+
}, ke = (e, t) => {
|
|
96
|
+
const n = b.value.findIndex((o) => o.id === e);
|
|
97
|
+
n !== -1 && (b.value[n] = { ...b.value[n], ...t });
|
|
98
|
+
}, $t = (e) => {
|
|
99
|
+
var t;
|
|
100
|
+
if (!e) {
|
|
101
|
+
b.value.forEach((n) => {
|
|
102
|
+
n.isLeaving = !0;
|
|
103
|
+
}), setTimeout(() => {
|
|
104
|
+
b.value = [];
|
|
105
|
+
}, 400);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (typeof e == "string") {
|
|
109
|
+
const n = b.value.find((o) => o.id === e);
|
|
110
|
+
n && (n.isLeaving = !0, (t = n.onDismiss) == null || t.call(n, e), setTimeout(() => {
|
|
111
|
+
b.value = b.value.filter((o) => o.id !== e);
|
|
112
|
+
}, 400));
|
|
113
|
+
} else {
|
|
114
|
+
const n = Array.isArray(e.type) ? e.type : [e.type];
|
|
115
|
+
b.value.forEach((o) => {
|
|
116
|
+
var s;
|
|
117
|
+
n.includes(o.type) && (o.isLeaving = !0, (s = o.onDismiss) == null || s.call(o, o.id));
|
|
118
|
+
}), setTimeout(() => {
|
|
119
|
+
b.value = b.value.filter((o) => !n.includes(o.type));
|
|
120
|
+
}, 400);
|
|
121
|
+
}
|
|
122
|
+
}, Nt = (e) => {
|
|
123
|
+
const t = b.value.find((n) => n.id === e);
|
|
124
|
+
t && (t.isPaused = !0);
|
|
125
|
+
}, Ht = (e) => {
|
|
126
|
+
const t = b.value.find((n) => n.id === e);
|
|
127
|
+
t && (t.isPaused = !1);
|
|
128
|
+
}, qt = (e) => {
|
|
129
|
+
const t = b.value.find((n) => n.id === e);
|
|
130
|
+
t && (t.isExpanded = !0);
|
|
131
|
+
}, Vt = (e) => {
|
|
132
|
+
const t = b.value.find((n) => n.id === e);
|
|
133
|
+
t && (t.isExpanded = !1);
|
|
134
|
+
};
|
|
135
|
+
let _ = 0, ie = null;
|
|
136
|
+
const zt = () => {
|
|
137
|
+
if (ie !== null || typeof window > "u") return;
|
|
138
|
+
const e = (t) => {
|
|
139
|
+
_ === 0 && (_ = t);
|
|
140
|
+
const n = t - _;
|
|
141
|
+
_ = t, b.value.forEach((o) => {
|
|
142
|
+
var s;
|
|
143
|
+
!o.isPaused && !o.isLeaving && o.remainingTime > 0 && o.duration !== 1 / 0 && (o.remainingTime -= n, o.remainingTime <= 0 && (o.isLeaving = !0, (s = o.onAutoClose) == null || s.call(o, o.id), setTimeout(() => {
|
|
144
|
+
b.value = b.value.filter((i) => i.id !== o.id);
|
|
145
|
+
}, 400)));
|
|
146
|
+
}), b.value.length > 0 ? ie = requestAnimationFrame(e) : (ie = null, _ = 0);
|
|
147
|
+
};
|
|
148
|
+
ie = requestAnimationFrame(e);
|
|
149
|
+
}, Qt = (e, t) => U({ ...t, type: "success", title: e }), Ut = (e, t) => U({ ...t, type: "error", title: e }), Yt = (e, t) => U({ ...t, type: "warning", title: e }), Gt = (e, t) => U({ ...t, type: "info", title: e }), Xt = (e, t) => U({ ...t, type: "promise", title: e, duration: 1 / 0 }), Wt = async (e, t, n) => {
|
|
150
|
+
var s, i, r;
|
|
151
|
+
const o = U({
|
|
152
|
+
...n,
|
|
153
|
+
type: "promise",
|
|
154
|
+
title: t.loading,
|
|
155
|
+
duration: 1 / 0
|
|
156
|
+
});
|
|
157
|
+
try {
|
|
158
|
+
const a = await e;
|
|
159
|
+
return ke(o, {
|
|
160
|
+
type: "success",
|
|
161
|
+
title: t.success,
|
|
162
|
+
description: (s = t.description) == null ? void 0 : s.success,
|
|
163
|
+
duration: 4e3
|
|
164
|
+
}), a;
|
|
165
|
+
} catch (a) {
|
|
166
|
+
throw ke(o, {
|
|
167
|
+
type: "error",
|
|
168
|
+
title: t.error,
|
|
169
|
+
description: (i = t.description) == null ? void 0 : i.error,
|
|
170
|
+
action: (r = t.action) == null ? void 0 : r.error,
|
|
171
|
+
duration: 6e3
|
|
172
|
+
}), a;
|
|
173
|
+
}
|
|
174
|
+
}, Kt = () => {
|
|
175
|
+
b.value = [];
|
|
176
|
+
}, Jt = (e) => {
|
|
177
|
+
b.value = b.value.filter((t) => t.id !== e);
|
|
178
|
+
}, m = {
|
|
179
|
+
toasts: Rt,
|
|
180
|
+
getToastsByPosition: Bt,
|
|
181
|
+
add: U,
|
|
182
|
+
update: ke,
|
|
183
|
+
dismiss: $t,
|
|
184
|
+
pause: Nt,
|
|
185
|
+
resume: Ht,
|
|
186
|
+
expand: qt,
|
|
187
|
+
collapse: Vt,
|
|
188
|
+
success: Qt,
|
|
189
|
+
error: Ut,
|
|
190
|
+
warning: Yt,
|
|
191
|
+
info: Gt,
|
|
192
|
+
loading: Xt,
|
|
193
|
+
promise: Wt,
|
|
194
|
+
clearAll: Kt,
|
|
195
|
+
remove: Jt
|
|
196
|
+
}, pt = /^[a-z0-9]+(-[a-z0-9]+)*$/, ge = (e, t, n, o = "") => {
|
|
197
|
+
const s = e.split(":");
|
|
198
|
+
if (e.slice(0, 1) === "@") {
|
|
199
|
+
if (s.length < 2 || s.length > 3) return null;
|
|
200
|
+
o = s.shift().slice(1);
|
|
201
|
+
}
|
|
202
|
+
if (s.length > 3 || !s.length) return null;
|
|
203
|
+
if (s.length > 1) {
|
|
204
|
+
const a = s.pop(), l = s.pop(), c = {
|
|
205
|
+
provider: s.length > 0 ? s[0] : o,
|
|
206
|
+
prefix: l,
|
|
207
|
+
name: a
|
|
208
|
+
};
|
|
209
|
+
return t && !ae(c) ? null : c;
|
|
210
|
+
}
|
|
211
|
+
const i = s[0], r = i.split("-");
|
|
212
|
+
if (r.length > 1) {
|
|
213
|
+
const a = {
|
|
214
|
+
provider: o,
|
|
215
|
+
prefix: r.shift(),
|
|
216
|
+
name: r.join("-")
|
|
217
|
+
};
|
|
218
|
+
return t && !ae(a) ? null : a;
|
|
219
|
+
}
|
|
220
|
+
if (n && o === "") {
|
|
221
|
+
const a = {
|
|
222
|
+
provider: o,
|
|
223
|
+
prefix: "",
|
|
224
|
+
name: i
|
|
225
|
+
};
|
|
226
|
+
return t && !ae(a, n) ? null : a;
|
|
227
|
+
}
|
|
228
|
+
return null;
|
|
229
|
+
}, ae = (e, t) => e ? !!((t && e.prefix === "" || e.prefix) && e.name) : !1;
|
|
230
|
+
function Zt(e, t) {
|
|
231
|
+
const n = e.icons, o = e.aliases || /* @__PURE__ */ Object.create(null), s = /* @__PURE__ */ Object.create(null);
|
|
232
|
+
function i(r) {
|
|
233
|
+
if (n[r]) return s[r] = [];
|
|
234
|
+
if (!(r in s)) {
|
|
235
|
+
s[r] = null;
|
|
236
|
+
const a = o[r] && o[r].parent, l = a && i(a);
|
|
237
|
+
l && (s[r] = [a].concat(l));
|
|
238
|
+
}
|
|
239
|
+
return s[r];
|
|
240
|
+
}
|
|
241
|
+
return Object.keys(n).concat(Object.keys(o)).forEach(i), s;
|
|
242
|
+
}
|
|
243
|
+
const ht = Object.freeze({
|
|
244
|
+
left: 0,
|
|
245
|
+
top: 0,
|
|
246
|
+
width: 16,
|
|
247
|
+
height: 16
|
|
248
|
+
}), fe = Object.freeze({
|
|
249
|
+
rotate: 0,
|
|
250
|
+
vFlip: !1,
|
|
251
|
+
hFlip: !1
|
|
252
|
+
}), ve = Object.freeze({
|
|
253
|
+
...ht,
|
|
254
|
+
...fe
|
|
255
|
+
}), Te = Object.freeze({
|
|
256
|
+
...ve,
|
|
257
|
+
body: "",
|
|
258
|
+
hidden: !1
|
|
259
|
+
});
|
|
260
|
+
function _t(e, t) {
|
|
261
|
+
const n = {};
|
|
262
|
+
!e.hFlip != !t.hFlip && (n.hFlip = !0), !e.vFlip != !t.vFlip && (n.vFlip = !0);
|
|
263
|
+
const o = ((e.rotate || 0) + (t.rotate || 0)) % 4;
|
|
264
|
+
return o && (n.rotate = o), n;
|
|
265
|
+
}
|
|
266
|
+
function qe(e, t) {
|
|
267
|
+
const n = _t(e, t);
|
|
268
|
+
for (const o in Te) o in fe ? o in e && !(o in n) && (n[o] = fe[o]) : o in t ? n[o] = t[o] : o in e && (n[o] = e[o]);
|
|
269
|
+
return n;
|
|
270
|
+
}
|
|
271
|
+
function en(e, t, n) {
|
|
272
|
+
const o = e.icons, s = e.aliases || /* @__PURE__ */ Object.create(null);
|
|
273
|
+
let i = {};
|
|
274
|
+
function r(a) {
|
|
275
|
+
i = qe(o[a] || s[a], i);
|
|
276
|
+
}
|
|
277
|
+
return r(t), n.forEach(r), qe(e, i);
|
|
278
|
+
}
|
|
279
|
+
function mt(e, t) {
|
|
280
|
+
const n = [];
|
|
281
|
+
if (typeof e != "object" || typeof e.icons != "object") return n;
|
|
282
|
+
e.not_found instanceof Array && e.not_found.forEach((s) => {
|
|
283
|
+
t(s, null), n.push(s);
|
|
284
|
+
});
|
|
285
|
+
const o = Zt(e);
|
|
286
|
+
for (const s in o) {
|
|
287
|
+
const i = o[s];
|
|
288
|
+
i && (t(s, en(e, s, i)), n.push(s));
|
|
289
|
+
}
|
|
290
|
+
return n;
|
|
291
|
+
}
|
|
292
|
+
const tn = {
|
|
293
|
+
provider: "",
|
|
294
|
+
aliases: {},
|
|
295
|
+
not_found: {},
|
|
296
|
+
...ht
|
|
297
|
+
};
|
|
298
|
+
function ye(e, t) {
|
|
299
|
+
for (const n in t) if (n in e && typeof e[n] != typeof t[n]) return !1;
|
|
300
|
+
return !0;
|
|
301
|
+
}
|
|
302
|
+
function gt(e) {
|
|
303
|
+
if (typeof e != "object" || e === null) return null;
|
|
304
|
+
const t = e;
|
|
305
|
+
if (typeof t.prefix != "string" || !e.icons || typeof e.icons != "object" || !ye(e, tn)) return null;
|
|
306
|
+
const n = t.icons;
|
|
307
|
+
for (const s in n) {
|
|
308
|
+
const i = n[s];
|
|
309
|
+
if (!s || typeof i.body != "string" || !ye(i, Te)) return null;
|
|
310
|
+
}
|
|
311
|
+
const o = t.aliases || /* @__PURE__ */ Object.create(null);
|
|
312
|
+
for (const s in o) {
|
|
313
|
+
const i = o[s], r = i.parent;
|
|
314
|
+
if (!s || typeof r != "string" || !n[r] && !o[r] || !ye(i, Te)) return null;
|
|
315
|
+
}
|
|
316
|
+
return t;
|
|
317
|
+
}
|
|
318
|
+
const Ve = /* @__PURE__ */ Object.create(null);
|
|
319
|
+
function nn(e, t) {
|
|
320
|
+
return {
|
|
321
|
+
provider: e,
|
|
322
|
+
prefix: t,
|
|
323
|
+
icons: /* @__PURE__ */ Object.create(null),
|
|
324
|
+
missing: /* @__PURE__ */ new Set()
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function G(e, t) {
|
|
328
|
+
const n = Ve[e] || (Ve[e] = /* @__PURE__ */ Object.create(null));
|
|
329
|
+
return n[t] || (n[t] = nn(e, t));
|
|
330
|
+
}
|
|
331
|
+
function vt(e, t) {
|
|
332
|
+
return gt(t) ? mt(t, (n, o) => {
|
|
333
|
+
o ? e.icons[n] = o : e.missing.add(n);
|
|
334
|
+
}) : [];
|
|
335
|
+
}
|
|
336
|
+
function on(e, t, n) {
|
|
337
|
+
try {
|
|
338
|
+
if (typeof n.body == "string")
|
|
339
|
+
return e.icons[t] = { ...n }, !0;
|
|
340
|
+
} catch {
|
|
341
|
+
}
|
|
342
|
+
return !1;
|
|
343
|
+
}
|
|
344
|
+
let oe = !1;
|
|
345
|
+
function yt(e) {
|
|
346
|
+
return typeof e == "boolean" && (oe = e), oe;
|
|
347
|
+
}
|
|
348
|
+
function sn(e) {
|
|
349
|
+
const t = typeof e == "string" ? ge(e, !0, oe) : e;
|
|
350
|
+
if (t) {
|
|
351
|
+
const n = G(t.provider, t.prefix), o = t.name;
|
|
352
|
+
return n.icons[o] || (n.missing.has(o) ? null : void 0);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function z(e, t) {
|
|
356
|
+
const n = ge(e, !0, oe);
|
|
357
|
+
if (!n) return !1;
|
|
358
|
+
const o = G(n.provider, n.prefix);
|
|
359
|
+
return t ? on(o, n.name, t) : (o.missing.add(n.name), !0);
|
|
360
|
+
}
|
|
361
|
+
function rn(e, t) {
|
|
362
|
+
if (typeof e != "object") return !1;
|
|
363
|
+
if (typeof t != "string" && (t = e.provider || ""), oe && !t && !e.prefix) {
|
|
364
|
+
let o = !1;
|
|
365
|
+
return gt(e) && (e.prefix = "", mt(e, (s, i) => {
|
|
366
|
+
z(s, i) && (o = !0);
|
|
367
|
+
})), o;
|
|
368
|
+
}
|
|
369
|
+
const n = e.prefix;
|
|
370
|
+
return ae({
|
|
371
|
+
prefix: n,
|
|
372
|
+
name: "a"
|
|
373
|
+
}) ? !!vt(G(t, n), e) : !1;
|
|
374
|
+
}
|
|
375
|
+
const wt = Object.freeze({
|
|
376
|
+
width: null,
|
|
377
|
+
height: null
|
|
378
|
+
}), xt = Object.freeze({
|
|
379
|
+
...wt,
|
|
380
|
+
...fe
|
|
381
|
+
}), an = /(-?[0-9.]*[0-9]+[0-9.]*)/g, cn = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
382
|
+
function ze(e, t, n) {
|
|
383
|
+
if (t === 1) return e;
|
|
384
|
+
if (n = n || 100, typeof e == "number") return Math.ceil(e * t * n) / n;
|
|
385
|
+
if (typeof e != "string") return e;
|
|
386
|
+
const o = e.split(an);
|
|
387
|
+
if (o === null || !o.length) return e;
|
|
388
|
+
const s = [];
|
|
389
|
+
let i = o.shift(), r = cn.test(i);
|
|
390
|
+
for (; ; ) {
|
|
391
|
+
if (r) {
|
|
392
|
+
const a = parseFloat(i);
|
|
393
|
+
isNaN(a) ? s.push(i) : s.push(Math.ceil(a * t * n) / n);
|
|
394
|
+
} else s.push(i);
|
|
395
|
+
if (i = o.shift(), i === void 0) return s.join("");
|
|
396
|
+
r = !r;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function ln(e, t = "defs") {
|
|
400
|
+
let n = "";
|
|
401
|
+
const o = e.indexOf("<" + t);
|
|
402
|
+
for (; o >= 0; ) {
|
|
403
|
+
const s = e.indexOf(">", o), i = e.indexOf("</" + t);
|
|
404
|
+
if (s === -1 || i === -1) break;
|
|
405
|
+
const r = e.indexOf(">", i);
|
|
406
|
+
if (r === -1) break;
|
|
407
|
+
n += e.slice(s + 1, i).trim(), e = e.slice(0, o).trim() + e.slice(r + 1);
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
defs: n,
|
|
411
|
+
content: e
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function un(e, t) {
|
|
415
|
+
return e ? "<defs>" + e + "</defs>" + t : t;
|
|
416
|
+
}
|
|
417
|
+
function fn(e, t, n) {
|
|
418
|
+
const o = ln(e);
|
|
419
|
+
return un(o.defs, t + o.content + n);
|
|
420
|
+
}
|
|
421
|
+
const dn = (e) => e === "unset" || e === "undefined" || e === "none";
|
|
422
|
+
function pn(e, t) {
|
|
423
|
+
const n = {
|
|
424
|
+
...ve,
|
|
425
|
+
...e
|
|
426
|
+
}, o = {
|
|
427
|
+
...xt,
|
|
428
|
+
...t
|
|
429
|
+
}, s = {
|
|
430
|
+
left: n.left,
|
|
431
|
+
top: n.top,
|
|
432
|
+
width: n.width,
|
|
433
|
+
height: n.height
|
|
434
|
+
};
|
|
435
|
+
let i = n.body;
|
|
436
|
+
[n, o].forEach((I) => {
|
|
437
|
+
const d = [], D = I.hFlip, F = I.vFlip;
|
|
438
|
+
let f = I.rotate;
|
|
439
|
+
D ? F ? f += 2 : (d.push("translate(" + (s.width + s.left).toString() + " " + (0 - s.top).toString() + ")"), d.push("scale(-1 1)"), s.top = s.left = 0) : F && (d.push("translate(" + (0 - s.left).toString() + " " + (s.height + s.top).toString() + ")"), d.push("scale(1 -1)"), s.top = s.left = 0);
|
|
440
|
+
let g;
|
|
441
|
+
switch (f < 0 && (f -= Math.floor(f / 4) * 4), f = f % 4, f) {
|
|
442
|
+
case 1:
|
|
443
|
+
g = s.height / 2 + s.top, d.unshift("rotate(90 " + g.toString() + " " + g.toString() + ")");
|
|
444
|
+
break;
|
|
445
|
+
case 2:
|
|
446
|
+
d.unshift("rotate(180 " + (s.width / 2 + s.left).toString() + " " + (s.height / 2 + s.top).toString() + ")");
|
|
447
|
+
break;
|
|
448
|
+
case 3:
|
|
449
|
+
g = s.width / 2 + s.left, d.unshift("rotate(-90 " + g.toString() + " " + g.toString() + ")");
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
f % 2 === 1 && (s.left !== s.top && (g = s.left, s.left = s.top, s.top = g), s.width !== s.height && (g = s.width, s.width = s.height, s.height = g)), d.length && (i = fn(i, '<g transform="' + d.join(" ") + '">', "</g>"));
|
|
453
|
+
});
|
|
454
|
+
const r = o.width, a = o.height, l = s.width, c = s.height;
|
|
455
|
+
let u, p;
|
|
456
|
+
r === null ? (p = a === null ? "1em" : a === "auto" ? c : a, u = ze(p, l / c)) : (u = r === "auto" ? l : r, p = a === null ? ze(u, c / l) : a === "auto" ? c : a);
|
|
457
|
+
const x = {}, k = (I, d) => {
|
|
458
|
+
dn(d) || (x[I] = d.toString());
|
|
459
|
+
};
|
|
460
|
+
k("width", u), k("height", p);
|
|
461
|
+
const T = [
|
|
462
|
+
s.left,
|
|
463
|
+
s.top,
|
|
464
|
+
l,
|
|
465
|
+
c
|
|
466
|
+
];
|
|
467
|
+
return x.viewBox = T.join(" "), {
|
|
468
|
+
attributes: x,
|
|
469
|
+
viewBox: T,
|
|
470
|
+
body: i
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
const hn = /\sid="(\S+)"/g, Qe = /* @__PURE__ */ new Map();
|
|
474
|
+
function mn(e) {
|
|
475
|
+
e = e.replace(/[0-9]+$/, "") || "a";
|
|
476
|
+
const t = Qe.get(e) || 0;
|
|
477
|
+
return Qe.set(e, t + 1), t ? `${e}${t}` : e;
|
|
478
|
+
}
|
|
479
|
+
function gn(e) {
|
|
480
|
+
const t = [];
|
|
481
|
+
let n;
|
|
482
|
+
for (; n = hn.exec(e); ) t.push(n[1]);
|
|
483
|
+
if (!t.length) return e;
|
|
484
|
+
const o = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
|
485
|
+
return t.forEach((s) => {
|
|
486
|
+
const i = mn(s), r = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
487
|
+
e = e.replace(new RegExp('([#;"])(' + r + ')([")]|\\.[a-z])', "g"), "$1" + i + o + "$3");
|
|
488
|
+
}), e = e.replace(new RegExp(o, "g"), ""), e;
|
|
489
|
+
}
|
|
490
|
+
const Ie = /* @__PURE__ */ Object.create(null);
|
|
491
|
+
function vn(e, t) {
|
|
492
|
+
Ie[e] = t;
|
|
493
|
+
}
|
|
494
|
+
function Se(e) {
|
|
495
|
+
return Ie[e] || Ie[""];
|
|
496
|
+
}
|
|
497
|
+
function Ce(e) {
|
|
498
|
+
let t;
|
|
499
|
+
if (typeof e.resources == "string") t = [e.resources];
|
|
500
|
+
else if (t = e.resources, !(t instanceof Array) || !t.length) return null;
|
|
501
|
+
return {
|
|
502
|
+
resources: t,
|
|
503
|
+
path: e.path || "/",
|
|
504
|
+
maxURL: e.maxURL || 500,
|
|
505
|
+
rotate: e.rotate || 750,
|
|
506
|
+
timeout: e.timeout || 5e3,
|
|
507
|
+
random: e.random === !0,
|
|
508
|
+
index: e.index || 0,
|
|
509
|
+
dataAfterTimeout: e.dataAfterTimeout !== !1
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
const Oe = /* @__PURE__ */ Object.create(null), ee = ["https://api.simplesvg.com", "https://api.unisvg.com"], ce = [];
|
|
513
|
+
for (; ee.length > 0; ) ee.length === 1 || Math.random() > 0.5 ? ce.push(ee.shift()) : ce.push(ee.pop());
|
|
514
|
+
Oe[""] = Ce({ resources: ["https://api.iconify.design"].concat(ce) });
|
|
515
|
+
function yn(e, t) {
|
|
516
|
+
const n = Ce(t);
|
|
517
|
+
return n === null ? !1 : (Oe[e] = n, !0);
|
|
518
|
+
}
|
|
519
|
+
function Le(e) {
|
|
520
|
+
return Oe[e];
|
|
521
|
+
}
|
|
522
|
+
const wn = () => {
|
|
523
|
+
let e;
|
|
524
|
+
try {
|
|
525
|
+
if (e = fetch, typeof e == "function") return e;
|
|
526
|
+
} catch {
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
let Ue = wn();
|
|
530
|
+
function xn(e, t) {
|
|
531
|
+
const n = Le(e);
|
|
532
|
+
if (!n) return 0;
|
|
533
|
+
let o;
|
|
534
|
+
if (!n.maxURL) o = 0;
|
|
535
|
+
else {
|
|
536
|
+
let s = 0;
|
|
537
|
+
n.resources.forEach((r) => {
|
|
538
|
+
s = Math.max(s, r.length);
|
|
539
|
+
});
|
|
540
|
+
const i = t + ".json?icons=";
|
|
541
|
+
o = n.maxURL - s - n.path.length - i.length;
|
|
542
|
+
}
|
|
543
|
+
return o;
|
|
544
|
+
}
|
|
545
|
+
function bn(e) {
|
|
546
|
+
return e === 404;
|
|
547
|
+
}
|
|
548
|
+
const kn = (e, t, n) => {
|
|
549
|
+
const o = [], s = xn(e, t), i = "icons";
|
|
550
|
+
let r = {
|
|
551
|
+
type: i,
|
|
552
|
+
provider: e,
|
|
553
|
+
prefix: t,
|
|
554
|
+
icons: []
|
|
555
|
+
}, a = 0;
|
|
556
|
+
return n.forEach((l, c) => {
|
|
557
|
+
a += l.length + 1, a >= s && c > 0 && (o.push(r), r = {
|
|
558
|
+
type: i,
|
|
559
|
+
provider: e,
|
|
560
|
+
prefix: t,
|
|
561
|
+
icons: []
|
|
562
|
+
}, a = l.length), r.icons.push(l);
|
|
563
|
+
}), o.push(r), o;
|
|
564
|
+
};
|
|
565
|
+
function Tn(e) {
|
|
566
|
+
if (typeof e == "string") {
|
|
567
|
+
const t = Le(e);
|
|
568
|
+
if (t) return t.path;
|
|
569
|
+
}
|
|
570
|
+
return "/";
|
|
571
|
+
}
|
|
572
|
+
const In = (e, t, n) => {
|
|
573
|
+
if (!Ue) {
|
|
574
|
+
n("abort", 424);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
let o = Tn(t.provider);
|
|
578
|
+
switch (t.type) {
|
|
579
|
+
case "icons": {
|
|
580
|
+
const i = t.prefix, r = t.icons.join(","), a = new URLSearchParams({ icons: r });
|
|
581
|
+
o += i + ".json?" + a.toString();
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
case "custom": {
|
|
585
|
+
const i = t.uri;
|
|
586
|
+
o += i.slice(0, 1) === "/" ? i.slice(1) : i;
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
default:
|
|
590
|
+
n("abort", 400);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
let s = 503;
|
|
594
|
+
Ue(e + o).then((i) => {
|
|
595
|
+
const r = i.status;
|
|
596
|
+
if (r !== 200) {
|
|
597
|
+
setTimeout(() => {
|
|
598
|
+
n(bn(r) ? "abort" : "next", r);
|
|
599
|
+
});
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
return s = 501, i.json();
|
|
603
|
+
}).then((i) => {
|
|
604
|
+
if (typeof i != "object" || i === null) {
|
|
605
|
+
setTimeout(() => {
|
|
606
|
+
i === 404 ? n("abort", i) : n("next", s);
|
|
607
|
+
});
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
setTimeout(() => {
|
|
611
|
+
n("success", i);
|
|
612
|
+
});
|
|
613
|
+
}).catch(() => {
|
|
614
|
+
n("next", s);
|
|
615
|
+
});
|
|
616
|
+
}, Sn = {
|
|
617
|
+
prepare: kn,
|
|
618
|
+
send: In
|
|
619
|
+
};
|
|
620
|
+
function bt(e, t) {
|
|
621
|
+
e.forEach((n) => {
|
|
622
|
+
const o = n.loaderCallbacks;
|
|
623
|
+
o && (n.loaderCallbacks = o.filter((s) => s.id !== t));
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
function Pn(e) {
|
|
627
|
+
e.pendingCallbacksFlag || (e.pendingCallbacksFlag = !0, setTimeout(() => {
|
|
628
|
+
e.pendingCallbacksFlag = !1;
|
|
629
|
+
const t = e.loaderCallbacks ? e.loaderCallbacks.slice(0) : [];
|
|
630
|
+
if (!t.length) return;
|
|
631
|
+
let n = !1;
|
|
632
|
+
const o = e.provider, s = e.prefix;
|
|
633
|
+
t.forEach((i) => {
|
|
634
|
+
const r = i.icons, a = r.pending.length;
|
|
635
|
+
r.pending = r.pending.filter((l) => {
|
|
636
|
+
if (l.prefix !== s) return !0;
|
|
637
|
+
const c = l.name;
|
|
638
|
+
if (e.icons[c]) r.loaded.push({
|
|
639
|
+
provider: o,
|
|
640
|
+
prefix: s,
|
|
641
|
+
name: c
|
|
642
|
+
});
|
|
643
|
+
else if (e.missing.has(c)) r.missing.push({
|
|
644
|
+
provider: o,
|
|
645
|
+
prefix: s,
|
|
646
|
+
name: c
|
|
647
|
+
});
|
|
648
|
+
else
|
|
649
|
+
return n = !0, !0;
|
|
650
|
+
return !1;
|
|
651
|
+
}), r.pending.length !== a && (n || bt([e], i.id), i.callback(r.loaded.slice(0), r.missing.slice(0), r.pending.slice(0), i.abort));
|
|
652
|
+
});
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
655
|
+
let En = 0;
|
|
656
|
+
function An(e, t, n) {
|
|
657
|
+
const o = En++, s = bt.bind(null, n, o);
|
|
658
|
+
if (!t.pending.length) return s;
|
|
659
|
+
const i = {
|
|
660
|
+
id: o,
|
|
661
|
+
icons: t,
|
|
662
|
+
callback: e,
|
|
663
|
+
abort: s
|
|
664
|
+
};
|
|
665
|
+
return n.forEach((r) => {
|
|
666
|
+
(r.loaderCallbacks || (r.loaderCallbacks = [])).push(i);
|
|
667
|
+
}), s;
|
|
668
|
+
}
|
|
669
|
+
function Cn(e) {
|
|
670
|
+
const t = {
|
|
671
|
+
loaded: [],
|
|
672
|
+
missing: [],
|
|
673
|
+
pending: []
|
|
674
|
+
}, n = /* @__PURE__ */ Object.create(null);
|
|
675
|
+
e.sort((s, i) => s.provider !== i.provider ? s.provider.localeCompare(i.provider) : s.prefix !== i.prefix ? s.prefix.localeCompare(i.prefix) : s.name.localeCompare(i.name));
|
|
676
|
+
let o = {
|
|
677
|
+
provider: "",
|
|
678
|
+
prefix: "",
|
|
679
|
+
name: ""
|
|
680
|
+
};
|
|
681
|
+
return e.forEach((s) => {
|
|
682
|
+
if (o.name === s.name && o.prefix === s.prefix && o.provider === s.provider) return;
|
|
683
|
+
o = s;
|
|
684
|
+
const i = s.provider, r = s.prefix, a = s.name, l = n[i] || (n[i] = /* @__PURE__ */ Object.create(null)), c = l[r] || (l[r] = G(i, r));
|
|
685
|
+
let u;
|
|
686
|
+
a in c.icons ? u = t.loaded : r === "" || c.missing.has(a) ? u = t.missing : u = t.pending;
|
|
687
|
+
const p = {
|
|
688
|
+
provider: i,
|
|
689
|
+
prefix: r,
|
|
690
|
+
name: a
|
|
691
|
+
};
|
|
692
|
+
u.push(p);
|
|
693
|
+
}), t;
|
|
694
|
+
}
|
|
695
|
+
function On(e, t = !0, n = !1) {
|
|
696
|
+
const o = [];
|
|
697
|
+
return e.forEach((s) => {
|
|
698
|
+
const i = typeof s == "string" ? ge(s, t, n) : s;
|
|
699
|
+
i && o.push(i);
|
|
700
|
+
}), o;
|
|
701
|
+
}
|
|
702
|
+
const Ln = {
|
|
703
|
+
resources: [],
|
|
704
|
+
index: 0,
|
|
705
|
+
timeout: 2e3,
|
|
706
|
+
rotate: 750,
|
|
707
|
+
random: !1,
|
|
708
|
+
dataAfterTimeout: !1
|
|
709
|
+
};
|
|
710
|
+
function Dn(e, t, n, o) {
|
|
711
|
+
const s = e.resources.length, i = e.random ? Math.floor(Math.random() * s) : e.index;
|
|
712
|
+
let r;
|
|
713
|
+
if (e.random) {
|
|
714
|
+
let v = e.resources.slice(0);
|
|
715
|
+
for (r = []; v.length > 1; ) {
|
|
716
|
+
const P = Math.floor(Math.random() * v.length);
|
|
717
|
+
r.push(v[P]), v = v.slice(0, P).concat(v.slice(P + 1));
|
|
718
|
+
}
|
|
719
|
+
r = r.concat(v);
|
|
720
|
+
} else r = e.resources.slice(i).concat(e.resources.slice(0, i));
|
|
721
|
+
const a = Date.now();
|
|
722
|
+
let l = "pending", c = 0, u, p = null, x = [], k = [];
|
|
723
|
+
typeof o == "function" && k.push(o);
|
|
724
|
+
function T() {
|
|
725
|
+
p && (clearTimeout(p), p = null);
|
|
726
|
+
}
|
|
727
|
+
function I() {
|
|
728
|
+
l === "pending" && (l = "aborted"), T(), x.forEach((v) => {
|
|
729
|
+
v.status === "pending" && (v.status = "aborted");
|
|
730
|
+
}), x = [];
|
|
731
|
+
}
|
|
732
|
+
function d(v, P) {
|
|
733
|
+
P && (k = []), typeof v == "function" && k.push(v);
|
|
734
|
+
}
|
|
735
|
+
function D() {
|
|
736
|
+
return {
|
|
737
|
+
startTime: a,
|
|
738
|
+
payload: t,
|
|
739
|
+
status: l,
|
|
740
|
+
queriesSent: c,
|
|
741
|
+
queriesPending: x.length,
|
|
742
|
+
subscribe: d,
|
|
743
|
+
abort: I
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
function F() {
|
|
747
|
+
l = "failed", k.forEach((v) => {
|
|
748
|
+
v(void 0, u);
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
function f() {
|
|
752
|
+
x.forEach((v) => {
|
|
753
|
+
v.status === "pending" && (v.status = "aborted");
|
|
754
|
+
}), x = [];
|
|
755
|
+
}
|
|
756
|
+
function g(v, P, h) {
|
|
757
|
+
const w = P !== "success";
|
|
758
|
+
switch (x = x.filter((y) => y !== v), l) {
|
|
759
|
+
case "pending":
|
|
760
|
+
break;
|
|
761
|
+
case "failed":
|
|
762
|
+
if (w || !e.dataAfterTimeout) return;
|
|
763
|
+
break;
|
|
764
|
+
default:
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (P === "abort") {
|
|
768
|
+
u = h, F();
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
if (w) {
|
|
772
|
+
u = h, x.length || (r.length ? C() : F());
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
if (T(), f(), !e.random) {
|
|
776
|
+
const y = e.resources.indexOf(v.resource);
|
|
777
|
+
y !== -1 && y !== e.index && (e.index = y);
|
|
778
|
+
}
|
|
779
|
+
l = "completed", k.forEach((y) => {
|
|
780
|
+
y(h);
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
function C() {
|
|
784
|
+
if (l !== "pending") return;
|
|
785
|
+
T();
|
|
786
|
+
const v = r.shift();
|
|
787
|
+
if (v === void 0) {
|
|
788
|
+
if (x.length) {
|
|
789
|
+
p = setTimeout(() => {
|
|
790
|
+
T(), l === "pending" && (f(), F());
|
|
791
|
+
}, e.timeout);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
F();
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
const P = {
|
|
798
|
+
status: "pending",
|
|
799
|
+
resource: v,
|
|
800
|
+
callback: (h, w) => {
|
|
801
|
+
g(P, h, w);
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
x.push(P), c++, p = setTimeout(C, e.rotate), n(v, t, P.callback);
|
|
805
|
+
}
|
|
806
|
+
return setTimeout(C), D;
|
|
807
|
+
}
|
|
808
|
+
function kt(e) {
|
|
809
|
+
const t = {
|
|
810
|
+
...Ln,
|
|
811
|
+
...e
|
|
812
|
+
};
|
|
813
|
+
let n = [];
|
|
814
|
+
function o() {
|
|
815
|
+
n = n.filter((r) => r().status === "pending");
|
|
816
|
+
}
|
|
817
|
+
function s(r, a, l) {
|
|
818
|
+
const c = Dn(t, r, a, (u, p) => {
|
|
819
|
+
o(), l && l(u, p);
|
|
820
|
+
});
|
|
821
|
+
return n.push(c), c;
|
|
822
|
+
}
|
|
823
|
+
function i(r) {
|
|
824
|
+
return n.find((a) => r(a)) || null;
|
|
825
|
+
}
|
|
826
|
+
return {
|
|
827
|
+
query: s,
|
|
828
|
+
find: i,
|
|
829
|
+
setIndex: (r) => {
|
|
830
|
+
t.index = r;
|
|
831
|
+
},
|
|
832
|
+
getIndex: () => t.index,
|
|
833
|
+
cleanup: o
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function Ye() {
|
|
837
|
+
}
|
|
838
|
+
const we = /* @__PURE__ */ Object.create(null);
|
|
839
|
+
function Fn(e) {
|
|
840
|
+
if (!we[e]) {
|
|
841
|
+
const t = Le(e);
|
|
842
|
+
if (!t) return;
|
|
843
|
+
we[e] = {
|
|
844
|
+
config: t,
|
|
845
|
+
redundancy: kt(t)
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
return we[e];
|
|
849
|
+
}
|
|
850
|
+
function Mn(e, t, n) {
|
|
851
|
+
let o, s;
|
|
852
|
+
if (typeof e == "string") {
|
|
853
|
+
const i = Se(e);
|
|
854
|
+
if (!i)
|
|
855
|
+
return n(void 0, 424), Ye;
|
|
856
|
+
s = i.send;
|
|
857
|
+
const r = Fn(e);
|
|
858
|
+
r && (o = r.redundancy);
|
|
859
|
+
} else {
|
|
860
|
+
const i = Ce(e);
|
|
861
|
+
if (i) {
|
|
862
|
+
o = kt(i);
|
|
863
|
+
const r = Se(e.resources ? e.resources[0] : "");
|
|
864
|
+
r && (s = r.send);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return !o || !s ? (n(void 0, 424), Ye) : o.query(t, s, n)().abort;
|
|
868
|
+
}
|
|
869
|
+
function Ge() {
|
|
870
|
+
}
|
|
871
|
+
function jn(e) {
|
|
872
|
+
e.iconsLoaderFlag || (e.iconsLoaderFlag = !0, setTimeout(() => {
|
|
873
|
+
e.iconsLoaderFlag = !1, Pn(e);
|
|
874
|
+
}));
|
|
875
|
+
}
|
|
876
|
+
function Bn(e) {
|
|
877
|
+
const t = [], n = [];
|
|
878
|
+
return e.forEach((o) => {
|
|
879
|
+
(o.match(pt) ? t : n).push(o);
|
|
880
|
+
}), {
|
|
881
|
+
valid: t,
|
|
882
|
+
invalid: n
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function te(e, t, n) {
|
|
886
|
+
function o() {
|
|
887
|
+
const s = e.pendingIcons;
|
|
888
|
+
t.forEach((i) => {
|
|
889
|
+
s && s.delete(i), e.icons[i] || e.missing.add(i);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
if (n && typeof n == "object") try {
|
|
893
|
+
if (!vt(e, n).length) {
|
|
894
|
+
o();
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
} catch (s) {
|
|
898
|
+
console.error(s);
|
|
899
|
+
}
|
|
900
|
+
o(), jn(e);
|
|
901
|
+
}
|
|
902
|
+
function Xe(e, t) {
|
|
903
|
+
e instanceof Promise ? e.then((n) => {
|
|
904
|
+
t(n);
|
|
905
|
+
}).catch(() => {
|
|
906
|
+
t(null);
|
|
907
|
+
}) : t(e);
|
|
908
|
+
}
|
|
909
|
+
function Rn(e, t) {
|
|
910
|
+
e.iconsToLoad ? e.iconsToLoad = e.iconsToLoad.concat(t).sort() : e.iconsToLoad = t, e.iconsQueueFlag || (e.iconsQueueFlag = !0, setTimeout(() => {
|
|
911
|
+
e.iconsQueueFlag = !1;
|
|
912
|
+
const { provider: n, prefix: o } = e, s = e.iconsToLoad;
|
|
913
|
+
if (delete e.iconsToLoad, !s || !s.length) return;
|
|
914
|
+
const i = e.loadIcon;
|
|
915
|
+
if (e.loadIcons && (s.length > 1 || !i)) {
|
|
916
|
+
Xe(e.loadIcons(s, o, n), (c) => {
|
|
917
|
+
te(e, s, c);
|
|
918
|
+
});
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
if (i) {
|
|
922
|
+
s.forEach((c) => {
|
|
923
|
+
Xe(i(c, o, n), (u) => {
|
|
924
|
+
te(e, [c], u ? {
|
|
925
|
+
prefix: o,
|
|
926
|
+
icons: { [c]: u }
|
|
927
|
+
} : null);
|
|
928
|
+
});
|
|
929
|
+
});
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
const { valid: r, invalid: a } = Bn(s);
|
|
933
|
+
if (a.length && te(e, a, null), !r.length) return;
|
|
934
|
+
const l = o.match(pt) ? Se(n) : null;
|
|
935
|
+
if (!l) {
|
|
936
|
+
te(e, r, null);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
l.prepare(n, o, r).forEach((c) => {
|
|
940
|
+
Mn(n, c, (u) => {
|
|
941
|
+
te(e, c.icons, u);
|
|
942
|
+
});
|
|
943
|
+
});
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
const $n = (e, t) => {
|
|
947
|
+
const n = Cn(On(e, !0, yt()));
|
|
948
|
+
if (!n.pending.length) {
|
|
949
|
+
let a = !0;
|
|
950
|
+
return t && setTimeout(() => {
|
|
951
|
+
a && t(n.loaded, n.missing, n.pending, Ge);
|
|
952
|
+
}), () => {
|
|
953
|
+
a = !1;
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
const o = /* @__PURE__ */ Object.create(null), s = [];
|
|
957
|
+
let i, r;
|
|
958
|
+
return n.pending.forEach((a) => {
|
|
959
|
+
const { provider: l, prefix: c } = a;
|
|
960
|
+
if (c === r && l === i) return;
|
|
961
|
+
i = l, r = c, s.push(G(l, c));
|
|
962
|
+
const u = o[l] || (o[l] = /* @__PURE__ */ Object.create(null));
|
|
963
|
+
u[c] || (u[c] = []);
|
|
964
|
+
}), n.pending.forEach((a) => {
|
|
965
|
+
const { provider: l, prefix: c, name: u } = a, p = G(l, c), x = p.pendingIcons || (p.pendingIcons = /* @__PURE__ */ new Set());
|
|
966
|
+
x.has(u) || (x.add(u), o[l][c].push(u));
|
|
967
|
+
}), s.forEach((a) => {
|
|
968
|
+
const l = o[a.provider][a.prefix];
|
|
969
|
+
l.length && Rn(a, l);
|
|
970
|
+
}), t ? An(t, n, s) : Ge;
|
|
971
|
+
};
|
|
972
|
+
function Nn(e, t) {
|
|
973
|
+
const n = { ...e };
|
|
974
|
+
for (const o in t) {
|
|
975
|
+
const s = t[o], i = typeof s;
|
|
976
|
+
o in wt ? (s === null || s && (i === "string" || i === "number")) && (n[o] = s) : i === typeof n[o] && (n[o] = o === "rotate" ? s % 4 : s);
|
|
977
|
+
}
|
|
978
|
+
return n;
|
|
979
|
+
}
|
|
980
|
+
const Hn = /[\s,]+/;
|
|
981
|
+
function qn(e, t) {
|
|
982
|
+
t.split(Hn).forEach((n) => {
|
|
983
|
+
switch (n.trim()) {
|
|
984
|
+
case "horizontal":
|
|
985
|
+
e.hFlip = !0;
|
|
986
|
+
break;
|
|
987
|
+
case "vertical":
|
|
988
|
+
e.vFlip = !0;
|
|
989
|
+
break;
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
function Vn(e, t = 0) {
|
|
994
|
+
const n = e.replace(/^-?[0-9.]*/, "");
|
|
995
|
+
function o(s) {
|
|
996
|
+
for (; s < 0; ) s += 4;
|
|
997
|
+
return s % 4;
|
|
998
|
+
}
|
|
999
|
+
if (n === "") {
|
|
1000
|
+
const s = parseInt(e);
|
|
1001
|
+
return isNaN(s) ? 0 : o(s);
|
|
1002
|
+
} else if (n !== e) {
|
|
1003
|
+
let s = 0;
|
|
1004
|
+
switch (n) {
|
|
1005
|
+
case "%":
|
|
1006
|
+
s = 25;
|
|
1007
|
+
break;
|
|
1008
|
+
case "deg":
|
|
1009
|
+
s = 90;
|
|
1010
|
+
}
|
|
1011
|
+
if (s) {
|
|
1012
|
+
let i = parseFloat(e.slice(0, e.length - n.length));
|
|
1013
|
+
return isNaN(i) ? 0 : (i = i / s, i % 1 === 0 ? o(i) : 0);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
return t;
|
|
1017
|
+
}
|
|
1018
|
+
function zn(e, t) {
|
|
1019
|
+
let n = e.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
|
|
1020
|
+
for (const o in t) n += " " + o + '="' + t[o] + '"';
|
|
1021
|
+
return '<svg xmlns="http://www.w3.org/2000/svg"' + n + ">" + e + "</svg>";
|
|
1022
|
+
}
|
|
1023
|
+
function Qn(e) {
|
|
1024
|
+
return e.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
|
1025
|
+
}
|
|
1026
|
+
function Un(e) {
|
|
1027
|
+
return "data:image/svg+xml," + Qn(e);
|
|
1028
|
+
}
|
|
1029
|
+
function Yn(e) {
|
|
1030
|
+
return 'url("' + Un(e) + '")';
|
|
1031
|
+
}
|
|
1032
|
+
const We = {
|
|
1033
|
+
...xt,
|
|
1034
|
+
inline: !1
|
|
1035
|
+
}, Gn = {
|
|
1036
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1037
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1038
|
+
"aria-hidden": !0,
|
|
1039
|
+
role: "img"
|
|
1040
|
+
}, Xn = {
|
|
1041
|
+
display: "inline-block"
|
|
1042
|
+
}, Pe = {
|
|
1043
|
+
backgroundColor: "currentColor"
|
|
1044
|
+
}, Tt = {
|
|
1045
|
+
backgroundColor: "transparent"
|
|
1046
|
+
}, Ke = {
|
|
1047
|
+
Image: "var(--svg)",
|
|
1048
|
+
Repeat: "no-repeat",
|
|
1049
|
+
Size: "100% 100%"
|
|
1050
|
+
}, Je = {
|
|
1051
|
+
webkitMask: Pe,
|
|
1052
|
+
mask: Pe,
|
|
1053
|
+
background: Tt
|
|
1054
|
+
};
|
|
1055
|
+
for (const e in Je) {
|
|
1056
|
+
const t = Je[e];
|
|
1057
|
+
for (const n in Ke)
|
|
1058
|
+
t[e + n] = Ke[n];
|
|
1059
|
+
}
|
|
1060
|
+
const le = {};
|
|
1061
|
+
["horizontal", "vertical"].forEach((e) => {
|
|
1062
|
+
const t = e.slice(0, 1) + "Flip";
|
|
1063
|
+
le[e + "-flip"] = t, le[e.slice(0, 1) + "-flip"] = t, le[e + "Flip"] = t;
|
|
1064
|
+
});
|
|
1065
|
+
function Ze(e) {
|
|
1066
|
+
return e + (e.match(/^[-0-9.]+$/) ? "px" : "");
|
|
1067
|
+
}
|
|
1068
|
+
const _e = (e, t) => {
|
|
1069
|
+
const n = Nn(We, t), o = { ...Gn }, s = t.mode || "svg", i = {}, r = t.style, a = typeof r == "object" && !(r instanceof Array) ? r : {};
|
|
1070
|
+
for (let I in t) {
|
|
1071
|
+
const d = t[I];
|
|
1072
|
+
if (d !== void 0)
|
|
1073
|
+
switch (I) {
|
|
1074
|
+
case "icon":
|
|
1075
|
+
case "style":
|
|
1076
|
+
case "onLoad":
|
|
1077
|
+
case "mode":
|
|
1078
|
+
case "ssr":
|
|
1079
|
+
case "customise":
|
|
1080
|
+
break;
|
|
1081
|
+
case "inline":
|
|
1082
|
+
case "hFlip":
|
|
1083
|
+
case "vFlip":
|
|
1084
|
+
n[I] = d === !0 || d === "true" || d === 1;
|
|
1085
|
+
break;
|
|
1086
|
+
case "flip":
|
|
1087
|
+
typeof d == "string" && qn(n, d);
|
|
1088
|
+
break;
|
|
1089
|
+
case "color":
|
|
1090
|
+
i.color = d;
|
|
1091
|
+
break;
|
|
1092
|
+
case "rotate":
|
|
1093
|
+
typeof d == "string" ? n[I] = Vn(d) : typeof d == "number" && (n[I] = d);
|
|
1094
|
+
break;
|
|
1095
|
+
case "ariaHidden":
|
|
1096
|
+
case "aria-hidden":
|
|
1097
|
+
d !== !0 && d !== "true" && delete o["aria-hidden"];
|
|
1098
|
+
break;
|
|
1099
|
+
default: {
|
|
1100
|
+
const D = le[I];
|
|
1101
|
+
D ? (d === !0 || d === "true" || d === 1) && (n[D] = !0) : We[I] === void 0 && (o[I] = d);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
const l = pn(e, n), c = l.attributes;
|
|
1106
|
+
if (n.inline && (i.verticalAlign = "-0.125em"), s === "svg")
|
|
1107
|
+
return o.style = {
|
|
1108
|
+
...i,
|
|
1109
|
+
...a
|
|
1110
|
+
}, Object.assign(o, c), o.innerHTML = gn(l.body), xe("svg", o);
|
|
1111
|
+
const { body: u, width: p, height: x } = e, k = s === "mask" || (s === "bg" ? !1 : u.indexOf("currentColor") !== -1), T = zn(u, {
|
|
1112
|
+
...c,
|
|
1113
|
+
width: p + "",
|
|
1114
|
+
height: x + ""
|
|
1115
|
+
});
|
|
1116
|
+
return o.style = {
|
|
1117
|
+
...i,
|
|
1118
|
+
"--svg": Yn(T),
|
|
1119
|
+
width: Ze(c.width),
|
|
1120
|
+
height: Ze(c.height),
|
|
1121
|
+
...Xn,
|
|
1122
|
+
...k ? Pe : Tt,
|
|
1123
|
+
...a
|
|
1124
|
+
}, xe("span", o);
|
|
1125
|
+
};
|
|
1126
|
+
yt(!0);
|
|
1127
|
+
vn("", Sn);
|
|
1128
|
+
if (typeof document < "u" && typeof window < "u") {
|
|
1129
|
+
const e = window;
|
|
1130
|
+
if (e.IconifyPreload !== void 0) {
|
|
1131
|
+
const t = e.IconifyPreload, n = "Invalid IconifyPreload syntax.";
|
|
1132
|
+
typeof t == "object" && t !== null && (t instanceof Array ? t : [t]).forEach((o) => {
|
|
1133
|
+
try {
|
|
1134
|
+
// Check if item is an object and not null/array
|
|
1135
|
+
(typeof o != "object" || o === null || o instanceof Array || // Check for 'icons' and 'prefix'
|
|
1136
|
+
typeof o.icons != "object" || typeof o.prefix != "string" || // Add icon set
|
|
1137
|
+
!rn(o)) && console.error(n);
|
|
1138
|
+
} catch {
|
|
1139
|
+
console.error(n);
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
if (e.IconifyProviders !== void 0) {
|
|
1144
|
+
const t = e.IconifyProviders;
|
|
1145
|
+
if (typeof t == "object" && t !== null)
|
|
1146
|
+
for (let n in t) {
|
|
1147
|
+
const o = "IconifyProviders[" + n + "] is invalid.";
|
|
1148
|
+
try {
|
|
1149
|
+
const s = t[n];
|
|
1150
|
+
if (typeof s != "object" || !s || s.resources === void 0)
|
|
1151
|
+
continue;
|
|
1152
|
+
yn(n, s) || console.error(o);
|
|
1153
|
+
} catch {
|
|
1154
|
+
console.error(o);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
const Wn = {
|
|
1160
|
+
...ve,
|
|
1161
|
+
body: ""
|
|
1162
|
+
}, It = X((e, { emit: t }) => {
|
|
1163
|
+
const n = O(null);
|
|
1164
|
+
function o() {
|
|
1165
|
+
var c, u;
|
|
1166
|
+
n.value && ((u = (c = n.value).abort) == null || u.call(c), n.value = null);
|
|
1167
|
+
}
|
|
1168
|
+
const s = O(!!e.ssr), i = O(""), r = At(null);
|
|
1169
|
+
function a() {
|
|
1170
|
+
const c = e.icon;
|
|
1171
|
+
if (typeof c == "object" && c !== null && typeof c.body == "string")
|
|
1172
|
+
return i.value = "", {
|
|
1173
|
+
data: c
|
|
1174
|
+
};
|
|
1175
|
+
let u;
|
|
1176
|
+
if (typeof c != "string" || (u = ge(c, !1, !0)) === null)
|
|
1177
|
+
return null;
|
|
1178
|
+
let p = sn(u);
|
|
1179
|
+
if (!p) {
|
|
1180
|
+
const T = n.value;
|
|
1181
|
+
return (!T || T.name !== c) && (p === null ? n.value = {
|
|
1182
|
+
name: c
|
|
1183
|
+
} : n.value = {
|
|
1184
|
+
name: c,
|
|
1185
|
+
abort: $n([u], l)
|
|
1186
|
+
}), null;
|
|
1187
|
+
}
|
|
1188
|
+
o(), i.value !== c && (i.value = c, Ee(() => {
|
|
1189
|
+
t("load", c);
|
|
1190
|
+
}));
|
|
1191
|
+
const x = e.customise;
|
|
1192
|
+
if (x) {
|
|
1193
|
+
p = Object.assign({}, p);
|
|
1194
|
+
const T = x(p.body, u.name, u.prefix, u.provider);
|
|
1195
|
+
typeof T == "string" && (p.body = T);
|
|
1196
|
+
}
|
|
1197
|
+
const k = ["iconify"];
|
|
1198
|
+
return u.prefix !== "" && k.push("iconify--" + u.prefix), u.provider !== "" && k.push("iconify--" + u.provider), { data: p, classes: k };
|
|
1199
|
+
}
|
|
1200
|
+
function l() {
|
|
1201
|
+
var u;
|
|
1202
|
+
const c = a();
|
|
1203
|
+
c ? c.data !== ((u = r.value) == null ? void 0 : u.data) && (r.value = c) : r.value = null;
|
|
1204
|
+
}
|
|
1205
|
+
return s.value ? l() : he(() => {
|
|
1206
|
+
s.value = !0, l();
|
|
1207
|
+
}), N(() => e.icon, l), me(o), () => {
|
|
1208
|
+
const c = r.value;
|
|
1209
|
+
if (!c)
|
|
1210
|
+
return _e(Wn, e);
|
|
1211
|
+
let u = e;
|
|
1212
|
+
return c.classes && (u = {
|
|
1213
|
+
...e,
|
|
1214
|
+
class: c.classes.join(" ")
|
|
1215
|
+
}), _e({
|
|
1216
|
+
...ve,
|
|
1217
|
+
...c.data
|
|
1218
|
+
}, u);
|
|
1219
|
+
};
|
|
1220
|
+
}, {
|
|
1221
|
+
props: [
|
|
1222
|
+
// Icon and render mode
|
|
1223
|
+
"icon",
|
|
1224
|
+
"mode",
|
|
1225
|
+
"ssr",
|
|
1226
|
+
// Layout and style
|
|
1227
|
+
"width",
|
|
1228
|
+
"height",
|
|
1229
|
+
"style",
|
|
1230
|
+
"color",
|
|
1231
|
+
"inline",
|
|
1232
|
+
// Transformations
|
|
1233
|
+
"rotate",
|
|
1234
|
+
"hFlip",
|
|
1235
|
+
"horizontalFlip",
|
|
1236
|
+
"vFlip",
|
|
1237
|
+
"verticalFlip",
|
|
1238
|
+
"flip",
|
|
1239
|
+
// Misc
|
|
1240
|
+
"id",
|
|
1241
|
+
"ariaHidden",
|
|
1242
|
+
"customise",
|
|
1243
|
+
"title"
|
|
1244
|
+
],
|
|
1245
|
+
emits: ["load"]
|
|
1246
|
+
});
|
|
1247
|
+
let et = !1;
|
|
1248
|
+
const Y = {
|
|
1249
|
+
width: 24,
|
|
1250
|
+
height: 24
|
|
1251
|
+
}, St = () => {
|
|
1252
|
+
et || (et = !0, z("lucide:circle-check", {
|
|
1253
|
+
...Y,
|
|
1254
|
+
body: '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="m9 12l2 2l4-4"/></g>'
|
|
1255
|
+
}), z("lucide:circle-x", {
|
|
1256
|
+
...Y,
|
|
1257
|
+
body: '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="m15 9l-6 6m0-6l6 6"/></g>'
|
|
1258
|
+
}), z("lucide:triangle-alert", {
|
|
1259
|
+
...Y,
|
|
1260
|
+
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01"/>'
|
|
1261
|
+
}), z("lucide:info", {
|
|
1262
|
+
...Y,
|
|
1263
|
+
body: '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4m0-4h.01"/></g>'
|
|
1264
|
+
}), z("lucide:bell", {
|
|
1265
|
+
...Y,
|
|
1266
|
+
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.268 21a2 2 0 0 0 3.464 0m-10.47-5.674A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>'
|
|
1267
|
+
}), z("lucide:loader-circle", {
|
|
1268
|
+
...Y,
|
|
1269
|
+
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 1 1-6.219-8.56"/>'
|
|
1270
|
+
}));
|
|
1271
|
+
}, Kn = { class: "soft-toast-icon" }, tt = /* @__PURE__ */ X({
|
|
1272
|
+
__name: "ToastIcon",
|
|
1273
|
+
props: {
|
|
1274
|
+
type: {},
|
|
1275
|
+
customIcon: {}
|
|
1276
|
+
},
|
|
1277
|
+
setup(e) {
|
|
1278
|
+
St();
|
|
1279
|
+
const t = e, n = {
|
|
1280
|
+
success: "lucide:circle-check",
|
|
1281
|
+
error: "lucide:circle-x",
|
|
1282
|
+
warning: "lucide:triangle-alert",
|
|
1283
|
+
info: "lucide:info",
|
|
1284
|
+
default: "lucide:bell"
|
|
1285
|
+
}, o = () => t.customIcon ? t.customIcon : n[t.type] || n.default;
|
|
1286
|
+
return (s, i) => (S(), L("span", Kn, [
|
|
1287
|
+
Ae(at(It), {
|
|
1288
|
+
class: "soft-toast-icon-svg",
|
|
1289
|
+
icon: o(),
|
|
1290
|
+
width: 18,
|
|
1291
|
+
height: 18
|
|
1292
|
+
}, null, 8, ["icon"])
|
|
1293
|
+
]));
|
|
1294
|
+
}
|
|
1295
|
+
}), de = {
|
|
1296
|
+
smooth: {
|
|
1297
|
+
ease: "power3.out",
|
|
1298
|
+
elasticEase: "elastic.out(1, 0.5)",
|
|
1299
|
+
duration: 0.65
|
|
1300
|
+
},
|
|
1301
|
+
bouncy: {
|
|
1302
|
+
ease: "back.out(2)",
|
|
1303
|
+
elasticEase: "elastic.out(1.4, 0.45)",
|
|
1304
|
+
duration: 0.75
|
|
1305
|
+
},
|
|
1306
|
+
subtle: {
|
|
1307
|
+
ease: "power2.out",
|
|
1308
|
+
elasticEase: "back.out(1.2)",
|
|
1309
|
+
duration: 0.45
|
|
1310
|
+
},
|
|
1311
|
+
snappy: {
|
|
1312
|
+
ease: "back.out(3)",
|
|
1313
|
+
elasticEase: "elastic.out(1.1, 0.35)",
|
|
1314
|
+
duration: 0.5
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
A.defaults({ overwrite: "auto" });
|
|
1318
|
+
const Jn = 0.22, pe = "power2.out", Zn = (e) => {
|
|
1319
|
+
const t = 0.8 + e * 0.8, n = 0.55 - e * 0.15;
|
|
1320
|
+
return `elastic.out(${t.toFixed(2)}, ${n.toFixed(2)})`;
|
|
1321
|
+
}, _n = (e, t, n) => Math.max(t, Math.min(n, e)), nt = (e, t) => {
|
|
1322
|
+
const n = Number(A.getProperty(e, "y")) || 0, o = t.y - n, s = Math.abs(o);
|
|
1323
|
+
return s < 0.5 ? A.to(e, {
|
|
1324
|
+
y: t.y,
|
|
1325
|
+
scale: t.scale,
|
|
1326
|
+
opacity: t.opacity,
|
|
1327
|
+
force3D: !0,
|
|
1328
|
+
overwrite: !0,
|
|
1329
|
+
duration: Jn,
|
|
1330
|
+
ease: pe
|
|
1331
|
+
}) : A.to(e, {
|
|
1332
|
+
y: t.y,
|
|
1333
|
+
scale: t.scale,
|
|
1334
|
+
opacity: t.opacity,
|
|
1335
|
+
force3D: !0,
|
|
1336
|
+
overwrite: !0,
|
|
1337
|
+
duration: _n(0.34 + s * 3e-3, 0.36, 0.46),
|
|
1338
|
+
ease: "sine.out"
|
|
1339
|
+
});
|
|
1340
|
+
}, eo = (e, t = {}) => {
|
|
1341
|
+
const { direction: n = "up", preset: o = "smooth" } = t, s = de[o] || de.smooth, i = n === "down" ? -14 : 14, r = Math.min(s.duration, 0.46), a = o === "bouncy" ? "back.out(1.35)" : pe, l = A.timeline(), c = e.querySelector(".soft-toast-extra");
|
|
1342
|
+
return c && A.set(c, { height: 0, opacity: 0 }), l.fromTo(
|
|
1343
|
+
e,
|
|
1344
|
+
{ y: i, opacity: 0, scale: 0.94 },
|
|
1345
|
+
{
|
|
1346
|
+
y: 0,
|
|
1347
|
+
opacity: 1,
|
|
1348
|
+
scale: 1,
|
|
1349
|
+
duration: r,
|
|
1350
|
+
ease: a,
|
|
1351
|
+
transformOrigin: n === "down" ? "top center" : "bottom center"
|
|
1352
|
+
}
|
|
1353
|
+
), c && l.to(c, {
|
|
1354
|
+
height: "auto",
|
|
1355
|
+
opacity: 1,
|
|
1356
|
+
duration: 0.36,
|
|
1357
|
+
force3D: !0,
|
|
1358
|
+
ease: pe,
|
|
1359
|
+
clearProps: "overflow"
|
|
1360
|
+
}, "-=0.32"), l;
|
|
1361
|
+
}, to = (e) => A.to(e, {
|
|
1362
|
+
scale: 0.8,
|
|
1363
|
+
opacity: 0,
|
|
1364
|
+
force3D: !0,
|
|
1365
|
+
overwrite: "auto",
|
|
1366
|
+
duration: 0.25,
|
|
1367
|
+
ease: "power2.out"
|
|
1368
|
+
}), no = (e, t) => A.to(e, {
|
|
1369
|
+
x: t,
|
|
1370
|
+
opacity: 0,
|
|
1371
|
+
force3D: !0,
|
|
1372
|
+
overwrite: "auto",
|
|
1373
|
+
duration: 0.28,
|
|
1374
|
+
ease: "power3.out"
|
|
1375
|
+
}), ot = (e) => A.to(e, {
|
|
1376
|
+
x: 0,
|
|
1377
|
+
opacity: 1,
|
|
1378
|
+
force3D: !0,
|
|
1379
|
+
overwrite: "auto",
|
|
1380
|
+
duration: 0.55,
|
|
1381
|
+
ease: "elastic.out(1, 0.55)"
|
|
1382
|
+
}), oo = (e, t) => {
|
|
1383
|
+
const {
|
|
1384
|
+
index: n,
|
|
1385
|
+
expanded: o,
|
|
1386
|
+
preset: s = "smooth",
|
|
1387
|
+
bounce: i = 0.4,
|
|
1388
|
+
spring: r = !0,
|
|
1389
|
+
direction: a = "up",
|
|
1390
|
+
expandedOffset: l = 0,
|
|
1391
|
+
liftPx: c = 14,
|
|
1392
|
+
scaleStep: u = 0.055,
|
|
1393
|
+
opacityStep: p = 0.2,
|
|
1394
|
+
maxVisible: x = 3,
|
|
1395
|
+
reposition: k = !1
|
|
1396
|
+
} = t, T = de[s] || de.smooth, I = a === "up" ? -1 : 1;
|
|
1397
|
+
if (o) {
|
|
1398
|
+
const v = {
|
|
1399
|
+
y: l * I,
|
|
1400
|
+
scale: 1,
|
|
1401
|
+
opacity: 1
|
|
1402
|
+
};
|
|
1403
|
+
return k && r ? nt(e, v) : A.to(e, {
|
|
1404
|
+
...v,
|
|
1405
|
+
force3D: !0,
|
|
1406
|
+
overwrite: "auto",
|
|
1407
|
+
duration: 0.36,
|
|
1408
|
+
ease: pe
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
const d = n >= x, D = Math.min(n, x), F = D * c * I, f = 1 - D * u, g = d ? 0 : Math.max(0, 1 - D * p);
|
|
1412
|
+
if (k && r)
|
|
1413
|
+
return nt(e, {
|
|
1414
|
+
y: F,
|
|
1415
|
+
scale: f,
|
|
1416
|
+
opacity: g
|
|
1417
|
+
});
|
|
1418
|
+
const C = r ? Zn(i) : T.ease;
|
|
1419
|
+
return A.to(e, {
|
|
1420
|
+
y: F,
|
|
1421
|
+
scale: f,
|
|
1422
|
+
opacity: g,
|
|
1423
|
+
force3D: !0,
|
|
1424
|
+
overwrite: "auto",
|
|
1425
|
+
duration: T.duration * 0.85,
|
|
1426
|
+
ease: C
|
|
1427
|
+
});
|
|
1428
|
+
}, so = (e, t, n) => A.fromTo(
|
|
1429
|
+
e,
|
|
1430
|
+
{ scaleX: 1 },
|
|
1431
|
+
{ scaleX: 0, duration: t / 1e3, ease: "linear", onComplete: n }
|
|
1432
|
+
), st = (e) => e.pause(), io = (e) => e.play(), ro = (e) => A.killTweensOf(e), ao = { class: "soft-toast-progress" }, co = /* @__PURE__ */ X({
|
|
1433
|
+
__name: "ToastProgress",
|
|
1434
|
+
props: {
|
|
1435
|
+
remainingTime: {},
|
|
1436
|
+
totalDuration: {},
|
|
1437
|
+
isPaused: { type: Boolean }
|
|
1438
|
+
},
|
|
1439
|
+
setup(e) {
|
|
1440
|
+
const t = e, n = O(null), o = O(null);
|
|
1441
|
+
return he(() => {
|
|
1442
|
+
n.value && (o.value = so(
|
|
1443
|
+
n.value,
|
|
1444
|
+
t.remainingTime
|
|
1445
|
+
), t.isPaused && st(o.value));
|
|
1446
|
+
}), N(() => t.isPaused, (s) => {
|
|
1447
|
+
o.value && (s ? st(o.value) : io(o.value));
|
|
1448
|
+
}), me(() => {
|
|
1449
|
+
var s;
|
|
1450
|
+
(s = o.value) == null || s.kill();
|
|
1451
|
+
}), (s, i) => (S(), L("div", ao, [
|
|
1452
|
+
j(
|
|
1453
|
+
"div",
|
|
1454
|
+
{
|
|
1455
|
+
ref_key: "progressRef",
|
|
1456
|
+
ref: n,
|
|
1457
|
+
class: "soft-toast-progress-bar"
|
|
1458
|
+
},
|
|
1459
|
+
null,
|
|
1460
|
+
512
|
|
1461
|
+
/* NEED_PATCH */
|
|
1462
|
+
)
|
|
1463
|
+
]));
|
|
1464
|
+
}
|
|
1465
|
+
}), lo = ["data-type", "data-st-index", "data-leaving"], uo = ["data-position"], fo = { class: "soft-toast-content" }, po = {
|
|
1466
|
+
key: 0,
|
|
1467
|
+
class: "soft-toast-icon"
|
|
1468
|
+
}, ho = {
|
|
1469
|
+
key: 2,
|
|
1470
|
+
class: "soft-toast-icon"
|
|
1471
|
+
}, mo = { class: "soft-toast-body" }, go = { class: "soft-toast-header-row" }, vo = {
|
|
1472
|
+
key: 0,
|
|
1473
|
+
class: "soft-toast-extra",
|
|
1474
|
+
style: { overflow: "hidden" }
|
|
1475
|
+
}, yo = {
|
|
1476
|
+
key: 0,
|
|
1477
|
+
class: "soft-toast-description"
|
|
1478
|
+
}, wo = {
|
|
1479
|
+
key: 0,
|
|
1480
|
+
class: "soft-toast-action"
|
|
1481
|
+
}, xo = ["onClick"], bo = {
|
|
1482
|
+
key: 1,
|
|
1483
|
+
class: "soft-toast-action"
|
|
1484
|
+
}, ko = {
|
|
1485
|
+
class: "soft-toast-action-button soft-toast-action-success",
|
|
1486
|
+
style: { opacity: "0.75", cursor: "default" }
|
|
1487
|
+
}, To = {
|
|
1488
|
+
key: 1,
|
|
1489
|
+
class: "soft-toast-timestamp"
|
|
1490
|
+
}, Io = /* @__PURE__ */ X({
|
|
1491
|
+
__name: "ToastItem",
|
|
1492
|
+
props: {
|
|
1493
|
+
toast: {},
|
|
1494
|
+
closeButton: { type: [Boolean, String], default: !1 },
|
|
1495
|
+
swipeToDismiss: { type: Boolean, default: !0 },
|
|
1496
|
+
index: { default: 0 },
|
|
1497
|
+
total: { default: 1 },
|
|
1498
|
+
expanded: { type: Boolean, default: !1 },
|
|
1499
|
+
expandedOffset: { default: 0 },
|
|
1500
|
+
stackDirection: { default: "up" },
|
|
1501
|
+
reposition: { type: Boolean, default: !1 }
|
|
1502
|
+
},
|
|
1503
|
+
setup(e) {
|
|
1504
|
+
St();
|
|
1505
|
+
const t = e, n = O(null), o = O(!1), s = O("");
|
|
1506
|
+
let i = !1;
|
|
1507
|
+
const r = $(() => new Date(t.toast.createdAt).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })), a = () => {
|
|
1508
|
+
if (i || !n.value) return;
|
|
1509
|
+
i = !0, t.toast.isLeaving = !0, to(n.value).then(() => m.dismiss(t.toast.id));
|
|
1510
|
+
}, l = async (f) => {
|
|
1511
|
+
if (f)
|
|
1512
|
+
try {
|
|
1513
|
+
await f.onClick(), f.successLabel && (o.value = !0, s.value = f.successLabel, setTimeout(a, 1200));
|
|
1514
|
+
} catch {
|
|
1515
|
+
}
|
|
1516
|
+
}, c = $(() => t.toast.action ? Array.isArray(t.toast.action) ? t.toast.action : [t.toast.action] : []), u = (f = !1) => {
|
|
1517
|
+
!n.value || t.toast.isLeaving || oo(n.value, {
|
|
1518
|
+
index: t.index,
|
|
1519
|
+
expanded: t.expanded,
|
|
1520
|
+
preset: t.toast.preset,
|
|
1521
|
+
bounce: t.toast.bounce,
|
|
1522
|
+
spring: t.toast.spring,
|
|
1523
|
+
direction: t.stackDirection,
|
|
1524
|
+
expandedOffset: t.expandedOffset,
|
|
1525
|
+
reposition: f
|
|
1526
|
+
});
|
|
1527
|
+
};
|
|
1528
|
+
let p = 0, x = 0, k = !1, T = 0;
|
|
1529
|
+
const I = (f) => {
|
|
1530
|
+
!t.swipeToDismiss || i || f.pointerType === "mouse" && f.button !== 0 || f.target.closest("button, a") || (p = f.clientX, x = Date.now(), k = !0, T = 0, f.currentTarget.setPointerCapture(f.pointerId), m.pause(t.toast.id));
|
|
1531
|
+
}, d = (f) => {
|
|
1532
|
+
if (!k || !n.value) return;
|
|
1533
|
+
const g = f.clientX - p;
|
|
1534
|
+
T = g;
|
|
1535
|
+
const C = n.value.offsetWidth, v = Math.max(0, 1 - Math.abs(g) / (C * 0.7)), P = g / C * 6;
|
|
1536
|
+
A.set(n.value, { x: g, opacity: v, rotate: P, overwrite: "auto" });
|
|
1537
|
+
}, D = (f) => {
|
|
1538
|
+
if (!k || !n.value) return;
|
|
1539
|
+
k = !1;
|
|
1540
|
+
const g = T, C = Math.max(1, Date.now() - x), v = Math.abs(g) / C * 1e3, P = n.value.offsetWidth, h = P * 0.35;
|
|
1541
|
+
if (Math.abs(g) >= h || v >= 500) {
|
|
1542
|
+
i = !0, t.toast.isLeaving = !0;
|
|
1543
|
+
const w = g > 0 ? P * 1.6 : -P * 1.6;
|
|
1544
|
+
no(n.value, w).then(() => {
|
|
1545
|
+
m.remove(t.toast.id);
|
|
1546
|
+
});
|
|
1547
|
+
} else
|
|
1548
|
+
A.set(n.value, { rotate: 0 }), ot(n.value), m.resume(t.toast.id);
|
|
1549
|
+
}, F = () => {
|
|
1550
|
+
!k || !n.value || (k = !1, A.set(n.value, { rotate: 0 }), ot(n.value), m.resume(t.toast.id));
|
|
1551
|
+
};
|
|
1552
|
+
return he(() => {
|
|
1553
|
+
if (!n.value) return;
|
|
1554
|
+
const f = t.toast.position.includes("bottom");
|
|
1555
|
+
eo(n.value, {
|
|
1556
|
+
preset: t.toast.preset,
|
|
1557
|
+
bounce: t.toast.bounce,
|
|
1558
|
+
spring: t.toast.spring,
|
|
1559
|
+
direction: f ? "up" : "down"
|
|
1560
|
+
}).eventCallback("onComplete", () => {
|
|
1561
|
+
Ee(u);
|
|
1562
|
+
});
|
|
1563
|
+
}), N(() => t.index, (f, g) => {
|
|
1564
|
+
t.expanded || u(f < g || t.reposition);
|
|
1565
|
+
}), N(() => t.expandedOffset, (f, g) => {
|
|
1566
|
+
t.expanded && u(f !== g);
|
|
1567
|
+
}), N(() => t.expanded, () => {
|
|
1568
|
+
u(!0);
|
|
1569
|
+
}), N(
|
|
1570
|
+
() => t.expanded,
|
|
1571
|
+
(f) => {
|
|
1572
|
+
f ? m.pause(t.toast.id) : m.resume(t.toast.id);
|
|
1573
|
+
}
|
|
1574
|
+
), N(
|
|
1575
|
+
() => t.toast.isLeaving,
|
|
1576
|
+
(f) => {
|
|
1577
|
+
f && a();
|
|
1578
|
+
}
|
|
1579
|
+
), me(() => {
|
|
1580
|
+
n.value && ro(n.value);
|
|
1581
|
+
}), (f, g) => (S(), L("div", {
|
|
1582
|
+
ref_key: "toastRef",
|
|
1583
|
+
ref: n,
|
|
1584
|
+
class: re(["soft-toast-item", { "soft-toast-item--swipeable": e.swipeToDismiss }]),
|
|
1585
|
+
"data-type": e.toast.type,
|
|
1586
|
+
"data-st-index": e.index,
|
|
1587
|
+
"data-leaving": e.toast.isLeaving,
|
|
1588
|
+
style: ct({ zIndex: 1e3 - e.index }),
|
|
1589
|
+
onPointerdown: I,
|
|
1590
|
+
onPointermove: d,
|
|
1591
|
+
onPointerup: D,
|
|
1592
|
+
onPointercancel: F
|
|
1593
|
+
}, [
|
|
1594
|
+
Q(f.$slots, "close-button", {
|
|
1595
|
+
toast: e.toast,
|
|
1596
|
+
dismiss: a
|
|
1597
|
+
}, () => [
|
|
1598
|
+
e.closeButton ? (S(), L("button", {
|
|
1599
|
+
key: 0,
|
|
1600
|
+
class: "soft-toast-close",
|
|
1601
|
+
"data-position": typeof e.closeButton == "string" ? e.closeButton : "top-right",
|
|
1602
|
+
onClick: Re(a, ["stop"]),
|
|
1603
|
+
"aria-label": "Close"
|
|
1604
|
+
}, [...g[0] || (g[0] = [
|
|
1605
|
+
j(
|
|
1606
|
+
"svg",
|
|
1607
|
+
{
|
|
1608
|
+
width: "10",
|
|
1609
|
+
height: "10",
|
|
1610
|
+
viewBox: "0 0 10 10",
|
|
1611
|
+
fill: "none",
|
|
1612
|
+
class: "st-close-icon"
|
|
1613
|
+
},
|
|
1614
|
+
[
|
|
1615
|
+
j("path", {
|
|
1616
|
+
class: "st-close-line-1",
|
|
1617
|
+
d: "M1 1L9 9",
|
|
1618
|
+
stroke: "currentColor",
|
|
1619
|
+
"stroke-width": "1.6",
|
|
1620
|
+
"stroke-linecap": "round"
|
|
1621
|
+
}),
|
|
1622
|
+
j("path", {
|
|
1623
|
+
class: "st-close-line-2",
|
|
1624
|
+
d: "M9 1L1 9",
|
|
1625
|
+
stroke: "currentColor",
|
|
1626
|
+
"stroke-width": "1.6",
|
|
1627
|
+
"stroke-linecap": "round"
|
|
1628
|
+
})
|
|
1629
|
+
],
|
|
1630
|
+
-1
|
|
1631
|
+
/* CACHED */
|
|
1632
|
+
)
|
|
1633
|
+
])], 8, uo)) : H("v-if", !0)
|
|
1634
|
+
]),
|
|
1635
|
+
j("div", fo, [
|
|
1636
|
+
Q(f.$slots, "icon", { toast: e.toast }, () => [
|
|
1637
|
+
e.toast.type === "promise" ? (S(), L("div", po, [
|
|
1638
|
+
Ae(at(It), {
|
|
1639
|
+
class: "soft-toast-icon-svg",
|
|
1640
|
+
icon: "lucide:loader-circle",
|
|
1641
|
+
width: 18,
|
|
1642
|
+
height: 18
|
|
1643
|
+
})
|
|
1644
|
+
])) : e.toast.icon && typeof e.toast.icon == "string" ? (S(), q(tt, {
|
|
1645
|
+
key: 1,
|
|
1646
|
+
type: e.toast.type,
|
|
1647
|
+
customIcon: e.toast.icon
|
|
1648
|
+
}, null, 8, ["type", "customIcon"])) : e.toast.icon ? (S(), L("div", ho, [
|
|
1649
|
+
(S(), q($e(e.toast.icon)))
|
|
1650
|
+
])) : e.toast.type !== "default" ? (S(), q(tt, {
|
|
1651
|
+
key: 3,
|
|
1652
|
+
type: e.toast.type
|
|
1653
|
+
}, null, 8, ["type"])) : H("v-if", !0)
|
|
1654
|
+
]),
|
|
1655
|
+
j("div", mo, [
|
|
1656
|
+
j("div", go, [
|
|
1657
|
+
Q(f.$slots, "title", { toast: e.toast }, () => [
|
|
1658
|
+
j(
|
|
1659
|
+
"p",
|
|
1660
|
+
{
|
|
1661
|
+
class: re(["soft-toast-title", { "soft-toast-title--has-close": e.closeButton === !0 || e.closeButton === "top-right" }])
|
|
1662
|
+
},
|
|
1663
|
+
J(e.toast.title),
|
|
1664
|
+
3
|
|
1665
|
+
/* TEXT, CLASS */
|
|
1666
|
+
)
|
|
1667
|
+
])
|
|
1668
|
+
]),
|
|
1669
|
+
e.toast.description || e.toast.action ? (S(), L("div", vo, [
|
|
1670
|
+
Q(f.$slots, "description", { toast: e.toast }, () => [
|
|
1671
|
+
e.toast.description ? (S(), L("p", yo, [
|
|
1672
|
+
typeof e.toast.description == "object" ? (S(), q($e(e.toast.description), { key: 0 })) : (S(), L(
|
|
1673
|
+
ue,
|
|
1674
|
+
{ key: 1 },
|
|
1675
|
+
[
|
|
1676
|
+
Ct(
|
|
1677
|
+
J(e.toast.description),
|
|
1678
|
+
1
|
|
1679
|
+
/* TEXT */
|
|
1680
|
+
)
|
|
1681
|
+
],
|
|
1682
|
+
64
|
|
1683
|
+
/* STABLE_FRAGMENT */
|
|
1684
|
+
))
|
|
1685
|
+
])) : H("v-if", !0)
|
|
1686
|
+
]),
|
|
1687
|
+
Q(f.$slots, "action", {
|
|
1688
|
+
toast: e.toast,
|
|
1689
|
+
execute: l,
|
|
1690
|
+
hasSucceeded: o.value
|
|
1691
|
+
}, () => [
|
|
1692
|
+
c.value.length > 0 && !o.value ? (S(), L("div", wo, [
|
|
1693
|
+
(S(!0), L(
|
|
1694
|
+
ue,
|
|
1695
|
+
null,
|
|
1696
|
+
ne(c.value, (C, v) => (S(), L("button", {
|
|
1697
|
+
key: v,
|
|
1698
|
+
class: re(["soft-toast-action-button", [C.class || "", C.primary ? "soft-toast-action-primary" : ""]]),
|
|
1699
|
+
onClick: Re(() => l(C), ["stop"])
|
|
1700
|
+
}, J(C.label), 11, xo))),
|
|
1701
|
+
128
|
|
1702
|
+
/* KEYED_FRAGMENT */
|
|
1703
|
+
))
|
|
1704
|
+
])) : o.value ? (S(), L("div", bo, [
|
|
1705
|
+
j(
|
|
1706
|
+
"span",
|
|
1707
|
+
ko,
|
|
1708
|
+
J(s.value),
|
|
1709
|
+
1
|
|
1710
|
+
/* TEXT */
|
|
1711
|
+
)
|
|
1712
|
+
])) : H("v-if", !0)
|
|
1713
|
+
])
|
|
1714
|
+
])) : H("v-if", !0),
|
|
1715
|
+
H(" Timestamp lives below all content — never overlaps close button "),
|
|
1716
|
+
e.toast.showTimestamp ? (S(), L(
|
|
1717
|
+
"span",
|
|
1718
|
+
To,
|
|
1719
|
+
J(r.value),
|
|
1720
|
+
1
|
|
1721
|
+
/* TEXT */
|
|
1722
|
+
)) : H("v-if", !0)
|
|
1723
|
+
])
|
|
1724
|
+
]),
|
|
1725
|
+
e.toast.showProgress && e.toast.duration > 0 && e.toast.duration !== 1 / 0 ? (S(), q(co, {
|
|
1726
|
+
key: 0,
|
|
1727
|
+
"remaining-time": e.toast.remainingTime,
|
|
1728
|
+
"total-duration": e.toast.duration,
|
|
1729
|
+
"is-paused": e.toast.isPaused
|
|
1730
|
+
}, null, 8, ["remaining-time", "total-duration", "is-paused"])) : H("v-if", !0)
|
|
1731
|
+
], 46, lo));
|
|
1732
|
+
}
|
|
1733
|
+
}), So = ["data-position", "data-soft-toast-theme", "data-soft-toast-dir", "data-expanded"], Po = ["data-direction"], Eo = /* @__PURE__ */ X({
|
|
1734
|
+
__name: "ToastRegion",
|
|
1735
|
+
props: {
|
|
1736
|
+
position: { default: "top-right" },
|
|
1737
|
+
duration: { default: 5e3 },
|
|
1738
|
+
gap: { default: 12 },
|
|
1739
|
+
offset: { default: "24px" },
|
|
1740
|
+
theme: { default: "light" },
|
|
1741
|
+
toastOptions: {},
|
|
1742
|
+
spring: { type: Boolean, default: !0 },
|
|
1743
|
+
bounce: { default: 0.4 },
|
|
1744
|
+
preset: { default: "smooth" },
|
|
1745
|
+
closeOnEscape: { type: Boolean, default: !0 },
|
|
1746
|
+
closeButton: { type: [Boolean, String], default: !1 },
|
|
1747
|
+
showProgress: { type: Boolean, default: !1 },
|
|
1748
|
+
showTimestamp: { type: Boolean, default: !1 },
|
|
1749
|
+
sound: { type: Boolean },
|
|
1750
|
+
soundVolume: {},
|
|
1751
|
+
maxQueue: { default: 1 / 0 },
|
|
1752
|
+
queueOverflow: { default: "drop-oldest" },
|
|
1753
|
+
dir: { default: "ltr" },
|
|
1754
|
+
swipeToDismiss: { type: Boolean, default: !0 }
|
|
1755
|
+
},
|
|
1756
|
+
setup(e) {
|
|
1757
|
+
const t = e, n = O(null), o = O(null), s = O(null), i = $(() => m.getToastsByPosition(t.position).value), r = (h) => {
|
|
1758
|
+
if (h.key === "Escape" && t.closeOnEscape) {
|
|
1759
|
+
const w = i.value;
|
|
1760
|
+
w.length > 0 && m.dismiss(w[0].id);
|
|
1761
|
+
}
|
|
1762
|
+
}, a = () => {
|
|
1763
|
+
const h = i.value;
|
|
1764
|
+
document.hidden ? h.forEach((w) => m.pause(w.id)) : h.forEach((w) => m.resume(w.id));
|
|
1765
|
+
};
|
|
1766
|
+
he(() => {
|
|
1767
|
+
t.closeOnEscape && document.addEventListener("keydown", r), document.addEventListener("visibilitychange", a), s.value && typeof ResizeObserver < "u" && (g = new ResizeObserver(() => I()), g.observe(s.value));
|
|
1768
|
+
}), me(() => {
|
|
1769
|
+
t.closeOnEscape && document.removeEventListener("keydown", r), document.removeEventListener("visibilitychange", a), g && g.disconnect();
|
|
1770
|
+
}), N(
|
|
1771
|
+
() => i.value.map((h) => `${h.id}:${h.isLeaving}`).join(","),
|
|
1772
|
+
() => {
|
|
1773
|
+
Ee(I);
|
|
1774
|
+
}
|
|
1775
|
+
), N(
|
|
1776
|
+
() => m.toasts.value.length,
|
|
1777
|
+
(h, w) => {
|
|
1778
|
+
if (h > w) {
|
|
1779
|
+
const y = m.toasts.value[0];
|
|
1780
|
+
y && (y.duration || (y.duration = t.duration), y.preset || (y.preset = t.preset), y.bounce === void 0 && (y.bounce = t.bounce), y.spring === void 0 && (y.spring = t.spring), y.showProgress === void 0 && (y.showProgress = t.showProgress), y.showTimestamp === void 0 && (y.showTimestamp = t.showTimestamp));
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
);
|
|
1784
|
+
const l = $(() => `soft-toast-container--${t.position}`), c = $(
|
|
1785
|
+
() => i.value.filter((h) => !h.isLeaving)
|
|
1786
|
+
), u = (h, w) => h.isLeaving ? w : c.value.findIndex((y) => y.id === h.id), p = O(!1), x = O([]), k = O(0), T = O(0), I = () => {
|
|
1787
|
+
if (!s.value) return;
|
|
1788
|
+
const h = Array.from(
|
|
1789
|
+
s.value.querySelectorAll(".soft-toast-item")
|
|
1790
|
+
), w = t.gap ?? 10, y = [];
|
|
1791
|
+
let R = 0, se = 0;
|
|
1792
|
+
for (let M = 0; M < h.length; M++)
|
|
1793
|
+
if (y.push(R), h[M].getAttribute("data-leaving") !== "true") {
|
|
1794
|
+
R += h[M].offsetHeight + w;
|
|
1795
|
+
const W = h[M].dataset.toastId, K = i.value.find((Be) => Be.id === W);
|
|
1796
|
+
K && u(K, i.value.indexOf(K)) === 0 && (se = h[M].offsetHeight);
|
|
1797
|
+
}
|
|
1798
|
+
x.value = y, k.value = se, T.value = Math.max(0, R - w), p.value && s.value && D(0);
|
|
1799
|
+
}, d = O(0), D = (h) => {
|
|
1800
|
+
if (!s.value) return;
|
|
1801
|
+
const w = 120, y = window.innerHeight, R = Math.max(0, T.value - y + w);
|
|
1802
|
+
P.value === "up" ? (d.value -= h, d.value = Math.max(0, Math.min(d.value, R))) : (d.value -= h, d.value = Math.max(-R, Math.min(d.value, 0))), A.to(s.value, {
|
|
1803
|
+
y: d.value,
|
|
1804
|
+
duration: 0.4,
|
|
1805
|
+
ease: "power3.out",
|
|
1806
|
+
overwrite: "auto"
|
|
1807
|
+
});
|
|
1808
|
+
}, F = (h) => {
|
|
1809
|
+
if (!p.value) return;
|
|
1810
|
+
let w = h.target, y = !1;
|
|
1811
|
+
for (; w && w !== o.value; ) {
|
|
1812
|
+
const M = window.getComputedStyle(w).overflowY;
|
|
1813
|
+
if ((M === "auto" || M === "scroll") && w.scrollHeight > w.clientHeight) {
|
|
1814
|
+
const W = Math.ceil(w.scrollTop + w.clientHeight) < w.scrollHeight, K = w.scrollTop > 0;
|
|
1815
|
+
if (h.deltaY > 0 && W || h.deltaY < 0 && K) {
|
|
1816
|
+
y = !0;
|
|
1817
|
+
break;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
w = w.parentElement;
|
|
1821
|
+
}
|
|
1822
|
+
y || Math.max(0, T.value - window.innerHeight + 120) <= 0 || (h.preventDefault(), D(h.deltaY));
|
|
1823
|
+
}, f = $(() => i.value.length === 0 ? 0 : p.value ? T.value : k.value);
|
|
1824
|
+
let g = null;
|
|
1825
|
+
const C = () => {
|
|
1826
|
+
I(), p.value = !0;
|
|
1827
|
+
}, v = () => {
|
|
1828
|
+
p.value = !1, d.value = 0, s.value && A.to(s.value, { y: 0, duration: 0.5, ease: "power3.out", overwrite: "auto" });
|
|
1829
|
+
}, P = $(
|
|
1830
|
+
() => t.position.includes("bottom") ? "up" : "down"
|
|
1831
|
+
);
|
|
1832
|
+
return (h, w) => (S(), q(lt, { to: "body" }, [
|
|
1833
|
+
Ot(j("div", {
|
|
1834
|
+
ref_key: "containerRef",
|
|
1835
|
+
ref: n,
|
|
1836
|
+
class: re(["soft-toast-container", l.value]),
|
|
1837
|
+
"data-position": e.position,
|
|
1838
|
+
"data-soft-toast-theme": e.theme,
|
|
1839
|
+
"data-soft-toast-dir": e.dir,
|
|
1840
|
+
"data-expanded": p.value
|
|
1841
|
+
}, [
|
|
1842
|
+
j("div", {
|
|
1843
|
+
ref_key: "stackRef",
|
|
1844
|
+
ref: o,
|
|
1845
|
+
class: "soft-toast-stack",
|
|
1846
|
+
"data-direction": P.value,
|
|
1847
|
+
onMouseenter: C,
|
|
1848
|
+
onMouseleave: v,
|
|
1849
|
+
onWheel: F,
|
|
1850
|
+
"data-lenis-prevent": "true"
|
|
1851
|
+
}, [
|
|
1852
|
+
j(
|
|
1853
|
+
"div",
|
|
1854
|
+
{
|
|
1855
|
+
ref_key: "listRef",
|
|
1856
|
+
ref: s,
|
|
1857
|
+
class: "soft-toast-list",
|
|
1858
|
+
style: ct({ height: f.value + "px" })
|
|
1859
|
+
},
|
|
1860
|
+
[
|
|
1861
|
+
(S(!0), L(
|
|
1862
|
+
ue,
|
|
1863
|
+
null,
|
|
1864
|
+
ne(i.value, (y, R) => (S(), q(Io, {
|
|
1865
|
+
key: y.id,
|
|
1866
|
+
toast: y,
|
|
1867
|
+
index: u(y, R),
|
|
1868
|
+
total: c.value.length,
|
|
1869
|
+
expanded: p.value,
|
|
1870
|
+
"expanded-offset": x.value[R] ?? 0,
|
|
1871
|
+
"stack-direction": P.value,
|
|
1872
|
+
"close-button": y.closeButton ?? e.closeButton,
|
|
1873
|
+
"swipe-to-dismiss": e.swipeToDismiss
|
|
1874
|
+
}, ut({
|
|
1875
|
+
_: 2
|
|
1876
|
+
/* DYNAMIC */
|
|
1877
|
+
}, [
|
|
1878
|
+
ne(h.$slots, (se, M) => ({
|
|
1879
|
+
name: M,
|
|
1880
|
+
fn: ft((W) => [
|
|
1881
|
+
Q(h.$slots, M, be({ ref_for: !0 }, W || {}), void 0, !0)
|
|
1882
|
+
])
|
|
1883
|
+
}))
|
|
1884
|
+
]), 1032, ["toast", "index", "total", "expanded", "expanded-offset", "stack-direction", "close-button", "swipe-to-dismiss"]))),
|
|
1885
|
+
128
|
|
1886
|
+
/* KEYED_FRAGMENT */
|
|
1887
|
+
))
|
|
1888
|
+
],
|
|
1889
|
+
4
|
|
1890
|
+
/* STYLE */
|
|
1891
|
+
)
|
|
1892
|
+
], 40, Po)
|
|
1893
|
+
], 10, So), [
|
|
1894
|
+
[Lt, i.value.length > 0]
|
|
1895
|
+
])
|
|
1896
|
+
]));
|
|
1897
|
+
}
|
|
1898
|
+
}), Ao = (e, t) => {
|
|
1899
|
+
const n = e.__vccOpts || e;
|
|
1900
|
+
for (const [o, s] of t)
|
|
1901
|
+
n[o] = s;
|
|
1902
|
+
return n;
|
|
1903
|
+
}, Co = /* @__PURE__ */ Ao(Eo, [["__scopeId", "data-v-3699e296"]]), it = /* @__PURE__ */ X({
|
|
1904
|
+
__name: "ToastContainer",
|
|
1905
|
+
props: {
|
|
1906
|
+
position: { default: "top-right" },
|
|
1907
|
+
duration: {},
|
|
1908
|
+
gap: {},
|
|
1909
|
+
offset: {},
|
|
1910
|
+
theme: {},
|
|
1911
|
+
toastOptions: {},
|
|
1912
|
+
spring: { type: Boolean },
|
|
1913
|
+
bounce: {},
|
|
1914
|
+
preset: {},
|
|
1915
|
+
closeOnEscape: { type: Boolean },
|
|
1916
|
+
closeButton: { type: [Boolean, String] },
|
|
1917
|
+
showProgress: { type: Boolean },
|
|
1918
|
+
showTimestamp: { type: Boolean },
|
|
1919
|
+
sound: { type: Boolean },
|
|
1920
|
+
soundVolume: {},
|
|
1921
|
+
maxQueue: { default: 10 },
|
|
1922
|
+
queueOverflow: { default: "drop-oldest" },
|
|
1923
|
+
dir: {},
|
|
1924
|
+
swipeToDismiss: { type: Boolean }
|
|
1925
|
+
},
|
|
1926
|
+
setup(e) {
|
|
1927
|
+
const t = e, n = [
|
|
1928
|
+
"top",
|
|
1929
|
+
"bottom",
|
|
1930
|
+
"left",
|
|
1931
|
+
"right",
|
|
1932
|
+
"center",
|
|
1933
|
+
"top-left",
|
|
1934
|
+
"top-center",
|
|
1935
|
+
"top-right",
|
|
1936
|
+
"bottom-left",
|
|
1937
|
+
"bottom-center",
|
|
1938
|
+
"bottom-right"
|
|
1939
|
+
];
|
|
1940
|
+
return (o, s) => (S(), q(lt, { to: "body" }, [
|
|
1941
|
+
(S(), L(
|
|
1942
|
+
ue,
|
|
1943
|
+
null,
|
|
1944
|
+
ne(n, (i) => Ae(Co, be({ key: i }, { ref_for: !0 }, t, { position: i }), ut({
|
|
1945
|
+
_: 2
|
|
1946
|
+
/* DYNAMIC */
|
|
1947
|
+
}, [
|
|
1948
|
+
ne(o.$slots, (r, a) => ({
|
|
1949
|
+
name: a,
|
|
1950
|
+
fn: ft((l) => [
|
|
1951
|
+
Q(o.$slots, a, be({ ref_for: !0 }, l || {}))
|
|
1952
|
+
])
|
|
1953
|
+
}))
|
|
1954
|
+
]), 1040, ["position"])),
|
|
1955
|
+
64
|
|
1956
|
+
/* STABLE_FRAGMENT */
|
|
1957
|
+
))
|
|
1958
|
+
]));
|
|
1959
|
+
}
|
|
1960
|
+
});
|
|
1961
|
+
let E = {
|
|
1962
|
+
position: "top-right",
|
|
1963
|
+
duration: 4e3,
|
|
1964
|
+
theme: "light",
|
|
1965
|
+
spring: !0,
|
|
1966
|
+
bounce: 0.4,
|
|
1967
|
+
preset: "smooth",
|
|
1968
|
+
closeOnEscape: !0,
|
|
1969
|
+
closeButton: !1,
|
|
1970
|
+
showProgress: !1,
|
|
1971
|
+
showTimestamp: !1,
|
|
1972
|
+
maxQueue: 10,
|
|
1973
|
+
queueOverflow: "drop-oldest",
|
|
1974
|
+
dir: "ltr",
|
|
1975
|
+
swipeToDismiss: !0,
|
|
1976
|
+
teleportTarget: "body"
|
|
1977
|
+
}, rt = !1;
|
|
1978
|
+
const Do = {
|
|
1979
|
+
install(e, t = {}) {
|
|
1980
|
+
if (E = { ...E, ...t }, !rt && typeof window < "u") {
|
|
1981
|
+
const n = "soft-toast-global-container";
|
|
1982
|
+
let o = document.getElementById(n);
|
|
1983
|
+
o || (o = document.createElement("div"), o.id = n, document.body.appendChild(o)), e.component("SoftToastContainer", it), Dt({
|
|
1984
|
+
render: () => xe(it, {
|
|
1985
|
+
position: E.position,
|
|
1986
|
+
duration: E.duration,
|
|
1987
|
+
gap: E.gap,
|
|
1988
|
+
offset: E.offset,
|
|
1989
|
+
theme: E.theme,
|
|
1990
|
+
spring: E.spring,
|
|
1991
|
+
bounce: E.bounce,
|
|
1992
|
+
preset: E.preset,
|
|
1993
|
+
closeOnEscape: E.closeOnEscape,
|
|
1994
|
+
closeButton: E.closeButton,
|
|
1995
|
+
showProgress: E.showProgress,
|
|
1996
|
+
maxQueue: E.maxQueue,
|
|
1997
|
+
queueOverflow: E.queueOverflow,
|
|
1998
|
+
dir: E.dir,
|
|
1999
|
+
swipeToDismiss: E.swipeToDismiss
|
|
2000
|
+
})
|
|
2001
|
+
}).mount(o), rt = !0;
|
|
2002
|
+
}
|
|
2003
|
+
e.provide("softToastOptions", E), typeof document < "u" && (document.body.setAttribute("data-soft-toast-theme", E.theme || "light"), document.body.setAttribute("data-soft-toast-dir", E.dir || "ltr"));
|
|
2004
|
+
}
|
|
2005
|
+
}, Fo = () => E, Pt = "@soft-toast/vue:flash", De = () => {
|
|
2006
|
+
if (typeof sessionStorage > "u") return [];
|
|
2007
|
+
try {
|
|
2008
|
+
return JSON.parse(sessionStorage.getItem(Pt) || "[]");
|
|
2009
|
+
} catch {
|
|
2010
|
+
return [];
|
|
2011
|
+
}
|
|
2012
|
+
}, Et = (e) => {
|
|
2013
|
+
if (!(typeof sessionStorage > "u"))
|
|
2014
|
+
try {
|
|
2015
|
+
sessionStorage.setItem(Pt, JSON.stringify(e));
|
|
2016
|
+
} catch {
|
|
2017
|
+
}
|
|
2018
|
+
}, Fe = (e, t = {}) => {
|
|
2019
|
+
const n = De().filter(
|
|
2020
|
+
(o) => Date.now() - o.queuedAt < 3e4
|
|
2021
|
+
// discard stale flashes
|
|
2022
|
+
);
|
|
2023
|
+
n.push({ title: e, options: t, queuedAt: Date.now() }), Et(n);
|
|
2024
|
+
}, Me = () => {
|
|
2025
|
+
const e = De().filter(
|
|
2026
|
+
(t) => Date.now() - t.queuedAt < 3e4
|
|
2027
|
+
);
|
|
2028
|
+
return Et([]), e.forEach((t) => {
|
|
2029
|
+
m.add({ title: t.title, type: "default", ...t.options });
|
|
2030
|
+
}), e.length;
|
|
2031
|
+
}, je = () => De().some((e) => Date.now() - e.queuedAt < 3e4), Mo = () => ({
|
|
2032
|
+
/** Queue a toast that will appear on the next page/route */
|
|
2033
|
+
flash: Fe,
|
|
2034
|
+
/** Show all pending flashes now — call in onMounted */
|
|
2035
|
+
showPendingFlashes: Me,
|
|
2036
|
+
/** True if there are flashes waiting to be shown */
|
|
2037
|
+
hasPending: je
|
|
2038
|
+
}), jo = () => ({
|
|
2039
|
+
default: (e, t) => m.add({ ...t, type: "default", title: e }),
|
|
2040
|
+
success: (e, t) => m.add({ ...t, type: "success", title: e }),
|
|
2041
|
+
error: (e, t) => m.add({ ...t, type: "error", title: e }),
|
|
2042
|
+
warning: (e, t) => m.add({ ...t, type: "warning", title: e }),
|
|
2043
|
+
info: (e, t) => m.add({ ...t, type: "info", title: e }),
|
|
2044
|
+
loading: (e, t) => m.loading(e, t),
|
|
2045
|
+
promise: (e, t, n) => m.promise(e, t, n),
|
|
2046
|
+
custom: (e) => m.add(e),
|
|
2047
|
+
update: (e, t) => m.update(e, t),
|
|
2048
|
+
dismiss: (e) => m.dismiss(e),
|
|
2049
|
+
dismissAll: () => m.dismiss(),
|
|
2050
|
+
pause: (e) => m.pause(e),
|
|
2051
|
+
resume: (e) => m.resume(e),
|
|
2052
|
+
/**
|
|
2053
|
+
* Queue a toast that will be shown on the next page load / route navigation.
|
|
2054
|
+
* Perfect for the "submit → redirect → show success" pattern.
|
|
2055
|
+
*
|
|
2056
|
+
* @example
|
|
2057
|
+
* const { flash } = useToast()
|
|
2058
|
+
* await api.save()
|
|
2059
|
+
* flash('Saved!', { type: 'success' })
|
|
2060
|
+
* router.push('/dashboard')
|
|
2061
|
+
*/
|
|
2062
|
+
flash: (e, t = {}) => Fe(e, t),
|
|
2063
|
+
/**
|
|
2064
|
+
* Show any toasts that were queued with flash() before a page navigation.
|
|
2065
|
+
* Call this in onMounted() of your root layout or App.vue.
|
|
2066
|
+
*/
|
|
2067
|
+
showFlashes: () => Me(),
|
|
2068
|
+
/** Check if there are pending flash messages without consuming them. */
|
|
2069
|
+
hasFlashes: () => je()
|
|
2070
|
+
}), Bo = {
|
|
2071
|
+
default: (e, t) => m.add({ ...t, type: "default", title: e }),
|
|
2072
|
+
success: (e, t) => m.add({ ...t, type: "success", title: e }),
|
|
2073
|
+
error: (e, t) => m.add({ ...t, type: "error", title: e }),
|
|
2074
|
+
warning: (e, t) => m.add({ ...t, type: "warning", title: e }),
|
|
2075
|
+
info: (e, t) => m.add({ ...t, type: "info", title: e }),
|
|
2076
|
+
loading: (e, t) => m.loading(e, t),
|
|
2077
|
+
promise: (e, t, n) => m.promise(e, t, n),
|
|
2078
|
+
custom: (e) => m.add(e),
|
|
2079
|
+
update: (e, t) => m.update(e, t),
|
|
2080
|
+
dismiss: (e) => m.dismiss(e),
|
|
2081
|
+
dismissAll: () => m.dismiss(),
|
|
2082
|
+
pause: (e) => m.pause(e),
|
|
2083
|
+
resume: (e) => m.resume(e),
|
|
2084
|
+
flash: (e, t = {}) => Fe(e, t),
|
|
2085
|
+
showFlashes: () => Me(),
|
|
2086
|
+
hasFlashes: () => je()
|
|
2087
|
+
};
|
|
2088
|
+
export {
|
|
2089
|
+
Do as SoftToastPlugin,
|
|
2090
|
+
it as ToastContainer,
|
|
2091
|
+
Io as ToastItem,
|
|
2092
|
+
Me as consumeFlashes,
|
|
2093
|
+
Fo as getToastOptions,
|
|
2094
|
+
je as hasPendingFlashes,
|
|
2095
|
+
Fe as queueFlash,
|
|
2096
|
+
Bo as toast,
|
|
2097
|
+
m as toastStore,
|
|
2098
|
+
Mo as useFlash,
|
|
2099
|
+
jo as useToast
|
|
2100
|
+
};
|