@editora/toast 2.0.7 → 2.0.9

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 A {
1
+ class z {
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
  }
@@ -26,8 +26,7 @@ class A {
26
26
  // Group management
27
27
  updateGroup(t) {
28
28
  const e = t.options.group;
29
- if (!e)
30
- return;
29
+ if (!e) return;
31
30
  let s = this.groups.get(e);
32
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);
33
32
  }
@@ -75,19 +74,19 @@ class A {
75
74
  };
76
75
  }
77
76
  }
78
- class M {
77
+ class N {
79
78
  constructor(t) {
80
79
  this.queue = [], this.visible = [], this.config = this.normalizeConfig(t);
81
80
  }
82
81
  enqueue(t) {
83
- var r;
82
+ var o;
84
83
  const e = this.findDuplicate(t);
85
- if (e && ((r = t.options.preventDuplicate) != null ? r : this.config.preventDuplicate))
84
+ if (e && ((o = t.options.preventDuplicate) != null ? o : this.config.preventDuplicate))
86
85
  return { show: [], hide: [], rejected: e };
87
86
  const s = [];
88
87
  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 };
88
+ const r = this.removeLowestPriorityVisible();
89
+ return this.visible.push(t), { show: [t], hide: r ? [...s, r] : s };
91
90
  }
92
91
  this.config.queueStrategy === "fifo" ? this.queue.push(t) : this.queue.unshift(t), this.sortQueue();
93
92
  const i = this.processQueue();
@@ -123,15 +122,13 @@ class M {
123
122
  }
124
123
  for (; this.visible.length < this.maxVisible && this.queue.length > 0; ) {
125
124
  const s = this.queue.shift();
126
- if (!s)
127
- break;
125
+ if (!s) break;
128
126
  this.visible.push(s), t.push(s);
129
127
  }
130
128
  return { show: t, hide: e };
131
129
  }
132
130
  removeLowestPriorityVisible() {
133
- if (this.visible.length === 0)
134
- return;
131
+ if (this.visible.length === 0) return;
135
132
  let t = 0;
136
133
  for (let e = 1; e < this.visible.length; e += 1)
137
134
  (this.visible[e].options.priority || 0) < (this.visible[t].options.priority || 0) && (t = e);
@@ -147,7 +144,7 @@ class M {
147
144
  }
148
145
  findDuplicate(t) {
149
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);
150
- return s.find((r) => this.getDedupeKey(r) === i);
147
+ return s.find((o) => this.getDedupeKey(o) === i);
151
148
  }
152
149
  getDedupeKey(t) {
153
150
  return t.options.dedupeKey || `${t.options.level || "info"}:${t.options.title || ""}:${t.options.message || ""}:${t.options.description || ""}`;
@@ -168,45 +165,127 @@ class M {
168
165
  };
169
166
  }
170
167
  }
171
- class q {
168
+ const F = /* @__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
+ ]), I = /* @__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
+ ]), Y = /^(?:https?:|mailto:|tel:)/i;
218
+ function V(c) {
219
+ const t = c.replace(/[\u0000- \u007f-\u009f]/g, "");
220
+ return t ? Y.test(t) ? !0 : !/^[a-z][a-z0-9+.-]*:/i.test(t) : !1;
221
+ }
222
+ function H(c, t, e) {
223
+ for (const s of Array.from(c.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 (I.has(o)) continue;
231
+ if (!F.has(o)) {
232
+ H(i, t, e);
233
+ continue;
234
+ }
235
+ const r = e.createElement(o);
236
+ if (o === "a") {
237
+ const n = i.getAttribute("href");
238
+ n && V(n) && (r.setAttribute("href", n.trim()), /^(?:https?:)?\/\//i.test(n.trim()) && (r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer")));
239
+ const a = i.getAttribute("title");
240
+ a && r.setAttribute("title", a);
241
+ }
242
+ H(i, r, e), t.appendChild(r);
243
+ }
244
+ }
245
+ function X(c, t) {
246
+ const e = document.createElement("template");
247
+ e.innerHTML = t;
248
+ const s = document.createDocumentFragment();
249
+ H(e.content, s, document), c.textContent = "", c.appendChild(s);
250
+ }
251
+ class j {
172
252
  constructor(t = {}) {
173
- var e, s, i, r;
253
+ var e, s, i, o;
174
254
  this.config = {
175
255
  stiffness: (e = t.stiffness) != null ? e : 100,
176
256
  damping: (s = t.damping) != null ? s : 10,
177
257
  mass: (i = t.mass) != null ? i : 1,
178
- precision: (r = t.precision) != null ? r : 0.01
258
+ precision: (o = t.precision) != null ? o : 0.01
179
259
  };
180
260
  }
181
261
  // Spring animation function
182
- animate(t, e, s, i, r) {
183
- const o = {
262
+ animate(t, e, s, i, o) {
263
+ const r = {
184
264
  ...this.config,
185
- ...r
265
+ ...o
186
266
  };
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)
190
- return;
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);
267
+ let n, a = !1;
268
+ const l = Object.keys(e).reduce((u, P) => (u[P] = e[P].from, u), {}), d = Object.keys(e).reduce((u, P) => (u[P] = 0, u), {}), f = () => {
269
+ if (a) return;
270
+ let u = !0;
271
+ Object.keys(e).forEach((w) => {
272
+ const v = e[w].to, S = l[w], p = d[w], y = -r.stiffness * (S - v), m = -r.damping * p, T = (y + m) / r.mass;
273
+ d[w] += T * 0.016, l[w] += d[w] * 0.016, (Math.abs(S - v) > r.precision || Math.abs(p) > r.precision) && (u = !1);
195
274
  });
196
- const l = Object.keys(d).reduce((y, b) => {
197
- const m = e[b].unit || "px";
198
- return y[b] = `${d[b]}${m}`, y;
275
+ const P = Object.keys(l).reduce((w, v) => {
276
+ const S = e[v].unit || "px";
277
+ return w[v] = `${l[v]}${S}`, w;
199
278
  }, {});
200
- s(l), p ? (c = !0, i == null || i()) : a = requestAnimationFrame(f);
279
+ s(P), u ? (a = !0, i == null || i()) : n = requestAnimationFrame(f);
201
280
  };
202
- return a = requestAnimationFrame(f), () => {
203
- c = !0, a && cancelAnimationFrame(a);
281
+ return n = requestAnimationFrame(f), () => {
282
+ a = !0, n && cancelAnimationFrame(n);
204
283
  };
205
284
  }
206
285
  }
207
- class z {
286
+ class W {
208
287
  constructor() {
209
- this.springAnimation = new q();
288
+ this.springAnimation = new j();
210
289
  }
211
290
  // Show toast with specified animation
212
291
  async showToast(t, e, s) {
@@ -238,7 +317,6 @@ class z {
238
317
  case "custom":
239
318
  s.show ? await Promise.resolve(s.show(t, e)) : await this.animateCssShow(t);
240
319
  break;
241
- case "css":
242
320
  default:
243
321
  await this.animateCssShow(t);
244
322
  break;
@@ -274,7 +352,6 @@ class z {
274
352
  case "custom":
275
353
  s.hide ? await Promise.resolve(s.hide(t, e)) : await this.animateCssHide(t);
276
354
  break;
277
- case "css":
278
355
  default:
279
356
  await this.animateCssHide(t);
280
357
  break;
@@ -301,10 +378,10 @@ class z {
301
378
  // Spring-based show animation
302
379
  async animateSpringShow(t, e) {
303
380
  return new Promise((s) => {
304
- var o, a, c;
381
+ var r, n, a;
305
382
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important"), t.style.setProperty("-webkit-transition", "none", "important");
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;
307
- t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `translateY(${r}px) scale(0.95)`, "important"), t.offsetHeight, setTimeout(() => {
383
+ const o = ((r = t.parentElement) == null ? void 0 : r.classList.contains("editora-toast-bottom-right")) || ((n = t.parentElement) == null ? void 0 : n.classList.contains("editora-toast-bottom-left")) || ((a = t.parentElement) == null ? void 0 : a.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(() => {
308
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(() => {
309
386
  t.style.setProperty("transition", "none", "important"), s();
310
387
  }, 800);
@@ -324,21 +401,21 @@ class z {
324
401
  // Bounce-based show animation
325
402
  async animateBounceShow(t, e) {
326
403
  return new Promise((s) => {
327
- var h, f, p;
404
+ var d, f, u;
328
405
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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;
406
+ const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((f = t.parentElement) == null ? void 0 : f.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", n = e.duration || 800, a = r === "gentle" ? 0.05 : r === "strong" ? 0.15 : 0.1, l = o === "up" ? 30 : o === "down" ? -30 : o === "left" ? 30 : -30;
330
407
  t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
331
408
  "transform",
332
- r === "left" || r === "right" ? `translateX(${d}px) scale(${1 - c})` : `translateY(${d}px) scale(${1 - c})`,
409
+ o === "left" || o === "right" ? `translateX(${l}px) scale(${1 - a})` : `translateY(${l}px) scale(${1 - a})`,
333
410
  "important"
334
411
  ), t.offsetHeight, setTimeout(() => {
335
412
  t.style.setProperty(
336
413
  "transition",
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)`,
414
+ `opacity ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,
338
415
  "important"
339
416
  ), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
340
417
  t.style.setProperty("transition", "none", "important"), s();
341
- }, a);
418
+ }, n);
342
419
  }, 16);
343
420
  });
344
421
  }
@@ -346,9 +423,9 @@ class z {
346
423
  async animateBounceHide(t, e) {
347
424
  return new Promise((s) => {
348
425
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
349
- const i = e.intensity || "normal", r = i === "gentle" ? 0.05 : i === "strong" ? 0.15 : 0.1;
426
+ const i = e.intensity || "normal", o = i === "gentle" ? 0.05 : i === "strong" ? 0.15 : 0.1;
350
427
  setTimeout(() => {
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(() => {
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(() => {
352
429
  t.style.setProperty("transition", "none", "important"), s();
353
430
  }, 400);
354
431
  }, 16);
@@ -357,13 +434,13 @@ class z {
357
434
  // Slide-based show animation
358
435
  async animateSlideShow(t, e) {
359
436
  return new Promise((s) => {
360
- var h, f, p;
437
+ var d, f, u;
361
438
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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(() => {
439
+ const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((f = t.parentElement) == null ? void 0 : f.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, n = e.easing || "ease-out", a = 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 ${a}ms ${n}, transform ${a}ms ${n}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) translateX(0)", "important"), setTimeout(() => {
365
442
  t.style.setProperty("transition", "none", "important"), s();
366
- }, c);
443
+ }, a);
367
444
  }, 16);
368
445
  });
369
446
  }
@@ -371,11 +448,11 @@ class z {
371
448
  async animateSlideHide(t, e) {
372
449
  return new Promise((s) => {
373
450
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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)`;
451
+ const i = e.direction || "down", o = e.distance || 100, r = e.easing || "ease-in", n = e.duration || 300, a = i === "up" ? `translateY(-${o}px)` : i === "down" ? `translateY(${o}px)` : i === "left" ? `translateX(-${o}px)` : `translateX(${o}px)`;
375
452
  setTimeout(() => {
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(() => {
453
+ t.style.setProperty("transition", `opacity ${n}ms ${r}, transform ${n}ms ${r}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", a, "important"), setTimeout(() => {
377
454
  t.style.setProperty("transition", "none", "important"), s();
378
- }, a);
455
+ }, n);
379
456
  }, 16);
380
457
  });
381
458
  }
@@ -383,11 +460,11 @@ class z {
383
460
  async animateZoomShow(t, e) {
384
461
  return new Promise((s) => {
385
462
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
386
- const i = e.scale || 0.3, r = e.origin || "center", o = e.easing || "ease-out", a = e.duration || 500;
387
- t.style.setProperty("transform-origin", r, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), t.offsetHeight, setTimeout(() => {
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(() => {
463
+ const i = e.scale || 0.3, o = e.origin || "center", r = e.easing || "ease-out", n = 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 ${n}ms ${r}, transform ${n}ms ${r}`, "important"), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "scale(1)", "important"), setTimeout(() => {
389
466
  t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
390
- }, a);
467
+ }, n);
391
468
  }, 16);
392
469
  });
393
470
  }
@@ -395,11 +472,11 @@ class z {
395
472
  async animateZoomHide(t, e) {
396
473
  return new Promise((s) => {
397
474
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
398
- const i = e.scale || 0.3, r = e.origin || "center", o = e.easing || "ease-in", a = e.duration || 300;
399
- t.style.setProperty("transform-origin", r, "important"), setTimeout(() => {
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(() => {
475
+ const i = e.scale || 0.3, o = e.origin || "center", r = e.easing || "ease-in", n = e.duration || 300;
476
+ t.style.setProperty("transform-origin", o, "important"), setTimeout(() => {
477
+ t.style.setProperty("transition", `opacity ${n}ms ${r}, transform ${n}ms ${r}`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `scale(${i})`, "important"), setTimeout(() => {
401
478
  t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
402
- }, a);
479
+ }, n);
403
480
  }, 16);
404
481
  });
405
482
  }
@@ -407,13 +484,13 @@ class z {
407
484
  async animateFlipShow(t, e) {
408
485
  return new Promise((s) => {
409
486
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
410
- const i = e.axis || "y", r = e.perspective || 1e3, o = e.direction || "forward", a = e.duration || 600;
411
- t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${r}px`, "important");
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(() => {
487
+ const i = e.axis || "y", o = e.perspective || 1e3, r = e.direction || "forward", n = e.duration || 600;
488
+ t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${o}px`, "important");
489
+ const a = r === "forward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
490
+ t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${a}deg)`, "important"), t.offsetHeight, setTimeout(() => {
491
+ t.style.setProperty("transition", `opacity ${n}ms ease, transform ${n}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
492
  t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), s();
416
- }, a);
493
+ }, n);
417
494
  }, 16);
418
495
  });
419
496
  }
@@ -421,13 +498,13 @@ class z {
421
498
  async animateFlipHide(t, e) {
422
499
  return new Promise((s) => {
423
500
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
424
- const i = e.axis || "y", r = e.perspective || 1e3, o = e.direction || "backward", a = e.duration || 400;
425
- t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${r}px`, "important");
426
- const c = o === "backward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
501
+ const i = e.axis || "y", o = e.perspective || 1e3, r = e.direction || "backward", n = e.duration || 400;
502
+ t.style.setProperty("transform-style", "preserve-3d", "important"), t.parentElement.style.setProperty("perspective", `${o}px`, "important");
503
+ const a = r === "backward" ? i === "x" ? -90 : 90 : i === "x" ? 90 : -90;
427
504
  setTimeout(() => {
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(() => {
505
+ t.style.setProperty("transition", `opacity ${n}ms ease, transform ${n}ms ease-in`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate${i.toUpperCase()}(${a}deg)`, "important"), setTimeout(() => {
429
506
  t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-style", "", "important"), t.parentElement.style.setProperty("perspective", "", "important"), s();
430
- }, a);
507
+ }, n);
431
508
  }, 16);
432
509
  });
433
510
  }
@@ -435,12 +512,12 @@ class z {
435
512
  async animateFadeShow(t, e) {
436
513
  return new Promise((s) => {
437
514
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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(() => {
515
+ const i = e.direction || "none", o = e.distance || 20, r = e.duration || 300;
516
+ let n = "translateY(0) translateX(0)";
517
+ i !== "none" && (n = 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", n, "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(() => {
442
519
  t.style.setProperty("transition", "none", "important"), s();
443
- }, o);
520
+ }, r);
444
521
  }, 16);
445
522
  });
446
523
  }
@@ -448,33 +525,33 @@ class z {
448
525
  async animateFadeHide(t, e) {
449
526
  return new Promise((s) => {
450
527
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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(() => {
528
+ const i = e.direction || "none", o = e.distance || 20, r = e.duration || 200;
529
+ let n = "translateY(0) translateX(0)";
530
+ i !== "none" && (n = 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", n, "important"), setTimeout(() => {
455
532
  t.style.setProperty("transition", "none", "important"), s();
456
- }, o);
533
+ }, r);
457
534
  }, 16);
458
535
  });
459
536
  }
460
537
  // Elastic-based show animation
461
538
  async animateElasticShow(t, e) {
462
539
  return new Promise((s) => {
463
- var h, f, p;
540
+ var d, f, u;
464
541
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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;
542
+ const i = ((d = t.parentElement) == null ? void 0 : d.classList.contains("editora-toast-bottom-right")) || ((f = t.parentElement) == null ? void 0 : f.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", n = e.duration || 1e3, a = r === "gentle" ? 0.1 : r === "strong" ? 0.3 : 0.2, l = o === "up" ? 40 : o === "down" ? -40 : o === "left" ? 40 : -40;
466
543
  t.style.setProperty("opacity", "0", "important"), t.style.setProperty(
467
544
  "transform",
468
- r === "left" || r === "right" ? `translateX(${d}px) scale(${1 + c})` : `translateY(${d}px) scale(${1 + c})`,
545
+ o === "left" || o === "right" ? `translateX(${l}px) scale(${1 + a})` : `translateY(${l}px) scale(${1 + a})`,
469
546
  "important"
470
547
  ), t.offsetHeight, setTimeout(() => {
471
548
  t.style.setProperty(
472
549
  "transition",
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)`,
550
+ `opacity ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55), transform ${n}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,
474
551
  "important"
475
552
  ), t.style.setProperty("opacity", "1", "important"), t.style.setProperty("transform", "translateY(0) scale(1)", "important"), setTimeout(() => {
476
553
  t.style.setProperty("transition", "none", "important"), s();
477
- }, a);
554
+ }, n);
478
555
  }, 16);
479
556
  });
480
557
  }
@@ -482,9 +559,9 @@ class z {
482
559
  async animateElasticHide(t, e) {
483
560
  return new Promise((s) => {
484
561
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
485
- const i = e.intensity || "normal", r = i === "gentle" ? 0.1 : i === "strong" ? 0.3 : 0.2;
562
+ const i = e.intensity || "normal", o = i === "gentle" ? 0.1 : i === "strong" ? 0.3 : 0.2;
486
563
  e.duration, setTimeout(() => {
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(() => {
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(() => {
488
565
  t.style.setProperty("transition", "none", "important"), s();
489
566
  }, 400);
490
567
  }, 16);
@@ -494,11 +571,11 @@ class z {
494
571
  async animateRotateShow(t, e) {
495
572
  return new Promise((s) => {
496
573
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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(() => {
574
+ const i = e.degrees || 360, o = e.direction || "clockwise", r = e.origin || "center", n = e.duration || 500, a = o === "clockwise" ? i : -i;
575
+ t.style.setProperty("transform-origin", r, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${a}deg) scale(0.8)`, "important"), t.offsetHeight, setTimeout(() => {
576
+ t.style.setProperty("transition", `opacity ${n}ms ease, transform ${n}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
577
  t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
501
- }, a);
578
+ }, n);
502
579
  }, 16);
503
580
  });
504
581
  }
@@ -506,17 +583,17 @@ class z {
506
583
  async animateRotateHide(t, e) {
507
584
  return new Promise((s) => {
508
585
  t.classList.add("spring-animation"), t.style.setProperty("transition", "none", "important");
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(() => {
586
+ const i = e.degrees || 180, o = e.direction || "counterclockwise", r = e.origin || "center", n = e.duration || 300, a = o === "clockwise" ? i : -i;
587
+ t.style.setProperty("transform-origin", r, "important"), setTimeout(() => {
588
+ t.style.setProperty("transition", `opacity ${n}ms ease, transform ${n}ms ease-in`, "important"), t.style.setProperty("opacity", "0", "important"), t.style.setProperty("transform", `rotate(${a}deg) scale(0.8)`, "important"), setTimeout(() => {
512
589
  t.style.setProperty("transition", "none", "important"), t.style.setProperty("transform-origin", "", "important"), s();
513
- }, a);
590
+ }, n);
514
591
  }, 16);
515
592
  });
516
593
  }
517
594
  }
518
- const C = new z();
519
- class O {
595
+ const L = new W();
596
+ class G {
520
597
  constructor(t) {
521
598
  this.containers = /* @__PURE__ */ new Map(), this.cssInjected = !1, this.config = t;
522
599
  }
@@ -535,128 +612,131 @@ class O {
535
612
  // Create toast element
536
613
  createToastElement(t) {
537
614
  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);
615
+ s.className = `editora-toast editora-toast-${e.level || "info"}`, s.dataset.level = e.level || "info", e.customClass && e.customClass.split(/\s+/).filter(Boolean).forEach((n) => s.classList.add(n)), 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
616
  const i = e.theme || this.config.theme;
540
617
  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);
618
+ const r = this.createContent(t);
542
619
  if (e.progress) {
620
+ const n = document.createElement("div");
621
+ n.className = "editora-toast-progress-track", n.setAttribute("role", "progressbar"), n.setAttribute("aria-valuemin", "0"), n.setAttribute("aria-valuemax", "100"), n.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, e.progress.value))));
543
622
  const a = document.createElement("div");
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);
623
+ if (a.className = "editora-toast-progress-bar", a.style.width = `${Math.min(100, Math.max(0, e.progress.value))}%`, e.progress.showPercentage) {
624
+ const l = document.createElement("span");
625
+ l.className = "editora-toast-progress-text", l.textContent = `${Math.round(e.progress.value)}%`, n.appendChild(l);
549
626
  }
550
- a.appendChild(c), o.appendChild(a);
551
- }
552
- if (s.appendChild(o), e.actions && e.actions.length > 0) {
553
- const a = document.createElement("div");
554
- a.className = "editora-toast-actions", e.actions.forEach((c) => a.appendChild(this.createActionButton(c, t))), s.appendChild(a);
627
+ n.appendChild(a), r.appendChild(n);
555
628
  }
556
- if (e.closable || e.closeButton) {
557
- const a = document.createElement("button");
558
- a.className = "editora-toast-close", a.setAttribute("aria-label", "Close notification"), a.textContent = "×", a.onclick = () => t.dismiss(), s.appendChild(a);
629
+ if (s.appendChild(r), e.actions && e.actions.length > 0) {
630
+ const n = document.createElement("div");
631
+ n.className = "editora-toast-actions", e.actions.forEach((a) => n.appendChild(this.createActionButton(a, t))), s.appendChild(n);
559
632
  }
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;
633
+ return (e.closable || e.closeButton) && s.appendChild(this.createCloseButton(t)), 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;
561
634
  }
562
635
  // Show toast with animation
563
636
  async showToast(t) {
564
- var r, o;
637
+ var o, r;
565
638
  const e = this.ensureContainer(t.options.position || this.config.position), s = this.createToastElement(t);
566
639
  t.element = s, e.appendChild(s), this.applyStackState(e);
567
640
  const i = t.options.animation || this.config.animation || { type: "css" };
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;
641
+ if (await L.showToast(s, t, i), this.config.enableAccessibility && this.announceToast(t), (r = (o = t.options).onShow) == null || r.call(o), !t.options.persistent && t.options.duration !== 0) {
642
+ const n = t.options.duration || this.config.duration;
570
643
  t.timeoutId = window.setTimeout(() => {
571
644
  t.dismiss();
572
- }, a);
645
+ }, n);
573
646
  }
574
647
  }
575
648
  // Hide toast with animation
576
649
  async hideToast(t) {
577
650
  var s, i;
578
- if (!t.element)
579
- return;
651
+ if (!t.element) return;
580
652
  t.timeoutId && (clearTimeout(t.timeoutId), t.timeoutId = void 0);
581
653
  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);
654
+ if (await L.hideToast(t.element, t, e), t.element && t.element.parentNode) {
655
+ const o = t.element.parentElement;
656
+ t.element.parentNode.removeChild(t.element), t.element = void 0, o && this.applyStackState(o);
585
657
  }
586
658
  (i = (s = t.options).onHide) == null || i.call(s);
587
659
  }
588
660
  // Update toast content
589
661
  async updateToast(t, e) {
590
- var i, r;
591
- if (!t.element)
592
- return;
662
+ var o, r, n;
663
+ if (!t.element) return;
593
664
  const s = t.options.animation || this.config.animation || { type: "css" };
594
665
  if (s.type === "custom" && s.update) {
595
- await C.updateToast(t.element, t, e, s);
666
+ await L.updateToast(t.element, t, e, s);
596
667
  return;
597
668
  }
598
669
  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);
670
+ const a = t.element.querySelector(".editora-toast-content"), l = this.createContent(t);
671
+ a == null || a.replaceWith(l);
672
+ }
673
+ const i = (o = e.closeButton) != null ? o : e.closable;
674
+ if (i !== void 0) {
675
+ t.options.closable = i, t.options.closeButton = i;
676
+ const a = t.element.querySelector(".editora-toast-close");
677
+ i && !a ? t.element.appendChild(this.createCloseButton(t)) : !i && a && a.remove();
601
678
  }
602
679
  if (e.progress !== void 0) {
603
- let o = t.element.querySelector(".editora-toast-progress-track");
680
+ let a = t.element.querySelector(".editora-toast-progress-track");
604
681
  if (e.progress) {
605
- if (!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);
682
+ if (!a) {
683
+ a = document.createElement("div"), a.className = "editora-toast-progress-track", a.setAttribute("role", "progressbar"), a.setAttribute("aria-valuemin", "0"), a.setAttribute("aria-valuemax", "100");
684
+ const d = t.element.querySelector(".editora-toast-content");
685
+ d && d.appendChild(a);
609
686
  }
610
- o.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, e.progress.value))));
611
- const a = o.querySelector(".editora-toast-progress-bar");
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)}%`;
687
+ a.setAttribute("aria-valuenow", String(Math.min(100, Math.max(0, e.progress.value))));
688
+ const l = a.querySelector(".editora-toast-progress-bar");
689
+ if (l && (l.style.width = `${Math.min(100, Math.max(0, e.progress.value))}%`), e.progress.showPercentage) {
690
+ let d = a.querySelector(".editora-toast-progress-text");
691
+ d || (d = document.createElement("span"), d.className = "editora-toast-progress-text", a.insertBefore(d, a.firstChild)), d.textContent = `${Math.round(e.progress.value)}%`;
615
692
  } else {
616
- const c = o.querySelector(".editora-toast-progress-text");
617
- c && c.remove();
693
+ const d = a.querySelector(".editora-toast-progress-text");
694
+ d && d.remove();
618
695
  }
619
- } else
620
- o && o.remove();
696
+ } else a && a.remove();
621
697
  }
622
698
  if (e.actions !== void 0 || e.action !== void 0 || e.cancel !== void 0) {
623
- let o = t.element.querySelector(".editora-toast-actions");
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();
699
+ let a = t.element.querySelector(".editora-toast-actions");
700
+ const l = t.options.actions || [];
701
+ l.length > 0 ? (a ? a.innerHTML = "" : (a = document.createElement("div"), a.className = "editora-toast-actions", t.element.appendChild(a)), a && l.forEach((d) => a.appendChild(this.createActionButton(d, t)))) : a && a.remove();
626
702
  }
627
703
  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;
704
+ const a = t.options.duration || this.config.duration;
629
705
  t.timeoutId = window.setTimeout(() => {
630
706
  t.dismiss();
631
- }, o);
707
+ }, a);
632
708
  }
633
- (r = (i = t.options).onUpdate) == null || r.call(i, e);
709
+ (n = (r = t.options).onUpdate) == null || n.call(r, e);
634
710
  }
635
711
  createContent(t) {
636
712
  const e = t.options, s = document.createElement("div");
637
713
  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);
714
+ const o = document.createElement("span");
715
+ o.className = "editora-toast-icon", o.setAttribute("aria-hidden", "true"), o.textContent = e.icon, s.appendChild(o);
640
716
  }
641
717
  const i = document.createElement("div");
642
718
  if (i.className = "editora-toast-body", e.render)
643
719
  i.appendChild(e.render(t));
644
720
  else {
645
721
  if (e.title) {
646
- const r = document.createElement("div");
647
- r.className = "editora-toast-title", r.textContent = e.title, i.appendChild(r);
722
+ const o = document.createElement("div");
723
+ o.className = "editora-toast-title", o.textContent = e.title, i.appendChild(o);
648
724
  }
649
725
  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);
726
+ const o = document.createElement("div");
727
+ o.className = "editora-toast-message", e.html ? X(o, e.message) : o.textContent = e.message, i.appendChild(o);
652
728
  }
653
729
  if (e.description) {
654
- const r = document.createElement("div");
655
- r.className = "editora-toast-description", r.textContent = e.description, i.appendChild(r);
730
+ const o = document.createElement("div");
731
+ o.className = "editora-toast-description", o.textContent = e.description, i.appendChild(o);
656
732
  }
657
733
  }
658
734
  return s.appendChild(i), s;
659
735
  }
736
+ createCloseButton(t) {
737
+ const e = document.createElement("button");
738
+ return e.className = "editora-toast-close", e.setAttribute("type", "button"), e.setAttribute("aria-label", "Close notification"), e.textContent = "×", e.onclick = () => t.dismiss(), e;
739
+ }
660
740
  createActionButton(t, e) {
661
741
  const s = document.createElement("button");
662
742
  return s.className = `editora-toast-action ${t.primary ? "primary" : ""}`, s.textContent = t.label, t.altText && s.setAttribute("aria-label", t.altText), s.onclick = (i) => {
@@ -664,14 +744,14 @@ class O {
664
744
  }, s;
665
745
  }
666
746
  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 = {
747
+ const s = this.toCssLength(this.config.offset), i = this.toCssLength(this.config.mobileOffset), o = this.toCssLength(this.config.gap);
748
+ 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", o);
749
+ const r = {
670
750
  position: "fixed",
671
751
  zIndex: (this.config.zIndex || 2147483647).toString(),
672
752
  display: "flex",
673
753
  flexDirection: e.startsWith("top") ? "column" : "column-reverse",
674
- gap: r,
754
+ gap: o,
675
755
  pointerEvents: "none",
676
756
  maxWidth: "100%",
677
757
  boxSizing: "border-box",
@@ -684,34 +764,34 @@ class O {
684
764
  };
685
765
  switch (e) {
686
766
  case "top-left":
687
- o.top = `max(${s}, env(safe-area-inset-top))`, o.left = `max(${s}, env(safe-area-inset-left))`;
767
+ r.top = `max(${s}, env(safe-area-inset-top))`, r.left = `max(${s}, env(safe-area-inset-left))`;
688
768
  break;
689
769
  case "top-center":
690
- o.top = `max(${s}, env(safe-area-inset-top))`, o.left = "50%", o.transform = "translateX(-50%)";
770
+ r.top = `max(${s}, env(safe-area-inset-top))`, r.left = "50%", r.transform = "translateX(-50%)";
691
771
  break;
692
772
  case "top-right":
693
- o.top = `max(${s}, env(safe-area-inset-top))`, o.right = `max(${s}, env(safe-area-inset-right))`;
773
+ r.top = `max(${s}, env(safe-area-inset-top))`, r.right = `max(${s}, env(safe-area-inset-right))`;
694
774
  break;
695
775
  case "bottom-left":
696
- o.bottom = `max(${s}, env(safe-area-inset-bottom))`, o.left = `max(${s}, env(safe-area-inset-left))`;
776
+ r.bottom = `max(${s}, env(safe-area-inset-bottom))`, r.left = `max(${s}, env(safe-area-inset-left))`;
697
777
  break;
698
778
  case "bottom-center":
699
- o.bottom = `max(${s}, env(safe-area-inset-bottom))`, o.left = "50%", o.transform = "translateX(-50%)";
779
+ r.bottom = `max(${s}, env(safe-area-inset-bottom))`, r.left = "50%", r.transform = "translateX(-50%)";
700
780
  break;
701
781
  case "bottom-right":
702
- o.bottom = `max(${s}, env(safe-area-inset-bottom))`, o.right = `max(${s}, env(safe-area-inset-right))`;
782
+ r.bottom = `max(${s}, env(safe-area-inset-bottom))`, r.right = `max(${s}, env(safe-area-inset-right))`;
703
783
  break;
704
784
  case "center":
705
- o.top = "50%", o.left = "50%", o.transform = "translate(-50%, -50%)", o.alignItems = "center";
785
+ r.top = "50%", r.left = "50%", r.transform = "translate(-50%, -50%)", r.alignItems = "center";
706
786
  break;
707
787
  }
708
- Object.assign(t.style, o), t.style.setProperty("--editora-toast-mobile-left", i);
788
+ Object.assign(t.style, r), t.style.setProperty("--editora-toast-mobile-left", i);
709
789
  }
710
790
  applyStackState(t) {
711
791
  const e = Array.from(t.querySelectorAll(".editora-toast"));
712
792
  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));
793
+ const o = e.length - i - 1;
794
+ s.dataset.index = String(i), s.dataset.front = String(o === 0), s.style.setProperty("--editora-toast-index", String(i)), s.style.setProperty("--editora-toast-before", String(o));
715
795
  });
716
796
  }
717
797
  toCssLength(t) {
@@ -731,56 +811,70 @@ class O {
731
811
  }
732
812
  // Swipe dismiss with directional control
733
813
  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) => {
740
- if (!r)
741
- return;
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)`;
814
+ let s = 0, i = 0, o = !1;
815
+ const r = e.options.swipeDirection || this.config.swipeDirection || "any", n = 40;
816
+ let a = "", l = !1;
817
+ const d = 'button, a[href], input, select, textarea, label, summary, [role="button"], [contenteditable="true"]', f = () => {
818
+ t.style.transform = a, t.style.transition = "", t.style.cursor = "", t.style.userSelect = "";
819
+ }, u = (p, y) => {
820
+ if ("changedTouches" in p || "touches" in p) {
821
+ const m = y ? p.changedTouches : p.touches, g = m && m[0];
822
+ return g ? { x: g.clientX, y: g.clientY } : null;
746
823
  }
747
- (Math.abs(w) > Math.abs(m) || o === "vertical" || o === "up" || o === "down") && l.preventDefault();
748
- }, p = (l) => {
749
- if (!r)
750
- return;
751
- if (t.style.transform = c, t.style.transition = "", t.style.cursor = "", !d) {
752
- r = !1;
753
- return;
824
+ return { x: p.clientX, y: p.clientY };
825
+ }, P = (p) => {
826
+ const y = p.target;
827
+ if (y instanceof Element && t.contains(y) && y.closest(d) || "button" in p && p.button !== 0) return;
828
+ const m = u(p, !1);
829
+ m && (o = !0, l = !1, s = m.x, i = m.y, a = t.style.transform || "");
830
+ }, w = (p) => {
831
+ var b, k;
832
+ if (!o) return;
833
+ const y = u(p, !1);
834
+ if (!y) return;
835
+ const m = y.x - s, g = y.y - i, T = 5;
836
+ if (!l && (Math.abs(m) > T || Math.abs(g) > T) && (l = !0, t.style.transition = "none", t.style.cursor = "grabbing", t.style.userSelect = "none", (k = (b = window.getSelection) == null ? void 0 : b.call(window)) == null || k.removeAllRanges()), l) {
837
+ const x = Math.abs(g) > Math.abs(m) ? 25 : 20, B = Math.min(Math.max(m * 0.2, -x), x), D = Math.min(Math.max(g * 0.2, -x), x);
838
+ t.style.transform = `${a} translate(${B}px, ${D}px)`, p.cancelable && p.preventDefault();
754
839
  }
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) {
840
+ }, v = (p) => {
841
+ if (!o) return;
842
+ o = !1;
843
+ const y = l;
844
+ if (f(), !y) return;
845
+ const m = u(p, !0);
846
+ if (!m) return;
847
+ const g = m.x - s, T = m.y - i;
848
+ let b = !1;
849
+ const x = r === "vertical" || r === "up" || r === "down" ? 35 : n;
850
+ switch (r) {
759
851
  case "any":
760
- g = Math.abs(m) > a || Math.abs(w) > a;
852
+ b = Math.abs(g) > n || Math.abs(T) > n;
761
853
  break;
762
854
  case "horizontal":
763
- g = Math.abs(m) > a;
855
+ b = Math.abs(g) > n;
764
856
  break;
765
857
  case "vertical":
766
- g = Math.abs(w) > P;
858
+ b = Math.abs(T) > x;
767
859
  break;
768
860
  case "left":
769
- g = m < -a;
861
+ b = g < -n;
770
862
  break;
771
863
  case "right":
772
- g = m > a;
864
+ b = g > n;
773
865
  break;
774
866
  case "up":
775
- g = w < -P;
867
+ b = T < -x;
776
868
  break;
777
869
  case "down":
778
- g = w > P;
870
+ b = T > x;
779
871
  break;
780
872
  }
781
- g && e.dismiss(), r = !1;
873
+ b && e.dismiss();
874
+ }, S = () => {
875
+ o && (o = !1, l = !1, f());
782
876
  };
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);
877
+ t.addEventListener("dragstart", (p) => p.preventDefault()), t.addEventListener("touchstart", P, { passive: !0 }), t.addEventListener("touchmove", w, { passive: !1 }), t.addEventListener("touchend", v), t.addEventListener("touchcancel", S), t.addEventListener("mousedown", P), t.addEventListener("mousemove", w), t.addEventListener("mouseup", v), t.addEventListener("mouseleave", v);
784
878
  }
785
879
  // Drag dismiss (simplified)
786
880
  addDragDismiss(t, e) {
@@ -788,28 +882,21 @@ class O {
788
882
  }
789
883
  // Accessibility
790
884
  announceToast(t) {
791
- if (t.options.ariaLive === "off")
792
- return;
885
+ if (t.options.ariaLive === "off") return;
793
886
  const e = document.createElement("div");
794
887
  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
888
  const s = [t.options.title, t.options.message, t.options.description].filter(Boolean).join(". ");
796
889
  e.textContent = `${t.options.level || "info"}: ${s}`, document.body.appendChild(e), setTimeout(() => {
797
- document.body.removeChild(e);
890
+ e.remove();
798
891
  }, 1e3);
799
892
  }
800
- // Security: Basic HTML sanitization
801
- sanitizeHTML(t) {
802
- const e = document.createElement("div");
803
- return e.textContent = t, e.innerHTML;
804
- }
805
893
  // Inject CSS
806
894
  injectCSS() {
807
- if (this.cssInjected || typeof document == "undefined")
808
- return;
895
+ if (this.cssInjected || typeof document == "undefined") return;
809
896
  if (!Array.from(document.styleSheets).find(
810
897
  (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"));
898
+ var s, i, o, r;
899
+ 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"));
813
900
  }
814
901
  )) {
815
902
  const e = document.createElement("style");
@@ -824,7 +911,7 @@ class O {
824
911
  }), this.containers.clear();
825
912
  }
826
913
  }
827
- class I {
914
+ class U {
828
915
  constructor() {
829
916
  this.plugins = [], this.hooks = {
830
917
  beforeShow: [],
@@ -845,8 +932,7 @@ class I {
845
932
  }
846
933
  remove(t) {
847
934
  const e = this.plugins.findIndex((i) => i.name === t);
848
- if (e === -1)
849
- return !1;
935
+ if (e === -1) return !1;
850
936
  const s = this.plugins[e];
851
937
  return s.uninstall && s.uninstall(this), this.plugins.splice(e, 1), !0;
852
938
  }
@@ -867,11 +953,11 @@ class I {
867
953
  async trigger(t, e, ...s) {
868
954
  const i = this.hooks[t];
869
955
  if (!(!i || i.length === 0))
870
- for (const r of i)
956
+ for (const o of i)
871
957
  try {
872
- await r(e, ...s);
873
- } catch (o) {
874
- console.error(`Error in ${t} hook:`, o);
958
+ await o(e, ...s);
959
+ } catch (r) {
960
+ console.error(`Error in ${t} hook:`, r);
875
961
  }
876
962
  }
877
963
  // Convenience methods for common lifecycle events
@@ -906,10 +992,10 @@ class I {
906
992
  async handlePromise(t, e, s, i) {
907
993
  e();
908
994
  try {
909
- const r = await t;
910
- return s(r), r;
911
- } catch (r) {
912
- throw i(r), r;
995
+ const o = await t;
996
+ return s(o), o;
997
+ } catch (o) {
998
+ throw i(o), o;
913
999
  }
914
1000
  }
915
1001
  // Batch operations
@@ -934,7 +1020,7 @@ class I {
934
1020
  });
935
1021
  }
936
1022
  }
937
- const L = {
1023
+ const O = {
938
1024
  position: "bottom-right",
939
1025
  duration: 4e3,
940
1026
  maxVisible: 3,
@@ -963,36 +1049,48 @@ const L = {
963
1049
  animation: { type: "css" }
964
1050
  // Default to CSS animations
965
1051
  };
966
- class k {
1052
+ class q {
967
1053
  constructor(t = {}) {
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();
1054
+ this.idCounter = 0, this.pausedToasts = /* @__PURE__ */ new Set(), this.pendingShows = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Set(), this.config = this.normalizeConfig({ ...O, ...t }), this.store = new z(this.config), this.queue = new N(this.config), this.renderer = new G(this.config), this.lifecycle = new U(), this.setupWindowFocusHandling();
969
1055
  }
970
1056
  // Core API
971
1057
  show(t) {
972
1058
  const e = t.id || `toast-${++this.idCounter}`, s = {
973
1059
  id: e,
974
- options: this.normalizeToastOptions({ ...this.config, ...t }),
1060
+ options: this.normalizeToastOptions({ ...this.config, ...t }, t),
975
1061
  createdAt: Date.now(),
976
1062
  dismiss: () => this.dismiss(e),
977
- update: (i) => this.update(e, i)
1063
+ update: (r) => this.update(e, r)
1064
+ }, i = this.lifecycle.beforeShow(s).then(async () => {
1065
+ const r = this.queue.enqueue(s);
1066
+ r.rejected || (this.store.addToast(s), await this.hideToasts(r.hide, !0), await this.showToasts(r.show), this.notify());
1067
+ });
1068
+ this.pendingShows.set(e, i);
1069
+ const o = () => {
1070
+ this.pendingShows.get(e) === i && this.pendingShows.delete(e);
978
1071
  };
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;
1072
+ return i.then(o, o), s;
983
1073
  }
984
1074
  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();
1075
+ const s = this.pendingShows.get(t);
1076
+ if (s)
1077
+ return s.then(() => this.update(t, e), () => {
1078
+ }), !0;
1079
+ const i = this.store.getToast(t);
1080
+ return i ? (this.lifecycle.beforeUpdate(i, e).then(async () => {
1081
+ const o = this.normalizeToastOptions({ ...i.options, ...e }, e);
1082
+ this.store.updateToast(t, { options: o }), this.queue.isVisible(t) && await this.renderer.updateToast(i, e), this.lifecycle.afterUpdate(i, e), this.notify();
989
1083
  }), !0) : !1;
990
1084
  }
991
1085
  dismiss(t) {
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();
1086
+ const e = this.pendingShows.get(t);
1087
+ if (e)
1088
+ return e.then(() => this.dismiss(t), () => {
1089
+ }), !0;
1090
+ const s = this.store.getToast(t);
1091
+ return s ? (this.lifecycle.beforeHide(s).then(async () => {
1092
+ const i = this.queue.isVisible(t), o = this.queue.dequeue(t);
1093
+ i && await this.renderer.hideToast(s), this.store.removeToast(t), this.lifecycle.afterHide(s), await this.showToasts(o.show), this.notify();
996
1094
  }), !0) : !1;
997
1095
  }
998
1096
  clear() {
@@ -1003,20 +1101,20 @@ class k {
1003
1101
  }
1004
1102
  // Promise API
1005
1103
  async promise(t, e) {
1006
- var i, r;
1104
+ var i, o;
1007
1105
  const s = this.show(this.normalizeOptions(e.loading, "loading"));
1008
1106
  try {
1009
- const o = await t, a = this.normalizeOptions(
1010
- typeof e.success == "function" ? e.success(o) : e.success,
1107
+ const r = await t, n = this.normalizeOptions(
1108
+ typeof e.success == "function" ? e.success(r) : e.success,
1011
1109
  "success"
1012
1110
  );
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,
1111
+ return n.duration === void 0 && !n.persistent && (n.duration = this.config.duration), this.update(s.id, n), (i = e.onSuccess) == null || i.call(e, r), r;
1112
+ } catch (r) {
1113
+ const n = this.normalizeOptions(
1114
+ typeof e.error == "function" ? e.error(r) : e.error,
1017
1115
  "error"
1018
1116
  );
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;
1117
+ throw n.duration === void 0 && !n.persistent && (n.duration = this.config.duration), this.update(s.id, n), (o = e.onError) == null || o.call(e, r), r;
1020
1118
  }
1021
1119
  }
1022
1120
  // Group API
@@ -1029,10 +1127,10 @@ class k {
1029
1127
  }
1030
1128
  // Configuration
1031
1129
  configure(t) {
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());
1130
+ const e = this.config.pauseOnWindowBlur, s = { ...this.config, ...t };
1131
+ 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);
1132
+ const i = this.queue.updateConfig(this.config);
1133
+ this.hideToasts(i.hide, !0).then(() => this.showToasts(i.show)).then(() => this.notify()), t.pauseOnWindowBlur !== void 0 && t.pauseOnWindowBlur !== e && (this.teardownWindowFocusHandling(), this.setupWindowFocusHandling());
1036
1134
  }
1037
1135
  getConfig() {
1038
1136
  return { ...this.config };
@@ -1079,27 +1177,34 @@ class k {
1079
1177
  return typeof t == "string" ? { message: t, level: e } : { ...t, level: t.level || e };
1080
1178
  }
1081
1179
  normalizeConfig(t) {
1082
- const e = t.visibleToasts || t.maxVisible || L.maxVisible;
1180
+ const e = t.visibleToasts || t.maxVisible || O.maxVisible;
1083
1181
  return {
1084
1182
  ...t,
1085
1183
  maxVisible: e,
1086
1184
  visibleToasts: e
1087
1185
  };
1088
1186
  }
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] : [],
1187
+ // `options` is the caller's options already merged over the config (or over the toast's current options when
1188
+ // updating); `explicit` is just what the caller passed. The close button has to be decided from what the
1189
+ // caller passed first: the merged object always carries the config's `closeButton: false`, so reading it
1190
+ // first made an explicit `closable: true` lose and the documented option silently did nothing.
1191
+ normalizeToastOptions(t, e = t) {
1192
+ var r, n, a, l, d, f;
1193
+ const s = (l = (a = (n = (r = e.closeButton) != null ? r : e.closable) != null ? n : t.closable) != null ? a : t.closeButton) != null ? l : this.config.closeButton, i = t.action ? { ...t.action, primary: (d = t.action.primary) != null ? d : !0 } : void 0, o = [
1194
+ ...i ? [i] : [],
1093
1195
  ...t.cancel ? [t.cancel] : [],
1094
1196
  ...t.actions || []
1095
1197
  ];
1096
1198
  return {
1097
1199
  ...t,
1098
- closable: e,
1099
- actions: i.length > 0 ? i : void 0,
1200
+ closable: s,
1201
+ // Keep the alias in step: the renderer shows the button if either flag is set, and the merged config
1202
+ // value would otherwise re-enable a button the caller explicitly turned off.
1203
+ closeButton: s,
1204
+ actions: o.length > 0 ? o : void 0,
1100
1205
  ariaLive: t.ariaLive || (t.level === "error" || t.important ? "assertive" : "polite"),
1101
1206
  role: t.role || (t.level === "error" || t.important ? "alert" : "status"),
1102
- preventDuplicate: (c = t.preventDuplicate) != null ? c : this.config.preventDuplicate,
1207
+ preventDuplicate: (f = t.preventDuplicate) != null ? f : this.config.preventDuplicate,
1103
1208
  dedupeScope: t.dedupeScope || this.config.dedupeScope
1104
1209
  };
1105
1210
  }
@@ -1115,8 +1220,7 @@ class k {
1115
1220
  await this.lifecycle.beforeHide(t), await this.renderer.hideToast(t), e && this.store.removeToast(t.id), await this.lifecycle.afterHide(t);
1116
1221
  }
1117
1222
  notify() {
1118
- if (this.subscribers.size === 0)
1119
- return;
1223
+ if (this.subscribers.size === 0) return;
1120
1224
  const t = this.getState();
1121
1225
  this.subscribers.forEach((e) => e(t));
1122
1226
  }
@@ -1156,89 +1260,89 @@ class k {
1156
1260
  this.teardownWindowFocusHandling(), this.clear(), this.renderer.destroy(), this.lifecycle.destroy();
1157
1261
  }
1158
1262
  }
1159
- let T = null;
1160
- function u() {
1161
- return T || (T = new k()), T;
1263
+ let E = null;
1264
+ function h() {
1265
+ return E || (E = new q()), E;
1162
1266
  }
1163
- function x(n) {
1267
+ function C(c) {
1164
1268
  return typeof document == "undefined" ? { dismiss: () => {
1165
- } } : u().show(n);
1269
+ } } : h().show(c);
1166
1270
  }
1167
- function S(n, t, e, s) {
1271
+ function $(c, t, e, s) {
1168
1272
  let i = {};
1169
1273
  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,
1274
+ const o = {
1275
+ message: c,
1172
1276
  ...i,
1173
1277
  level: i.level || void 0
1174
1278
  };
1175
- return i.duration !== void 0 && (r.duration = i.duration), i.position && (r.position = i.position), i.theme && (r.theme = i.theme), r;
1279
+ return i.duration !== void 0 && (o.duration = i.duration), i.position && (o.position = i.position), i.theme && (o.theme = i.theme), o;
1176
1280
  }
1177
- const H = {
1178
- info: (n, t, e, s) => x({
1179
- ...S(n, t, e, s),
1281
+ const M = {
1282
+ info: (c, t, e, s) => C({
1283
+ ...$(c, t, e, s),
1180
1284
  level: "info"
1181
1285
  }),
1182
- success: (n, t, e, s) => x({
1183
- ...S(n, t, e, s),
1286
+ success: (c, t, e, s) => C({
1287
+ ...$(c, t, e, s),
1184
1288
  level: "success"
1185
1289
  }),
1186
- error: (n, t, e, s) => x({
1187
- ...S(n, t, e, s),
1290
+ error: (c, t, e, s) => C({
1291
+ ...$(c, t, e, s),
1188
1292
  level: "error"
1189
1293
  }),
1190
- warning: (n, t, e, s) => x({
1191
- ...S(n, t, e, s),
1294
+ warning: (c, t, e, s) => C({
1295
+ ...$(c, t, e, s),
1192
1296
  level: "warning"
1193
1297
  }),
1194
- loading: (n, t, e, s) => x({
1195
- ...S(n, t, e, s),
1298
+ loading: (c, t, e, s) => C({
1299
+ ...$(c, t, e, s),
1196
1300
  level: "loading"
1197
1301
  })
1198
- }, $ = {
1302
+ }, A = {
1199
1303
  // Core methods
1200
- show: (n) => u().show(n),
1201
- update: (n, t) => u().update(n, t),
1202
- dismiss: (n) => u().dismiss(n),
1203
- clear: () => u().clear(),
1304
+ show: (c) => h().show(c),
1305
+ update: (c, t) => h().update(c, t),
1306
+ dismiss: (c) => h().dismiss(c),
1307
+ clear: () => h().clear(),
1204
1308
  // Convenience methods
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 }),
1309
+ info: (c, t) => h().show({ message: c, level: "info", ...t }),
1310
+ success: (c, t) => h().show({ message: c, level: "success", ...t }),
1311
+ error: (c, t) => h().show({ message: c, level: "error", ...t }),
1312
+ warning: (c, t) => h().show({ message: c, level: "warning", ...t }),
1313
+ loading: (c, t) => h().show({ message: c, level: "loading", ...t }),
1210
1314
  // Advanced features
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),
1315
+ promise: (c, t) => h().promise(c, t),
1316
+ group: (c, t) => h().group(c, t),
1317
+ configure: (c) => h().configure(c),
1318
+ use: (c) => h().use(c),
1215
1319
  // State queries
1216
- getToasts: () => u().getToasts(),
1217
- getGroups: () => u().getGroups(),
1218
- getConfig: () => u().getConfig(),
1219
- getState: () => u().getState(),
1220
- subscribe: (n) => u().subscribe(n),
1320
+ getToasts: () => h().getToasts(),
1321
+ getGroups: () => h().getGroups(),
1322
+ getConfig: () => h().getConfig(),
1323
+ getState: () => h().getState(),
1324
+ subscribe: (c) => h().subscribe(c),
1221
1325
  // Editor integration
1222
- onEditorEvent: (n, t) => u().onEditorEvent(n, t),
1223
- triggerEditorEvent: (n, t, ...e) => u().triggerEditorEvent(n, t, ...e),
1326
+ onEditorEvent: (c, t) => h().onEditorEvent(c, t),
1327
+ triggerEditorEvent: (c, t, ...e) => h().triggerEditorEvent(c, t, ...e),
1224
1328
  // Cleanup
1225
1329
  destroy: () => {
1226
- T && (T.destroy(), T = null);
1330
+ E && (E.destroy(), E = null);
1227
1331
  }
1228
1332
  };
1229
1333
  if (typeof window != "undefined" && typeof document != "undefined") {
1230
- const n = window;
1231
- n.toast = H, n.toastAdvanced = $, n.toastPro = $, n.ToastManager = k, n.__editoraToastReady || (n.__editoraToastReady = !0, window.dispatchEvent(
1334
+ const c = window;
1335
+ c.toast = M, c.toastAdvanced = A, c.toastPro = A, c.ToastManager = q, c.__editoraToastReady || (c.__editoraToastReady = !0, window.dispatchEvent(
1232
1336
  new CustomEvent("toastReady", {
1233
- detail: { toast: H, toastAdvanced: $, toastPro: $, ToastManager: k }
1337
+ detail: { toast: M, toastAdvanced: A, toastPro: A, ToastManager: q }
1234
1338
  })
1235
1339
  ));
1236
1340
  }
1237
1341
  export {
1238
- k as ToastManager,
1239
- H as default,
1240
- H as toast,
1241
- $ as toastAdvanced,
1242
- $ as toastPro
1342
+ q as ToastManager,
1343
+ M as default,
1344
+ M as toast,
1345
+ A as toastAdvanced,
1346
+ A as toastPro
1243
1347
  };
1244
1348
  //# sourceMappingURL=index.esm.js.map