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