@mechane-ai/elements 0.39.0 → 0.41.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 (110) hide show
  1. package/NOTICE +11 -19
  2. package/README.md +49 -25
  3. package/dist/accessibility-P89UG9-r.js +25 -0
  4. package/dist/agent.js +1 -0
  5. package/dist/ai.js +50 -44
  6. package/dist/{categorical-values-BECG-J6R.js → categorical-values-DnGR_pQx.js} +3 -3
  7. package/dist/{chart-frame-CJFnI39T.js → chart-frame-BsyI1Zc8.js} +58 -57
  8. package/dist/{chart-input-DwAobO8Y.js → chart-input-r4S3-QCT.js} +2 -2
  9. package/dist/chart-navigation-D7OkLdSx.js +119 -0
  10. package/dist/charts/cartesian.js +560 -583
  11. package/dist/charts/distribution.js +218 -218
  12. package/dist/charts/graph.js +86 -85
  13. package/dist/charts/hierarchy.js +4 -4
  14. package/dist/charts/matrix.js +148 -147
  15. package/dist/charts/timeline.js +77 -76
  16. package/dist/charts.js +2 -2
  17. package/dist/code-block-C4K1sM9O.js +255 -0
  18. package/dist/collections.js +828 -607
  19. package/dist/constants.stylex-BILvnwUk.js +84 -0
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +184 -77
  25. package/dist/{content-link-B3ObdyZY.js → content-link-CBDqSvgP.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/control-styles-D3q_Qyxi.js +179 -0
  28. package/dist/csp.js +14 -1
  29. package/dist/feedback.js +1 -1
  30. package/dist/forms/dates.js +359 -245
  31. package/dist/forms-I-WMHTkr.js +139 -0
  32. package/dist/forms.js +3 -3
  33. package/dist/index.js +1 -1
  34. package/dist/layout.js +271 -241
  35. package/dist/navigation/commands.js +87 -76
  36. package/dist/{navigation-D2_sGy3C.js → navigation-CveMIuXI.js} +1 -1
  37. package/dist/navigation.js +2 -2
  38. package/dist/overlays.js +1 -1
  39. package/dist/packages/ai/src/message-action.d.ts +1 -1
  40. package/dist/packages/charts/src/chart-navigation.d.ts +18 -2
  41. package/dist/packages/charts/src/chart-surface.d.ts +23 -0
  42. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -2
  43. package/dist/packages/collections/src/data-table.d.ts +7 -2
  44. package/dist/packages/collections/src/index.d.ts +4 -1
  45. package/dist/packages/collections/src/query-controls.d.ts +18 -0
  46. package/dist/packages/collections/src/table-query.d.ts +64 -0
  47. package/dist/packages/collections/src/use-collection-controls.d.ts +3 -8
  48. package/dist/packages/content/src/pierre-theme.d.ts +0 -1
  49. package/dist/packages/core/src/actions.d.ts +15 -13
  50. package/dist/packages/core/src/copy-value.d.ts +3 -2
  51. package/dist/packages/core/src/disclosure.d.ts +14 -11
  52. package/dist/packages/feedback/src/notifications.d.ts +15 -15
  53. package/dist/packages/feedback/src/toast.d.ts +9 -3
  54. package/dist/packages/forms/src/combobox.d.ts +31 -41
  55. package/dist/packages/forms/src/dates/event-month.d.ts +17 -0
  56. package/dist/packages/forms/src/dates/index.d.ts +2 -0
  57. package/dist/packages/forms/src/field-styles.d.ts +0 -19
  58. package/dist/packages/forms/src/form-controls.d.ts +26 -24
  59. package/dist/packages/forms/src/forms.d.ts +17 -14
  60. package/dist/packages/forms/src/select-control.d.ts +6 -4
  61. package/dist/packages/forms/src/select.d.ts +14 -18
  62. package/dist/packages/forms/src/selection-state.d.ts +11 -0
  63. package/dist/packages/forms/src/selection-styles.d.ts +3 -0
  64. package/dist/packages/forms/src/selection.d.ts +21 -19
  65. package/dist/packages/foundations/src/agent/index.d.ts +2 -0
  66. package/dist/packages/foundations/src/control-state.d.ts +2 -3
  67. package/dist/packages/foundations/src/control-styles.d.ts +19 -0
  68. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  69. package/dist/packages/foundations/src/csp/provider.d.ts +3 -0
  70. package/dist/packages/foundations/src/style-composition.d.ts +4 -1
  71. package/dist/packages/layout/src/app-shell.d.ts +12 -1
  72. package/dist/packages/layout/src/index.d.ts +1 -1
  73. package/dist/packages/layout/src/navigation-rail.d.ts +15 -2
  74. package/dist/packages/layout/src/resizable.d.ts +2 -2
  75. package/dist/packages/layout/src/sidebar.d.ts +4 -3
  76. package/dist/packages/navigation/src/tab-styles.d.ts +1 -1
  77. package/dist/packages/navigation/src/tabs.d.ts +12 -10
  78. package/dist/packages/overlays/src/alert-dialog.d.ts +19 -13
  79. package/dist/packages/overlays/src/dialog.d.ts +39 -24
  80. package/dist/packages/overlays/src/drawer.d.ts +16 -26
  81. package/dist/packages/overlays/src/menu.d.ts +37 -44
  82. package/dist/packages/overlays/src/overlay-root.d.ts +10 -0
  83. package/dist/packages/overlays/src/popover.d.ts +11 -20
  84. package/dist/packages/overlays/src/preview.d.ts +6 -13
  85. package/dist/packages/overlays/src/tooltip.d.ts +12 -15
  86. package/dist/{pierre-diff-CaPsfQRo.js → pierre-diff-DJ3oOfPX.js} +5 -5
  87. package/dist/{src-DPRmO-JY.js → src-CNV1ewzb.js} +379 -407
  88. package/dist/{src-CSWIG_op.js → src-CQQvXi7a.js} +58 -81
  89. package/dist/{src-DWjAoOyd.js → src-D2OHco8V.js} +42 -41
  90. package/dist/src-DfOAlAd2.js +750 -0
  91. package/dist/src-na2DdkKI.js +561 -0
  92. package/dist/{src-C-Sx37kz.js → src-s3tWwnN4.js} +361 -518
  93. package/dist/styles.js +3 -0
  94. package/dist/{elements.css → styles2.css} +195 -97
  95. package/dist/tokens.js +3 -1
  96. package/dist/{tokens.stylex-CJbIDPB9.js → tokens.stylex-dF5CACEJ.js} +13 -93
  97. package/package.json +8 -9
  98. package/skills/elements-workspace/SKILL.md +12 -0
  99. package/dist/accessibility-C-aIZ1Yx.js +0 -15
  100. package/dist/chart-navigation-CBIeNtJq.js +0 -67
  101. package/dist/code-block-aC0Htt4N.js +0 -184
  102. package/dist/forms-BQQFas9g.js +0 -118
  103. package/dist/foundations.css +0 -7
  104. package/dist/packages/content/src/tree/pierre-tree.d.ts +0 -3
  105. package/dist/pierre-theme-BpNaWn1x.js +0 -126
  106. package/dist/pierre-tree-CYCRjdGG.js +0 -106
  107. package/dist/src-d7EAi61b.js +0 -617
  108. package/dist/src-nkgFDl-g.js +0 -1171
  109. package/dist/style-composition-uYlczSsB.js +0 -9
  110. package/styles.css +0 -2
@@ -1,1171 +0,0 @@
1
- import { A as e, N as t, i as n, j as r, k as i, s as a } from "./src-C-Sx37kz.js";
2
- import { b as o, i as s, n as c, r as l, u, y as d } from "./tokens.stylex-CJbIDPB9.js";
3
- import { t as f } from "./accessibility-C-aIZ1Yx.js";
4
- import { mergeProps as p } from "@base-ui/react/merge-props";
5
- import * as m from "@stylexjs/stylex";
6
- import h, { createContext as g, useContext as _, useEffect as v, useRef as y, useState as b } from "react";
7
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
8
- import { Box as w, CircleCheck as T, CircleX as ee, Info as E, LoaderCircle as D, TriangleAlert as te, X as O } from "lucide-react";
9
- import { Meter as k } from "@base-ui/react/meter";
10
- import { Progress as A } from "@base-ui/react/progress";
11
- import ne from "react-dom";
12
- // packages/feedback/src/feedback.tsx
13
- function re({ title: e, children: t, action: r, ...i }) {
14
- return /* @__PURE__ */ C("div", {
15
- ...p({ className: "x78zum5 xdt5ytf x6s0dn4 xl56j7k x2b8uid xeuugli x193iq5w x9f619 x9w77qv xnx3t7k x1n8ia3y x1hz01jw xj57cvi xvmahel xj0a0fe" }, i),
16
- children: [
17
- /* @__PURE__ */ S(w, {
18
- size: 22,
19
- "aria-hidden": !0,
20
- className: "x153jb6y x2lah0s"
21
- }),
22
- /* @__PURE__ */ S(a, { children: e }),
23
- t != null && /* @__PURE__ */ S(n, { children: t }),
24
- r != null && /* @__PURE__ */ S("div", {
25
- className: "x78zum5 xl56j7k x1a02dak x1hnptsi xeuugli x193iq5w",
26
- children: r
27
- })
28
- ]
29
- });
30
- }
31
- function j({ hasError: e = !1, ...t }) {
32
- return /* @__PURE__ */ S("div", { ...p({ role: e ? "alert" : "status" }, {
33
- 0: { className: "xeuugli x193iq5w x9f619 x1qokhjc x1doqdfy x1ok0vyi x1hz01jw xvmahel xtqrqnz x1778rvt xj57cvi x1dqe72f x1f9ixgr xj0a0fe" },
34
- 1: { className: "xeuugli x193iq5w x9f619 x1qokhjc x1doqdfy x1ok0vyi x1hz01jw xvmahel xtqrqnz x1778rvt xj57cvi xj0a0fe xr5kp14 xcqwzn" }
35
- }[!!e | 0], t) });
36
- }
37
- // packages/feedback/src/skeleton.tsx
38
- var M = {
39
- skeleton: {
40
- k1xSpc: "x1lliihq",
41
- ks0D6T: "x193iq5w",
42
- kWkggS: "x1fa40ue",
43
- kaIpWk: "x1ok0vyi",
44
- kmuXW: "x2lah0s",
45
- $$css: !0
46
- },
47
- dimensions: (e, t) => [{
48
- kzqmXN: e == null ? e : "x5lhr3w",
49
- kZKoxP: t == null ? t : "x16ye13r",
50
- $$css: !0
51
- }, {
52
- "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
53
- "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
54
- }],
55
- width: (e) => [{
56
- kzqmXN: e == null ? e : "x5lhr3w",
57
- $$css: !0
58
- }, { "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
59
- circle: {
60
- kaIpWk: "x16rqkct",
61
- $$css: !0
62
- },
63
- rectangle: { $$css: !0 },
64
- text: {
65
- k1xSpc: "x3nfvp2",
66
- kXwgrk: "xdt5ytf",
67
- k7Eaqz: "xeuugli",
68
- ks0D6T: "x193iq5w",
69
- kXLuUW: "x16dsc37",
70
- $$css: !0
71
- },
72
- label: {
73
- k7Eaqz: "xeuugli",
74
- $$css: !0
75
- }
76
- }, ie = {
77
- rectangle: M.rectangle,
78
- circle: M.circle
79
- };
80
- function N({ width: e = "100%", height: t = 8, shape: n = "rectangle" }) {
81
- return /* @__PURE__ */ S("span", {
82
- "aria-hidden": !0,
83
- ...m.props(M.skeleton, M.dimensions(e, t), ie[n])
84
- });
85
- }
86
- function P({ lines: e = 1, width: t = "100%" }) {
87
- return /* @__PURE__ */ S("span", {
88
- "aria-hidden": !0,
89
- ...m.props(M.text, M.width(t)),
90
- children: Array.from({ length: e }, (t, n) => /* @__PURE__ */ S("span", {
91
- className: "x78zum5 x6s0dn4 xg2ss61",
92
- children: /* @__PURE__ */ S(N, {
93
- width: e > 1 && n === e - 1 ? "65%" : "100%",
94
- height: "0.6em"
95
- })
96
- }, `placeholder-${n}`))
97
- });
98
- }
99
- function F({ label: e, showLabel: t = !1 }) {
100
- return /* @__PURE__ */ C("span", {
101
- role: "status",
102
- className: "x3nfvp2 x1n2onr6 x6s0dn4 xeuugli x193iq5w x1hnptsi x153jb6y x1hz01jw xtqrqnz x1778rvt xj57cvi xj0a0fe",
103
- children: [/* @__PURE__ */ S(D, {
104
- "aria-hidden": !0,
105
- className: "xtwnzbg x18utl2x x2lah0s"
106
- }), /* @__PURE__ */ S("span", {
107
- ...m.props(M.label, !t && f.hidden),
108
- children: e
109
- })]
110
- });
111
- }
112
- // packages/feedback/src/control-placeholders.tsx
113
- var ae = {
114
- ks0D6T: "x193iq5w",
115
- $$css: !0
116
- }, I = {
117
- kZKoxP: "x16ye13r",
118
- $$css: !0
119
- }, L = {
120
- button: {
121
- kWkggS: "x1r7kqkb",
122
- kXLuUW: "xxymvpz",
123
- $$css: !0
124
- },
125
- singleLine: {
126
- k1xSpc: "x78zum5",
127
- kGNEyG: "x6s0dn4",
128
- $$css: !0
129
- },
130
- width: (e) => [
131
- ae,
132
- {
133
- kzqmXN: e == null ? e : "x5lhr3w",
134
- $$css: !0
135
- },
136
- { "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
137
- ],
138
- rows: (e) => [I, { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(`calc(${e} * 1lh + 2 * ${s.paddingBlock} + 2px)`) }]
139
- };
140
- function oe({ width: t = "7ch", isIconOnly: n = !1, density: a = "standard", xstyle: o }) {
141
- return /* @__PURE__ */ S("span", {
142
- "aria-hidden": !0,
143
- inert: !0,
144
- ...m.props(r.base, r.button, e[a], i[a], n && r.iconButton, L.button, o),
145
- children: n ? /* @__PURE__ */ S(N, {
146
- width: s.iconSize,
147
- height: s.iconSize
148
- }) : /* @__PURE__ */ S(P, { width: t })
149
- });
150
- }
151
- function R({ label: n, hint: i, isMultiline: a = !1, density: o = "standard", rows: s = 4, width: c = "100%", xstyle: l }) {
152
- let u = a ? Math.min(s, 6) : 1;
153
- return /* @__PURE__ */ C("div", {
154
- "aria-hidden": !0,
155
- ...m.props(r.fieldRoot, L.width(c), l),
156
- children: [
157
- n !== void 0 && /* @__PURE__ */ S("span", {
158
- ...m.props(r.label),
159
- children: n
160
- }),
161
- /* @__PURE__ */ S("div", {
162
- ...m.props(r.base, r.field, e[o], !a && r.singleLineField, !a && t[o], !a && L.singleLine, a && r.textarea, a && L.rows(s)),
163
- children: /* @__PURE__ */ S(P, {
164
- width: "60%",
165
- lines: u
166
- })
167
- }),
168
- i !== void 0 && /* @__PURE__ */ S("span", {
169
- ...m.props(r.description),
170
- children: i
171
- })
172
- ]
173
- });
174
- }
175
- // packages/foundations/src/chart-tones.ts
176
- var z = {
177
- series1: c.series1,
178
- series2: c.series2,
179
- series3: c.series3,
180
- series4: c.series4,
181
- series5: c.series5,
182
- series6: c.series6,
183
- positive: c.positive,
184
- negative: c.negative,
185
- neutral: l.muted
186
- }, B = {
187
- root: {
188
- k1xSpc: "x78zum5",
189
- kXwgrk: "xdt5ytf",
190
- kOIVth: "x1hnptsi",
191
- kzqmXN: "xh8yej3",
192
- k7Eaqz: "xeuugli",
193
- kMv6JI: "x1hz01jw",
194
- kGuDYH: "xtqrqnz",
195
- kLWn49: "x1778rvt",
196
- k63SB2: "xj57cvi",
197
- kMwMTN: "xbixft",
198
- kHjlTd: "xj0a0fe",
199
- $$css: !0
200
- },
201
- heading: {
202
- k1xSpc: "x78zum5",
203
- kGNEyG: "x1pha0wt",
204
- kjj79g: "x1qughib",
205
- kOIVth: "x1n8ia3y",
206
- kwnvtZ: "x1a02dak",
207
- $$css: !0
208
- },
209
- label: {
210
- k7Eaqz: "xeuugli",
211
- ks0D6T: "x193iq5w",
212
- $$css: !0
213
- },
214
- value: {
215
- k7Eaqz: "xeuugli",
216
- ks0D6T: "x193iq5w",
217
- kMwMTN: "x153jb6y",
218
- kcqcaj: "xss6m8b",
219
- $$css: !0
220
- },
221
- track: {
222
- kZKoxP: "xqu0tyb",
223
- kzqmXN: "xh8yej3",
224
- kaIpWk: "x1ok0vyi",
225
- kWkggS: "x1fa40ue",
226
- kVQacm: "xb3r6kr",
227
- $$css: !0
228
- },
229
- indicator: {
230
- kZKoxP: "x5yr21d",
231
- kWkggS: "x1pt885t",
232
- kaIpWk: "x1ok0vyi",
233
- $$css: !0
234
- },
235
- inline: {
236
- kXwgrk: "x1q0g3np",
237
- kGNEyG: "x6s0dn4",
238
- kjj79g: "x13a6bvl",
239
- kwnvtZ: "x1a02dak",
240
- $$css: !0
241
- },
242
- inlineHeading: {
243
- k1xSpc: "xjp7ctv",
244
- $$css: !0
245
- },
246
- inlineValue: {
247
- kMwMTN: "xbixft",
248
- $$css: !0
249
- },
250
- inlineTrack: {
251
- kzqmXN: "x1useyqa x1251vi3",
252
- kmuXW: "x2lah0s",
253
- $$css: !0
254
- },
255
- tone: (e) => [{
256
- kWkggS: e == null ? e : "xl8spv7",
257
- $$css: !0
258
- }, { "--x-backgroundColor": e ?? void 0 }],
259
- unknown: {
260
- kWkggS: "x1r7kqkb",
261
- kMzoRj: "xmkeg23",
262
- ksu8eU: "xbsl7fq",
263
- kVAM5u: "xqrc7c3",
264
- kB7OPa: "x9f619",
265
- $$css: !0
266
- }
267
- }, se = {
268
- stacked: {
269
- root: void 0,
270
- heading: void 0,
271
- label: void 0,
272
- value: void 0,
273
- track: void 0
274
- },
275
- inline: {
276
- root: B.inline,
277
- heading: B.inlineHeading,
278
- label: f.hidden,
279
- value: B.inlineValue,
280
- track: B.inlineTrack
281
- }
282
- };
283
- function ce({ label: e, value: t, max: n, valueLabel: r }) {
284
- return /* @__PURE__ */ C(A.Root, {
285
- value: t,
286
- max: n,
287
- locale: "en-US",
288
- getAriaValueText: () => r,
289
- className: "x78zum5 xdt5ytf x1hnptsi xh8yej3 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft xj0a0fe",
290
- children: [/* @__PURE__ */ C("div", {
291
- className: "x78zum5 x1pha0wt x1qughib x1n8ia3y x1a02dak",
292
- children: [/* @__PURE__ */ S(A.Label, {
293
- className: "xeuugli x193iq5w",
294
- children: e
295
- }), /* @__PURE__ */ S("span", {
296
- className: "xeuugli x193iq5w x153jb6y xss6m8b",
297
- children: r
298
- })]
299
- }), /* @__PURE__ */ S(A.Track, {
300
- ...{
301
- 0: { className: "xqu0tyb xh8yej3 x1ok0vyi x1fa40ue xb3r6kr" },
302
- 1: { className: "xqu0tyb xh8yej3 x1ok0vyi xb3r6kr x1r7kqkb xmkeg23 xbsl7fq xqrc7c3 x9f619" }
303
- }[t === null | 0],
304
- children: t !== null && /* @__PURE__ */ S(A.Indicator, { className: "x5yr21d x1pt885t x1ok0vyi" })
305
- })]
306
- });
307
- }
308
- function V({ label: e, value: t, max: n, valueLabel: r, layout: i = "stacked", tone: a }) {
309
- let o = se[i], s = a === void 0 ? void 0 : B.tone(z[a]), c = t !== null && Number.isFinite(t);
310
- return Number.isFinite(n) && n > 0 && c && t >= 0 && t <= n ? /* @__PURE__ */ C(k.Root, {
311
- value: t,
312
- max: n,
313
- locale: "en-US",
314
- getAriaValueText: () => r,
315
- ...m.props(B.root, o.root),
316
- children: [/* @__PURE__ */ C("div", {
317
- ...m.props(B.heading, o.heading),
318
- children: [/* @__PURE__ */ S(k.Label, {
319
- ...m.props(B.label, o.label),
320
- children: e
321
- }), /* @__PURE__ */ S("span", {
322
- ...m.props(B.value, o.value),
323
- children: r
324
- })]
325
- }), /* @__PURE__ */ S(k.Track, {
326
- ...m.props(B.track, o.track),
327
- children: /* @__PURE__ */ S(k.Indicator, { ...m.props(B.indicator, s) })
328
- })]
329
- }) : /* @__PURE__ */ C("div", {
330
- ...m.props(B.root, o.root),
331
- children: [/* @__PURE__ */ C("div", {
332
- ...m.props(B.heading, o.heading),
333
- children: [/* @__PURE__ */ S("span", {
334
- ...m.props(B.label, o.label),
335
- children: e
336
- }), /* @__PURE__ */ S("span", {
337
- ...m.props(B.value, o.value),
338
- children: r
339
- })]
340
- }), /* @__PURE__ */ S("div", {
341
- "aria-hidden": !0,
342
- ...m.props(B.track, o.track, B.unknown)
343
- })]
344
- });
345
- }
346
- // ../../../node_modules/.pnpm/sonner@2.0.8_@types+react@19.3.0_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/sonner/dist/index.mjs
347
- var le = (e) => {
348
- switch (e) {
349
- case "success": return H;
350
- case "info": return pe;
351
- case "warning": return fe;
352
- case "error": return U;
353
- default: return null;
354
- }
355
- }, ue = Array(12).fill(0), de = ({ visible: e, className: t }) => /*#__PURE__*/ h.createElement("div", {
356
- className: ["sonner-loading-wrapper", t].filter(Boolean).join(" "),
357
- "data-visible": e
358
- }, /*#__PURE__*/ h.createElement("div", { className: "sonner-spinner" }, ue.map((e, t) => /*#__PURE__*/ h.createElement("div", {
359
- className: "sonner-loading-bar",
360
- key: `spinner-bar-${t}`
361
- })))), H = /*#__PURE__*/ h.createElement("svg", {
362
- xmlns: "http://www.w3.org/2000/svg",
363
- viewBox: "0 0 20 20",
364
- fill: "currentColor",
365
- height: "20",
366
- width: "20",
367
- "aria-hidden": "true"
368
- }, /*#__PURE__*/ h.createElement("path", {
369
- fillRule: "evenodd",
370
- 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",
371
- clipRule: "evenodd"
372
- })), fe = /*#__PURE__*/ h.createElement("svg", {
373
- xmlns: "http://www.w3.org/2000/svg",
374
- viewBox: "0 0 24 24",
375
- fill: "currentColor",
376
- height: "20",
377
- width: "20",
378
- "aria-hidden": "true"
379
- }, /*#__PURE__*/ h.createElement("path", {
380
- fillRule: "evenodd",
381
- 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",
382
- clipRule: "evenodd"
383
- })), pe = /*#__PURE__*/ h.createElement("svg", {
384
- xmlns: "http://www.w3.org/2000/svg",
385
- viewBox: "0 0 20 20",
386
- fill: "currentColor",
387
- height: "20",
388
- width: "20",
389
- "aria-hidden": "true"
390
- }, /*#__PURE__*/ h.createElement("path", {
391
- fillRule: "evenodd",
392
- 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",
393
- clipRule: "evenodd"
394
- })), U = /*#__PURE__*/ h.createElement("svg", {
395
- xmlns: "http://www.w3.org/2000/svg",
396
- viewBox: "0 0 20 20",
397
- fill: "currentColor",
398
- height: "20",
399
- width: "20",
400
- "aria-hidden": "true"
401
- }, /*#__PURE__*/ h.createElement("path", {
402
- fillRule: "evenodd",
403
- 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",
404
- clipRule: "evenodd"
405
- })), me = /*#__PURE__*/ h.createElement("svg", {
406
- xmlns: "http://www.w3.org/2000/svg",
407
- width: "12",
408
- height: "12",
409
- viewBox: "0 0 24 24",
410
- fill: "none",
411
- stroke: "currentColor",
412
- strokeWidth: "1.5",
413
- strokeLinecap: "round",
414
- strokeLinejoin: "round",
415
- "aria-hidden": "true"
416
- }, /*#__PURE__*/ h.createElement("line", {
417
- x1: "18",
418
- y1: "6",
419
- x2: "6",
420
- y2: "18"
421
- }), /*#__PURE__*/ h.createElement("line", {
422
- x1: "6",
423
- y1: "6",
424
- x2: "18",
425
- y2: "18"
426
- })), he = () => {
427
- let [e, t] = h.useState(document.hidden);
428
- return h.useEffect(() => {
429
- let e = () => {
430
- t(document.hidden);
431
- };
432
- return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
433
- }, []), e;
434
- }, ge = 1, _e = 100, W = (e) => typeof e?.id == "number" || e?.id?.length > 0 ? e.id : ge++, G = new class {
435
- constructor() {
436
- this.subscribe = (e) => (this.subscribers.push(e), this.getActiveToasts().forEach((t) => e(t)), () => {
437
- let t = this.subscribers.indexOf(e);
438
- this.subscribers.splice(t, 1);
439
- }), this.publish = (e) => {
440
- this.subscribers.forEach((t) => t(e));
441
- }, this.addToast = (e) => {
442
- this.publish(e), this.toasts = [...this.toasts, e], this.trimHistory();
443
- }, this.trimHistory = () => {
444
- let e = this.toasts.length - _e;
445
- e <= 0 || (this.toasts = this.toasts.filter((t) => e > 0 && this.dismissedToasts.has(t.id) ? (this.dismissedToasts.delete(t.id), e--, !1) : !0));
446
- }, this.create = (e) => {
447
- let { message: t, ...n } = e, r = W(e), i = this.pendingDismissals.get(r);
448
- i !== void 0 && (cancelAnimationFrame(i), this.pendingDismissals.delete(r), this.dismissedToasts.delete(r));
449
- let a = this.dismissedToasts.has(r), o = e.dismissible === void 0 || e.dismissible;
450
- return a && (this.dismissedToasts.delete(r), this.toasts = this.toasts.filter((e) => e.id !== r)), !a && this.toasts.find((e) => e.id === r) ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
451
- ...n,
452
- ...e,
453
- id: r,
454
- title: t
455
- }), {
456
- ...n,
457
- ...e,
458
- id: r,
459
- dismissible: o,
460
- title: t
461
- }) : n) : this.addToast({
462
- title: t,
463
- ...n,
464
- dismissible: o,
465
- id: r
466
- }), r;
467
- }, this.dismiss = (e) => {
468
- if (e == null) return this.getActiveToasts().forEach((e) => {
469
- this.dismissedToasts.add(e.id), this.subscribers.forEach((t) => t({
470
- id: e.id,
471
- dismiss: !0
472
- }));
473
- }), e;
474
- this.dismissedToasts.add(e);
475
- let t = this.pendingDismissals.get(e);
476
- return t !== void 0 && cancelAnimationFrame(t), this.pendingDismissals.set(e, requestAnimationFrame(() => {
477
- this.pendingDismissals.delete(e), this.subscribers.forEach((t) => t({
478
- id: e,
479
- dismiss: !0
480
- }));
481
- })), e;
482
- }, this.message = (e, t) => this.create({
483
- ...t,
484
- message: e,
485
- type: void 0
486
- }), this.error = (e, t) => this.create({
487
- ...t,
488
- message: e,
489
- type: "error"
490
- }), this.success = (e, t) => this.create({
491
- ...t,
492
- type: "success",
493
- message: e
494
- }), this.info = (e, t) => this.create({
495
- ...t,
496
- type: "info",
497
- message: e
498
- }), this.warning = (e, t) => this.create({
499
- ...t,
500
- type: "warning",
501
- message: e
502
- }), this.loading = (e, t) => this.create({
503
- ...t,
504
- type: "loading",
505
- message: e
506
- }), this.promise = (e, t) => {
507
- if (!t) return;
508
- let n;
509
- t.loading !== void 0 && (n = this.create({
510
- ...t,
511
- promise: e,
512
- type: "loading",
513
- message: t.loading,
514
- description: typeof t.description == "function" ? void 0 : t.description
515
- }));
516
- let r = Promise.resolve(e instanceof Function ? e() : e), i = n !== void 0, a, o = r.then(async (e) => {
517
- if (a = ["resolve", e], h.isValidElement(e)) i = !1, this.create({
518
- id: n,
519
- type: "default",
520
- message: e
521
- });
522
- else if (K(e) && !e.ok) {
523
- i = !1;
524
- let r = typeof t.error == "function" ? await t.error(`HTTP error! status: ${e.status}`) : t.error, a = typeof t.description == "function" ? await t.description(`HTTP error! status: ${e.status}`) : t.description, o = typeof r == "object" && !h.isValidElement(r) ? r : { message: r };
525
- this.create({
526
- id: n,
527
- type: "error",
528
- description: a,
529
- ...o
530
- });
531
- } else if (e instanceof Error) {
532
- i = !1;
533
- let r = typeof t.error == "function" ? await t.error(e) : t.error, a = typeof t.description == "function" ? await t.description(e) : t.description, o = typeof r == "object" && !h.isValidElement(r) ? r : { message: r };
534
- this.create({
535
- id: n,
536
- type: "error",
537
- description: a,
538
- ...o
539
- });
540
- } else if (t.success !== void 0) {
541
- i = !1;
542
- let r = typeof t.success == "function" ? await t.success(e) : t.success, a = typeof t.description == "function" ? await t.description(e) : t.description, o = typeof r == "object" && !h.isValidElement(r) ? r : { message: r };
543
- this.create({
544
- id: n,
545
- type: "success",
546
- description: a,
547
- ...o
548
- });
549
- }
550
- }).catch(async (e) => {
551
- if (a = ["reject", e], t.error !== void 0) {
552
- i = !1;
553
- let r = typeof t.error == "function" ? await t.error(e) : t.error, a = typeof t.description == "function" ? await t.description(e) : t.description, o = typeof r == "object" && !h.isValidElement(r) ? r : { message: r };
554
- this.create({
555
- id: n,
556
- type: "error",
557
- description: a,
558
- ...o
559
- });
560
- }
561
- }).finally(() => {
562
- i && (this.dismiss(n), n = void 0), t.finally == null || t.finally.call(t);
563
- }), s = () => new Promise((e, t) => o.then(() => a[0] === "reject" ? t(a[1]) : e(a[1])).catch(t));
564
- return typeof n != "string" && typeof n != "number" ? { unwrap: s } : Object.assign(n, { unwrap: s });
565
- }, this.custom = (e, t) => {
566
- let n = W(t);
567
- return this.create({
568
- ...t,
569
- jsx: e(n),
570
- id: n,
571
- type: void 0
572
- }), n;
573
- }, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set(), this.pendingDismissals = /* @__PURE__ */ new Map();
574
- }
575
- }(), ve = (e, t) => G.message(e, t), K = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", q = Object.assign(ve, {
576
- success: G.success,
577
- info: G.info,
578
- warning: G.warning,
579
- error: G.error,
580
- custom: G.custom,
581
- message: G.message,
582
- promise: G.promise,
583
- dismiss: G.dismiss,
584
- loading: G.loading
585
- }, {
586
- getHistory: () => G.toasts,
587
- getToasts: () => G.getActiveToasts()
588
- });
589
- function J(e) {
590
- return e.label !== void 0;
591
- }
592
- var ye = 3, be = "24px", xe = "16px", Se = 4e3, Y = 356, Ce = 14, we = 45, Te = 200;
593
- function X(...e) {
594
- return e.filter(Boolean).join(" ");
595
- }
596
- function Ee(e) {
597
- let [t, n] = e.split("-"), r = [];
598
- return t && r.push(t), n && r.push(n), r;
599
- }
600
- var Z = (e) => {
601
- let { invert: t, toast: n, unstyled: r, interacting: i, setHeights: a, visibleToasts: o, heights: s, index: c, toasts: l, expanded: u, removeToast: d, defaultRichColors: f, closeButton: p, style: m, cancelButtonStyle: g, actionButtonStyle: _, className: v = "", descriptionClassName: y = "", duration: b, position: x, gap: S, expandByDefault: C, classNames: w, icons: T, closeButtonAriaLabel: ee = "Close toast" } = e, [E, D] = h.useState(null), [te, O] = h.useState(null), [k, A] = h.useState(!1), [ne, re] = h.useState(!1), [j, M] = h.useState(!1), [ie, N] = h.useState(!1), [P, F] = h.useState(!1), [ae, I] = h.useState(0), [L, oe] = h.useState(0), R = h.useRef(n.duration || b || Se), z = h.useRef(null), B = h.useRef(null), se = c === 0, ce = c + 1 <= o, V = n.type, ue = V ?? "default", H = n.dismissible !== !1, fe = n.className || "", pe = n.descriptionClassName || "", U = h.useMemo(() => s.findIndex((e) => e.toastId === n.id) || 0, [s, n.id]), ge = h.useMemo(() => n.closeButton ?? p, [n.closeButton, p]), _e = h.useMemo(() => n.duration || b || Se, [n.duration, b]), W = h.useRef(0), G = h.useRef(0), ve = h.useRef(0), K = h.useRef(null), [q, ye] = x.split("-"), be = h.useMemo(() => s.reduce((e, t, n) => n >= U ? e : e + t.height, 0), [s, U]), xe = he(), Y = h.useMemo(() => e.swipeDirections ?? Ee(x), [e.swipeDirections, x]), Ce = n.invert || t, Z = V === "loading";
602
- G.current = h.useMemo(() => U * S + be, [U, be]), h.useEffect(() => {
603
- R.current = _e;
604
- }, [_e]), h.useEffect(() => {
605
- A(!0);
606
- }, []), h.useEffect(() => {
607
- let e = B.current;
608
- if (e) {
609
- let t = e.getBoundingClientRect().height;
610
- return oe(t), a((e) => [{
611
- toastId: n.id,
612
- height: t,
613
- position: n.position
614
- }, ...e]), () => a((e) => e.filter((e) => e.toastId !== n.id));
615
- }
616
- }, [a, n.id]), h.useLayoutEffect(() => {
617
- if (!k) return;
618
- let e = B.current, t = e.style.height;
619
- e.style.height = "auto";
620
- let r = e.getBoundingClientRect().height;
621
- e.style.height = t, oe(r), a((e) => e.find((e) => e.toastId === n.id) ? e.map((e) => e.toastId === n.id ? {
622
- ...e,
623
- height: r
624
- } : e) : [{
625
- toastId: n.id,
626
- height: r,
627
- position: n.position
628
- }, ...e]);
629
- }, [
630
- k,
631
- n.title,
632
- n.description,
633
- a,
634
- n.id,
635
- n.jsx,
636
- n.action,
637
- n.cancel
638
- ]);
639
- let Q = h.useCallback(() => {
640
- re(!0), I(G.current), a((e) => e.filter((e) => e.toastId !== n.id)), setTimeout(() => {
641
- d(n);
642
- }, Te);
643
- }, [
644
- n,
645
- d,
646
- a,
647
- G
648
- ]);
649
- h.useEffect(() => {
650
- if (n.promise && V === "loading" || n.duration === Infinity || n.type === "loading") return;
651
- let e;
652
- return u || i || xe ? (() => {
653
- if (ve.current < W.current) {
654
- let e = (/* @__PURE__ */ new Date()).getTime() - W.current;
655
- R.current -= e;
656
- }
657
- ve.current = (/* @__PURE__ */ new Date()).getTime();
658
- })() : R.current !== Infinity && (W.current = (/* @__PURE__ */ new Date()).getTime(), e = setTimeout(() => {
659
- n.onAutoClose == null || n.onAutoClose.call(n, n), Q();
660
- }, R.current)), () => clearTimeout(e);
661
- }, [
662
- u,
663
- i,
664
- n,
665
- V,
666
- xe,
667
- Q
668
- ]), h.useEffect(() => {
669
- n.delete && (Q(), n.onDismiss == null || n.onDismiss.call(n, n));
670
- }, [Q, n.delete]);
671
- function De() {
672
- return T?.loading ? /*#__PURE__*/ h.createElement("div", {
673
- className: X(w?.loader, n?.classNames?.loader, "sonner-loader"),
674
- "data-visible": V === "loading"
675
- }, T.loading) : /*#__PURE__*/ h.createElement(de, {
676
- className: X(w?.loader, n?.classNames?.loader),
677
- visible: V === "loading"
678
- });
679
- }
680
- let Oe = n.icon || T?.[V] || le(V);
681
- return /*#__PURE__*/ h.createElement("li", {
682
- tabIndex: 0,
683
- ref: B,
684
- className: X(v, fe, w?.toast, n?.classNames?.toast, w?.[ue], n?.classNames?.[ue]),
685
- "data-sonner-toast": "",
686
- "data-rich-colors": n.richColors ?? f,
687
- "data-styled": !(n.jsx || n.unstyled || r),
688
- "data-mounted": k,
689
- "data-promise": !!n.promise,
690
- "data-swiped": P,
691
- "data-removed": ne,
692
- "data-visible": ce,
693
- "data-y-position": q,
694
- "data-x-position": ye,
695
- "data-index": c,
696
- "data-front": se,
697
- "data-swiping": j,
698
- "data-dismissible": H,
699
- "data-type": V,
700
- "data-invert": Ce,
701
- "data-swipe-out": ie,
702
- "data-swipe-direction": te,
703
- "data-expanded": !!(u || C && k),
704
- "data-testid": n.testId,
705
- style: {
706
- "--index": c,
707
- "--toasts-before": c,
708
- "--z-index": l.length - c,
709
- "--offset": `${ne ? ae : G.current}px`,
710
- "--initial-height": C ? "auto" : `${L}px`,
711
- ...m,
712
- ...n.style
713
- },
714
- onDragEnd: () => {
715
- M(!1), D(null), K.current = null;
716
- },
717
- onPointerDown: (e) => {
718
- e.button !== 2 && !Z && H && (z.current = /* @__PURE__ */ new Date(), I(G.current), e.target.setPointerCapture(e.pointerId), e.target.tagName !== "BUTTON" && (M(!0), K.current = {
719
- x: e.clientX,
720
- y: e.clientY
721
- }));
722
- },
723
- onPointerUp: () => {
724
- if (ie || !H) return;
725
- K.current = null;
726
- let e = Number(B.current?.style.getPropertyValue("--swipe-amount-x").replace("px", "") || 0), t = Number(B.current?.style.getPropertyValue("--swipe-amount-y").replace("px", "") || 0), r = (/* @__PURE__ */ new Date()).getTime() - z.current?.getTime(), i = E === "x" ? e : t, a = Math.abs(i) / r;
727
- if ((E === "x" ? Y.includes(e > 0 ? "right" : "left") : Y.includes(t > 0 ? "bottom" : "top")) && (Math.abs(i) >= we || a > .11)) I(G.current), n.onDismiss == null || n.onDismiss.call(n, n), O(E === "x" ? e > 0 ? "right" : "left" : t > 0 ? "down" : "up"), Q(), N(!0);
728
- else {
729
- var o, s;
730
- (o = B.current) == null || o.style.setProperty("--swipe-amount-x", "0px"), (s = B.current) == null || s.style.setProperty("--swipe-amount-y", "0px"), F(!1), M(!1), D(null);
731
- }
732
- },
733
- onPointerMove: (e) => {
734
- var t, n;
735
- if (!K.current || !H || window.getSelection()?.toString().length > 0) return;
736
- let r = e.clientY - K.current.y, i = e.clientX - K.current.x;
737
- !E && (Math.abs(i) > 1 || Math.abs(r) > 1) && D(Math.abs(i) > Math.abs(r) ? "x" : "y");
738
- let a = {
739
- x: 0,
740
- y: 0
741
- }, o = (e) => 1 / (1.5 + Math.abs(e) / 20);
742
- if (E === "y") {
743
- if (Y.includes("top") || Y.includes("bottom")) {
744
- if (Y.includes("top") && r < 0 || Y.includes("bottom") && r > 0) a.y = r;
745
- else {
746
- let e = r * o(r);
747
- a.y = Math.abs(e) < Math.abs(r) ? e : r;
748
- }
749
- }
750
- } else if (E === "x" && (Y.includes("left") || Y.includes("right"))) {
751
- if (Y.includes("left") && i < 0 || Y.includes("right") && i > 0) a.x = i;
752
- else {
753
- let e = i * o(i);
754
- a.x = Math.abs(e) < Math.abs(i) ? e : i;
755
- }
756
- }
757
- (Math.abs(a.x) > 0 || Math.abs(a.y) > 0) && F(!0), (t = B.current) == null || t.style.setProperty("--swipe-amount-x", `${a.x}px`), (n = B.current) == null || n.style.setProperty("--swipe-amount-y", `${a.y}px`);
758
- }
759
- }, ge && !n.jsx && V !== "loading" ? /*#__PURE__*/ h.createElement("button", {
760
- "aria-label": ee,
761
- "data-disabled": Z,
762
- "data-close-button": !0,
763
- onClick: Z || !H ? () => {} : () => {
764
- Q(), n.onDismiss == null || n.onDismiss.call(n, n);
765
- },
766
- className: X(w?.closeButton, n?.classNames?.closeButton)
767
- }, T?.close ?? me) : null, (V || n.icon || n.promise) && n.icon !== null && (T?.[V] !== null || n.icon) ? /*#__PURE__*/ h.createElement("div", {
768
- "data-icon": "",
769
- className: X(w?.icon, n?.classNames?.icon)
770
- }, V === "loading" ? n.icon || De() : n.promise ? De() : null, V === "loading" ? null : Oe) : null, /*#__PURE__*/ h.createElement("div", {
771
- "data-content": "",
772
- className: X(w?.content, n?.classNames?.content)
773
- }, /*#__PURE__*/ h.createElement("div", {
774
- "data-title": "",
775
- className: X(w?.title, n?.classNames?.title)
776
- }, n.jsx ? n.jsx : typeof n.title == "function" ? n.title() : n.title), n.description ? /*#__PURE__*/ h.createElement("div", {
777
- "data-description": "",
778
- className: X(y, pe, w?.description, n?.classNames?.description)
779
- }, typeof n.description == "function" ? n.description() : n.description) : null), /*#__PURE__*/ h.isValidElement(n.cancel) ? n.cancel : n.cancel && J(n.cancel) ? /*#__PURE__*/ h.createElement("button", {
780
- "data-button": !0,
781
- "data-cancel": !0,
782
- style: n.cancelButtonStyle || g,
783
- onClick: (e) => {
784
- J(n.cancel) && H && (n.cancel.onClick == null || n.cancel.onClick.call(n.cancel, e), Q());
785
- },
786
- className: X(w?.cancelButton, n?.classNames?.cancelButton)
787
- }, n.cancel.label) : null, /*#__PURE__*/ h.isValidElement(n.action) ? n.action : n.action && J(n.action) ? /*#__PURE__*/ h.createElement("button", {
788
- "data-button": !0,
789
- "data-action": !0,
790
- style: n.actionButtonStyle || _,
791
- onClick: (e) => {
792
- J(n.action) && (n.action.onClick == null || n.action.onClick.call(n.action, e), e.defaultPrevented || Q());
793
- },
794
- className: X(w?.actionButton, n?.classNames?.actionButton)
795
- }, n.action.label) : null);
796
- };
797
- function Q() {
798
- if (typeof window > "u" || typeof document > "u") return "ltr";
799
- let e = document.documentElement.getAttribute("dir");
800
- return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
801
- }
802
- function De(e, t) {
803
- let n = {};
804
- return [e, t].forEach((e, t) => {
805
- let r = t === 1, i = r ? "--mobile-offset" : "--offset", a = r ? xe : be;
806
- function o(e) {
807
- [
808
- "top",
809
- "right",
810
- "bottom",
811
- "left"
812
- ].forEach((t) => {
813
- n[`${i}-${t}`] = typeof e == "number" ? `${e}px` : e;
814
- });
815
- }
816
- typeof e == "number" || typeof e == "string" ? o(e) : typeof e == "object" ? [
817
- "top",
818
- "right",
819
- "bottom",
820
- "left"
821
- ].forEach((t) => {
822
- e[t] === void 0 ? n[`${i}-${t}`] = a : n[`${i}-${t}`] = typeof e[t] == "number" ? `${e[t]}px` : e[t];
823
- }) : o(a);
824
- }), n;
825
- }
826
- var Oe = /*#__PURE__*/ h.forwardRef(function(e, t) {
827
- let { id: n, invert: r, position: i = "bottom-right", hotkey: a = ["altKey", "KeyT"], expand: o, closeButton: s, className: c, offset: l, mobileOffset: u, theme: d = "light", richColors: f, duration: p, style: m, visibleToasts: g = ye, toastOptions: _, dir: v = Q(), gap: y = Ce, icons: b, customAriaLabel: x, containerAriaLabel: S = "Notifications" } = e, [C, w] = h.useState([]), T = h.useMemo(() => n ? C.filter((e) => e.toasterId === n) : C.filter((e) => !e.toasterId), [C, n]), ee = h.useMemo(() => Array.from(new Set([i].concat(T.filter((e) => e.position).map((e) => e.position)))), [T, i]), [E, D] = h.useState([]), [te, O] = h.useState(!1), [k, A] = h.useState(!1), [re, j] = h.useState(d === "system" ? typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : d), M = h.useRef(null), ie = a.join("+").replace(/Key/g, "").replace(/Digit/g, ""), N = h.useRef(null), P = h.useRef(!1), F = h.useCallback((e) => {
828
- w((t) => (t.find((t) => t.id === e.id)?.delete || G.dismiss(e.id), t.filter(({ id: t }) => t !== e.id)));
829
- }, []);
830
- return h.useEffect(() => G.subscribe((e) => {
831
- e.dismiss ? requestAnimationFrame(() => {
832
- w((t) => t.map((t) => t.id === e.id ? {
833
- ...t,
834
- delete: !0
835
- } : t));
836
- }) : setTimeout(() => {
837
- ne.flushSync(() => {
838
- w((t) => {
839
- let n = t.findIndex((t) => t.id === e.id);
840
- return n === -1 ? [e, ...t] : [
841
- ...t.slice(0, n),
842
- {
843
- ...t[n],
844
- ...e
845
- },
846
- ...t.slice(n + 1)
847
- ];
848
- });
849
- });
850
- });
851
- }), []), h.useEffect(() => {
852
- if (d !== "system") {
853
- j(d);
854
- return;
855
- }
856
- if (d === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? j("dark") : j("light")), typeof window > "u") return;
857
- let e = window.matchMedia("(prefers-color-scheme: dark)");
858
- try {
859
- e.addEventListener("change", ({ matches: e }) => {
860
- j(e ? "dark" : "light");
861
- });
862
- } catch {
863
- e.addListener(({ matches: e }) => {
864
- try {
865
- j(e ? "dark" : "light");
866
- } catch (e) {
867
- console.error(e);
868
- }
869
- });
870
- }
871
- }, [d]), h.useEffect(() => {
872
- C.length <= 1 && O(!1);
873
- }, [C]), h.useEffect(() => {
874
- let e = (e) => {
875
- if (a.length > 0 && a.every((t) => e[t] || e.code === t)) {
876
- var t;
877
- O(!0), (t = M.current) == null || t.focus();
878
- }
879
- e.code === "Escape" && (document.activeElement === M.current || M.current?.contains(document.activeElement)) && O(!1);
880
- };
881
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
882
- }, [a]), h.useEffect(() => {
883
- if (M.current) return () => {
884
- N.current && (N.current.focus({ preventScroll: !0 }), N.current = null, P.current = !1);
885
- };
886
- }, [M.current]), /*#__PURE__*/ h.createElement("section", {
887
- ref: t,
888
- "aria-label": x ?? `${S} ${ie}`,
889
- tabIndex: -1,
890
- "aria-live": "polite",
891
- "aria-relevant": "additions text",
892
- "aria-atomic": "false",
893
- suppressHydrationWarning: !0,
894
- "data-react-aria-top-layer": !0
895
- }, ee.map((t, n) => {
896
- let [i, a] = t.split("-");
897
- return T.length ? /*#__PURE__*/ h.createElement("ol", {
898
- key: t,
899
- dir: v === "auto" ? Q() : v,
900
- tabIndex: -1,
901
- ref: M,
902
- className: c,
903
- "data-sonner-toaster": !0,
904
- "data-sonner-theme": re,
905
- "data-y-position": i,
906
- "data-x-position": a,
907
- style: {
908
- "--front-toast-height": `${E[0]?.height || 0}px`,
909
- "--width": `${Y}px`,
910
- "--gap": `${y}px`,
911
- ...m,
912
- ...De(l, u)
913
- },
914
- onBlur: (e) => {
915
- P.current && !e.currentTarget.contains(e.relatedTarget) && (P.current = !1, N.current &&= (N.current.focus({ preventScroll: !0 }), null));
916
- },
917
- onFocus: (e) => {
918
- e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || P.current || (P.current = !0, N.current = e.relatedTarget);
919
- },
920
- onMouseEnter: () => O(!0),
921
- onMouseMove: () => O(!0),
922
- onMouseLeave: () => {
923
- k || O(!1);
924
- },
925
- onDragEnd: () => O(!1),
926
- onPointerDown: (e) => {
927
- e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || A(!0);
928
- },
929
- onPointerUp: () => A(!1)
930
- }, T.filter((e) => !e.position && n === 0 || e.position === t).map((n, i) => /*#__PURE__*/ h.createElement(Z, {
931
- key: n.id,
932
- icons: b,
933
- index: i,
934
- toast: n,
935
- defaultRichColors: f,
936
- duration: _?.duration ?? p,
937
- className: _?.className,
938
- descriptionClassName: _?.descriptionClassName,
939
- invert: r,
940
- visibleToasts: g,
941
- closeButton: _?.closeButton ?? s,
942
- interacting: k,
943
- position: t,
944
- style: _?.style,
945
- unstyled: _?.unstyled,
946
- classNames: _?.classNames,
947
- cancelButtonStyle: _?.cancelButtonStyle,
948
- actionButtonStyle: _?.actionButtonStyle,
949
- closeButtonAriaLabel: _?.closeButtonAriaLabel,
950
- removeToast: F,
951
- toasts: T.filter((e) => e.position == n.position),
952
- heights: E.filter((e) => e.position == n.position),
953
- setHeights: D,
954
- expandByDefault: o,
955
- gap: y,
956
- expanded: te,
957
- swipeDirections: e.swipeDirections
958
- }))) : null;
959
- }));
960
- });
961
- // packages/feedback/src/notifications.ts
962
- function $({ title: e, shouldPersist: t, ...n }) {
963
- let r = {
964
- ...n,
965
- description: n.description,
966
- action: n.action ?? null,
967
- duration: 4e3
968
- };
969
- return (t === !0 || n.action !== void 0) && (r.duration = Infinity), r;
970
- }
971
- function ke(e) {
972
- return q.success(e.title, $(e));
973
- }
974
- function Ae(e) {
975
- return q.error(e.title, $(e));
976
- }
977
- function je(e) {
978
- return q.info(e.title, $(e));
979
- }
980
- function Me(e) {
981
- return q.warning(e.title, $(e));
982
- }
983
- function Ne(e) {
984
- return q.loading(e.title, {
985
- ...$(e),
986
- duration: Infinity
987
- });
988
- }
989
- function Pe({ id: e }) {
990
- q.dismiss(e);
991
- }
992
- var Fe = {
993
- success: ke,
994
- error: Ae,
995
- info: je,
996
- warning: Me,
997
- loading: Ne,
998
- dismiss: Pe
999
- };
1000
- // packages/feedback/src/toast.tsx
1001
- function Ie({ closeButton: e = !0, closeButtonAriaLabel: t = "Dismiss notification", offset: n = u.xl, mobileOffset: r = u.lg, ...i }) {
1002
- return /* @__PURE__ */ S(Oe, {
1003
- ...i,
1004
- className: "x7kce61 xkwcdv0 x19hn9gq x350ok5 x1dknavn x1qgcmqu x19j7ixz xgam3oh x7s97pk",
1005
- style: {
1006
- zIndex: d.popup,
1007
- transitionProperty: "opacity, transform"
1008
- },
1009
- offset: n,
1010
- mobileOffset: r,
1011
- closeButton: e,
1012
- icons: {
1013
- success: /* @__PURE__ */ S(T, {
1014
- "aria-hidden": !0,
1015
- className: "xtwnzbg x18utl2x x19m34er x7ixh4y"
1016
- }),
1017
- error: /* @__PURE__ */ S(ee, {
1018
- "aria-hidden": !0,
1019
- className: "xtwnzbg x18utl2x x19m34er xr5kp14"
1020
- }),
1021
- warning: /* @__PURE__ */ S(te, {
1022
- "aria-hidden": !0,
1023
- className: "xtwnzbg x18utl2x x19m34er x1f9ixgr"
1024
- }),
1025
- info: /* @__PURE__ */ S(E, {
1026
- "aria-hidden": !0,
1027
- className: "xtwnzbg x18utl2x x19m34er x153jb6y"
1028
- }),
1029
- loading: /* @__PURE__ */ S(D, {
1030
- "aria-hidden": !0,
1031
- className: "xtwnzbg x18utl2x x19m34er x153jb6y"
1032
- }),
1033
- close: /* @__PURE__ */ S(O, {
1034
- "aria-hidden": !0,
1035
- className: "xtwnzbg x18utl2x x19m34er"
1036
- })
1037
- },
1038
- toastOptions: {
1039
- unstyled: !0,
1040
- closeButtonAriaLabel: t,
1041
- style: { transitionProperty: "opacity, transform" },
1042
- classNames: {
1043
- toast: { className: "x1bl4301 x78zum5 x1a02dak x6s0dn4 x1hnptsi x1mvvolr xx4ccz x1l38xx4 xmkeg23 x1y0btm7 x1ey3b81 xy32g2j xpvm0e4 xbixft x16hm2kh x1hz01jw xvmahel xtqrqnz x1778rvt xj57cvi x7kce61 xkwcdv0 x19hn9gq x350ok5 x1dknavn x1qgcmqu x19j7ixz xgam3oh x7s97pk x-default-marker" }.className ?? "",
1044
- title: { className: "xk4h15q x104kibb x1ua5tub xh0615m xb3r6kr xj0a0fe" }.className ?? "",
1045
- description: { className: "x153jb6y x104kibb x1ua5tub xh0615m xb3r6kr xj0a0fe" }.className ?? "",
1046
- content: { className: "x78zum5 xdt5ytf x148l3ej xeuugli xfko13i x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? "",
1047
- icon: { className: "x78zum5 x1n2onr6 x2lah0s xtwnzbg x18utl2x x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? "",
1048
- loader: { className: "x7kce61 xkwcdv0 x19hn9gq x350ok5 x1dknavn" }.className ?? "",
1049
- actionButton: { className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s x9f619 xeuugli x193iq5w x17tes2r x17oiadl x1hmw7ec x1atzlso xc342km x1ok0vyi x1hz01jw xtqrqnz x1778rvt xk4h15q xeaf4i8 xj0a0fe x1ypdohk x1pt885t x1ymx3u3 xmn6lam x1eou8nq x1qgcmqu x19j7ixz xgam3oh x7s97pk x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? "",
1050
- cancelButton: { className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s x9f619 xeuugli x193iq5w x17tes2r x17oiadl x1hmw7ec x1atzlso xc342km x1ok0vyi x1hz01jw xtqrqnz x1778rvt xk4h15q xeaf4i8 xj0a0fe x1ypdohk x1r7kqkb xbixft x1mkwuse x1ecmtor x1qgcmqu x19j7ixz xgam3oh x7s97pk x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? "",
1051
- closeButton: { className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s x9f619 x193iq5w x17tes2r x17oiadl x1hmw7ec xc342km x1ok0vyi x1hz01jw xtqrqnz x1778rvt xk4h15q xeaf4i8 xj0a0fe x1ypdohk x10l6tqk x1m7q2ru x1b86y6l x16opp91 x1gjsuxi xnjsko4 xjbqb8w x153jb6y xbks5bx xfkdqyo x1snzz31 xqu5dr6 x1qgcmqu x19j7ixz xgam3oh x7s97pk x1hc1fzr xnglhca x19991ni xkwcdv0 x19hn9gq" }.className ?? ""
1052
- }
1053
- }
1054
- });
1055
- }
1056
- // packages/feedback/src/async-region.tsx
1057
- var Le = g(void 0), Re = g(!1), ze = o.delaySeconds * 1e3, Be = {
1058
- content: {
1059
- k7Eaqz: "xeuugli",
1060
- kAzted: "x2lwn1j",
1061
- k1xSpc: "x78zum5",
1062
- kXwgrk: "xdt5ytf",
1063
- kUk6DE: "x98rzlu",
1064
- $$css: !0
1065
- },
1066
- reveal: {
1067
- kKVMdj: "xqcmdr3 x1qme5af",
1068
- k44tkh: "x1irg2zc",
1069
- kyAemX: "x1c3o69q",
1070
- $$css: !0
1071
- },
1072
- imageReveal: {
1073
- k44tkh: "x11hm9ij",
1074
- $$css: !0
1075
- }
1076
- }, Ve = {
1077
- content: null,
1078
- image: Be.imageReveal
1079
- };
1080
- function He({ identity: e, initialStartedAt: t, children: n }) {
1081
- let [r, i] = b(() => ({
1082
- identity: e,
1083
- startedAt: t ?? Date.now()
1084
- })), a = r;
1085
- return r.identity !== e && (a = {
1086
- identity: e,
1087
- startedAt: Date.now()
1088
- }, i(a)), /* @__PURE__ */ S(Le, {
1089
- value: a,
1090
- children: n
1091
- });
1092
- }
1093
- function Ue({ shouldEnter: e, presentation: t = "content", children: n }) {
1094
- let r = _(Re), [i, a] = b(e && !r), o = y(null);
1095
- return v(() => {
1096
- let e = o.current;
1097
- if (!i || e === null) return;
1098
- let t = !0;
1099
- return Promise.allSettled(e.getAnimations().map((e) => e.finished)).then(() => {
1100
- t && a(!1);
1101
- }), () => {
1102
- t = !1;
1103
- };
1104
- }, [i]), /* @__PURE__ */ S("div", {
1105
- ref: o,
1106
- ...m.props(Be.content, i && Be.reveal, Ve[t]),
1107
- children: /* @__PURE__ */ S(Re, {
1108
- value: r || i,
1109
- children: n
1110
- })
1111
- });
1112
- }
1113
- function We({ label: e, placeholder: t, startedAt: n, presentation: r }) {
1114
- let [i, a] = b(() => Date.now() - n >= ze ? n : void 0), o = i === n, s = r === "image";
1115
- return v(() => {
1116
- let e = Math.max(0, ze - (Date.now() - n)), t = setTimeout(() => a(n), e);
1117
- return () => clearTimeout(t);
1118
- }, [n]), /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
1119
- "aria-busy": !0,
1120
- className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu",
1121
- children: /* @__PURE__ */ S("div", {
1122
- "aria-hidden": !0,
1123
- inert: !0,
1124
- ...{
1125
- 0: { className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu x18usnwx" },
1126
- 2: { className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu xlshs6z x18usnwx" },
1127
- 1: { className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu xqcmdr3 x1qme5af x1c3o69q x18usnwx" },
1128
- 3: { className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu xlshs6z xqcmdr3 x1qme5af x1c3o69q x18usnwx" }
1129
- }[!(s || o) << 1 | !(s || !o)],
1130
- children: t
1131
- })
1132
- }), o && /* @__PURE__ */ S("span", {
1133
- role: "status",
1134
- ...m.props(f.hidden),
1135
- children: e
1136
- })] });
1137
- }
1138
- function Ge(e) {
1139
- let t = _(Le), [n, r] = b(() => ({
1140
- state: e.state,
1141
- scope: t,
1142
- startedAt: t?.startedAt ?? Date.now(),
1143
- wasPending: e.state === "pending"
1144
- })), i = n;
1145
- if (n.scope !== t || n.state !== e.state) {
1146
- let a = n.scope !== t, o = n.startedAt;
1147
- a ? o = t?.startedAt ?? Date.now() : e.state === "pending" && (o = Date.now()), i = {
1148
- state: e.state,
1149
- scope: t,
1150
- startedAt: o,
1151
- wasPending: e.state === "pending" || !a && n.wasPending
1152
- }, r(i);
1153
- }
1154
- return /* @__PURE__ */ S("div", {
1155
- className: "x1n2onr6 xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu",
1156
- children: e.state === "pending" ? /* @__PURE__ */ S(We, {
1157
- label: e.label,
1158
- placeholder: e.placeholder,
1159
- startedAt: i.startedAt,
1160
- presentation: e.presentation ?? "content"
1161
- }) : e.state === "failed" ? /* @__PURE__ */ S("div", {
1162
- className: "xeuugli x2lwn1j x78zum5 xdt5ytf x98rzlu",
1163
- children: e.children
1164
- }) : /* @__PURE__ */ S(Ue, {
1165
- shouldEnter: i.wasPending,
1166
- presentation: e.presentation ?? "content",
1167
- children: e.children
1168
- })
1169
- });
1170
- }
1171
- export { Fe as a, z as c, N as d, P as f, j as h, Ie as i, oe as l, re as m, Ue as n, V as o, F as p, He as r, ce as s, Ge as t, R as u };