@arcadeai/design-system 0.8.0 → 1.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.
@@ -1,788 +0,0 @@
1
- import { jsx as Wt } from "react/jsx-runtime";
2
- import * as ft from "react";
3
- import a from "react";
4
- import Xt from "react-dom";
5
- var Kt = (n, o, e, s, E, l, b, T) => {
6
- let f = document.documentElement, i = ["light", "dark"];
7
- function y(p) {
8
- (Array.isArray(n) ? n : [n]).forEach((v) => {
9
- let U = v === "class", c = U && l ? E.map((D) => l[D] || D) : E;
10
- U ? (f.classList.remove(...c), f.classList.add(l && l[p] ? l[p] : p)) : f.setAttribute(v, p);
11
- }), t(p);
12
- }
13
- function t(p) {
14
- T && i.includes(p) && (f.style.colorScheme = p);
15
- }
16
- function R() {
17
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
18
- }
19
- if (s) y(s);
20
- else try {
21
- let p = localStorage.getItem(o) || e, v = b && p === "system" ? R() : p;
22
- y(v);
23
- } catch {
24
- }
25
- }, qt = ft.createContext(void 0), Gt = { setTheme: (n) => {
26
- }, themes: [] }, Jt = () => {
27
- var n;
28
- return (n = ft.useContext(qt)) != null ? n : Gt;
29
- };
30
- ft.memo(({ forcedTheme: n, storageKey: o, attribute: e, enableSystem: s, enableColorScheme: E, defaultTheme: l, value: b, themes: T, nonce: f, scriptProps: i }) => {
31
- let y = JSON.stringify([e, o, l, n, T, b, s, E]).slice(1, -1);
32
- return ft.createElement("script", { ...i, suppressHydrationWarning: !0, nonce: typeof window > "u" ? f : "", dangerouslySetInnerHTML: { __html: `(${Kt.toString()})(${y})` } });
33
- });
34
- function Qt(n) {
35
- if (typeof document > "u") return;
36
- let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
37
- e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = n : e.appendChild(document.createTextNode(n));
38
- }
39
- const Zt = (n) => {
40
- switch (n) {
41
- case "success":
42
- return ae;
43
- case "info":
44
- return se;
45
- case "warning":
46
- return oe;
47
- case "error":
48
- return ne;
49
- default:
50
- return null;
51
- }
52
- }, te = Array(12).fill(0), ee = ({ visible: n, className: o }) => /* @__PURE__ */ a.createElement("div", {
53
- className: [
54
- "sonner-loading-wrapper",
55
- o
56
- ].filter(Boolean).join(" "),
57
- "data-visible": n
58
- }, /* @__PURE__ */ a.createElement("div", {
59
- className: "sonner-spinner"
60
- }, te.map((e, s) => /* @__PURE__ */ a.createElement("div", {
61
- className: "sonner-loading-bar",
62
- key: `spinner-bar-${s}`
63
- })))), ae = /* @__PURE__ */ a.createElement("svg", {
64
- xmlns: "http://www.w3.org/2000/svg",
65
- viewBox: "0 0 20 20",
66
- fill: "currentColor",
67
- height: "20",
68
- width: "20"
69
- }, /* @__PURE__ */ a.createElement("path", {
70
- fillRule: "evenodd",
71
- 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",
72
- clipRule: "evenodd"
73
- })), oe = /* @__PURE__ */ a.createElement("svg", {
74
- xmlns: "http://www.w3.org/2000/svg",
75
- viewBox: "0 0 24 24",
76
- fill: "currentColor",
77
- height: "20",
78
- width: "20"
79
- }, /* @__PURE__ */ a.createElement("path", {
80
- fillRule: "evenodd",
81
- 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",
82
- clipRule: "evenodd"
83
- })), se = /* @__PURE__ */ a.createElement("svg", {
84
- xmlns: "http://www.w3.org/2000/svg",
85
- viewBox: "0 0 20 20",
86
- fill: "currentColor",
87
- height: "20",
88
- width: "20"
89
- }, /* @__PURE__ */ a.createElement("path", {
90
- fillRule: "evenodd",
91
- 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",
92
- clipRule: "evenodd"
93
- })), ne = /* @__PURE__ */ a.createElement("svg", {
94
- xmlns: "http://www.w3.org/2000/svg",
95
- viewBox: "0 0 20 20",
96
- fill: "currentColor",
97
- height: "20",
98
- width: "20"
99
- }, /* @__PURE__ */ a.createElement("path", {
100
- fillRule: "evenodd",
101
- 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",
102
- clipRule: "evenodd"
103
- })), re = /* @__PURE__ */ a.createElement("svg", {
104
- xmlns: "http://www.w3.org/2000/svg",
105
- width: "12",
106
- height: "12",
107
- viewBox: "0 0 24 24",
108
- fill: "none",
109
- stroke: "currentColor",
110
- strokeWidth: "1.5",
111
- strokeLinecap: "round",
112
- strokeLinejoin: "round"
113
- }, /* @__PURE__ */ a.createElement("line", {
114
- x1: "18",
115
- y1: "6",
116
- x2: "6",
117
- y2: "18"
118
- }), /* @__PURE__ */ a.createElement("line", {
119
- x1: "6",
120
- y1: "6",
121
- x2: "18",
122
- y2: "18"
123
- })), ie = () => {
124
- const [n, o] = a.useState(document.hidden);
125
- return a.useEffect(() => {
126
- const e = () => {
127
- o(document.hidden);
128
- };
129
- return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
130
- }, []), n;
131
- };
132
- let wt = 1;
133
- class le {
134
- constructor() {
135
- this.subscribe = (o) => (this.subscribers.push(o), () => {
136
- const e = this.subscribers.indexOf(o);
137
- this.subscribers.splice(e, 1);
138
- }), this.publish = (o) => {
139
- this.subscribers.forEach((e) => e(o));
140
- }, this.addToast = (o) => {
141
- this.publish(o), this.toasts = [
142
- ...this.toasts,
143
- o
144
- ];
145
- }, this.create = (o) => {
146
- var e;
147
- const { message: s, ...E } = o, l = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : wt++, b = this.toasts.find((f) => f.id === l), T = o.dismissible === void 0 ? !0 : o.dismissible;
148
- return this.dismissedToasts.has(l) && this.dismissedToasts.delete(l), b ? this.toasts = this.toasts.map((f) => f.id === l ? (this.publish({
149
- ...f,
150
- ...o,
151
- id: l,
152
- title: s
153
- }), {
154
- ...f,
155
- ...o,
156
- id: l,
157
- dismissible: T,
158
- title: s
159
- }) : f) : this.addToast({
160
- title: s,
161
- ...E,
162
- dismissible: T,
163
- id: l
164
- }), l;
165
- }, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
166
- id: o,
167
- dismiss: !0
168
- })))) : this.toasts.forEach((e) => {
169
- this.subscribers.forEach((s) => s({
170
- id: e.id,
171
- dismiss: !0
172
- }));
173
- }), o), this.message = (o, e) => this.create({
174
- ...e,
175
- message: o
176
- }), this.error = (o, e) => this.create({
177
- ...e,
178
- message: o,
179
- type: "error"
180
- }), this.success = (o, e) => this.create({
181
- ...e,
182
- type: "success",
183
- message: o
184
- }), this.info = (o, e) => this.create({
185
- ...e,
186
- type: "info",
187
- message: o
188
- }), this.warning = (o, e) => this.create({
189
- ...e,
190
- type: "warning",
191
- message: o
192
- }), this.loading = (o, e) => this.create({
193
- ...e,
194
- type: "loading",
195
- message: o
196
- }), this.promise = (o, e) => {
197
- if (!e)
198
- return;
199
- let s;
200
- e.loading !== void 0 && (s = this.create({
201
- ...e,
202
- promise: o,
203
- type: "loading",
204
- message: e.loading,
205
- description: typeof e.description != "function" ? e.description : void 0
206
- }));
207
- const E = Promise.resolve(o instanceof Function ? o() : o);
208
- let l = s !== void 0, b;
209
- const T = E.then(async (i) => {
210
- if (b = [
211
- "resolve",
212
- i
213
- ], a.isValidElement(i))
214
- l = !1, this.create({
215
- id: s,
216
- type: "default",
217
- message: i
218
- });
219
- else if (ce(i) && !i.ok) {
220
- l = !1;
221
- const t = typeof e.error == "function" ? await e.error(`HTTP error! status: ${i.status}`) : e.error, R = typeof e.description == "function" ? await e.description(`HTTP error! status: ${i.status}`) : e.description, v = typeof t == "object" && !a.isValidElement(t) ? t : {
222
- message: t
223
- };
224
- this.create({
225
- id: s,
226
- type: "error",
227
- description: R,
228
- ...v
229
- });
230
- } else if (i instanceof Error) {
231
- l = !1;
232
- const t = typeof e.error == "function" ? await e.error(i) : e.error, R = typeof e.description == "function" ? await e.description(i) : e.description, v = typeof t == "object" && !a.isValidElement(t) ? t : {
233
- message: t
234
- };
235
- this.create({
236
- id: s,
237
- type: "error",
238
- description: R,
239
- ...v
240
- });
241
- } else if (e.success !== void 0) {
242
- l = !1;
243
- const t = typeof e.success == "function" ? await e.success(i) : e.success, R = typeof e.description == "function" ? await e.description(i) : e.description, v = typeof t == "object" && !a.isValidElement(t) ? t : {
244
- message: t
245
- };
246
- this.create({
247
- id: s,
248
- type: "success",
249
- description: R,
250
- ...v
251
- });
252
- }
253
- }).catch(async (i) => {
254
- if (b = [
255
- "reject",
256
- i
257
- ], e.error !== void 0) {
258
- l = !1;
259
- const y = typeof e.error == "function" ? await e.error(i) : e.error, t = typeof e.description == "function" ? await e.description(i) : e.description, p = typeof y == "object" && !a.isValidElement(y) ? y : {
260
- message: y
261
- };
262
- this.create({
263
- id: s,
264
- type: "error",
265
- description: t,
266
- ...p
267
- });
268
- }
269
- }).finally(() => {
270
- l && (this.dismiss(s), s = void 0), e.finally == null || e.finally.call(e);
271
- }), f = () => new Promise((i, y) => T.then(() => b[0] === "reject" ? y(b[1]) : i(b[1])).catch(y));
272
- return typeof s != "string" && typeof s != "number" ? {
273
- unwrap: f
274
- } : Object.assign(s, {
275
- unwrap: f
276
- });
277
- }, this.custom = (o, e) => {
278
- const s = e?.id || wt++;
279
- return this.create({
280
- jsx: o(s),
281
- id: s,
282
- ...e
283
- }), s;
284
- }, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
285
- }
286
- }
287
- const k = new le(), de = (n, o) => {
288
- const e = o?.id || wt++;
289
- return k.addToast({
290
- title: n,
291
- ...o,
292
- id: e
293
- }), e;
294
- }, ce = (n) => n && typeof n == "object" && "ok" in n && typeof n.ok == "boolean" && "status" in n && typeof n.status == "number", ue = de, fe = () => k.toasts, me = () => k.getActiveToasts();
295
- Object.assign(ue, {
296
- success: k.success,
297
- info: k.info,
298
- warning: k.warning,
299
- error: k.error,
300
- custom: k.custom,
301
- message: k.message,
302
- promise: k.promise,
303
- dismiss: k.dismiss,
304
- loading: k.loading
305
- }, {
306
- getHistory: fe,
307
- getToasts: me
308
- });
309
- Qt("[data-sonner-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-sonner-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-sonner-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-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-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-sonner-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-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-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-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-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-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-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(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-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-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-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-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-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-sonner-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-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-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-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-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-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-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-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-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-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-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-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-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-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
310
- function ut(n) {
311
- return n.label !== void 0;
312
- }
313
- const pe = 3, ge = "24px", he = "16px", Mt = 4e3, be = 356, ve = 14, ye = 45, we = 200;
314
- function L(...n) {
315
- return n.filter(Boolean).join(" ");
316
- }
317
- function xe(n) {
318
- const [o, e] = n.split("-"), s = [];
319
- return o && s.push(o), e && s.push(e), s;
320
- }
321
- const Ee = (n) => {
322
- var o, e, s, E, l, b, T, f, i;
323
- const { invert: y, toast: t, unstyled: R, interacting: p, setHeights: v, visibleToasts: U, heights: c, index: D, toasts: nt, expanded: Q, removeToast: rt, defaultRichColors: O, closeButton: W, style: mt, cancelButtonStyle: it, actionButtonStyle: pt, className: gt = "", descriptionClassName: P = "", duration: X, position: Z, gap: ht, expandByDefault: z, classNames: d, icons: I, closeButtonAriaLabel: j = "Close toast" } = n, [C, tt] = a.useState(null), [u, g] = a.useState(null), [m, B] = a.useState(!1), [F, h] = a.useState(!1), [et, K] = a.useState(!1), [at, ot] = a.useState(!1), [Ct, xt] = a.useState(!1), [At, bt] = a.useState(0), [Ht, Et] = a.useState(0), st = a.useRef(t.duration || X || Mt), Tt = a.useRef(null), $ = a.useRef(null), Ot = D === 0, zt = D + 1 <= U, N = t.type, q = t.dismissible !== !1, Lt = t.className || "", Pt = t.descriptionClassName || "", lt = a.useMemo(() => c.findIndex((r) => r.toastId === t.id) || 0, [
324
- c,
325
- t.id
326
- ]), jt = a.useMemo(() => {
327
- var r;
328
- return (r = t.closeButton) != null ? r : W;
329
- }, [
330
- t.closeButton,
331
- W
332
- ]), St = a.useMemo(() => t.duration || X || Mt, [
333
- t.duration,
334
- X
335
- ]), vt = a.useRef(0), G = a.useRef(0), kt = a.useRef(0), J = a.useRef(null), [$t, Yt] = Z.split("-"), Nt = a.useMemo(() => c.reduce((r, w, S) => S >= lt ? r : r + w.height, 0), [
336
- c,
337
- lt
338
- ]), _t = ie(), Ft = t.invert || y, yt = N === "loading";
339
- G.current = a.useMemo(() => lt * ht + Nt, [
340
- lt,
341
- Nt
342
- ]), a.useEffect(() => {
343
- st.current = St;
344
- }, [
345
- St
346
- ]), a.useEffect(() => {
347
- B(!0);
348
- }, []), a.useEffect(() => {
349
- const r = $.current;
350
- if (r) {
351
- const w = r.getBoundingClientRect().height;
352
- return Et(w), v((S) => [
353
- {
354
- toastId: t.id,
355
- height: w,
356
- position: t.position
357
- },
358
- ...S
359
- ]), () => v((S) => S.filter((_) => _.toastId !== t.id));
360
- }
361
- }, [
362
- v,
363
- t.id
364
- ]), a.useLayoutEffect(() => {
365
- if (!m) return;
366
- const r = $.current, w = r.style.height;
367
- r.style.height = "auto";
368
- const S = r.getBoundingClientRect().height;
369
- r.style.height = w, Et(S), v((_) => _.find((x) => x.toastId === t.id) ? _.map((x) => x.toastId === t.id ? {
370
- ...x,
371
- height: S
372
- } : x) : [
373
- {
374
- toastId: t.id,
375
- height: S,
376
- position: t.position
377
- },
378
- ..._
379
- ]);
380
- }, [
381
- m,
382
- t.title,
383
- t.description,
384
- v,
385
- t.id,
386
- t.jsx,
387
- t.action,
388
- t.cancel
389
- ]);
390
- const Y = a.useCallback(() => {
391
- h(!0), bt(G.current), v((r) => r.filter((w) => w.toastId !== t.id)), setTimeout(() => {
392
- rt(t);
393
- }, we);
394
- }, [
395
- t,
396
- rt,
397
- v,
398
- G
399
- ]);
400
- a.useEffect(() => {
401
- if (t.promise && N === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
402
- let r;
403
- return Q || p || _t ? (() => {
404
- if (kt.current < vt.current) {
405
- const _ = (/* @__PURE__ */ new Date()).getTime() - vt.current;
406
- st.current = st.current - _;
407
- }
408
- kt.current = (/* @__PURE__ */ new Date()).getTime();
409
- })() : (() => {
410
- st.current !== 1 / 0 && (vt.current = (/* @__PURE__ */ new Date()).getTime(), r = setTimeout(() => {
411
- t.onAutoClose == null || t.onAutoClose.call(t, t), Y();
412
- }, st.current));
413
- })(), () => clearTimeout(r);
414
- }, [
415
- Q,
416
- p,
417
- t,
418
- N,
419
- _t,
420
- Y
421
- ]), a.useEffect(() => {
422
- t.delete && (Y(), t.onDismiss == null || t.onDismiss.call(t, t));
423
- }, [
424
- Y,
425
- t.delete
426
- ]);
427
- function Vt() {
428
- var r;
429
- if (I?.loading) {
430
- var w;
431
- return /* @__PURE__ */ a.createElement("div", {
432
- className: L(d?.loader, t == null || (w = t.classNames) == null ? void 0 : w.loader, "sonner-loader"),
433
- "data-visible": N === "loading"
434
- }, I.loading);
435
- }
436
- return /* @__PURE__ */ a.createElement(ee, {
437
- className: L(d?.loader, t == null || (r = t.classNames) == null ? void 0 : r.loader),
438
- visible: N === "loading"
439
- });
440
- }
441
- const Ut = t.icon || I?.[N] || Zt(N);
442
- var Rt, Dt;
443
- return /* @__PURE__ */ a.createElement("li", {
444
- tabIndex: 0,
445
- ref: $,
446
- className: L(gt, Lt, d?.toast, t == null || (o = t.classNames) == null ? void 0 : o.toast, d?.default, d?.[N], t == null || (e = t.classNames) == null ? void 0 : e[N]),
447
- "data-sonner-toast": "",
448
- "data-rich-colors": (Rt = t.richColors) != null ? Rt : O,
449
- "data-styled": !(t.jsx || t.unstyled || R),
450
- "data-mounted": m,
451
- "data-promise": !!t.promise,
452
- "data-swiped": Ct,
453
- "data-removed": F,
454
- "data-visible": zt,
455
- "data-y-position": $t,
456
- "data-x-position": Yt,
457
- "data-index": D,
458
- "data-front": Ot,
459
- "data-swiping": et,
460
- "data-dismissible": q,
461
- "data-type": N,
462
- "data-invert": Ft,
463
- "data-swipe-out": at,
464
- "data-swipe-direction": u,
465
- "data-expanded": !!(Q || z && m),
466
- style: {
467
- "--index": D,
468
- "--toasts-before": D,
469
- "--z-index": nt.length - D,
470
- "--offset": `${F ? At : G.current}px`,
471
- "--initial-height": z ? "auto" : `${Ht}px`,
472
- ...mt,
473
- ...t.style
474
- },
475
- onDragEnd: () => {
476
- K(!1), tt(null), J.current = null;
477
- },
478
- onPointerDown: (r) => {
479
- r.button !== 2 && (yt || !q || (Tt.current = /* @__PURE__ */ new Date(), bt(G.current), r.target.setPointerCapture(r.pointerId), r.target.tagName !== "BUTTON" && (K(!0), J.current = {
480
- x: r.clientX,
481
- y: r.clientY
482
- })));
483
- },
484
- onPointerUp: () => {
485
- var r, w, S;
486
- if (at || !q) return;
487
- J.current = null;
488
- const _ = Number(((r = $.current) == null ? void 0 : r.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), dt = Number(((w = $.current) == null ? void 0 : w.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), x = (/* @__PURE__ */ new Date()).getTime() - ((S = Tt.current) == null ? void 0 : S.getTime()), M = C === "x" ? _ : dt, ct = Math.abs(M) / x;
489
- if (Math.abs(M) >= ye || ct > 0.11) {
490
- bt(G.current), t.onDismiss == null || t.onDismiss.call(t, t), g(C === "x" ? _ > 0 ? "right" : "left" : dt > 0 ? "down" : "up"), Y(), ot(!0);
491
- return;
492
- } else {
493
- var A, H;
494
- (A = $.current) == null || A.style.setProperty("--swipe-amount-x", "0px"), (H = $.current) == null || H.style.setProperty("--swipe-amount-y", "0px");
495
- }
496
- xt(!1), K(!1), tt(null);
497
- },
498
- onPointerMove: (r) => {
499
- var w, S, _;
500
- if (!J.current || !q || ((w = window.getSelection()) == null ? void 0 : w.toString().length) > 0) return;
501
- const x = r.clientY - J.current.y, M = r.clientX - J.current.x;
502
- var ct;
503
- const A = (ct = n.swipeDirections) != null ? ct : xe(Z);
504
- !C && (Math.abs(M) > 1 || Math.abs(x) > 1) && tt(Math.abs(M) > Math.abs(x) ? "x" : "y");
505
- let H = {
506
- x: 0,
507
- y: 0
508
- };
509
- const Bt = (V) => 1 / (1.5 + Math.abs(V) / 20);
510
- if (C === "y") {
511
- if (A.includes("top") || A.includes("bottom"))
512
- if (A.includes("top") && x < 0 || A.includes("bottom") && x > 0)
513
- H.y = x;
514
- else {
515
- const V = x * Bt(x);
516
- H.y = Math.abs(V) < Math.abs(x) ? V : x;
517
- }
518
- } else if (C === "x" && (A.includes("left") || A.includes("right")))
519
- if (A.includes("left") && M < 0 || A.includes("right") && M > 0)
520
- H.x = M;
521
- else {
522
- const V = M * Bt(M);
523
- H.x = Math.abs(V) < Math.abs(M) ? V : M;
524
- }
525
- (Math.abs(H.x) > 0 || Math.abs(H.y) > 0) && xt(!0), (S = $.current) == null || S.style.setProperty("--swipe-amount-x", `${H.x}px`), (_ = $.current) == null || _.style.setProperty("--swipe-amount-y", `${H.y}px`);
526
- }
527
- }, jt && !t.jsx && N !== "loading" ? /* @__PURE__ */ a.createElement("button", {
528
- "aria-label": j,
529
- "data-disabled": yt,
530
- "data-close-button": !0,
531
- onClick: yt || !q ? () => {
532
- } : () => {
533
- Y(), t.onDismiss == null || t.onDismiss.call(t, t);
534
- },
535
- className: L(d?.closeButton, t == null || (s = t.classNames) == null ? void 0 : s.closeButton)
536
- }, (Dt = I?.close) != null ? Dt : re) : null, (N || t.icon || t.promise) && t.icon !== null && (I?.[N] !== null || t.icon) ? /* @__PURE__ */ a.createElement("div", {
537
- "data-icon": "",
538
- className: L(d?.icon, t == null || (E = t.classNames) == null ? void 0 : E.icon)
539
- }, t.promise || t.type === "loading" && !t.icon ? t.icon || Vt() : null, t.type !== "loading" ? Ut : null) : null, /* @__PURE__ */ a.createElement("div", {
540
- "data-content": "",
541
- className: L(d?.content, t == null || (l = t.classNames) == null ? void 0 : l.content)
542
- }, /* @__PURE__ */ a.createElement("div", {
543
- "data-title": "",
544
- className: L(d?.title, t == null || (b = t.classNames) == null ? void 0 : b.title)
545
- }, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ a.createElement("div", {
546
- "data-description": "",
547
- className: L(P, Pt, d?.description, t == null || (T = t.classNames) == null ? void 0 : T.description)
548
- }, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ a.isValidElement(t.cancel) ? t.cancel : t.cancel && ut(t.cancel) ? /* @__PURE__ */ a.createElement("button", {
549
- "data-button": !0,
550
- "data-cancel": !0,
551
- style: t.cancelButtonStyle || it,
552
- onClick: (r) => {
553
- ut(t.cancel) && q && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, r), Y());
554
- },
555
- className: L(d?.cancelButton, t == null || (f = t.classNames) == null ? void 0 : f.cancelButton)
556
- }, t.cancel.label) : null, /* @__PURE__ */ a.isValidElement(t.action) ? t.action : t.action && ut(t.action) ? /* @__PURE__ */ a.createElement("button", {
557
- "data-button": !0,
558
- "data-action": !0,
559
- style: t.actionButtonStyle || pt,
560
- onClick: (r) => {
561
- ut(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, r), !r.defaultPrevented && Y());
562
- },
563
- className: L(d?.actionButton, t == null || (i = t.classNames) == null ? void 0 : i.actionButton)
564
- }, t.action.label) : null);
565
- };
566
- function It() {
567
- if (typeof window > "u" || typeof document > "u") return "ltr";
568
- const n = document.documentElement.getAttribute("dir");
569
- return n === "auto" || !n ? window.getComputedStyle(document.documentElement).direction : n;
570
- }
571
- function Te(n, o) {
572
- const e = {};
573
- return [
574
- n,
575
- o
576
- ].forEach((s, E) => {
577
- const l = E === 1, b = l ? "--mobile-offset" : "--offset", T = l ? he : ge;
578
- function f(i) {
579
- [
580
- "top",
581
- "right",
582
- "bottom",
583
- "left"
584
- ].forEach((y) => {
585
- e[`${b}-${y}`] = typeof i == "number" ? `${i}px` : i;
586
- });
587
- }
588
- typeof s == "number" || typeof s == "string" ? f(s) : typeof s == "object" ? [
589
- "top",
590
- "right",
591
- "bottom",
592
- "left"
593
- ].forEach((i) => {
594
- s[i] === void 0 ? e[`${b}-${i}`] = T : e[`${b}-${i}`] = typeof s[i] == "number" ? `${s[i]}px` : s[i];
595
- }) : f(T);
596
- }), e;
597
- }
598
- const Se = /* @__PURE__ */ a.forwardRef(function(o, e) {
599
- const { invert: s, position: E = "bottom-right", hotkey: l = [
600
- "altKey",
601
- "KeyT"
602
- ], expand: b, closeButton: T, className: f, offset: i, mobileOffset: y, theme: t = "light", richColors: R, duration: p, style: v, visibleToasts: U = pe, toastOptions: c, dir: D = It(), gap: nt = ve, icons: Q, containerAriaLabel: rt = "Notifications" } = o, [O, W] = a.useState([]), mt = a.useMemo(() => Array.from(new Set([
603
- E
604
- ].concat(O.filter((u) => u.position).map((u) => u.position)))), [
605
- O,
606
- E
607
- ]), [it, pt] = a.useState([]), [gt, P] = a.useState(!1), [X, Z] = a.useState(!1), [ht, z] = a.useState(t !== "system" ? t : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), d = a.useRef(null), I = l.join("+").replace(/Key/g, "").replace(/Digit/g, ""), j = a.useRef(null), C = a.useRef(!1), tt = a.useCallback((u) => {
608
- W((g) => {
609
- var m;
610
- return (m = g.find((B) => B.id === u.id)) != null && m.delete || k.dismiss(u.id), g.filter(({ id: B }) => B !== u.id);
611
- });
612
- }, []);
613
- return a.useEffect(() => k.subscribe((u) => {
614
- if (u.dismiss) {
615
- requestAnimationFrame(() => {
616
- W((g) => g.map((m) => m.id === u.id ? {
617
- ...m,
618
- delete: !0
619
- } : m));
620
- });
621
- return;
622
- }
623
- setTimeout(() => {
624
- Xt.flushSync(() => {
625
- W((g) => {
626
- const m = g.findIndex((B) => B.id === u.id);
627
- return m !== -1 ? [
628
- ...g.slice(0, m),
629
- {
630
- ...g[m],
631
- ...u
632
- },
633
- ...g.slice(m + 1)
634
- ] : [
635
- u,
636
- ...g
637
- ];
638
- });
639
- });
640
- });
641
- }), [
642
- O
643
- ]), a.useEffect(() => {
644
- if (t !== "system") {
645
- z(t);
646
- return;
647
- }
648
- if (t === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? z("dark") : z("light")), typeof window > "u") return;
649
- const u = window.matchMedia("(prefers-color-scheme: dark)");
650
- try {
651
- u.addEventListener("change", ({ matches: g }) => {
652
- z(g ? "dark" : "light");
653
- });
654
- } catch {
655
- u.addListener(({ matches: m }) => {
656
- try {
657
- z(m ? "dark" : "light");
658
- } catch (B) {
659
- console.error(B);
660
- }
661
- });
662
- }
663
- }, [
664
- t
665
- ]), a.useEffect(() => {
666
- O.length <= 1 && P(!1);
667
- }, [
668
- O
669
- ]), a.useEffect(() => {
670
- const u = (g) => {
671
- var m;
672
- if (l.every((h) => g[h] || g.code === h)) {
673
- var F;
674
- P(!0), (F = d.current) == null || F.focus();
675
- }
676
- g.code === "Escape" && (document.activeElement === d.current || (m = d.current) != null && m.contains(document.activeElement)) && P(!1);
677
- };
678
- return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
679
- }, [
680
- l
681
- ]), a.useEffect(() => {
682
- if (d.current)
683
- return () => {
684
- j.current && (j.current.focus({
685
- preventScroll: !0
686
- }), j.current = null, C.current = !1);
687
- };
688
- }, [
689
- d.current
690
- ]), // Remove item from normal navigation flow, only available via hotkey
691
- /* @__PURE__ */ a.createElement("section", {
692
- ref: e,
693
- "aria-label": `${rt} ${I}`,
694
- tabIndex: -1,
695
- "aria-live": "polite",
696
- "aria-relevant": "additions text",
697
- "aria-atomic": "false",
698
- suppressHydrationWarning: !0
699
- }, mt.map((u, g) => {
700
- var m;
701
- const [B, F] = u.split("-");
702
- return O.length ? /* @__PURE__ */ a.createElement("ol", {
703
- key: u,
704
- dir: D === "auto" ? It() : D,
705
- tabIndex: -1,
706
- ref: d,
707
- className: f,
708
- "data-sonner-toaster": !0,
709
- "data-sonner-theme": ht,
710
- "data-y-position": B,
711
- "data-x-position": F,
712
- style: {
713
- "--front-toast-height": `${((m = it[0]) == null ? void 0 : m.height) || 0}px`,
714
- "--width": `${be}px`,
715
- "--gap": `${nt}px`,
716
- ...v,
717
- ...Te(i, y)
718
- },
719
- onBlur: (h) => {
720
- C.current && !h.currentTarget.contains(h.relatedTarget) && (C.current = !1, j.current && (j.current.focus({
721
- preventScroll: !0
722
- }), j.current = null));
723
- },
724
- onFocus: (h) => {
725
- h.target instanceof HTMLElement && h.target.dataset.dismissible === "false" || C.current || (C.current = !0, j.current = h.relatedTarget);
726
- },
727
- onMouseEnter: () => P(!0),
728
- onMouseMove: () => P(!0),
729
- onMouseLeave: () => {
730
- X || P(!1);
731
- },
732
- onDragEnd: () => P(!1),
733
- onPointerDown: (h) => {
734
- h.target instanceof HTMLElement && h.target.dataset.dismissible === "false" || Z(!0);
735
- },
736
- onPointerUp: () => Z(!1)
737
- }, O.filter((h) => !h.position && g === 0 || h.position === u).map((h, et) => {
738
- var K, at;
739
- return /* @__PURE__ */ a.createElement(Ee, {
740
- key: h.id,
741
- icons: Q,
742
- index: et,
743
- toast: h,
744
- defaultRichColors: R,
745
- duration: (K = c?.duration) != null ? K : p,
746
- className: c?.className,
747
- descriptionClassName: c?.descriptionClassName,
748
- invert: s,
749
- visibleToasts: U,
750
- closeButton: (at = c?.closeButton) != null ? at : T,
751
- interacting: X,
752
- position: u,
753
- style: c?.style,
754
- unstyled: c?.unstyled,
755
- classNames: c?.classNames,
756
- cancelButtonStyle: c?.cancelButtonStyle,
757
- actionButtonStyle: c?.actionButtonStyle,
758
- closeButtonAriaLabel: c?.closeButtonAriaLabel,
759
- removeToast: tt,
760
- toasts: O.filter((ot) => ot.position == h.position),
761
- heights: it.filter((ot) => ot.position == h.position),
762
- setHeights: pt,
763
- expandByDefault: b,
764
- gap: nt,
765
- expanded: gt,
766
- swipeDirections: o.swipeDirections
767
- });
768
- })) : null;
769
- }));
770
- }), De = ({ ...n }) => {
771
- const { theme: o = "system" } = Jt();
772
- return /* @__PURE__ */ Wt(
773
- Se,
774
- {
775
- className: "toaster group",
776
- style: {
777
- "--normal-bg": "var(--popover)",
778
- "--normal-text": "var(--popover-foreground)",
779
- "--normal-border": "var(--border)"
780
- },
781
- theme: o,
782
- ...n
783
- }
784
- );
785
- };
786
- export {
787
- De as Toaster
788
- };