@editora/toast 2.0.4 → 2.0.6

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,4 +1,4 @@
1
- class k {
1
+ class A {
2
2
  constructor(t) {
3
3
  this.toasts = /* @__PURE__ */ new Map(), this.groups = /* @__PURE__ */ new Map(), this.containers = /* @__PURE__ */ new Map(), this.config = { ...t };
4
4
  }
@@ -7,8 +7,8 @@ class k {
7
7
  this.toasts.set(t.id, t), this.updateGroup(t);
8
8
  }
9
9
  removeToast(t) {
10
- const s = this.toasts.get(t);
11
- return s ? (this.toasts.delete(t), this.updateGroup(s), !0) : !1;
10
+ const e = this.toasts.get(t);
11
+ return e ? (this.toasts.delete(t), this.updateGroup(e), !0) : !1;
12
12
  }
13
13
  getToast(t) {
14
14
  return this.toasts.get(t);
@@ -17,19 +17,19 @@ class k {
17
17
  return Array.from(this.toasts.values());
18
18
  }
19
19
  getToastsByPosition(t) {
20
- return this.getAllToasts().filter((s) => s.options.position === t);
20
+ return this.getAllToasts().filter((e) => e.options.position === t);
21
21
  }
22
- updateToast(t, s) {
23
- const e = this.toasts.get(t);
24
- return e ? (Object.assign(e, s), this.updateGroup(e), !0) : !1;
22
+ updateToast(t, e) {
23
+ const s = this.toasts.get(t);
24
+ return s ? (Object.assign(s, e), this.updateGroup(s), !0) : !1;
25
25
  }
26
26
  // Group management
27
27
  updateGroup(t) {
28
- const s = t.options.group;
29
- if (!s)
28
+ const e = t.options.group;
29
+ if (!e)
30
30
  return;
31
- let e = this.groups.get(s);
32
- e || (e = { id: s, toasts: [] }, this.groups.set(s, e)), e.toasts = e.toasts.filter((i) => i.id !== t.id), t.options.group === s && e.toasts.push(t), e.toasts.length === 0 && this.groups.delete(s);
31
+ let s = this.groups.get(e);
32
+ 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);
33
33
  }
34
34
  getGroup(t) {
35
35
  return this.groups.get(t);
@@ -41,8 +41,8 @@ class k {
41
41
  getContainer(t) {
42
42
  return this.containers.get(t);
43
43
  }
44
- setContainer(t, s) {
45
- this.containers.set(t, s);
44
+ setContainer(t, e) {
45
+ this.containers.set(t, e);
46
46
  }
47
47
  removeContainer(t) {
48
48
  return this.containers.delete(t);
@@ -77,51 +77,28 @@ class k {
77
77
  }
78
78
  class M {
79
79
  constructor(t) {
80
- this.queue = [], this.visible = [], this.config = t;
80
+ this.queue = [], this.visible = [], this.config = this.normalizeConfig(t);
81
81
  }
82
- // Add toast to queue
83
82
  enqueue(t) {
84
- this.deduplicate(t), this.config.queueStrategy === "fifo" ? this.queue.push(t) : this.queue.unshift(t), this.queue.sort((s, e) => (e.options.priority || 0) - (s.options.priority || 0)), this.processQueue();
85
- }
86
- // Remove toast from queue/visible
87
- dequeue(t) {
88
- let s = !1;
89
- const e = this.queue.findIndex((r) => r.id === t);
90
- e !== -1 && (this.queue.splice(e, 1), s = !0);
91
- const i = this.visible.findIndex((r) => r.id === t);
92
- return i !== -1 && (this.visible.splice(i, 1), s = !0), s && this.processQueue(), s;
93
- }
94
- // Process queue to show toasts within limits
95
- processQueue() {
96
- const t = this.config.maxVisible;
97
- for (; this.visible.length > t; ) {
98
- const s = this.visible.pop();
99
- this.hideToast(s);
83
+ var r;
84
+ const e = this.findDuplicate(t);
85
+ if (e && ((r = t.options.preventDuplicate) != null ? r : this.config.preventDuplicate))
86
+ return { show: [], hide: [], rejected: e };
87
+ const s = [];
88
+ if (t.options.important && this.visible.length >= this.maxVisible) {
89
+ const o = this.removeLowestPriorityVisible();
90
+ return this.visible.push(t), { show: [t], hide: o ? [...s, o] : s };
100
91
  }
101
- for (; this.visible.length < t && this.queue.length > 0; ) {
102
- const s = this.queue.shift();
103
- this.showToast(s);
104
- }
105
- }
106
- showToast(t) {
107
- this.visible.push(t);
92
+ this.config.queueStrategy === "fifo" ? this.queue.push(t) : this.queue.unshift(t), this.sortQueue();
93
+ const i = this.processQueue();
94
+ return { show: i.show, hide: [...s, ...i.hide] };
108
95
  }
109
- hideToast(t) {
110
- }
111
- // Deduplicate toasts with same message and level
112
- deduplicate(t) {
113
- this.queue.filter(
114
- (e) => e.options.message === t.options.message && e.options.level === t.options.level
115
- ).forEach((e) => {
116
- const i = this.queue.indexOf(e);
117
- i !== -1 && this.queue.splice(i, 1);
118
- });
96
+ dequeue(t) {
97
+ return this.removeFromCollections(t) ? { show: this.processQueue().show, hide: [] } : { show: [], hide: [] };
119
98
  }
120
- // Update configuration
121
99
  updateConfig(t) {
122
- this.config = { ...this.config, ...t }, this.processQueue();
100
+ return this.config = this.normalizeConfig({ ...this.config, ...t }), this.sortQueue(), this.processQueue();
123
101
  }
124
- // Get current state
125
102
  getQueued() {
126
103
  return [...this.queue];
127
104
  }
@@ -131,525 +108,614 @@ class M {
131
108
  getAll() {
132
109
  return [...this.visible, ...this.queue];
133
110
  }
134
- // Clear all
111
+ isVisible(t) {
112
+ return this.visible.some((e) => e.id === t);
113
+ }
135
114
  clear() {
136
115
  const t = [...this.visible, ...this.queue];
137
- this.queue = [], this.visible = [], t.forEach((s) => {
138
- s.element && this.hideToast(s);
139
- });
116
+ return this.queue = [], this.visible = [], t;
140
117
  }
141
- // Force show a high-priority toast (bypass queue)
142
- forceShow(t) {
143
- if (this.visible.length >= this.config.maxVisible) {
144
- const s = this.visible.reduce(
145
- (e, i) => (i.options.priority || 0) < (e.options.priority || 0) ? i : e
146
- );
147
- this.dequeue(s.id);
118
+ processQueue() {
119
+ const t = [], e = [];
120
+ for (; this.visible.length > this.maxVisible; ) {
121
+ const s = this.visible.pop();
122
+ s && e.push(s);
123
+ }
124
+ for (; this.visible.length < this.maxVisible && this.queue.length > 0; ) {
125
+ const s = this.queue.shift();
126
+ if (!s)
127
+ break;
128
+ this.visible.push(s), t.push(s);
148
129
  }
149
- this.showToast(t);
130
+ return { show: t, hide: e };
131
+ }
132
+ removeLowestPriorityVisible() {
133
+ if (this.visible.length === 0)
134
+ return;
135
+ let t = 0;
136
+ for (let e = 1; e < this.visible.length; e += 1)
137
+ (this.visible[e].options.priority || 0) < (this.visible[t].options.priority || 0) && (t = e);
138
+ return this.visible.splice(t, 1)[0];
139
+ }
140
+ removeFromCollections(t) {
141
+ const e = this.visible.findIndex((i) => i.id === t);
142
+ if (e !== -1)
143
+ return this.visible.splice(e, 1)[0];
144
+ const s = this.queue.findIndex((i) => i.id === t);
145
+ if (s !== -1)
146
+ return this.queue.splice(s, 1)[0];
147
+ }
148
+ findDuplicate(t) {
149
+ 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);
150
+ return s.find((r) => this.getDedupeKey(r) === i);
151
+ }
152
+ getDedupeKey(t) {
153
+ return t.options.dedupeKey || `${t.options.level || "info"}:${t.options.title || ""}:${t.options.message || ""}:${t.options.description || ""}`;
154
+ }
155
+ sortQueue() {
156
+ this.queue.sort((t, e) => {
157
+ const s = (e.options.priority || 0) - (t.options.priority || 0);
158
+ return s !== 0 ? s : t.createdAt - e.createdAt;
159
+ });
160
+ }
161
+ get maxVisible() {
162
+ return Math.max(1, this.config.visibleToasts || this.config.maxVisible || 1);
163
+ }
164
+ normalizeConfig(t) {
165
+ return {
166
+ ...t,
167
+ maxVisible: t.visibleToasts || t.maxVisible
168
+ };
150
169
  }
151
170
  }
152
- class A {
171
+ class q {
153
172
  constructor(t = {}) {
154
- var s, e, i, r;
173
+ var e, s, i, r;
155
174
  this.config = {
156
- stiffness: (s = t.stiffness) != null ? s : 100,
157
- damping: (e = t.damping) != null ? e : 10,
175
+ stiffness: (e = t.stiffness) != null ? e : 100,
176
+ damping: (s = t.damping) != null ? s : 10,
158
177
  mass: (i = t.mass) != null ? i : 1,
159
178
  precision: (r = t.precision) != null ? r : 0.01
160
179
  };
161
180
  }
162
181
  // Spring animation function
163
- animate(t, s, e, i, r) {
164
- const n = {
182
+ animate(t, e, s, i, r) {
183
+ const o = {
165
184
  ...this.config,
166
185
  ...r
167
186
  };
168
- let o, a = !1;
169
- const l = Object.keys(s).reduce((u, d) => (u[d] = s[d].from, u), {}), p = Object.keys(s).reduce((u, d) => (u[d] = 0, u), {}), y = () => {
170
- if (a)
187
+ let a, c = !1;
188
+ const d = Object.keys(e).reduce((p, l) => (p[l] = e[l].from, p), {}), h = Object.keys(e).reduce((p, l) => (p[l] = 0, p), {}), f = () => {
189
+ if (c)
171
190
  return;
172
- let u = !0;
173
- Object.keys(s).forEach((g) => {
174
- const b = s[g].to, m = l[g], w = p[g], f = -n.stiffness * (m - b), v = -n.damping * w, H = (f + v) / n.mass;
175
- p[g] += H * 0.016, l[g] += p[g] * 0.016, (Math.abs(m - b) > n.precision || Math.abs(w) > n.precision) && (u = !1);
191
+ let p = !0;
192
+ Object.keys(e).forEach((y) => {
193
+ const b = e[y].to, m = d[y], w = h[y], g = -o.stiffness * (m - b), v = -o.damping * w, E = (g + v) / o.mass;
194
+ h[y] += E * 0.016, d[y] += h[y] * 0.016, (Math.abs(m - b) > o.precision || Math.abs(w) > o.precision) && (p = !1);
176
195
  });
177
- const d = Object.keys(l).reduce((g, b) => {
178
- const m = s[b].unit || "px";
179
- return g[b] = `${l[b]}${m}`, g;
196
+ const l = Object.keys(d).reduce((y, b) => {
197
+ const m = e[b].unit || "px";
198
+ return y[b] = `${d[b]}${m}`, y;
180
199
  }, {});
181
- e(d), u ? (a = !0, i == null || i()) : o = requestAnimationFrame(y);
200
+ s(l), p ? (c = !0, i == null || i()) : a = requestAnimationFrame(f);
182
201
  };
183
- return o = requestAnimationFrame(y), () => {
184
- a = !0, o && cancelAnimationFrame(o);
202
+ return a = requestAnimationFrame(f), () => {
203
+ c = !0, a && cancelAnimationFrame(a);
185
204
  };
186
205
  }
187
206
  }
188
- class q {
207
+ class z {
189
208
  constructor() {
190
- this.springAnimation = new A();
209
+ this.springAnimation = new q();
191
210
  }
192
211
  // Show toast with specified animation
193
- async showToast(t, s, e) {
194
- switch (e.type) {
212
+ async showToast(t, e, s) {
213
+ switch (s.type) {
195
214
  case "spring":
196
- await this.animateSpringShow(t, e);
215
+ await this.animateSpringShow(t, s);
197
216
  break;
198
217
  case "bounce":
199
- await this.animateBounceShow(t, e);
218
+ await this.animateBounceShow(t, s);
200
219
  break;
201
220
  case "slide":
202
- await this.animateSlideShow(t, e);
221
+ await this.animateSlideShow(t, s);
203
222
  break;
204
223
  case "zoom":
205
- await this.animateZoomShow(t, e);
224
+ await this.animateZoomShow(t, s);
206
225
  break;
207
226
  case "flip":
208
- await this.animateFlipShow(t, e);
227
+ await this.animateFlipShow(t, s);
209
228
  break;
210
229
  case "fade":
211
- await this.animateFadeShow(t, e);
230
+ await this.animateFadeShow(t, s);
212
231
  break;
213
232
  case "elastic":
214
- await this.animateElasticShow(t, e);
233
+ await this.animateElasticShow(t, s);
215
234
  break;
216
235
  case "rotate":
217
- await this.animateRotateShow(t, e);
236
+ await this.animateRotateShow(t, s);
218
237
  break;
219
238
  case "custom":
220
- e.show ? await Promise.resolve(e.show(t, s)) : this.animateCssShow(t);
239
+ s.show ? await Promise.resolve(s.show(t, e)) : await this.animateCssShow(t);
221
240
  break;
222
241
  case "css":
223
242
  default:
224
- this.animateCssShow(t);
243
+ await this.animateCssShow(t);
225
244
  break;
226
245
  }
227
246
  }
228
247
  // Hide toast with specified animation
229
- async hideToast(t, s, e) {
230
- switch (e.type) {
248
+ async hideToast(t, e, s) {
249
+ switch (s.type) {
231
250
  case "spring":
232
- await this.animateSpringHide(t, e);
251
+ await this.animateSpringHide(t, s);
233
252
  break;
234
253
  case "bounce":
235
- await this.animateBounceHide(t, e);
254
+ await this.animateBounceHide(t, s);
236
255
  break;
237
256
  case "slide":
238
- await this.animateSlideHide(t, e);
257
+ await this.animateSlideHide(t, s);
239
258
  break;
240
259
  case "zoom":
241
- await this.animateZoomHide(t, e);
260
+ await this.animateZoomHide(t, s);
242
261
  break;
243
262
  case "flip":
244
- await this.animateFlipHide(t, e);
263
+ await this.animateFlipHide(t, s);
245
264
  break;
246
265
  case "fade":
247
- await this.animateFadeHide(t, e);
266
+ await this.animateFadeHide(t, s);
248
267
  break;
249
268
  case "elastic":
250
- await this.animateElasticHide(t, e);
269
+ await this.animateElasticHide(t, s);
251
270
  break;
252
271
  case "rotate":
253
- await this.animateRotateHide(t, e);
272
+ await this.animateRotateHide(t, s);
254
273
  break;
255
274
  case "custom":
256
- e.hide ? await Promise.resolve(e.hide(t, s)) : this.animateCssHide(t);
275
+ s.hide ? await Promise.resolve(s.hide(t, e)) : await this.animateCssHide(t);
257
276
  break;
258
277
  case "css":
259
278
  default:
260
- this.animateCssHide(t);
279
+ await this.animateCssHide(t);
261
280
  break;
262
281
  }
263
282
  }
264
283
  // Update toast with specified animation
265
- async updateToast(t, s, e, i) {
266
- i.type === "custom" && i.update && await Promise.resolve(i.update(t, s, e));
284
+ async updateToast(t, e, s, i) {
285
+ i.type === "custom" && i.update && await Promise.resolve(i.update(t, e, s));
267
286
  }
268
287
  // CSS-based show animation (existing behavior)
269
288
  animateCssShow(t) {
270
- requestAnimationFrame(() => {
271
- t.classList.add("show");
289
+ return new Promise((e) => {
290
+ requestAnimationFrame(() => {
291
+ t.classList.add("show"), window.setTimeout(e, 220);
292
+ });
272
293
  });
273
294
  }
274
295
  // CSS-based hide animation (existing behavior)
275
296
  animateCssHide(t) {
276
- t.classList.remove("show"), t.classList.add("hiding");
297
+ return new Promise((e) => {
298
+ t.classList.remove("show"), t.classList.add("hiding"), window.setTimeout(e, 220);
299
+ });
277
300
  }
278
301
  // Spring-based show animation
279
- async animateSpringShow(t, s) {
280
- return new Promise((e) => {
281
- var n, o, a;
302
+ async animateSpringShow(t, e) {
303
+ return new Promise((s) => {
304
+ var o, a, c;
282
305
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important"), t.style.setProperty("-webkit-transition", "none", "important");
283
- const r = ((n = t.parentElement) == null ? void 0 : n.classList.contains("editora-toast-bottom-right")) || ((o = t.parentElement) == null ? void 0 : o.classList.contains("editora-toast-bottom-left")) || ((a = t.parentElement) == null ? void 0 : a.classList.contains("editora-toast-bottom-center")) ? 20 : -20;
306
+ const r = ((o = t.parentElement) == null ? void 0 : o.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;
284
307
  t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `translateY(${r}px) scale(0.95)`, "important"), t.offsetHeight, setTimeout(() => {
285
308
  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(() => {
286
- t.style.setProperty("transition", "none", "important"), e();
309
+ t.style.setProperty("transition", "none", "important"), s();
287
310
  }, 800);
288
311
  }, 16);
289
312
  });
290
313
  }
291
314
  // Spring-based hide animation
292
- async animateSpringHide(t, s) {
293
- return new Promise((e) => {
315
+ async animateSpringHide(t, e) {
316
+ return new Promise((s) => {
294
317
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important"), t.style.setProperty("-webkit-transition", "none", "important"), setTimeout(() => {
295
318
  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(() => {
296
- t.style.setProperty("transition", "none", "important"), e();
319
+ t.style.setProperty("transition", "none", "important"), s();
297
320
  }, 400);
298
321
  }, 16);
299
322
  });
300
323
  }
301
324
  // Bounce-based show animation
302
- async animateBounceShow(t, s) {
303
- return new Promise((e) => {
304
- var p, y, u;
325
+ async animateBounceShow(t, e) {
326
+ return new Promise((s) => {
327
+ var h, f, p;
305
328
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
306
- const i = ((p = t.parentElement) == null ? void 0 : p.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")), r = s.direction || (i ? "up" : "down"), n = s.intensity || "normal", o = s.duration || 800, a = n === "gentle" ? 0.05 : n === "strong" ? 0.15 : 0.1, l = r === "up" ? 30 : r === "down" ? -30 : r === "left" ? 30 : -30;
329
+ const i = ((h = t.parentElement) == null ? void 0 : h.classList.contains("editora-toast-bottom-right")) || ((f = t.parentElement) == null ? void 0 : f.classList.contains("editora-toast-bottom-left")) || ((p = t.parentElement) == null ? void 0 : p.classList.contains("editora-toast-bottom-center")), r = e.direction || (i ? "up" : "down"), o = e.intensity || "normal", a = e.duration || 800, c = o === "gentle" ? 0.05 : o === "strong" ? 0.15 : 0.1, d = r === "up" ? 30 : r === "down" ? -30 : r === "left" ? 30 : -30;
307
330
  t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
308
331
  "transform",
309
- r === "left" || r === "right" ? `translateX(${l}px) scale(${1 - a})` : `translateY(${l}px) scale(${1 - a})`,
332
+ r === "left" || r === "right" ? `translateX(${d}px) scale(${1 - c})` : `translateY(${d}px) scale(${1 - c})`,
310
333
  "important"
311
334
  ), t.offsetHeight, setTimeout(() => {
312
335
  t.style.setProperty(
313
336
  "transition",
314
- `opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,
337
+ `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)`,
315
338
  "important"
316
339
  ), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
317
- t.style.setProperty("transition", "none", "important"), e();
318
- }, o);
340
+ t.style.setProperty("transition", "none", "important"), s();
341
+ }, a);
319
342
  }, 16);
320
343
  });
321
344
  }
322
345
  // Bounce-based hide animation
323
- async animateBounceHide(t, s) {
324
- return new Promise((e) => {
346
+ async animateBounceHide(t, e) {
347
+ return new Promise((s) => {
325
348
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
326
- const i = s.intensity || "normal", r = i === "gentle" ? 0.05 : i === "strong" ? 0.15 : 0.1;
349
+ const i = e.intensity || "normal", r = i === "gentle" ? 0.05 : i === "strong" ? 0.15 : 0.1;
327
350
  setTimeout(() => {
328
351
  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 - r})`, "important"), setTimeout(() => {
329
- t.style.setProperty("transition", "none", "important"), e();
352
+ t.style.setProperty("transition", "none", "important"), s();
330
353
  }, 400);
331
354
  }, 16);
332
355
  });
333
356
  }
334
357
  // Slide-based show animation
335
- async animateSlideShow(t, s) {
336
- return new Promise((e) => {
337
- var p, y, u;
358
+ async animateSlideShow(t, e) {
359
+ return new Promise((s) => {
360
+ var h, f, p;
338
361
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
339
- const i = ((p = t.parentElement) == null ? void 0 : p.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")), r = s.direction || (i ? "up" : "down"), n = s.distance || 100, o = s.easing || "ease-out", a = s.duration || 400, l = r === "up" ? `translateY(${n}px)` : r === "down" ? `translateY(-${n}px)` : r === "left" ? `translateX(${n}px)` : `translateX(-${n}px)`;
340
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", l, "important"), t.offsetHeight, setTimeout(() => {
341
- t.style.setProperty("transition", `opacity ${a}ms ${o}, transform ${a}ms ${o}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) translateX(0)", "important"), setTimeout(() => {
342
- t.style.setProperty("transition", "none", "important"), e();
343
- }, a);
362
+ const i = ((h = t.parentElement) == null ? void 0 : h.classList.contains("editora-toast-bottom-right")) || ((f = t.parentElement) == null ? void 0 : f.classList.contains("editora-toast-bottom-left")) || ((p = t.parentElement) == null ? void 0 : p.classList.contains("editora-toast-bottom-center")), r = e.direction || (i ? "up" : "down"), o = e.distance || 100, a = e.easing || "ease-out", c = e.duration || 400, d = r === "up" ? `translateY(${o}px)` : r === "down" ? `translateY(-${o}px)` : r === "left" ? `translateX(${o}px)` : `translateX(-${o}px)`;
363
+ t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", d, "important"), t.offsetHeight, setTimeout(() => {
364
+ 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(() => {
365
+ t.style.setProperty("transition", "none", "important"), s();
366
+ }, c);
344
367
  }, 16);
345
368
  });
346
369
  }
347
370
  // Slide-based hide animation
348
- async animateSlideHide(t, s) {
349
- return new Promise((e) => {
371
+ async animateSlideHide(t, e) {
372
+ return new Promise((s) => {
350
373
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
351
- const i = s.direction || "down", r = s.distance || 100, n = s.easing || "ease-in", o = s.duration || 300, a = i === "up" ? `translateY(-${r}px)` : i === "down" ? `translateY(${r}px)` : i === "left" ? `translateX(-${r}px)` : `translateX(${r}px)`;
374
+ const i = e.direction || "down", r = e.distance || 100, o = e.easing || "ease-in", a = e.duration || 300, c = i === "up" ? `translateY(-${r}px)` : i === "down" ? `translateY(${r}px)` : i === "left" ? `translateX(-${r}px)` : `translateX(${r}px)`;
352
375
  setTimeout(() => {
353
- t.style.setProperty("transition", `opacity ${o}ms ${n}, transform ${o}ms ${n}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", a, "important"), setTimeout(() => {
354
- t.style.setProperty("transition", "none", "important"), e();
355
- }, o);
376
+ t.style.setProperty("transition", `opacity ${a}ms ${o}, transform ${a}ms ${o}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", c, "important"), setTimeout(() => {
377
+ t.style.setProperty("transition", "none", "important"), s();
378
+ }, a);
356
379
  }, 16);
357
380
  });
358
381
  }
359
382
  // Zoom-based show animation
360
- async animateZoomShow(t, s) {
361
- return new Promise((e) => {
383
+ async animateZoomShow(t, e) {
384
+ return new Promise((s) => {
362
385
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
363
- const i = s.scale || 0.3, r = s.origin || "center", n = s.easing || "ease-out", o = s.duration || 500;
386
+ const i = e.scale || 0.3, r = e.origin || "center", o = e.easing || "ease-out", a = e.duration || 500;
364
387
  t.style.setProperty("transform-origin", r, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), t.offsetHeight, setTimeout(() => {
365
- t.style.setProperty("transition", `opacity ${o}ms ${n}, transform ${o}ms ${n}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "scale(1)", "important"), setTimeout(() => {
366
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), e();
367
- }, o);
388
+ t.style.setProperty("transition", `opacity ${a}ms ${o}, transform ${a}ms ${o}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "scale(1)", "important"), setTimeout(() => {
389
+ t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
390
+ }, a);
368
391
  }, 16);
369
392
  });
370
393
  }
371
394
  // Zoom-based hide animation
372
- async animateZoomHide(t, s) {
373
- return new Promise((e) => {
395
+ async animateZoomHide(t, e) {
396
+ return new Promise((s) => {
374
397
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
375
- const i = s.scale || 0.3, r = s.origin || "center", n = s.easing || "ease-in", o = s.duration || 300;
398
+ const i = e.scale || 0.3, r = e.origin || "center", o = e.easing || "ease-in", a = e.duration || 300;
376
399
  t.style.setProperty("transform-origin", r, "important"), setTimeout(() => {
377
- t.style.setProperty("transition", `opacity ${o}ms ${n}, transform ${o}ms ${n}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), setTimeout(() => {
378
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), e();
379
- }, o);
400
+ t.style.setProperty("transition", `opacity ${a}ms ${o}, transform ${a}ms ${o}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), setTimeout(() => {
401
+ t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
402
+ }, a);
380
403
  }, 16);
381
404
  });
382
405
  }
383
406
  // Flip-based show animation
384
- async animateFlipShow(t, s) {
385
- return new Promise((e) => {
407
+ async animateFlipShow(t, e) {
408
+ return new Promise((s) => {
386
409
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
387
- const i = s.axis || "y", r = s.perspective || 1e3, n = s.direction || "forward", o = s.duration || 600;
410
+ const i = e.axis || "y", r = e.perspective || 1e3, o = e.direction || "forward", a = e.duration || 600;
388
411
  t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${r}px`, "important");
389
- const a = n === "forward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
390
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${a}deg)`, "important"), t.offsetHeight, setTimeout(() => {
391
- t.style.setProperty("transition", `opacity ${o}ms ease, transform ${o}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(() => {
392
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), e();
393
- }, o);
412
+ const c = o === "forward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
413
+ t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${c}deg)`, "important"), t.offsetHeight, setTimeout(() => {
414
+ 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(() => {
415
+ t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), s();
416
+ }, a);
394
417
  }, 16);
395
418
  });
396
419
  }
397
420
  // Flip-based hide animation
398
- async animateFlipHide(t, s) {
399
- return new Promise((e) => {
421
+ async animateFlipHide(t, e) {
422
+ return new Promise((s) => {
400
423
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
401
- const i = s.axis || "y", r = s.perspective || 1e3, n = s.direction || "backward", o = s.duration || 400;
424
+ const i = e.axis || "y", r = e.perspective || 1e3, o = e.direction || "backward", a = e.duration || 400;
402
425
  t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${r}px`, "important");
403
- const a = n === "backward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
426
+ const c = o === "backward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
404
427
  setTimeout(() => {
405
- t.style.setProperty("transition", `opacity ${o}ms ease, transform ${o}ms ease-in`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${a}deg)`, "important"), setTimeout(() => {
406
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), e();
407
- }, o);
428
+ 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(() => {
429
+ t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), s();
430
+ }, a);
408
431
  }, 16);
409
432
  });
410
433
  }
411
434
  // Fade-based show animation
412
- async animateFadeShow(t, s) {
413
- return new Promise((e) => {
435
+ async animateFadeShow(t, e) {
436
+ return new Promise((s) => {
414
437
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
415
- const i = s.direction || "none", r = s.distance || 20, n = s.duration || 300;
416
- let o = "translateY(0) translateX(0)";
417
- i !== "none" && (o = i === "up" ? `translateY(${r}px)` : i === "down" ? `translateY(-${r}px)` : i === "left" ? `translateX(${r}px)` : `translateX(-${r}px)`), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", o, "important"), t.offsetHeight, setTimeout(() => {
418
- t.style.setProperty("transition", `opacity ${n}ms ease, transform ${n}ms ease`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) translateX(0)", "important"), setTimeout(() => {
419
- t.style.setProperty("transition", "none", "important"), e();
420
- }, n);
438
+ const i = e.direction || "none", r = e.distance || 20, o = e.duration || 300;
439
+ let a = "translateY(0) translateX(0)";
440
+ i !== "none" && (a = i === "up" ? `translateY(${r}px)` : i === "down" ? `translateY(-${r}px)` : i === "left" ? `translateX(${r}px)` : `translateX(-${r}px)`), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", a, "important"), t.offsetHeight, setTimeout(() => {
441
+ t.style.setProperty("transition", `opacity ${o}ms ease, transform ${o}ms ease`, "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
+ }, o);
421
444
  }, 16);
422
445
  });
423
446
  }
424
447
  // Fade-based hide animation
425
- async animateFadeHide(t, s) {
426
- return new Promise((e) => {
448
+ async animateFadeHide(t, e) {
449
+ return new Promise((s) => {
427
450
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
428
- const i = s.direction || "none", r = s.distance || 20, n = s.duration || 200;
429
- let o = "translateY(0) translateX(0)";
430
- i !== "none" && (o = i === "up" ? `translateY(-${r}px)` : i === "down" ? `translateY(${r}px)` : i === "left" ? `translateX(-${r}px)` : `translateX(${r}px)`), setTimeout(() => {
431
- t.style.setProperty("transition", `opacity ${n}ms ease, transform ${n}ms ease`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", o, "important"), setTimeout(() => {
432
- t.style.setProperty("transition", "none", "important"), e();
433
- }, n);
451
+ const i = e.direction || "none", r = e.distance || 20, o = e.duration || 200;
452
+ let a = "translateY(0) translateX(0)";
453
+ i !== "none" && (a = i === "up" ? `translateY(-${r}px)` : i === "down" ? `translateY(${r}px)` : i === "left" ? `translateX(-${r}px)` : `translateX(${r}px)`), setTimeout(() => {
454
+ t.style.setProperty("transition", `opacity ${o}ms ease, transform ${o}ms ease`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", a, "important"), setTimeout(() => {
455
+ t.style.setProperty("transition", "none", "important"), s();
456
+ }, o);
434
457
  }, 16);
435
458
  });
436
459
  }
437
460
  // Elastic-based show animation
438
- async animateElasticShow(t, s) {
439
- return new Promise((e) => {
440
- var p, y, u;
461
+ async animateElasticShow(t, e) {
462
+ return new Promise((s) => {
463
+ var h, f, p;
441
464
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
442
- const i = ((p = t.parentElement) == null ? void 0 : p.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")), r = s.direction || (i ? "up" : "down"), n = s.intensity || "normal", o = s.duration || 1e3, a = n === "gentle" ? 0.1 : n === "strong" ? 0.3 : 0.2, l = r === "up" ? 40 : r === "down" ? -40 : r === "left" ? 40 : -40;
465
+ const i = ((h = t.parentElement) == null ? void 0 : h.classList.contains("editora-toast-bottom-right")) || ((f = t.parentElement) == null ? void 0 : f.classList.contains("editora-toast-bottom-left")) || ((p = t.parentElement) == null ? void 0 : p.classList.contains("editora-toast-bottom-center")), r = e.direction || (i ? "up" : "down"), o = e.intensity || "normal", a = e.duration || 1e3, c = o === "gentle" ? 0.1 : o === "strong" ? 0.3 : 0.2, d = r === "up" ? 40 : r === "down" ? -40 : r === "left" ? 40 : -40;
443
466
  t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
444
467
  "transform",
445
- r === "left" || r === "right" ? `translateX(${l}px) scale(${1 + a})` : `translateY(${l}px) scale(${1 + a})`,
468
+ r === "left" || r === "right" ? `translateX(${d}px) scale(${1 + c})` : `translateY(${d}px) scale(${1 + c})`,
446
469
  "important"
447
470
  ), t.offsetHeight, setTimeout(() => {
448
471
  t.style.setProperty(
449
472
  "transition",
450
- `opacity ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${o}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,
473
+ `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)`,
451
474
  "important"
452
475
  ), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
453
- t.style.setProperty("transition", "none", "important"), e();
454
- }, o);
476
+ t.style.setProperty("transition", "none", "important"), s();
477
+ }, a);
455
478
  }, 16);
456
479
  });
457
480
  }
458
481
  // Elastic-based hide animation
459
- async animateElasticHide(t, s) {
460
- return new Promise((e) => {
482
+ async animateElasticHide(t, e) {
483
+ return new Promise((s) => {
461
484
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
462
- const i = s.intensity || "normal", r = i === "gentle" ? 0.1 : i === "strong" ? 0.3 : 0.2;
463
- s.duration, setTimeout(() => {
485
+ const i = e.intensity || "normal", r = i === "gentle" ? 0.1 : i === "strong" ? 0.3 : 0.2;
486
+ e.duration, setTimeout(() => {
464
487
  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 + r})`, "important"), setTimeout(() => {
465
- t.style.setProperty("transition", "none", "important"), e();
488
+ t.style.setProperty("transition", "none", "important"), s();
466
489
  }, 400);
467
490
  }, 16);
468
491
  });
469
492
  }
470
493
  // Rotate-based show animation
471
- async animateRotateShow(t, s) {
472
- return new Promise((e) => {
494
+ async animateRotateShow(t, e) {
495
+ return new Promise((s) => {
473
496
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
474
- const i = s.degrees || 360, r = s.direction || "clockwise", n = s.origin || "center", o = s.duration || 500, a = r === "clockwise" ? i : -i;
475
- t.style.setProperty("transform-origin", n, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${a}deg) scale(0.8)`, "important"), t.offsetHeight, setTimeout(() => {
476
- t.style.setProperty("transition", `opacity ${o}ms ease, transform ${o}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(() => {
477
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), e();
478
- }, o);
497
+ const i = e.degrees || 360, r = e.direction || "clockwise", o = e.origin || "center", a = e.duration || 500, c = r === "clockwise" ? i : -i;
498
+ t.style.setProperty("transform-origin", o, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${c}deg) scale(0.8)`, "important"), t.offsetHeight, setTimeout(() => {
499
+ 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(() => {
500
+ t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
501
+ }, a);
479
502
  }, 16);
480
503
  });
481
504
  }
482
505
  // Rotate-based hide animation
483
- async animateRotateHide(t, s) {
484
- return new Promise((e) => {
506
+ async animateRotateHide(t, e) {
507
+ return new Promise((s) => {
485
508
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
486
- const i = s.degrees || 180, r = s.direction || "counterclockwise", n = s.origin || "center", o = s.duration || 300, a = r === "clockwise" ? i : -i;
487
- t.style.setProperty("transform-origin", n, "important"), setTimeout(() => {
488
- t.style.setProperty("transition", `opacity ${o}ms ease, transform ${o}ms ease-in`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${a}deg) scale(0.8)`, "important"), setTimeout(() => {
489
- t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), e();
490
- }, o);
509
+ const i = e.degrees || 180, r = e.direction || "counterclockwise", o = e.origin || "center", a = e.duration || 300, c = r === "clockwise" ? i : -i;
510
+ t.style.setProperty("transform-origin", o, "important"), setTimeout(() => {
511
+ 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(() => {
512
+ t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
513
+ }, a);
491
514
  }, 16);
492
515
  });
493
516
  }
494
517
  }
495
- const S = new q();
496
- class Y {
518
+ const C = new z();
519
+ class O {
497
520
  constructor(t) {
498
521
  this.containers = /* @__PURE__ */ new Map(), this.cssInjected = !1, this.config = t;
499
522
  }
523
+ updateConfig(t) {
524
+ this.config = t, this.containers.forEach((e, s) => {
525
+ this.applyContainerStyles(e, s), this.applyStackState(e);
526
+ });
527
+ }
500
528
  // Ensure container exists for position
501
529
  ensureContainer(t) {
502
530
  if (this.containers.has(t))
503
531
  return this.containers.get(t);
504
- const s = document.createElement("div");
505
- s.className = `editora-toast-container editora-toast-${t.replace("-", "-")}`, s.setAttribute("role", "region"), s.setAttribute("aria-label", "Toast notifications"), s.setAttribute("aria-live", "polite");
506
- const e = {
507
- position: "fixed",
508
- zIndex: (this.config.zIndex || 2147483647).toString(),
509
- display: "flex",
510
- flexDirection: "column",
511
- gap: "8px",
512
- pointerEvents: "none",
513
- maxWidth: "100%",
514
- boxSizing: "border-box"
515
- };
516
- switch (t) {
517
- case "top-left":
518
- e.top = "16px", e.left = "16px";
519
- break;
520
- case "top-right":
521
- e.top = "16px", e.right = "16px";
522
- break;
523
- case "bottom-left":
524
- e.bottom = "16px", e.left = "16px";
525
- break;
526
- case "bottom-right":
527
- e.bottom = "16px", e.right = "16px";
528
- break;
529
- case "center":
530
- e.top = "50%", e.left = "50%", e.transform = "translate(-50%, -50%)", e.alignItems = "center";
531
- break;
532
- }
533
- return Object.assign(s.style, e), document.body.appendChild(s), this.containers.set(t, s), this.injectCSS(), s;
532
+ const e = document.createElement("div");
533
+ 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), document.body.appendChild(e), this.containers.set(t, e), this.injectCSS(), e;
534
534
  }
535
535
  // Create toast element
536
536
  createToastElement(t) {
537
- const s = t.options, e = document.createElement("div");
538
- e.className = `editora-toast editora-toast-${s.level || "info"}`, s.customClass && e.classList.add(s.customClass), e.setAttribute("role", "alert"), e.setAttribute("aria-atomic", "true");
539
- const i = s.theme || this.config.theme;
540
- i && i !== "system" && e.setAttribute("data-theme", i), (s.rtl !== void 0 ? s.rtl : this.config.rtl) && (e.setAttribute("data-rtl", "true"), e.setAttribute("dir", "rtl"));
541
- const n = document.createElement("div");
542
- if (n.className = "editora-toast-content", s.icon) {
543
- const a = document.createElement("span");
544
- a.className = "editora-toast-icon", a.textContent = s.icon, n.appendChild(a);
545
- }
546
- const o = document.createElement("span");
547
- if (o.className = "editora-toast-message", s.html && s.message)
548
- o.innerHTML = this.sanitizeHTML(s.message);
549
- else if (s.render) {
550
- const a = s.render();
551
- o.appendChild(a);
552
- } else
553
- o.textContent = s.message || "";
554
- if (n.appendChild(o), s.progress) {
537
+ const e = t.options, s = document.createElement("div");
538
+ 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"), e.ariaLive && e.ariaLive !== "off" && s.setAttribute("aria-live", e.ariaLive);
539
+ const i = e.theme || this.config.theme;
540
+ 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"));
541
+ const o = this.createContent(t);
542
+ if (e.progress) {
555
543
  const a = document.createElement("div");
556
- a.className = "editora-toast-progress";
557
- const l = document.createElement("div");
558
- if (l.className = "editora-toast-progress-bar", l.style.width = `${Math.min(100, Math.max(0, s.progress.value))}%`, s.progress.showPercentage) {
559
- const p = document.createElement("span");
560
- p.className = "editora-toast-progress-text", p.textContent = `${Math.round(s.progress.value)}%`, a.appendChild(p);
544
+ a.className = "editora-toast-progress-track", a.setAttribute("role", "progressbar"), a.setAttribute("aria-valuemin", "0"), a.setAttribute("aria-valuemax", "100"), a.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, e.progress.value))));
545
+ const c = document.createElement("div");
546
+ if (c.className = "editora-toast-progress-bar", c.style.width = `${Math.min(100, Math.max(0, e.progress.value))}%`, e.progress.showPercentage) {
547
+ const d = document.createElement("span");
548
+ d.className = "editora-toast-progress-text", d.textContent = `${Math.round(e.progress.value)}%`, a.appendChild(d);
561
549
  }
562
- a.appendChild(l), n.appendChild(a);
550
+ a.appendChild(c), o.appendChild(a);
563
551
  }
564
- if (e.appendChild(n), s.actions && s.actions.length > 0) {
552
+ if (s.appendChild(o), e.actions && e.actions.length > 0) {
565
553
  const a = document.createElement("div");
566
- a.className = "editora-toast-actions", s.actions.forEach((l) => {
567
- const p = document.createElement("button");
568
- p.className = `editora-toast-action ${l.primary ? "primary" : ""}`, p.textContent = l.label, p.onclick = (y) => {
569
- y.stopPropagation(), l.onClick();
570
- }, a.appendChild(p);
571
- }), e.appendChild(a);
554
+ a.className = "editora-toast-actions", e.actions.forEach((c) => a.appendChild(this.createActionButton(c, t))), s.appendChild(a);
572
555
  }
573
- if (s.closable !== !1) {
556
+ if (e.closable || e.closeButton) {
574
557
  const a = document.createElement("button");
575
- a.className = "editora-toast-close", a.setAttribute("aria-label", "Close notification"), a.innerHTML = "×", a.onclick = () => t.dismiss(), e.appendChild(a);
558
+ a.className = "editora-toast-close", a.setAttribute("aria-label", "Close notification"), a.textContent = "×", a.onclick = () => t.dismiss(), s.appendChild(a);
576
559
  }
577
- return s.pauseOnHover && (e.addEventListener("mouseenter", () => this.pauseToast(t)), e.addEventListener("mouseleave", () => this.resumeToast(t))), s.pauseOnFocus && (e.addEventListener("focusin", () => this.pauseToast(t)), e.addEventListener("focusout", () => this.resumeToast(t))), s.swipeDismiss && this.addSwipeDismiss(e, t), s.dragDismiss && this.addDragDismiss(e, t), e;
560
+ return e.pauseOnHover && (s.addEventListener("mouseenter", () => this.pauseToast(t)), s.addEventListener("mouseleave", () => this.resumeToast(t))), e.pauseOnFocus && (s.addEventListener("focusin", () => this.pauseToast(t)), s.addEventListener("focusout", () => this.resumeToast(t))), e.swipeDismiss && this.addSwipeDismiss(s, t), e.dragDismiss && this.addDragDismiss(s, t), s;
578
561
  }
579
562
  // Show toast with animation
580
563
  async showToast(t) {
581
- var r, n;
582
- const s = this.ensureContainer(t.options.position || this.config.position), e = this.createToastElement(t);
583
- t.element = e, s.appendChild(e);
564
+ var r, o;
565
+ const e = this.ensureContainer(t.options.position || this.config.position), s = this.createToastElement(t);
566
+ t.element = s, e.appendChild(s), this.applyStackState(e);
584
567
  const i = t.options.animation || this.config.animation || { type: "css" };
585
- if (await S.showToast(e, t, i), this.config.enableAccessibility && this.announceToast(t), (n = (r = t.options).onShow) == null || n.call(r), !t.options.persistent && t.options.duration !== 0) {
586
- const o = t.options.duration || this.config.duration;
568
+ if (await C.showToast(s, t, i), this.config.enableAccessibility && this.announceToast(t), (o = (r = t.options).onShow) == null || o.call(r), !t.options.persistent && t.options.duration !== 0) {
569
+ const a = t.options.duration || this.config.duration;
587
570
  t.timeoutId = window.setTimeout(() => {
588
- this.hideToast(t);
589
- }, o);
571
+ t.dismiss();
572
+ }, a);
590
573
  }
591
574
  }
592
575
  // Hide toast with animation
593
576
  async hideToast(t) {
594
- var e, i;
577
+ var s, i;
595
578
  if (!t.element)
596
579
  return;
597
580
  t.timeoutId && (clearTimeout(t.timeoutId), t.timeoutId = void 0);
598
- const s = t.options.animation || this.config.animation || { type: "css" };
599
- await S.hideToast(t.element, t, s), t.element && t.element.parentNode && (t.element.parentNode.removeChild(t.element), t.element = void 0), (i = (e = t.options).onHide) == null || i.call(e);
581
+ const e = t.options.animation || this.config.animation || { type: "css" };
582
+ if (await C.hideToast(t.element, t, e), t.element && t.element.parentNode) {
583
+ const r = t.element.parentElement;
584
+ t.element.parentNode.removeChild(t.element), t.element = void 0, r && this.applyStackState(r);
585
+ }
586
+ (i = (s = t.options).onHide) == null || i.call(s);
600
587
  }
601
588
  // Update toast content
602
- async updateToast(t, s) {
603
- var r, n;
589
+ async updateToast(t, e) {
590
+ var i, r;
604
591
  if (!t.element)
605
592
  return;
606
- const e = t.options.animation || this.config.animation || { type: "css" };
607
- if (e.type === "custom" && e.update) {
608
- await S.updateToast(t.element, t, s, e);
593
+ const s = t.options.animation || this.config.animation || { type: "css" };
594
+ if (s.type === "custom" && s.update) {
595
+ await C.updateToast(t.element, t, e, s);
609
596
  return;
610
597
  }
611
- Object.assign(t.options, s), s.level && (t.element.className = t.element.className.replace(/editora-toast--(info|success|error|warning|loading|custom)/g, ""), t.element.classList.add(`editora-toast--${s.level}`));
612
- const i = t.element.querySelector(".editora-toast-message");
613
- if (i && s.message !== void 0)
614
- if (t.options.html && s.message)
615
- i.innerHTML = this.sanitizeHTML(s.message);
616
- else if (t.options.render) {
617
- const o = t.element.querySelector(".editora-toast-content");
618
- if (o) {
619
- const a = t.options.render();
620
- o.innerHTML = "", o.appendChild(a);
621
- }
622
- } else
623
- i.textContent = s.message || "";
624
- if (s.progress !== void 0) {
625
- let o = t.element.querySelector(".editora-toast-progress");
626
- if (s.progress) {
598
+ 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.render) {
599
+ const o = t.element.querySelector(".editora-toast-content"), a = this.createContent(t);
600
+ o == null || o.replaceWith(a);
601
+ }
602
+ if (e.progress !== void 0) {
603
+ let o = t.element.querySelector(".editora-toast-progress-track");
604
+ if (e.progress) {
627
605
  if (!o) {
628
- o = document.createElement("div"), o.className = "editora-toast-progress";
629
- const l = t.element.querySelector(".editora-toast-content");
630
- l && l.appendChild(o);
606
+ o = document.createElement("div"), o.className = "editora-toast-progress-track", o.setAttribute("role", "progressbar"), o.setAttribute("aria-valuemin", "0"), o.setAttribute("aria-valuemax", "100");
607
+ const c = t.element.querySelector(".editora-toast-content");
608
+ c && c.appendChild(o);
631
609
  }
610
+ o.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, e.progress.value))));
632
611
  const a = o.querySelector(".editora-toast-progress-bar");
633
- if (a && (a.style.width = `${Math.min(100, Math.max(0, s.progress.value))}%`), s.progress.showPercentage) {
634
- let l = o.querySelector(".editora-toast-progress-text");
635
- l || (l = document.createElement("span"), l.className = "editora-toast-progress-text", o.insertBefore(l, o.firstChild)), l.textContent = `${Math.round(s.progress.value)}%`;
612
+ if (a && (a.style.width = `${Math.min(100, Math.max(0, e.progress.value))}%`), e.progress.showPercentage) {
613
+ let c = o.querySelector(".editora-toast-progress-text");
614
+ c || (c = document.createElement("span"), c.className = "editora-toast-progress-text", o.insertBefore(c, o.firstChild)), c.textContent = `${Math.round(e.progress.value)}%`;
636
615
  } else {
637
- const l = o.querySelector(".editora-toast-progress-text");
638
- l && l.remove();
616
+ const c = o.querySelector(".editora-toast-progress-text");
617
+ c && c.remove();
639
618
  }
640
619
  } else
641
620
  o && o.remove();
642
621
  }
643
- if (s.actions !== void 0) {
622
+ if (e.actions !== void 0 || e.action !== void 0 || e.cancel !== void 0) {
644
623
  let o = t.element.querySelector(".editora-toast-actions");
645
- s.actions && s.actions.length > 0 ? (o ? o.innerHTML = "" : (o = document.createElement("div"), o.className = "editora-toast-actions", t.element.appendChild(o)), o && s.actions.forEach((a) => {
646
- const l = document.createElement("button");
647
- l.className = `editora-toast-action ${a.primary ? "primary" : ""}`, l.textContent = a.label, l.onclick = (p) => {
648
- p.stopPropagation(), a.onClick();
649
- }, o.appendChild(l);
650
- })) : o && o.remove();
624
+ const a = t.options.actions || [];
625
+ a.length > 0 ? (o ? o.innerHTML = "" : (o = document.createElement("div"), o.className = "editora-toast-actions", t.element.appendChild(o)), o && a.forEach((c) => o.appendChild(this.createActionButton(c, t)))) : o && o.remove();
626
+ }
627
+ if ((e.duration !== void 0 || e.persistent !== void 0 || e.level !== void 0) && (t.timeoutId && (clearTimeout(t.timeoutId), t.timeoutId = void 0), !t.options.persistent && t.options.duration !== 0)) {
628
+ const o = t.options.duration || this.config.duration;
629
+ t.timeoutId = window.setTimeout(() => {
630
+ t.dismiss();
631
+ }, o);
632
+ }
633
+ (r = (i = t.options).onUpdate) == null || r.call(i, e);
634
+ }
635
+ createContent(t) {
636
+ const e = t.options, s = document.createElement("div");
637
+ if (s.className = "editora-toast-content", e.icon) {
638
+ const r = document.createElement("span");
639
+ r.className = "editora-toast-icon", r.setAttribute("aria-hidden", "true"), r.textContent = e.icon, s.appendChild(r);
640
+ }
641
+ const i = document.createElement("div");
642
+ if (i.className = "editora-toast-body", e.render)
643
+ i.appendChild(e.render(t));
644
+ else {
645
+ if (e.title) {
646
+ const r = document.createElement("div");
647
+ r.className = "editora-toast-title", r.textContent = e.title, i.appendChild(r);
648
+ }
649
+ if (e.message) {
650
+ const r = document.createElement("div");
651
+ r.className = "editora-toast-message", e.html ? r.innerHTML = this.sanitizeHTML(e.message) : r.textContent = e.message, i.appendChild(r);
652
+ }
653
+ if (e.description) {
654
+ const r = document.createElement("div");
655
+ r.className = "editora-toast-description", r.textContent = e.description, i.appendChild(r);
656
+ }
657
+ }
658
+ return s.appendChild(i), s;
659
+ }
660
+ createActionButton(t, e) {
661
+ const s = document.createElement("button");
662
+ return s.className = `editora-toast-action ${t.primary ? "primary" : ""}`, s.textContent = t.label, t.altText && s.setAttribute("aria-label", t.altText), s.onclick = (i) => {
663
+ i.stopPropagation(), t.onClick(), t.dismissOnClick !== !1 && e.dismiss();
664
+ }, s;
665
+ }
666
+ applyContainerStyles(t, e) {
667
+ const s = this.toCssLength(this.config.offset), i = this.toCssLength(this.config.mobileOffset), r = this.toCssLength(this.config.gap);
668
+ t.dataset.position = e, 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", r);
669
+ const o = {
670
+ position: "fixed",
671
+ zIndex: (this.config.zIndex || 2147483647).toString(),
672
+ display: "flex",
673
+ flexDirection: e.startsWith("top") ? "column" : "column-reverse",
674
+ gap: r,
675
+ pointerEvents: "none",
676
+ maxWidth: "100%",
677
+ boxSizing: "border-box",
678
+ top: "",
679
+ right: "",
680
+ bottom: "",
681
+ left: "",
682
+ transform: "",
683
+ alignItems: e.includes("center") ? "center" : "stretch"
684
+ };
685
+ switch (e) {
686
+ case "top-left":
687
+ o.top = `max(${s}, env(safe-area-inset-top))`, o.left = `max(${s}, env(safe-area-inset-left))`;
688
+ break;
689
+ case "top-center":
690
+ o.top = `max(${s}, env(safe-area-inset-top))`, o.left = "50%", o.transform = "translateX(-50%)";
691
+ break;
692
+ case "top-right":
693
+ o.top = `max(${s}, env(safe-area-inset-top))`, o.right = `max(${s}, env(safe-area-inset-right))`;
694
+ break;
695
+ case "bottom-left":
696
+ o.bottom = `max(${s}, env(safe-area-inset-bottom))`, o.left = `max(${s}, env(safe-area-inset-left))`;
697
+ break;
698
+ case "bottom-center":
699
+ o.bottom = `max(${s}, env(safe-area-inset-bottom))`, o.left = "50%", o.transform = "translateX(-50%)";
700
+ break;
701
+ case "bottom-right":
702
+ o.bottom = `max(${s}, env(safe-area-inset-bottom))`, o.right = `max(${s}, env(safe-area-inset-right))`;
703
+ break;
704
+ case "center":
705
+ o.top = "50%", o.left = "50%", o.transform = "translate(-50%, -50%)", o.alignItems = "center";
706
+ break;
651
707
  }
652
- (n = (r = t.options).onUpdate) == null || n.call(r, s);
708
+ Object.assign(t.style, o), t.style.setProperty("--editora-toast-mobile-left", i);
709
+ }
710
+ applyStackState(t) {
711
+ const e = Array.from(t.querySelectorAll(".editora-toast"));
712
+ e.forEach((s, i) => {
713
+ const r = e.length - i - 1;
714
+ s.dataset.index = String(i), s.dataset.front = String(r === 0), s.style.setProperty("--editora-toast-index", String(i)), s.style.setProperty("--editora-toast-before", String(r));
715
+ });
716
+ }
717
+ toCssLength(t) {
718
+ return typeof t == "number" ? `${t}px` : t || "16px";
653
719
  }
654
720
  // Pause/resume auto-dismiss
655
721
  pauseToast(t) {
@@ -657,93 +723,97 @@ class Y {
657
723
  }
658
724
  resumeToast(t) {
659
725
  if (!t.options.persistent && t.options.duration !== 0) {
660
- const s = t.options.duration || this.config.duration;
726
+ const e = t.options.duration || this.config.duration;
661
727
  t.timeoutId = window.setTimeout(() => {
662
- this.hideToast(t);
663
- }, s);
728
+ t.dismiss();
729
+ }, e);
664
730
  }
665
731
  }
666
732
  // Swipe dismiss with directional control
667
- addSwipeDismiss(t, s) {
668
- let e = 0, i = 0, r = !1;
669
- const n = s.options.swipeDirection || this.config.swipeDirection || "any", o = 40;
670
- let a = "", l = !1;
671
- const p = (d) => {
672
- r = !0, l = !1, e = "touches" in d ? d.touches[0].clientX : d.clientX, i = "touches" in d ? d.touches[0].clientY : d.clientY, a = t.style.transform || "", t.style.transition = "none", t.style.cursor = "grabbing", d.preventDefault();
673
- }, y = (d) => {
733
+ addSwipeDismiss(t, e) {
734
+ let s = 0, i = 0, r = !1;
735
+ const o = e.options.swipeDirection || this.config.swipeDirection || "any", a = 40;
736
+ let c = "", d = !1;
737
+ const h = (l) => {
738
+ r = !0, d = !1, s = "touches" in l ? l.touches[0].clientX : l.clientX, i = "touches" in l ? l.touches[0].clientY : l.clientY, c = t.style.transform || "", t.style.transition = "none", t.style.cursor = "grabbing", l.preventDefault();
739
+ }, f = (l) => {
674
740
  if (!r)
675
741
  return;
676
- const g = "touches" in d ? d.touches[0].clientX : d.clientX, b = "touches" in d ? d.touches[0].clientY : d.clientY, m = g - e, w = b - i, f = 5;
677
- if ((Math.abs(m) > f || Math.abs(w) > f) && (l = !0), l) {
678
- const v = Math.abs(w) > Math.abs(m) ? 25 : 20, P = Math.min(Math.max(m * 0.2, -v), v), H = Math.min(Math.max(w * 0.2, -v), v);
679
- t.style.transform = `${a} translate(${P}px, ${H}px)`;
742
+ const y = "touches" in l ? l.touches[0].clientX : l.clientX, b = "touches" in l ? l.touches[0].clientY : l.clientY, m = y - s, w = b - i, g = 5;
743
+ if ((Math.abs(m) > g || Math.abs(w) > g) && (d = !0), d) {
744
+ const v = Math.abs(w) > Math.abs(m) ? 25 : 20, P = Math.min(Math.max(m * 0.2, -v), v), E = Math.min(Math.max(w * 0.2, -v), v);
745
+ t.style.transform = `${c} translate(${P}px, ${E}px)`;
680
746
  }
681
- (Math.abs(w) > Math.abs(m) || n === "vertical" || n === "up" || n === "down") && d.preventDefault();
682
- }, u = (d) => {
747
+ (Math.abs(w) > Math.abs(m) || o === "vertical" || o === "up" || o === "down") && l.preventDefault();
748
+ }, p = (l) => {
683
749
  if (!r)
684
750
  return;
685
- if (t.style.transform = a, t.style.transition = "", t.style.cursor = "", !l) {
751
+ if (t.style.transform = c, t.style.transition = "", t.style.cursor = "", !d) {
686
752
  r = !1;
687
753
  return;
688
754
  }
689
- const g = "changedTouches" in d ? d.changedTouches[0].clientX : d.clientX, b = "changedTouches" in d ? d.changedTouches[0].clientY : d.clientY, m = g - e, w = b - i;
690
- let f = !1;
691
- const v = n === "vertical" || n === "up" || n === "down", P = v ? 35 : o;
692
- switch (n) {
755
+ const y = "changedTouches" in l ? l.changedTouches[0].clientX : l.clientX, b = "changedTouches" in l ? l.changedTouches[0].clientY : l.clientY, m = y - s, w = b - i;
756
+ let g = !1;
757
+ const P = o === "vertical" || o === "up" || o === "down" ? 35 : a;
758
+ switch (o) {
693
759
  case "any":
694
- f = Math.abs(m) > o || Math.abs(w) > o;
760
+ g = Math.abs(m) > a || Math.abs(w) > a;
695
761
  break;
696
762
  case "horizontal":
697
- f = Math.abs(m) > o;
763
+ g = Math.abs(m) > a;
698
764
  break;
699
765
  case "vertical":
700
- f = Math.abs(w) > P;
766
+ g = Math.abs(w) > P;
701
767
  break;
702
768
  case "left":
703
- f = m < -o;
769
+ g = m < -a;
704
770
  break;
705
771
  case "right":
706
- f = m > o;
772
+ g = m > a;
707
773
  break;
708
774
  case "up":
709
- f = w < -P;
775
+ g = w < -P;
710
776
  break;
711
777
  case "down":
712
- f = w > P;
778
+ g = w > P;
713
779
  break;
714
780
  }
715
- v && console.log(`Vertical swipe attempt: direction=${n}, deltaY=${w}, effectiveMinDistance=${P}, shouldDismiss=${f}`), f && s.dismiss(), r = !1;
781
+ g && e.dismiss(), r = !1;
716
782
  };
717
- t.addEventListener("dragstart", (d) => d.preventDefault()), t.addEventListener("touchstart", p, { passive: !1 }), t.addEventListener("touchmove", y, { passive: !1 }), t.addEventListener("touchend", u, { passive: !1 }), t.addEventListener("mousedown", p), t.addEventListener("mousemove", y), t.addEventListener("mouseup", u), t.addEventListener("mouseleave", u);
783
+ t.addEventListener("dragstart", (l) => l.preventDefault()), t.addEventListener("touchstart", h, { passive: !1 }), t.addEventListener("touchmove", f, { passive: !1 }), t.addEventListener("touchend", p, { passive: !1 }), t.addEventListener("mousedown", h), t.addEventListener("mousemove", f), t.addEventListener("mouseup", p), t.addEventListener("mouseleave", p);
718
784
  }
719
785
  // Drag dismiss (simplified)
720
- addDragDismiss(t, s) {
721
- this.addSwipeDismiss(t, s);
786
+ addDragDismiss(t, e) {
787
+ this.addSwipeDismiss(t, e);
722
788
  }
723
789
  // Accessibility
724
790
  announceToast(t) {
725
- const s = document.createElement("div");
726
- s.setAttribute("aria-live", "assertive"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.left = "-10000px", s.style.width = "1px", s.style.height = "1px", s.style.overflow = "hidden", s.textContent = `${t.options.level || "info"}: ${t.options.message}`, document.body.appendChild(s), setTimeout(() => {
727
- document.body.removeChild(s);
791
+ if (t.options.ariaLive === "off")
792
+ return;
793
+ const e = document.createElement("div");
794
+ 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";
795
+ const s = [t.options.title, t.options.message, t.options.description].filter(Boolean).join(". ");
796
+ e.textContent = `${t.options.level || "info"}: ${s}`, document.body.appendChild(e), setTimeout(() => {
797
+ document.body.removeChild(e);
728
798
  }, 1e3);
729
799
  }
730
800
  // Security: Basic HTML sanitization
731
801
  sanitizeHTML(t) {
732
- const s = document.createElement("div");
733
- return s.textContent = t, s.innerHTML;
802
+ const e = document.createElement("div");
803
+ return e.textContent = t, e.innerHTML;
734
804
  }
735
805
  // Inject CSS
736
806
  injectCSS() {
737
807
  if (this.cssInjected || typeof document == "undefined")
738
808
  return;
739
809
  if (!Array.from(document.styleSheets).find(
740
- (s) => {
741
- var e, i, r, n;
742
- return ((i = (e = s.ownerNode) == null ? void 0 : e.href) == null ? void 0 : i.includes("toast.css")) || ((n = (r = s.ownerNode) == null ? void 0 : r.textContent) == null ? void 0 : n.includes("editora-toast"));
810
+ (e) => {
811
+ var s, i, r, o;
812
+ return ((i = (s = e.ownerNode) == null ? void 0 : s.href) == null ? void 0 : i.includes("toast.css")) || ((o = (r = e.ownerNode) == null ? void 0 : r.textContent) == null ? void 0 : o.includes("editora-toast"));
743
813
  }
744
814
  )) {
745
- const s = document.createElement("link");
746
- s.rel = "stylesheet", s.href = "/packages/editora-toast/dist/toast.css", document.head.appendChild(s);
815
+ const e = document.createElement("style");
816
+ e.setAttribute("data-editora-toast-fallback", "true"), e.textContent = ".editora-toast{box-sizing:border-box;pointer-events:auto}.editora-toast-container{box-sizing:border-box;pointer-events:none}.editora-toast.show{opacity:1;transform:translateY(0) scale(1)}.editora-toast.hiding{opacity:0}", document.head.appendChild(e);
747
817
  }
748
818
  this.cssInjected = !0;
749
819
  }
@@ -754,7 +824,7 @@ class Y {
754
824
  }), this.containers.clear();
755
825
  }
756
826
  }
757
- class F {
827
+ class I {
758
828
  constructor() {
759
829
  this.plugins = [], this.hooks = {
760
830
  beforeShow: [],
@@ -767,41 +837,41 @@ class F {
767
837
  }
768
838
  // Plugin management
769
839
  use(t) {
770
- if (this.plugins.find((s) => s.name === t.name)) {
840
+ if (this.plugins.find((e) => e.name === t.name)) {
771
841
  console.warn(`Plugin "${t.name}" is already installed`);
772
842
  return;
773
843
  }
774
844
  this.plugins.push(t), t.install(this);
775
845
  }
776
846
  remove(t) {
777
- const s = this.plugins.findIndex((i) => i.name === t);
778
- if (s === -1)
847
+ const e = this.plugins.findIndex((i) => i.name === t);
848
+ if (e === -1)
779
849
  return !1;
780
- const e = this.plugins[s];
781
- return e.uninstall && e.uninstall(this), this.plugins.splice(s, 1), !0;
850
+ const s = this.plugins[e];
851
+ return s.uninstall && s.uninstall(this), this.plugins.splice(e, 1), !0;
782
852
  }
783
853
  getPlugins() {
784
854
  return [...this.plugins];
785
855
  }
786
856
  // Hook registration
787
- on(t, s) {
788
- this.hooks[t] && this.hooks[t].push(s);
857
+ on(t, e) {
858
+ this.hooks[t] && this.hooks[t].push(e);
789
859
  }
790
- off(t, s) {
860
+ off(t, e) {
791
861
  if (this.hooks[t]) {
792
- const e = this.hooks[t].indexOf(s);
793
- e !== -1 && this.hooks[t].splice(e, 1);
862
+ const s = this.hooks[t].indexOf(e);
863
+ s !== -1 && this.hooks[t].splice(s, 1);
794
864
  }
795
865
  }
796
866
  // Hook execution
797
- async trigger(t, s, ...e) {
867
+ async trigger(t, e, ...s) {
798
868
  const i = this.hooks[t];
799
869
  if (!(!i || i.length === 0))
800
870
  for (const r of i)
801
871
  try {
802
- await r(s, ...e);
803
- } catch (n) {
804
- console.error(`Error in ${t} hook:`, n);
872
+ await r(e, ...s);
873
+ } catch (o) {
874
+ console.error(`Error in ${t} hook:`, o);
805
875
  }
806
876
  }
807
877
  // Convenience methods for common lifecycle events
@@ -817,43 +887,43 @@ class F {
817
887
  async afterHide(t) {
818
888
  await this.trigger("afterHide", t);
819
889
  }
820
- async beforeUpdate(t, s) {
821
- await this.trigger("beforeUpdate", t, s);
890
+ async beforeUpdate(t, e) {
891
+ await this.trigger("beforeUpdate", t, e);
822
892
  }
823
- async afterUpdate(t, s) {
824
- await this.trigger("afterUpdate", t, s);
893
+ async afterUpdate(t, e) {
894
+ await this.trigger("afterUpdate", t, e);
825
895
  }
826
896
  // Editor integration hooks (for RTE)
827
- onEditorEvent(t, s) {
828
- const e = `editor:${t}`;
829
- this.hooks[e] || (this.hooks[e] = []), this.hooks[e].push(s);
897
+ onEditorEvent(t, e) {
898
+ const s = `editor:${t}`;
899
+ this.hooks[s] || (this.hooks[s] = []), this.hooks[s].push(e);
830
900
  }
831
- triggerEditorEvent(t, s, ...e) {
901
+ triggerEditorEvent(t, e, ...s) {
832
902
  const i = `editor:${t}`;
833
- this.trigger(i, s, ...e);
903
+ this.trigger(i, e, ...s);
834
904
  }
835
905
  // Promise lifecycle helpers
836
- async handlePromise(t, s, e, i) {
837
- s();
906
+ async handlePromise(t, e, s, i) {
907
+ e();
838
908
  try {
839
909
  const r = await t;
840
- return e(r), r;
910
+ return s(r), r;
841
911
  } catch (r) {
842
912
  throw i(r), r;
843
913
  }
844
914
  }
845
915
  // Batch operations
846
916
  async batchShow(t) {
847
- const s = t.map((i) => this.beforeShow(i));
848
- await Promise.all(s);
849
- const e = t.map((i) => this.afterShow(i));
917
+ const e = t.map((i) => this.beforeShow(i));
850
918
  await Promise.all(e);
919
+ const s = t.map((i) => this.afterShow(i));
920
+ await Promise.all(s);
851
921
  }
852
922
  async batchHide(t) {
853
- const s = t.map((i) => this.beforeHide(i));
854
- await Promise.all(s);
855
- const e = t.map((i) => this.afterHide(i));
923
+ const e = t.map((i) => this.beforeHide(i));
856
924
  await Promise.all(e);
925
+ const s = t.map((i) => this.afterHide(i));
926
+ await Promise.all(s);
857
927
  }
858
928
  // Cleanup
859
929
  destroy() {
@@ -864,82 +934,94 @@ class F {
864
934
  });
865
935
  }
866
936
  }
867
- const I = {
937
+ const L = {
868
938
  position: "bottom-right",
869
939
  duration: 4e3,
870
- maxVisible: 5,
940
+ maxVisible: 3,
871
941
  queueStrategy: "fifo",
872
942
  theme: "system",
943
+ richColors: !1,
944
+ expand: !0,
945
+ stack: !1,
946
+ offset: 16,
947
+ mobileOffset: 16,
948
+ gap: 8,
873
949
  pauseOnHover: !0,
874
950
  pauseOnFocus: !1,
875
951
  pauseOnWindowBlur: !1,
876
952
  // Don't pause by default
877
- swipeDismiss: !1,
953
+ swipeDismiss: !0,
878
954
  swipeDirection: "any",
879
955
  // Allow any direction by default
880
956
  dragDismiss: !1,
881
957
  rtl: !1,
882
958
  // LTR by default
883
959
  enableAccessibility: !0,
960
+ closeButton: !1,
961
+ preventDuplicate: !1,
962
+ dedupeScope: "all",
884
963
  animation: { type: "css" }
885
964
  // Default to CSS animations
886
965
  };
887
- class C {
966
+ class k {
888
967
  constructor(t = {}) {
889
- this.idCounter = 0, this.pausedToasts = /* @__PURE__ */ new Set(), this.config = { ...I, ...t }, this.store = new k(this.config), this.queue = new M(this.config), this.renderer = new Y(this.config), this.lifecycle = new F(), this.setupWindowFocusHandling();
968
+ this.idCounter = 0, this.pausedToasts = /* @__PURE__ */ new Set(), this.subscribers = /* @__PURE__ */ new Set(), this.config = this.normalizeConfig({ ...L, ...t }), this.store = new A(this.config), this.queue = new M(this.config), this.renderer = new O(this.config), this.lifecycle = new I(), this.setupWindowFocusHandling();
890
969
  }
891
970
  // Core API
892
971
  show(t) {
893
- const s = t.id || `toast-${++this.idCounter}`, e = {
894
- id: s,
895
- options: { ...this.config, ...t },
972
+ const e = t.id || `toast-${++this.idCounter}`, s = {
973
+ id: e,
974
+ options: this.normalizeToastOptions({ ...this.config, ...t }),
896
975
  createdAt: Date.now(),
897
- dismiss: () => this.dismiss(s),
898
- update: (i) => this.update(s, i)
976
+ dismiss: () => this.dismiss(e),
977
+ update: (i) => this.update(e, i)
899
978
  };
900
- return this.lifecycle.beforeShow(e).then(async () => {
901
- this.store.addToast(e), this.queue.enqueue(e), await this.renderer.showToast(e), this.lifecycle.afterShow(e);
902
- }), e;
979
+ return this.lifecycle.beforeShow(s).then(async () => {
980
+ const i = this.queue.enqueue(s);
981
+ i.rejected || (this.store.addToast(s), await this.hideToasts(i.hide, !0), await this.showToasts(i.show), this.notify());
982
+ }), s;
903
983
  }
904
- update(t, s) {
905
- const e = this.store.getToast(t);
906
- return e ? (this.lifecycle.beforeUpdate(e, s).then(async () => {
907
- this.store.updateToast(t, { options: { ...e.options, ...s } }), await this.renderer.updateToast(e, s), this.lifecycle.afterUpdate(e, s);
984
+ update(t, e) {
985
+ const s = this.store.getToast(t);
986
+ return s ? (this.lifecycle.beforeUpdate(s, e).then(async () => {
987
+ const i = this.normalizeToastOptions({ ...s.options, ...e });
988
+ this.store.updateToast(t, { options: i }), this.queue.isVisible(t) && await this.renderer.updateToast(s, e), this.lifecycle.afterUpdate(s, e), this.notify();
908
989
  }), !0) : !1;
909
990
  }
910
991
  dismiss(t) {
911
- const s = this.store.getToast(t);
912
- return s ? (this.lifecycle.beforeHide(s).then(async () => {
913
- this.queue.dequeue(t), await this.renderer.hideToast(s), this.store.removeToast(t), this.lifecycle.afterHide(s);
992
+ const e = this.store.getToast(t);
993
+ return e ? (this.lifecycle.beforeHide(e).then(async () => {
994
+ const s = this.queue.isVisible(t), i = this.queue.dequeue(t);
995
+ s && await this.renderer.hideToast(e), this.store.removeToast(t), this.lifecycle.afterHide(e), await this.showToasts(i.show), this.notify();
914
996
  }), !0) : !1;
915
997
  }
916
998
  clear() {
917
- const t = this.store.getAllToasts();
918
- this.lifecycle.batchHide(t).then(() => {
919
- this.queue.clear(), this.store.clear();
999
+ const t = this.queue.clear();
1000
+ Promise.all(t.map((e) => this.hideOne(e, !1))).then(() => {
1001
+ this.store.clear(), this.notify();
920
1002
  });
921
1003
  }
922
1004
  // Promise API
923
- async promise(t, s) {
1005
+ async promise(t, e) {
924
1006
  var i, r;
925
- const e = this.show(this.normalizeOptions(s.loading, "loading"));
1007
+ const s = this.show(this.normalizeOptions(e.loading, "loading"));
926
1008
  try {
927
- const n = await t, o = this.normalizeOptions(
928
- typeof s.success == "function" ? s.success(n) : s.success,
1009
+ const o = await t, a = this.normalizeOptions(
1010
+ typeof e.success == "function" ? e.success(o) : e.success,
929
1011
  "success"
930
1012
  );
931
- return this.update(e.id, o), (i = s.onSuccess) == null || i.call(s, n), n;
932
- } catch (n) {
933
- const o = this.normalizeOptions(
934
- typeof s.error == "function" ? s.error(n) : s.error,
1013
+ return a.duration === void 0 && !a.persistent && (a.duration = this.config.duration), this.update(s.id, a), (i = e.onSuccess) == null || i.call(e, o), o;
1014
+ } catch (o) {
1015
+ const a = this.normalizeOptions(
1016
+ typeof e.error == "function" ? e.error(o) : e.error,
935
1017
  "error"
936
1018
  );
937
- throw this.update(e.id, o), (r = s.onError) == null || r.call(s, n), n;
1019
+ throw a.duration === void 0 && !a.persistent && (a.duration = this.config.duration), this.update(s.id, a), (r = e.onError) == null || r.call(e, o), o;
938
1020
  }
939
1021
  }
940
1022
  // Group API
941
- group(t, s) {
942
- return this.show({ ...s, group: t });
1023
+ group(t, e) {
1024
+ return this.show({ ...e, group: t });
943
1025
  }
944
1026
  // Plugin API
945
1027
  use(t) {
@@ -947,8 +1029,10 @@ class C {
947
1029
  }
948
1030
  // Configuration
949
1031
  configure(t) {
950
- const s = this.config.pauseOnWindowBlur;
951
- this.config = { ...this.config, ...t }, this.store.updateConfig(t), this.queue.updateConfig(t), t.pauseOnWindowBlur !== void 0 && t.pauseOnWindowBlur !== s && (this.teardownWindowFocusHandling(), this.setupWindowFocusHandling());
1032
+ const e = this.config.pauseOnWindowBlur;
1033
+ this.config = this.normalizeConfig({ ...this.config, ...t }), this.store.updateConfig(this.config), this.renderer.updateConfig(this.config);
1034
+ const s = this.queue.updateConfig(this.config);
1035
+ this.hideToasts(s.hide, !0).then(() => this.showToasts(s.show)).then(() => this.notify()), t.pauseOnWindowBlur !== void 0 && t.pauseOnWindowBlur !== e && (this.teardownWindowFocusHandling(), this.setupWindowFocusHandling());
952
1036
  }
953
1037
  getConfig() {
954
1038
  return { ...this.config };
@@ -957,35 +1041,91 @@ class C {
957
1041
  getToasts() {
958
1042
  return this.store.getAllToasts();
959
1043
  }
1044
+ getState() {
1045
+ return {
1046
+ toasts: this.store.getAllToasts(),
1047
+ visible: this.queue.getVisible(),
1048
+ queued: this.queue.getQueued(),
1049
+ groups: this.store.getAllGroups(),
1050
+ config: this.getConfig()
1051
+ };
1052
+ }
1053
+ subscribe(t) {
1054
+ return this.subscribers.add(t), t(this.getState()), () => {
1055
+ this.subscribers.delete(t);
1056
+ };
1057
+ }
960
1058
  getGroups() {
961
1059
  return this.store.getAllGroups();
962
1060
  }
963
1061
  // Convenience methods for backward compatibility
964
- info(t, s) {
965
- return this.show({ message: t, level: "info", duration: s });
1062
+ info(t, e) {
1063
+ return this.show({ message: t, level: "info", duration: e });
966
1064
  }
967
- success(t, s) {
968
- return this.show({ message: t, level: "success", duration: s });
1065
+ success(t, e) {
1066
+ return this.show({ message: t, level: "success", duration: e });
969
1067
  }
970
- error(t, s) {
971
- return this.show({ message: t, level: "error", duration: s });
1068
+ error(t, e) {
1069
+ return this.show({ message: t, level: "error", duration: e });
972
1070
  }
973
- warning(t, s) {
974
- return this.show({ message: t, level: "warning", duration: s });
1071
+ warning(t, e) {
1072
+ return this.show({ message: t, level: "warning", duration: e });
975
1073
  }
976
- loading(t, s) {
977
- return this.show({ message: t, level: "loading", duration: s });
1074
+ loading(t, e) {
1075
+ return this.show({ message: t, level: "loading", duration: e });
978
1076
  }
979
1077
  // Utility methods
980
- normalizeOptions(t, s) {
981
- return typeof t == "string" ? { message: t, level: s } : { ...t, level: t.level || s };
1078
+ normalizeOptions(t, e) {
1079
+ return typeof t == "string" ? { message: t, level: e } : { ...t, level: t.level || e };
1080
+ }
1081
+ normalizeConfig(t) {
1082
+ const e = t.visibleToasts || t.maxVisible || L.maxVisible;
1083
+ return {
1084
+ ...t,
1085
+ maxVisible: e,
1086
+ visibleToasts: e
1087
+ };
1088
+ }
1089
+ normalizeToastOptions(t) {
1090
+ var r, o, a, c;
1091
+ const e = (o = (r = t.closeButton) != null ? r : t.closable) != null ? o : this.config.closeButton, s = t.action ? { ...t.action, primary: (a = t.action.primary) != null ? a : !0 } : void 0, i = [
1092
+ ...s ? [s] : [],
1093
+ ...t.cancel ? [t.cancel] : [],
1094
+ ...t.actions || []
1095
+ ];
1096
+ return {
1097
+ ...t,
1098
+ closable: e,
1099
+ actions: i.length > 0 ? i : void 0,
1100
+ ariaLive: t.ariaLive || (t.level === "error" || t.important ? "assertive" : "polite"),
1101
+ role: t.role || (t.level === "error" || t.important ? "alert" : "status"),
1102
+ preventDuplicate: (c = t.preventDuplicate) != null ? c : this.config.preventDuplicate,
1103
+ dedupeScope: t.dedupeScope || this.config.dedupeScope
1104
+ };
1105
+ }
1106
+ async showToasts(t) {
1107
+ for (const e of t)
1108
+ await this.renderer.showToast(e), await this.lifecycle.afterShow(e);
1109
+ }
1110
+ async hideToasts(t, e) {
1111
+ for (const s of t)
1112
+ await this.hideOne(s, e);
1113
+ }
1114
+ async hideOne(t, e) {
1115
+ await this.lifecycle.beforeHide(t), await this.renderer.hideToast(t), e && this.store.removeToast(t.id), await this.lifecycle.afterHide(t);
1116
+ }
1117
+ notify() {
1118
+ if (this.subscribers.size === 0)
1119
+ return;
1120
+ const t = this.getState();
1121
+ this.subscribers.forEach((e) => e(t));
982
1122
  }
983
1123
  // Editor integration (for RTE)
984
- onEditorEvent(t, s) {
985
- this.lifecycle.onEditorEvent(t, s);
1124
+ onEditorEvent(t, e) {
1125
+ this.lifecycle.onEditorEvent(t, e);
986
1126
  }
987
- triggerEditorEvent(t, s, ...e) {
988
- this.lifecycle.triggerEditorEvent(t, s, ...e);
1127
+ triggerEditorEvent(t, e, ...s) {
1128
+ this.lifecycle.triggerEditorEvent(t, e, ...s);
989
1129
  }
990
1130
  // Window focus/blur handling
991
1131
  setupWindowFocusHandling() {
@@ -997,17 +1137,17 @@ class C {
997
1137
  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));
998
1138
  }
999
1139
  pauseAllToasts() {
1000
- this.store.getAllToasts().forEach((s) => {
1001
- s.timeoutId && !this.pausedToasts.has(s.id) && (clearTimeout(s.timeoutId), s.timeoutId = void 0, this.pausedToasts.add(s.id));
1140
+ this.store.getAllToasts().forEach((e) => {
1141
+ e.timeoutId && !this.pausedToasts.has(e.id) && (clearTimeout(e.timeoutId), e.timeoutId = void 0, this.pausedToasts.add(e.id));
1002
1142
  });
1003
1143
  }
1004
1144
  resumeAllToasts() {
1005
- this.store.getAllToasts().forEach((s) => {
1006
- if (this.pausedToasts.has(s.id) && !s.options.persistent && s.options.duration !== 0) {
1007
- const e = s.options.duration || this.config.duration;
1008
- s.timeoutId = window.setTimeout(() => {
1009
- this.dismiss(s.id);
1010
- }, e), this.pausedToasts.delete(s.id);
1145
+ this.store.getAllToasts().forEach((e) => {
1146
+ if (this.pausedToasts.has(e.id) && !e.options.persistent && e.options.duration !== 0) {
1147
+ const s = e.options.duration || this.config.duration;
1148
+ e.timeoutId = window.setTimeout(() => {
1149
+ this.dismiss(e.id);
1150
+ }, s), this.pausedToasts.delete(e.id);
1011
1151
  }
1012
1152
  });
1013
1153
  }
@@ -1017,71 +1157,88 @@ class C {
1017
1157
  }
1018
1158
  }
1019
1159
  let T = null;
1020
- function h() {
1021
- return T || (T = new C()), T;
1160
+ function u() {
1161
+ return T || (T = new k()), T;
1022
1162
  }
1023
- function E(c) {
1163
+ function x(n) {
1024
1164
  return typeof document == "undefined" ? { dismiss: () => {
1025
- } } : h().show(c);
1165
+ } } : u().show(n);
1026
1166
  }
1027
- function $(c, t, s, e) {
1028
- const i = { position: "top-right", theme: "light" };
1029
- let r = {};
1030
- return t && typeof t == "object" ? r = { ...t } : typeof t == "number" && (r.duration = t), s && (r.theme = s), e && (r.position = e), {
1031
- message: c,
1032
- ...r,
1033
- duration: r.duration,
1034
- level: r.level || void 0,
1035
- position: r.position || i.position,
1036
- theme: r.theme || i.theme
1167
+ function S(n, t, e, s) {
1168
+ let i = {};
1169
+ t && typeof t == "object" ? i = { ...t } : typeof t == "number" && (i.duration = t), e && (i.theme = e), s && (i.position = s);
1170
+ const r = {
1171
+ message: n,
1172
+ ...i,
1173
+ level: i.level || void 0
1037
1174
  };
1175
+ return i.duration !== void 0 && (r.duration = i.duration), i.position && (r.position = i.position), i.theme && (r.theme = i.theme), r;
1038
1176
  }
1039
- const L = {
1040
- info: (c, t, s, e) => E({ ...$(c, t, s, e), level: "info" }),
1041
- success: (c, t, s, e) => E({ ...$(c, t, s, e), level: "success" }),
1042
- error: (c, t, s, e) => E({ ...$(c, t, s, e), level: "error" }),
1043
- warning: (c, t, s, e) => E({ ...$(c, t, s, e), level: "warning" }),
1044
- loading: (c, t, s, e) => E({ ...$(c, t, s, e), level: "loading" })
1045
- }, x = {
1177
+ const H = {
1178
+ info: (n, t, e, s) => x({
1179
+ ...S(n, t, e, s),
1180
+ level: "info"
1181
+ }),
1182
+ success: (n, t, e, s) => x({
1183
+ ...S(n, t, e, s),
1184
+ level: "success"
1185
+ }),
1186
+ error: (n, t, e, s) => x({
1187
+ ...S(n, t, e, s),
1188
+ level: "error"
1189
+ }),
1190
+ warning: (n, t, e, s) => x({
1191
+ ...S(n, t, e, s),
1192
+ level: "warning"
1193
+ }),
1194
+ loading: (n, t, e, s) => x({
1195
+ ...S(n, t, e, s),
1196
+ level: "loading"
1197
+ })
1198
+ }, $ = {
1046
1199
  // Core methods
1047
- show: (c) => h().show(c),
1048
- update: (c, t) => h().update(c, t),
1049
- dismiss: (c) => h().dismiss(c),
1050
- clear: () => h().clear(),
1200
+ show: (n) => u().show(n),
1201
+ update: (n, t) => u().update(n, t),
1202
+ dismiss: (n) => u().dismiss(n),
1203
+ clear: () => u().clear(),
1051
1204
  // Convenience methods
1052
- info: (c, t) => h().show({ message: c, level: "info", ...t }),
1053
- success: (c, t) => h().show({ message: c, level: "success", ...t }),
1054
- error: (c, t) => h().show({ message: c, level: "error", ...t }),
1055
- warning: (c, t) => h().show({ message: c, level: "warning", ...t }),
1056
- loading: (c, t) => h().show({ message: c, level: "loading", ...t }),
1205
+ info: (n, t) => u().show({ message: n, level: "info", ...t }),
1206
+ success: (n, t) => u().show({ message: n, level: "success", ...t }),
1207
+ error: (n, t) => u().show({ message: n, level: "error", ...t }),
1208
+ warning: (n, t) => u().show({ message: n, level: "warning", ...t }),
1209
+ loading: (n, t) => u().show({ message: n, level: "loading", ...t }),
1057
1210
  // Advanced features
1058
- promise: (c, t) => h().promise(c, t),
1059
- group: (c, t) => h().group(c, t),
1060
- configure: (c) => h().configure(c),
1061
- use: (c) => h().use(c),
1211
+ promise: (n, t) => u().promise(n, t),
1212
+ group: (n, t) => u().group(n, t),
1213
+ configure: (n) => u().configure(n),
1214
+ use: (n) => u().use(n),
1062
1215
  // State queries
1063
- getToasts: () => h().getToasts(),
1064
- getGroups: () => h().getGroups(),
1065
- getConfig: () => h().getConfig(),
1216
+ getToasts: () => u().getToasts(),
1217
+ getGroups: () => u().getGroups(),
1218
+ getConfig: () => u().getConfig(),
1219
+ getState: () => u().getState(),
1220
+ subscribe: (n) => u().subscribe(n),
1066
1221
  // Editor integration
1067
- onEditorEvent: (c, t) => h().onEditorEvent(c, t),
1068
- triggerEditorEvent: (c, t, ...s) => h().triggerEditorEvent(c, t, ...s),
1222
+ onEditorEvent: (n, t) => u().onEditorEvent(n, t),
1223
+ triggerEditorEvent: (n, t, ...e) => u().triggerEditorEvent(n, t, ...e),
1069
1224
  // Cleanup
1070
1225
  destroy: () => {
1071
1226
  T && (T.destroy(), T = null);
1072
1227
  }
1073
1228
  };
1074
1229
  if (typeof window != "undefined" && typeof document != "undefined") {
1075
- const c = window;
1076
- c.toast = L, c.toastAdvanced = x, c.toastPro = x, c.ToastManager = C, c.__editoraToastReady || (c.__editoraToastReady = !0, window.dispatchEvent(new CustomEvent("toastReady", {
1077
- detail: { toast: L, toastAdvanced: x, toastPro: x, ToastManager: C }
1078
- })));
1230
+ const n = window;
1231
+ n.toast = H, n.toastAdvanced = $, n.toastPro = $, n.ToastManager = k, n.__editoraToastReady || (n.__editoraToastReady = !0, window.dispatchEvent(
1232
+ new CustomEvent("toastReady", {
1233
+ detail: { toast: H, toastAdvanced: $, toastPro: $, ToastManager: k }
1234
+ })
1235
+ ));
1079
1236
  }
1080
1237
  export {
1081
- C as ToastManager,
1082
- L as default,
1083
- L as toast,
1084
- x as toastAdvanced,
1085
- x as toastPro
1238
+ k as ToastManager,
1239
+ H as default,
1240
+ H as toast,
1241
+ $ as toastAdvanced,
1242
+ $ as toastPro
1086
1243
  };
1087
1244
  //# sourceMappingURL=index.esm.js.map