@samline/notify 1.0.2 → 2.0.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.
Files changed (84) hide show
  1. package/{LICENSE → LICENSE.md} +2 -2
  2. package/README.md +27 -163
  3. package/dist/_runtime.d.mts +87 -0
  4. package/dist/_runtime.d.ts +87 -0
  5. package/dist/_runtime.js +97 -0
  6. package/dist/_runtime.mjs +83 -0
  7. package/dist/browser/assets-client-B-VVPPYQ.js +114 -0
  8. package/dist/browser/assets-client-CUzxHubR.mjs +108 -0
  9. package/dist/browser/index-client-BBOQyMFk.mjs +173 -0
  10. package/dist/browser/index-client-Czb7hTpD.js +181 -0
  11. package/dist/browser/index.d.mts +134 -0
  12. package/dist/browser/index.d.ts +134 -0
  13. package/dist/browser/index.js +34 -0
  14. package/dist/browser/index.mjs +26 -0
  15. package/dist/browser/render-client-CjcQoukB.js +981 -0
  16. package/dist/browser/render-client-bGRSTd-L.mjs +974 -0
  17. package/dist/core/index.d.mts +68 -0
  18. package/dist/core/index.d.ts +68 -0
  19. package/dist/core/index.js +1 -0
  20. package/dist/core/index.mjs +1 -0
  21. package/dist/index.d.mts +131 -0
  22. package/dist/index.d.ts +131 -0
  23. package/dist/index.js +1240 -0
  24. package/dist/index.mjs +1228 -0
  25. package/dist/react/index.d.mts +158 -0
  26. package/dist/react/index.d.ts +158 -0
  27. package/dist/react/index.js +1116 -0
  28. package/dist/react/index.mjs +1107 -0
  29. package/dist/styles.css +589 -422
  30. package/dist/svelte/assets-client-B-VVPPYQ.js +114 -0
  31. package/dist/svelte/assets-client-CUzxHubR.mjs +108 -0
  32. package/dist/svelte/index-client-DbXbWMIe.js +177 -0
  33. package/dist/svelte/index-client-Dj_WfPK9.mjs +170 -0
  34. package/dist/svelte/index.d.mts +14 -0
  35. package/dist/svelte/index.d.ts +14 -0
  36. package/dist/svelte/index.js +43 -0
  37. package/dist/svelte/index.mjs +36 -0
  38. package/dist/svelte/render-client-CjcQoukB.js +981 -0
  39. package/dist/svelte/render-client-bGRSTd-L.mjs +974 -0
  40. package/dist/vue/assets-client-B-VVPPYQ.js +114 -0
  41. package/dist/vue/assets-client-CUzxHubR.mjs +108 -0
  42. package/dist/vue/index-client-DbXbWMIe.js +177 -0
  43. package/dist/vue/index-client-Dj_WfPK9.mjs +170 -0
  44. package/dist/vue/index.d.mts +50 -0
  45. package/dist/vue/index.d.ts +50 -0
  46. package/dist/vue/index.js +110 -0
  47. package/dist/vue/index.mjs +104 -0
  48. package/dist/vue/render-client-CjcQoukB.js +981 -0
  49. package/dist/vue/render-client-bGRSTd-L.mjs +974 -0
  50. package/package.json +140 -95
  51. package/dist/browser-notify.js +0 -68
  52. package/dist/cc-2Yt7NqMX.mjs +0 -21
  53. package/dist/cc-B6peeNak.mjs +0 -33
  54. package/dist/cc-BWuAzFJ6.js +0 -12
  55. package/dist/cc-CaBHsjUt.js +0 -34
  56. package/dist/cc-DGff5sSY.js +0 -21
  57. package/dist/cc-he3fHS3P.mjs +0 -12
  58. package/dist/notify.d.mts +0 -48
  59. package/dist/notify.d.mts.map +0 -1
  60. package/dist/notify.d.ts +0 -48
  61. package/dist/notify.d.ts.map +0 -1
  62. package/dist/notify.js +0 -206
  63. package/dist/notify.mjs +0 -202
  64. package/dist/react-notify-12s--2JK5UjB.mjs +0 -1244
  65. package/dist/react-notify-12s-Kv2M6zlv.js +0 -1247
  66. package/dist/react.d.mts +0 -70
  67. package/dist/react.d.mts.map +0 -1
  68. package/dist/react.d.ts +0 -70
  69. package/dist/react.d.ts.map +0 -1
  70. package/dist/react.js +0 -19
  71. package/dist/react.mjs +0 -10
  72. package/dist/render-notify-toasts.js +0 -213
  73. package/dist/svelte.d.mts +0 -49
  74. package/dist/svelte.d.mts.map +0 -1
  75. package/dist/svelte.d.ts +0 -49
  76. package/dist/svelte.d.ts.map +0 -1
  77. package/dist/svelte.js +0 -284
  78. package/dist/svelte.mjs +0 -280
  79. package/dist/vue.d.mts +0 -107
  80. package/dist/vue.d.mts.map +0 -1
  81. package/dist/vue.d.ts +0 -107
  82. package/dist/vue.d.ts.map +0 -1
  83. package/dist/vue.js +0 -2215
  84. package/dist/vue.mjs +0 -2211
package/dist/index.js ADDED
@@ -0,0 +1,1240 @@
1
+ 'use client';
2
+ function __insertCSS(code) {
3
+ if (!code || typeof document == 'undefined') return
4
+ let head = document.head || document.getElementsByTagName('head')[0]
5
+ let style = document.createElement('style')
6
+ style.type = 'text/css'
7
+ head.appendChild(style)
8
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))
9
+ }
10
+
11
+ Object.defineProperty(exports, '__esModule', { value: true });
12
+
13
+ var React = require('react');
14
+ var client = require('react-dom/client');
15
+ var ReactDOM = require('react-dom');
16
+
17
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
+
19
+ var React__default = /*#__PURE__*/_interopDefault(React);
20
+ var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
21
+
22
+ // Visible toasts amount
23
+ const VISIBLE_TOASTS_AMOUNT = 3;
24
+ // Viewport padding
25
+ const VIEWPORT_OFFSET = '24px';
26
+ // Mobile viewport padding
27
+ const MOBILE_VIEWPORT_OFFSET = '16px';
28
+ // Default lifetime of a toasts (in ms)
29
+ const TOAST_LIFETIME = 4000;
30
+ // Default toast width
31
+ const TOAST_WIDTH = 356;
32
+ // Default gap between toasts
33
+ const GAP = 14;
34
+ // Threshold to dismiss a toast
35
+ const SWIPE_THRESHOLD = 45;
36
+ // Equal to exit animation duration
37
+ const TIME_BEFORE_UNMOUNT = 200;
38
+ function cn(...classes) {
39
+ return classes.filter(Boolean).join(' ');
40
+ }
41
+ function canUseDOM() {
42
+ return typeof window !== 'undefined' && typeof document !== 'undefined';
43
+ }
44
+ function getDefaultSwipeDirections(position) {
45
+ const [y, x] = position.split('-');
46
+ const directions = [];
47
+ if (y) {
48
+ directions.push(y);
49
+ }
50
+ if (x) {
51
+ directions.push(x);
52
+ }
53
+ return directions;
54
+ }
55
+ function getDocumentDirection() {
56
+ if (!canUseDOM()) return 'ltr';
57
+ const dirAttribute = document.documentElement.getAttribute('dir');
58
+ if (dirAttribute === 'auto' || !dirAttribute) {
59
+ return window.getComputedStyle(document.documentElement).direction;
60
+ }
61
+ return dirAttribute;
62
+ }
63
+ function assignOffset(defaultOffset, mobileOffset) {
64
+ const styles = {};
65
+ [
66
+ defaultOffset,
67
+ mobileOffset
68
+ ].forEach((offset, index)=>{
69
+ const isMobile = index === 1;
70
+ const prefix = isMobile ? '--mobile-offset' : '--offset';
71
+ const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
72
+ function assignAll(value) {
73
+ [
74
+ 'top',
75
+ 'right',
76
+ 'bottom',
77
+ 'left'
78
+ ].forEach((key)=>{
79
+ styles[`${prefix}-${key}`] = typeof value === 'number' ? `${value}px` : value;
80
+ });
81
+ }
82
+ if (typeof offset === 'number' || typeof offset === 'string') {
83
+ assignAll(offset);
84
+ } else if (typeof offset === 'object') {
85
+ [
86
+ 'top',
87
+ 'right',
88
+ 'bottom',
89
+ 'left'
90
+ ].forEach((key)=>{
91
+ if (offset[key] === undefined) {
92
+ styles[`${prefix}-${key}`] = defaultValue;
93
+ } else {
94
+ styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key];
95
+ }
96
+ });
97
+ } else {
98
+ assignAll(defaultValue);
99
+ }
100
+ });
101
+ return styles;
102
+ }
103
+
104
+ let toastsCounter = 1;
105
+ class Observer {
106
+ constructor(){
107
+ // We use arrow functions to maintain the correct `this` reference
108
+ this.subscribe = (subscriber)=>{
109
+ this.subscribers.push(subscriber);
110
+ return ()=>{
111
+ const index = this.subscribers.indexOf(subscriber);
112
+ this.subscribers.splice(index, 1);
113
+ };
114
+ };
115
+ this.publish = (data)=>{
116
+ this.subscribers.forEach((subscriber)=>subscriber(data));
117
+ };
118
+ this.addToast = (data)=>{
119
+ this.publish(data);
120
+ this.toasts = [
121
+ ...this.toasts,
122
+ data
123
+ ];
124
+ };
125
+ this.create = (data)=>{
126
+ const { message, ...rest } = data;
127
+ const id = typeof data?.id === 'number' || data.id?.length > 0 ? data.id : toastsCounter++;
128
+ const alreadyExists = this.toasts.find((toast)=>{
129
+ return toast.id === id;
130
+ });
131
+ const dismissible = data.dismissible === undefined ? true : data.dismissible;
132
+ if (this.dismissedToasts.has(id)) {
133
+ this.dismissedToasts.delete(id);
134
+ }
135
+ if (alreadyExists) {
136
+ this.toasts = this.toasts.map((toast)=>{
137
+ if (toast.id === id) {
138
+ this.publish({
139
+ ...toast,
140
+ ...data,
141
+ id,
142
+ title: message
143
+ });
144
+ return {
145
+ ...toast,
146
+ ...data,
147
+ id,
148
+ dismissible,
149
+ title: message
150
+ };
151
+ }
152
+ return toast;
153
+ });
154
+ } else {
155
+ this.addToast({
156
+ title: message,
157
+ ...rest,
158
+ dismissible,
159
+ id
160
+ });
161
+ }
162
+ return id;
163
+ };
164
+ this.dismiss = (id)=>{
165
+ if (id) {
166
+ this.dismissedToasts.add(id);
167
+ requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
168
+ id,
169
+ dismiss: true
170
+ })));
171
+ } else {
172
+ this.toasts.forEach((toast)=>{
173
+ this.subscribers.forEach((subscriber)=>subscriber({
174
+ id: toast.id,
175
+ dismiss: true
176
+ }));
177
+ });
178
+ }
179
+ return id;
180
+ };
181
+ this.message = (message, data)=>{
182
+ return this.create({
183
+ ...data,
184
+ message
185
+ });
186
+ };
187
+ this.error = (message, data)=>{
188
+ return this.create({
189
+ ...data,
190
+ message,
191
+ type: 'error'
192
+ });
193
+ };
194
+ this.success = (message, data)=>{
195
+ return this.create({
196
+ ...data,
197
+ type: 'success',
198
+ message
199
+ });
200
+ };
201
+ this.info = (message, data)=>{
202
+ return this.create({
203
+ ...data,
204
+ type: 'info',
205
+ message
206
+ });
207
+ };
208
+ this.warning = (message, data)=>{
209
+ return this.create({
210
+ ...data,
211
+ type: 'warning',
212
+ message
213
+ });
214
+ };
215
+ this.loading = (message, data)=>{
216
+ return this.create({
217
+ ...data,
218
+ type: 'loading',
219
+ message
220
+ });
221
+ };
222
+ this.promise = (promise, data)=>{
223
+ if (!data) {
224
+ // Nothing to show
225
+ return;
226
+ }
227
+ let id = undefined;
228
+ if (data.loading !== undefined) {
229
+ id = this.create({
230
+ ...data,
231
+ promise,
232
+ type: 'loading',
233
+ message: data.loading,
234
+ description: typeof data.description !== 'function' ? data.description : undefined
235
+ });
236
+ }
237
+ const p = Promise.resolve(promise instanceof Function ? promise() : promise);
238
+ let shouldDismiss = id !== undefined;
239
+ let result;
240
+ const originalPromise = p.then(async (response)=>{
241
+ result = [
242
+ 'resolve',
243
+ response
244
+ ];
245
+ const isReactElementResponse = React__default.default.isValidElement(response);
246
+ if (isReactElementResponse) {
247
+ shouldDismiss = false;
248
+ this.create({
249
+ id,
250
+ type: 'default',
251
+ message: response
252
+ });
253
+ } else if (isHttpResponse(response) && !response.ok) {
254
+ shouldDismiss = false;
255
+ const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
256
+ const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
257
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
258
+ const toastSettings = isExtendedResult ? promiseData : {
259
+ message: promiseData
260
+ };
261
+ this.create({
262
+ id,
263
+ type: 'error',
264
+ description,
265
+ ...toastSettings
266
+ });
267
+ } else if (response instanceof Error) {
268
+ shouldDismiss = false;
269
+ const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
270
+ const description = typeof data.description === 'function' ? await data.description(response) : data.description;
271
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
272
+ const toastSettings = isExtendedResult ? promiseData : {
273
+ message: promiseData
274
+ };
275
+ this.create({
276
+ id,
277
+ type: 'error',
278
+ description,
279
+ ...toastSettings
280
+ });
281
+ } else if (data.success !== undefined) {
282
+ shouldDismiss = false;
283
+ const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
284
+ const description = typeof data.description === 'function' ? await data.description(response) : data.description;
285
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
286
+ const toastSettings = isExtendedResult ? promiseData : {
287
+ message: promiseData
288
+ };
289
+ this.create({
290
+ id,
291
+ type: 'success',
292
+ description,
293
+ ...toastSettings
294
+ });
295
+ }
296
+ }).catch(async (error)=>{
297
+ result = [
298
+ 'reject',
299
+ error
300
+ ];
301
+ if (data.error !== undefined) {
302
+ shouldDismiss = false;
303
+ const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
304
+ const description = typeof data.description === 'function' ? await data.description(error) : data.description;
305
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
306
+ const toastSettings = isExtendedResult ? promiseData : {
307
+ message: promiseData
308
+ };
309
+ this.create({
310
+ id,
311
+ type: 'error',
312
+ description,
313
+ ...toastSettings
314
+ });
315
+ }
316
+ }).finally(()=>{
317
+ if (shouldDismiss) {
318
+ // Toast is still in load state (and will be indefinitely — dismiss it)
319
+ this.dismiss(id);
320
+ id = undefined;
321
+ }
322
+ data.finally?.();
323
+ });
324
+ const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
325
+ if (typeof id !== 'string' && typeof id !== 'number') {
326
+ // cannot Object.assign on undefined
327
+ return {
328
+ unwrap
329
+ };
330
+ } else {
331
+ return Object.assign(id, {
332
+ unwrap
333
+ });
334
+ }
335
+ };
336
+ this.custom = (jsx, data)=>{
337
+ const id = data?.id || toastsCounter++;
338
+ this.create({
339
+ jsx: jsx(id),
340
+ ...data,
341
+ id
342
+ });
343
+ return id;
344
+ };
345
+ this.getActiveToasts = ()=>{
346
+ return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
347
+ };
348
+ this.subscribers = [];
349
+ this.toasts = [];
350
+ this.dismissedToasts = new Set();
351
+ }
352
+ }
353
+ const ToastState = new Observer();
354
+ // bind this to the toast function
355
+ const toastFunction = (message, data)=>{
356
+ return ToastState.create({
357
+ ...data,
358
+ message
359
+ });
360
+ };
361
+ const isHttpResponse = (data)=>{
362
+ return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
363
+ };
364
+ const basicToast = toastFunction;
365
+ const getHistory = ()=>ToastState.toasts;
366
+ const getToasts = ()=>ToastState.getActiveToasts();
367
+ // We use `Object.assign` to maintain the correct types as we would lose them otherwise
368
+ const toast$1 = Object.assign(basicToast, {
369
+ success: ToastState.success,
370
+ info: ToastState.info,
371
+ warning: ToastState.warning,
372
+ error: ToastState.error,
373
+ custom: ToastState.custom,
374
+ message: ToastState.message,
375
+ promise: ToastState.promise,
376
+ dismiss: ToastState.dismiss,
377
+ loading: ToastState.loading
378
+ }, {
379
+ getHistory,
380
+ getToasts
381
+ });
382
+
383
+ const getAsset = (type)=>{
384
+ switch(type){
385
+ case 'success':
386
+ return SuccessIcon;
387
+ case 'info':
388
+ return InfoIcon;
389
+ case 'warning':
390
+ return WarningIcon;
391
+ case 'error':
392
+ return ErrorIcon;
393
+ default:
394
+ return null;
395
+ }
396
+ };
397
+ const bars = Array(12).fill(0);
398
+ const Loader = ({ visible, className })=>{
399
+ return /*#__PURE__*/ React__default.default.createElement("div", {
400
+ className: [
401
+ 'notify-loading-wrapper',
402
+ className
403
+ ].filter(Boolean).join(' '),
404
+ "data-visible": visible
405
+ }, /*#__PURE__*/ React__default.default.createElement("div", {
406
+ className: "notify-spinner"
407
+ }, bars.map((_, i)=>/*#__PURE__*/ React__default.default.createElement("div", {
408
+ className: "notify-loading-bar",
409
+ key: `spinner-bar-${i}`
410
+ }))));
411
+ };
412
+ const SuccessIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
413
+ xmlns: "http://www.w3.org/2000/svg",
414
+ viewBox: "0 0 20 20",
415
+ fill: "currentColor",
416
+ height: "20",
417
+ width: "20"
418
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
419
+ fillRule: "evenodd",
420
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
421
+ clipRule: "evenodd"
422
+ }));
423
+ const WarningIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
424
+ xmlns: "http://www.w3.org/2000/svg",
425
+ viewBox: "0 0 24 24",
426
+ fill: "currentColor",
427
+ height: "20",
428
+ width: "20"
429
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
430
+ fillRule: "evenodd",
431
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
432
+ clipRule: "evenodd"
433
+ }));
434
+ const InfoIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
435
+ xmlns: "http://www.w3.org/2000/svg",
436
+ viewBox: "0 0 20 20",
437
+ fill: "currentColor",
438
+ height: "20",
439
+ width: "20"
440
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
441
+ fillRule: "evenodd",
442
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
443
+ clipRule: "evenodd"
444
+ }));
445
+ const ErrorIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
446
+ xmlns: "http://www.w3.org/2000/svg",
447
+ viewBox: "0 0 20 20",
448
+ fill: "currentColor",
449
+ height: "20",
450
+ width: "20"
451
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
452
+ fillRule: "evenodd",
453
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
454
+ clipRule: "evenodd"
455
+ }));
456
+ const CloseIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
457
+ xmlns: "http://www.w3.org/2000/svg",
458
+ width: "12",
459
+ height: "12",
460
+ viewBox: "0 0 24 24",
461
+ fill: "none",
462
+ stroke: "currentColor",
463
+ strokeWidth: "1.5",
464
+ strokeLinecap: "round",
465
+ strokeLinejoin: "round"
466
+ }, /*#__PURE__*/ React__default.default.createElement("line", {
467
+ x1: "18",
468
+ y1: "6",
469
+ x2: "6",
470
+ y2: "18"
471
+ }), /*#__PURE__*/ React__default.default.createElement("line", {
472
+ x1: "6",
473
+ y1: "6",
474
+ x2: "18",
475
+ y2: "18"
476
+ }));
477
+
478
+ const useIsDocumentHidden = ()=>{
479
+ const [isDocumentHidden, setIsDocumentHidden] = React__default.default.useState(document.hidden);
480
+ React__default.default.useEffect(()=>{
481
+ const callback = ()=>{
482
+ setIsDocumentHidden(document.hidden);
483
+ };
484
+ document.addEventListener('visibilitychange', callback);
485
+ return ()=>document.removeEventListener('visibilitychange', callback);
486
+ }, []);
487
+ return isDocumentHidden;
488
+ };
489
+
490
+ __insertCSS("[data-notify-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-notify-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-notify-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-notify-toaster][data-lifted=true]{transform:none}}[data-notify-toaster][data-x-position=right]{right:var(--offset-right)}[data-notify-toaster][data-x-position=left]{left:var(--offset-left)}[data-notify-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-notify-toaster][data-y-position=top]{top:var(--offset-top)}[data-notify-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-notify-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-notify-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-notify-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-notify-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-notify-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-notify-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-notify-toast][data-styled=true] [data-description]{color:inherit}[data-notify-toaster][data-notify-theme=dark] [data-description]{color:#e8e8e8}[data-notify-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-notify-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-notify-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:notify-fade-in .3s ease forwards}[data-notify-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-notify-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-notify-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-notify-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-notify-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-notify-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-notify-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-notify-toaster][data-notify-theme=dark] [data-notify-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-notify-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-notify-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-notify-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-notify-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-notify-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-notify-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-notify-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-notify-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-notify-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-notify-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-notify-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-notify-toast]>*{transition:opacity .4s}[data-notify-toast][data-x-position=right]{right:0}[data-notify-toast][data-x-position=left]{left:0}[data-notify-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-notify-toast][data-visible=false]{opacity:0;pointer-events:none}[data-notify-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-notify-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-notify-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-notify-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-notify-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-notify-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-notify-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-notify-toast][data-swipe-out=true][data-y-position=bottom],[data-notify-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-notify-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-notify-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-notify-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-notify-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-notify-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-notify-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-notify-toaster] [data-notify-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-notify-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-notify-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-notify-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-notify-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-notify-toaster][data-notify-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-notify-toaster][data-notify-theme=light] [data-notify-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-notify-toaster][data-notify-theme=dark] [data-notify-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-notify-toaster][data-notify-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-notify-toaster][data-notify-theme=dark] [data-notify-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-notify-toaster][data-notify-theme=dark] [data-notify-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-notify-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-notify-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-notify-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-notify-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-notify-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-notify-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-notify-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-notify-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.notify-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.notify-loading-wrapper[data-visible=false]{transform-origin:center;animation:notify-fade-out .2s ease forwards}.notify-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.notify-loading-bar{animation:notify-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.notify-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.notify-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.notify-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.notify-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.notify-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.notify-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.notify-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.notify-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.notify-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.notify-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.notify-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.notify-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes notify-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes notify-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes notify-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.notify-loading-bar,[data-notify-toast],[data-notify-toast]>*{transition:none!important;animation:none!important}}.notify-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.notify-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
491
+
492
+ function isAction(action) {
493
+ return action.label !== undefined;
494
+ }
495
+
496
+ const Toast = (props)=>{
497
+ const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props;
498
+ const [swipeDirection, setSwipeDirection] = React__default.default.useState(null);
499
+ const [swipeOutDirection, setSwipeOutDirection] = React__default.default.useState(null);
500
+ const [mounted, setMounted] = React__default.default.useState(false);
501
+ const [removed, setRemoved] = React__default.default.useState(false);
502
+ const [swiping, setSwiping] = React__default.default.useState(false);
503
+ const [swipeOut, setSwipeOut] = React__default.default.useState(false);
504
+ const [isSwiped, setIsSwiped] = React__default.default.useState(false);
505
+ const [offsetBeforeRemove, setOffsetBeforeRemove] = React__default.default.useState(0);
506
+ const [initialHeight, setInitialHeight] = React__default.default.useState(0);
507
+ const remainingTime = React__default.default.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);
508
+ const dragStartTime = React__default.default.useRef(null);
509
+ const toastRef = React__default.default.useRef(null);
510
+ const isFront = index === 0;
511
+ const isVisible = index + 1 <= visibleToasts;
512
+ const toastType = toast.type;
513
+ const dismissible = toast.dismissible !== false;
514
+ const toastClassname = toast.className || '';
515
+ const toastDescriptionClassname = toast.descriptionClassName || '';
516
+ const heightIndex = React__default.default.useMemo(()=>heights.findIndex((height)=>height.toastId === toast.id) || 0, [
517
+ heights,
518
+ toast.id
519
+ ]);
520
+ const closeButton = React__default.default.useMemo(()=>toast.closeButton ?? closeButtonFromToaster, [
521
+ toast.closeButton,
522
+ closeButtonFromToaster
523
+ ]);
524
+ const duration = React__default.default.useMemo(()=>toast.duration || durationFromToaster || TOAST_LIFETIME, [
525
+ toast.duration,
526
+ durationFromToaster
527
+ ]);
528
+ const closeTimerStartTimeRef = React__default.default.useRef(0);
529
+ const offset = React__default.default.useRef(0);
530
+ const lastCloseTimerStartTimeRef = React__default.default.useRef(0);
531
+ const pointerStartRef = React__default.default.useRef(null);
532
+ const [y, x] = position.split('-');
533
+ const toastsHeightBefore = React__default.default.useMemo(()=>{
534
+ return heights.reduce((prev, curr, reducerIndex)=>{
535
+ if (reducerIndex >= heightIndex) {
536
+ return prev;
537
+ }
538
+ return prev + curr.height;
539
+ }, 0);
540
+ }, [
541
+ heights,
542
+ heightIndex
543
+ ]);
544
+ const isDocumentHidden = useIsDocumentHidden();
545
+ const invert = toast.invert || ToasterInvert;
546
+ const disabled = toastType === 'loading';
547
+ offset.current = React__default.default.useMemo(()=>heightIndex * gap + toastsHeightBefore, [
548
+ heightIndex,
549
+ toastsHeightBefore
550
+ ]);
551
+ React__default.default.useEffect(()=>{
552
+ remainingTime.current = duration;
553
+ }, [
554
+ duration
555
+ ]);
556
+ React__default.default.useEffect(()=>{
557
+ setMounted(true);
558
+ }, []);
559
+ React__default.default.useEffect(()=>{
560
+ const toastNode = toastRef.current;
561
+ if (toastNode) {
562
+ const height = toastNode.getBoundingClientRect().height;
563
+ setInitialHeight(height);
564
+ setHeights((h)=>[
565
+ {
566
+ toastId: toast.id,
567
+ height,
568
+ position: toast.position
569
+ },
570
+ ...h
571
+ ]);
572
+ return ()=>setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
573
+ }
574
+ }, [
575
+ setHeights,
576
+ toast.id
577
+ ]);
578
+ React__default.default.useLayoutEffect(()=>{
579
+ if (!mounted) return;
580
+ const toastNode = toastRef.current;
581
+ const originalHeight = toastNode.style.height;
582
+ toastNode.style.height = 'auto';
583
+ const newHeight = toastNode.getBoundingClientRect().height;
584
+ toastNode.style.height = originalHeight;
585
+ setInitialHeight(newHeight);
586
+ setHeights((currentHeights)=>{
587
+ const alreadyExists = currentHeights.find((height)=>height.toastId === toast.id);
588
+ if (!alreadyExists) {
589
+ return [
590
+ {
591
+ toastId: toast.id,
592
+ height: newHeight,
593
+ position: toast.position
594
+ },
595
+ ...currentHeights
596
+ ];
597
+ }
598
+ return currentHeights.map((height)=>height.toastId === toast.id ? {
599
+ ...height,
600
+ height: newHeight
601
+ } : height);
602
+ });
603
+ }, [
604
+ mounted,
605
+ toast.title,
606
+ toast.description,
607
+ setHeights,
608
+ toast.id,
609
+ toast.jsx,
610
+ toast.action,
611
+ toast.cancel
612
+ ]);
613
+ const deleteToast = React__default.default.useCallback(()=>{
614
+ setRemoved(true);
615
+ setOffsetBeforeRemove(offset.current);
616
+ setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
617
+ setTimeout(()=>{
618
+ removeToast(toast);
619
+ }, TIME_BEFORE_UNMOUNT);
620
+ }, [
621
+ toast,
622
+ removeToast,
623
+ setHeights,
624
+ offset
625
+ ]);
626
+ React__default.default.useEffect(()=>{
627
+ if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return;
628
+ let timeoutId;
629
+ const pauseTimer = ()=>{
630
+ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
631
+ const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
632
+ remainingTime.current = remainingTime.current - elapsedTime;
633
+ }
634
+ lastCloseTimerStartTimeRef.current = new Date().getTime();
635
+ };
636
+ const startTimer = ()=>{
637
+ if (remainingTime.current === Infinity) return;
638
+ closeTimerStartTimeRef.current = new Date().getTime();
639
+ timeoutId = setTimeout(()=>{
640
+ toast.onAutoClose?.(toast);
641
+ deleteToast();
642
+ }, remainingTime.current);
643
+ };
644
+ if (expanded || interacting || isDocumentHidden) {
645
+ pauseTimer();
646
+ } else {
647
+ startTimer();
648
+ }
649
+ return ()=>clearTimeout(timeoutId);
650
+ }, [
651
+ expanded,
652
+ interacting,
653
+ toast,
654
+ toastType,
655
+ isDocumentHidden,
656
+ deleteToast
657
+ ]);
658
+ React__default.default.useEffect(()=>{
659
+ if (toast.delete) {
660
+ deleteToast();
661
+ toast.onDismiss?.(toast);
662
+ }
663
+ }, [
664
+ deleteToast,
665
+ toast.delete
666
+ ]);
667
+ function getLoadingIcon() {
668
+ if (icons?.loading) {
669
+ return /*#__PURE__*/ React__default.default.createElement("div", {
670
+ className: cn(classNames?.loader, toast?.classNames?.loader, 'notify-loader'),
671
+ "data-visible": toastType === 'loading'
672
+ }, icons.loading);
673
+ }
674
+ return /*#__PURE__*/ React__default.default.createElement(Loader, {
675
+ className: cn(classNames?.loader, toast?.classNames?.loader),
676
+ visible: toastType === 'loading'
677
+ });
678
+ }
679
+ const icon = toast.icon || icons?.[toastType] || getAsset(toastType);
680
+ return /*#__PURE__*/ React__default.default.createElement("li", {
681
+ tabIndex: 0,
682
+ ref: toastRef,
683
+ className: cn(className, toastClassname, classNames?.toast, toast?.classNames?.toast, classNames?.default, classNames?.[toastType], toast?.classNames?.[toastType]),
684
+ "data-notify-toast": "",
685
+ "data-rich-colors": toast.richColors ?? defaultRichColors,
686
+ "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled),
687
+ "data-mounted": mounted,
688
+ "data-promise": Boolean(toast.promise),
689
+ "data-swiped": isSwiped,
690
+ "data-removed": removed,
691
+ "data-visible": isVisible,
692
+ "data-y-position": y,
693
+ "data-x-position": x,
694
+ "data-index": index,
695
+ "data-front": isFront,
696
+ "data-swiping": swiping,
697
+ "data-dismissible": dismissible,
698
+ "data-type": toastType,
699
+ "data-invert": invert,
700
+ "data-swipe-out": swipeOut,
701
+ "data-swipe-direction": swipeOutDirection,
702
+ "data-expanded": Boolean(expanded || expandByDefault && mounted),
703
+ "data-testid": toast.testId,
704
+ style: {
705
+ '--index': index,
706
+ '--toasts-before': index,
707
+ '--z-index': toasts.length - index,
708
+ '--offset': `${removed ? offsetBeforeRemove : offset.current}px`,
709
+ '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`,
710
+ ...style,
711
+ ...toast.style
712
+ },
713
+ onDragEnd: ()=>{
714
+ setSwiping(false);
715
+ setSwipeDirection(null);
716
+ pointerStartRef.current = null;
717
+ },
718
+ onPointerDown: (event)=>{
719
+ if (event.button === 2) return;
720
+ if (disabled || !dismissible) return;
721
+ dragStartTime.current = new Date();
722
+ setOffsetBeforeRemove(offset.current);
723
+ event.target.setPointerCapture(event.pointerId);
724
+ if (event.target.tagName === 'BUTTON') return;
725
+ setSwiping(true);
726
+ pointerStartRef.current = {
727
+ x: event.clientX,
728
+ y: event.clientY
729
+ };
730
+ },
731
+ onPointerUp: ()=>{
732
+ if (swipeOut || !dismissible) return;
733
+ pointerStartRef.current = null;
734
+ const swipeAmountX = Number(toastRef.current?.style.getPropertyValue('--swipe-amount-x').replace('px', '') || 0);
735
+ const swipeAmountY = Number(toastRef.current?.style.getPropertyValue('--swipe-amount-y').replace('px', '') || 0);
736
+ const timeTaken = new Date().getTime() - dragStartTime.current?.getTime();
737
+ const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;
738
+ const velocity = Math.abs(swipeAmount) / timeTaken;
739
+ if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
740
+ setOffsetBeforeRemove(offset.current);
741
+ toast.onDismiss?.(toast);
742
+ if (swipeDirection === 'x') {
743
+ setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');
744
+ } else {
745
+ setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');
746
+ }
747
+ deleteToast();
748
+ setSwipeOut(true);
749
+ return;
750
+ }
751
+ toastRef.current?.style.setProperty('--swipe-amount-x', '0px');
752
+ toastRef.current?.style.setProperty('--swipe-amount-y', '0px');
753
+ setIsSwiped(false);
754
+ setSwiping(false);
755
+ setSwipeDirection(null);
756
+ },
757
+ onPointerMove: (event)=>{
758
+ if (!pointerStartRef.current || !dismissible) return;
759
+ const isHighlighted = window.getSelection()?.toString().length > 0;
760
+ if (isHighlighted) return;
761
+ const yDelta = event.clientY - pointerStartRef.current.y;
762
+ const xDelta = event.clientX - pointerStartRef.current.x;
763
+ const swipeDirections = props.swipeDirections ?? getDefaultSwipeDirections(position);
764
+ if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
765
+ setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');
766
+ }
767
+ let swipeAmount = {
768
+ x: 0,
769
+ y: 0
770
+ };
771
+ const getDampening = (delta)=>{
772
+ const factor = Math.abs(delta) / 20;
773
+ return 1 / (1.5 + factor);
774
+ };
775
+ if (swipeDirection === 'y') {
776
+ if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) {
777
+ if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) {
778
+ swipeAmount.y = yDelta;
779
+ } else {
780
+ const dampenedDelta = yDelta * getDampening(yDelta);
781
+ swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
782
+ }
783
+ }
784
+ } else if (swipeDirection === 'x') {
785
+ if (swipeDirections.includes('left') || swipeDirections.includes('right')) {
786
+ if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) {
787
+ swipeAmount.x = xDelta;
788
+ } else {
789
+ const dampenedDelta = xDelta * getDampening(xDelta);
790
+ swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
791
+ }
792
+ }
793
+ }
794
+ if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
795
+ setIsSwiped(true);
796
+ }
797
+ toastRef.current?.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`);
798
+ toastRef.current?.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`);
799
+ }
800
+ }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ React__default.default.createElement("button", {
801
+ "aria-label": closeButtonAriaLabel,
802
+ "data-disabled": disabled,
803
+ "data-close-button": true,
804
+ onClick: disabled || !dismissible ? ()=>{} : ()=>{
805
+ deleteToast();
806
+ toast.onDismiss?.(toast);
807
+ },
808
+ className: cn(classNames?.closeButton, toast?.classNames?.closeButton)
809
+ }, icons?.close ?? CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && (icons?.[toastType] !== null || toast.icon) ? /*#__PURE__*/ React__default.default.createElement("div", {
810
+ "data-icon": "",
811
+ className: cn(classNames?.icon, toast?.classNames?.icon)
812
+ }, toast.promise || toast.type === 'loading' && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== 'loading' ? icon : null) : null, /*#__PURE__*/ React__default.default.createElement("div", {
813
+ "data-content": "",
814
+ className: cn(classNames?.content, toast?.classNames?.content)
815
+ }, /*#__PURE__*/ React__default.default.createElement("div", {
816
+ "data-title": "",
817
+ className: cn(classNames?.title, toast?.classNames?.title)
818
+ }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ React__default.default.createElement("div", {
819
+ "data-description": "",
820
+ className: cn(descriptionClassName, toastDescriptionClassname, classNames?.description, toast?.classNames?.description)
821
+ }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ React__default.default.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ React__default.default.createElement("button", {
822
+ "data-button": true,
823
+ "data-cancel": true,
824
+ style: toast.cancelButtonStyle || cancelButtonStyle,
825
+ onClick: (event)=>{
826
+ if (!isAction(toast.cancel)) return;
827
+ if (!dismissible) return;
828
+ toast.cancel.onClick?.(event);
829
+ deleteToast();
830
+ },
831
+ className: cn(classNames?.cancelButton, toast?.classNames?.cancelButton)
832
+ }, toast.cancel.label) : null, /*#__PURE__*/ React__default.default.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ React__default.default.createElement("button", {
833
+ "data-button": true,
834
+ "data-action": true,
835
+ style: toast.actionButtonStyle || actionButtonStyle,
836
+ onClick: (event)=>{
837
+ if (!isAction(toast.action)) return;
838
+ toast.action.onClick?.(event);
839
+ if (event.defaultPrevented) return;
840
+ deleteToast();
841
+ },
842
+ className: cn(classNames?.actionButton, toast?.classNames?.actionButton)
843
+ }, toast.action.label) : null);
844
+ };
845
+ const Toaster$1 = /*#__PURE__*/ React__default.default.forwardRef(function Toaster(props, ref) {
846
+ const { id, invert, position = 'bottom-right', hotkey = [
847
+ 'altKey',
848
+ 'KeyT'
849
+ ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, customAriaLabel, containerAriaLabel = 'Notifications' } = props;
850
+ const [toasts, setToasts] = React__default.default.useState([]);
851
+ const filteredToasts = React__default.default.useMemo(()=>{
852
+ if (id) {
853
+ return toasts.filter((toast)=>toast.toasterId === id);
854
+ }
855
+ return toasts.filter((toast)=>!toast.toasterId);
856
+ }, [
857
+ toasts,
858
+ id
859
+ ]);
860
+ const possiblePositions = React__default.default.useMemo(()=>{
861
+ return Array.from(new Set([
862
+ position
863
+ ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
864
+ }, [
865
+ filteredToasts,
866
+ position
867
+ ]);
868
+ const [heights, setHeights] = React__default.default.useState([]);
869
+ const [expanded, setExpanded] = React__default.default.useState(false);
870
+ const [interacting, setInteracting] = React__default.default.useState(false);
871
+ const [actualTheme, setActualTheme] = React__default.default.useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light');
872
+ const listRef = React__default.default.useRef(null);
873
+ const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');
874
+ const lastFocusedElementRef = React__default.default.useRef(null);
875
+ const isFocusWithinRef = React__default.default.useRef(false);
876
+ const removeToast = React__default.default.useCallback((toastToRemove)=>{
877
+ setToasts((currentToasts)=>{
878
+ if (!currentToasts.find((toast)=>toast.id === toastToRemove.id)?.delete) {
879
+ ToastState.dismiss(toastToRemove.id);
880
+ }
881
+ return currentToasts.filter(({ id: toastId })=>toastId !== toastToRemove.id);
882
+ });
883
+ }, []);
884
+ React__default.default.useEffect(()=>{
885
+ return ToastState.subscribe((toast)=>{
886
+ if (toast.dismiss) {
887
+ requestAnimationFrame(()=>{
888
+ setToasts((currentToasts)=>currentToasts.map((t)=>t.id === toast.id ? {
889
+ ...t,
890
+ delete: true
891
+ } : t));
892
+ });
893
+ return;
894
+ }
895
+ setTimeout(()=>{
896
+ ReactDOM__default.default.flushSync(()=>{
897
+ setToasts((currentToasts)=>{
898
+ const indexOfExistingToast = currentToasts.findIndex((t)=>t.id === toast.id);
899
+ if (indexOfExistingToast !== -1) {
900
+ return [
901
+ ...currentToasts.slice(0, indexOfExistingToast),
902
+ {
903
+ ...currentToasts[indexOfExistingToast],
904
+ ...toast
905
+ },
906
+ ...currentToasts.slice(indexOfExistingToast + 1)
907
+ ];
908
+ }
909
+ return [
910
+ toast,
911
+ ...currentToasts
912
+ ];
913
+ });
914
+ });
915
+ });
916
+ });
917
+ }, []);
918
+ React__default.default.useEffect(()=>{
919
+ if (theme !== 'system') {
920
+ setActualTheme(theme);
921
+ return;
922
+ }
923
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
924
+ setActualTheme('dark');
925
+ } else {
926
+ setActualTheme('light');
927
+ }
928
+ if (typeof window === 'undefined') return;
929
+ const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
930
+ try {
931
+ darkMediaQuery.addEventListener('change', ({ matches })=>{
932
+ setActualTheme(matches ? 'dark' : 'light');
933
+ });
934
+ } catch (error) {
935
+ darkMediaQuery.addListener(({ matches })=>{
936
+ try {
937
+ setActualTheme(matches ? 'dark' : 'light');
938
+ } catch (listenerError) {
939
+ console.error(listenerError);
940
+ }
941
+ });
942
+ }
943
+ }, [
944
+ theme
945
+ ]);
946
+ React__default.default.useEffect(()=>{
947
+ if (toasts.length <= 1) {
948
+ setExpanded(false);
949
+ }
950
+ }, [
951
+ toasts
952
+ ]);
953
+ React__default.default.useEffect(()=>{
954
+ const handleKeyDown = (event)=>{
955
+ const isHotkeyPressed = hotkey.length > 0 && hotkey.every((key)=>event[key] || event.code === key);
956
+ if (isHotkeyPressed) {
957
+ setExpanded(true);
958
+ listRef.current?.focus();
959
+ }
960
+ if (event.code === 'Escape' && (document.activeElement === listRef.current || listRef.current?.contains(document.activeElement))) {
961
+ setExpanded(false);
962
+ }
963
+ };
964
+ document.addEventListener('keydown', handleKeyDown);
965
+ return ()=>document.removeEventListener('keydown', handleKeyDown);
966
+ }, [
967
+ hotkey
968
+ ]);
969
+ React__default.default.useEffect(()=>{
970
+ if (listRef.current) {
971
+ return ()=>{
972
+ if (lastFocusedElementRef.current) {
973
+ lastFocusedElementRef.current.focus({
974
+ preventScroll: true
975
+ });
976
+ lastFocusedElementRef.current = null;
977
+ isFocusWithinRef.current = false;
978
+ }
979
+ };
980
+ }
981
+ }, []);
982
+ return /*#__PURE__*/ React__default.default.createElement("section", {
983
+ ref: ref,
984
+ "aria-label": customAriaLabel ?? `${containerAriaLabel} ${hotkeyLabel}`,
985
+ tabIndex: -1,
986
+ "aria-live": "polite",
987
+ "aria-relevant": "additions text",
988
+ "aria-atomic": "false",
989
+ suppressHydrationWarning: true,
990
+ "data-react-aria-top-layer": true
991
+ }, possiblePositions.map((currentPosition, index)=>{
992
+ const [y, x] = currentPosition.split('-');
993
+ if (!filteredToasts.length) return null;
994
+ return /*#__PURE__*/ React__default.default.createElement("ol", {
995
+ key: currentPosition,
996
+ dir: dir === 'auto' ? getDocumentDirection() : dir,
997
+ tabIndex: -1,
998
+ ref: listRef,
999
+ className: className,
1000
+ "data-notify-toaster": true,
1001
+ "data-notify-theme": actualTheme,
1002
+ "data-y-position": y,
1003
+ "data-x-position": x,
1004
+ style: {
1005
+ '--front-toast-height': `${heights[0]?.height || 0}px`,
1006
+ '--width': `${TOAST_WIDTH}px`,
1007
+ '--gap': `${gap}px`,
1008
+ ...style,
1009
+ ...assignOffset(offset, mobileOffset)
1010
+ },
1011
+ onBlur: (event)=>{
1012
+ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
1013
+ isFocusWithinRef.current = false;
1014
+ if (lastFocusedElementRef.current) {
1015
+ lastFocusedElementRef.current.focus({
1016
+ preventScroll: true
1017
+ });
1018
+ lastFocusedElementRef.current = null;
1019
+ }
1020
+ }
1021
+ },
1022
+ onFocus: (event)=>{
1023
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1024
+ if (isNotDismissible) return;
1025
+ if (!isFocusWithinRef.current) {
1026
+ isFocusWithinRef.current = true;
1027
+ lastFocusedElementRef.current = event.relatedTarget;
1028
+ }
1029
+ },
1030
+ onMouseEnter: ()=>setExpanded(true),
1031
+ onMouseMove: ()=>setExpanded(true),
1032
+ onMouseLeave: ()=>{
1033
+ if (!interacting) {
1034
+ setExpanded(false);
1035
+ }
1036
+ },
1037
+ onDragEnd: ()=>setExpanded(false),
1038
+ onPointerDown: (event)=>{
1039
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1040
+ if (isNotDismissible) return;
1041
+ setInteracting(true);
1042
+ },
1043
+ onPointerUp: ()=>setInteracting(false)
1044
+ }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === currentPosition).map((toast, toastIndex)=>/*#__PURE__*/ React__default.default.createElement(Toast, {
1045
+ key: toast.id,
1046
+ icons: icons,
1047
+ index: toastIndex,
1048
+ toast: toast,
1049
+ defaultRichColors: richColors,
1050
+ duration: toastOptions?.duration ?? duration,
1051
+ className: toastOptions?.className,
1052
+ descriptionClassName: toastOptions?.descriptionClassName,
1053
+ invert: invert,
1054
+ visibleToasts: visibleToasts,
1055
+ closeButton: toastOptions?.closeButton ?? closeButton,
1056
+ interacting: interacting,
1057
+ position: currentPosition,
1058
+ style: toastOptions?.style,
1059
+ unstyled: toastOptions?.unstyled,
1060
+ classNames: toastOptions?.classNames,
1061
+ cancelButtonStyle: toastOptions?.cancelButtonStyle,
1062
+ actionButtonStyle: toastOptions?.actionButtonStyle,
1063
+ closeButtonAriaLabel: toastOptions?.closeButtonAriaLabel,
1064
+ removeToast: removeToast,
1065
+ toasts: filteredToasts.filter((t)=>t.position == toast.position),
1066
+ heights: heights.filter((h)=>h.position == toast.position),
1067
+ setHeights: setHeights,
1068
+ expandByDefault: expand,
1069
+ gap: gap,
1070
+ expanded: expanded,
1071
+ swipeDirections: props.swipeDirections
1072
+ })));
1073
+ }));
1074
+ });
1075
+
1076
+ let vanillaToasterRoot = null;
1077
+ let vanillaToasterElement = null;
1078
+ let vanillaToasterOptions = {};
1079
+ function toReactAction(action) {
1080
+ if (!action) return undefined;
1081
+ return {
1082
+ label: action.label,
1083
+ onClick: (event)=>{
1084
+ action.onClick?.(event);
1085
+ if (action.closeOnClick === false) {
1086
+ event.preventDefault();
1087
+ }
1088
+ }
1089
+ };
1090
+ }
1091
+ function normalizeToastOptions(options) {
1092
+ if (!options) return undefined;
1093
+ return {
1094
+ ...options,
1095
+ action: toReactAction(options.action),
1096
+ cancel: toReactAction(options.cancel)
1097
+ };
1098
+ }
1099
+ function normalizePromiseValue(value) {
1100
+ if (typeof value !== 'function') {
1101
+ return value;
1102
+ }
1103
+ return async (data)=>value(data);
1104
+ }
1105
+ function normalizePromiseData(data) {
1106
+ if (!data) return undefined;
1107
+ const { loading, success, error, description, finally: finallyCallback, ...rest } = data;
1108
+ return {
1109
+ ...normalizeToastOptions(rest),
1110
+ loading: loading,
1111
+ success: normalizePromiseValue(success),
1112
+ error: normalizePromiseValue(error),
1113
+ description: description,
1114
+ finally: finallyCallback
1115
+ };
1116
+ }
1117
+ function getVanillaContainer() {
1118
+ if (!canUseDOM()) return null;
1119
+ if (vanillaToasterElement?.isConnected) {
1120
+ return vanillaToasterElement;
1121
+ }
1122
+ const existing = document.querySelector('[data-notify-vanilla-root]');
1123
+ if (existing) {
1124
+ vanillaToasterElement = existing;
1125
+ return existing;
1126
+ }
1127
+ const element = document.createElement('div');
1128
+ element.dataset.notifyVanillaRoot = '';
1129
+ document.body.appendChild(element);
1130
+ vanillaToasterElement = element;
1131
+ return element;
1132
+ }
1133
+ function renderVanillaToaster() {
1134
+ const container = getVanillaContainer();
1135
+ if (!container) return null;
1136
+ if (!vanillaToasterRoot) {
1137
+ vanillaToasterRoot = client.createRoot(container);
1138
+ }
1139
+ vanillaToasterRoot.render(/*#__PURE__*/ React__default.default.createElement(Toaster$1, vanillaToasterOptions));
1140
+ return container;
1141
+ }
1142
+ function buildVanillaController(element) {
1143
+ return {
1144
+ element,
1145
+ options: vanillaToasterOptions,
1146
+ update (options = {}) {
1147
+ vanillaToasterOptions = {
1148
+ ...vanillaToasterOptions,
1149
+ ...options
1150
+ };
1151
+ renderVanillaToaster();
1152
+ return buildVanillaController(element);
1153
+ },
1154
+ destroy () {
1155
+ destroyToaster();
1156
+ }
1157
+ };
1158
+ }
1159
+ function ensureVanillaToaster() {
1160
+ const container = renderVanillaToaster();
1161
+ return container ? buildVanillaController(container) : null;
1162
+ }
1163
+ function createToaster(options = {}) {
1164
+ vanillaToasterOptions = {
1165
+ ...vanillaToasterOptions,
1166
+ ...options
1167
+ };
1168
+ return ensureVanillaToaster();
1169
+ }
1170
+ function configureToaster(options = {}) {
1171
+ return createToaster(options);
1172
+ }
1173
+ const Toaster = createToaster;
1174
+ function getToaster() {
1175
+ if (!vanillaToasterElement || !vanillaToasterRoot) {
1176
+ return null;
1177
+ }
1178
+ return buildVanillaController(vanillaToasterElement);
1179
+ }
1180
+ function destroyToaster() {
1181
+ vanillaToasterRoot?.unmount();
1182
+ vanillaToasterRoot = null;
1183
+ if (vanillaToasterElement?.parentNode) {
1184
+ vanillaToasterElement.parentNode.removeChild(vanillaToasterElement);
1185
+ }
1186
+ vanillaToasterElement = null;
1187
+ }
1188
+ function ensureVanillaRendererMounted() {
1189
+ if (!canUseDOM()) return;
1190
+ ensureVanillaToaster();
1191
+ }
1192
+ const toast = Object.assign((message, data)=>{
1193
+ ensureVanillaRendererMounted();
1194
+ return toast$1(message, normalizeToastOptions(data));
1195
+ }, {
1196
+ success (message, data) {
1197
+ ensureVanillaRendererMounted();
1198
+ return toast$1.success(message, normalizeToastOptions(data));
1199
+ },
1200
+ info (message, data) {
1201
+ ensureVanillaRendererMounted();
1202
+ return toast$1.info(message, normalizeToastOptions(data));
1203
+ },
1204
+ warning (message, data) {
1205
+ ensureVanillaRendererMounted();
1206
+ return toast$1.warning(message, normalizeToastOptions(data));
1207
+ },
1208
+ error (message, data) {
1209
+ ensureVanillaRendererMounted();
1210
+ return toast$1.error(message, normalizeToastOptions(data));
1211
+ },
1212
+ loading (message, data) {
1213
+ ensureVanillaRendererMounted();
1214
+ return toast$1.loading(message, normalizeToastOptions(data));
1215
+ },
1216
+ message (message, data) {
1217
+ ensureVanillaRendererMounted();
1218
+ return toast$1.message(message, normalizeToastOptions(data));
1219
+ },
1220
+ promise (promise, data) {
1221
+ ensureVanillaRendererMounted();
1222
+ return toast$1.promise(promise, normalizePromiseData(data));
1223
+ },
1224
+ dismiss (id) {
1225
+ return toast$1.dismiss(id);
1226
+ },
1227
+ getHistory () {
1228
+ return toast$1.getHistory();
1229
+ },
1230
+ getToasts () {
1231
+ return toast$1.getToasts();
1232
+ }
1233
+ });
1234
+
1235
+ exports.Toaster = Toaster;
1236
+ exports.configureToaster = configureToaster;
1237
+ exports.createToaster = createToaster;
1238
+ exports.destroyToaster = destroyToaster;
1239
+ exports.getToaster = getToaster;
1240
+ exports.toast = toast;