@editora/toast 2.1.1 → 2.2.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/dist/index.esm.js CHANGED
@@ -1,1528 +1,12 @@
1
- class j {
2
- constructor(t) {
3
- this.toasts = /* @__PURE__ */ new Map(), this.groups = /* @__PURE__ */ new Map(), this.containers = /* @__PURE__ */ new Map(), this.config = { ...t };
4
- }
5
- // Toast management
6
- addToast(t) {
7
- this.toasts.set(t.id, t), this.updateGroup(t);
8
- }
9
- removeToast(t) {
10
- const e = this.toasts.get(t);
11
- return e ? (this.toasts.delete(t), this.updateGroup(e), !0) : !1;
12
- }
13
- getToast(t) {
14
- return this.toasts.get(t);
15
- }
16
- getAllToasts() {
17
- return Array.from(this.toasts.values());
18
- }
19
- getToastsByPosition(t) {
20
- return this.getAllToasts().filter((e) => e.options.position === t);
21
- }
22
- updateToast(t, e) {
23
- const s = this.toasts.get(t);
24
- return s ? (Object.assign(s, e), this.updateGroup(s), !0) : !1;
25
- }
26
- // Group management
27
- updateGroup(t) {
28
- const e = t.options.group;
29
- if (!e) return;
30
- let s = this.groups.get(e);
31
- s || (s = { id: e, toasts: [] }, this.groups.set(e, s)), s.toasts = s.toasts.filter((i) => i.id !== t.id), t.options.group === e && s.toasts.push(t), s.toasts.length === 0 && this.groups.delete(e);
32
- }
33
- getGroup(t) {
34
- return this.groups.get(t);
35
- }
36
- getAllGroups() {
37
- return Array.from(this.groups.values());
38
- }
39
- // Container management
40
- getContainer(t) {
41
- return this.containers.get(t);
42
- }
43
- setContainer(t, e) {
44
- this.containers.set(t, e);
45
- }
46
- removeContainer(t) {
47
- return this.containers.delete(t);
48
- }
49
- getAllContainers() {
50
- return new Map(this.containers);
51
- }
52
- // Configuration
53
- getConfig() {
54
- return { ...this.config };
55
- }
56
- updateConfig(t) {
57
- this.config = { ...this.config, ...t };
58
- }
59
- // Cleanup
60
- clear() {
61
- this.toasts.clear(), this.groups.clear();
62
- }
63
- // Statistics
64
- getStats() {
65
- return {
66
- totalToasts: this.toasts.size,
67
- totalGroups: this.groups.size,
68
- toastsByPosition: Object.fromEntries(
69
- Array.from(this.containers.keys()).map((t) => [
70
- t,
71
- this.getToastsByPosition(t).length
72
- ])
73
- )
74
- };
75
- }
76
- }
77
- class W {
78
- constructor(t) {
79
- this.queue = [], this.visible = [], this.config = this.normalizeConfig(t);
80
- }
81
- enqueue(t) {
82
- var o;
83
- const e = this.findDuplicate(t);
84
- if (e && ((o = t.options.preventDuplicate) != null ? o : this.config.preventDuplicate))
85
- return { show: [], hide: [], rejected: e };
86
- const s = [];
87
- if (t.options.important && this.visible.length >= this.maxVisible) {
88
- const r = this.removeLowestPriorityVisible();
89
- return this.visible.push(t), { show: [t], hide: r ? [...s, r] : s };
90
- }
91
- this.config.queueStrategy === "fifo" ? this.queue.push(t) : this.queue.unshift(t), this.sortQueue();
92
- const i = this.processQueue();
93
- return { show: i.show, hide: [...s, ...i.hide] };
94
- }
95
- dequeue(t) {
96
- return this.removeFromCollections(t) ? { show: this.processQueue().show, hide: [] } : { show: [], hide: [] };
97
- }
98
- updateConfig(t) {
99
- return this.config = this.normalizeConfig({ ...this.config, ...t }), this.sortQueue(), this.processQueue();
100
- }
101
- getQueued() {
102
- return [...this.queue];
103
- }
104
- getVisible() {
105
- return [...this.visible];
106
- }
107
- getAll() {
108
- return [...this.visible, ...this.queue];
109
- }
110
- isVisible(t) {
111
- return this.visible.some((e) => e.id === t);
112
- }
113
- clear() {
114
- const t = [...this.visible, ...this.queue];
115
- return this.queue = [], this.visible = [], t;
116
- }
117
- processQueue() {
118
- const t = [], e = [];
119
- for (; this.visible.length > this.maxVisible; ) {
120
- const s = this.visible.pop();
121
- s && e.push(s);
122
- }
123
- for (; this.visible.length < this.maxVisible && this.queue.length > 0; ) {
124
- const s = this.queue.shift();
125
- if (!s) break;
126
- this.visible.push(s), t.push(s);
127
- }
128
- return { show: t, hide: e };
129
- }
130
- removeLowestPriorityVisible() {
131
- if (this.visible.length === 0) return;
132
- let t = 0;
133
- for (let e = 1; e < this.visible.length; e += 1)
134
- (this.visible[e].options.priority || 0) < (this.visible[t].options.priority || 0) && (t = e);
135
- return this.visible.splice(t, 1)[0];
136
- }
137
- removeFromCollections(t) {
138
- const e = this.visible.findIndex((i) => i.id === t);
139
- if (e !== -1)
140
- return this.visible.splice(e, 1)[0];
141
- const s = this.queue.findIndex((i) => i.id === t);
142
- if (s !== -1)
143
- return this.queue.splice(s, 1)[0];
144
- }
145
- findDuplicate(t) {
146
- const e = t.options.dedupeScope || this.config.dedupeScope, s = e === "visible" ? this.visible : e === "queue" ? this.queue : [...this.visible, ...this.queue], i = this.getDedupeKey(t);
147
- return s.find((o) => this.getDedupeKey(o) === i);
148
- }
149
- getDedupeKey(t) {
150
- return t.options.dedupeKey || `${t.options.level || "info"}:${t.options.title || ""}:${t.options.message || ""}:${t.options.description || ""}`;
151
- }
152
- sortQueue() {
153
- this.queue.sort((t, e) => {
154
- const s = (e.options.priority || 0) - (t.options.priority || 0);
155
- return s !== 0 ? s : t.createdAt - e.createdAt;
156
- });
157
- }
158
- get maxVisible() {
159
- return Math.max(1, this.config.visibleToasts || this.config.maxVisible || 1);
160
- }
161
- normalizeConfig(t) {
162
- return {
163
- ...t,
164
- maxVisible: t.visibleToasts || t.maxVisible
165
- };
166
- }
167
- }
168
- const G = /* @__PURE__ */ new Set([
169
- "a",
170
- "b",
171
- "strong",
172
- "i",
173
- "em",
174
- "u",
175
- "s",
176
- "del",
177
- "ins",
178
- "mark",
179
- "small",
180
- "sub",
181
- "sup",
182
- "code",
183
- "kbd",
184
- "br",
185
- "span",
186
- "p",
187
- "ul",
188
- "ol",
189
- "li"
190
- ]), K = /* @__PURE__ */ new Set([
191
- "script",
192
- "style",
193
- "iframe",
194
- "frame",
195
- "frameset",
196
- "object",
197
- "embed",
198
- "applet",
199
- "noscript",
200
- "template",
201
- "svg",
202
- "math",
203
- "form",
204
- "input",
205
- "button",
206
- "textarea",
207
- "select",
208
- "option",
209
- "head",
210
- "title",
211
- "link",
212
- "meta",
213
- "base",
214
- "audio",
215
- "video",
216
- "canvas"
217
- ]), R = /^(?:https?:|mailto:|tel:)/i;
218
- function _(n) {
219
- const t = n.replace(/[\u0000- \u007f-\u009f]/g, "");
220
- return t ? R.test(t) ? !0 : !/^[a-z][a-z0-9+.-]*:/i.test(t) : !1;
221
- }
222
- function M(n, t, e) {
223
- for (const s of Array.from(n.childNodes)) {
224
- if (s.nodeType === Node.TEXT_NODE) {
225
- t.appendChild(e.createTextNode(s.textContent || ""));
226
- continue;
227
- }
228
- if (s.nodeType !== Node.ELEMENT_NODE) continue;
229
- const i = s, o = i.localName.toLowerCase();
230
- if (K.has(o)) continue;
231
- if (!G.has(o)) {
232
- M(i, t, e);
233
- continue;
234
- }
235
- const r = e.createElement(o);
236
- if (o === "a") {
237
- const a = i.getAttribute("href");
238
- a && _(a) && (r.setAttribute("href", a.trim()), /^(?:https?:)?\/\//i.test(a.trim()) && (r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer")));
239
- const c = i.getAttribute("title");
240
- c && r.setAttribute("title", c);
241
- }
242
- M(i, r, e), t.appendChild(r);
243
- }
244
- }
245
- function U(n, t) {
246
- const e = document.createElement("template");
247
- e.innerHTML = t;
248
- const s = document.createDocumentFragment();
249
- M(e.content, s, document), n.textContent = "", n.appendChild(s);
250
- }
251
- class Q {
252
- constructor(t = {}) {
253
- var e, s, i, o;
254
- this.config = {
255
- stiffness: (e = t.stiffness) != null ? e : 100,
256
- damping: (s = t.damping) != null ? s : 10,
257
- mass: (i = t.mass) != null ? i : 1,
258
- precision: (o = t.precision) != null ? o : 0.01
259
- };
260
- }
261
- // Spring animation function
262
- animate(t, e, s, i, o) {
263
- const r = {
264
- ...this.config,
265
- ...o
266
- };
267
- let a, c = !1;
268
- const l = Object.keys(e).reduce((u, v) => (u[v] = e[v].from, u), {}), h = Object.keys(e).reduce((u, v) => (u[v] = 0, u), {}), y = () => {
269
- if (c) return;
270
- let u = !0;
271
- Object.keys(e).forEach((d) => {
272
- const m = e[d].to, T = l[d], f = h[d], w = -r.stiffness * (T - m), g = -r.damping * f, x = (w + g) / r.mass;
273
- h[d] += x * 0.016, l[d] += h[d] * 0.016, (Math.abs(T - m) > r.precision || Math.abs(f) > r.precision) && (u = !1);
274
- });
275
- const v = Object.keys(l).reduce((d, m) => {
276
- const T = e[m].unit || "px";
277
- return d[m] = `${l[m]}${T}`, d;
278
- }, {});
279
- s(v), u ? (c = !0, i == null || i()) : a = requestAnimationFrame(y);
280
- };
281
- return a = requestAnimationFrame(y), () => {
282
- c = !0, a && cancelAnimationFrame(a);
283
- };
284
- }
285
- }
286
- class Z {
287
- constructor() {
288
- this.springAnimation = new Q();
289
- }
290
- // Show toast with specified animation
291
- async showToast(t, e, s) {
292
- switch (s.type) {
293
- case "spring":
294
- await this.animateSpringShow(t, s);
295
- break;
296
- case "bounce":
297
- await this.animateBounceShow(t, s);
298
- break;
299
- case "slide":
300
- await this.animateSlideShow(t, s);
301
- break;
302
- case "zoom":
303
- await this.animateZoomShow(t, s);
304
- break;
305
- case "flip":
306
- await this.animateFlipShow(t, s);
307
- break;
308
- case "fade":
309
- await this.animateFadeShow(t, s);
310
- break;
311
- case "elastic":
312
- await this.animateElasticShow(t, s);
313
- break;
314
- case "rotate":
315
- await this.animateRotateShow(t, s);
316
- break;
317
- case "custom":
318
- s.show ? await Promise.resolve(s.show(t, e)) : await this.animateCssShow(t);
319
- break;
320
- default:
321
- await this.animateCssShow(t);
322
- break;
323
- }
324
- }
325
- // Hide toast with specified animation
326
- async hideToast(t, e, s) {
327
- switch (s.type) {
328
- case "spring":
329
- await this.animateSpringHide(t, s);
330
- break;
331
- case "bounce":
332
- await this.animateBounceHide(t, s);
333
- break;
334
- case "slide":
335
- await this.animateSlideHide(t, s);
336
- break;
337
- case "zoom":
338
- await this.animateZoomHide(t, s);
339
- break;
340
- case "flip":
341
- await this.animateFlipHide(t, s);
342
- break;
343
- case "fade":
344
- await this.animateFadeHide(t, s);
345
- break;
346
- case "elastic":
347
- await this.animateElasticHide(t, s);
348
- break;
349
- case "rotate":
350
- await this.animateRotateHide(t, s);
351
- break;
352
- case "custom":
353
- s.hide ? await Promise.resolve(s.hide(t, e)) : await this.animateCssHide(t);
354
- break;
355
- default:
356
- await this.animateCssHide(t);
357
- break;
358
- }
359
- }
360
- // Update toast with specified animation
361
- async updateToast(t, e, s, i) {
362
- i.type === "custom" && i.update && await Promise.resolve(i.update(t, e, s));
363
- }
364
- // CSS-based show animation (existing behavior)
365
- animateCssShow(t) {
366
- return new Promise((e) => {
367
- requestAnimationFrame(() => {
368
- t.classList.add("show"), window.setTimeout(e, 220);
369
- });
370
- });
371
- }
372
- // CSS-based hide animation (existing behavior)
373
- animateCssHide(t) {
374
- return new Promise((e) => {
375
- t.classList.remove("show"), t.classList.add("hiding"), window.setTimeout(e, 220);
376
- });
377
- }
378
- // Spring-based show animation
379
- async animateSpringShow(t, e) {
380
- return new Promise((s) => {
381
- var r, a, c;
382
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important"), t.style.setProperty("-webkit-transition", "none", "important");
383
- const o = ((r = t.parentElement) == null ? void 0 : r.classList.contains("editora-toast-bottom-right")) || ((a = t.parentElement) == null ? void 0 : a.classList.contains("editora-toast-bottom-left")) || ((c = t.parentElement) == null ? void 0 : c.classList.contains("editora-toast-bottom-center")) ? 20 : -20;
384
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `translateY(${o}px) scale(0.95)`, "important"), t.offsetHeight, setTimeout(() => {
385
- t.style.setProperty("transition", "opacity 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1)", "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
386
- t.style.setProperty("transition", "none", "important"), s();
387
- }, 800);
388
- }, 16);
389
- });
390
- }
391
- // Spring-based hide animation
392
- async animateSpringHide(t, e) {
393
- return new Promise((s) => {
394
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important"), t.style.setProperty("-webkit-transition", "none", "important"), setTimeout(() => {
395
- t.style.setProperty("transition", "opacity 0.4s ease, transform 0.4s ease", "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", "translateY(-10px) scale(0.95)", "important"), setTimeout(() => {
396
- t.style.setProperty("transition", "none", "important"), s();
397
- }, 400);
398
- }, 16);
399
- });
400
- }
401
- // Bounce-based show animation
402
- async animateBounceShow(t, e) {
403
- return new Promise((s) => {
404
- var h, y, u;
405
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
406
- const i = ((h = t.parentElement) == null ? void 0 : h.classList.contains("editora-toast-bottom-right")) || ((y = t.parentElement) == null ? void 0 : y.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), o = e.direction || (i ? "up" : "down"), r = e.intensity || "normal", a = e.duration || 800, c = r === "gentle" ? 0.05 : r === "strong" ? 0.15 : 0.1, l = o === "up" ? 30 : o === "down" ? -30 : o === "left" ? 30 : -30;
407
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
408
- "transform",
409
- o === "left" || o === "right" ? `translateX(${l}px) scale(${1 - c})` : `translateY(${l}px) scale(${1 - c})`,
410
- "important"
411
- ), t.offsetHeight, setTimeout(() => {
412
- t.style.setProperty(
413
- "transition",
414
- `opacity ${a}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${a}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,
415
- "important"
416
- ), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
417
- t.style.setProperty("transition", "none", "important"), s();
418
- }, a);
419
- }, 16);
420
- });
421
- }
422
- // Bounce-based hide animation
423
- async animateBounceHide(t, e) {
424
- return new Promise((s) => {
425
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
426
- const i = e.intensity || "normal", o = i === "gentle" ? 0.05 : i === "strong" ? 0.15 : 0.1;
427
- setTimeout(() => {
428
- t.style.setProperty("transition", "opacity 0.4s ease, transform 0.4s ease", "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${1 - o})`, "important"), setTimeout(() => {
429
- t.style.setProperty("transition", "none", "important"), s();
430
- }, 400);
431
- }, 16);
432
- });
433
- }
434
- // Slide-based show animation
435
- async animateSlideShow(t, e) {
436
- return new Promise((s) => {
437
- var h, y, u;
438
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
439
- const i = ((h = t.parentElement) == null ? void 0 : h.classList.contains("editora-toast-bottom-right")) || ((y = t.parentElement) == null ? void 0 : y.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), o = e.direction || (i ? "up" : "down"), r = e.distance || 100, a = e.easing || "ease-out", c = e.duration || 400, l = o === "up" ? `translateY(${r}px)` : o === "down" ? `translateY(-${r}px)` : o === "left" ? `translateX(${r}px)` : `translateX(-${r}px)`;
440
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", l, "important"), t.offsetHeight, setTimeout(() => {
441
- t.style.setProperty("transition", `opacity ${c}ms ${a}, transform ${c}ms ${a}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) translateX(0)", "important"), setTimeout(() => {
442
- t.style.setProperty("transition", "none", "important"), s();
443
- }, c);
444
- }, 16);
445
- });
446
- }
447
- // Slide-based hide animation
448
- async animateSlideHide(t, e) {
449
- return new Promise((s) => {
450
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
451
- const i = e.direction || "down", o = e.distance || 100, r = e.easing || "ease-in", a = e.duration || 300, c = i === "up" ? `translateY(-${o}px)` : i === "down" ? `translateY(${o}px)` : i === "left" ? `translateX(-${o}px)` : `translateX(${o}px)`;
452
- setTimeout(() => {
453
- t.style.setProperty("transition", `opacity ${a}ms ${r}, transform ${a}ms ${r}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", c, "important"), setTimeout(() => {
454
- t.style.setProperty("transition", "none", "important"), s();
455
- }, a);
456
- }, 16);
457
- });
458
- }
459
- // Zoom-based show animation
460
- async animateZoomShow(t, e) {
461
- return new Promise((s) => {
462
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
463
- const i = e.scale || 0.3, o = e.origin || "center", r = e.easing || "ease-out", a = e.duration || 500;
464
- t.style.setProperty("transform-origin", o, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), t.offsetHeight, setTimeout(() => {
465
- t.style.setProperty("transition", `opacity ${a}ms ${r}, transform ${a}ms ${r}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "scale(1)", "important"), setTimeout(() => {
466
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
467
- }, a);
468
- }, 16);
469
- });
470
- }
471
- // Zoom-based hide animation
472
- async animateZoomHide(t, e) {
473
- return new Promise((s) => {
474
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
475
- const i = e.scale || 0.3, o = e.origin || "center", r = e.easing || "ease-in", a = e.duration || 300;
476
- t.style.setProperty("transform-origin", o, "important"), setTimeout(() => {
477
- t.style.setProperty("transition", `opacity ${a}ms ${r}, transform ${a}ms ${r}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), setTimeout(() => {
478
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
479
- }, a);
480
- }, 16);
481
- });
482
- }
483
- // Flip-based show animation
484
- async animateFlipShow(t, e) {
485
- return new Promise((s) => {
486
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
487
- const i = e.axis || "y", o = e.perspective || 1e3, r = e.direction || "forward", a = e.duration || 600;
488
- t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${o}px`, "important");
489
- const c = r === "forward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
490
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${c}deg)`, "important"), t.offsetHeight, setTimeout(() => {
491
- t.style.setProperty("transition", `opacity ${a}ms ease, transform ${a}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "rotateX(0deg) rotateY(0deg)", "important"), setTimeout(() => {
492
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), s();
493
- }, a);
494
- }, 16);
495
- });
496
- }
497
- // Flip-based hide animation
498
- async animateFlipHide(t, e) {
499
- return new Promise((s) => {
500
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
501
- const i = e.axis || "y", o = e.perspective || 1e3, r = e.direction || "backward", a = e.duration || 400;
502
- t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${o}px`, "important");
503
- const c = r === "backward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
504
- setTimeout(() => {
505
- t.style.setProperty("transition", `opacity ${a}ms ease, transform ${a}ms ease-in`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${c}deg)`, "important"), setTimeout(() => {
506
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), s();
507
- }, a);
508
- }, 16);
509
- });
510
- }
511
- // Fade-based show animation
512
- async animateFadeShow(t, e) {
513
- return new Promise((s) => {
514
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
515
- const i = e.direction || "none", o = e.distance || 20, r = e.duration || 300;
516
- let a = "translateY(0) translateX(0)";
517
- i !== "none" && (a = i === "up" ? `translateY(${o}px)` : i === "down" ? `translateY(-${o}px)` : i === "left" ? `translateX(${o}px)` : `translateX(-${o}px)`), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", a, "important"), t.offsetHeight, setTimeout(() => {
518
- t.style.setProperty("transition", `opacity ${r}ms ease, transform ${r}ms ease`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) translateX(0)", "important"), setTimeout(() => {
519
- t.style.setProperty("transition", "none", "important"), s();
520
- }, r);
521
- }, 16);
522
- });
523
- }
524
- // Fade-based hide animation
525
- async animateFadeHide(t, e) {
526
- return new Promise((s) => {
527
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
528
- const i = e.direction || "none", o = e.distance || 20, r = e.duration || 200;
529
- let a = "translateY(0) translateX(0)";
530
- i !== "none" && (a = i === "up" ? `translateY(-${o}px)` : i === "down" ? `translateY(${o}px)` : i === "left" ? `translateX(-${o}px)` : `translateX(${o}px)`), setTimeout(() => {
531
- t.style.setProperty("transition", `opacity ${r}ms ease, transform ${r}ms ease`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", a, "important"), setTimeout(() => {
532
- t.style.setProperty("transition", "none", "important"), s();
533
- }, r);
534
- }, 16);
535
- });
536
- }
537
- // Elastic-based show animation
538
- async animateElasticShow(t, e) {
539
- return new Promise((s) => {
540
- var h, y, u;
541
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
542
- const i = ((h = t.parentElement) == null ? void 0 : h.classList.contains("editora-toast-bottom-right")) || ((y = t.parentElement) == null ? void 0 : y.classList.contains("editora-toast-bottom-left")) || ((u = t.parentElement) == null ? void 0 : u.classList.contains("editora-toast-bottom-center")), o = e.direction || (i ? "up" : "down"), r = e.intensity || "normal", a = e.duration || 1e3, c = r === "gentle" ? 0.1 : r === "strong" ? 0.3 : 0.2, l = o === "up" ? 40 : o === "down" ? -40 : o === "left" ? 40 : -40;
543
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
544
- "transform",
545
- o === "left" || o === "right" ? `translateX(${l}px) scale(${1 + c})` : `translateY(${l}px) scale(${1 + c})`,
546
- "important"
547
- ), t.offsetHeight, setTimeout(() => {
548
- t.style.setProperty(
549
- "transition",
550
- `opacity ${a}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${a}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,
551
- "important"
552
- ), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
553
- t.style.setProperty("transition", "none", "important"), s();
554
- }, a);
555
- }, 16);
556
- });
557
- }
558
- // Elastic-based hide animation
559
- async animateElasticHide(t, e) {
560
- return new Promise((s) => {
561
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
562
- const i = e.intensity || "normal", o = i === "gentle" ? 0.1 : i === "strong" ? 0.3 : 0.2;
563
- e.duration, setTimeout(() => {
564
- t.style.setProperty("transition", "opacity 0.4s ease, transform 0.4s ease", "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${1 + o})`, "important"), setTimeout(() => {
565
- t.style.setProperty("transition", "none", "important"), s();
566
- }, 400);
567
- }, 16);
568
- });
569
- }
570
- // Rotate-based show animation
571
- async animateRotateShow(t, e) {
572
- return new Promise((s) => {
573
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
574
- const i = e.degrees || 360, o = e.direction || "clockwise", r = e.origin || "center", a = e.duration || 500, c = o === "clockwise" ? i : -i;
575
- t.style.setProperty("transform-origin", r, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${c}deg) scale(0.8)`, "important"), t.offsetHeight, setTimeout(() => {
576
- t.style.setProperty("transition", `opacity ${a}ms ease, transform ${a}ms cubic-bezier(0.175, 0.885, 0.32, 1.275)`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "rotate(0deg) scale(1)", "important"), setTimeout(() => {
577
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
578
- }, a);
579
- }, 16);
580
- });
581
- }
582
- // Rotate-based hide animation
583
- async animateRotateHide(t, e) {
584
- return new Promise((s) => {
585
- t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
586
- const i = e.degrees || 180, o = e.direction || "counterclockwise", r = e.origin || "center", a = e.duration || 300, c = o === "clockwise" ? i : -i;
587
- t.style.setProperty("transform-origin", r, "important"), setTimeout(() => {
588
- t.style.setProperty("transition", `opacity ${a}ms ease, transform ${a}ms ease-in`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${c}deg) scale(0.8)`, "important"), setTimeout(() => {
589
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
590
- }, a);
591
- }, 16);
592
- });
593
- }
594
- }
595
- const H = new Z(), F = "http://www.w3.org/2000/svg", J = {
596
- success: [
597
- ["circle", { cx: "10", cy: "10", r: "8" }],
598
- ["path", { d: "M6.6 10.3l2.3 2.3 4.5-4.9" }]
599
- ],
600
- error: [
601
- ["circle", { cx: "10", cy: "10", r: "8" }],
602
- ["path", { d: "M7.6 7.6l4.8 4.8M12.4 7.6l-4.8 4.8" }]
603
- ],
604
- warning: [
605
- ["path", { d: "M10 2.9L18 16.4H2L10 2.9z" }],
606
- ["path", { d: "M10 8.3v3.4M10 13.9v.1" }]
607
- ],
608
- info: [
609
- ["circle", { cx: "10", cy: "10", r: "8" }],
610
- ["path", { d: "M10 9.2v4.4M10 6.5v.1" }]
611
- ],
612
- loading: [["path", { d: "M10 2a8 8 0 1 0 8 8" }]]
613
- }, tt = {
614
- success: "success",
615
- error: "error",
616
- warning: "warning",
617
- info: "info",
618
- loading: "loading",
619
- promise: "loading"
620
- };
621
- function I(n, t) {
622
- const e = document.createElementNS(F, "svg");
623
- return e.setAttribute("viewBox", "0 0 20 20"), e.setAttribute("width", String(t)), e.setAttribute("height", String(t)), e.setAttribute("fill", "none"), e.setAttribute("stroke", "currentColor"), e.setAttribute("stroke-width", "1.7"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "round"), e.setAttribute("focusable", "false"), e.setAttribute("aria-hidden", "true"), n.forEach(([s, i]) => {
624
- const o = document.createElementNS(F, s);
625
- Object.keys(i).forEach((r) => o.setAttribute(r, i[r])), e.appendChild(o);
626
- }), e;
627
- }
628
- function et(n) {
629
- const t = J[tt[n] || ""];
630
- return t ? I(t, 18) : null;
631
- }
632
- function st() {
633
- const n = I([["path", { d: "M5.5 5.5l9 9M14.5 5.5l-9 9" }]], 14);
634
- return n.setAttribute("stroke-width", "1.8"), n;
635
- }
636
- const B = 12, it = 0.05, O = 3, L = /* @__PURE__ */ new WeakMap();
637
- function ot(n) {
638
- const t = n.style.height;
639
- n.style.height = "auto";
640
- const e = n.offsetHeight;
641
- return n.style.height = t, L.set(n, e), e;
642
- }
643
- function rt(n) {
644
- L.delete(n);
645
- }
646
- function nt(n, t) {
647
- return !t.stack || t.expand || n.dataset.open === "true";
648
- }
649
- function at(n, t, e = !1) {
650
- const i = n.dataset.edge === "bottom" ? -1 : 1, o = Array.from(n.querySelectorAll(".editora-toast")), r = o.filter((d) => !d.classList.contains("hiding") && d.dataset.leaving !== "true"), a = r.slice().reverse(), c = nt(n, t);
651
- a.forEach((d) => {
652
- (e || !L.has(d)) && ot(d);
653
- });
654
- const l = a.map((d) => L.get(d) || 0), h = l[0] || 0;
655
- let y = 0;
656
- a.forEach((d, m) => {
657
- const T = l[m], f = c ? 1 : Math.max(1 - m * it, 0.8), w = c ? T : h, g = c ? y : m * B + h * (1 - f);
658
- d.style.setProperty("--et-y", `${i * g}px`), d.style.setProperty("--et-s", String(f)), d.style.setProperty("--et-index", String(m)), d.style.height = `${w}px`, d.style.zIndex = String(a.length - m), d.dataset.index = String(m), d.dataset.front = String(m === 0), d.dataset.collapsed = String(!c && m > 0), d.dataset.hidden = String(!c && m >= O), y += T + t.gap;
659
- }), o.forEach((d) => {
660
- r.includes(d) || (d.dataset.front = "false");
661
- });
662
- const u = a.length, v = c ? l.reduce((d, m) => d + m, 0) + Math.max(u - 1, 0) * t.gap : h + (Math.min(u, O) - 1 > 0 ? (Math.min(u, O) - 1) * B : 0);
663
- n.style.height = u > 0 ? `${v}px` : "0px", n.dataset.count = String(u), n.dataset.expanded = String(c);
664
- }
665
- class ct {
666
- constructor(t) {
667
- this.containers = /* @__PURE__ */ new Map(), this.cssInjected = !1, this.toastOf = /* @__PURE__ */ new WeakMap(), this.holds = /* @__PURE__ */ new Map(), this.timing = /* @__PURE__ */ new Map(), this.returnFocusTo = null, this.globalListeners = [], this.config = t;
668
- }
669
- updateConfig(t) {
670
- this.config = t, this.containers.forEach((e, s) => {
671
- this.applyContainerStyles(e, s), this.layout(e, !0);
672
- });
673
- }
674
- // Ensure container exists for position
675
- ensureContainer(t) {
676
- if (this.containers.has(t))
677
- return this.containers.get(t);
678
- const e = document.createElement("div");
679
- return e.className = `editora-toast-container editora-toast-${t.replace("-", "-")}`, e.setAttribute("role", "region"), e.setAttribute("aria-label", "Toast notifications"), e.setAttribute("aria-live", "polite"), e.dataset.expand = String(this.config.expand), e.dataset.stack = String(this.config.stack), this.applyContainerStyles(e, t), this.attachContainerListeners(e), document.body.appendChild(e), this.containers.set(t, e), this.attachGlobalListeners(), this.injectCSS(), e;
680
- }
681
- // Hovering or focusing the stack opens it and holds the timers; leaving closes it and lets them run on.
682
- attachContainerListeners(t) {
683
- t.addEventListener("mouseenter", () => {
684
- t.dataset.hover = "true", this.holdAll(t, "pointer"), this.syncOpen(t);
685
- }), t.addEventListener("pointerdown", (e) => {
686
- e.pointerType !== "touch" || t.dataset.hover === "true" || (t.dataset.hover = "true", this.holdAll(t, "pointer"), this.syncOpen(t));
687
- }), t.addEventListener("mouseleave", () => {
688
- delete t.dataset.hover, this.releaseAll(t, "pointer"), this.syncOpen(t);
689
- }), t.addEventListener("focusin", (e) => {
690
- this.isKeyboardFocus(e.target) && (t.dataset.focus = "true", this.holdAll(t, "focus"), this.syncOpen(t));
691
- }), t.addEventListener("focusout", (e) => {
692
- const s = e.relatedTarget;
693
- s && t.contains(s) || (delete t.dataset.focus, this.releaseAll(t, "focus"), this.syncOpen(t));
694
- }), t.addEventListener("keydown", (e) => this.onContainerKey(t, e));
695
- }
696
- syncOpen(t) {
697
- const e = t.dataset.hover === "true" || t.dataset.focus === "true";
698
- t.dataset.open = String(e), this.layout(t);
699
- }
700
- isKeyboardFocus(t) {
701
- if (!(t instanceof Element)) return !1;
702
- try {
703
- return t.matches(":focus-visible");
704
- } catch (e) {
705
- return !0;
706
- }
707
- }
708
- onContainerKey(t, e) {
709
- if (e.key !== "Escape") return;
710
- const s = e.target instanceof Element ? e.target.closest(".editora-toast") : null, i = s ? this.toastOf.get(s) : void 0;
711
- if (!s || !i) return;
712
- e.preventDefault();
713
- const o = Array.from(t.querySelectorAll(".editora-toast:not(.hiding)")), r = o[o.indexOf(s) + 1] || o[o.indexOf(s) - 1];
714
- i.dismiss(), r && r !== s ? r.focus() : this.restoreFocus();
715
- }
716
- restoreFocus() {
717
- const t = this.returnFocusTo;
718
- this.returnFocusTo = null, t && t.isConnected && t.focus();
719
- }
720
- // Document level behaviour: the hotkey that jumps to the toasts, a tap outside that closes an open stack, and
721
- // a resize that can change how much the text of a toast wraps.
722
- attachGlobalListeners() {
723
- if (this.globalListeners.length > 0 || typeof window == "undefined") return;
724
- const t = (e, s, i) => {
725
- e.addEventListener(s, i), this.globalListeners.push([e, s, i]);
726
- };
727
- t(document, "keydown", ((e) => {
728
- if (!this.matchesHotkey(e)) return;
729
- const s = Array.from(this.containers.values()).find((r) => r.querySelector(".editora-toast:not(.hiding)"));
730
- if (!s) return;
731
- const i = s.querySelector('.editora-toast[data-front="true"]');
732
- if (!i) return;
733
- e.preventDefault();
734
- const o = document.activeElement;
735
- o instanceof HTMLElement && !s.contains(o) && (this.returnFocusTo = o), i.focus();
736
- })), t(document, "pointerdown", ((e) => {
737
- this.containers.forEach((s) => {
738
- s.dataset.hover === "true" && !s.contains(e.target) && (delete s.dataset.hover, this.releaseAll(s, "pointer"), this.syncOpen(s));
739
- });
740
- })), t(window, "resize", (() => {
741
- window.clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => this.containers.forEach((e) => this.layout(e, !0)), 120);
742
- }));
743
- }
744
- matchesHotkey(t) {
745
- const e = this.config.hotkey;
746
- if (!e) return !1;
747
- const s = e.toLowerCase().split("+").map((r) => r.trim()).filter(Boolean), i = s.pop();
748
- if (!i) return !1;
749
- const o = (r) => s.includes(r);
750
- return t.altKey !== o("alt") || t.shiftKey !== o("shift") || t.ctrlKey !== o("ctrl") || t.metaKey !== (o("meta") || o("cmd")) ? !1 : t.code.toLowerCase() === `key${i}` || t.code.toLowerCase() === i || t.key.toLowerCase() === i;
751
- }
752
- layout(t, e = !1) {
753
- at(t, { stack: this.config.stack, expand: this.config.expand, gap: this.toPx(this.config.gap) }, e);
754
- }
755
- toPx(t) {
756
- if (typeof t == "number") return t;
757
- const e = parseFloat(t || "");
758
- return Number.isFinite(e) ? e : 8;
759
- }
760
- // Timer holds
761
- holdAll(t, e) {
762
- t.querySelectorAll(".editora-toast").forEach((s) => {
763
- const i = this.toastOf.get(s);
764
- if (!i) return;
765
- (e === "focus" ? i.options.pauseOnFocus : i.options.pauseOnHover) !== !1 && this.pauseToast(i, e);
766
- });
767
- }
768
- releaseAll(t, e) {
769
- t.querySelectorAll(".editora-toast").forEach((s) => {
770
- const i = this.toastOf.get(s);
771
- i && this.resumeToast(i, e);
772
- });
773
- }
774
- // Create toast element
775
- createToastElement(t) {
776
- const e = t.options, s = document.createElement("div");
777
- s.className = `editora-toast editora-toast-${e.level || "info"}`, s.dataset.level = e.level || "info", e.customClass && e.customClass.split(/\s+/).filter(Boolean).forEach((a) => s.classList.add(a)), s.setAttribute("role", e.role || (e.level === "error" ? "alert" : "status")), s.setAttribute("aria-atomic", "true"), s.tabIndex = 0, (e.closable || e.closeButton) && (s.dataset.closable = "true"), this.toastOf.set(s, t), e.ariaLive && e.ariaLive !== "off" && s.setAttribute("aria-live", e.ariaLive);
778
- const i = e.theme || this.config.theme;
779
- i && i !== "system" && s.setAttribute("data-theme", i), (this.config.richColors || i === "colored") && s.setAttribute("data-rich-colors", "true"), (e.rtl !== void 0 ? e.rtl : this.config.rtl) && (s.setAttribute("data-rtl", "true"), s.setAttribute("dir", "rtl"));
780
- const r = this.createContent(t);
781
- if (s.appendChild(r), e.actions && e.actions.length > 0) {
782
- const a = document.createElement("div");
783
- a.className = "editora-toast-actions", e.actions.forEach((c) => a.appendChild(this.createActionButton(c, t))), s.appendChild(a);
784
- }
785
- return (e.closable || e.closeButton) && s.appendChild(this.createCloseButton(t)), e.swipeDismiss && this.addSwipeDismiss(s, t), e.dragDismiss && this.addDragDismiss(s, t), s;
786
- }
787
- // Show toast with animation
788
- async showToast(t) {
789
- var o, r;
790
- const e = this.ensureContainer(t.options.position || this.config.position), s = this.createToastElement(t);
791
- t.element = s, e.appendChild(s), e.dataset.hover === "true" && t.options.pauseOnHover !== !1 && this.pauseToast(t, "pointer"), e.dataset.focus === "true" && t.options.pauseOnFocus !== !1 && this.pauseToast(t, "focus"), this.layout(e);
792
- const i = t.options.animation || this.config.animation || { type: "css" };
793
- await H.showToast(s, t, i), this.config.enableAccessibility && this.announceToast(t), (r = (o = t.options).onShow) == null || r.call(o), this.startTimer(t);
794
- }
795
- // Hide toast with animation
796
- async hideToast(t) {
797
- var i, o;
798
- if (!t.element) return;
799
- this.stopTimer(t), this.holds.delete(t.id);
800
- const e = t.element;
801
- e.dataset.leaving = "true", e.parentElement && this.layout(e.parentElement);
802
- const s = t.options.animation || this.config.animation || { type: "css" };
803
- if (await H.hideToast(e, t, s), t.element && t.element.parentNode) {
804
- const r = t.element.parentElement;
805
- t.element.parentNode.removeChild(t.element), t.element = void 0, r && (r.querySelector(".editora-toast") || (delete r.dataset.hover, delete r.dataset.focus, r.dataset.open = "false"), this.layout(r));
806
- }
807
- (o = (i = t.options).onHide) == null || o.call(i);
808
- }
809
- // Update toast content
810
- async updateToast(t, e) {
811
- var o, r, a;
812
- if (!t.element) return;
813
- const s = t.options.animation || this.config.animation || { type: "css" };
814
- if (s.type === "custom" && s.update) {
815
- await H.updateToast(t.element, t, e, s);
816
- return;
817
- }
818
- if (Object.assign(t.options, e), e.level && (t.element.className = t.element.className.replace(/editora-toast-(info|success|error|warning|loading|progress|promise|custom)/g, ""), t.element.classList.add(`editora-toast-${e.level}`), t.element.dataset.level = e.level), e.title !== void 0 || e.description !== void 0 || e.message !== void 0 || e.icon !== void 0 || e.level !== void 0 || e.render) {
819
- const c = t.element.querySelector(".editora-toast-content"), l = this.createContent(t);
820
- c == null || c.replaceWith(l);
821
- }
822
- const i = (o = e.closeButton) != null ? o : e.closable;
823
- if (i !== void 0) {
824
- t.options.closable = i, t.options.closeButton = i, i ? t.element.dataset.closable = "true" : delete t.element.dataset.closable;
825
- const c = t.element.querySelector(".editora-toast-close");
826
- i && !c ? t.element.appendChild(this.createCloseButton(t)) : !i && c && c.remove();
827
- }
828
- if (e.progress !== void 0) {
829
- const c = t.element.querySelector(".editora-toast-body"), l = t.element.querySelector(".editora-toast-progress-track");
830
- if (e.progress && c) {
831
- const h = this.createProgress(e.progress);
832
- l ? l.replaceWith(h) : c.appendChild(h);
833
- } else l && l.remove();
834
- }
835
- if (e.actions !== void 0 || e.action !== void 0 || e.cancel !== void 0) {
836
- let c = t.element.querySelector(".editora-toast-actions");
837
- const l = t.options.actions || [];
838
- l.length > 0 ? (c ? c.innerHTML = "" : (c = document.createElement("div"), c.className = "editora-toast-actions", t.element.appendChild(c)), c && l.forEach((h) => c.appendChild(this.createActionButton(h, t)))) : c && c.remove();
839
- }
840
- (e.duration !== void 0 || e.persistent !== void 0 || e.level !== void 0) && this.startTimer(t), t.element.style.height = "", rt(t.element), t.element.parentElement && this.layout(t.element.parentElement), (a = (r = t.options).onUpdate) == null || a.call(r, e);
841
- }
842
- createContent(t) {
843
- const e = t.options, s = document.createElement("div");
844
- s.className = "editora-toast-content";
845
- const i = this.createIcon(t);
846
- i && s.appendChild(i);
847
- const o = document.createElement("div");
848
- if (o.className = "editora-toast-body", e.render)
849
- o.appendChild(e.render(t));
850
- else {
851
- if (e.title) {
852
- const r = document.createElement("div");
853
- r.className = "editora-toast-title", r.textContent = e.title, o.appendChild(r);
854
- }
855
- if (e.message) {
856
- const r = document.createElement("div");
857
- r.className = "editora-toast-message", e.html ? U(r, e.message) : r.textContent = e.message, o.appendChild(r);
858
- }
859
- if (e.description) {
860
- const r = document.createElement("div");
861
- r.className = "editora-toast-description", r.textContent = e.description, o.appendChild(r);
862
- }
863
- }
864
- return e.progress && o.appendChild(this.createProgress(e.progress)), s.appendChild(o), s;
865
- }
866
- createProgress(t) {
867
- const e = Math.min(100, Math.max(0, t.value)), s = document.createElement("div");
868
- s.className = "editora-toast-progress-track", s.setAttribute("role", "progressbar"), s.setAttribute("aria-valuemin", "0"), s.setAttribute("aria-valuemax", "100"), s.setAttribute("aria-valuenow", String(e));
869
- const i = document.createElement("div");
870
- if (i.className = "editora-toast-progress-bar", i.style.width = `${e}%`, t.showPercentage) {
871
- const o = document.createElement("span");
872
- o.className = "editora-toast-progress-text", o.textContent = `${Math.round(t.value)}%`, s.appendChild(o);
873
- }
874
- return s.appendChild(i), s;
875
- }
876
- createCloseButton(t) {
877
- const e = document.createElement("button");
878
- return e.className = "editora-toast-close", e.setAttribute("type", "button"), e.setAttribute("aria-label", "Close notification"), e.appendChild(st()), e.onclick = () => t.dismiss(), e;
879
- }
880
- // The icon is the caller's own (text, emoji or a node), false for none, or else the built-in one of the level.
881
- createIcon(t) {
882
- const e = t.options;
883
- if (e.icon === !1) return null;
884
- const s = document.createElement("span");
885
- if (s.className = "editora-toast-icon", s.setAttribute("aria-hidden", "true"), typeof e.icon == "string" && e.icon)
886
- return s.textContent = e.icon, s;
887
- if (e.icon && typeof e.icon == "object")
888
- return s.appendChild(e.icon), s;
889
- if (this.config.icons === !1) return null;
890
- const i = e.level || "info", o = et(i);
891
- return o ? ((i === "loading" || i === "promise") && (s.dataset.spin = "true"), s.appendChild(o), s) : null;
892
- }
893
- createActionButton(t, e) {
894
- const s = document.createElement("button");
895
- return s.className = `editora-toast-action ${t.primary ? "primary" : ""}`, s.textContent = t.label, t.altText && s.setAttribute("aria-label", t.altText), s.onclick = (i) => {
896
- i.stopPropagation(), t.onClick(), t.dismissOnClick !== !1 && e.dismiss();
897
- }, s;
898
- }
899
- applyContainerStyles(t, e) {
900
- const s = this.toCssLength(this.config.offset), i = this.toCssLength(this.config.mobileOffset), o = this.toCssLength(this.config.gap);
901
- t.dataset.position = e, t.dataset.edge = e.startsWith("bottom") ? "bottom" : "top", t.dataset.expand = String(this.config.expand), t.dataset.stack = String(this.config.stack), t.style.setProperty("--editora-toast-offset", s), t.style.setProperty("--editora-toast-mobile-offset", i), t.style.setProperty("--editora-toast-gap", o), t.style.setProperty("--et-edge", e.startsWith("bottom") ? "1" : "-1");
902
- const r = {
903
- position: "fixed",
904
- zIndex: (this.config.zIndex || 2147483647).toString(),
905
- display: "block",
906
- width: "var(--et-width, 360px)",
907
- maxWidth: `calc(100vw - 2 * ${s})`,
908
- boxSizing: "border-box",
909
- top: "",
910
- right: "",
911
- bottom: "",
912
- left: "",
913
- transform: ""
914
- };
915
- switch (e) {
916
- case "top-left":
917
- r.top = `max(${s}, env(safe-area-inset-top))`, r.left = `max(${s}, env(safe-area-inset-left))`;
918
- break;
919
- case "top-center":
920
- r.top = `max(${s}, env(safe-area-inset-top))`, r.left = "50%", r.transform = "translateX(-50%)";
921
- break;
922
- case "top-right":
923
- r.top = `max(${s}, env(safe-area-inset-top))`, r.right = `max(${s}, env(safe-area-inset-right))`;
924
- break;
925
- case "bottom-left":
926
- r.bottom = `max(${s}, env(safe-area-inset-bottom))`, r.left = `max(${s}, env(safe-area-inset-left))`;
927
- break;
928
- case "bottom-center":
929
- r.bottom = `max(${s}, env(safe-area-inset-bottom))`, r.left = "50%", r.transform = "translateX(-50%)";
930
- break;
931
- case "bottom-right":
932
- r.bottom = `max(${s}, env(safe-area-inset-bottom))`, r.right = `max(${s}, env(safe-area-inset-right))`;
933
- break;
934
- case "center":
935
- r.top = "50%", r.left = "50%", r.transform = "translate(-50%, -50%)";
936
- break;
937
- }
938
- Object.assign(t.style, r), t.style.setProperty("--editora-toast-mobile-left", i);
939
- }
940
- toCssLength(t) {
941
- return typeof t == "number" ? `${t}px` : t || "16px";
942
- }
943
- // Auto-dismiss timer. It keeps the time that is left, so pausing a toast and letting go does not give it a
944
- // fresh full duration.
945
- startTimer(t) {
946
- if (this.stopTimer(t), t.options.persistent || t.options.duration === 0) {
947
- this.timing.delete(t.id);
948
- return;
949
- }
950
- this.arm(t, t.options.duration || this.config.duration);
951
- }
952
- arm(t, e) {
953
- var s;
954
- this.timing.set(t.id, { remaining: e, startedAt: Date.now() }), !((((s = this.holds.get(t.id)) == null ? void 0 : s.size) || 0) > 0) && (t.timeoutId = window.setTimeout(() => {
955
- t.timeoutId = void 0, t.dismiss();
956
- }, e));
957
- }
958
- stopTimer(t) {
959
- t.timeoutId && (clearTimeout(t.timeoutId), t.timeoutId = void 0);
960
- }
961
- pauseToast(t, e = "hover") {
962
- const s = this.holds.get(t.id) || /* @__PURE__ */ new Set();
963
- if (this.holds.set(t.id, s), s.size === 0 && t.timeoutId) {
964
- const i = this.timing.get(t.id);
965
- this.stopTimer(t), i && (i.remaining = Math.max(0, i.remaining - (Date.now() - i.startedAt)));
966
- }
967
- s.add(e);
968
- }
969
- resumeToast(t, e = "hover") {
970
- const s = this.holds.get(t.id);
971
- if (!s || !s.delete(e) || s.size > 0) return;
972
- this.holds.delete(t.id);
973
- const i = this.timing.get(t.id);
974
- i && !t.timeoutId && !t.options.persistent && t.options.duration !== 0 && this.arm(t, i.remaining);
975
- }
976
- // Swipe dismiss with directional control
977
- addSwipeDismiss(t, e) {
978
- let s = 0, i = 0, o = !1;
979
- const r = e.options.swipeDirection || this.config.swipeDirection || "any", a = 40;
980
- let c = "", l = !1;
981
- const h = 'button, a[href], input, select, textarea, label, summary, [role="button"], [contenteditable="true"]', y = () => {
982
- t.style.transform = c, t.style.transition = "", t.style.cursor = "", t.style.userSelect = "";
983
- }, u = (f, w) => {
984
- if ("changedTouches" in f || "touches" in f) {
985
- const g = w ? f.changedTouches : f.touches, b = g && g[0];
986
- return b ? { x: b.clientX, y: b.clientY } : null;
987
- }
988
- return { x: f.clientX, y: f.clientY };
989
- }, v = (f) => {
990
- const w = f.target;
991
- if (w instanceof Element && t.contains(w) && w.closest(h) || "button" in f && f.button !== 0) return;
992
- const g = u(f, !1);
993
- g && (o = !0, l = !1, s = g.x, i = g.y, c = t.style.transform || "");
994
- }, d = (f) => {
995
- var P, k;
996
- if (!o) return;
997
- const w = u(f, !1);
998
- if (!w) return;
999
- const g = w.x - s, b = w.y - i, x = 5;
1000
- if (!l && (Math.abs(g) > x || Math.abs(b) > x) && (l = !0, t.style.transition = "none", t.style.cursor = "grabbing", t.style.userSelect = "none", (k = (P = window.getSelection) == null ? void 0 : P.call(window)) == null || k.removeAllRanges()), l) {
1001
- const E = Math.abs(b) > Math.abs(g) ? 25 : 20, V = Math.min(Math.max(g * 0.2, -E), E), X = Math.min(Math.max(b * 0.2, -E), E);
1002
- t.style.transform = `${c} translate(${V}px, ${X}px)`, f.cancelable && f.preventDefault();
1003
- }
1004
- }, m = (f) => {
1005
- if (!o) return;
1006
- o = !1;
1007
- const w = l;
1008
- if (y(), !w) return;
1009
- const g = u(f, !0);
1010
- if (!g) return;
1011
- const b = g.x - s, x = g.y - i;
1012
- let P = !1;
1013
- const E = r === "vertical" || r === "up" || r === "down" ? 35 : a;
1014
- switch (r) {
1015
- case "any":
1016
- P = Math.abs(b) > a || Math.abs(x) > a;
1017
- break;
1018
- case "horizontal":
1019
- P = Math.abs(b) > a;
1020
- break;
1021
- case "vertical":
1022
- P = Math.abs(x) > E;
1023
- break;
1024
- case "left":
1025
- P = b < -a;
1026
- break;
1027
- case "right":
1028
- P = b > a;
1029
- break;
1030
- case "up":
1031
- P = x < -E;
1032
- break;
1033
- case "down":
1034
- P = x > E;
1035
- break;
1036
- }
1037
- P && e.dismiss();
1038
- }, T = () => {
1039
- o && (o = !1, l = !1, y());
1040
- };
1041
- t.addEventListener("dragstart", (f) => f.preventDefault()), t.addEventListener("touchstart", v, { passive: !0 }), t.addEventListener("touchmove", d, { passive: !1 }), t.addEventListener("touchend", m), t.addEventListener("touchcancel", T), t.addEventListener("mousedown", v), t.addEventListener("mousemove", d), t.addEventListener("mouseup", m), t.addEventListener("mouseleave", m);
1042
- }
1043
- // Drag dismiss (simplified)
1044
- addDragDismiss(t, e) {
1045
- this.addSwipeDismiss(t, e);
1046
- }
1047
- // Accessibility
1048
- announceToast(t) {
1049
- if (t.options.ariaLive === "off") return;
1050
- const e = document.createElement("div");
1051
- e.setAttribute("aria-live", t.options.ariaLive || (t.options.level === "error" ? "assertive" : "polite")), e.setAttribute("aria-atomic", "true"), e.style.position = "absolute", e.style.left = "-10000px", e.style.width = "1px", e.style.height = "1px", e.style.overflow = "hidden";
1052
- const s = [t.options.title, t.options.message, t.options.description].filter(Boolean).join(". ");
1053
- e.textContent = `${t.options.level || "info"}: ${s}`, document.body.appendChild(e), setTimeout(() => {
1054
- e.remove();
1055
- }, 1e3);
1056
- }
1057
- // Inject CSS
1058
- injectCSS() {
1059
- if (this.cssInjected || typeof document == "undefined") return;
1060
- if (!Array.from(document.styleSheets).find(
1061
- (e) => {
1062
- var s, i, o, r;
1063
- return ((i = (s = e.ownerNode) == null ? void 0 : s.href) == null ? void 0 : i.includes("toast.css")) || ((r = (o = e.ownerNode) == null ? void 0 : o.textContent) == null ? void 0 : r.includes("editora-toast"));
1064
- }
1065
- )) {
1066
- const e = document.createElement("style");
1067
- e.setAttribute("data-editora-toast-fallback", "true"), e.textContent = ".editora-toast-container{position:fixed;width:360px;max-width:100vw;box-sizing:border-box}.editora-toast{position:absolute;left:0;width:100%;box-sizing:border-box;padding:12px 14px;background:#fff;color:#111;border:1px solid #ddd;border-radius:12px;font:13px/1.45 system-ui,sans-serif;overflow:hidden;pointer-events:auto;opacity:0;translate:0 var(--et-y,0px);scale:var(--et-s,1);transition:opacity .2s,translate .3s,scale .3s,height .3s}.editora-toast-container[data-edge=bottom] .editora-toast{bottom:0}.editora-toast-container[data-edge=top] .editora-toast{top:0}.editora-toast.show{opacity:1}.editora-toast.hiding,.editora-toast[data-hidden=true]{opacity:0}", document.head.appendChild(e);
1068
- }
1069
- this.cssInjected = !0;
1070
- }
1071
- // Cleanup
1072
- destroy() {
1073
- this.globalListeners.forEach(([t, e, s]) => t.removeEventListener(e, s)), this.globalListeners = [], window.clearTimeout(this.resizeTimer), this.containers.forEach((t) => {
1074
- t.parentNode && t.parentNode.removeChild(t);
1075
- }), this.containers.clear();
1076
- }
1077
- }
1078
- class lt {
1079
- constructor() {
1080
- this.plugins = [], this.hooks = {
1081
- beforeShow: [],
1082
- afterShow: [],
1083
- beforeHide: [],
1084
- afterHide: [],
1085
- beforeUpdate: [],
1086
- afterUpdate: []
1087
- };
1088
- }
1089
- // Plugin management
1090
- use(t) {
1091
- if (this.plugins.find((e) => e.name === t.name)) {
1092
- console.warn(`Plugin "${t.name}" is already installed`);
1093
- return;
1094
- }
1095
- this.plugins.push(t), t.install(this);
1096
- }
1097
- remove(t) {
1098
- const e = this.plugins.findIndex((i) => i.name === t);
1099
- if (e === -1) return !1;
1100
- const s = this.plugins[e];
1101
- return s.uninstall && s.uninstall(this), this.plugins.splice(e, 1), !0;
1102
- }
1103
- getPlugins() {
1104
- return [...this.plugins];
1105
- }
1106
- // Hook registration
1107
- on(t, e) {
1108
- this.hooks[t] && this.hooks[t].push(e);
1109
- }
1110
- off(t, e) {
1111
- if (this.hooks[t]) {
1112
- const s = this.hooks[t].indexOf(e);
1113
- s !== -1 && this.hooks[t].splice(s, 1);
1114
- }
1115
- }
1116
- // Hook execution
1117
- async trigger(t, e, ...s) {
1118
- const i = this.hooks[t];
1119
- if (!(!i || i.length === 0))
1120
- for (const o of i)
1121
- try {
1122
- await o(e, ...s);
1123
- } catch (r) {
1124
- console.error(`Error in ${t} hook:`, r);
1125
- }
1126
- }
1127
- // Convenience methods for common lifecycle events
1128
- async beforeShow(t) {
1129
- await this.trigger("beforeShow", t);
1130
- }
1131
- async afterShow(t) {
1132
- await this.trigger("afterShow", t);
1133
- }
1134
- async beforeHide(t) {
1135
- await this.trigger("beforeHide", t);
1136
- }
1137
- async afterHide(t) {
1138
- await this.trigger("afterHide", t);
1139
- }
1140
- async beforeUpdate(t, e) {
1141
- await this.trigger("beforeUpdate", t, e);
1142
- }
1143
- async afterUpdate(t, e) {
1144
- await this.trigger("afterUpdate", t, e);
1145
- }
1146
- // Editor integration hooks (for RTE)
1147
- onEditorEvent(t, e) {
1148
- const s = `editor:${t}`;
1149
- this.hooks[s] || (this.hooks[s] = []), this.hooks[s].push(e);
1150
- }
1151
- triggerEditorEvent(t, e, ...s) {
1152
- const i = `editor:${t}`;
1153
- this.trigger(i, e, ...s);
1154
- }
1155
- // Promise lifecycle helpers
1156
- async handlePromise(t, e, s, i) {
1157
- e();
1158
- try {
1159
- const o = await t;
1160
- return s(o), o;
1161
- } catch (o) {
1162
- throw i(o), o;
1163
- }
1164
- }
1165
- // Batch operations
1166
- async batchShow(t) {
1167
- const e = t.map((i) => this.beforeShow(i));
1168
- await Promise.all(e);
1169
- const s = t.map((i) => this.afterShow(i));
1170
- await Promise.all(s);
1171
- }
1172
- async batchHide(t) {
1173
- const e = t.map((i) => this.beforeHide(i));
1174
- await Promise.all(e);
1175
- const s = t.map((i) => this.afterHide(i));
1176
- await Promise.all(s);
1177
- }
1178
- // Cleanup
1179
- destroy() {
1180
- this.plugins.forEach((t) => {
1181
- t.uninstall && t.uninstall(this);
1182
- }), this.plugins = [], Object.keys(this.hooks).forEach((t) => {
1183
- this.hooks[t] = [];
1184
- });
1185
- }
1186
- }
1187
- const D = {
1188
- position: "bottom-right",
1189
- duration: 4e3,
1190
- maxVisible: 3,
1191
- queueStrategy: "fifo",
1192
- theme: "system",
1193
- richColors: !1,
1194
- expand: !1,
1195
- stack: !0,
1196
- offset: 16,
1197
- mobileOffset: 16,
1198
- gap: 8,
1199
- pauseOnHover: !0,
1200
- pauseOnFocus: !0,
1201
- pauseOnWindowBlur: !1,
1202
- // Don't pause by default
1203
- swipeDismiss: !0,
1204
- swipeDirection: "any",
1205
- // Allow any direction by default
1206
- dragDismiss: !1,
1207
- rtl: !1,
1208
- // LTR by default
1209
- enableAccessibility: !0,
1210
- closeButton: !1,
1211
- icons: !0,
1212
- hotkey: "alt+t",
1213
- preventDuplicate: !1,
1214
- dedupeScope: "all",
1215
- animation: { type: "css" }
1216
- // Default to CSS animations
1217
- };
1218
- class q {
1219
- constructor(t = {}) {
1220
- this.idCounter = 0, this.pendingShows = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Set(), this.config = this.normalizeConfig({ ...D, ...t }), this.store = new j(this.config), this.queue = new W(this.config), this.renderer = new ct(this.config), this.lifecycle = new lt(), this.setupWindowFocusHandling();
1221
- }
1222
- // Core API
1223
- show(t) {
1224
- const e = t.id || `toast-${++this.idCounter}`, s = {
1225
- id: e,
1226
- options: this.normalizeToastOptions({ ...this.config, ...t }, t),
1227
- createdAt: Date.now(),
1228
- dismiss: () => this.dismiss(e),
1229
- update: (r) => this.update(e, r)
1230
- }, i = this.lifecycle.beforeShow(s).then(async () => {
1231
- const r = this.queue.enqueue(s);
1232
- r.rejected || (this.store.addToast(s), await this.hideToasts(r.hide, !0), await this.showToasts(r.show), this.notify());
1233
- });
1234
- this.pendingShows.set(e, i);
1235
- const o = () => {
1236
- this.pendingShows.get(e) === i && this.pendingShows.delete(e);
1237
- };
1238
- return i.then(o, o), s;
1239
- }
1240
- update(t, e) {
1241
- const s = this.pendingShows.get(t);
1242
- if (s)
1243
- return s.then(() => this.update(t, e), () => {
1244
- }), !0;
1245
- const i = this.store.getToast(t);
1246
- return i ? (this.lifecycle.beforeUpdate(i, e).then(async () => {
1247
- const o = this.normalizeToastOptions({ ...i.options, ...e }, e);
1248
- this.store.updateToast(t, { options: o }), this.queue.isVisible(t) && await this.renderer.updateToast(i, e), this.lifecycle.afterUpdate(i, e), this.notify();
1249
- }), !0) : !1;
1250
- }
1251
- dismiss(t) {
1252
- const e = this.pendingShows.get(t);
1253
- if (e)
1254
- return e.then(() => this.dismiss(t), () => {
1255
- }), !0;
1256
- const s = this.store.getToast(t);
1257
- return s ? (this.lifecycle.beforeHide(s).then(async () => {
1258
- const i = this.queue.isVisible(t), o = this.queue.dequeue(t);
1259
- i && await this.renderer.hideToast(s), this.store.removeToast(t), this.lifecycle.afterHide(s), await this.showToasts(o.show), this.notify();
1260
- }), !0) : !1;
1261
- }
1262
- clear() {
1263
- const t = this.queue.clear();
1264
- Promise.all(t.map((e) => this.hideOne(e, !1))).then(() => {
1265
- this.store.clear(), this.notify();
1266
- });
1267
- }
1268
- // Promise API
1269
- async promise(t, e) {
1270
- var i, o;
1271
- const s = this.show(this.normalizeOptions(e.loading, "loading"));
1272
- try {
1273
- const r = await t, a = this.normalizeResult(
1274
- typeof e.success == "function" ? e.success(r) : e.success,
1275
- "success"
1276
- );
1277
- return a.duration === void 0 && !a.persistent && (a.duration = this.config.duration), this.update(s.id, a), (i = e.onSuccess) == null || i.call(e, r), r;
1278
- } catch (r) {
1279
- const a = this.normalizeResult(
1280
- typeof e.error == "function" ? e.error(r) : e.error,
1281
- "error"
1282
- );
1283
- throw a.duration === void 0 && !a.persistent && (a.duration = this.config.duration), this.update(s.id, a), (o = e.onError) == null || o.call(e, r), r;
1284
- }
1285
- }
1286
- // Group API
1287
- group(t, e) {
1288
- return this.show({ ...e, group: t });
1289
- }
1290
- // Plugin API
1291
- use(t) {
1292
- this.lifecycle.use(t);
1293
- }
1294
- // Configuration
1295
- configure(t) {
1296
- const e = this.config.pauseOnWindowBlur, s = { ...this.config, ...t };
1297
- t.maxVisible !== void 0 && t.visibleToasts === void 0 && delete s.visibleToasts, this.config = this.normalizeConfig(s), this.store.updateConfig(this.config), this.renderer.updateConfig(this.config);
1298
- const i = this.queue.updateConfig(this.config);
1299
- this.hideToasts(i.hide, !0).then(() => this.showToasts(i.show)).then(() => this.notify()), t.pauseOnWindowBlur !== void 0 && t.pauseOnWindowBlur !== e && (this.teardownWindowFocusHandling(), this.setupWindowFocusHandling());
1300
- }
1301
- getConfig() {
1302
- return { ...this.config };
1303
- }
1304
- // State queries
1305
- getToasts() {
1306
- return this.store.getAllToasts();
1307
- }
1308
- getState() {
1309
- return {
1310
- toasts: this.store.getAllToasts(),
1311
- visible: this.queue.getVisible(),
1312
- queued: this.queue.getQueued(),
1313
- groups: this.store.getAllGroups(),
1314
- config: this.getConfig()
1315
- };
1316
- }
1317
- subscribe(t) {
1318
- return this.subscribers.add(t), t(this.getState()), () => {
1319
- this.subscribers.delete(t);
1320
- };
1321
- }
1322
- getGroups() {
1323
- return this.store.getAllGroups();
1324
- }
1325
- // Convenience methods for backward compatibility
1326
- info(t, e) {
1327
- return this.show({ message: t, level: "info", duration: e });
1328
- }
1329
- success(t, e) {
1330
- return this.show({ message: t, level: "success", duration: e });
1331
- }
1332
- error(t, e) {
1333
- return this.show({ message: t, level: "error", duration: e });
1334
- }
1335
- warning(t, e) {
1336
- return this.show({ message: t, level: "warning", duration: e });
1337
- }
1338
- loading(t, e) {
1339
- return this.show({ message: t, level: "loading", duration: e });
1340
- }
1341
- // Utility methods
1342
- normalizeOptions(t, e) {
1343
- return typeof t == "string" ? { message: t, level: e } : { ...t, level: t.level || e };
1344
- }
1345
- // The result of a promise replaces the loading toast's text. update() merges, so a result given as options
1346
- // without a message (a title and a description, say) would otherwise keep showing the loading message.
1347
- normalizeResult(t, e) {
1348
- const s = this.normalizeOptions(t, e);
1349
- return "message" in s ? s : { ...s, message: void 0 };
1350
- }
1351
- normalizeConfig(t) {
1352
- const e = t.visibleToasts || t.maxVisible || D.maxVisible;
1353
- return {
1354
- ...t,
1355
- maxVisible: e,
1356
- visibleToasts: e
1357
- };
1358
- }
1359
- // `options` is the caller's options already merged over the config (or over the toast's current options when
1360
- // updating); `explicit` is just what the caller passed. The close button has to be decided from what the
1361
- // caller passed first: the merged object always carries the config's `closeButton: false`, so reading it
1362
- // first made an explicit `closable: true` lose and the documented option silently did nothing.
1363
- normalizeToastOptions(t, e = t) {
1364
- var r, a, c, l, h, y;
1365
- const s = (l = (c = (a = (r = e.closeButton) != null ? r : e.closable) != null ? a : t.closable) != null ? c : t.closeButton) != null ? l : this.config.closeButton, i = t.action ? { ...t.action, primary: (h = t.action.primary) != null ? h : !0 } : void 0, o = [
1366
- ...i ? [i] : [],
1367
- ...t.cancel ? [t.cancel] : [],
1368
- ...t.actions || []
1369
- ];
1370
- return {
1371
- ...t,
1372
- closable: s,
1373
- // Keep the alias in step: the renderer shows the button if either flag is set, and the merged config
1374
- // value would otherwise re-enable a button the caller explicitly turned off.
1375
- closeButton: s,
1376
- actions: o.length > 0 ? o : void 0,
1377
- ariaLive: t.ariaLive || (t.level === "error" || t.important ? "assertive" : "polite"),
1378
- role: t.role || (t.level === "error" || t.important ? "alert" : "status"),
1379
- preventDuplicate: (y = t.preventDuplicate) != null ? y : this.config.preventDuplicate,
1380
- dedupeScope: t.dedupeScope || this.config.dedupeScope
1381
- };
1382
- }
1383
- async showToasts(t) {
1384
- for (const e of t)
1385
- await this.renderer.showToast(e), await this.lifecycle.afterShow(e);
1386
- }
1387
- async hideToasts(t, e) {
1388
- for (const s of t)
1389
- await this.hideOne(s, e);
1390
- }
1391
- async hideOne(t, e) {
1392
- await this.lifecycle.beforeHide(t), await this.renderer.hideToast(t), e && this.store.removeToast(t.id), await this.lifecycle.afterHide(t);
1393
- }
1394
- notify() {
1395
- if (this.subscribers.size === 0) return;
1396
- const t = this.getState();
1397
- this.subscribers.forEach((e) => e(t));
1398
- }
1399
- // Editor integration (for RTE)
1400
- onEditorEvent(t, e) {
1401
- this.lifecycle.onEditorEvent(t, e);
1402
- }
1403
- triggerEditorEvent(t, e, ...s) {
1404
- this.lifecycle.triggerEditorEvent(t, e, ...s);
1405
- }
1406
- // Window focus/blur handling
1407
- setupWindowFocusHandling() {
1408
- typeof window == "undefined" || typeof document == "undefined" || !this.config.pauseOnWindowBlur || (this.teardownWindowFocusHandling(), this.windowBlurHandler = () => this.pauseAllToasts(), this.windowFocusHandler = () => this.resumeAllToasts(), this.visibilityChangeHandler = () => {
1409
- document.hidden ? this.pauseAllToasts() : this.resumeAllToasts();
1410
- }, window.addEventListener("blur", this.windowBlurHandler), window.addEventListener("focus", this.windowFocusHandler), document.addEventListener("visibilitychange", this.visibilityChangeHandler));
1411
- }
1412
- teardownWindowFocusHandling() {
1413
- typeof window != "undefined" && (this.windowBlurHandler && (window.removeEventListener("blur", this.windowBlurHandler), this.windowBlurHandler = void 0), this.windowFocusHandler && (window.removeEventListener("focus", this.windowFocusHandler), this.windowFocusHandler = void 0), typeof document != "undefined" && this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = void 0));
1414
- }
1415
- pauseAllToasts() {
1416
- this.store.getAllToasts().forEach((t) => this.renderer.pauseToast(t, "window"));
1417
- }
1418
- resumeAllToasts() {
1419
- this.store.getAllToasts().forEach((t) => this.renderer.resumeToast(t, "window"));
1420
- }
1421
- // Cleanup
1422
- destroy() {
1423
- this.teardownWindowFocusHandling(), this.clear(), this.renderer.destroy(), this.lifecycle.destroy();
1424
- }
1425
- }
1426
- let S = null;
1427
- function p() {
1428
- return S || (S = new q()), S;
1429
- }
1430
- const dt = (n) => ({
1431
- id: n.id || "",
1432
- options: n,
1433
- createdAt: 0,
1434
- dismiss: () => {
1435
- },
1436
- update: () => {
1437
- }
1438
- });
1439
- function z(n) {
1440
- return typeof document == "undefined" ? dt(n) : p().show(n);
1441
- }
1442
- function Y(n, t, e, s) {
1443
- let i = {};
1444
- t && typeof t == "object" ? i = { ...t } : typeof t == "number" && (i.duration = t), e && (i.theme = e), s && (i.position = s);
1445
- const o = {
1446
- message: n,
1447
- ...i,
1448
- level: i.level || void 0
1449
- };
1450
- return i.duration !== void 0 && (o.duration = i.duration), i.position && (o.position = i.position), i.theme && (o.theme = i.theme), o;
1451
- }
1452
- function C(n) {
1453
- return (t, e, s, i) => z({
1454
- ...Y(t, e, s, i),
1455
- level: n
1456
- });
1457
- }
1458
- const $ = () => typeof document != "undefined";
1459
- function ut(n, t, e, s) {
1460
- const i = Y(n, t, e, s);
1461
- return z({ ...i, level: i.level || "custom" });
1462
- }
1463
- const N = Object.assign(ut, {
1464
- info: C("info"),
1465
- success: C("success"),
1466
- error: C("error"),
1467
- warning: C("warning"),
1468
- loading: C("loading"),
1469
- // Full options (title, description, actions, progress, ...). Returns the toast.
1470
- show: (n) => z(n),
1471
- // One toast that follows a promise from loading to success or error. Resolves with the promise's value.
1472
- promise: (n, t) => $() ? p().promise(n, t) : n,
1473
- update: (n, t) => $() ? p().update(n, t) : !1,
1474
- // With an id: that toast. Without: all of them.
1475
- dismiss: (n) => $() ? n === void 0 ? (p().clear(), !0) : p().dismiss(n) : !1,
1476
- clear: () => {
1477
- $() && p().clear();
1478
- },
1479
- configure: (n) => {
1480
- $() && p().configure(n);
1481
- }
1482
- }), A = {
1483
- // Core methods
1484
- show: (n) => p().show(n),
1485
- update: (n, t) => p().update(n, t),
1486
- dismiss: (n) => p().dismiss(n),
1487
- clear: () => p().clear(),
1488
- // Convenience methods
1489
- info: (n, t) => p().show({ message: n, level: "info", ...t }),
1490
- success: (n, t) => p().show({ message: n, level: "success", ...t }),
1491
- error: (n, t) => p().show({ message: n, level: "error", ...t }),
1492
- warning: (n, t) => p().show({ message: n, level: "warning", ...t }),
1493
- loading: (n, t) => p().show({ message: n, level: "loading", ...t }),
1494
- // Advanced features
1495
- promise: (n, t) => p().promise(n, t),
1496
- group: (n, t) => p().group(n, t),
1497
- configure: (n) => p().configure(n),
1498
- use: (n) => p().use(n),
1499
- // State queries
1500
- getToasts: () => p().getToasts(),
1501
- getGroups: () => p().getGroups(),
1502
- getConfig: () => p().getConfig(),
1503
- getState: () => p().getState(),
1504
- subscribe: (n) => p().subscribe(n),
1505
- // Editor integration
1506
- onEditorEvent: (n, t) => p().onEditorEvent(n, t),
1507
- triggerEditorEvent: (n, t, ...e) => p().triggerEditorEvent(n, t, ...e),
1508
- // Cleanup
1509
- destroy: () => {
1510
- S && (S.destroy(), S = null);
1511
- }
1512
- };
1513
- if (typeof window != "undefined" && typeof document != "undefined") {
1514
- const n = window;
1515
- n.toast = N, n.toastAdvanced = A, n.toastPro = A, n.ToastManager = q, n.__editoraToastReady || (n.__editoraToastReady = !0, window.dispatchEvent(
1516
- new CustomEvent("toastReady", {
1517
- detail: { toast: N, toastAdvanced: A, toastPro: A, ToastManager: q }
1518
- })
1519
- ));
1520
- }
1
+ import { p as t } from "./chunks/toast-CISbzOBc.es.js";
2
+ import { T as i, t as s, t as n, a as d, a as g } from "./chunks/toast-CISbzOBc.es.js";
3
+ const e = ':root{--editora-toast-stylesheet: 1;--et-bg: #ffffff;--et-bg-subtle: #f6f6f5;--et-border: rgba(0,0,0,.09);--et-border-strong: rgba(0,0,0,.16);--et-text: #1c1917;--et-text-muted: #6b6560;--et-text-inverse: #fafaf9;--et-info: #2563eb;--et-success: #15803d;--et-error: #dc2626;--et-warning: #b45309;--et-loading: #4f46e5;--et-promise: #4f46e5;--et-info-tint: rgba(37,99,235,.08);--et-info-ring: rgba(37,99,235,.28);--et-success-tint: rgba(21,128,61,.08);--et-success-ring: rgba(21,128,61,.28);--et-error-tint: rgba(220,38,38,.07);--et-error-ring: rgba(220,38,38,.28);--et-warning-tint: rgba(180,83,9,.08);--et-warning-ring: rgba(180,83,9,.3);--et-loading-tint: rgba(79,70,229,.07);--et-loading-ring: rgba(79,70,229,.26);--et-promise-tint: var(--et-loading-tint);--et-promise-ring: var(--et-loading-ring);--et-radius: 12px;--et-radius-sm: 8px;--et-width: 356px;--et-offset: 20px;--et-gap: 8px;--et-z: 2147483647;--et-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.04), 0 10px 28px rgba(0,0,0,.1);--et-dur-enter: .3s;--et-dur-exit: .2s;--et-ease-enter: cubic-bezier(.16,1,.3,1);--et-ease-exit: cubic-bezier(.4,0,1,1);--et-ease-move: cubic-bezier(.32,.72,0,1);--et-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--et-font-size-title: 13.5px;--et-font-size-body: 13px;--et-font-size-desc: 12.5px;--et-font-size-action: 12.5px;--editora-toast-bg: var(--et-bg);--editora-toast-color: var(--et-text);--editora-toast-muted-color: var(--et-text-muted);--editora-toast-border: var(--et-border);--editora-toast-shadow: var(--et-shadow);--editora-toast-border-radius: var(--et-radius);--editora-toast-font-family: var(--et-font);--editora-toast-font-size: var(--et-font-size-body);--editora-toast-gap: var(--et-gap);--editora-toast-z-index: var(--et-z);--editora-toast-width: var(--et-width);--editora-toast-offset: var(--et-offset);--editora-toast-mobile-offset: 12px}@media(prefers-color-scheme:dark){:root{--et-bg: #19181a;--et-bg-subtle: #232225;--et-border: rgba(255,255,255,.1);--et-border-strong: rgba(255,255,255,.18);--et-text: #f5f5f4;--et-text-muted: #a8a29e;--et-text-inverse: #19181a;--et-info: #60a5fa;--et-success: #4ade80;--et-error: #f87171;--et-warning: #fbbf24;--et-loading: #a5b4fc;--et-promise: #a5b4fc;--et-info-tint: rgba(96,165,250,.13);--et-info-ring: rgba(96,165,250,.32);--et-success-tint: rgba(74,222,128,.11);--et-success-ring: rgba(74,222,128,.3);--et-error-tint: rgba(248,113,113,.12);--et-error-ring: rgba(248,113,113,.32);--et-warning-tint: rgba(251,191,36,.11);--et-warning-ring: rgba(251,191,36,.3);--et-loading-tint: rgba(165,180,252,.12);--et-loading-ring: rgba(165,180,252,.3);--et-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 2px 6px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.45)}}:root.dark,:root[data-theme=dark],:root[data-bs-theme=dark],:root[data-color-scheme=dark],:root[data-mantine-color-scheme=dark]{--et-bg: #19181a;--et-bg-subtle: #232225;--et-border: rgba(255,255,255,.1);--et-border-strong: rgba(255,255,255,.18);--et-text: #f5f5f4;--et-text-muted: #a8a29e;--et-text-inverse: #19181a;--et-info: #60a5fa;--et-success: #4ade80;--et-error: #f87171;--et-warning: #fbbf24;--et-loading: #a5b4fc;--et-promise: #a5b4fc;--et-info-tint: rgba(96,165,250,.13);--et-info-ring: rgba(96,165,250,.32);--et-success-tint: rgba(74,222,128,.11);--et-success-ring: rgba(74,222,128,.3);--et-error-tint: rgba(248,113,113,.12);--et-error-ring: rgba(248,113,113,.32);--et-warning-tint: rgba(251,191,36,.11);--et-warning-ring: rgba(251,191,36,.3);--et-loading-tint: rgba(165,180,252,.12);--et-loading-ring: rgba(165,180,252,.3);--et-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 2px 6px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.45)}:root.light,:root[data-theme=light],:root[data-bs-theme=light],:root[data-color-scheme=light],:root[data-mantine-color-scheme=light]{--et-bg: #ffffff;--et-bg-subtle: #f6f6f5;--et-border: rgba(0,0,0,.09);--et-border-strong: rgba(0,0,0,.16);--et-text: #1c1917;--et-text-muted: #6b6560;--et-text-inverse: #fafaf9;--et-info: #2563eb;--et-success: #15803d;--et-error: #dc2626;--et-warning: #b45309;--et-loading: #4f46e5;--et-promise: #4f46e5;--et-info-tint: rgba(37,99,235,.08);--et-info-ring: rgba(37,99,235,.28);--et-success-tint: rgba(21,128,61,.08);--et-success-ring: rgba(21,128,61,.28);--et-error-tint: rgba(220,38,38,.07);--et-error-ring: rgba(220,38,38,.28);--et-warning-tint: rgba(180,83,9,.08);--et-warning-ring: rgba(180,83,9,.3);--et-loading-tint: rgba(79,70,229,.07);--et-loading-ring: rgba(79,70,229,.26);--et-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.04), 0 10px 28px rgba(0,0,0,.1)}.editora-toast-container{position:fixed;z-index:var(--et-z);width:var(--et-width);max-width:calc(100vw - 2 * var(--et-offset));box-sizing:border-box;pointer-events:auto}.editora-toast-container[data-count="0"]{pointer-events:none}[dir=rtl] .editora-toast-container,.editora-toast-container[data-rtl=true]{direction:rtl}[dir=rtl] .editora-toast,.editora-toast[data-rtl=true]{direction:rtl;text-align:right}.editora-toast[data-rtl=true] .editora-toast-close,[dir=rtl] .editora-toast .editora-toast-close{right:auto;left:8px}.editora-toast[data-rtl=true][data-closable=true],[dir=rtl] .editora-toast[data-closable=true]{padding-right:14px;padding-left:40px}.editora-toast[data-rtl=true]:has(.editora-toast-icon) .editora-toast-actions,[dir=rtl] .editora-toast:has(.editora-toast-icon) .editora-toast-actions{margin-left:0;margin-right:28px}.editora-toast{--et-accent: var(--et-info);position:absolute;left:0;width:100%;box-sizing:border-box;padding:12px 14px;background:var(--et-bg);color:var(--et-text);border:1px solid var(--et-border);border-radius:var(--et-radius);box-shadow:var(--et-shadow);font-family:var(--et-font);font-size:var(--et-font-size-body);line-height:1.45;pointer-events:auto;touch-action:none;overflow:hidden;outline:none;-webkit-font-smoothing:antialiased;translate:0 var(--et-y, 0px);scale:var(--et-s, 1);opacity:0;transform:translateY(calc(var(--et-edge, 1) * 18px)) scale(.97);transition:opacity var(--et-dur-exit) var(--et-ease-exit),transform var(--et-dur-exit) var(--et-ease-exit),translate .38s var(--et-ease-move),scale .38s var(--et-ease-move),height .38s var(--et-ease-move),box-shadow .2s ease}.editora-toast-container[data-edge=bottom] .editora-toast{bottom:0;transform-origin:50% 100%}.editora-toast-container[data-edge=top] .editora-toast{top:0;transform-origin:50% 0}.editora-toast.show{opacity:1;transform:none;transition:opacity var(--et-dur-enter) var(--et-ease-enter),transform var(--et-dur-enter) var(--et-ease-enter),translate .38s var(--et-ease-move),scale .38s var(--et-ease-move),height .38s var(--et-ease-move),box-shadow .2s ease}.editora-toast.hiding{opacity:0;transform:translateY(calc(var(--et-edge, 1) * 12px)) scale(.96);pointer-events:none}.editora-toast.spring-animation{transition:none!important;animation:none!important}.editora-toast[data-collapsed=true]{pointer-events:none}.editora-toast[data-collapsed=true]>*{opacity:0;transition:opacity .2s ease}.editora-toast[data-hidden=true]{opacity:0!important;pointer-events:none}.editora-toast-info{--et-accent: var(--et-info)}.editora-toast-success{--et-accent: var(--et-success)}.editora-toast-error{--et-accent: var(--et-error)}.editora-toast-warning{--et-accent: var(--et-warning)}.editora-toast-loading,.editora-toast-progress,.editora-toast-promise{--et-accent: var(--et-loading)}.editora-toast[data-rich-colors=true]:not([data-theme=colored]).editora-toast-info{background:linear-gradient(var(--et-info-tint),var(--et-info-tint)),var(--et-bg);border-color:var(--et-info-ring)}.editora-toast[data-rich-colors=true]:not([data-theme=colored]).editora-toast-success{background:linear-gradient(var(--et-success-tint),var(--et-success-tint)),var(--et-bg);border-color:var(--et-success-ring)}.editora-toast[data-rich-colors=true]:not([data-theme=colored]).editora-toast-error{background:linear-gradient(var(--et-error-tint),var(--et-error-tint)),var(--et-bg);border-color:var(--et-error-ring)}.editora-toast[data-rich-colors=true]:not([data-theme=colored]).editora-toast-warning{background:linear-gradient(var(--et-warning-tint),var(--et-warning-tint)),var(--et-bg);border-color:var(--et-warning-ring)}.editora-toast[data-rich-colors=true]:not([data-theme=colored]).editora-toast-loading,.editora-toast[data-rich-colors=true]:not([data-theme=colored]).editora-toast-promise{background:linear-gradient(var(--et-loading-tint),var(--et-loading-tint)),var(--et-bg);border-color:var(--et-loading-ring)}.editora-toast[data-closable=true]{padding-right:40px}.editora-toast-content{display:flex;align-items:flex-start;gap:10px;min-height:20px}.editora-toast-icon{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:18px;height:18px;margin-top:1px;color:var(--et-accent);font-size:15px;line-height:1}.editora-toast-icon svg{display:block}.editora-toast-icon[data-spin=true] svg{animation:et-spin .8s linear infinite}.editora-toast-body{flex:1;min-width:0}.editora-toast-title{font-size:var(--et-font-size-title);font-weight:600;letter-spacing:-.01em;line-height:1.35;margin:0;color:var(--et-text)}.editora-toast-message{line-height:1.45;overflow-wrap:anywhere;color:var(--et-text)}.editora-toast-body>.editora-toast-message:only-child{font-weight:500}.editora-toast-title+.editora-toast-message,.editora-toast-title+.editora-toast-description,.editora-toast-message+.editora-toast-description{margin-top:2px}.editora-toast-description{color:var(--et-text-muted);font-size:var(--et-font-size-desc);line-height:1.45;overflow-wrap:anywhere}.editora-toast-actions{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap;justify-content:flex-start}.editora-toast:has(.editora-toast-icon) .editora-toast-actions{margin-left:28px}.editora-toast-action{height:28px;padding:0 12px;border:1px solid var(--et-border-strong);background:transparent;color:var(--et-text);border-radius:var(--et-radius-sm);font-size:var(--et-font-size-action);font-weight:500;font-family:var(--et-font);line-height:1;cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;transition:background .15s ease,border-color .15s ease,transform .1s ease,opacity .15s ease}.editora-toast-action:hover{background:var(--et-bg-subtle)}.editora-toast-action:active{transform:scale(.97)}.editora-toast-action.primary{background:var(--et-action-bg, var(--et-text));border-color:var(--et-action-bg, var(--et-text));color:var(--et-action-ink, var(--et-bg))}.editora-toast-action.primary:hover{background:var(--et-action-bg, var(--et-text));opacity:.88}.editora-toast-close{position:absolute;top:8px;right:8px;width:24px;height:24px;padding:0;display:grid;place-items:center;border:0;background:transparent;color:var(--et-text-muted);border-radius:7px;cursor:pointer;opacity:0;transition:opacity .16s ease,background .15s ease,color .15s ease;z-index:1}.editora-toast-close svg{display:block}.editora-toast:hover .editora-toast-close,.editora-toast:focus-within .editora-toast-close,.editora-toast-close:focus-visible{opacity:1}@media(hover:none){.editora-toast-close{opacity:1}}.editora-toast-close:hover{background:var(--et-bg-subtle);color:var(--et-text)}.editora-toast-close:active{transform:scale(.92)}.editora-toast-progress-track{position:relative;height:4px;margin-top:10px;border-radius:99px;background:var(--et-border)}.editora-toast-progress-bar{height:100%;border-radius:inherit;background:var(--et-accent);transition:width .25s ease}.editora-toast-progress-text{position:absolute;top:-17px;right:0;font-size:11px;font-variant-numeric:tabular-nums;color:var(--et-text-muted)}.editora-toast-group{margin-bottom:4px}.editora-toast-group-header{font-size:10px;font-weight:600;opacity:.55;margin-bottom:4px;text-transform:uppercase;letter-spacing:.06em}.editora-toast-group-collapsed{max-height:40px;overflow:hidden}@keyframes et-spin{to{transform:rotate(360deg)}}.editora-toast[data-theme=light]{--et-bg: #ffffff;--et-bg-subtle: #f6f6f5;--et-border: rgba(0,0,0,.09);--et-border-strong: rgba(0,0,0,.16);--et-text: #1c1917;--et-text-muted: #6b6560;--et-info: #2563eb;--et-success: #15803d;--et-error: #dc2626;--et-warning: #b45309;--et-loading: #4f46e5;--et-promise: #4f46e5;--et-info-tint: rgba(37,99,235,.08);--et-info-ring: rgba(37,99,235,.28);--et-success-tint: rgba(21,128,61,.08);--et-success-ring: rgba(21,128,61,.28);--et-error-tint: rgba(220,38,38,.07);--et-error-ring: rgba(220,38,38,.28);--et-warning-tint: rgba(180,83,9,.08);--et-warning-ring: rgba(180,83,9,.3);--et-loading-tint: rgba(79,70,229,.07);--et-loading-ring: rgba(79,70,229,.26);--et-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.04), 0 10px 28px rgba(0,0,0,.1)}.editora-toast[data-theme=dark]{--et-bg: #19181a;--et-bg-subtle: #232225;--et-border: rgba(255,255,255,.1);--et-border-strong: rgba(255,255,255,.18);--et-text: #f5f5f4;--et-text-muted: #a8a29e;--et-info: #60a5fa;--et-success: #4ade80;--et-error: #f87171;--et-warning: #fbbf24;--et-loading: #a5b4fc;--et-promise: #a5b4fc;--et-info-tint: rgba(96,165,250,.13);--et-info-ring: rgba(96,165,250,.32);--et-success-tint: rgba(74,222,128,.11);--et-success-ring: rgba(74,222,128,.3);--et-error-tint: rgba(248,113,113,.12);--et-error-ring: rgba(248,113,113,.32);--et-warning-tint: rgba(251,191,36,.11);--et-warning-ring: rgba(251,191,36,.3);--et-loading-tint: rgba(165,180,252,.12);--et-loading-ring: rgba(165,180,252,.3);--et-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 2px 6px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.45)}.editora-toast[data-theme=minimal]{--et-bg: #ffffff;--et-bg-subtle: #f6f6f5;--et-text: #1c1917;--et-text-muted: #6b6560;--et-border: rgba(0,0,0,.14);--et-border-strong: rgba(0,0,0,.22);--et-info: #2563eb;--et-success: #15803d;--et-error: #dc2626;--et-warning: #b45309;--et-loading: #4f46e5;border-radius:6px;box-shadow:0 1px 3px #00000014;border-left:3px solid var(--et-accent)}.editora-toast[data-theme=colored]{--et-info: #2563eb;--et-success: #15803d;--et-error: #c81e1e;--et-warning: #b45309;--et-loading: #4f46e5;--et-text: #ffffff;--et-text-muted: rgba(255,255,255,.95);--et-bg-subtle: rgba(255,255,255,.16);--et-border: rgba(255,255,255,.22);--et-border-strong: rgba(255,255,255,.38);--et-action-bg: #ffffff;--et-action-ink: var(--et-accent);background:var(--et-accent);border-color:transparent;box-shadow:0 8px 22px #00000038}.editora-toast[data-theme=colored] .editora-toast-icon{color:#fff}.editora-toast[data-theme=colored] .editora-toast-progress-bar{background:#fff}.editora-toast[data-theme=glass]{--et-bg: rgba(24,24,27,.72);--et-bg-subtle: rgba(255,255,255,.1);--et-text: #ffffff;--et-text-muted: rgba(255,255,255,.86);--et-border: rgba(255,255,255,.16);--et-border-strong: rgba(255,255,255,.3);--et-info: #7dd3fc;--et-success: #86efac;--et-error: #fca5a5;--et-warning: #fcd34d;--et-loading: #c4b5fd;--et-action-bg: #ffffff;--et-action-ink: #18181b;-webkit-backdrop-filter:blur(22px) saturate(170%);backdrop-filter:blur(22px) saturate(170%);box-shadow:0 10px 34px #00000047,inset 0 1px #ffffff24}.editora-toast[data-theme=neon]{--et-bg: #09090b;--et-bg-subtle: #18181b;--et-text: #e4e4e7;--et-text-muted: #a1a1aa;--et-border: rgba(255,255,255,.08);--et-border-strong: rgba(255,255,255,.2);--et-info: #38bdf8;--et-success: #4ade80;--et-error: #f87171;--et-warning: #fbbf24;--et-loading: #a5b4fc;border-color:var(--et-accent);box-shadow:0 0 18px color-mix(in srgb,var(--et-accent) 28%,transparent),0 4px 12px #00000080}.editora-toast[data-theme=ocean]{--et-bg: #0f2942;--et-bg-subtle: #1a3d5c;--et-text: #e0f2fe;--et-text-muted: rgba(224,242,254,.76);--et-border: rgba(186,230,253,.18);--et-border-strong: rgba(186,230,253,.32);--et-info: #38bdf8;--et-success: #34d399;--et-error: #fb7185;--et-warning: #fbbf24;--et-loading: #a5b4fc;background:linear-gradient(135deg,#0f2942,#1a3d5c);box-shadow:0 8px 28px #0f294266}.editora-toast[data-theme=forest]{--et-bg: #052e16;--et-bg-subtle: #14532d;--et-text: #dcfce7;--et-text-muted: rgba(220,252,231,.76);--et-border: rgba(220,252,231,.16);--et-border-strong: rgba(220,252,231,.3);--et-info: #4ade80;--et-success: #86efac;--et-error: #fca5a5;--et-warning: #fde68a;--et-loading: #6ee7b7;background:linear-gradient(135deg,#052e16,#14532d);box-shadow:0 8px 28px #052e1666}.editora-toast[data-theme=sunset]{--et-bg: #431407;--et-bg-subtle: #7c2d12;--et-text: #fed7aa;--et-text-muted: rgba(254,215,170,.78);--et-border: rgba(254,215,170,.16);--et-border-strong: rgba(254,215,170,.3);--et-info: #fb923c;--et-success: #fbbf24;--et-error: #fca5a5;--et-warning: #fde68a;--et-loading: #d8b4fe;background:linear-gradient(135deg,#431407,#7c2d12);box-shadow:0 8px 28px #43140766}.editora-toast[data-theme=midnight]{--et-bg: #0a0a0f;--et-bg-subtle: #14141f;--et-text: #e2e8f0;--et-text-muted: rgba(226,232,240,.72);--et-border: rgba(226,232,240,.1);--et-border-strong: rgba(226,232,240,.22);--et-info: #60a5fa;--et-success: #34d399;--et-error: #f87171;--et-warning: #fbbf24;--et-loading: #a5b4fc;box-shadow:0 8px 28px #0009,inset 0 1px #ffffff0a}.editora-toast[data-theme=retro]{--et-bg: #fefce8;--et-bg-subtle: #fef9c3;--et-text: #1c1917;--et-text-muted: #57534e;--et-border: #1c1917;--et-border-strong: #1c1917;--et-info: #1d4ed8;--et-success: #15803d;--et-error: #b91c1c;--et-warning: #b45309;--et-loading: #4338ca;border:2px solid var(--et-accent);border-radius:6px;box-shadow:4px 4px 0 var(--et-accent);font-family:Courier New,Courier,monospace}.editora-toast:focus-visible,.editora-toast-action:focus-visible,.editora-toast-close:focus-visible{outline:2px solid var(--et-focus, var(--et-info));outline-offset:2px}@media(prefers-reduced-motion:reduce){.editora-toast,.editora-toast.show,.editora-toast.hiding{transition:opacity .1s ease!important;transform:none!important}.editora-toast-icon[data-spin=true] svg{animation-duration:1.6s}}@media(prefers-contrast:more){.editora-toast{border-color:var(--et-text);box-shadow:none}.editora-toast-description,.editora-toast-progress-text{color:var(--et-text)}.editora-toast-close{opacity:1;color:var(--et-text)}.editora-toast-action{border-color:var(--et-text)}}@media(forced-colors:active){.editora-toast{forced-color-adjust:none;background:Canvas;color:CanvasText;border:1px solid CanvasText;box-shadow:none}.editora-toast-title,.editora-toast-message,.editora-toast-description,.editora-toast-progress-text,.editora-toast-icon{color:CanvasText}.editora-toast-action{background:ButtonFace;color:ButtonText;border-color:ButtonText}.editora-toast-action.primary{background:Highlight;color:HighlightText;border-color:Highlight}.editora-toast-close{opacity:1;color:ButtonText}.editora-toast-action:focus-visible,.editora-toast-close:focus-visible{outline:2px solid Highlight;outline-offset:2px}.editora-toast-progress-track{background:GrayText}.editora-toast-progress-bar{background:Highlight}}@media(max-width:480px){.editora-toast-container{left:max(12px,env(safe-area-inset-left))!important;right:max(12px,env(safe-area-inset-right))!important;width:auto!important;max-width:none!important;transform:none!important}.editora-toast-container[data-position=center]{top:max(12px,env(safe-area-inset-top))!important}.editora-toast-action{flex:1;justify-content:center}}.editora-toast .close{position:absolute;top:10px;right:10px;background:none;border:none;color:inherit;cursor:pointer;font-size:16px;opacity:.5;transition:opacity .2s ease}.editora-toast .close:hover{opacity:1}';
4
+ t(e);
1521
5
  export {
1522
- q as ToastManager,
1523
- N as default,
1524
- N as toast,
1525
- A as toastAdvanced,
1526
- A as toastPro
6
+ i as ToastManager,
7
+ s as default,
8
+ n as toast,
9
+ d as toastAdvanced,
10
+ g as toastPro
1527
11
  };
1528
12
  //# sourceMappingURL=index.esm.js.map