customizable-toast-notification 3.12.4 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # [3.14.0](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.13.0...v3.14.0) (2026-10-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * elevate playground UI/UX and fix release workflow git notes ([7a06f36](https://github.com/sammy-cool/customizable-toast-notification/commit/7a06f360716eb9ad7120203981135f781742ff4a))
7
+
8
+ # [3.13.0](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.12.4...v3.13.0) (2026-10-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * correct wrapText truncate logic, enhance CTA href handling, and prune dead code ([6252d35](https://github.com/sammy-cool/customizable-toast-notification/commit/6252d35d0552b2207a767d40d35545c58a00e0a8))
14
+ * eliminate postinstall anti-pattern, harden CI gates, and add defensive edge-case handling ([7856d30](https://github.com/sammy-cool/customizable-toast-notification/commit/7856d3064437b048cdaa20328c9c9bf5decd914b))
15
+ * harden edge cases across id generator, timers, container registry, and promise wrappers ([0678f85](https://github.com/sammy-cool/customizable-toast-notification/commit/0678f85c93731796800cec3a179feef1ed033359))
16
+ * harden progress option, ensure strict typings, and defend against NaN ([fd8a082](https://github.com/sammy-cool/customizable-toast-notification/commit/fd8a0824f9810d41d0b77a3aa5f79f774dc4261e))
17
+ * harden workflows, make toast dismissal concurrent, and document className ([8d4ad60](https://github.com/sammy-cool/customizable-toast-notification/commit/8d4ad607b182ad7ac673ced996989c77aa991f6b))
18
+ * **package:** remove duplicate author field and remove postinstall from files array ([125ece6](https://github.com/sammy-cool/customizable-toast-notification/commit/125ece6a44f44e3760e191f7ce0bbe3423a6321e))
19
+ * preserve loader element during text rendering and add loader types and tests ([fa30711](https://github.com/sammy-cool/customizable-toast-notification/commit/fa30711d5330f921401e85a6996892d2bd022003))
20
+ * prioritize active toasts in dismissMostRecent to drain queue ([ab6d0a3](https://github.com/sammy-cool/customizable-toast-notification/commit/ab6d0a37c2c721412f64f70c420e3c3b2d2a2045))
21
+ * resolve 28 bugs across positioning, sanitization, timers, workflows, and a11y ([9f21ee7](https://github.com/sammy-cool/customizable-toast-notification/commit/9f21ee7fb9d90d6673d61695e82c5953a14174db))
22
+ * standardize toast exit animation transform to downward movement ([3e4e273](https://github.com/sammy-cool/customizable-toast-notification/commit/3e4e273dd0f8fe521832082250b7a7b35bfc5da5))
23
+
24
+
25
+ ### Features
26
+
27
+ * add live updates, stacked card deck, swipe dismiss, and audio synth ([67b2ede](https://github.com/sammy-cool/customizable-toast-notification/commit/67b2eded62c9443be119319daae7c6da738807c6))
28
+ * add loader controls to playground and TypeSafe AI smart toast recipe ([b8e84e7](https://github.com/sammy-cool/customizable-toast-notification/commit/b8e84e7c91c5794e6333cef2e61d51a0823bdd85))
29
+ * **animation:** add custom animation, exit transitions, and memory safeguards ([f8cf63c](https://github.com/sammy-cool/customizable-toast-notification/commit/f8cf63cfb600c606e8fd77fc5ebac9f0b275181c))
30
+ * auto-convert numeric dimensional options to px and restore forceReflow ([6a42f71](https://github.com/sammy-cool/customizable-toast-notification/commit/6a42f718f5bbc6b1366956c875e2fd8fa22657b1))
31
+
1
32
  ## [3.12.4](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.12.3...v3.12.4) (2026-10-03)
2
33
 
3
34
 
package/README.md CHANGED
@@ -95,52 +95,72 @@ Global Variable Name: `customizableToast`
95
95
 
96
96
  ### `createToast(options)`
97
97
 
98
- Creates and displays a toast notification. Returns a handle for
99
- dismissing _that specific toast_ later — useful when other toasts might
100
- be created in between:
98
+ Creates and displays a toast notification. Returns a handle `{ dismiss, update }` for
99
+ dismissing or modifying _that specific toast_ later — without flickering or remounting:
101
100
 
102
101
  ```js
103
- const handle = await createToast({ message: "Uploading...", duration: 60000 });
102
+ const handle = await createToast({
103
+ message: "Uploading assets...",
104
+ showLoader: true,
105
+ duration: 60000,
106
+ });
107
+
108
+ // Update progress in-place:
109
+ await handle.update({ progress: 65, message: "Uploading assets... 65%" });
104
110
 
105
- // later, regardless of what else has happened on screen since:
111
+ // Transition state seamlessly:
112
+ await handle.update({
113
+ type: "success",
114
+ message: "Upload complete!",
115
+ showLoader: false,
116
+ duration: 3000,
117
+ sound: "success",
118
+ });
119
+
120
+ // Or dismiss manually at any point:
106
121
  await handle.dismiss();
107
122
  ```
108
123
 
109
- `handle.dismiss()` is always safe to call, even if the toast already
110
- auto-dismissed on its own — it no-ops rather than throwing.
124
+ `handle.dismiss()` and `handle.update()` are always safe to call, even if the toast already
125
+ auto-dismissed on its own — they no-op gracefully rather than throwing.
111
126
 
112
127
  #### Options
113
128
 
114
- | Parameter | Type | Default | Description |
115
- | ------------------- | --------- | ------------------------------- | --------------------------------------------------------- |
116
- | `message` | `string` | Based on `type` | Toast message content |
117
- | `type` | `string` | `"info"` | `"info"`, `"success"`, `"error"`, `"warning"` |
118
- | `duration` | `number` | `2500` | Auto-dismiss time in milliseconds |
119
- | `position` | `string` | `"bottom-right"` | Toast position on screen |
120
- | `borderRadius` | `string` | `"50px"` | Toast corner radius |
121
- | `backgroundColor` | `string` | Based on `type` | Custom background color |
122
- | `textColor` | `string` | Auto-computed for WCAG contrast | Custom text color |
123
- | `showCloseButton` | `boolean` | `true` | Show close (×) button |
124
- | `showProgressBar` | `boolean` | `true` | Show countdown progress bar |
125
- | `animationDuration` | `string` | `"0.4s"` | CSS animation duration |
126
- | `animationEasing` | `string` | `"ease"` | CSS animation easing function |
127
- | `progressColor` | `string` | Falls back to `textColor` | Progress bar color |
128
- | `progressHeight` | `string` | `"4px"` | Progress bar height |
129
- | `progressPosition` | `string` | `"bottom"` | Progress bar position: `"top"` or `"bottom"` |
130
- | `pauseOnHover` | `boolean` | `auto` | Pause timer on hover (auto: true for CTA toasts) |
131
- | `allowHtml` | `boolean` | `false` | Render `message` as sanitized HTML instead of plain text |
132
- | `sanitizeHtml` | `boolean` | `true` | Sanitize HTML when `allowHtml=true` |
133
- | `wrapText` | `string` | `"normal"` | `"normal"` wraps naturally; falsy truncates to 3 lines |
134
- | `maxWidth` | `string` | Auto | Max width (auto: `400px` / `100vw` for full-width) |
135
- | `fontFamily` | `string` | System default | Font family |
136
- | `fontSize` | `string` | `"14px"` | Font size |
137
- | `fontWeight` | `string` | `"400"` | Font weight |
138
- | `fontLineHeight` | `string` | `"1.4"` | Font line height |
139
- | `showLoader` | `boolean` | `false` | Show spinner loader before the message |
140
- | `loader` | `object` | `null` | Custom loader config (`size`, `color`, `text`) |
141
- | `fontDirection` | `string` | `"auto"` | Font direction: `"auto"`, `"ltr"`, `"rtl"` |
142
- | `fontPadding` | `string` | `undefined` | Custom padding for message container (e.g. `"4px 8px"`) |
143
- | `cta` | `object` | `null` | Call-to-action configuration (see [CTA](#call-to-action)) |
129
+ | Parameter | Type | Default | Description |
130
+ | ------------------- | ------------------ | ------------------------------- | ------------------------------------------------------------------------------ |
131
+ | `message` | `string` | Based on `type` | Toast message content |
132
+ | `type` | `string` | `"info"` | `"info"`, `"success"`, `"error"`, `"warning"` |
133
+ | `duration` | `number` | `2500` | Auto-dismiss time in milliseconds |
134
+ | `position` | `string` | `"bottom-right"` | Toast position on screen |
135
+ | `borderRadius` | `string` | `"50px"` | Toast corner radius |
136
+ | `backgroundColor` | `string` | Based on `type` | Custom background color |
137
+ | `textColor` | `string` | Auto-computed for WCAG contrast | Custom text color |
138
+ | `showCloseButton` | `boolean` | `true` | Show close (×) button |
139
+ | `showProgressBar` | `boolean` | `true` | Show countdown progress bar |
140
+ | `animationDuration` | `string` | `"0.4s"` | CSS animation duration |
141
+ | `animationEasing` | `string` | `"ease"` | CSS animation easing function |
142
+ | `progressColor` | `string` | Falls back to `textColor` | Progress bar color |
143
+ | `progressHeight` | `string` | `"4px"` | Progress bar height |
144
+ | `progressPosition` | `string` | `"bottom"` | Progress bar position: `"top"` or `"bottom"` |
145
+ | `pauseOnHover` | `boolean` | `auto` | Pause timer on hover (auto: true for CTA toasts) |
146
+ | `allowHtml` | `boolean` | `false` | Render `message` as sanitized HTML instead of plain text |
147
+ | `sanitizeHtml` | `boolean` | `true` | Sanitize HTML when `allowHtml=true` |
148
+ | `wrapText` | `string` | `"normal"` | `"normal"` wraps naturally; falsy truncates to 3 lines |
149
+ | `maxWidth` | `string` | Auto | Max width (auto: `400px` / `100vw` for full-width) |
150
+ | `fontFamily` | `string` | System default | Font family |
151
+ | `fontSize` | `string` | `"14px"` | Font size |
152
+ | `fontWeight` | `string` | `"400"` | Font weight |
153
+ | `fontLineHeight` | `string` | `"1.4"` | Font line height |
154
+ | `showLoader` | `boolean` | `false` | Show spinner loader before the message |
155
+ | `loader` | `object` | `null` | Custom loader config (`size`, `color`, `text`) |
156
+ | `fontDirection` | `string` | `"auto"` | Font direction: `"auto"`, `"ltr"`, `"rtl"` |
157
+ | `fontPadding` | `string` | `undefined` | Custom padding for message container (e.g. `"4px 8px"`) |
158
+ | `className` | `string` | `undefined` | Custom CSS class name(s) for animations / styling |
159
+ | `stacked` | `boolean` | `false` | Enable iOS-style card deck stacking for multiple toasts |
160
+ | `sound` | `boolean \| string`| `false` | Zero-asset audio chime (`true`, `'success'`, `'error'`, `'warning'`, `'pop'`) |
161
+ | `swipeToDismiss` | `boolean` | `true` | Mobile touch swipe-to-dismiss gesture with physics |
162
+ | `progress` | `number` | `undefined` | Explicit progress bar percentage (0 to 100) |
163
+ | `cta` | `object` | `null` | Call-to-action configuration (see [CTA](#call-to-action)) |
144
164
 
145
165
  #### Position Options
146
166
 
@@ -239,6 +259,45 @@ createToast({
239
259
  | `color` | `string` | `"currentColor"` | SVG stroke color |
240
260
  | `text` | `string` | `""` | Optional inline label text next to the spinner |
241
261
 
262
+ ### 🗂️ iOS-Style Card Deck Stacked Mode
263
+
264
+ Group multiple notifications into a beautiful, compact card stack that collapses behind each other with natural depth physics, and automatically fans out on hover or focus:
265
+
266
+ ```js
267
+ // Enable stacking per toast or for an entire workflow
268
+ createToast({ message: "New comment on your post", stacked: true });
269
+ createToast({ message: "Sarah mentioned you", stacked: true });
270
+ createToast({ message: "Deploy finished successfully", type: "success", stacked: true });
271
+ ```
272
+
273
+ - When multiple toasts arrive, earlier toasts smoothly scale down and tuck behind the active card (`scale(0.95)`, `scale(0.90)`).
274
+ - Hovering or keyboard-focusing on the deck automatically expands all notifications with spring animations.
275
+ - Leaving collapses them back into a clean stack.
276
+
277
+ ### 🔊 Zero-Asset Web Audio API Chimes
278
+
279
+ Play pleasant micro-feedback audio chimes generated entirely on the fly with the browser's native `AudioContext` and pure math oscillators — **zero external audio files, zero MP3 assets, and 0 network overhead**:
280
+
281
+ ```js
282
+ import { createToast, setAudioEnabled, playTone } from "customizable-toast-notification";
283
+
284
+ // Automatically chime based on type or custom tone:
285
+ createToast({ message: "Changes saved", type: "success", sound: true }); // pleasant major chord
286
+ createToast({ message: "Network error", type: "error", sound: "error" }); // gentle alert buzz
287
+ createToast({ message: "Warning threshold", sound: "warning" });
288
+ createToast({ message: "New ping", sound: "pop" });
289
+
290
+ // Globally toggle sound effects (e.g. user accessibility preferences)
291
+ setAudioEnabled(false);
292
+ ```
293
+
294
+ ### 👆 Mobile Touch Swipe-to-Dismiss
295
+
296
+ Toasts feature native-feeling touch velocity gestures:
297
+ - Swipe horizontally past 75px on any mobile device to smoothly fling the toast off-screen.
298
+ - Releases below the threshold snap cleanly back into place.
299
+ - Can be disabled if needed via `swipeToDismiss: false`.
300
+
242
301
  ### `setDefaultColors(colors)`
243
302
 
244
303
  Configure default colors for toast types.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Customizable Toast Notifications
3
- * Build: 2026-10-03 17:19:09
4
- * Cache-Buster: 1791047949836
3
+ * Build: 2026-10-03 21:34:16
4
+ * Cache-Buster: 1791063256887
5
5
  * Author: Priyanshu Patel
6
6
  * Email: priyanshu.alt191@gmail.com
7
7
  * License: Apache-2.0
@@ -12,5 +12,5 @@
12
12
  * Supports flexible positioning, theming, icons, animations, and timing options
13
13
  * out of the box — with CTA support and zero dependencies.
14
14
  */
15
- "use strict";const t=new class{constructor(t=200){this.maxSize=t,this.map=new Map}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxSize){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}}(200),e={};function o(o){if(!o)return"snow";const n=String(o),r=t.get(n);if(r)return r;if(e[null==o?void 0:o.toLowerCase()]){const r=e[o.toLowerCase()];return t.set(n,r),r}let i,a,s;try{const t=function(t){const e=null==t?void 0:t.match(/^#([0-9a-f]{3,8})$/i);if(e){let t=e[1];return 3===t.length&&(t=t.split("").map(t=>t+t).join("")),{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const o=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(o)return{r:Number(o[1]),g:Number(o[2]),b:Number(o[3])};const n=null==t?void 0:t.match(/hsla?\(\s*([\d.]+)(?:deg)?\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.]+)?\)/i);if(n){const t=Number(n[1])/360,e=Number(n[2])/100,o=Number(n[3])/100;if(0===e){const t=Math.round(255*o);return{r:t,g:t,b:t}}const r=(t,e,o)=>(o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t),i=o<.5?o*(1+e):o+e-o*e,a=2*o-i;return{r:Math.round(255*r(a,i,t+1/3)),g:Math.round(255*r(a,i,t)),b:Math.round(255*r(a,i,t-1/3))}}return null}(function(t){var e;const o=null==t?void 0:t.match(/^var\((--[\w-]+)(?:\s*,\s*(.+))?\)$/i);if(!o)return t;try{if("undefined"!=typeof document&&"function"==typeof getComputedStyle){const t=getComputedStyle(document.documentElement).getPropertyValue(o[1]).trim();if(t)return t}}catch(t){}return(null===(e=o[2])||void 0===e?void 0:e.trim())||t}(o));if(!t)throw new Error("Unknown color");({r:i,g:a,b:s}=t)}catch{i=a=s=128}const l=(t,e,o)=>{const n=[t,e,o].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*n[0]+.7152*n[1]+.0722*n[2]},c=(t,e)=>{const o=l(...t),n=l(...e);return(Math.max(o,n)+.05)/(Math.min(o,n)+.05)};let[u,d,m]=((t,e,o)=>{t/=255,e/=255,o/=255;const n=Math.max(t,e,o),r=Math.min(t,e,o);let i,a,s=(n+r)/2;if(n===r)i=a=0;else{const l=n-r;switch(a=s>.5?l/(2-n-r):l/(n+r),n){case t:i=(e-o)/l+(e<o?6:0);break;case e:i=(o-t)/l+2;break;case o:i=(t-e)/l+4}i/=6}return[360*i,a,s]})(i,a,s),f=m<.5?Math.min(m+.5,1):Math.max(m-.5,0),[p,h,y]=((t,e,o)=>{let n,r,i;if(t/=360,0===e)n=r=i=o;else{const a=(t,e,o)=>(o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t),s=o<.5?o*(1+e):o+e-o*e,l=2*o-s;n=a(l,s,t+1/3),r=a(l,s,t),i=a(l,s,t-1/3)}return[Math.round(255*n),Math.round(255*r),Math.round(255*i)]})(u,d,f);if(c([i,a,s],[p,h,y])<4.5){const t=c([i,a,s],[0,0,0]),e=c([i,a,s],[255,255,255]);[p,h,y]=t>=e?[0,0,0]:[255,255,255]}const g=((t,e,o)=>`#${t.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`)(p,h,y);return t.set(n,g),g}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(([t,[o,n,r]])=>{const i=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=.2126*i(o)+.7152*i(n)+.0722*i(r),s=(a+.05)/.05,l=1.05/(a+.05);e[t.toLowerCase()]=s>=l?"#000000":"#ffffff"});const n=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),r=new Set(["href","src","alt","title","class","target","rel","loading"]),i=/<\/?(script|iframe|object|embed|link|meta|style|form|input|button|svg|math|video|audio|details|dialog|applet|frame|frameset|textarea|select|option|optgroup|fieldset|legend|datalist|output|progress|meter|keygen|canvas|map|area|base|basefont|bgsound|blink|center|dir|font|hgroup|isindex|listing|marquee|multicol|nextid|noembed|noframes|plaintext|rb|rtc|spacer|strike|tt|xmp)[^>]*>/gi,a=/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,s=/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi;function l(t,e,o){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType===Node.COMMENT_NODE)return null;if(t.nodeType!==Node.ELEMENT_NODE)return null;const n=t.tagName.toUpperCase();if(!e.has(n)){const n=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const r=l(t,e,o);r&&n.appendChild(r)}),n}const r=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(t=>{r.setAttribute(t.name,t.value)}),function(t,e){const o=[];Array.from(t.attributes||[]).forEach(n=>{const r=n.name.toLowerCase(),i=n.value;if(e.has(r))if("href"!==r&&"src"!==r||!/^\s*javascript:/i.test(i))if("src"!==r||/^\s*(https?:|data:image\/)/i.test(i)){if("target"===r&&"_blank"===i){const e=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);e.includes("noopener")||e.push("noopener"),e.includes("noreferrer")||e.push("noreferrer"),t.setAttribute("rel",e.join(" "))}}else o.push(r);else o.push(r);else o.push(r)}),o.forEach(e=>t.removeAttribute(e))}(r,o),Array.from(t.childNodes).forEach(t=>{const n=l(t,e,o);n&&r.appendChild(n)}),r}function c(t,e={}){if("string"!=typeof t||!t.trim())return"";try{if(!e.forceFallback&&function(){try{if("undefined"!=typeof window&&window.DOMPurify)return!0}catch(t){}return!1}()){const e=window.DOMPurify.sanitize(t,{ALLOWED_TAGS:Array.from(n),ALLOWED_ATTR:Array.from(r),ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i}),o=document.createElement("div");return o.innerHTML=e,o.querySelectorAll('a[target="_blank"]').forEach(t=>{const e=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);e.includes("noopener")||e.push("noopener"),e.includes("noreferrer")||e.push("noreferrer"),t.setAttribute("rel",e.join(" "))}),o.innerHTML}}catch(t){console.warn("DOMPurify sanitization failed, falling back:",t)}return function(t){if(!t||"string"!=typeof t)return"";let e=t.replace(i,"");e=e.replace(a,""),e=e.replace(s,"$1=$2#$2");const o=document.createElement("div");o.innerHTML=e;const c=document.createDocumentFragment();Array.from(o.childNodes).forEach(t=>{const e=l(t,n,r);e&&c.appendChild(e)});const u=document.createElement("div");return u.appendChild(c),u.querySelectorAll('a[target="_blank"]').forEach(t=>{const e=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);e.includes("noopener")||e.push("noopener"),e.includes("noreferrer")||e.push("noreferrer"),t.setAttribute("rel",e.join(" "))}),u.innerHTML}(t)}async function u(t,e,n){const r=await async function(t){if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;if("string"==typeof t){if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*parseFloat(t);return Number.isFinite(e)&&e>0?e:500}const e=parseFloat(t);return Number.isFinite(e)&&e>0?e:500}return 500}(null==e?void 0:e.animationDuration),i=`${r}ms`,a="string"==typeof(null==e?void 0:e.animationEasing)&&e.animationEasing.trim()?e.animationEasing.trim():"ease",s="string"==typeof(null==e?void 0:e.className)&&e.className.trim()?` ${e.className.trim()}`:"";t.className=`toast toast-${(null==e?void 0:e.type)??"info"}${s}`,Object.assign(t.style,{background:null==e?void 0:e.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:null==e?void 0:e.borderRadius,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:null==e?void 0:e.maxWidth,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${i} ${a}, transform ${i} ${a}`,transform:"translateY(20px)",zIndex:"9999"}),t.setAttribute("role","alert"),t.setAttribute("aria-live","polite"),t.tabIndex=0,t._animationDuration=r;const l=document.createElement("span");null!=e&&e.wrapText?Object.assign(l.style,{display:"block",whiteSpace:"normal"}):Object.assign(l.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"}),Object.assign(l.style,{flex:"1",padding:null==e?void 0:e.fontPadding,fontFamily:null==e?void 0:e.fontFamily,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,lineHeight:null==e?void 0:e.fontLineHeight,color:null==e?void 0:e.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:null!=e&&e.fontDirection&&"auto"!==e.fontDirection?e.fontDirection:void 0});const u=!!e.allowHtml,d=e.message??"";if(e.loader||e.showLoader){const t=function(t={}){const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},o=Number(e.size)||14,n="string"==typeof e.color&&e.color.trim()?e.color.trim():"currentColor",r="string"==typeof e.text?e.text:"",i=document.createElement("span");i.className="toast-loader",i.style.display="inline-flex",i.style.alignItems="center",i.style.gap="8px";const a="http://www.w3.org/2000/svg",s=document.createElementNS(a,"svg");s.setAttribute("width",String(o)),s.setAttribute("height",String(o)),s.setAttribute("viewBox","0 0 50 50"),s.setAttribute("aria-hidden","true");const l=document.createElementNS(a,"circle");if(l.setAttribute("cx","25"),l.setAttribute("cy","25"),l.setAttribute("r","20"),l.setAttribute("fill","none"),l.setAttribute("stroke",n),l.setAttribute("stroke-width","4"),l.setAttribute("stroke-linecap","round"),l.style.opacity="0.85",l.style.strokeDasharray="90",l.style.strokeDashoffset="60",l.style.transformOrigin="center",l.style.animation="toast-spinner 1s linear infinite",s.appendChild(l),i.appendChild(s),r){const t=document.createElement("span");t.style.fontSize="13px",t.textContent=r,i.appendChild(t)}if("undefined"!=typeof document&&!document.getElementById("toast-spinner-styles")){const t=document.createElement("style");t.id="toast-spinner-styles",t.textContent="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }";const e=document.head||document.documentElement;e&&e.appendChild(t)}return i}(e.loader||{});l.appendChild(t);const o=document.createElement("span");o.style.display="inline-block",o.style.width="8px",l.appendChild(o)}if(u&&"string"==typeof d&&d.trim().length>0)try{const t=c(d),e=document.createElement("div");for(e.innerHTML=t;e.firstChild;)l.appendChild(e.firstChild)}catch(t){console.warn("HTML message sanitization failed, falling back to text:",t),l.appendChild(document.createTextNode(String(d)))}else l.appendChild(document.createTextNode(String(d)));l.setAttribute("title","string"==typeof d?d.replace(/<[^>]+>/g,""):String(d)),t.appendChild(l),null!=e&&e.cta&&0!==Object.keys(e.cta).length&&function(t,e,n){const r=null==e?void 0:e.cta;if(!r||"object"!=typeof r||Array.isArray(r))return;const i={...r};i.label||(i.label="CTA Label Missing!");const a=!!i.href&&"link"===i.variant,s=document.createElement(a?"a":"button");a?(s.href=i.href,i.target&&(s.target=i.target),s.rel=i.rel||("_blank"===i.target?"noopener noreferrer":"")):s.type="button",s.setAttribute("aria-label",i.ariaLabel||i.label);const l=e.textColor||o(e.backgroundColor),c=e.backgroundColor&&(d=e.backgroundColor)&&"#000000"===o(d)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)",u="string"==typeof l&&/^#[0-9a-fA-F]{6}$/.test(l.trim())?`${l.trim()}44`:"rgba(128, 128, 128, 0.3)";var d;Object.assign(s.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${u}`,color:l,background:c,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),s.textContent=i.label;const m=async e=>{try{if("function"==typeof i.onClick){const t=i.onClick(e);null!=t&&t.then&&await t}}catch(t){console.error("CTA onClick handler error:",t)}finally{!1!==i.autoClose&&"function"==typeof n&&n(t)}};s.addEventListener("click",m),s._cleanup=()=>s.removeEventListener("click",m),t._cleanupCTA=()=>s.removeEventListener("click",m),t.appendChild(s)}(t,e,n),null!=e&&e.showCloseButton&&function(t,e,n){const r=document.createElement("button");r.setAttribute("aria-label","Close notification"),r.setAttribute("title","Close"),r.textContent="×";const i=e.textColor||o(e.backgroundColor);Object.assign(r.style,{background:"none",border:"none",color:i,fontSize:"18px",marginLeft:"10px",cursor:"pointer",lineHeight:"1",padding:"0 4px"});const a=()=>{"function"==typeof n&&n(t)};r.addEventListener("click",a),t._cleanupCloseButton=()=>{r.removeEventListener("click",a)},t.appendChild(r)}(t,e,n),null!=e&&e.showProgressBar&&function(t,e){const o=document.createElement("div"),n=e.borderRadius||"0",r=parseInt(n,10),i=parseInt(e.progressHeight,10)||4,a=Number(e.duration??2500)+5,s=Math.min(r,2*i),l=r>0?`calc(100% - ${s}px)`:"100%";Object.assign(o.style,{position:"absolute",left:`${s}px`,height:`${i}px`,background:e.progressColor||"currentColor",width:`${l}`,transition:`width ${a}ms linear`,["top"===e.progressPosition?"top":"bottom"]:"0",borderRadius:i/2+"px",opacity:"0.8"}),t.appendChild(o),"function"==typeof o.animate?t._progressAnimation=o.animate([{width:l},{width:"0%"}],{duration:a,easing:"linear",fill:"forwards",delay:50}):(o.style.transition=`width ${a}ms linear`,setTimeout(()=>{o.offsetWidth,o.style.width="0%"},50))}(t,e),function(t){setTimeout(()=>{requestAnimationFrame(()=>{t.style.opacity="1",t.style.transform="translateY(0)"})},50)}(t)}async function d(t,e){try{const o=document.createElement("div"),n=((null==t?void 0:t.position)||"bottom-right").toLowerCase().trim();let r="auto",i="auto",a="auto",s="auto",l="none";n.startsWith("top")?r="20px":(n.startsWith("bottom")||n.includes("below"))&&(i="20px"),n.startsWith("left")?a="20px":n.startsWith("right")?s="20px":"center"===n?(a="50%",r="50%",l="translate(-50%, -50%)"):n.includes("center")?n.includes("left")?(a="20px",r="50%",l="translateY(-50%)"):n.includes("right")?(s="20px",r="50%",l="translateY(-50%)"):n.includes("top")?(r="20px",a="50%",l="translateX(-50%)"):n.includes("bottom")&&(i="20px",a="50%",l="translateX(-50%)"):(s="20px",i="20px"),Object.assign(o.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:r,bottom:i,left:a,right:s,transform:l,zIndex:"99999",borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const u=document.createElement("div"),d=document.createElement("span");d.style.display="inline-block",t.allowHtml?d.innerHTML=c(String(t.message||"Emergency Toast Showing!")):d.textContent=String(t.message||"Emergency Toast Creation Showing!"),u.appendChild(d);const m=document.createElement("span");for(m.style.cssText="float: right; margin-left: 10px; font-weight: bold; cursor: pointer;",m.textContent="×",u.appendChild(m);o.firstChild;)o.removeChild(o.firstChild);o.appendChild(u),m.addEventListener("click",()=>{o.remove(),"function"==typeof e&&e(o)}),document.body.appendChild(o);const f=Number(null==t?void 0:t.duration)||2500,p=setTimeout(()=>{o.remove(),"function"==typeof e&&e(o)},f);return"function"==typeof(null==p?void 0:p.unref)&&p.unref(),o}catch(t){return console.error("Emergency toast creation failed:",t),"function"==typeof e&&e(null),null}}const m=new Map,f=new Map;function p(t){if(!t||"string"!=typeof t)return"bottom-right";const e=t.toLowerCase().trim();return e?e.replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-"):"bottom-right"}async function h(t,e){const o=`toast-container-${p((null==t?void 0:t.position)||"bottom-right")}`;if(f.has(o))return f.get(o);const n=(async()=>{const n=m.get(o),r="undefined"==typeof document||(null==n?void 0:n.ownerDocument)===document;if(null!=n&&n.isConnected&&r)return n;n&&m.delete(o);let i=document.getElementById(o);i&&!i.isConnected&&document.body.appendChild(i),i?(i.style.position=i.style.position||"fixed",i.style.zIndex=i.style.zIndex||"9999","function"==typeof e&&await e(i,t)):(i=document.createElement("div"),i.id=o,i.setAttribute("role","status"),i.setAttribute("aria-atomic","true"),i.style.position="fixed",i.style.zIndex="9999",i.style.pointerEvents="none",i.style.inset="auto 10px 10px auto",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center",i.style.flexDirection="column",i.style.overflow="hidden","function"==typeof e&&await e(i,t),document.body.appendChild(i));const a=document.querySelectorAll(`#${o}`);if(a.length>1)for(let t=1;t<a.length;t++)try{a[t].remove()}catch{}return m.set(o,i),i})();f.set(o,n);try{return await n}finally{f.delete(o)}}const y=new Set(["top-left","top-right","bottom-left","bottom-right","top-center","bottom-center","left-center","right-center","top-full-width","bottom-full-width","center"]),g=new Set(["top","bottom"]);async function b(t,e){if(!t||null==e||!e.position)throw new Error("Invalid container or position!");const o=String(e.position).toLowerCase().trim();let n=o;var r;r=o,y.has(r)||g.has(o)||(console.warn(`Unknown position "${e.position}", defaulting to "bottom-right"`),n="bottom-right"),function(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}(t);const i=function(t){const e=t.toLowerCase().trim();return{hasTop:e.startsWith("top"),hasBottom:e.startsWith("bottom")||e.startsWith("below"),hasLeft:e.startsWith("left"),hasRight:e.startsWith("right"),hasCenter:"center"===e||e.includes("center")&&!e.includes("left")&&!e.includes("right")&&!e.includes("top")&&!e.includes("bottom"),hasFullWidth:"top-full-width"===e||"bottom-full-width"===e}}(n);(function(t,e,o){if(!o.hasFullWidth)return!1;t.style.maxWidth="100vw";try{e&&!e.maxWidth&&(e.maxWidth="100vw")}catch{}return o.hasTop?(t.style.top="10px",t.style.left="10px",t.style.right="10px",!0):!!o.hasBottom&&(t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0)})(t,e,i)||function(t,e){return!!e.hasCenter&&(!e.hasTop||e.hasLeft||e.hasRight?!e.hasBottom||e.hasLeft||e.hasRight?!e.hasLeft||e.hasTop||e.hasBottom?!e.hasRight||e.hasTop||e.hasBottom?!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom)&&(t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0):(t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0):(t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0))}(t,i)||function(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop?t.style.top="10px":t.style.bottom="10px",e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(t.style.left="50%",t.style.transform="translateX(-50%)")}(t,i)}class w{constructor(t,e){this.callback="function"==typeof t?t:()=>{};const o=Number.isFinite(e)&&e>=0?e:0;this.delay=o,this.remaining=o,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){var t;return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null;try{this.callback()}catch(t){console.error("PausableTimer callback error:",t)}},this.remaining),"function"==typeof(null===(t=this.timeoutId)||void 0===t?void 0:t.unref)&&this.timeoutId.unref()),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}const v=new Map,x=new Map,C=[];let k=0;async function E(t,e,o){try{if(!t||"object"!=typeof t)throw new TypeError("options must be an object");k++;const n=await h(t,b);if(!n)throw new Error("Failed to create toast container");const r=await async function(t,e){let o;try{return o=await async function(t,e){const o=document.createElement(t);return o.id=function(t="toast"){return`${"string"==typeof t&&t.trim()?t.trim():"toast"}-${Date.now().toString(36)}-${Math.floor(1048575*Math.random()).toString(36)}`}(e),o}("div","toast"),await u(o,t,e),o}catch(n){return console.warn("toast creation failed with error showing fallback one: ",n),o=await d(t,e),o}}(t,L);if(!r)throw new Error("Toast element creation failed");const i=document.createElement("div");Object.assign(i.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const a=document.createElement("div");Object.assign(a.style,{position:"relative",overflow:"hidden",zIndex:"1"}),a.appendChild(r),i.appendChild(a),n.id.includes("toast-container-")&&n.appendChild(i);const s=!1!==t.pauseOnHover&&(!0===t.pauseOnHover||!!t.cta),l={outer:i,toast:r,options:t,count:Math.max(1,Math.floor(o??0)),timeout:null,pauseOnHover:s};v.set(e,l),r._key=e,l.count>1&&await N(l),l.timer=S(r,t),await T(l)}catch(e){console.error("Something went wrong: ",e),k=Math.max(0,k-1),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await d(t,L))}}const A=async function(){try{if(0===v.size)return;let t=null;const e=Array.from(v.values());if(e.length>0){const o=e.at(-1);t=o.toast||o.outer&&o.outer.querySelector('[id^="toast-"]')}if(t||document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const o=Array.from(e.children||[]);if(0===o.length)return;const n=o.at(-1);n&&(t=n.querySelector('[id^="toast-"]')||n)}),!t)return;const o=t._key?t:t.querySelector('[id^="toast-"]')||t;await L(o)}catch(t){console.error("dismissMostRecent failed:",t)}};function S(t,e){const o=Number(null==e?void 0:e.duration),n=Number.isFinite(o)&&o>0?o:2500,r=new w(async()=>await L(t),n+5);return r.start(),r}async function T(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const{outer:e,timer:o,toast:n}=t,r=()=>{var t;o.pause(),null==n||null===(t=n._progressAnimation)||void 0===t||t.pause()},i=()=>{var t;o.resume(),null==n||null===(t=n._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(o.pause(),null==n||null===(e=n._progressAnimation)||void 0===e||e.pause())},s=t=>{var r;e.contains(t.relatedTarget)||(o.resume(),null==n||null===(r=n._progressAnimation)||void 0===r||r.play())};e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",i),e.addEventListener("focusin",a),e.addEventListener("focusout",s),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",i),e.removeEventListener("focusin",a),e.removeEventListener("focusout",s)}}async function L(t){if(null!=t&&t._key)return M(t._key)}async function M(t){try{var e,o,n,r,i,a,s,l,c,u,d,m,f,p;if(!t)return;const h=x.get(t);if(h)return cancelAnimationFrame(h.rafId),void x.delete(t);const y=C.findIndex(e=>e.key===t);if(-1!==y)return void C.splice(y,1);const g=v.get(t);if(!g)return;null===(e=g.timer)||void 0===e||e.clear(),null===(o=g.outer)||void 0===o||null===(n=o._pauseCleanup)||void 0===n||n.call(o),null===(r=g.toast)||void 0===r||null===(i=r._cleanupCloseButton)||void 0===i||i.call(r),null===(a=g.toast)||void 0===a||null===(s=a._cleanupCTA)||void 0===s||s.call(a),null===(l=g.toast)||void 0===l||null===(c=l._cleanup)||void 0===c||c.call(l);const b=null===(u=g.toast)||void 0===u?void 0:u.querySelector("button, a");null==b||null===(d=b._cleanup)||void 0===d||d.call(b),v.delete(t),k=Math.max(0,k-1);const w=g.outer.querySelector(".toast-count-badge");w&&w.remove();const E=(null===(m=g.toast)||void 0===m?void 0:m._animationDuration)??400;g.toast&&(g.toast.style.opacity="0",g.toast.style.transform="translateY(20px)");const A=null===(f=g.outer)||void 0===f?void 0:f.parentElement;if(await async function(t,e,o=400){return t?new Promise(n=>{let r=!1;const i=()=>{r||(r=!0,async function(t){if(!t)return!0;try{if("function"==typeof t.remove)return t.remove(),!0}catch{}try{if(t.parentNode)return t.parentNode.removeChild(t),!0}catch{}}(t),n())},a=e||t.firstElementChild||t;if(!a)return n();const s=t=>{try{if(t.target!==a)return;a.removeEventListener("transitionend",s,!0),i()}catch(t){console.error("removeWithTransition error:",t)}};try{a.addEventListener("transitionend",s,!0)}catch(t){console.error("removeWithTransition error:",t)}setTimeout(()=>{try{a.removeEventListener("transitionend",s,!0),i()}catch(t){console.error("removeWithTransition error:",t)}},o+100)}):Promise.resolve()}(g.outer,g.toast,E),A&&0===A.children.length&&null!==(p=A.id)&&void 0!==p&&p.startsWith("toast-container-"))try{A.remove()}catch{}await I()}catch(t){console.error("Closing Toast failed!: ",t)}}async function I(){for(;k<3&&C.length;){const t=C.shift();if(v.has(t.key)){const e=v.get(t.key);e.count+=t.count,await N(e);continue}E(t.options,t.key,t.count)}}async function N({outer:t,count:e}){if(!(t&&t instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(e<2){const e=t.querySelector(".toast-count-badge");return void(e&&e.remove())}let o=t.querySelector(".toast-count-badge");o||(o=document.createElement("span"),o.className="toast-count-badge",o.setAttribute("aria-label",`${e} identical notifications`),Object.assign(o.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),t.appendChild(o)),o.textContent=e>99?"99+":String(e);try{o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}catch(t){console.error("updateBadge animation error:",t)}}let O={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},j={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"};const D=[];let W=!1;async function $(t={}){try{const e=await async function(t){var e;const n=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),r={allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:null!=n&&n.includes("top-full-width")||null!=n&&n.includes("bottom-full-width")?"100vw":"400px",..."object"!=typeof t||Array.isArray(t)?{}:t};r.message=(null==t?void 0:t.message)??r.message;try{var i;r.backgroundColor||(r.backgroundColor=(null===(i=O)||void 0===i?void 0:i[r.type])??(window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"))}catch(t){console.warn("Background color resolution failed:",t)}try{var a;r.message=r.message||(null===(a=j)||void 0===a?void 0:a[r.type])||"No Message Provided!"}catch(t){console.warn("Default message resolution failed:",t)}try{!r.textColor&&r.backgroundColor&&(r.textColor=o(r.backgroundColor))}catch(t){console.warn("Text color resolution failed:",t)}try{!r.progressColor&&r.backgroundColor&&(r.progressColor=r.textColor||o(r.backgroundColor))}catch(t){console.warn("Progress bar color resolution failed:",t)}return"string"!=typeof r.message&&(r.message="No Message Provided!"),r}(t);return await async function(t){try{return await h(t,b)}catch(t){return console.error("Failed to create toast container:",t),document.body}}(e),await async function(t={}){try{const e=function(t={}){const e=t&&"object"==typeof t?t:{};return`${String(e.type||"info").trim().toLowerCase()}|${function(t){let e=5381;for(let o=0;o<t.length;o++)e=(e<<5)+e+t.charCodeAt(o);return e>>>0}(String(e.message||"")).toString(16)}|${p(e.position||"bottom-right")}`}(t);if(v.has(e)){const o=v.get(e);if(!o)throw new Error(`Active toast with key ${e} not found`);return o.count++,o.timer.clear(),o.timer=S(o.toast,t),await T(o),await N(o),e}if(x.has(e)){const t=x.get(e);if(!t)throw new Error(`Pending toast with key ${e} not found`);return t.count++,e}const o={options:t,count:1,rafId:0};return x.set(e,o),o.rafId=requestAnimationFrame(async()=>{const t=x.get(e);if(t){if(x.delete(e),k>=3)return C.push({options:t.options,key:e,count:t.count}),void await I();try{await E(t.options,e,t.count)}catch(t){console.error("showToast failed:",t)}}}),e}catch(t){console.error("showToast failed:",t)}}(e)}catch(t){return console.error("CreateToast failed:",t),null}}function _(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const e=["success","error","warning","info"],o={};for(const[n,r]of Object.entries(t))e.includes(n)&&"string"==typeof r&&r.trim()&&(o[n]=r.trim());Object.keys(o).length>0&&(O={...O,...o})}}catch(t){console.error("setDefaultColors failed:",t)}}function z(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const e=["success","error","warning","info"],o={};for(const[n,r]of Object.entries(t))e.includes(n)&&"string"==typeof r&&r.trim()&&(o[n]=r.trim());Object.keys(o).length>0&&(j={...j,...o})}}catch(t){console.error("setDefaultMessages failed:",t)}}let B=!1,P=null;async function H(t={}){const e=await async function(){if(B&&P)try{await P}catch(t){console.warn("Previous close operation failed (continuing anyway):",t)}return async function(t={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){if(!W&&"undefined"!=typeof window&&"undefined"!=typeof document)if("complete"===document.readyState||"interactive"===document.readyState){W=!0;const t=[...D];D.length=0;for(const e of t)setTimeout(()=>$(e),0)}else document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{W=!0;const t=[...D];D.length=0;for(const e of t)setTimeout(()=>$(e),0)},200)},{once:!0})}(),W?await $(t):(D.push(t),null)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)}(t)}();return{dismiss:()=>e?M(e):Promise.resolve()}}const R=async()=>{B=!0,P=(async()=>{try{await A()}finally{B=!1,P=null}})(),await P},q=async()=>{B=!0,P=(async()=>{try{await async function(){try{for(const[,t]of x)null!=t&&t.rafId&&cancelAnimationFrame(t.rafId);x.clear(),C.length=0;const t=Array.from(v.values()).map(t=>t.toast).filter(Boolean);for(const e of t)try{await L(e)}catch(t){console.warn("closeAllToasts: failed to close one toast:",t)}}catch(t){console.error("closeAllToasts failed:",t)}}()}finally{B=!1,P=null}})(),await P};async function F(t,e={},o={}){const n=e&&"object"==typeof e?e:{},r=o&&"object"==typeof o?o:{},i=n.loading??"Loading...",a=await H({...r,type:"info",message:i,duration:864e5,showProgressBar:!1,pauseOnHover:!1}),s={...r,pauseOnHover:r.pauseOnHover};try{const e="function"==typeof t?t():t,o=await e;await a.dismiss();const r="function"==typeof n.success?n.success(o):n.success??"Done!";return await H({...s,type:"success",message:r}),o}catch(t){await a.dismiss();const e="function"==typeof n.error?n.error(t):n.error??"Something went wrong.";throw await H({...s,type:"error",message:e}),t}}if("undefined"!=typeof window&&"undefined"!=typeof document&&!window.__customizableToastEscapeAttached){window.__customizableToastEscapeAttached=!0;const t=t=>{"Escape"!==t.key&&"Esc"!==t.key||(async()=>{try{B=!0,P=(async()=>{try{await A()}finally{B=!1,P=null}})(),await P}catch(t){console.error("Escape key dismiss failed:",t),B=!1,P=null}})()};window.addEventListener("keydown",t,{passive:!0})}try{"undefined"!=typeof window&&(window.customizableToast={createToast:H,setDefaultColors:_,setDefaultMessages:z,noop:q,dismiss:R,toastPromise:F})}catch(t){console.error("Global assignment failed:",t)}exports.createToast=H,exports.dismiss=R,exports.noop=q,exports.resetContainerRegistry=function(){m.clear(),f.clear()},exports.resetToastManager=function(){for(const[,t]of x)null!=t&&t.rafId&&cancelAnimationFrame(t.rafId);x.clear(),C.length=0;for(const[,s]of v){var t,e,o,n,r,i,a;null===(t=s.timer)||void 0===t||t.clear(),null===(e=s.outer)||void 0===e||null===(o=e._pauseCleanup)||void 0===o||o.call(e),null===(n=s.toast)||void 0===n||null===(r=n._cleanupCloseButton)||void 0===r||r.call(n),null===(i=s.toast)||void 0===i||null===(a=i._cleanup)||void 0===a||a.call(i)}v.clear(),k=0},exports.setDefaultColors=_,exports.setDefaultMessages=z,exports.toastPromise=F;
15
+ "use strict";function t(t){try{return(null==t?void 0:t.offsetWidth)||0}catch{return 0}}const e=new class{constructor(t=200){this.maxSize=t,this.map=new Map}get(t){if(!this.map.has(t))return;const e=this.map.get(t);return this.map.delete(t),this.map.set(t,e),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxSize){const t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,e)}}(200),o={};function n(t){if(!t)return"snow";const n=String(t),r=e.get(n);if(r)return r;if(o[null==t?void 0:t.toLowerCase()]){const r=o[t.toLowerCase()];return e.set(n,r),r}let i,a,s;try{const e=function(t){const e=null==t?void 0:t.match(/^#([0-9a-f]{3,8})$/i);if(e){let t=e[1];return 3===t.length&&(t=t.split("").map(t=>t+t).join("")),{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const o=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(o)return{r:Number(o[1]),g:Number(o[2]),b:Number(o[3])};const n=null==t?void 0:t.match(/hsla?\(\s*([\d.]+)(?:deg)?\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.]+)?\)/i);if(n){const t=Number(n[1])/360,e=Number(n[2])/100,o=Number(n[3])/100;if(0===e){const t=Math.round(255*o);return{r:t,g:t,b:t}}const r=(t,e,o)=>(o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t),i=o<.5?o*(1+e):o+e-o*e,a=2*o-i;return{r:Math.round(255*r(a,i,t+1/3)),g:Math.round(255*r(a,i,t)),b:Math.round(255*r(a,i,t-1/3))}}return null}(function(t){var e;const o=null==t?void 0:t.match(/^var\((--[\w-]+)(?:\s*,\s*(.+))?\)$/i);if(!o)return t;try{if("undefined"!=typeof document&&"function"==typeof getComputedStyle){const t=getComputedStyle(document.documentElement).getPropertyValue(o[1]).trim();if(t)return t}}catch(t){}return(null===(e=o[2])||void 0===e?void 0:e.trim())||t}(t));if(!e)throw new Error("Unknown color");({r:i,g:a,b:s}=e)}catch{i=a=s=128}const l=(t,e,o)=>{const n=[t,e,o].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*n[0]+.7152*n[1]+.0722*n[2]},c=(t,e)=>{const o=l(...t),n=l(...e);return(Math.max(o,n)+.05)/(Math.min(o,n)+.05)};let[u,d,p]=((t,e,o)=>{t/=255,e/=255,o/=255;const n=Math.max(t,e,o),r=Math.min(t,e,o);let i,a,s=(n+r)/2;if(n===r)i=a=0;else{const l=n-r;switch(a=s>.5?l/(2-n-r):l/(n+r),n){case t:i=(e-o)/l+(e<o?6:0);break;case e:i=(o-t)/l+2;break;case o:i=(t-e)/l+4}i/=6}return[360*i,a,s]})(i,a,s),m=p<.5?Math.min(p+.5,1):Math.max(p-.5,0),[f,h,y]=((t,e,o)=>{let n,r,i;if(t/=360,0===e)n=r=i=o;else{const a=(t,e,o)=>(o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t),s=o<.5?o*(1+e):o+e-o*e,l=2*o-s;n=a(l,s,t+1/3),r=a(l,s,t),i=a(l,s,t-1/3)}return[Math.round(255*n),Math.round(255*r),Math.round(255*i)]})(u,d,m);if(c([i,a,s],[f,h,y])<4.5){const t=c([i,a,s],[0,0,0]),e=c([i,a,s],[255,255,255]);[f,h,y]=t>=e?[0,0,0]:[255,255,255]}const g=((t,e,o)=>`#${t.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`)(f,h,y);return e.set(n,g),g}Object.entries({aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}).forEach(([t,[e,n,r]])=>{const i=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=.2126*i(e)+.7152*i(n)+.0722*i(r),s=(a+.05)/.05,l=1.05/(a+.05);o[t.toLowerCase()]=s>=l?"#000000":"#ffffff"});const r=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),i=new Set(["href","src","alt","title","class","target","rel","loading"]),a=/<\/?(script|iframe|object|embed|link|meta|style|form|input|button|svg|math|video|audio|details|dialog|applet|frame|frameset|textarea|select|option|optgroup|fieldset|legend|datalist|output|progress|meter|keygen|canvas|map|area|base|basefont|bgsound|blink|center|dir|font|hgroup|isindex|listing|marquee|multicol|nextid|noembed|noframes|plaintext|rb|rtc|spacer|strike|tt|xmp)[^>]*>/gi,s=/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,l=/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi;function c(t,e,o){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType===Node.COMMENT_NODE)return null;if(t.nodeType!==Node.ELEMENT_NODE)return null;const n=t.tagName.toUpperCase();if(!e.has(n)){const n=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const r=c(t,e,o);r&&n.appendChild(r)}),n}const r=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(t=>{r.setAttribute(t.name,t.value)}),function(t,e){const o=[];Array.from(t.attributes||[]).forEach(n=>{const r=n.name.toLowerCase(),i=n.value;if(e.has(r))if("href"!==r&&"src"!==r||!/^\s*javascript:/i.test(i))if("src"!==r||/^\s*(https?:|data:image\/)/i.test(i)){if("target"===r&&"_blank"===i){const e=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);e.includes("noopener")||e.push("noopener"),e.includes("noreferrer")||e.push("noreferrer"),t.setAttribute("rel",e.join(" "))}}else o.push(r);else o.push(r);else o.push(r)}),o.forEach(e=>t.removeAttribute(e))}(r,o),Array.from(t.childNodes).forEach(t=>{const n=c(t,e,o);n&&r.appendChild(n)}),r}function u(t,e={}){if("string"!=typeof t||!t.trim())return"";try{if(!e.forceFallback&&function(){try{if("undefined"!=typeof window&&window.DOMPurify)return!0}catch(t){}return!1}()){const e=window.DOMPurify.sanitize(t,{ALLOWED_TAGS:Array.from(r),ALLOWED_ATTR:Array.from(i),ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i}),o=document.createElement("div");return o.innerHTML=e,o.querySelectorAll('a[target="_blank"]').forEach(t=>{const e=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);e.includes("noopener")||e.push("noopener"),e.includes("noreferrer")||e.push("noreferrer"),t.setAttribute("rel",e.join(" "))}),o.innerHTML}}catch(t){console.warn("DOMPurify sanitization failed, falling back:",t)}return function(t){if(!t||"string"!=typeof t)return"";let e=t.replace(a,"");e=e.replace(s,""),e=e.replace(l,"$1=$2#$2");const o=document.createElement("div");o.innerHTML=e;const n=document.createDocumentFragment();Array.from(o.childNodes).forEach(t=>{const e=c(t,r,i);e&&n.appendChild(e)});const u=document.createElement("div");return u.appendChild(n),u.querySelectorAll('a[target="_blank"]').forEach(t=>{const e=(t.getAttribute("rel")||"").split(/\s+/).filter(Boolean);e.includes("noopener")||e.push("noopener"),e.includes("noreferrer")||e.push("noreferrer"),t.setAttribute("rel",e.join(" "))}),u.innerHTML}(t)}function d(t={}){const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},o=Number(e.size)||14,n="string"==typeof e.color&&e.color.trim()?e.color.trim():"currentColor",r="string"==typeof e.text?e.text:"",i=document.createElement("span");i.className="toast-loader",i.style.display="inline-flex",i.style.alignItems="center",i.style.gap="8px";const a="http://www.w3.org/2000/svg",s=document.createElementNS(a,"svg");s.setAttribute("width",String(o)),s.setAttribute("height",String(o)),s.setAttribute("viewBox","0 0 50 50"),s.setAttribute("aria-hidden","true");const l=document.createElementNS(a,"circle");if(l.setAttribute("cx","25"),l.setAttribute("cy","25"),l.setAttribute("r","20"),l.setAttribute("fill","none"),l.setAttribute("stroke",n),l.setAttribute("stroke-width","4"),l.setAttribute("stroke-linecap","round"),l.style.opacity="0.85",l.style.strokeDasharray="90",l.style.strokeDashoffset="60",l.style.transformOrigin="center",l.style.animation="toast-spinner 1s linear infinite",s.appendChild(l),i.appendChild(s),r){const t=document.createElement("span");t.style.fontSize="13px",t.textContent=r,i.appendChild(t)}if("undefined"!=typeof document&&!document.getElementById("toast-spinner-styles")){const t=document.createElement("style");t.id="toast-spinner-styles",t.textContent="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }";const e=document.head||document.documentElement;e&&e.appendChild(t)}return i}function p(e,o){const n=document.createElement("div");n.className="toast-progress-bar",e._progressBar=n;const r=o.borderRadius||"0",i=parseInt(r,10),a=parseInt(o.progressHeight,10)||4,s=Number(o.duration??2500)+5,l=Math.min(i,2*a),c=i>0?`calc(100% - ${l}px)`:"100%";if(Object.assign(n.style,{position:"absolute",left:`${l}px`,height:`${a}px`,background:o.progressColor||"currentColor",width:`${c}`,transition:`width ${s}ms linear`,["top"===o.progressPosition?"top":"bottom"]:"0",borderRadius:a/2+"px",opacity:"0.8"}),e.appendChild(n),void 0!==o.progress){let t=Number(o.progress);return Number.isFinite(t)||(t=0),t<=1&&t>0&&(t*=100),t=Math.min(100,Math.max(0,t)),n.style.width=`${t}%`,void(n.style.transition="width 200ms ease")}"function"==typeof n.animate?e._progressAnimation=n.animate([{width:c},{width:"0%"}],{duration:s,easing:"linear",fill:"forwards",delay:50}):(n.style.transition=`width ${s}ms linear`,setTimeout(()=>{t(n),n.style.width="0%"},50))}let m=null,f=!0;function h(t="info"){if(!f)return;const e=function(){if("undefined"==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;if(!t)return null;if(!m)try{m=new t}catch{return null}if(m&&"suspended"===m.state)try{m.resume().catch(()=>{})}catch{}return m}();if(e)try{const o=e.currentTime,n=String(t||"info").toLowerCase().trim();if("success"===n)[523.25,659.25,783.99].forEach((t,n)=>{const r=e.createOscillator(),i=e.createGain();r.type="sine",r.frequency.setValueAtTime(t,o+.08*n),i.gain.setValueAtTime(.001,o+.08*n),i.gain.exponentialRampToValueAtTime(.12,o+.08*n+.02),i.gain.exponentialRampToValueAtTime(1e-4,o+.08*n+.35),r.connect(i),i.connect(e.destination),r.start(o+.08*n),r.stop(o+.08*n+.36)});else if("error"===n)[320,240].forEach((t,n)=>{const r=e.createOscillator(),i=e.createGain();r.type="triangle",r.frequency.setValueAtTime(t,o+.1*n),i.gain.setValueAtTime(.001,o+.1*n),i.gain.exponentialRampToValueAtTime(.15,o+.1*n+.02),i.gain.exponentialRampToValueAtTime(1e-4,o+.1*n+.22),r.connect(i),i.connect(e.destination),r.start(o+.1*n),r.stop(o+.1*n+.23)});else if("warning"===n){const t=e.createOscillator(),n=e.createGain();t.type="sine",t.frequency.setValueAtTime(440,o),t.frequency.exponentialRampToValueAtTime(493.88,o+.12),n.gain.setValueAtTime(.001,o),n.gain.exponentialRampToValueAtTime(.12,o+.02),n.gain.exponentialRampToValueAtTime(1e-4,o+.28),t.connect(n),n.connect(e.destination),t.start(o),t.stop(o+.3)}else{const t=e.createOscillator(),n=e.createGain();t.type="sine",t.frequency.setValueAtTime(600,o),t.frequency.exponentialRampToValueAtTime(950,o+.04),t.frequency.exponentialRampToValueAtTime(400,o+.09),n.gain.setValueAtTime(.001,o),n.gain.exponentialRampToValueAtTime(.1,o+.015),n.gain.exponentialRampToValueAtTime(1e-4,o+.12),t.connect(n),n.connect(e.destination),t.start(o),t.stop(o+.13)}}catch{}}function y(t){f=Boolean(t)}function g(){return f}async function b(e,o,r){const i=await async function(t){if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;if("string"==typeof t){if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*parseFloat(t);return Number.isFinite(e)&&e>0?e:500}const e=parseFloat(t);return Number.isFinite(e)&&e>0?e:500}return 500}(null==o?void 0:o.animationDuration),a=`${i}ms`,s="string"==typeof(null==o?void 0:o.animationEasing)&&o.animationEasing.trim()?o.animationEasing.trim():"ease",l="string"==typeof(null==o?void 0:o.className)&&o.className.trim()?` ${o.className.trim()}`:"";e.className=`toast toast-${(null==o?void 0:o.type)??"info"}${l}`;const c="number"==typeof(null==o?void 0:o.borderRadius)?`${o.borderRadius}px`:null==o?void 0:o.borderRadius,m="number"==typeof(null==o?void 0:o.maxWidth)?`${o.maxWidth}px`:null==o?void 0:o.maxWidth;Object.assign(e.style,{background:null==o?void 0:o.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:c,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.1)",minWidth:"250px",maxWidth:m,opacity:"0",position:"relative",cursor:"default",boxSizing:"border-box",userSelect:"text",pointerEvents:"auto",transition:`opacity ${a} ${s}, transform ${a} ${s}`,transform:"translateY(20px)",zIndex:"9999"}),e.setAttribute("role","alert"),e.setAttribute("aria-live","polite"),e.tabIndex=0,e._animationDuration=i;const f=document.createElement("span");f.className="toast-message",e._messageSpan=f,"truncate"!==(null==o?void 0:o.wrapText)&&"ellipsis"!==(null==o?void 0:o.wrapText)&&!1!==(null==o?void 0:o.wrapText)&&null!=o&&o.wrapText?Object.assign(f.style,{display:"block",whiteSpace:"normal"}):Object.assign(f.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis"});const y="number"==typeof(null==o?void 0:o.fontSize)?`${o.fontSize}px`:null==o?void 0:o.fontSize;Object.assign(f.style,{flex:"1",padding:null==o?void 0:o.fontPadding,fontFamily:null==o?void 0:o.fontFamily,fontSize:y,fontWeight:null==o?void 0:o.fontWeight,lineHeight:null==o?void 0:o.fontLineHeight,color:null==o?void 0:o.textColor,userSelect:"text",wordBreak:"break-word",overflow:"hidden",textOverflow:"ellipsis",direction:null!=o&&o.fontDirection&&"auto"!==o.fontDirection?o.fontDirection:void 0});const g=!!o.allowHtml,b=o.message??"";if(o.loader||o.showLoader){const t=d(o.loader||{});f.appendChild(t);const e=document.createElement("span");e.style.display="inline-block",e.style.width="8px",f.appendChild(e)}if(g&&"string"==typeof b&&b.trim().length>0)try{const t=u(b),e=document.createElement("div");for(e.innerHTML=t;e.firstChild;)f.appendChild(e.firstChild)}catch(t){console.warn("HTML message sanitization failed, falling back to text:",t),f.appendChild(document.createTextNode(String(b)))}else f.appendChild(document.createTextNode(String(b)));f.setAttribute("title","string"==typeof b?b.replace(/<[^>]+>/g,""):String(b)),e.appendChild(f),null!=o&&o.cta&&0!==Object.keys(o.cta).length&&function(t,e,o){const r=null==e?void 0:e.cta;if(!r||"object"!=typeof r||Array.isArray(r))return;const i={...r};i.label||(i.label="CTA Label Missing!");const a="link"===i.variant||!i.variant&&!!i.href,s=document.createElement(a?"a":"button");a?(s.href=i.href,i.target&&(s.target=i.target),s.rel=i.rel||("_blank"===i.target?"noopener noreferrer":"")):s.type="button",s.setAttribute("aria-label",i.ariaLabel||i.label);const l=e.textColor||n(e.backgroundColor),c=e.backgroundColor&&(d=e.backgroundColor)&&"#000000"===n(d)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)",u="string"==typeof l&&/^#[0-9a-fA-F]{6}$/.test(l.trim())?`${l.trim()}44`:"rgba(128, 128, 128, 0.3)";var d;Object.assign(s.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:`1px solid ${u}`,color:l,background:c,cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),s.textContent=i.label;const p=async e=>{try{if("function"==typeof i.onClick){const t=i.onClick(e);null!=t&&t.then&&await t}}catch(t){console.error("CTA onClick handler error:",t)}finally{!1!==i.autoClose&&"function"==typeof o&&o(t)}};s.addEventListener("click",p),s._cleanup=()=>s.removeEventListener("click",p),t._cleanupCTA=()=>s.removeEventListener("click",p),t.appendChild(s)}(e,o,r),null!=o&&o.showCloseButton&&function(t,e,o){const r=document.createElement("button");r.setAttribute("aria-label","Close notification"),r.setAttribute("title","Close"),r.textContent="×";const i=e.textColor||n(e.backgroundColor);Object.assign(r.style,{background:"none",border:"none",color:i,fontSize:"18px",marginLeft:"10px",cursor:"pointer",lineHeight:"1",padding:"0 4px"});const a=()=>{"function"==typeof o&&o(t)};r.addEventListener("click",a),t._cleanupCloseButton=()=>{r.removeEventListener("click",a)},t.appendChild(r)}(e,o,r),null!=o&&o.showProgressBar&&p(e,o),!1!==(null==o?void 0:o.swipeToDismiss)&&function(t,e){if(!t||"function"!=typeof t.addEventListener)return;let o=0,n=0,r=0,i=!1,a=!1;const s=e=>{e&&e.touches&&1===e.touches.length&&(o=e.touches[0].clientX,n=e.touches[0].clientY,r=o,i=!0,a=!1,t.style.transition="none")},l=e=>{if(!i||!e||!e.touches||1!==e.touches.length)return;const s=e.touches[0].clientX,l=e.touches[0].clientY,c=s-o,u=l-n;if(!a)if(Math.abs(c)>8&&Math.abs(c)>Math.abs(u))a=!0;else if(Math.abs(u)>8)return void(i=!1);if(a){r=s;const o=Math.max(0,1-Math.abs(c)/280);t.style.transform=`translateX(${c}px)`,t.style.opacity=String(o),e.cancelable&&e.preventDefault()}},c=()=>{if(!i||!a)return void(i=!1);i=!1;const n=r-o;if(Math.abs(n)>=75){const o=n>0?320:-320;t.style.transition="transform 180ms ease-out, opacity 180ms ease-out",t.style.transform=`translateX(${o}px)`,t.style.opacity="0",setTimeout(()=>{"function"==typeof e&&e(t)},180)}else t.style.transition="transform 200ms ease, opacity 200ms ease",t.style.transform="translateX(0)",t.style.opacity="1"};t.addEventListener("touchstart",s,{passive:!0}),t.addEventListener("touchmove",l,{passive:!1}),t.addEventListener("touchend",c,{passive:!0}),t.addEventListener("touchcancel",c,{passive:!0}),t._cleanupSwipe=()=>{t.removeEventListener("touchstart",s),t.removeEventListener("touchmove",l),t.removeEventListener("touchend",c),t.removeEventListener("touchcancel",c)}}(e,r),null!=o&&o.sound&&h("string"==typeof o.sound?o.sound:(null==o?void 0:o.type)||"info"),function(e){t(e),setTimeout(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="translateY(0)"})},50)}(e)}async function v(t,e){try{const o=document.createElement("div"),n=((null==t?void 0:t.position)||"bottom-right").toLowerCase().trim();let r="auto",i="auto",a="auto",s="auto",l="none";n.startsWith("top")?r="20px":(n.startsWith("bottom")||n.includes("below"))&&(i="20px"),n.startsWith("left")?a="20px":n.startsWith("right")?s="20px":"center"===n?(a="50%",r="50%",l="translate(-50%, -50%)"):n.includes("center")?n.includes("left")?(a="20px",r="50%",l="translateY(-50%)"):n.includes("right")?(s="20px",r="50%",l="translateY(-50%)"):n.includes("top")?(r="20px",a="50%",l="translateX(-50%)"):n.includes("bottom")&&(i="20px",a="50%",l="translateX(-50%)"):(s="20px",i="20px"),Object.assign(o.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:r,bottom:i,left:a,right:s,transform:l,zIndex:"99999",borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)"});const c=document.createElement("div"),d=document.createElement("span");d.style.display="inline-block",t.allowHtml?d.innerHTML=u(String(t.message||"Emergency Toast Showing!")):d.textContent=String(t.message||"Emergency Toast Creation Showing!"),c.appendChild(d);const p=document.createElement("span");for(p.style.cssText="float: right; margin-left: 10px; font-weight: bold; cursor: pointer;",p.textContent="×",c.appendChild(p);o.firstChild;)o.removeChild(o.firstChild);o.appendChild(c),p.addEventListener("click",()=>{o.remove(),"function"==typeof e&&e(o)});const m=Number(null==t?void 0:t.duration)||2500,f=setTimeout(()=>{o.remove(),"function"==typeof e&&e(o)},m);return"function"==typeof(null==f?void 0:f.unref)&&f.unref(),o}catch(t){return console.error("Emergency toast creation failed:",t),"function"==typeof e&&e(null),null}}const w=new Map,x=new Map;function C(t){if(!t||"string"!=typeof t)return"bottom-right";const e=t.toLowerCase().trim();return e?e.replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-"):"bottom-right"}async function k(t,e){const o=`toast-container-${C((null==t?void 0:t.position)||"bottom-right")}`;if(x.has(o))return x.get(o);const n=(async()=>{const n=w.get(o),r="undefined"==typeof document||(null==n?void 0:n.ownerDocument)===document;if(null!=n&&n.isConnected&&r)return n;n&&w.delete(o);let i=document.getElementById(o);i&&!i.isConnected&&document.body.appendChild(i),i?(i.style.position=i.style.position||"fixed",i.style.zIndex=i.style.zIndex||"9999","function"==typeof e&&await e(i,t)):(i=document.createElement("div"),i.id=o,i.setAttribute("role","status"),i.setAttribute("aria-atomic","true"),i.style.position="fixed",i.style.zIndex="9999",i.style.pointerEvents="none",i.style.inset="auto 10px 10px auto",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center",i.style.flexDirection="column",i.style.overflow="hidden","function"==typeof e&&await e(i,t),document.body.appendChild(i));const a=document.querySelectorAll(`#${o}`);if(a.length>1)for(let t=1;t<a.length;t++)try{a[t].remove()}catch{}return w.set(o,i),i})();x.set(o,n);try{return await n}finally{x.delete(o)}}const E=new Set(["top-left","top-right","bottom-left","bottom-right","top-center","bottom-center","left-center","right-center","top-full-width","bottom-full-width","center"]),T=new Set(["top","bottom"]);async function A(t,e){if(!t||null==e||!e.position)throw new Error("Invalid container or position!");const o=String(e.position).toLowerCase().trim();let n=o;var r;r=o,E.has(r)||T.has(o)||(console.warn(`Unknown position "${e.position}", defaulting to "bottom-right"`),n="bottom-right"),function(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}(t);const i=function(t){const e=t.toLowerCase().trim();return{hasTop:e.startsWith("top"),hasBottom:e.startsWith("bottom")||e.startsWith("below"),hasLeft:e.startsWith("left"),hasRight:e.startsWith("right"),hasCenter:"center"===e||e.includes("center")&&!e.includes("left")&&!e.includes("right")&&!e.includes("top")&&!e.includes("bottom"),hasFullWidth:"top-full-width"===e||"bottom-full-width"===e}}(n);(function(t,e,o){if(!o.hasFullWidth)return!1;t.style.maxWidth="100vw";try{e&&!e.maxWidth&&(e.maxWidth="100vw")}catch{}return o.hasTop?(t.style.top="10px",t.style.left="10px",t.style.right="10px",!0):!!o.hasBottom&&(t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0)})(t,e,i)||function(t,e){return!!e.hasCenter&&(!e.hasTop||e.hasLeft||e.hasRight?!e.hasBottom||e.hasLeft||e.hasRight?!e.hasLeft||e.hasTop||e.hasBottom?!e.hasRight||e.hasTop||e.hasBottom?!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom)&&(t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0):(t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0):(t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0):(t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0))}(t,i)||function(t,e){e.hasBottom?t.style.bottom="10px":e.hasTop?t.style.top="10px":t.style.bottom="10px",e.hasRight?t.style.right="10px":e.hasLeft?t.style.left="10px":(t.style.left="50%",t.style.transform="translateX(-50%)")}(t,i)}class S{constructor(t,e){this.callback="function"==typeof t?t:()=>{};const o=Number.isFinite(e)&&e>=0?e:0;this.delay=o,this.remaining=o,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){var t;return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null;try{this.callback()}catch(t){console.error("PausableTimer callback error:",t)}},this.remaining),"function"==typeof(null===(t=this.timeoutId)||void 0===t?void 0:t.unref)&&this.timeoutId.unref()),this}pause(){return this.isPaused||!this.timeoutId||this.isCompleted||(clearTimeout(this.timeoutId),this.timeoutId=null,this.remaining-=Date.now()-this.startTime,this.remaining=Math.max(0,this.remaining),this.isPaused=!0),this}resume(){return!this.isPaused||this.isCompleted||(this.isPaused=!1,this.start()),this}clear(){return this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.isCompleted=!0,this}getRemainingTime(){return this.isCompleted?0:this.isPaused?this.remaining:this.timeoutId?Math.max(0,this.remaining-(Date.now()-this.startTime)):this.delay}}const L=new Map,M=new Map,I=[];let N=0;function _(t){if(!t||!t.children)return;if("true"!==t.getAttribute("data-stacked"))return;t._stackedInitialized||"function"!=typeof t.addEventListener||(t._stackedInitialized=!0,t.addEventListener("mouseenter",()=>{t._isExpanded=!0,_(t)}),t.addEventListener("mouseleave",()=>{t._isExpanded=!1,_(t)}),t.addEventListener("focusin",()=>{t._isExpanded=!0,_(t)}),t.addEventListener("focusout",e=>{t.contains(e.relatedTarget)||(t._isExpanded=!1,_(t))}));const e=Array.from(t.children),o=e.length,n=Boolean(t._isExpanded),r=Boolean(t.id&&t.id.includes("top"));e.forEach((t,e)=>{const i=o-1-e;if(t.style.transition="transform 240ms cubic-bezier(0.16, 1, 0.3, 1), margin 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease",n)t.style.transform="none",t.style.marginTop="0px",t.style.marginBottom="10px",t.style.opacity="1",t.style.zIndex=String(100+e),t.style.pointerEvents="auto";else if(0===i)t.style.transform="scale(1)",t.style.marginTop="0px",t.style.marginBottom="0px",t.style.opacity="1",t.style.zIndex="30",t.style.pointerEvents="auto";else if(1===i){const e=r?10:-10;t.style.transform=`scale(0.95) translateY(${e}px)`,t.style.marginTop="-55px",t.style.marginBottom="0px",t.style.opacity="0.9",t.style.zIndex="20",t.style.pointerEvents="auto"}else if(2===i){const e=r?20:-20;t.style.transform=`scale(0.90) translateY(${e}px)`,t.style.marginTop="-55px",t.style.marginBottom="0px",t.style.opacity="0.75",t.style.zIndex="10",t.style.pointerEvents="auto"}else{const e=r?30:-30;t.style.transform=`scale(0.85) translateY(${e}px)`,t.style.marginTop="-55px",t.style.marginBottom="0px",t.style.opacity="0",t.style.zIndex="1",t.style.pointerEvents="none"}})}async function B(t,e,o){try{if(!t||"object"!=typeof t)throw new TypeError("options must be an object");N++;const n=await k(t,A);if(!n)throw new Error("Failed to create toast container");const r=await async function(t,e){let o;try{return o=await async function(t,e){const o=document.createElement(t);return o.id=function(t="toast"){return`${"string"==typeof t&&t.trim()?t.trim():"toast"}-${Date.now().toString(36)}-${Math.floor(1048575*Math.random()).toString(36)}`}(e),o}("div","toast"),await b(o,t,e),o}catch(n){return console.warn("toast creation failed with error showing fallback one: ",n),o=await v(t,e),o}}(t,j);if(!r)throw new Error("Toast element creation failed");const i=document.createElement("div");Object.assign(i.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%",pointerEvents:"auto"});const a=document.createElement("div");Object.assign(a.style,{position:"relative",overflow:"hidden",zIndex:"1"}),a.appendChild(r),i.appendChild(a),n.id.includes("toast-container-")&&(n.appendChild(i),t.stacked&&n.setAttribute("data-stacked","true"),"true"===n.getAttribute("data-stacked")&&_(n));const s=!1!==t.pauseOnHover&&(!0===t.pauseOnHover||!!t.cta),l={outer:i,toast:r,options:t,count:Math.max(1,Math.floor(o??0)),pauseOnHover:s};L.set(e,l),r._key=e,l.count>1&&await q(l),l.timer=$(r,t),await z(l)}catch(e){console.error("Something went wrong: ",e),N=Math.max(0,N-1),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await v(t,j))}}const O=async function(){try{if(0===L.size){if(M.size>0){const[t,e]=Array.from(M.entries()).at(-1);return null!=e&&e.rafId&&cancelAnimationFrame(e.rafId),void M.delete(t)}return I.length>0?void I.pop():void 0}let t=null;const e=Array.from(L.values());if(e.length>0){const o=e.at(-1);t=o.toast||o.outer&&o.outer.querySelector('[id^="toast-"]')}if(t||document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const o=Array.from(e.children||[]);if(0===o.length)return;const n=o.at(-1);n&&(t=n.querySelector('[id^="toast-"]')||n)}),!t)return;const o=t._key?t:t.querySelector('[id^="toast-"]')||t;await j(o)}catch(t){console.error("dismissMostRecent failed:",t)}};function $(t,e){const o=Number(null==e?void 0:e.duration),n=Number.isFinite(o)&&o>0?o:2500,r=new S(async()=>await j(t),n+5);return r.start(),r}async function z(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const{outer:e,timer:o,toast:n}=t,r=()=>{var t;o.pause(),null==n||null===(t=n._progressAnimation)||void 0===t||t.pause()},i=()=>{var t;o.resume(),null==n||null===(t=n._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(o.pause(),null==n||null===(e=n._progressAnimation)||void 0===e||e.pause())},s=t=>{var r;e.contains(t.relatedTarget)||(o.resume(),null==n||null===(r=n._progressAnimation)||void 0===r||r.play())};e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",i),e.addEventListener("focusin",a),e.addEventListener("focusout",s),e._pauseCleanup=()=>{e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",i),e.removeEventListener("focusin",a),e.removeEventListener("focusout",s)}}async function j(t){if(null!=t&&t._key)return D(t._key)}async function D(t){try{var e,o,n,r,i,a,s,l,c,u,d,p,m,f,h,y;if(!t)return;const g=M.get(t);if(g)return cancelAnimationFrame(g.rafId),void M.delete(t);const b=I.findIndex(e=>e.key===t);if(-1!==b)return void I.splice(b,1);const v=L.get(t);if(!v)return;null===(e=v.timer)||void 0===e||e.clear(),null===(o=v.outer)||void 0===o||null===(n=o._pauseCleanup)||void 0===n||n.call(o),null===(r=v.toast)||void 0===r||null===(i=r._cleanupCloseButton)||void 0===i||i.call(r),null===(a=v.toast)||void 0===a||null===(s=a._cleanupCTA)||void 0===s||s.call(a),null===(l=v.toast)||void 0===l||null===(c=l._cleanupSwipe)||void 0===c||c.call(l),null===(u=v.toast)||void 0===u||null===(d=u._cleanup)||void 0===d||d.call(u);const w=null===(p=v.toast)||void 0===p?void 0:p.querySelector("button, a");null==w||null===(m=w._cleanup)||void 0===m||m.call(w),L.delete(t),N=Math.max(0,N-1);const x=v.outer.querySelector(".toast-count-badge");x&&x.remove();const C=(null===(f=v.toast)||void 0===f?void 0:f._animationDuration)??400;v.toast&&(v.toast.style.opacity="0",v.toast.style.transform="translateY(20px)");const k=null===(h=v.outer)||void 0===h?void 0:h.parentElement;if(await async function(t,e,o=400){return t?new Promise(n=>{let r=!1;const i=()=>{r||(r=!0,async function(t){if(!t)return!0;try{if("function"==typeof t.remove)return t.remove(),!0}catch{}try{if(t.parentNode)return t.parentNode.removeChild(t),!0}catch{}}(t),n())},a=e||t.firstElementChild||t;if(!a)return n();const s=t=>{try{if(t.target!==a)return;a.removeEventListener("transitionend",s,!0),i()}catch(t){console.error("removeWithTransition error:",t)}};try{a.addEventListener("transitionend",s,!0)}catch(t){console.error("removeWithTransition error:",t)}setTimeout(()=>{try{a.removeEventListener("transitionend",s,!0),i()}catch(t){console.error("removeWithTransition error:",t)}},o+100)}):Promise.resolve()}(v.outer,v.toast,C),k&&0===k.children.length&&null!==(y=k.id)&&void 0!==y&&y.startsWith("toast-container-"))try{k.remove()}catch{}else k&&"true"===k.getAttribute("data-stacked")&&_(k);await W()}catch(t){console.error("Closing Toast failed!: ",t)}}async function W(){for(;N<3&&I.length;){const t=I.shift();if(L.has(t.key)){const e=L.get(t.key);e.count+=t.count,await q(e);continue}B(t.options,t.key,t.count)}}async function q({outer:t,count:e}){if(!(t&&t instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(e<2){const e=t.querySelector(".toast-count-badge");return void(e&&e.remove())}let o=t.querySelector(".toast-count-badge");o||(o=document.createElement("span"),o.className="toast-count-badge",o.setAttribute("aria-label",`${e} identical notifications`),Object.assign(o.style,{position:"absolute",top:"6px",right:"6px",backgroundColor:"#f44336",color:"#fff",borderRadius:"50%",minWidth:"20px",height:"20px",fontSize:"12px",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid #fff",boxShadow:"0 2px 6px rgba(0,0,0,0.3)",zIndex:"2",pointerEvents:"none",transition:"transform 150ms ease"}),t.appendChild(o)),o.textContent=e>99?"99+":String(e);try{o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}catch(t){console.error("updateBadge animation error:",t)}}async function P(t,e={}){if(!t||"object"!=typeof e||null===e)return;if(M.has(t)){const o=M.get(t);return void(o.options={...o.options,...e})}const o=I.find(e=>e.key===t);if(o)return void(o.options={...o.options,...e});const r=L.get(t);if(!r||!r.toast)return;r.options={...r.options,...e};const i=r.toast,a=i._messageSpan||i.querySelector(".toast-message")||i.querySelector("span:not(.toast-count-badge)");if(void 0!==e.message){const t=String(e.message??""),o=void 0!==e.allowHtml?Boolean(e.allowHtml):Boolean(r.options.allowHtml);if(a){const n=a.querySelector(".toast-loader");if(a.innerHTML="",n&&!1!==e.showLoader&&null!==e.loader){a.appendChild(n);const t=document.createElement("span");t.style.display="inline-block",t.style.width="8px",a.appendChild(t)}if(o&&t.trim().length>0)try{const e=u(t),o=document.createElement("div");for(o.innerHTML=e;o.firstChild;)a.appendChild(o.firstChild)}catch{a.appendChild(document.createTextNode(t))}else a.appendChild(document.createTextNode(t));a.setAttribute("title",t.replace(/<[^>]+>/g,""))}}if(!1===e.showLoader||null===e.loader){const t=null==a?void 0:a.querySelector(".toast-loader");t&&(t.nextSibling&&"SPAN"===t.nextSibling.nodeName&&t.nextSibling.remove(),t.remove())}else if((!0===e.showLoader||e.loader&&"object"==typeof e.loader)&&a&&!a.querySelector(".toast-loader")){const t=d(e.loader||{});a.insertBefore(t,a.firstChild);const o=document.createElement("span");o.style.display="inline-block",o.style.width="8px",a.insertBefore(o,t.nextSibling)}if(e.type){const t=String(e.type).toLowerCase().trim();if(i.className=i.className.replace(/\btoast-(info|success|error|warning)\b/g,`toast-${t}`),!e.backgroundColor){const e={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"};e[t]&&(i.style.background=e[t])}}if(e.backgroundColor&&(i.style.background=e.backgroundColor),e.textColor)i.style.color=e.textColor,a&&(a.style.color=e.textColor);else if(e.type||e.backgroundColor){const t=i.style.background;if(t){const e=n(t);i.style.color=e,a&&(a.style.color=e)}}if(void 0!==e.progress){let t=Number(e.progress);Number.isFinite(t)||(t=0),t<=1&&t>0&&(t*=100),t=Math.min(100,Math.max(0,t));let o=i.querySelector(".toast-progress-bar");if(o||!e.showProgressBar&&!r.options.showProgressBar||(p(i,{...r.options,...e}),o=i.querySelector(".toast-progress-bar")),o){if(i._progressAnimation){try{i._progressAnimation.cancel()}catch{}i._progressAnimation=null}o.style.transition="width 200ms ease",o.style.width=`${t}%`}}else if(!1===e.showProgressBar){const t=i.querySelector(".toast-progress-bar");t&&t.remove()}if(void 0!==e.duration){var s;null===(s=r.timer)||void 0===s||s.clear();const t=Number(e.duration);Number.isFinite(t)&&t>0&&(r.timer=$(i,{duration:t}))}e.sound&&h("string"==typeof e.sound?e.sound:e.type||r.options.type||"info");const l=i.closest('[id^="toast-container-"]');l&&"true"===l.getAttribute("data-stacked")&&_(l)}let R={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},H={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"},F=!1,V=null;async function X(t={}){try{const e=await async function(t){var e;const o=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),r={allowHtml:!1,sanitizeHtml:!0,pauseOnHover:void 0,duration:2500,position:"bottom-right",type:"info",borderRadius:"50px",backgroundColor:void 0,textColor:void 0,showCloseButton:!0,animationDuration:"0.4s",animationEasing:"ease",showProgressBar:!0,progressColor:void 0,progressHeight:"4px",progressPosition:"bottom",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"14px",fontWeight:"400",fontLineHeight:"1.4",fontDirection:"auto",wrapText:"normal",maxWidth:null!=o&&o.includes("top-full-width")||null!=o&&o.includes("bottom-full-width")?"100vw":"400px",..."object"!=typeof t||Array.isArray(t)?{}:t};r.message=(null==t?void 0:t.message)??r.message;try{var i;r.backgroundColor||(r.backgroundColor=(null===(i=R)||void 0===i?void 0:i[r.type])??(window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"))}catch(t){console.warn("Background color resolution failed:",t)}try{var a;r.message=r.message||(null===(a=H)||void 0===a?void 0:a[r.type])||"No Message Provided!"}catch(t){console.warn("Default message resolution failed:",t)}try{!r.textColor&&r.backgroundColor&&(r.textColor=n(r.backgroundColor))}catch(t){console.warn("Text color resolution failed:",t)}try{!r.progressColor&&r.backgroundColor&&(r.progressColor=r.textColor||n(r.backgroundColor))}catch(t){console.warn("Progress bar color resolution failed:",t)}return"string"!=typeof r.message&&(r.message="No Message Provided!"),r}(t);return await async function(t){try{return await k(t,A)}catch(t){return console.error("Failed to create toast container:",t),document.body}}(e),await async function(t={}){try{const e=function(t={}){const e=t&&"object"==typeof t?t:{};return`${String(e.type||"info").trim().toLowerCase()}|${function(t){let e=5381;for(let o=0;o<t.length;o++)e=(e<<5)+e+t.charCodeAt(o);return e>>>0}(String(e.message||"")).toString(16)}|${C(e.position||"bottom-right")}`}(t);if(L.has(e)){const o=L.get(e);if(!o)throw new Error(`Active toast with key ${e} not found`);return o.count++,o.timer.clear(),o.timer=$(o.toast,t),await z(o),await q(o),e}if(M.has(e)){const t=M.get(e);if(!t)throw new Error(`Pending toast with key ${e} not found`);return t.count++,e}const o={options:t,count:1,rafId:0};return M.set(e,o),o.rafId=requestAnimationFrame(async()=>{const t=M.get(e);if(t){if(M.delete(e),N>=3)return I.push({options:t.options,key:e,count:t.count}),void await W();try{await B(t.options,e,t.count)}catch(t){console.error("showToast failed:",t)}}}),e}catch(t){console.error("showToast failed:",t)}}(e)}catch(t){return console.error("CreateToast failed:",t),null}}function Y(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const e=["success","error","warning","info"],o={};for(const[n,r]of Object.entries(t))e.includes(n)&&"string"==typeof r&&r.trim()&&(o[n]=r.trim());Object.keys(o).length>0&&(R={...R,...o})}}catch(t){console.error("setDefaultColors failed:",t)}}function G(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const e=["success","error","warning","info"],o={};for(const[n,r]of Object.entries(t))e.includes(n)&&"string"==typeof r&&r.trim()&&(o[n]=r.trim());Object.keys(o).length>0&&(H={...H,...o})}}catch(t){console.error("setDefaultMessages failed:",t)}}let U=!1,K=null;async function J(t={}){const e=await async function(){if(U&&K)try{await K}catch(t){console.warn("Previous close operation failed (continuing anyway):",t)}return async function(t={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){F||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?(V||(V=new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>{F=!0,t()},{once:!0})})),await V):F=!0)}(),await X(t)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)}(t)}();return{dismiss:()=>e?D(e):Promise.resolve(),update:t=>e?P(e,t):Promise.resolve()}}const Q=async()=>{U=!0,K=(async()=>{try{await O()}finally{U=!1,K=null}})(),await K},Z=async()=>{U=!0,K=(async()=>{try{await async function(){try{for(const[,t]of M)null!=t&&t.rafId&&cancelAnimationFrame(t.rafId);M.clear(),I.length=0;const t=Array.from(L.values()).map(t=>t.toast).filter(Boolean);await Promise.allSettled(t.map(async t=>{try{await j(t)}catch(t){console.warn("closeAllToasts: failed to close one toast:",t)}}))}catch(t){console.error("closeAllToasts failed:",t)}}()}finally{U=!1,K=null}})(),await K};async function tt(t,e={},o={}){const n=e&&"object"==typeof e?e:{},r=o&&"object"==typeof o?o:{},i=n.loading??"Loading...",a=await J({...r,type:"info",message:i,duration:864e5,showProgressBar:!1,pauseOnHover:!1}),s={...r,pauseOnHover:r.pauseOnHover};try{const e="function"==typeof t?t():t,o=await e;await a.dismiss();const r="function"==typeof n.success?n.success(o):n.success??"Done!";return await J({...s,type:"success",message:r}),o}catch(t){await a.dismiss();const e="function"==typeof n.error?n.error(t):n.error??"Something went wrong.";throw await J({...s,type:"error",message:e}),t}}const et="3.13.0";if("undefined"!=typeof window&&"undefined"!=typeof document&&!window.__customizableToastEscapeAttached){window.__customizableToastEscapeAttached=!0;const t=t=>{"Escape"!==t.key&&"Esc"!==t.key||(async()=>{try{U=!0,K=(async()=>{try{await O()}finally{U=!1,K=null}})(),await K}catch(t){console.error("Escape key dismiss failed:",t),U=!1,K=null}})()};window.addEventListener("keydown",t,{passive:!0})}try{"undefined"!=typeof window&&(window.customizableToast={version:et,createToast:J,setDefaultColors:Y,setDefaultMessages:G,noop:Z,dismiss:Q,toastPromise:tt,updateToastByKey:P,setAudioEnabled:y,isAudioEnabled:g,playTone:h})}catch(t){console.error("Global assignment failed:",t)}exports.createToast=J,exports.dismiss=Q,exports.isAudioEnabled=g,exports.noop=Z,exports.playTone=h,exports.resetContainerRegistry=function(){w.clear(),x.clear()},exports.resetToastManager=function(){for(const[,t]of M)null!=t&&t.rafId&&cancelAnimationFrame(t.rafId);M.clear(),I.length=0;for(const[,d]of L){var t,e,o,n,r,i,a,s,l,c,u;null===(t=d.timer)||void 0===t||t.clear(),null===(e=d.outer)||void 0===e||null===(o=e._pauseCleanup)||void 0===o||o.call(e),null===(n=d.toast)||void 0===n||null===(r=n._cleanupCloseButton)||void 0===r||r.call(n),null===(i=d.toast)||void 0===i||null===(a=i._cleanupCTA)||void 0===a||a.call(i),null===(s=d.toast)||void 0===s||null===(l=s._cleanupSwipe)||void 0===l||l.call(s),null===(c=d.toast)||void 0===c||null===(u=c._cleanup)||void 0===u||u.call(c)}L.clear(),N=0},exports.setAudioEnabled=y,exports.setDefaultColors=Y,exports.setDefaultMessages=G,exports.toastPromise=tt,exports.updateToastByKey=P,exports.version=et;
16
16
  //# sourceMappingURL=index.cjs.map