customizable-toast-notification 3.12.3 → 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 +39 -0
- package/README.md +119 -35
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +84 -155
- package/dist/index.esm.mjs +3 -3
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +3 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,199 +1,128 @@
|
|
|
1
|
-
|
|
1
|
+
declare function resetToastManager(): void;
|
|
2
|
+
/**
|
|
3
|
+
* Updates an active, pending, or queued toast in-place with new options.
|
|
4
|
+
* @param {string} key
|
|
5
|
+
* @param {Partial<import('../index.js').ToastOptions>} [newOptions]
|
|
6
|
+
*/
|
|
7
|
+
declare function updateToastByKey(key: string, newOptions?: Partial<ToastOptions>): Promise<void>;
|
|
8
|
+
|
|
9
|
+
declare function resetContainerRegistry(): void;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Synthesizes a pleasant audio chime or tone using pure Web Audio API oscillators.
|
|
13
|
+
* Zero external audio assets or network requests.
|
|
14
|
+
* @param {'success' | 'error' | 'warning' | 'info' | 'pop' | string} toneType
|
|
15
|
+
*/
|
|
16
|
+
declare function playTone(toneType?: "success" | "error" | "warning" | "info" | "pop" | string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Globally enable or disable synthesized notification sounds.
|
|
19
|
+
* @param {boolean} enabled
|
|
20
|
+
*/
|
|
21
|
+
declare function setAudioEnabled(enabled: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* Returns current global audio feedback status.
|
|
24
|
+
* @returns {boolean}
|
|
25
|
+
*/
|
|
26
|
+
declare function isAudioEnabled(): boolean;
|
|
27
|
+
|
|
28
|
+
type ToastType = "info" | "success" | "error" | "warning";
|
|
29
|
+
type ToastPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center" | "left-center" | "right-center" | "top-full-width" | "bottom-full-width" | "center";
|
|
30
|
+
type CTAOptions = {
|
|
31
|
+
label?: string;
|
|
32
|
+
href?: string;
|
|
33
|
+
variant?: "button" | "link";
|
|
34
|
+
target?: string;
|
|
35
|
+
rel?: string;
|
|
36
|
+
ariaLabel?: string;
|
|
37
|
+
autoClose?: boolean;
|
|
38
|
+
onClick?: (e: MouseEvent) => void | Promise<void>;
|
|
39
|
+
};
|
|
40
|
+
type ToastLoaderOptions = {
|
|
2
41
|
/**
|
|
3
|
-
* -
|
|
42
|
+
* - Spinner size in pixels (default 14)
|
|
4
43
|
*/
|
|
5
|
-
|
|
44
|
+
size?: number;
|
|
6
45
|
/**
|
|
7
|
-
* -
|
|
46
|
+
* - Spinner SVG stroke color (default 'currentColor')
|
|
8
47
|
*/
|
|
9
|
-
|
|
48
|
+
color?: string;
|
|
10
49
|
/**
|
|
11
|
-
* -
|
|
50
|
+
* - Optional text label alongside spinner
|
|
12
51
|
*/
|
|
52
|
+
text?: string;
|
|
53
|
+
};
|
|
54
|
+
type ToastOptions = {
|
|
55
|
+
message?: string;
|
|
56
|
+
type?: ToastType;
|
|
13
57
|
duration?: number;
|
|
14
|
-
|
|
15
|
-
* - Toast position on screen
|
|
16
|
-
*/
|
|
17
|
-
position?: string;
|
|
18
|
-
/**
|
|
19
|
-
* - Toast corner radius
|
|
20
|
-
*/
|
|
58
|
+
position?: ToastPosition | string;
|
|
21
59
|
borderRadius?: string;
|
|
22
|
-
/**
|
|
23
|
-
* - Custom background color (per-type default if unset)
|
|
24
|
-
*/
|
|
25
60
|
backgroundColor?: string;
|
|
26
|
-
/**
|
|
27
|
-
* - Custom text color (auto-computed for WCAG contrast if unset)
|
|
28
|
-
*/
|
|
29
61
|
textColor?: string;
|
|
30
|
-
/**
|
|
31
|
-
* - Show close (×) button
|
|
32
|
-
*/
|
|
33
62
|
showCloseButton?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* - Show countdown progress bar
|
|
36
|
-
*/
|
|
37
63
|
showProgressBar?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* - CSS animation duration
|
|
40
|
-
*/
|
|
41
64
|
animationDuration?: string;
|
|
42
|
-
/**
|
|
43
|
-
* - CSS animation easing function
|
|
44
|
-
*/
|
|
45
65
|
animationEasing?: string;
|
|
46
|
-
/**
|
|
47
|
-
* - Progress bar color (falls back to textColor)
|
|
48
|
-
*/
|
|
49
66
|
progressColor?: string;
|
|
50
|
-
/**
|
|
51
|
-
* - Progress bar height
|
|
52
|
-
*/
|
|
53
67
|
progressHeight?: string;
|
|
54
|
-
/**
|
|
55
|
-
* - Progress bar position
|
|
56
|
-
*/
|
|
57
68
|
progressPosition?: "top" | "bottom";
|
|
58
|
-
|
|
59
|
-
* - Pause timer on hover (auto: true for CTA toasts)
|
|
60
|
-
*/
|
|
61
|
-
pauseOnHover?: boolean | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* - Render message as sanitized HTML
|
|
64
|
-
*/
|
|
69
|
+
pauseOnHover?: boolean;
|
|
65
70
|
allowHtml?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* - Sanitize HTML when allowHtml=true
|
|
68
|
-
*/
|
|
69
71
|
sanitizeHtml?: boolean;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
wrapText?: string;
|
|
74
|
-
/**
|
|
75
|
-
* - Max width (auto: 400px / 100vw for full-width positions)
|
|
76
|
-
*/
|
|
72
|
+
showLoader?: boolean;
|
|
73
|
+
loader?: ToastLoaderOptions;
|
|
74
|
+
wrapText?: "normal" | "truncate" | string | boolean;
|
|
77
75
|
maxWidth?: string;
|
|
78
|
-
/**
|
|
79
|
-
* - Font family (system default if unset)
|
|
80
|
-
*/
|
|
81
76
|
fontFamily?: string;
|
|
82
|
-
/**
|
|
83
|
-
* - Font size
|
|
84
|
-
*/
|
|
85
77
|
fontSize?: string;
|
|
86
|
-
/**
|
|
87
|
-
* - Font weight
|
|
88
|
-
*/
|
|
89
78
|
fontWeight?: string;
|
|
90
|
-
/**
|
|
91
|
-
* - Font line height
|
|
92
|
-
*/
|
|
93
79
|
fontLineHeight?: string;
|
|
94
|
-
/**
|
|
95
|
-
* - Font direction
|
|
96
|
-
*/
|
|
97
80
|
fontDirection?: "auto" | "ltr" | "rtl";
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
variant?: "button" | "link";
|
|
106
|
-
target?: string;
|
|
107
|
-
rel?: string;
|
|
108
|
-
autoClose?: boolean;
|
|
109
|
-
ariaLabel?: string;
|
|
110
|
-
};
|
|
81
|
+
fontPadding?: string;
|
|
82
|
+
className?: string;
|
|
83
|
+
cta?: CTAOptions;
|
|
84
|
+
stacked?: boolean;
|
|
85
|
+
sound?: boolean | "success" | "error" | "warning" | "info" | "pop" | string;
|
|
86
|
+
swipeToDismiss?: boolean;
|
|
87
|
+
progress?: number;
|
|
111
88
|
};
|
|
112
89
|
type ToastHandle = {
|
|
113
|
-
/**
|
|
114
|
-
* - Dismisses this specific toast. Safe to call even if the toast already closed itself (e.g. its duration expired) — no-ops rather than throwing.
|
|
115
|
-
*/
|
|
116
90
|
dismiss: () => Promise<void>;
|
|
91
|
+
update: (newOptions: Partial<ToastOptions>) => Promise<void>;
|
|
117
92
|
};
|
|
118
93
|
type ToastPromiseMessages = {
|
|
119
94
|
loading?: string;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
*/
|
|
123
|
-
success?: string | ((value: any) => string);
|
|
124
|
-
/**
|
|
125
|
-
* - Either a fixed string, or a function that receives the caught error and returns the message.
|
|
126
|
-
*/
|
|
127
|
-
error?: string | ((error: any) => string);
|
|
95
|
+
success?: string | ((result: unknown) => string);
|
|
96
|
+
error?: string | ((error: unknown) => string);
|
|
128
97
|
};
|
|
129
98
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
133
|
-
* @property {number} [duration=2500] - Auto-dismiss time in milliseconds
|
|
134
|
-
* @property {string} [position="bottom-right"] - Toast position on screen
|
|
135
|
-
* @property {string} [borderRadius="50px"] - Toast corner radius
|
|
136
|
-
* @property {string} [backgroundColor] - Custom background color (per-type default if unset)
|
|
137
|
-
* @property {string} [textColor] - Custom text color (auto-computed for WCAG contrast if unset)
|
|
138
|
-
* @property {boolean} [showCloseButton=true] - Show close (×) button
|
|
139
|
-
* @property {boolean} [showProgressBar=true] - Show countdown progress bar
|
|
140
|
-
* @property {string} [animationDuration="0.4s"] - CSS animation duration
|
|
141
|
-
* @property {string} [animationEasing="ease"] - CSS animation easing function
|
|
142
|
-
* @property {string} [progressColor] - Progress bar color (falls back to textColor)
|
|
143
|
-
* @property {string} [progressHeight="4px"] - Progress bar height
|
|
144
|
-
* @property {"top"|"bottom"} [progressPosition="bottom"] - Progress bar position
|
|
145
|
-
* @property {boolean|undefined} [pauseOnHover] - Pause timer on hover (auto: true for CTA toasts)
|
|
146
|
-
* @property {boolean} [allowHtml=false] - Render message as sanitized HTML
|
|
147
|
-
* @property {boolean} [sanitizeHtml=true] - Sanitize HTML when allowHtml=true
|
|
148
|
-
* @property {string} [wrapText="normal"] - "normal" wraps naturally; falsy truncates to 3 lines
|
|
149
|
-
* @property {string} [maxWidth] - Max width (auto: 400px / 100vw for full-width positions)
|
|
150
|
-
* @property {string} [fontFamily] - Font family (system default if unset)
|
|
151
|
-
* @property {string} [fontSize="14px"] - Font size
|
|
152
|
-
* @property {string} [fontWeight="400"] - Font weight
|
|
153
|
-
* @property {string} [fontLineHeight="1.4"] - Font line height
|
|
154
|
-
* @property {"auto"|"ltr"|"rtl"} [fontDirection="auto"] - Font direction
|
|
155
|
-
* @property {Object} [cta] - Call-to-action configuration
|
|
156
|
-
* @property {string} [cta.label] - Button/link text
|
|
157
|
-
* @property {Function} [cta.onClick] - Click handler (may be async)
|
|
158
|
-
* @property {string} [cta.href] - URL for link variant
|
|
159
|
-
* @property {"button"|"link"} [cta.variant="button"] - Button or link
|
|
160
|
-
* @property {string} [cta.target] - Link target (_blank, etc.)
|
|
161
|
-
* @property {string} [cta.rel] - Link rel (auto: noopener noreferrer for _blank)
|
|
162
|
-
* @property {boolean} [cta.autoClose=true] - Close toast after CTA click
|
|
163
|
-
* @property {string} [cta.ariaLabel] - Accessibility label for CTA
|
|
99
|
+
* Creates and displays a toast notification.
|
|
100
|
+
* @param {ToastOptions} [options]
|
|
101
|
+
* @returns {Promise<ToastHandle>}
|
|
164
102
|
*/
|
|
103
|
+
declare function createToastWithPriority(options?: ToastOptions): Promise<ToastHandle>;
|
|
165
104
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @
|
|
105
|
+
* Sets default background colors for toast types.
|
|
106
|
+
* @param {Partial<Record<ToastType, string>>} colors
|
|
168
107
|
*/
|
|
108
|
+
declare function setDefaultColors(colors: Partial<Record<ToastType, string>>): void;
|
|
169
109
|
/**
|
|
170
|
-
*
|
|
171
|
-
* @
|
|
110
|
+
* Sets default messages for toast types.
|
|
111
|
+
* @param {Partial<Record<ToastType, string>>} messages
|
|
172
112
|
*/
|
|
173
|
-
declare function
|
|
174
|
-
declare function setDefaultColors(colors: any): void;
|
|
175
|
-
declare function setDefaultMessages(messages: any): void;
|
|
113
|
+
declare function setDefaultMessages(messages: Partial<Record<ToastType, string>>): void;
|
|
176
114
|
declare function dismissToast(): Promise<void>;
|
|
177
115
|
declare function noopAll(): Promise<void>;
|
|
116
|
+
declare const version: "3.13.0";
|
|
178
117
|
/**
|
|
179
|
-
*
|
|
180
|
-
* @
|
|
181
|
-
* @
|
|
182
|
-
* @property {string | ((error: any) => string)} [error="Something went wrong."] - Either a fixed string, or a function that receives the caught error and returns the message.
|
|
183
|
-
*/
|
|
184
|
-
/**
|
|
185
|
-
* Shows a loading toast, then swaps it for a success or error toast once
|
|
186
|
-
* the given promise settles. The original promise's resolution/rejection
|
|
187
|
-
* is passed through unchanged, so `await toastPromise(fetchData(), {...})`
|
|
188
|
-
* still gives you the real result (or throws the real error) — this is
|
|
189
|
-
* purely a UI layer on top of a promise you're already awaiting.
|
|
190
|
-
*
|
|
191
|
-
* @param {Promise<any> | (() => Promise<any>)} promiseOrFn - A promise, or a function that returns one (called immediately).
|
|
118
|
+
* Wraps a promise or function with automatic loading, success, and error toasts.
|
|
119
|
+
* @template T
|
|
120
|
+
* @param {Promise<T> | (() => Promise<T> | T)} promiseOrFn
|
|
192
121
|
* @param {ToastPromiseMessages} [messages]
|
|
193
|
-
* @param {
|
|
194
|
-
* @returns {Promise<
|
|
122
|
+
* @param {ToastOptions} [options]
|
|
123
|
+
* @returns {Promise<T>}
|
|
195
124
|
*/
|
|
196
|
-
declare function toastPromise(promiseOrFn: Promise<
|
|
125
|
+
declare function toastPromise<T>(promiseOrFn: Promise<T> | (() => Promise<T> | T), messages?: ToastPromiseMessages, options?: ToastOptions): Promise<T>;
|
|
197
126
|
|
|
198
|
-
export { createToastWithPriority as createToast, dismissToast as dismiss, noopAll as noop, setDefaultColors, setDefaultMessages, toastPromise };
|
|
199
|
-
export type { ToastHandle, ToastOptions, ToastPromiseMessages };
|
|
127
|
+
export { createToastWithPriority as createToast, dismissToast as dismiss, isAudioEnabled, noopAll as noop, playTone, resetContainerRegistry, resetToastManager, setAudioEnabled, setDefaultColors, setDefaultMessages, toastPromise, updateToastByKey, version };
|
|
128
|
+
export type { CTAOptions, ToastHandle, ToastLoaderOptions, ToastOptions, ToastPosition, ToastPromiseMessages, ToastType };
|
package/dist/index.esm.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Customizable Toast Notifications
|
|
3
|
-
* Build: 2026-
|
|
4
|
-
* Cache-Buster:
|
|
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
|
-
async function t(t,e){const n=document.createElement(t);return n.id=function(t){return`${t}-${Date.now().toString(36)}-${Math.floor(1048575*Math.random()).toString(36)}`}(e),n}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),n={};function o(t){if(!t)return"snow";const o=String(t),r=e.get(o);if(r)return r;if(n[null==t?void 0:t.toLowerCase()]){const r=n[t.toLowerCase()];return e.set(o,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 n=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(n)return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3])};const o=null==t?void 0:t.match(/hsla?\(\s*([\d.]+)(?:deg)?\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.]+)?\)/i);if(o){const t=Number(o[1])/360,e=Number(o[2])/100,n=Number(o[3])/100;if(0===e){const t=Math.round(255*n);return{r:t,g:t,b:t}}const r=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),i=n<.5?n*(1+e):n+e-n*e,a=2*n-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 n=null==t?void 0:t.match(/^var\((--[\w-]+)(?:\s*,\s*(.+))?\)$/i);if(!n)return t;try{if("undefined"!=typeof document&&"function"==typeof getComputedStyle){const t=getComputedStyle(document.documentElement).getPropertyValue(n[1]).trim();if(t)return t}}catch(t){}return(null===(e=n[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(t){i=a=s=128}const l=(t,e,n)=>{const o=[t,e,n].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},c=(t,e)=>{const n=l(...t),o=l(...e);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let[u,d,m]=((t,e,n)=>{t/=255,e/=255,n/=255;const o=Math.max(t,e,n),r=Math.min(t,e,n);let i,a,s=(o+r)/2;if(o===r)i=a=0;else{const l=o-r;switch(a=s>.5?l/(2-o-r):l/(o+r),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return[360*i,a,s]})(i,a,s);let f=m<.5?Math.min(m+.5,1):Math.max(m-.5,0),[p,h,g]=((t,e,n)=>{let o,r,i;if(t/=360,0===e)o=r=i=n;else{const a=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;o=a(l,s,t+1/3),r=a(l,s,t),i=a(l,s,t-1/3)}return[Math.round(255*o),Math.round(255*r),Math.round(255*i)]})(u,d,f);if(c([i,a,s],[p,h,g])<4.5){const t=c([i,a,s],[0,0,0]),e=c([i,a,s],[255,255,255]);[p,h,g]=t>=e?[0,0,0]:[255,255,255]}const y=((t,e,n)=>`#${t.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`)(p,h,g);return e.set(o,y),y}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,o,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(o)+.0722*i(r),s=(a+.05)/.05,l=1.05/(a+.05);n[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"]);function a(t){if(!t||"string"!=typeof t)return"";let e=t.replace(/<\/?(script|iframe|object|embed|link|meta|style|form|input|button|svg|math|img|video|audio|details|dialog|applet|embed|frame|frameset|textarea|select|option|optgroup|fieldset|legend|datalist|output|progress|meter|keygen|canvas|map|area|base|basefont|bgsound|blink|center|dir|font|frame|frameset|hgroup|isindex|listing|marquee|multicol|nextid|noembed|noframes|plaintext|rb|rtc|spacer|strike|tt|xmp)[^>]*>/gi,"");e=e.replace(/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,""),e=e.replace(/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi,"$1=$2#$2");const n=document.createElement("div");function o(t){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.nodeValue);if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.tagName.toUpperCase();if(!r.has(e)){const e=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const n=o(t);n&&e.appendChild(n)}),e}const n=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(e=>{const o=e.name.toLowerCase(),r=e.value;i.has(o)&&("href"!==o&&"src"!==o||!/^\s*javascript:/i.test(r))&&("src"!==o||/^\s*(https?:|data:image\/)/i.test(r))&&("target"===o&&"_blank"===r&&n.setAttribute("rel",(t.getAttribute("rel")||"")+" noopener noreferrer"),n.setAttribute(o,r))}),Array.from(t.childNodes).forEach(t=>{const e=o(t);e&&n.appendChild(e)}),n}n.innerHTML=e;const a=document.createDocumentFragment();Array.from(n.childNodes).forEach(t=>{const e=o(t);e&&a.appendChild(e)});const s=document.createElement("div");return s.appendChild(a),s.innerHTML}function s(t,e={}){if(!t)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}),n=document.createElement("div");return n.innerHTML=e,n.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(" "))}),n.innerHTML}}catch(t){}return a(t)}function l(t={}){const e=t.size||14,n=t.color||"currentColor",o=t.text||"",r=document.createElement("span");r.className="toast-loader",r.style.display="inline-flex",r.style.alignItems="center",r.style.gap="8px";const i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"svg");a.setAttribute("width",String(e)),a.setAttribute("height",String(e)),a.setAttribute("viewBox","0 0 50 50"),a.setAttribute("aria-hidden","true");const s=document.createElementNS(i,"circle");if(s.setAttribute("cx","25"),s.setAttribute("cy","25"),s.setAttribute("r","20"),s.setAttribute("fill","none"),s.setAttribute("stroke",n),s.setAttribute("stroke-width","4"),s.setAttribute("stroke-linecap","round"),s.style.opacity="0.85",s.style.strokeDasharray="90",s.style.strokeDashoffset="60",s.style.transformOrigin="center",s.style.animation="toast-spinner 1s linear infinite",a.appendChild(s),r.appendChild(a),o){const t=document.createElement("span");t.style.fontSize="13px",t.textContent=o,r.appendChild(t)}if(!l._stylesInjected&&(l._stylesInjected=!0,!document.getElementById("toast-spinner-styles"))){const t=document.createElement("style");t.id="toast-spinner-styles",t.innerHTML="@keyframes toast-spinner { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(t)}return r}async function c(t,e,n){var o,r;const i=await async function(t){if("number"==typeof t&&t>0)return t;if("string"==typeof t){if(t.endsWith("s")&&!t.endsWith("ms")){const e=1e3*parseFloat(t);return e>0?e:500}const e=parseFloat(t);return e>0?e:500}return 500}(null==e?void 0:e.animationDuration),a=`${i}ms`;t.className=`toast toast-${null!==(o=null==e?void 0:e.type)&&void 0!==o?o:"info"}`,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",transition:`opacity ${a} ${null==e?void 0:e.animationEasing}, transform ${a} ${null==e?void 0:e.animationEasing}`,transform:"translateY(20px)",zIndex:"9999"}),t.setAttribute("role","alert"),t.setAttribute("aria-live","polite"),t.tabIndex=0,t._animationDuration=i;const c=document.createElement("span");null!=e&&e.wrapText?Object.assign(c.style,{display:"block",whiteSpace:"normal"}):Object.assign(c.style,{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3",whiteSpace:"nowrap"}),Object.assign(c.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"});const u=!!e.allowHtml,d=null!==(r=e.message)&&void 0!==r?r:"";if(e.loader||e.showLoader){const t=l(e.loader||{});c.appendChild(t);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",c.appendChild(n)}if(u&&"string"==typeof d&&d.trim().length>0)try{const t=s(d),e=document.createElement("div");for(e.innerHTML=t;e.firstChild;)c.appendChild(e.firstChild)}catch(t){console.warn("HTML message sanitization failed, falling back to text:",t),c.textContent=d}else c.textContent=String(d);c.setAttribute("aria-label","Toast Notification Center"),c.setAttribute("title","string"==typeof d?d.replace(/<[^>]+>/g,""):String(d)),t.appendChild(c),null!=e&&e.cta&&0!==Object.keys(e.cta).length&&function(t,e,n){const o=null==e?void 0:e.cta;if(!o)return;const r={...o};r.label||(r.label="CTA Label Missing!");const i=!!r.href&&"link"===r.variant,a=document.createElement(i?"a":"button");i?(a.href=r.href,r.target&&(a.target=r.target),a.rel=r.rel||("_blank"===r.target?"noopener noreferrer":"")):a.type="button",a.setAttribute("aria-label",r.ariaLabel||r.label),Object.assign(a.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid rgba(255,255,255,0.35)",color:e.textColor||"#fff",background:"rgba(255,255,255,0.15)",cursor:"pointer",whiteSpace:"nowrap",flexShrink:"0"}),a.textContent=r.label;const s=async e=>{try{if("function"==typeof r.onClick){const t=r.onClick(e);null!=t&&t.then&&await t}}finally{!1!==r.autoClose&&n(t)}};a.addEventListener("click",s),a._cleanup=()=>a.removeEventListener("click",s),t.appendChild(a)}(t,e,n),null!=e&&e.showCloseButton&&function(t,e,n){const o=document.createElement("button");o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×",Object.assign(o.style,{background:"none",border:"none",color:e.textColor||"white",fontSize:"18px",marginLeft:"10px",cursor:"pointer"});const r=()=>n(t);o.addEventListener("click",r),t._cleanupCloseButton=()=>{o.removeEventListener("click",r)},t.appendChild(o)}(t,e,n),null!=e&&e.showProgressBar&&function(t,e){var n;const o=document.createElement("div"),r=e.borderRadius||0,i=parseInt(r,10),a=i?"12px":"0",s=i?12:0,l=Math.max(i-10,s),c=i?`calc(100% - ${l}px)`:"100%",u=parseInt(e.progressHeight,10)||4,d=Number(null!==(n=e.duration)&&void 0!==n?n:1800)+5;Object.assign(o.style,{position:"absolute",left:`${a}`,height:`${u}px`,background:e.progressColor||"rgba(255, 255, 255, 0.3)",width:`${c}`,transition:`width ${d}ms linear`,["top"===e.progressPosition?"top":"bottom"]:"0",borderRadius:u/2+"px"}),t.appendChild(o),"function"==typeof o.animate?t._progressAnimation=o.animate([{width:c},{width:"0%"}],{duration:d,easing:"linear",fill:"forwards",delay:50}):(o.style.transition=`width ${d}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 u(t,e){try{const n=document.createElement("div");Object.assign(n.style,{background:"#333",color:"white",padding:"10px 15px",position:"fixed",top:"20px",right:"20px",zIndex:"99999",borderRadius:"3px",maxWidth:"250px",wordWrap:"break-word",boxShadow:"0 2px 10px rgba(0,0,0,0.3)",cursor:"pointer"});const o=document.createElement("div"),r=document.createElement("span");r.style.display="inline-block",t.allowHtml?r.innerHTML=s(String(t.message||"Emergency Toast Showing!")):r.textContent=String(t.message||"Emergency Toast Creation Showing!"),o.appendChild(r);const i=document.createElement("span");for(i.style.cssText="float: right; margin-left: 10px; font-weight: bold;",i.textContent="×",o.appendChild(i);n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(o),i.onclick=()=>{n.remove(),e(n)},document.body.appendChild(n),setTimeout(()=>{n.remove(),e(n)},null==t?void 0:t.duration),n}catch(n){return console.error("Emergency toast creation failed:",n),setTimeout(()=>{alert((null==t?void 0:t.message)||"Emergency Toast Creation Showing!"),e(null)},100),null}}const d=new Map,m=new Map;function f(t){return`toast-container-${function(t){return String(t).toLowerCase().trim().replace(/\bbelow\b/g,"bottom").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-")}(t)}`}async function p(t,e){const n=f(t.position);if(m.has(n))return m.get(n);const o=(async()=>{const o=d.get(n);if(null!=o&&o.isConnected)return o;o&&!o.isConnected&&d.delete(n);let r=document.getElementById(n);r&&!r.isConnected&&document.body.appendChild(r),r?(r.style.position=r.style.position||"fixed",r.style.zIndex=r.style.zIndex||"9999","function"==typeof e&&await e(r,t)):(r=document.createElement("div"),r.id=n,r.setAttribute("role","status"),r.setAttribute("aria-atomic","true"),r.style.position="fixed",r.style.zIndex="9999",r.style.inset="auto 10px 10px auto",r.style.display="flex",r.style.justifyContent="space-between",r.style.alignItems="center",r.style.flexDirection="column",r.style.overflow="hidden","function"==typeof e&&await e(r,t),document.body.appendChild(r));const i=document.querySelectorAll(`#${n}`);if(i.length>1)for(let t=1;t<i.length;t++)try{i[t].remove()}catch(t){}return d.set(n,r),r})();m.set(n,o);try{return await o}finally{m.delete(n)}}async function h(t,e){if(!t||!e.position)throw new Error("Invalid container or position!");!function(t){t.style.top="auto",t.style.bottom="auto",t.style.left="auto",t.style.right="auto",t.style.transform="none"}(t);const n=function(t){const e=t.toLowerCase().trim(),n="top-full-width"===e||"bottom-full-width"===e||"fullwidth"===e;return{hasTop:e.startsWith("top")||"center"!==e&&e.includes("top"),hasBottom:e.startsWith("bottom")||e.includes("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:n}}(e.position);(function(t,e,n){if(!n.hasFullWidth)return!1;if(n.hasTop)return e.maxWidth="100vw",t.style.top="10px",t.style.left="10px",t.style.right="10px",!0;if(n.hasBottom)return e.maxWidth="100vw",t.style.bottom="10px",t.style.left="10px",t.style.right="10px",!0;return!1})(t,e,n)||function(t,e){if(!e.hasCenter)return!1;if(e.hasTop&&!e.hasLeft&&!e.hasRight)return t.style.top="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasBottom&&!e.hasLeft&&!e.hasRight)return t.style.bottom="10px",t.style.left="50%",t.style.transform="translateX(-50%)",!0;if(e.hasLeft&&!e.hasTop&&!e.hasBottom)return t.style.left="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(e.hasRight&&!e.hasTop&&!e.hasBottom)return t.style.right="10px",t.style.top="50%",t.style.transform="translateY(-50%)",!0;if(!(e.hasLeft||e.hasRight||e.hasTop||e.hasBottom))return t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",!0;return!1}(t,n)||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,n)}class g{constructor(t,e){this.callback=t,this.delay=e,this.remaining=e,this.startTime=null,this.timeoutId=null,this.isPaused=!1,this.isCompleted=!1}start(){return this.isCompleted||this.timeoutId||(this.startTime=Date.now(),this.timeoutId=setTimeout(()=>{this.isCompleted=!0,this.timeoutId=null,this.callback()},this.remaining)),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 y=new Map,b=new Map,w=[];let v=0;async function x(t={}){try{const e=function(t={}){return`${String(t.type).trim().toLowerCase()}|${function(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}(String(t.message||"")).toString(16)}|${String(t.position).trim().toLowerCase()}`}(t);if(y.has(e)){const n=y.get(e);if(!n)throw new Error(`Active toast with key ${e} not found`);return n.count++,n.timer.clear(),n.timer=S(n.toast,t),await T(n),await I(n),e}if(b.has(e)){const t=b.get(e);if(!t)throw new Error(`Pending toast with key ${e} not found`);return t.count++,e}const n={options:t,count:1,rafId:0};return b.set(e,n),n.rafId=requestAnimationFrame(async()=>{const t=b.get(e);if(t){if(b.delete(e),v>=3)return w.push({options:t.options,key:e,count:t.count}),void await M();try{await C(t.options,e,t.count)}catch(t){console.error("showToast failed:",t)}}}),e}catch(t){console.error("showToast failed:",t)}}async function C(e,n,o){try{if(!e||"object"!=typeof e)throw new TypeError("options must be an object");v++;const r=await p(e,h);if(!r)throw new Error("Failed to create toast container");const i=await async function(e,n){if(!document.querySelector('[id^="toast-container-"]'))return null;let o;try{return o=await t("div","toast"),await c(o,e,n),o}catch(t){return console.warn("toast creation failed with error showing fallback one: ",t),o=await u(e,n),o}}(e,A);if(!i)throw new Error("Toast element creation failed");const a=document.createElement("div");Object.assign(a.style,{position:"relative",display:"inline-block",overflow:"visible",marginBottom:"10px",zIndex:"0",width:"100%"});const s=document.createElement("div");Object.assign(s.style,{position:"relative",overflow:"hidden",zIndex:"1"}),s.appendChild(i),a.appendChild(s),r.id.includes("toast-container-")&&r.appendChild(a);const l=!1!==e.pauseOnHover&&(!0===e.pauseOnHover||!!e.cta),d={outer:a,toast:i,count:Math.max(1,Math.floor(null!=o?o:0)),timeout:null,pauseOnHover:l};y.set(n,d),i._key=n,d.count>1&&await I(d),d.timer=S(i,e),await T(d)}catch(t){console.error("Something went wrong: ",t),v=Math.max(0,v-1);(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await u(e,A))}}const k=async function(){try{if(0===y.size)return;let t=null;if(document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const n=Array.from(e.children||[]);if(0===n.length)return;const o=n.at(-1);o&&(t=o.querySelector('[id^="toast-"]')||o)}),!t){const e=Array.from(y.entries());if(e.length>0){const[,n]=e.at(-1);t=n.toast||n.outer&&n.outer.querySelector('[id^="toast-"]')}}if(!t)return;const e=t._key?t:t.querySelector('[id^="toast-"]')||t;await A(e)}catch(t){console.error("dismissMostRecent failed:",t)}},E=async function(){try{const t=Array.from(y.values()).map(t=>t.toast).filter(Boolean);w.length=0,b.clear();for(const e of t)try{await A(e)}catch(t){console.warn("closeAllToasts: failed to close one toast:",t)}}catch(t){console.error("closeAllToasts failed:",t)}};function S(t,e){var n;const o=Number(null!==(n=e.duration)&&void 0!==n?n:1800)+5,r=new g(async()=>await A(t),o);return r.start(),r}async function T(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const{outer:e,timer:n,toast:o}=t,r=()=>{var t;n.pause(),null==o||null===(t=o._progressAnimation)||void 0===t||t.pause()},i=()=>{var t;n.resume(),null==o||null===(t=o._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(n.pause(),null==o||null===(e=o._progressAnimation)||void 0===e||e.pause())},s=t=>{var r;e.contains(t.relatedTarget)||(n.resume(),null==o||null===(r=o._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 A(t){if(null!=t&&t._key)return L(t._key)}async function L(t){try{var e,n,o,r,i,a,s,l,c,u,d;if(!t)return;const m=b.get(t);if(m)return cancelAnimationFrame(m.rafId),void b.delete(t);const f=w.findIndex(e=>e.key===t);if(-1!==f)return void w.splice(f,1);const p=y.get(t);if(!p)return;null===(e=p.timer)||void 0===e||e.clear(),null===(n=p.outer)||void 0===n||null===(o=n._pauseCleanup)||void 0===o||o.call(n),null===(r=p.toast)||void 0===r||null===(i=r._cleanupCloseButton)||void 0===i||i.call(r),null===(a=p.toast)||void 0===a||null===(s=a._cleanup)||void 0===s||s.call(a);const h=null===(l=p.toast)||void 0===l?void 0:l.querySelector("button, a");null==h||null===(c=h._cleanup)||void 0===c||c.call(h),y.delete(t),v=Math.max(0,v-1);const g=p.outer.querySelector(".toast-count-badge");g&&g.remove();const x=null!==(u=null===(d=p.toast)||void 0===d?void 0:d._animationDuration)&&void 0!==u?u:400;await async function(t,e=400){return t?new Promise(n=>{let o=!1;const r=()=>{o||(o=!0,async function(t){if(!t)return!0;try{var e;if(null!=t&&null!==(e=t.parentNode)&&void 0!==e&&e.id.includes("toast-container-"))return t.parentNode.removeChild(t),!0}catch(t){}try{if(t.remove)return t.remove(),!0}catch(t){}try{return Object.assign(t.style,{display:"none",opacity:"0",pointerEvents:"none",position:"absolute",left:"-9999px"}),!0}catch(t){}}(t),n())},i=t.firstElementChild||t;if(!i)return n();const a=t=>{try{if(t.target!==i)return;i.removeEventListener("transitionend",a,!0),r()}catch(t){console.error("removeWithTransition error:",t)}};try{i.addEventListener("transitionend",a,!0)}catch(t){console.error("removeWithTransition error:",t)}setTimeout(()=>{try{i.removeEventListener("transitionend",a,!0),r()}catch(t){console.error("removeWithTransition error:",t)}},e+300)}):Promise.resolve()}(p.outer,x),await M()}catch(t){console.error("Closing Toast failed!: ",t)}}async function M(){for(;v<3&&w.length;){const t=w.shift();if(y.has(t.key)){const e=y.get(t.key);e.count+=t.count,await I(e);continue}C(t.options,t.key,t.count)}}async function I({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 n=t.querySelector(".toast-count-badge");n||(n=document.createElement("span"),n.className="toast-count-badge",n.setAttribute("aria-label",`${e} identical notifications`),Object.assign(n.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(n)),n.textContent=e>99?"99+":String(e);try{n.style.transform="scale(1.2)",setTimeout(()=>n.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 $=[];let N=!1;async function W(t={}){try{const e=await async function(t){var e,n;const r=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),i=null!=r&&r.includes("top-full-width")||null!=r&&r.includes("bottom-full-width")?"100vw":"400px",a={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",fontPosition:"relative",fontPadding:void 0,fontBorderRadius:void 0,fontBackgroundColor:void 0,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:i,..."object"!=typeof t||Array.isArray(t)?{}:t};a.message=null!==(n=null==t?void 0:t.message)&&void 0!==n?n:a.message;try{var s,l;if(!a.backgroundColor)a.backgroundColor=null!==(s=null===(l=O)||void 0===l?void 0:l[a.type])&&void 0!==s?s:window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111"}catch(t){console.warn("Background color resolution failed:",t)}try{var c;a.message=a.message||(null===(c=j)||void 0===c?void 0:c[a.type])||"No Message Provided!"}catch(t){console.warn("Default message resolution failed:",t)}try{!a.textColor&&a.backgroundColor&&(a.textColor=o(a.backgroundColor))}catch(t){console.warn("Text color resolution failed:",t)}try{!a.progressColor&&a.backgroundColor&&(a.progressColor=a.textColor||o(a.backgroundColor))}catch(t){console.warn("Progress bar color resolution failed:",t)}"string"!=typeof a.message&&(a.message="No Message Provided!");return a}(t);return await async function(t){try{return await p(t,h)}catch(t){return console.error("Failed to create toast container:",t),document.body}}(e),await x(e)}catch(e){console.error("CreateToast failed:",e);const n="string"==typeof(null==t?void 0:t.message)&&null!==(null==t?void 0:t.message)?`${t.message.substring(0,200)} toast creation failed!`:"Toast creation failed!";return alert(n),null}}function B(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const e=["success","error","warning","info"],n={};for(const[o,r]of Object.entries(t))e.includes(o)&&"string"==typeof r&&r.trim()&&(n[o]=r.trim());Object.keys(n).length>0&&(O={...O,...n})}}catch(t){console.error("setDefaultColors failed:",t)}}function D(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const e=["success","error","warning","info"],n={};for(const[o,r]of Object.entries(t))e.includes(o)&&"string"==typeof r&&r.trim()&&(n[o]=r.trim());Object.keys(n).length>0&&(j={...j,...n})}}catch(t){console.error("setDefaultMessages failed:",t)}}let z=!1,P=null;const _=async function(t={}){return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){if(N)return;"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"interactive"===document.readyState?(N=!0,$.forEach(t=>setTimeout(()=>W(t),200)),$.length=0):document.addEventListener("DOMContentLoaded",()=>{N=!0,$.forEach(t=>setTimeout(()=>W(t),200)),$.length=0},{once:!0}))}(),N?await W(t):($.push(t),null)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)};async function H(t={}){const e=await async function(t){if(z&&P)try{await P}catch(t){console.warn("Previous close operation failed (continuing anyway):",t)}return t()}(()=>_(t));return{dismiss:()=>e?L(e):Promise.resolve()}}const R=async()=>{z=!0,P=(async()=>{try{await k()}finally{z=!1,P=null}})(),await P},q=async()=>{z=!0,P=(async()=>{try{await E()}finally{z=!1,P=null}})(),await P};async function F(t,e={},n={}){var o;const r=null!==(o=e.loading)&&void 0!==o?o:"Loading...",i=await H({...n,type:"info",message:r,duration:864e5,showProgressBar:!1,pauseOnHover:!1}),a="function"==typeof t?t():t;try{var s;const t=await a;await i.dismiss();const o="function"==typeof e.success?e.success(t):null!==(s=e.success)&&void 0!==s?s:"Done!";return await H({...n,type:"success",message:o}),t}catch(t){var l;await i.dismiss();const o="function"==typeof e.error?e.error(t):null!==(l=e.error)&&void 0!==l?l:"Something went wrong.";throw await H({...n,type:"error",message:o}),t}}if("undefined"!=typeof window&&"undefined"!=typeof document){const t=t=>{"Escape"!==t.key&&"Esc"!==t.key||(async()=>{try{z=!0,P=(async()=>{try{await k()}finally{z=!1,P=null}})(),await P}catch(t){console.error("Escape key dismiss failed:",t),z=!1,P=null}})()};window.addEventListener("keydown",t,{passive:!0})}try{"undefined"!=typeof window&&(window.customizableToast={createToast:H,setDefaultColors:B,setDefaultMessages:D,noop:q,dismiss:R,toastPromise:F})}catch(t){console.error("Global assignment failed:",t)}export{H as createToast,R as dismiss,q as noop,B as setDefaultColors,D as setDefaultMessages,F as toastPromise};
|
|
15
|
+
function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function o(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach(function(n){e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function r(e,n){return function(t){if(Array.isArray(t))return t}(e)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o,r,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=i.call(n)).done)&&(s.push(o.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t){try{return(null==t?void 0:t.offsetWidth)||0}catch(t){return 0}}const a=new class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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),s={};function l(t){if(!t)return"snow";const e=String(t),n=a.get(e);if(n)return n;if(s[null==t?void 0:t.toLowerCase()]){const n=s[t.toLowerCase()];return a.set(e,n),n}let o,i,l;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 n=null==t?void 0:t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/i);if(n)return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3])};const o=null==t?void 0:t.match(/hsla?\(\s*([\d.]+)(?:deg)?\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*[\d.]+)?\)/i);if(o){const t=Number(o[1])/360,e=Number(o[2])/100,n=Number(o[3])/100;if(0===e){const t=Math.round(255*n);return{r:t,g:t,b:t}}const r=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),i=n<.5?n*(1+e):n+e-n*e,a=2*n-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 n=null==t?void 0:t.match(/^var\((--[\w-]+)(?:\s*,\s*(.+))?\)$/i);if(!n)return t;try{if("undefined"!=typeof document&&"function"==typeof getComputedStyle){const t=getComputedStyle(document.documentElement).getPropertyValue(n[1]).trim();if(t)return t}}catch(t){}return(null===(e=n[2])||void 0===e?void 0:e.trim())||t}(t));if(!e)throw new Error("Unknown color");o=e.r,i=e.g,l=e.b}catch(t){o=i=l=128}const c=(t,e,n)=>{const o=[t,e,n].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*o[0]+.7152*o[1]+.0722*o[2]},u=(t,e)=>{const n=c(...t),o=c(...e);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)};let d=((t,e,n)=>{t/=255,e/=255,n/=255;const o=Math.max(t,e,n),r=Math.min(t,e,n);let i,a,s=(o+r)/2;if(o===r)i=a=0;else{const l=o-r;switch(a=s>.5?l/(2-o-r):l/(o+r),o){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return[360*i,a,s]})(o,i,l),p=r(d,3),m=p[0],f=p[1],h=p[2],y=((t,e,n)=>{let o,r,i;if(t/=360,0===e)o=r=i=n;else{const a=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;o=a(l,s,t+1/3),r=a(l,s,t),i=a(l,s,t-1/3)}return[Math.round(255*o),Math.round(255*r),Math.round(255*i)]})(m,f,h<.5?Math.min(h+.5,1):Math.max(h-.5,0)),g=r(y,3),b=g[0],v=g[1],w=g[2];if(u([o,i,l],[b,v,w])<4.5){var x=r(u([o,i,l],[0,0,0])>=u([o,i,l],[255,255,255])?[0,0,0]:[255,255,255],3);b=x[0],v=x[1],w=x[2]}const C=((t,e,n)=>"#".concat(t.toString(16).padStart(2,"0")).concat(e.toString(16).padStart(2,"0")).concat(n.toString(16).padStart(2,"0")))(b,v,w);return a.set(e,C),C}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=>{let e=r(t,2),n=e[0],o=r(e[1],3),i=o[0],a=o[1],l=o[2];const c=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},u=.2126*c(i)+.7152*c(a)+.0722*c(l),d=(u+.05)/.05,p=1.05/(u+.05);s[n.toLowerCase()]=d>=p?"#000000":"#ffffff"});const c=new Set(["DIV","SPAN","P","BR","STRONG","B","EM","I","U","SMALL","UL","OL","LI","A","IMG","PRE","CODE","MARK"]),u=new Set(["href","src","alt","title","class","target","rel","loading"]),d=/<\/?(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,p=/\s(on\w+)\s*=\s*(['"])[\s\S]*?\2/gi,m=/(href|src)\s*=\s*(['"])\s*javascript:[^'"]*\2/gi;function f(t,e,n){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 o=t.tagName.toUpperCase();if(!e.has(o)){const o=document.createDocumentFragment();return Array.from(t.childNodes).forEach(t=>{const r=f(t,e,n);r&&o.appendChild(r)}),o}const r=document.createElement(t.tagName);return Array.from(t.attributes||[]).forEach(t=>{r.setAttribute(t.name,t.value)}),function(t,e){const n=[];Array.from(t.attributes||[]).forEach(o=>{const r=o.name.toLowerCase(),i=o.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 n.push(r);else n.push(r);else n.push(r)}),n.forEach(e=>t.removeAttribute(e))}(r,n),Array.from(t.childNodes).forEach(t=>{const o=f(t,e,n);o&&r.appendChild(o)}),r}function h(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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(c),ALLOWED_ATTR:Array.from(u),ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i}),n=document.createElement("div");return n.innerHTML=e,n.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(" "))}),n.innerHTML}}catch(t){console.warn("DOMPurify sanitization failed, falling back:",t)}return function(t){if(!t||"string"!=typeof t)return"";let e=t.replace(d,"");e=e.replace(p,""),e=e.replace(m,"$1=$2#$2");const n=document.createElement("div");n.innerHTML=e;const o=document.createDocumentFragment();Array.from(n.childNodes).forEach(t=>{const e=f(t,c,u);e&&o.appendChild(e)});const r=document.createElement("div");return r.appendChild(o),r.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(" "))}),r.innerHTML}(t)}function y(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},n=Number(e.size)||14,o="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(n)),s.setAttribute("height",String(n)),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",o),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 g(t,e){var n;const o=document.createElement("div");o.className="toast-progress-bar",t._progressBar=o;const r=e.borderRadius||"0",a=parseInt(r,10),s=parseInt(e.progressHeight,10)||4,l=Number(null!==(n=e.duration)&&void 0!==n?n:2500)+5,c=Math.min(a,2*s),u=a>0?"calc(100% - ".concat(c,"px)"):"100%";if(Object.assign(o.style,{position:"absolute",left:"".concat(c,"px"),height:"".concat(s,"px"),background:e.progressColor||"currentColor",width:"".concat(u),transition:"width ".concat(l,"ms linear"),["top"===e.progressPosition?"top":"bottom"]:"0",borderRadius:"".concat(s/2,"px"),opacity:"0.8"}),t.appendChild(o),void 0!==e.progress){let t=Number(e.progress);return Number.isFinite(t)||(t=0),t<=1&&t>0&&(t*=100),t=Math.min(100,Math.max(0,t)),o.style.width="".concat(t,"%"),void(o.style.transition="width 200ms ease")}"function"==typeof o.animate?t._progressAnimation=o.animate([{width:u},{width:"0%"}],{duration:l,easing:"linear",fill:"forwards",delay:50}):(o.style.transition="width ".concat(l,"ms linear"),setTimeout(()=>{i(o),o.style.width="0%"},50))}let b=null,v=!0;function w(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"info";if(!v)return;const e=function(){if("undefined"==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;if(!t)return null;if(!b)try{b=new t}catch(t){return null}if(b&&"suspended"===b.state)try{b.resume().catch(()=>{})}catch(t){}return b}();if(e)try{const n=e.currentTime,o=String(t||"info").toLowerCase().trim();if("success"===o)[523.25,659.25,783.99].forEach((t,o)=>{const r=e.createOscillator(),i=e.createGain();r.type="sine",r.frequency.setValueAtTime(t,n+.08*o),i.gain.setValueAtTime(.001,n+.08*o),i.gain.exponentialRampToValueAtTime(.12,n+.08*o+.02),i.gain.exponentialRampToValueAtTime(1e-4,n+.08*o+.35),r.connect(i),i.connect(e.destination),r.start(n+.08*o),r.stop(n+.08*o+.36)});else if("error"===o)[320,240].forEach((t,o)=>{const r=e.createOscillator(),i=e.createGain();r.type="triangle",r.frequency.setValueAtTime(t,n+.1*o),i.gain.setValueAtTime(.001,n+.1*o),i.gain.exponentialRampToValueAtTime(.15,n+.1*o+.02),i.gain.exponentialRampToValueAtTime(1e-4,n+.1*o+.22),r.connect(i),i.connect(e.destination),r.start(n+.1*o),r.stop(n+.1*o+.23)});else if("warning"===o){const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(440,n),t.frequency.exponentialRampToValueAtTime(493.88,n+.12),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.12,n+.02),o.gain.exponentialRampToValueAtTime(1e-4,n+.28),t.connect(o),o.connect(e.destination),t.start(n),t.stop(n+.3)}else{const t=e.createOscillator(),o=e.createGain();t.type="sine",t.frequency.setValueAtTime(600,n),t.frequency.exponentialRampToValueAtTime(950,n+.04),t.frequency.exponentialRampToValueAtTime(400,n+.09),o.gain.setValueAtTime(.001,n),o.gain.exponentialRampToValueAtTime(.1,n+.015),o.gain.exponentialRampToValueAtTime(1e-4,n+.12),t.connect(o),o.connect(e.destination),t.start(n),t.stop(n+.13)}}catch(t){}}function x(t){v=Boolean(t)}function C(){return v}async function k(t,e,n){var r,a;const s=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),c="".concat(s,"ms"),u="string"==typeof(null==e?void 0:e.animationEasing)&&e.animationEasing.trim()?e.animationEasing.trim():"ease",d="string"==typeof(null==e?void 0:e.className)&&e.className.trim()?" ".concat(e.className.trim()):"";t.className="toast toast-".concat(null!==(r=null==e?void 0:e.type)&&void 0!==r?r:"info").concat(d);const p="number"==typeof(null==e?void 0:e.borderRadius)?"".concat(e.borderRadius,"px"):null==e?void 0:e.borderRadius,m="number"==typeof(null==e?void 0:e.maxWidth)?"".concat(e.maxWidth,"px"):null==e?void 0:e.maxWidth;Object.assign(t.style,{background:null==e?void 0:e.backgroundColor,padding:"12px 16px",marginBottom:"10px",borderRadius:p,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 ".concat(c," ").concat(u,", transform ").concat(c," ").concat(u),transform:"translateY(20px)",zIndex:"9999"}),t.setAttribute("role","alert"),t.setAttribute("aria-live","polite"),t.tabIndex=0,t._animationDuration=s;const f=document.createElement("span");f.className="toast-message",t._messageSpan=f,"truncate"!==(null==e?void 0:e.wrapText)&&"ellipsis"!==(null==e?void 0:e.wrapText)&&!1!==(null==e?void 0:e.wrapText)&&null!=e&&e.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 b="number"==typeof(null==e?void 0:e.fontSize)?"".concat(e.fontSize,"px"):null==e?void 0:e.fontSize;Object.assign(f.style,{flex:"1",padding:null==e?void 0:e.fontPadding,fontFamily:null==e?void 0:e.fontFamily,fontSize:b,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 v=!!e.allowHtml,x=null!==(a=e.message)&&void 0!==a?a:"";if(e.loader||e.showLoader){const t=y(e.loader||{});f.appendChild(t);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",f.appendChild(n)}if(v&&"string"==typeof x&&x.trim().length>0)try{const t=h(x),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(x)))}else f.appendChild(document.createTextNode(String(x)));f.setAttribute("title","string"==typeof x?x.replace(/<[^>]+>/g,""):String(x)),t.appendChild(f),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=o({},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 c=e.textColor||l(e.backgroundColor),u=e.backgroundColor&&(p=e.backgroundColor)&&"#000000"===l(p)?"rgba(0,0,0,0.15)":"rgba(255,255,255,0.15)",d="string"==typeof c&&/^#[0-9a-fA-F]{6}$/.test(c.trim())?"".concat(c.trim(),"44"):"rgba(128, 128, 128, 0.3)";var p;Object.assign(s.style,{marginLeft:"10px",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:"600",lineHeight:"1",border:"1px solid ".concat(d),color:c,background:u,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 o=document.createElement("button");o.setAttribute("aria-label","Close notification"),o.setAttribute("title","Close"),o.textContent="×";const r=e.textColor||l(e.backgroundColor);Object.assign(o.style,{background:"none",border:"none",color:r,fontSize:"18px",marginLeft:"10px",cursor:"pointer",lineHeight:"1",padding:"0 4px"});const i=()=>{"function"==typeof n&&n(t)};o.addEventListener("click",i),t._cleanupCloseButton=()=>{o.removeEventListener("click",i)},t.appendChild(o)}(t,e,n),null!=e&&e.showProgressBar&&g(t,e),!1!==(null==e?void 0:e.swipeToDismiss)&&function(t,e){if(!t||"function"!=typeof t.addEventListener)return;let n=0,o=0,r=0,i=!1,a=!1;const s=e=>{e&&e.touches&&1===e.touches.length&&(n=e.touches[0].clientX,o=e.touches[0].clientY,r=n,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-n,u=l-o;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 n=Math.max(0,1-Math.abs(c)/280);t.style.transform="translateX(".concat(c,"px)"),t.style.opacity=String(n),e.cancelable&&e.preventDefault()}},c=()=>{if(!i||!a)return void(i=!1);i=!1;const o=r-n;if(Math.abs(o)>=75){const n=o>0?320:-320;t.style.transition="transform 180ms ease-out, opacity 180ms ease-out",t.style.transform="translateX(".concat(n,"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)}}(t,n),null!=e&&e.sound&&w("string"==typeof e.sound?e.sound:(null==e?void 0:e.type)||"info"),function(t){i(t),setTimeout(()=>{requestAnimationFrame(()=>{t.style.opacity="1",t.style.transform="translateY(0)"})},50)}(t)}async function E(t,e){try{const n=document.createElement("div"),o=((null==t?void 0:t.position)||"bottom-right").toLowerCase().trim();let r="auto",i="auto",a="auto",s="auto",l="none";o.startsWith("top")?r="20px":(o.startsWith("bottom")||o.includes("below"))&&(i="20px"),o.startsWith("left")?a="20px":o.startsWith("right")?s="20px":"center"===o?(a="50%",r="50%",l="translate(-50%, -50%)"):o.includes("center")?o.includes("left")?(a="20px",r="50%",l="translateY(-50%)"):o.includes("right")?(s="20px",r="50%",l="translateY(-50%)"):o.includes("top")?(r="20px",a="50%",l="translateX(-50%)"):o.includes("bottom")&&(i="20px",a="50%",l="translateX(-50%)"):(s="20px",i="20px"),Object.assign(n.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"),u=document.createElement("span");u.style.display="inline-block",t.allowHtml?u.innerHTML=h(String(t.message||"Emergency Toast Showing!")):u.textContent=String(t.message||"Emergency Toast Creation Showing!"),c.appendChild(u);const d=document.createElement("span");for(d.style.cssText="float: right; margin-left: 10px; font-weight: bold; cursor: pointer;",d.textContent="×",c.appendChild(d);n.firstChild;)n.removeChild(n.firstChild);n.appendChild(c),d.addEventListener("click",()=>{n.remove(),"function"==typeof e&&e(n)});const p=Number(null==t?void 0:t.duration)||2500,m=setTimeout(()=>{n.remove(),"function"==typeof e&&e(n)},p);return"function"==typeof(null==m?void 0:m.unref)&&m.unref(),n}catch(t){return console.error("Emergency toast creation failed:",t),"function"==typeof e&&e(null),null}}const A=new Map,T=new Map;function S(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"}function L(){A.clear(),T.clear()}async function M(t,e){const n=function(t){const e=S(t);return"toast-container-".concat(e)}((null==t?void 0:t.position)||"bottom-right");if(T.has(n))return T.get(n);const o=(async()=>{const o=A.get(n),r="undefined"==typeof document||(null==o?void 0:o.ownerDocument)===document;if(null!=o&&o.isConnected&&r)return o;o&&A.delete(n);let i=document.getElementById(n);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=n,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("#".concat(n));if(a.length>1)for(let t=1;t<a.length;t++)try{a[t].remove()}catch(t){}return A.set(n,i),i})();T.set(n,o);try{return await o}finally{T.delete(n)}}const O=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"]),I=new Set(["top","bottom"]);async function j(t,e){if(!t||null==e||!e.position)throw new Error("Invalid container or position!");const n=String(e.position).toLowerCase().trim();let o=n;var r;r=n,O.has(r)||I.has(n)||(console.warn('Unknown position "'.concat(e.position,'", defaulting to "bottom-right"')),o="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}}(o);(function(t,e,n){if(!n.hasFullWidth)return!1;t.style.maxWidth="100vw";try{e&&!e.maxWidth&&(e.maxWidth="100vw")}catch(t){}return n.hasTop?(t.style.top="10px",t.style.left="10px",t.style.right="10px",!0):!!n.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 N{constructor(t,e){this.callback="function"==typeof t?t:()=>{};const n=Number.isFinite(e)&&e>=0?e:0;this.delay=n,this.remaining=n,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 _=new Map,B=new Map,P=[];let z=0;function D(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,D(t)}),t.addEventListener("mouseleave",()=>{t._isExpanded=!1,D(t)}),t.addEventListener("focusin",()=>{t._isExpanded=!0,D(t)}),t.addEventListener("focusout",e=>{t.contains(e.relatedTarget)||(t._isExpanded=!1,D(t))}));const e=Array.from(t.children),n=e.length,o=Boolean(t._isExpanded),r=Boolean(t.id&&t.id.includes("top"));e.forEach((t,e)=>{const i=n-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",o)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(".concat(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(".concat(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(".concat(e,"px)"),t.style.marginTop="-55px",t.style.marginBottom="0px",t.style.opacity="0",t.style.zIndex="1",t.style.pointerEvents="none"}})}async function W(t,e,n){try{if(!t||"object"!=typeof t)throw new TypeError("options must be an object");z++;const o=await M(t,j);if(!o)throw new Error("Failed to create toast container");const r=await async function(t,e){let n;try{return n=await async function(t,e){const n=document.createElement(t);return n.id=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"toast";const e="string"==typeof t&&t.trim()?t.trim():"toast",n=Date.now().toString(36),o=Math.floor(1048575*Math.random()).toString(36);return"".concat(e,"-").concat(n,"-").concat(o)}(e),n}("div","toast"),await k(n,t,e),n}catch(o){return console.warn("toast creation failed with error showing fallback one: ",o),n=await E(t,e),n}}(t,V);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),o.id.includes("toast-container-")&&(o.appendChild(i),t.stacked&&o.setAttribute("data-stacked","true"),"true"===o.getAttribute("data-stacked")&&D(o));const s=!1!==t.pauseOnHover&&(!0===t.pauseOnHover||!!t.cta),l={outer:i,toast:r,options:t,count:Math.max(1,Math.floor(null!=n?n:0)),pauseOnHover:s};_.set(e,l),r._key=e,l.count>1&&await U(l),l.timer=H(r,t),await F(l)}catch(e){console.error("Something went wrong: ",e),z=Math.max(0,z-1),(document.querySelector('[id^="toast-container-"]')||document.body).appendChild(await E(t,V))}}function q(){for(const t of B){const e=r(t,2)[1];null!=e&&e.rafId&&cancelAnimationFrame(e.rafId)}B.clear(),P.length=0;for(const p of _){var t,e,n,o,i,a,s,l,c,u,d;const m=r(p,2)[1];null===(t=m.timer)||void 0===t||t.clear(),null===(e=m.outer)||void 0===e||null===(n=e._pauseCleanup)||void 0===n||n.call(e),null===(o=m.toast)||void 0===o||null===(i=o._cleanupCloseButton)||void 0===i||i.call(o),null===(a=m.toast)||void 0===a||null===(s=a._cleanupCTA)||void 0===s||s.call(a),null===(l=m.toast)||void 0===l||null===(c=l._cleanupSwipe)||void 0===c||c.call(l),null===(u=m.toast)||void 0===u||null===(d=u._cleanup)||void 0===d||d.call(u)}_.clear(),z=0}const R=async function(){try{if(0===_.size){if(B.size>0){const t=r(Array.from(B.entries()).at(-1),2),e=t[0],n=t[1];return null!=n&&n.rafId&&cancelAnimationFrame(n.rafId),void B.delete(e)}return P.length>0?void P.pop():void 0}let t=null;const e=Array.from(_.values());if(e.length>0){const n=e.at(-1);t=n.toast||n.outer&&n.outer.querySelector('[id^="toast-"]')}if(t||document.querySelectorAll('[id^="toast-container-"]').forEach(e=>{const n=Array.from(e.children||[]);if(0===n.length)return;const o=n.at(-1);o&&(t=o.querySelector('[id^="toast-"]')||o)}),!t)return;const n=t._key?t:t.querySelector('[id^="toast-"]')||t;await V(n)}catch(t){console.error("dismissMostRecent failed:",t)}};function H(t,e){const n=Number(null==e?void 0:e.duration),o=Number.isFinite(n)&&n>0?n:2500,r=new N(async()=>await V(t),o+5);return r.start(),r}async function F(t){if(!t.pauseOnHover||!t.outer||!t.timer)return;const e=t.outer,n=t.timer,o=t.toast,r=()=>{var t;n.pause(),null==o||null===(t=o._progressAnimation)||void 0===t||t.pause()},i=()=>{var t;n.resume(),null==o||null===(t=o._progressAnimation)||void 0===t||t.play()},a=t=>{var e;t.target.matches("[tabindex], div, span, button, a")&&(n.pause(),null==o||null===(e=o._progressAnimation)||void 0===e||e.pause())},s=t=>{var r;e.contains(t.relatedTarget)||(n.resume(),null==o||null===(r=o._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 V(t){if(null!=t&&t._key)return X(t._key)}async function X(t){try{var e,n,o,r,i,a,s,l,c,u,d,p,m,f,h,y,g;if(!t)return;const b=B.get(t);if(b)return cancelAnimationFrame(b.rafId),void B.delete(t);const v=P.findIndex(e=>e.key===t);if(-1!==v)return void P.splice(v,1);const w=_.get(t);if(!w)return;null===(e=w.timer)||void 0===e||e.clear(),null===(n=w.outer)||void 0===n||null===(o=n._pauseCleanup)||void 0===o||o.call(n),null===(r=w.toast)||void 0===r||null===(i=r._cleanupCloseButton)||void 0===i||i.call(r),null===(a=w.toast)||void 0===a||null===(s=a._cleanupCTA)||void 0===s||s.call(a),null===(l=w.toast)||void 0===l||null===(c=l._cleanupSwipe)||void 0===c||c.call(l),null===(u=w.toast)||void 0===u||null===(d=u._cleanup)||void 0===d||d.call(u);const x=null===(p=w.toast)||void 0===p?void 0:p.querySelector("button, a");null==x||null===(m=x._cleanup)||void 0===m||m.call(x),_.delete(t),z=Math.max(0,z-1);const C=w.outer.querySelector(".toast-count-badge");C&&C.remove();const k=null!==(f=null===(h=w.toast)||void 0===h?void 0:h._animationDuration)&&void 0!==f?f:400;w.toast&&(w.toast.style.opacity="0",w.toast.style.transform="translateY(20px)");const E=null===(y=w.outer)||void 0===y?void 0:y.parentElement;if(await async function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:400;return t?new Promise(o=>{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(t){}try{if(t.parentNode)return t.parentNode.removeChild(t),!0}catch(t){}}(t),o())},a=e||t.firstElementChild||t;if(!a)return o();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)}},n+100)}):Promise.resolve()}(w.outer,w.toast,k),E&&0===E.children.length&&null!==(g=E.id)&&void 0!==g&&g.startsWith("toast-container-"))try{E.remove()}catch(t){}else E&&"true"===E.getAttribute("data-stacked")&&D(E);await Y()}catch(t){console.error("Closing Toast failed!: ",t)}}async function Y(){for(;z<3&&P.length;){const t=P.shift();if(_.has(t.key)){const e=_.get(t.key);e.count+=t.count,await U(e);continue}W(t.options,t.key,t.count)}}async function U(t){let e=t.outer,n=t.count;if(!(e&&e instanceof HTMLElement))throw new Error("updateBadge: outer must be a valid HTMLElement");if(n<2){const t=e.querySelector(".toast-count-badge");return void(t&&t.remove())}let o=e.querySelector(".toast-count-badge");o||(o=document.createElement("span"),o.className="toast-count-badge",o.setAttribute("aria-label","".concat(n," 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"}),e.appendChild(o)),o.textContent=n>99?"99+":String(n);try{o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",150)}catch(t){console.error("updateBadge animation error:",t)}}async function G(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!=typeof e||null===e)return;if(B.has(t)){const n=B.get(t);return void(n.options=o(o({},n.options),e))}const n=P.find(e=>e.key===t);if(n)return void(n.options=o(o({},n.options),e));const r=_.get(t);if(!r||!r.toast)return;r.options=o(o({},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){var s;const t=String(null!==(s=e.message)&&void 0!==s?s:""),n=void 0!==e.allowHtml?Boolean(e.allowHtml):Boolean(r.options.allowHtml);if(a){const o=a.querySelector(".toast-loader");if(a.innerHTML="",o&&!1!==e.showLoader&&null!==e.loader){a.appendChild(o);const t=document.createElement("span");t.style.display="inline-block",t.style.width="8px",a.appendChild(t)}if(n&&t.trim().length>0)try{const e=h(t),n=document.createElement("div");for(n.innerHTML=e;n.firstChild;)a.appendChild(n.firstChild)}catch(e){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=y(e.loader||{});a.insertBefore(t,a.firstChild);const n=document.createElement("span");n.style.display="inline-block",n.style.width="8px",a.insertBefore(n,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-".concat(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=l(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 n=i.querySelector(".toast-progress-bar");if(n||!e.showProgressBar&&!r.options.showProgressBar||(g(i,o(o({},r.options),e)),n=i.querySelector(".toast-progress-bar")),n){if(i._progressAnimation){try{i._progressAnimation.cancel()}catch(t){}i._progressAnimation=null}n.style.transition="width 200ms ease",n.style.width="".concat(t,"%")}}else if(!1===e.showProgressBar){const t=i.querySelector(".toast-progress-bar");t&&t.remove()}if(void 0!==e.duration){var c;null===(c=r.timer)||void 0===c||c.clear();const t=Number(e.duration);Number.isFinite(t)&&t>0&&(r.timer=H(i,{duration:t}))}e.sound&&w("string"==typeof e.sound?e.sound:e.type||r.options.type||"info");const u=i.closest('[id^="toast-container-"]');u&&"true"===u.getAttribute("data-stacked")&&D(u)}let $={success:"#28a745",error:"#dc3545",warning:"#ffc107",info:"#17a2b8"},K={success:"Operation completed successfully!",error:"Something went wrong!",warning:"Warning message!",info:"Information message!"},J=!1,Q=null;async function Z(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const e=await async function(t){var e,n;const r=null==t||null===(e=t.position)||void 0===e||null===(e=e.toLowerCase())||void 0===e?void 0:e.trim(),i=o(o({},{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!=r&&r.includes("top-full-width")||null!=r&&r.includes("bottom-full-width")?"100vw":"400px"}),"object"!=typeof t||Array.isArray(t)?{}:t);i.message=null!==(n=null==t?void 0:t.message)&&void 0!==n?n:i.message;try{var a,s;i.backgroundColor||(i.backgroundColor=null!==(a=null===(s=$)||void 0===s?void 0:s[i.type])&&void 0!==a?a:window.matchMedia("(prefers-color-scheme: dark)").matches?"#f5f5f5":"#111111")}catch(t){console.warn("Background color resolution failed:",t)}try{var c;i.message=i.message||(null===(c=K)||void 0===c?void 0:c[i.type])||"No Message Provided!"}catch(t){console.warn("Default message resolution failed:",t)}try{!i.textColor&&i.backgroundColor&&(i.textColor=l(i.backgroundColor))}catch(t){console.warn("Text color resolution failed:",t)}try{!i.progressColor&&i.backgroundColor&&(i.progressColor=i.textColor||l(i.backgroundColor))}catch(t){console.warn("Progress bar color resolution failed:",t)}return"string"!=typeof i.message&&(i.message="No Message Provided!"),i}(t);return await async function(t){try{return await M(t,j)}catch(t){return console.error("Failed to create toast container:",t),document.body}}(e),await async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t&&"object"==typeof t?t:{},n=String(e.type||"info").trim().toLowerCase(),o=function(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n);return e>>>0}(String(e.message||"")).toString(16),r=S(e.position||"bottom-right");return"".concat(n,"|").concat(o,"|").concat(r)}(t);if(_.has(e)){const n=_.get(e);if(!n)throw new Error("Active toast with key ".concat(e," not found"));return n.count++,n.timer.clear(),n.timer=H(n.toast,t),await F(n),await U(n),e}if(B.has(e)){const t=B.get(e);if(!t)throw new Error("Pending toast with key ".concat(e," not found"));return t.count++,e}const n={options:t,count:1,rafId:0};return B.set(e,n),n.rafId=requestAnimationFrame(async()=>{const t=B.get(e);if(t){if(B.delete(e),z>=3)return P.push({options:t.options,key:e,count:t.count}),void await Y();try{await W(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 tt(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const n=["success","error","warning","info"],i={};for(const o of Object.entries(t)){var e=r(o,2);const t=e[0],a=e[1];n.includes(t)&&"string"==typeof a&&a.trim()&&(i[t]=a.trim())}Object.keys(i).length>0&&($=o(o({},$),i))}}catch(t){console.error("setDefaultColors failed:",t)}}function et(t){try{if(t&&"object"==typeof t&&!Array.isArray(t)){const n=["success","error","warning","info"],i={};for(const o of Object.entries(t)){var e=r(o,2);const t=e[0],a=e[1];n.includes(t)&&"string"==typeof a&&a.trim()&&(i[t]=a.trim())}Object.keys(i).length>0&&(K=o(o({},K),i))}}catch(t){console.error("setDefaultMessages failed:",t)}}let nt=!1,ot=null;async function rt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=await async function(){if(nt&&ot)try{await ot}catch(t){console.warn("Previous close operation failed (continuing anyway):",t)}return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"undefined"!=typeof window&&"undefined"!=typeof document?(await async function(){J||"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?(Q||(Q=new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>{J=!0,t()},{once:!0})})),await Q):J=!0)}(),await Z(t)):(console.warn("ToastNotification: running in non-browser environment, no DOM available."),null)}(t)}();return{dismiss:()=>e?X(e):Promise.resolve(),update:t=>e?G(e,t):Promise.resolve()}}const it=async()=>{nt=!0,ot=(async()=>{try{await R()}finally{nt=!1,ot=null}})(),await ot},at=async()=>{nt=!0,ot=(async()=>{try{await async function(){try{for(const t of B){const e=r(t,2)[1];null!=e&&e.rafId&&cancelAnimationFrame(e.rafId)}B.clear(),P.length=0;const t=Array.from(_.values()).map(t=>t.toast).filter(Boolean);await Promise.allSettled(t.map(async t=>{try{await V(t)}catch(t){console.warn("closeAllToasts: failed to close one toast:",t)}}))}catch(t){console.error("closeAllToasts failed:",t)}}()}finally{nt=!1,ot=null}})(),await ot};async function st(t){var e;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=n&&"object"==typeof n?n:{},a=r&&"object"==typeof r?r:{},s=null!==(e=i.loading)&&void 0!==e?e:"Loading...",l=await rt(o(o({},a),{},{type:"info",message:s,duration:864e5,showProgressBar:!1,pauseOnHover:!1})),c=o(o({},a),{},{pauseOnHover:a.pauseOnHover});try{var u;const e="function"==typeof t?t():t,n=await e;await l.dismiss();const r="function"==typeof i.success?i.success(n):null!==(u=i.success)&&void 0!==u?u:"Done!";return await rt(o(o({},c),{},{type:"success",message:r})),n}catch(t){var d;await l.dismiss();const e="function"==typeof i.error?i.error(t):null!==(d=i.error)&&void 0!==d?d:"Something went wrong.";throw await rt(o(o({},c),{},{type:"error",message:e})),t}}const lt="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{nt=!0,ot=(async()=>{try{await R()}finally{nt=!1,ot=null}})(),await ot}catch(t){console.error("Escape key dismiss failed:",t),nt=!1,ot=null}})()};window.addEventListener("keydown",t,{passive:!0})}try{"undefined"!=typeof window&&(window.customizableToast={version:lt,createToast:rt,setDefaultColors:tt,setDefaultMessages:et,noop:at,dismiss:it,toastPromise:st,updateToastByKey:G,setAudioEnabled:x,isAudioEnabled:C,playTone:w})}catch(t){console.error("Global assignment failed:",t)}export{rt as createToast,it as dismiss,C as isAudioEnabled,at as noop,w as playTone,L as resetContainerRegistry,q as resetToastManager,x as setAudioEnabled,tt as setDefaultColors,et as setDefaultMessages,st as toastPromise,G as updateToastByKey,lt as version};
|
|
16
16
|
//# sourceMappingURL=index.esm.mjs.map
|