@g4rcez/components 3.0.1 → 3.0.2

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 (141) hide show
  1. package/dist/MotionConfigContext-C7MqlSdv.js +2713 -0
  2. package/dist/MotionConfigContext-C7MqlSdv.js.map +1 -0
  3. package/dist/autocomplete-Boida9R7.js +375 -0
  4. package/dist/autocomplete-Boida9R7.js.map +1 -0
  5. package/dist/calendar-BswV66Nx.js +1719 -0
  6. package/dist/calendar-BswV66Nx.js.map +1 -0
  7. package/dist/chevron-down-BBFYYzZq.js +6 -0
  8. package/dist/chevron-down-BBFYYzZq.js.map +1 -0
  9. package/dist/chevron-right-DvXGOiS_.js +6 -0
  10. package/dist/chevron-right-DvXGOiS_.js.map +1 -0
  11. package/dist/circle-check-big-3M5lhTxx.js +9 -0
  12. package/dist/circle-check-big-3M5lhTxx.js.map +1 -0
  13. package/dist/components/core/button.js +76 -0
  14. package/dist/components/core/button.js.map +1 -0
  15. package/dist/components/core/tag.js +67 -0
  16. package/dist/components/core/tag.js.map +1 -0
  17. package/dist/components/display/alert.js +94 -0
  18. package/dist/components/display/alert.js.map +1 -0
  19. package/dist/components/display/calendar.js +15 -0
  20. package/dist/components/display/calendar.js.map +1 -0
  21. package/dist/components/display/card.js +84 -0
  22. package/dist/components/display/card.js.map +1 -0
  23. package/dist/components/display/list.js +93 -0
  24. package/dist/components/display/list.js.map +1 -0
  25. package/dist/components/display/notifications.js +15 -0
  26. package/dist/components/display/notifications.js.map +1 -0
  27. package/dist/components/display/stats.js +16 -0
  28. package/dist/components/display/stats.js.map +1 -0
  29. package/dist/components/display/tabs.js +12 -0
  30. package/dist/components/display/tabs.js.map +1 -0
  31. package/dist/components/display/timeline.js +29 -0
  32. package/dist/components/display/timeline.js.map +1 -0
  33. package/dist/components/floating/dropdown.js +58 -0
  34. package/dist/components/floating/dropdown.js.map +1 -0
  35. package/dist/components/floating/expand.js +41 -0
  36. package/dist/components/floating/expand.js.map +1 -0
  37. package/dist/components/floating/menu.js +177 -0
  38. package/dist/components/floating/menu.js.map +1 -0
  39. package/dist/components/floating/modal.js +297 -0
  40. package/dist/components/floating/modal.js.map +1 -0
  41. package/dist/components/floating/tooltip.js +73 -0
  42. package/dist/components/floating/tooltip.js.map +1 -0
  43. package/dist/components/form/autocomplete.js +16 -0
  44. package/dist/components/form/autocomplete.js.map +1 -0
  45. package/dist/components/form/checkbox.js +44 -0
  46. package/dist/components/form/checkbox.js.map +1 -0
  47. package/dist/components/form/date-picker.js +12 -0
  48. package/dist/components/form/date-picker.js.map +1 -0
  49. package/dist/components/form/file-upload.js +11 -0
  50. package/dist/components/form/file-upload.js.map +1 -0
  51. package/dist/components/form/form.js +8 -0
  52. package/dist/components/form/form.js.map +1 -0
  53. package/dist/components/form/input.js +5 -0
  54. package/dist/components/form/input.js.map +1 -0
  55. package/dist/components/form/radiobox.js +30 -0
  56. package/dist/components/form/radiobox.js.map +1 -0
  57. package/dist/components/form/select.js +106 -0
  58. package/dist/components/form/select.js.map +1 -0
  59. package/dist/components/form/switch.js +65 -0
  60. package/dist/components/form/switch.js.map +1 -0
  61. package/dist/components/form/task-list.js +68 -0
  62. package/dist/components/form/task-list.js.map +1 -0
  63. package/dist/components/form/transfer-list.js +55 -0
  64. package/dist/components/form/transfer-list.js.map +1 -0
  65. package/dist/components/table/table.js +10 -0
  66. package/dist/components/table/table.js.map +1 -0
  67. package/dist/constants-r-AHn273.js +6 -0
  68. package/dist/constants-r-AHn273.js.map +1 -0
  69. package/dist/context-BFXNJVn2.js +161 -0
  70. package/dist/context-BFXNJVn2.js.map +1 -0
  71. package/dist/createLucideIcon-CP-mMPfa.js +76 -0
  72. package/dist/createLucideIcon-CP-mMPfa.js.map +1 -0
  73. package/dist/date-picker-BxPTdZPy.js +1598 -0
  74. package/dist/date-picker-BxPTdZPy.js.map +1 -0
  75. package/dist/dom-Dl8XH0CK.js +2833 -0
  76. package/dist/dom-Dl8XH0CK.js.map +1 -0
  77. package/dist/file-CBCP85VI.js +15 -0
  78. package/dist/file-CBCP85VI.js.map +1 -0
  79. package/dist/file-upload-BB6BdGcE.js +3118 -0
  80. package/dist/file-upload-BB6BdGcE.js.map +1 -0
  81. package/dist/floating-ui.react-DycKASR0.js +3706 -0
  82. package/dist/floating-ui.react-DycKASR0.js.map +1 -0
  83. package/dist/fns-D2eyJKd5.js +33 -0
  84. package/dist/fns-D2eyJKd5.js.map +1 -0
  85. package/dist/index-0YMC-_Lt.js +20 -0
  86. package/dist/index-0YMC-_Lt.js.map +1 -0
  87. package/dist/index-BJ1ayTam.js +126 -0
  88. package/dist/index-BJ1ayTam.js.map +1 -0
  89. package/dist/index-BtlhELJ3.js +3416 -0
  90. package/dist/index-BtlhELJ3.js.map +1 -0
  91. package/dist/index-ChfR6F8d.js +1590 -0
  92. package/dist/index-ChfR6F8d.js.map +1 -0
  93. package/dist/index-DE4shK8D.js +215 -0
  94. package/dist/index-DE4shK8D.js.map +1 -0
  95. package/dist/index-DJSMaZR4.js +35 -0
  96. package/dist/index-DJSMaZR4.js.map +1 -0
  97. package/dist/index-t1qLJTt5.js +351 -0
  98. package/dist/index-t1qLJTt5.js.map +1 -0
  99. package/dist/index.esm-BaIwleSE.js +343 -0
  100. package/dist/index.esm-BaIwleSE.js.map +1 -0
  101. package/dist/index.js +8049 -27
  102. package/dist/index.js.map +1 -1
  103. package/dist/info-N5jWZg2A.js +10 -0
  104. package/dist/info-N5jWZg2A.js.map +1 -0
  105. package/dist/input-CoJoHIhd.js +441 -0
  106. package/dist/input-CoJoHIhd.js.map +1 -0
  107. package/dist/input-field-DTeIrwpK.js +146 -0
  108. package/dist/input-field-DTeIrwpK.js.map +1 -0
  109. package/dist/notifications-NPuFDsBp.js +2550 -0
  110. package/dist/notifications-NPuFDsBp.js.map +1 -0
  111. package/dist/polymorph-B5n9fs_K.js +10 -0
  112. package/dist/polymorph-B5n9fs_K.js.map +1 -0
  113. package/dist/proxy-BZcQiBrp.js +2495 -0
  114. package/dist/proxy-BZcQiBrp.js.map +1 -0
  115. package/dist/skeleton-D75GFBV6.js +10 -0
  116. package/dist/skeleton-D75GFBV6.js.map +1 -0
  117. package/dist/slot-CQW8ZzBb.js +79 -0
  118. package/dist/slot-CQW8ZzBb.js.map +1 -0
  119. package/dist/styles/common.js +29 -0
  120. package/dist/styles/dark.js +214 -0
  121. package/dist/styles/design-tokens.js +98 -0
  122. package/dist/styles/light.js +214 -0
  123. package/dist/styles/theme.js +4 -0
  124. package/dist/styles/theme.types.js +1 -0
  125. package/dist/tabs-ccIA7vMo.js +106 -0
  126. package/dist/tabs-ccIA7vMo.js.map +1 -0
  127. package/dist/triangle-alert-CHMhQ6yd.js +16 -0
  128. package/dist/triangle-alert-CHMhQ6yd.js.map +1 -0
  129. package/dist/use-motion-value-eGwNuWuw.js +14 -0
  130. package/dist/use-motion-value-eGwNuWuw.js.map +1 -0
  131. package/dist/use-stable-ref-CYh-YkID.js +11 -0
  132. package/dist/use-stable-ref-CYh-YkID.js.map +1 -0
  133. package/dist/use-translations-BwLKTrZv.js +10 -0
  134. package/dist/use-translations-BwLKTrZv.js.map +1 -0
  135. package/dist/x-B9bYxG31.js +9 -0
  136. package/dist/x-B9bYxG31.js.map +1 -0
  137. package/package.json +3 -4
  138. package/dist/index.mjs +0 -37108
  139. package/dist/index.mjs.map +0 -1
  140. package/dist/index.umd.js +0 -28
  141. package/dist/index.umd.js.map +0 -1
@@ -0,0 +1,2550 @@
1
+ import { jsx as x, jsxs as U } from "react/jsx-runtime";
2
+ import { c as on } from "./index-DJSMaZR4.js";
3
+ import * as u from "react";
4
+ import { createElement as et, useState as an, useEffect as cn, createContext as un, useContext as ln, useCallback as tt, useRef as dn } from "react";
5
+ import { c as nt } from "./dom-Dl8XH0CK.js";
6
+ import { A as fn, m as yt } from "./proxy-BZcQiBrp.js";
7
+ import { c as pn } from "./createLucideIcon-CP-mMPfa.js";
8
+ import { I as ae } from "./info-N5jWZg2A.js";
9
+ import { C as hn } from "./circle-check-big-3M5lhTxx.js";
10
+ import { T as st } from "./triangle-alert-CHMhQ6yd.js";
11
+ import { X as mn } from "./x-B9bYxG31.js";
12
+ import { w as gn, s as bn } from "./index-DE4shK8D.js";
13
+ import { a as yn, t as vt, g as rt, b as vn, c as wn } from "./index.esm-BaIwleSE.js";
14
+ import * as de from "react-dom";
15
+ const En = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], xn = pn("loader-circle", En);
16
+ function K(t) {
17
+ return t?.ownerDocument || document;
18
+ }
19
+ const ot = {};
20
+ function se(t, e) {
21
+ const n = u.useRef(ot);
22
+ return n.current === ot && (n.current = t(e)), n;
23
+ }
24
+ const Me = u[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)], Tn = (
25
+ // React 17 doesn't have useInsertionEffect.
26
+ Me && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
27
+ Me !== u.useLayoutEffect ? Me : (t) => t()
28
+ );
29
+ function J(t) {
30
+ const e = se(Sn).current;
31
+ return e.next = t, Tn(e.effect), e.trampoline;
32
+ }
33
+ function Sn() {
34
+ const t = {
35
+ next: void 0,
36
+ callback: Nn,
37
+ trampoline: (...e) => t.callback?.(...e),
38
+ effect: () => {
39
+ t.callback = t.next;
40
+ }
41
+ };
42
+ return t;
43
+ }
44
+ function Nn() {
45
+ if (process.env.NODE_ENV !== "production")
46
+ throw (
47
+ /* minify-error-disabled */
48
+ new Error("Base UI: Cannot call an event handler while rendering.")
49
+ );
50
+ }
51
+ const Cn = () => {
52
+ }, $ = typeof document < "u" ? u.useLayoutEffect : Cn;
53
+ function In() {
54
+ }
55
+ const W = Object.freeze({}), Dn = {
56
+ clipPath: "inset(50%)",
57
+ position: "fixed",
58
+ top: 0,
59
+ left: 0
60
+ }, Tr = "none", Sr = "track-press", Nr = "input-change", Rn = "focus-out", Cr = "keyboard", Ir = "drag";
61
+ function On(t, e, n, s) {
62
+ let r = !1, o = !1;
63
+ const c = s ?? W;
64
+ return {
65
+ reason: t,
66
+ event: e ?? new Event("base-ui"),
67
+ cancel() {
68
+ r = !0;
69
+ },
70
+ allowPropagation() {
71
+ o = !0;
72
+ },
73
+ get isCanceled() {
74
+ return r;
75
+ },
76
+ get isPropagationAllowed() {
77
+ return o;
78
+ },
79
+ trigger: n,
80
+ ...c
81
+ };
82
+ }
83
+ function Dr(t, e, n) {
84
+ const s = W;
85
+ return {
86
+ reason: t,
87
+ event: e ?? new Event("base-ui"),
88
+ ...s
89
+ };
90
+ }
91
+ const Le = {
92
+ ...u
93
+ };
94
+ let it = 0;
95
+ function Pn(t, e = "mui") {
96
+ const [n, s] = u.useState(t), r = t || n;
97
+ return u.useEffect(() => {
98
+ n == null && (it += 1, s(`${e}-${it}`));
99
+ }, [n, e]), r;
100
+ }
101
+ const at = Le.useId;
102
+ function He(t, e) {
103
+ if (at !== void 0) {
104
+ const n = at();
105
+ return t ?? (e ? `${e}-${n}` : n);
106
+ }
107
+ return Pn(t, e);
108
+ }
109
+ function Y(t, ...e) {
110
+ const n = new URL("https://base-ui.com/production-error");
111
+ return n.searchParams.set("code", t.toString()), e.forEach((s) => n.searchParams.append("args[]", s)), `Base UI error #${t}; visit ${n} for the full message.`;
112
+ }
113
+ function ct(t, e, n, s) {
114
+ const r = se(wt).current;
115
+ return Fn(r, t, e, n, s) && Et(r, [t, e, n, s]), r.callback;
116
+ }
117
+ function kn(t) {
118
+ const e = se(wt).current;
119
+ return Mn(e, t) && Et(e, t), e.callback;
120
+ }
121
+ function wt() {
122
+ return {
123
+ callback: null,
124
+ cleanup: null,
125
+ refs: []
126
+ };
127
+ }
128
+ function Fn(t, e, n, s, r) {
129
+ return t.refs[0] !== e || t.refs[1] !== n || t.refs[2] !== s || t.refs[3] !== r;
130
+ }
131
+ function Mn(t, e) {
132
+ return t.refs.length !== e.length || t.refs.some((n, s) => n !== e[s]);
133
+ }
134
+ function Et(t, e) {
135
+ if (t.refs = e, e.every((n) => n == null)) {
136
+ t.callback = null;
137
+ return;
138
+ }
139
+ t.callback = (n) => {
140
+ if (t.cleanup && (t.cleanup(), t.cleanup = null), n != null) {
141
+ const s = Array(e.length).fill(null);
142
+ for (let r = 0; r < e.length; r += 1) {
143
+ const o = e[r];
144
+ if (o != null)
145
+ switch (typeof o) {
146
+ case "function": {
147
+ const c = o(n);
148
+ typeof c == "function" && (s[r] = c);
149
+ break;
150
+ }
151
+ case "object": {
152
+ o.current = n;
153
+ break;
154
+ }
155
+ }
156
+ }
157
+ t.cleanup = () => {
158
+ for (let r = 0; r < e.length; r += 1) {
159
+ const o = e[r];
160
+ if (o != null)
161
+ switch (typeof o) {
162
+ case "function": {
163
+ const c = s[r];
164
+ typeof c == "function" ? c() : o(null);
165
+ break;
166
+ }
167
+ case "object": {
168
+ o.current = null;
169
+ break;
170
+ }
171
+ }
172
+ }
173
+ };
174
+ }
175
+ };
176
+ }
177
+ const An = parseInt(u.version, 10);
178
+ function We(t) {
179
+ return An >= t;
180
+ }
181
+ function ut(t) {
182
+ if (!/* @__PURE__ */ u.isValidElement(t))
183
+ return null;
184
+ const e = t, n = e.props;
185
+ return (We(19) ? n?.ref : e.ref) ?? null;
186
+ }
187
+ function $e(t, e) {
188
+ if (t && !e)
189
+ return t;
190
+ if (!t && e)
191
+ return e;
192
+ if (t || e)
193
+ return {
194
+ ...t,
195
+ ...e
196
+ };
197
+ }
198
+ function Vn(t, e) {
199
+ const n = {};
200
+ for (const s in t) {
201
+ const r = t[s];
202
+ if (e?.hasOwnProperty(s)) {
203
+ const o = e[s](r);
204
+ o != null && Object.assign(n, o);
205
+ continue;
206
+ }
207
+ r === !0 ? n[`data-${s.toLowerCase()}`] = "" : r && (n[`data-${s.toLowerCase()}`] = r.toString());
208
+ }
209
+ return n;
210
+ }
211
+ function _n(t, e) {
212
+ return typeof t == "function" ? t(e) : t;
213
+ }
214
+ function Ln(t, e) {
215
+ return typeof t == "function" ? t(e) : t;
216
+ }
217
+ const ce = {};
218
+ function xt(t, e, n, s, r) {
219
+ let o = {
220
+ ...Ue(t, ce)
221
+ };
222
+ return e && (o = Te(o, e)), n && (o = Te(o, n)), s && (o = Te(o, s)), o;
223
+ }
224
+ function $n(t) {
225
+ if (t.length === 0)
226
+ return ce;
227
+ if (t.length === 1)
228
+ return Ue(t[0], ce);
229
+ let e = {
230
+ ...Ue(t[0], ce)
231
+ };
232
+ for (let n = 1; n < t.length; n += 1)
233
+ e = Te(e, t[n]);
234
+ return e;
235
+ }
236
+ function Te(t, e) {
237
+ return Tt(e) ? e(t) : Un(t, e);
238
+ }
239
+ function Un(t, e) {
240
+ if (!e)
241
+ return t;
242
+ for (const n in e) {
243
+ const s = e[n];
244
+ switch (n) {
245
+ case "style": {
246
+ t[n] = $e(t.style, s);
247
+ break;
248
+ }
249
+ case "className": {
250
+ t[n] = St(t.className, s);
251
+ break;
252
+ }
253
+ default:
254
+ jn(n, s) ? t[n] = Bn(t[n], s) : t[n] = s;
255
+ }
256
+ }
257
+ return t;
258
+ }
259
+ function jn(t, e) {
260
+ const n = t.charCodeAt(0), s = t.charCodeAt(1), r = t.charCodeAt(2);
261
+ return n === 111 && s === 110 && r >= 65 && r <= 90 && (typeof e == "function" || typeof e > "u");
262
+ }
263
+ function Tt(t) {
264
+ return typeof t == "function";
265
+ }
266
+ function Ue(t, e) {
267
+ return Tt(t) ? t(e) : t ?? ce;
268
+ }
269
+ function Bn(t, e) {
270
+ return e ? t ? (n) => {
271
+ if (zn(n)) {
272
+ const r = n;
273
+ je(r);
274
+ const o = e(r);
275
+ return r.baseUIHandlerPrevented || t?.(r), o;
276
+ }
277
+ const s = e(n);
278
+ return t?.(n), s;
279
+ } : e : t;
280
+ }
281
+ function je(t) {
282
+ return t.preventBaseUIHandler = () => {
283
+ t.baseUIHandlerPrevented = !0;
284
+ }, t;
285
+ }
286
+ function St(t, e) {
287
+ return e ? t ? e + " " + t : e : t;
288
+ }
289
+ function zn(t) {
290
+ return t != null && typeof t == "object" && "nativeEvent" in t;
291
+ }
292
+ function Q(t, e, n = {}) {
293
+ const s = e.render, r = Hn(e, n);
294
+ if (n.enabled === !1)
295
+ return null;
296
+ const o = n.state ?? W;
297
+ return Kn(t, s, r, o);
298
+ }
299
+ function Hn(t, e = {}) {
300
+ const {
301
+ className: n,
302
+ style: s,
303
+ render: r
304
+ } = t, {
305
+ state: o = W,
306
+ ref: c,
307
+ props: i,
308
+ stateAttributesMapping: l,
309
+ enabled: a = !0
310
+ } = e, d = a ? _n(n, o) : void 0, f = a ? Ln(s, o) : void 0, p = a ? Vn(o, l) : W, h = a ? $e(p, Array.isArray(i) ? $n(i) : i) ?? W : W;
311
+ return typeof document < "u" && (a ? Array.isArray(c) ? h.ref = kn([h.ref, ut(r), ...c]) : h.ref = ct(h.ref, ut(r), c) : ct(null, null)), a ? (d !== void 0 && (h.className = St(h.className, d)), f !== void 0 && (h.style = $e(h.style, f)), h) : W;
312
+ }
313
+ const Wn = /* @__PURE__ */ Symbol.for("react.lazy");
314
+ function Kn(t, e, n, s) {
315
+ if (e) {
316
+ if (typeof e == "function")
317
+ return e(n, s);
318
+ const r = xt(n, e.props);
319
+ r.ref = n.ref;
320
+ let o = e;
321
+ if (o?.$$typeof === Wn && (o = u.Children.toArray(e)[0]), process.env.NODE_ENV !== "production" && !/* @__PURE__ */ u.isValidElement(o))
322
+ throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join(`
323
+ `));
324
+ return /* @__PURE__ */ u.cloneElement(o, r);
325
+ }
326
+ if (t && typeof t == "string")
327
+ return qn(t, n);
328
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : Y(8));
329
+ }
330
+ function qn(t, e) {
331
+ return t === "button" ? /* @__PURE__ */ et("button", {
332
+ type: "button",
333
+ ...e,
334
+ key: e.key
335
+ }) : t === "img" ? /* @__PURE__ */ et("img", {
336
+ alt: "",
337
+ ...e,
338
+ key: e.key
339
+ }) : /* @__PURE__ */ u.createElement(t, e);
340
+ }
341
+ const fe = typeof navigator < "u", Ae = Zn(), Yn = es(), Gn = Qn();
342
+ typeof CSS > "u" || !CSS.supports || CSS.supports("-webkit-backdrop-filter:none");
343
+ Ae.platform === "MacIntel" && Ae.maxTouchPoints > 1 || /iP(hone|ad|od)|iOS/.test(Ae.platform);
344
+ const Xn = fe && /apple/i.test(navigator.vendor);
345
+ fe && Yn.toLowerCase().startsWith("mac") && navigator.maxTouchPoints;
346
+ const Jn = Gn.includes("jsdom/");
347
+ function Zn() {
348
+ if (!fe)
349
+ return {
350
+ platform: "",
351
+ maxTouchPoints: -1
352
+ };
353
+ const t = navigator.userAgentData;
354
+ return t?.platform ? {
355
+ platform: t.platform,
356
+ maxTouchPoints: navigator.maxTouchPoints
357
+ } : {
358
+ platform: navigator.platform ?? "",
359
+ maxTouchPoints: navigator.maxTouchPoints ?? -1
360
+ };
361
+ }
362
+ function Qn() {
363
+ if (!fe)
364
+ return "";
365
+ const t = navigator.userAgentData;
366
+ return t && Array.isArray(t.brands) ? t.brands.map(({
367
+ brand: e,
368
+ version: n
369
+ }) => `${e}/${n}`).join(" ") : navigator.userAgent;
370
+ }
371
+ function es() {
372
+ if (!fe)
373
+ return "";
374
+ const t = navigator.userAgentData;
375
+ return t?.platform ? t.platform : navigator.platform ?? "";
376
+ }
377
+ function ue(t) {
378
+ let e = t.activeElement;
379
+ for (; e?.shadowRoot?.activeElement != null; )
380
+ e = e.shadowRoot.activeElement;
381
+ return e;
382
+ }
383
+ function Z(t, e) {
384
+ if (!t || !e)
385
+ return !1;
386
+ const n = e.getRootNode?.();
387
+ if (t.contains(e))
388
+ return !0;
389
+ if (n && yn(n)) {
390
+ let s = e;
391
+ for (; s; ) {
392
+ if (t === s)
393
+ return !0;
394
+ s = s.parentNode || s.host;
395
+ }
396
+ }
397
+ return !1;
398
+ }
399
+ function Ke(t) {
400
+ return "composedPath" in t ? t.composedPath()[0] : t.target;
401
+ }
402
+ function Be(t) {
403
+ if (!t || Jn)
404
+ return !0;
405
+ try {
406
+ return t.matches(":focus-visible");
407
+ } catch {
408
+ return !0;
409
+ }
410
+ }
411
+ const Nt = () => ({
412
+ getShadowRoot: !0,
413
+ displayCheck: (
414
+ // JSDOM does not support the `tabbable` library. To solve this we can
415
+ // check if `ResizeObserver` is a real function (not polyfilled), which
416
+ // determines if the current environment is JSDOM-like.
417
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
418
+ )
419
+ });
420
+ function Ct(t, e) {
421
+ const n = vt(t, Nt()), s = n.length;
422
+ if (s === 0)
423
+ return;
424
+ const r = ue(K(t)), o = n.indexOf(r), c = o === -1 ? e === 1 ? 0 : s - 1 : o + e;
425
+ return n[c];
426
+ }
427
+ function ts(t) {
428
+ return Ct(K(t).body, 1) || t;
429
+ }
430
+ function ns(t) {
431
+ return Ct(K(t).body, -1) || t;
432
+ }
433
+ function Ve(t, e) {
434
+ const n = e || t.currentTarget, s = t.relatedTarget;
435
+ return !s || !Z(n, s);
436
+ }
437
+ function ss(t) {
438
+ vt(t, Nt()).forEach((n) => {
439
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
440
+ });
441
+ }
442
+ function lt(t) {
443
+ t.querySelectorAll("[data-tabindex]").forEach((n) => {
444
+ const s = n.dataset.tabindex;
445
+ delete n.dataset.tabindex, s ? n.setAttribute("tabindex", s) : n.removeAttribute("tabindex");
446
+ });
447
+ }
448
+ const rs = [];
449
+ function qe(t) {
450
+ u.useEffect(t, rs);
451
+ }
452
+ const ve = null;
453
+ let dt = globalThis.requestAnimationFrame;
454
+ class os {
455
+ /* This implementation uses an array as a backing data-structure for frame callbacks.
456
+ * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
457
+ * never calls the native `cancelAnimationFrame` if there are no frames left. This can
458
+ * be much more efficient if there is a call pattern that alterns as
459
+ * "request-cancel-request-cancel-…".
460
+ * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
461
+ * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
462
+ callbacks = [];
463
+ callbacksCount = 0;
464
+ nextId = 1;
465
+ startId = 1;
466
+ isScheduled = !1;
467
+ tick = (e) => {
468
+ this.isScheduled = !1;
469
+ const n = this.callbacks, s = this.callbacksCount;
470
+ if (this.callbacks = [], this.callbacksCount = 0, this.startId = this.nextId, s > 0)
471
+ for (let r = 0; r < n.length; r += 1)
472
+ n[r]?.(e);
473
+ };
474
+ request(e) {
475
+ const n = this.nextId;
476
+ this.nextId += 1, this.callbacks.push(e), this.callbacksCount += 1;
477
+ const s = process.env.NODE_ENV !== "production" && dt !== requestAnimationFrame && (dt = requestAnimationFrame, !0);
478
+ return (!this.isScheduled || s) && (requestAnimationFrame(this.tick), this.isScheduled = !0), n;
479
+ }
480
+ cancel(e) {
481
+ const n = e - this.startId;
482
+ n < 0 || n >= this.callbacks.length || (this.callbacks[n] = null, this.callbacksCount -= 1);
483
+ }
484
+ }
485
+ const we = new os();
486
+ class Ye {
487
+ static create() {
488
+ return new Ye();
489
+ }
490
+ static request(e) {
491
+ return we.request(e);
492
+ }
493
+ static cancel(e) {
494
+ return we.cancel(e);
495
+ }
496
+ currentId = ve;
497
+ /**
498
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
499
+ */
500
+ request(e) {
501
+ this.cancel(), this.currentId = we.request(() => {
502
+ this.currentId = ve, e();
503
+ });
504
+ }
505
+ cancel = () => {
506
+ this.currentId !== ve && (we.cancel(this.currentId), this.currentId = ve);
507
+ };
508
+ disposeEffect = () => this.cancel;
509
+ }
510
+ function is() {
511
+ const t = se(Ye.create).current;
512
+ return qe(t.disposeEffect), t;
513
+ }
514
+ const as = {
515
+ clipPath: "inset(50%)",
516
+ overflow: "hidden",
517
+ whiteSpace: "nowrap",
518
+ border: 0,
519
+ padding: 0,
520
+ width: 1,
521
+ height: 1,
522
+ margin: -1
523
+ }, It = {
524
+ ...as,
525
+ position: "fixed",
526
+ top: 0,
527
+ left: 0
528
+ }, Ne = /* @__PURE__ */ u.createContext(void 0);
529
+ process.env.NODE_ENV !== "production" && (Ne.displayName = "ToastContext");
530
+ function Ge() {
531
+ const t = u.useContext(Ne);
532
+ if (!t)
533
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: useToastManager must be used within <Toast.Provider>." : Y(73));
534
+ return t;
535
+ }
536
+ var cs = (t, e, n) => {
537
+ if (e.length === 1 && e[0] === n) {
538
+ let s = !1;
539
+ try {
540
+ const r = {};
541
+ t(r) === r && (s = !0);
542
+ } catch {
543
+ }
544
+ if (s) {
545
+ let r;
546
+ try {
547
+ throw new Error();
548
+ } catch (o) {
549
+ ({ stack: r } = o);
550
+ }
551
+ console.warn(
552
+ `The result function returned its own inputs without modification. e.g
553
+ \`createSelector([state => state.todos], todos => todos)\`
554
+ This could lead to inefficient memoization and unnecessary re-renders.
555
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
556
+ { stack: r }
557
+ );
558
+ }
559
+ }
560
+ }, us = (t, e, n) => {
561
+ const { memoize: s, memoizeOptions: r } = e, { inputSelectorResults: o, inputSelectorResultsCopy: c } = t, i = s(() => ({}), ...r);
562
+ if (!(i.apply(null, o) === i.apply(null, c))) {
563
+ let a;
564
+ try {
565
+ throw new Error();
566
+ } catch (d) {
567
+ ({ stack: a } = d);
568
+ }
569
+ console.warn(
570
+ `An input selector returned a different result when passed same arguments.
571
+ This means your output selector will likely run more frequently than intended.
572
+ Avoid returning a new reference inside your input selector, e.g.
573
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
574
+ {
575
+ arguments: n,
576
+ firstInputs: o,
577
+ secondInputs: c,
578
+ stack: a
579
+ }
580
+ );
581
+ }
582
+ }, ls = {
583
+ inputStabilityCheck: "once",
584
+ identityFunctionCheck: "once"
585
+ }, Se = /* @__PURE__ */ Symbol("NOT_FOUND");
586
+ function ds(t, e = `expected a function, instead received ${typeof t}`) {
587
+ if (typeof t != "function")
588
+ throw new TypeError(e);
589
+ }
590
+ function fs(t, e = `expected an object, instead received ${typeof t}`) {
591
+ if (typeof t != "object")
592
+ throw new TypeError(e);
593
+ }
594
+ function ps(t, e = "expected all items to be functions, instead received the following types: ") {
595
+ if (!t.every((n) => typeof n == "function")) {
596
+ const n = t.map(
597
+ (s) => typeof s == "function" ? `function ${s.name || "unnamed"}()` : typeof s
598
+ ).join(", ");
599
+ throw new TypeError(`${e}[${n}]`);
600
+ }
601
+ }
602
+ var ft = (t) => Array.isArray(t) ? t : [t];
603
+ function hs(t) {
604
+ const e = Array.isArray(t[0]) ? t[0] : t;
605
+ return ps(
606
+ e,
607
+ "createSelector expects all input-selectors to be functions, but received the following types: "
608
+ ), e;
609
+ }
610
+ function pt(t, e) {
611
+ const n = [], { length: s } = t;
612
+ for (let r = 0; r < s; r++)
613
+ n.push(t[r].apply(null, e));
614
+ return n;
615
+ }
616
+ var ms = (t, e) => {
617
+ const { identityFunctionCheck: n, inputStabilityCheck: s } = {
618
+ ...ls,
619
+ ...e
620
+ };
621
+ return {
622
+ identityFunctionCheck: {
623
+ shouldRun: n === "always" || n === "once" && t,
624
+ run: cs
625
+ },
626
+ inputStabilityCheck: {
627
+ shouldRun: s === "always" || s === "once" && t,
628
+ run: us
629
+ }
630
+ };
631
+ };
632
+ function gs(t) {
633
+ let e;
634
+ return {
635
+ get(n) {
636
+ return e && t(e.key, n) ? e.value : Se;
637
+ },
638
+ put(n, s) {
639
+ e = { key: n, value: s };
640
+ },
641
+ getEntries() {
642
+ return e ? [e] : [];
643
+ },
644
+ clear() {
645
+ e = void 0;
646
+ }
647
+ };
648
+ }
649
+ function bs(t, e) {
650
+ let n = [];
651
+ function s(i) {
652
+ const l = n.findIndex((a) => e(i, a.key));
653
+ if (l > -1) {
654
+ const a = n[l];
655
+ return l > 0 && (n.splice(l, 1), n.unshift(a)), a.value;
656
+ }
657
+ return Se;
658
+ }
659
+ function r(i, l) {
660
+ s(i) === Se && (n.unshift({ key: i, value: l }), n.length > t && n.pop());
661
+ }
662
+ function o() {
663
+ return n;
664
+ }
665
+ function c() {
666
+ n = [];
667
+ }
668
+ return { get: s, put: r, getEntries: o, clear: c };
669
+ }
670
+ var ys = (t, e) => t === e;
671
+ function vs(t) {
672
+ return function(n, s) {
673
+ if (n === null || s === null || n.length !== s.length)
674
+ return !1;
675
+ const { length: r } = n;
676
+ for (let o = 0; o < r; o++)
677
+ if (!t(n[o], s[o]))
678
+ return !1;
679
+ return !0;
680
+ };
681
+ }
682
+ function ws(t, e) {
683
+ const n = typeof e == "object" ? e : { equalityCheck: e }, {
684
+ equalityCheck: s = ys,
685
+ maxSize: r = 1,
686
+ resultEqualityCheck: o
687
+ } = n, c = vs(s);
688
+ let i = 0;
689
+ const l = r <= 1 ? gs(c) : bs(r, c);
690
+ function a() {
691
+ let d = l.get(arguments);
692
+ if (d === Se) {
693
+ if (d = t.apply(null, arguments), i++, o) {
694
+ const p = l.getEntries().find(
695
+ (h) => o(h.value, d)
696
+ );
697
+ p && (d = p.value, i !== 0 && i--);
698
+ }
699
+ l.put(arguments, d);
700
+ }
701
+ return d;
702
+ }
703
+ return a.clearCache = () => {
704
+ l.clear(), a.resetResultsCount();
705
+ }, a.resultsCount = () => i, a.resetResultsCount = () => {
706
+ i = 0;
707
+ }, a;
708
+ }
709
+ var Es = class {
710
+ constructor(t) {
711
+ this.value = t;
712
+ }
713
+ deref() {
714
+ return this.value;
715
+ }
716
+ }, xs = typeof WeakRef < "u" ? WeakRef : Es, Ts = 0, ht = 1;
717
+ function Ee() {
718
+ return {
719
+ s: Ts,
720
+ v: void 0,
721
+ o: null,
722
+ p: null
723
+ };
724
+ }
725
+ function Dt(t, e = {}) {
726
+ let n = Ee();
727
+ const { resultEqualityCheck: s } = e;
728
+ let r, o = 0;
729
+ function c() {
730
+ let i = n;
731
+ const { length: l } = arguments;
732
+ for (let f = 0, p = l; f < p; f++) {
733
+ const h = arguments[f];
734
+ if (typeof h == "function" || typeof h == "object" && h !== null) {
735
+ let m = i.o;
736
+ m === null && (i.o = m = /* @__PURE__ */ new WeakMap());
737
+ const v = m.get(h);
738
+ v === void 0 ? (i = Ee(), m.set(h, i)) : i = v;
739
+ } else {
740
+ let m = i.p;
741
+ m === null && (i.p = m = /* @__PURE__ */ new Map());
742
+ const v = m.get(h);
743
+ v === void 0 ? (i = Ee(), m.set(h, i)) : i = v;
744
+ }
745
+ }
746
+ const a = i;
747
+ let d;
748
+ if (i.s === ht)
749
+ d = i.v;
750
+ else if (d = t.apply(null, arguments), o++, s) {
751
+ const f = r?.deref?.() ?? r;
752
+ f != null && s(f, d) && (d = f, o !== 0 && o--), r = typeof d == "object" && d !== null || typeof d == "function" ? new xs(d) : d;
753
+ }
754
+ return a.s = ht, a.v = d, d;
755
+ }
756
+ return c.clearCache = () => {
757
+ n = Ee(), c.resetResultsCount();
758
+ }, c.resultsCount = () => o, c.resetResultsCount = () => {
759
+ o = 0;
760
+ }, c;
761
+ }
762
+ function Rt(t, ...e) {
763
+ const n = typeof t == "function" ? {
764
+ memoize: t,
765
+ memoizeOptions: e
766
+ } : t, s = (...r) => {
767
+ let o = 0, c = 0, i, l = {}, a = r.pop();
768
+ typeof a == "object" && (l = a, a = r.pop()), ds(
769
+ a,
770
+ `createSelector expects an output function after the inputs, but received: [${typeof a}]`
771
+ );
772
+ const d = {
773
+ ...n,
774
+ ...l
775
+ }, {
776
+ memoize: f,
777
+ memoizeOptions: p = [],
778
+ argsMemoize: h = Dt,
779
+ argsMemoizeOptions: m = [],
780
+ devModeChecks: v = {}
781
+ } = d, T = ft(p), R = ft(m), O = hs(r), F = f(function() {
782
+ return o++, a.apply(
783
+ null,
784
+ arguments
785
+ );
786
+ }, ...T);
787
+ let g = !0;
788
+ const S = h(function() {
789
+ c++;
790
+ const P = pt(
791
+ O,
792
+ arguments
793
+ );
794
+ if (i = F.apply(null, P), process.env.NODE_ENV !== "production") {
795
+ const { identityFunctionCheck: j, inputStabilityCheck: ee } = ms(g, v);
796
+ if (j.shouldRun && j.run(
797
+ a,
798
+ P,
799
+ i
800
+ ), ee.shouldRun) {
801
+ const G = pt(
802
+ O,
803
+ arguments
804
+ );
805
+ ee.run(
806
+ { inputSelectorResults: P, inputSelectorResultsCopy: G },
807
+ { memoize: f, memoizeOptions: T },
808
+ arguments
809
+ );
810
+ }
811
+ g && (g = !1);
812
+ }
813
+ return i;
814
+ }, ...R);
815
+ return Object.assign(S, {
816
+ resultFunc: a,
817
+ memoizedResultFunc: F,
818
+ dependencies: O,
819
+ dependencyRecomputations: () => c,
820
+ resetDependencyRecomputations: () => {
821
+ c = 0;
822
+ },
823
+ lastResult: () => i,
824
+ recomputations: () => o,
825
+ resetRecomputations: () => {
826
+ o = 0;
827
+ },
828
+ memoize: f,
829
+ argsMemoize: h
830
+ });
831
+ };
832
+ return Object.assign(s, {
833
+ withTypes: () => s
834
+ }), s;
835
+ }
836
+ var Ss = /* @__PURE__ */ Rt(Dt), Ns = Object.assign(
837
+ (t, e = Ss) => {
838
+ fs(
839
+ t,
840
+ `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`
841
+ );
842
+ const n = Object.keys(t), s = n.map(
843
+ (o) => t[o]
844
+ );
845
+ return e(
846
+ s,
847
+ (...o) => o.reduce((c, i, l) => (c[n[l]] = i, c), {})
848
+ );
849
+ },
850
+ { withTypes: () => Ns }
851
+ );
852
+ const Cs = Rt({
853
+ memoize: ws,
854
+ memoizeOptions: {
855
+ maxSize: 1,
856
+ equalityCheck: Object.is
857
+ }
858
+ }), L = (t, e, n, s, r, o, ...c) => {
859
+ if (c.length > 0)
860
+ throw new Error(process.env.NODE_ENV !== "production" ? "Unsupported number of selectors" : Y(1));
861
+ let i;
862
+ if (t && e)
863
+ i = (l, a, d, f) => {
864
+ const p = t(l, a, d, f);
865
+ return e(p, a, d, f);
866
+ };
867
+ else if (t)
868
+ i = t;
869
+ else
870
+ throw (
871
+ /* minify-error-disabled */
872
+ new Error("Missing arguments")
873
+ );
874
+ return i;
875
+ }, Is = (...t) => {
876
+ const e = /* @__PURE__ */ new WeakMap();
877
+ let n = 1;
878
+ const s = t[t.length - 1], r = t.length - 1 || 1, o = s.length - r;
879
+ if (o > 3)
880
+ throw new Error(process.env.NODE_ENV !== "production" ? "Unsupported number of arguments" : Y(2));
881
+ return (i, l, a, d) => {
882
+ let f = i.__cacheKey__;
883
+ f || (f = {
884
+ id: n
885
+ }, i.__cacheKey__ = f, n += 1);
886
+ let p = e.get(f);
887
+ if (!p) {
888
+ let h = t;
889
+ const m = [void 0, void 0, void 0];
890
+ switch (o) {
891
+ case 0:
892
+ break;
893
+ case 1: {
894
+ h = [...t.slice(0, -1), () => m[0], s];
895
+ break;
896
+ }
897
+ case 2: {
898
+ h = [...t.slice(0, -1), () => m[0], () => m[1], s];
899
+ break;
900
+ }
901
+ case 3: {
902
+ h = [...t.slice(0, -1), () => m[0], () => m[1], () => m[2], s];
903
+ break;
904
+ }
905
+ default:
906
+ throw new Error(process.env.NODE_ENV !== "production" ? "Unsupported number of arguments" : Y(2));
907
+ }
908
+ p = Cs(...h), p.selectorArgs = m, e.set(f, p);
909
+ }
910
+ switch (p.selectorArgs[0] = l, p.selectorArgs[1] = a, p.selectorArgs[2] = d, o) {
911
+ case 0:
912
+ return p(i);
913
+ case 1:
914
+ return p(i, l);
915
+ case 2:
916
+ return p(i, l, a);
917
+ case 3:
918
+ return p(i, l, a, d);
919
+ default:
920
+ throw (
921
+ /* minify-error-disabled */
922
+ new Error("unreachable")
923
+ );
924
+ }
925
+ };
926
+ }, Ds = We(19), Rs = Ds ? Ps : ks;
927
+ function Ot(t, e, n, s, r) {
928
+ return Rs(t, e, n, s, r);
929
+ }
930
+ function Os(t, e, n, s, r) {
931
+ const o = u.useCallback(() => e(t.getSnapshot(), n, s, r), [t, e, n, s, r]);
932
+ return bn.useSyncExternalStore(t.subscribe, o, o);
933
+ }
934
+ function Ps(t, e, n, s, r) {
935
+ return Os(t, e, n, s, r);
936
+ }
937
+ function ks(t, e, n, s, r) {
938
+ return gn.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getSnapshot, (o) => e(o, n, s, r));
939
+ }
940
+ class Fs {
941
+ /**
942
+ * The current state of the store.
943
+ * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
944
+ * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
945
+ * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
946
+ *
947
+ * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
948
+ */
949
+ // Internal state to handle recursive `setState()` calls
950
+ constructor(e) {
951
+ this.state = e, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
952
+ }
953
+ /**
954
+ * Registers a listener that will be called whenever the store's state changes.
955
+ *
956
+ * @param fn The listener function to be called on state changes.
957
+ * @returns A function to unsubscribe the listener.
958
+ */
959
+ subscribe = (e) => (this.listeners.add(e), () => {
960
+ this.listeners.delete(e);
961
+ });
962
+ /**
963
+ * Returns the current state of the store.
964
+ */
965
+ getSnapshot = () => this.state;
966
+ /**
967
+ * Updates the entire store's state and notifies all registered listeners.
968
+ *
969
+ * @param newState The new state to set for the store.
970
+ */
971
+ setState(e) {
972
+ if (this.state === e)
973
+ return;
974
+ this.state = e, this.updateTick += 1;
975
+ const n = this.updateTick;
976
+ for (const s of this.listeners) {
977
+ if (n !== this.updateTick)
978
+ return;
979
+ s(e);
980
+ }
981
+ }
982
+ /**
983
+ * Merges the provided changes into the current state and notifies listeners if there are changes.
984
+ *
985
+ * @param changes An object containing the changes to apply to the current state.
986
+ */
987
+ update(e) {
988
+ for (const n in e)
989
+ if (!Object.is(this.state[n], e[n])) {
990
+ this.setState({
991
+ ...this.state,
992
+ ...e
993
+ });
994
+ return;
995
+ }
996
+ }
997
+ /**
998
+ * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
999
+ *
1000
+ * @param key The key in the store's state to update.
1001
+ * @param value The new value to set for the specified key.
1002
+ */
1003
+ set(e, n) {
1004
+ Object.is(this.state[e], n) || this.setState({
1005
+ ...this.state,
1006
+ [e]: n
1007
+ });
1008
+ }
1009
+ /**
1010
+ * Gives the state a new reference and updates all registered listeners.
1011
+ */
1012
+ notifyAll() {
1013
+ const e = {
1014
+ ...this.state
1015
+ };
1016
+ this.setState(e);
1017
+ }
1018
+ use(e, n, s, r) {
1019
+ return Ot(this, e, n, s, r);
1020
+ }
1021
+ }
1022
+ class Ms extends Fs {
1023
+ /**
1024
+ * Creates a new ReactStore instance.
1025
+ *
1026
+ * @param state Initial state of the store.
1027
+ * @param context Non-reactive context values.
1028
+ * @param selectors Optional selectors for use with `useState`.
1029
+ */
1030
+ constructor(e, n = {}, s) {
1031
+ super(e), this.context = n, this.selectors = s;
1032
+ }
1033
+ /**
1034
+ * Non-reactive values such as refs, callbacks, etc.
1035
+ */
1036
+ /**
1037
+ * Synchronizes a single external value into the store.
1038
+ *
1039
+ * Note that the while the value in `state` is updated immediately, the value returned
1040
+ * by `useState` is updated before the next render (similarly to React's `useState`).
1041
+ */
1042
+ useSyncedValue(e, n) {
1043
+ u.useDebugValue(e), $(() => {
1044
+ this.state[e] !== n && this.set(e, n);
1045
+ }, [e, n]);
1046
+ }
1047
+ /**
1048
+ * Synchronizes a single external value into the store and
1049
+ * cleans it up (sets to `undefined`) on unmount.
1050
+ *
1051
+ * Note that the while the value in `state` is updated immediately, the value returned
1052
+ * by `useState` is updated before the next render (similarly to React's `useState`).
1053
+ */
1054
+ useSyncedValueWithCleanup(e, n) {
1055
+ const s = this;
1056
+ $(() => (s.state[e] !== n && s.set(e, n), () => {
1057
+ s.set(e, void 0);
1058
+ }), [s, e, n]);
1059
+ }
1060
+ /**
1061
+ * Synchronizes multiple external values into the store.
1062
+ *
1063
+ * Note that the while the values in `state` are updated immediately, the values returned
1064
+ * by `useState` are updated before the next render (similarly to React's `useState`).
1065
+ */
1066
+ useSyncedValues(e) {
1067
+ const n = this;
1068
+ if (process.env.NODE_ENV !== "production") {
1069
+ u.useDebugValue(e, (c) => Object.keys(c));
1070
+ const r = u.useRef(Object.keys(e)).current, o = Object.keys(e);
1071
+ (r.length !== o.length || r.some((c, i) => c !== o[i])) && console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
1072
+ }
1073
+ const s = Object.values(e);
1074
+ $(() => {
1075
+ n.update(e);
1076
+ }, [n, ...s]);
1077
+ }
1078
+ /**
1079
+ * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
1080
+ * is non-undefined, the store's state at `key` is updated to match `controlled`.
1081
+ */
1082
+ useControlledProp(e, n) {
1083
+ u.useDebugValue(e);
1084
+ const s = n !== void 0;
1085
+ if ($(() => {
1086
+ s && !Object.is(this.state[e], n) && super.setState({
1087
+ ...this.state,
1088
+ [e]: n
1089
+ });
1090
+ }, [e, n, s]), process.env.NODE_ENV !== "production") {
1091
+ const r = this.controlledValues ??= /* @__PURE__ */ new Map();
1092
+ r.has(e) || r.set(e, s);
1093
+ const o = r.get(e);
1094
+ o !== void 0 && o !== s && console.error(`A component is changing the ${s ? "" : "un"}controlled state of ${e.toString()} to be ${s ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
1095
+ }
1096
+ }
1097
+ /** Gets the current value from the store using a selector with the provided key.
1098
+ *
1099
+ * @param key Key of the selector to use.
1100
+ */
1101
+ select(e, n, s, r) {
1102
+ const o = this.selectors[e];
1103
+ return o(this.state, n, s, r);
1104
+ }
1105
+ /**
1106
+ * Returns a value from the store's state using a selector function.
1107
+ * Used to subscribe to specific parts of the state.
1108
+ * This methods causes a rerender whenever the selected state changes.
1109
+ *
1110
+ * @param key Key of the selector to use.
1111
+ */
1112
+ useState(e, n, s, r) {
1113
+ return u.useDebugValue(e), Ot(this, this.selectors[e], n, s, r);
1114
+ }
1115
+ /**
1116
+ * Wraps a function with `useStableCallback` to ensure it has a stable reference
1117
+ * and assigns it to the context.
1118
+ *
1119
+ * @param key Key of the event callback. Must be a function in the context.
1120
+ * @param fn Function to assign.
1121
+ */
1122
+ useContextCallback(e, n) {
1123
+ u.useDebugValue(e);
1124
+ const s = J(n ?? In);
1125
+ this.context[e] = s;
1126
+ }
1127
+ /**
1128
+ * Returns a stable setter function for a specific key in the store's state.
1129
+ * It's commonly used to pass as a ref callback to React elements.
1130
+ *
1131
+ * @param key Key of the state to set.
1132
+ */
1133
+ useStateSetter(e) {
1134
+ const n = u.useRef(void 0);
1135
+ return n.current === void 0 && (n.current = (s) => {
1136
+ this.set(e, s);
1137
+ }), n.current;
1138
+ }
1139
+ /**
1140
+ * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
1141
+ *
1142
+ * @param key Key of the selector to observe.
1143
+ * @param listener Listener function called when the selector result changes.
1144
+ */
1145
+ observe(e, n) {
1146
+ let s;
1147
+ typeof e == "function" ? s = e : s = this.selectors[e];
1148
+ let r = s(this.state);
1149
+ return n(r, r, this), this.subscribe((o) => {
1150
+ const c = s(o);
1151
+ if (!Object.is(r, c)) {
1152
+ const i = r;
1153
+ r = c, n(c, i, this);
1154
+ }
1155
+ });
1156
+ }
1157
+ }
1158
+ const oe = 0;
1159
+ class le {
1160
+ static create() {
1161
+ return new le();
1162
+ }
1163
+ currentId = oe;
1164
+ /**
1165
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
1166
+ */
1167
+ start(e, n) {
1168
+ this.clear(), this.currentId = setTimeout(() => {
1169
+ this.currentId = oe, n();
1170
+ }, e);
1171
+ }
1172
+ isStarted() {
1173
+ return this.currentId !== oe;
1174
+ }
1175
+ clear = () => {
1176
+ this.currentId !== oe && (clearTimeout(this.currentId), this.currentId = oe);
1177
+ };
1178
+ disposeEffect = () => this.clear;
1179
+ }
1180
+ function As() {
1181
+ const t = se(le.create).current;
1182
+ return qe(t.disposeEffect), t;
1183
+ }
1184
+ let mt = 0;
1185
+ function Vs(t) {
1186
+ return mt += 1, `${t}-${Math.random().toString(36).slice(2, 6)}-${mt}`;
1187
+ }
1188
+ function _e(t, e) {
1189
+ if (typeof t == "string")
1190
+ return {
1191
+ description: t
1192
+ };
1193
+ if (typeof t == "function") {
1194
+ const n = t(e);
1195
+ return typeof n == "string" ? {
1196
+ description: n
1197
+ } : n;
1198
+ }
1199
+ return t;
1200
+ }
1201
+ const xe = Is((t) => t.toasts, (t) => {
1202
+ const e = /* @__PURE__ */ new Map();
1203
+ let n = 0, s = 0;
1204
+ return t.forEach((r, o) => {
1205
+ const c = r.transitionStatus === "ending";
1206
+ e.set(r.id, {
1207
+ value: r,
1208
+ domIndex: o,
1209
+ visibleIndex: c ? -1 : n,
1210
+ offsetY: s
1211
+ }), s += r.height || 0, c || (n += 1);
1212
+ }), e;
1213
+ }), H = {
1214
+ toasts: L((t) => t.toasts),
1215
+ isEmpty: L((t) => t.toasts.length === 0),
1216
+ toast: L(xe, (t, e) => t.get(e)?.value),
1217
+ toastIndex: L(xe, (t, e) => t.get(e)?.domIndex ?? -1),
1218
+ toastOffsetY: L(xe, (t, e) => t.get(e)?.offsetY ?? 0),
1219
+ toastVisibleIndex: L(xe, (t, e) => t.get(e)?.visibleIndex ?? -1),
1220
+ hovering: L((t) => t.hovering),
1221
+ focused: L((t) => t.focused),
1222
+ expanded: L((t) => t.hovering || t.focused),
1223
+ expandedOrOutOfFocus: L((t) => t.hovering || t.focused || !t.isWindowFocused),
1224
+ prevFocusElement: L((t) => t.prevFocusElement)
1225
+ };
1226
+ class _s extends Ms {
1227
+ timers = /* @__PURE__ */ new Map();
1228
+ areTimersPaused = !1;
1229
+ constructor(e) {
1230
+ super(e, {}, H);
1231
+ }
1232
+ setFocused(e) {
1233
+ this.set("focused", e);
1234
+ }
1235
+ setHovering(e) {
1236
+ this.set("hovering", e);
1237
+ }
1238
+ setIsWindowFocused(e) {
1239
+ this.set("isWindowFocused", e);
1240
+ }
1241
+ setPrevFocusElement(e) {
1242
+ this.set("prevFocusElement", e);
1243
+ }
1244
+ setViewport = (e) => {
1245
+ this.set("viewport", e);
1246
+ };
1247
+ disposeEffect = () => () => {
1248
+ this.timers.forEach((e) => {
1249
+ e.timeout?.clear();
1250
+ }), this.timers.clear();
1251
+ };
1252
+ removeToast(e) {
1253
+ const n = H.toastIndex(this.state, e);
1254
+ if (n === -1)
1255
+ return;
1256
+ this.state.toasts[n]?.onRemove?.();
1257
+ const r = [...this.state.toasts];
1258
+ r.splice(n, 1), this.setToasts(r);
1259
+ }
1260
+ addToast = (e) => {
1261
+ const {
1262
+ toasts: n,
1263
+ timeout: s,
1264
+ limit: r
1265
+ } = this.state, o = e.id || Vs("toast"), c = {
1266
+ ...e,
1267
+ id: o,
1268
+ transitionStatus: "starting"
1269
+ }, i = [c, ...n], l = i.filter((d) => d.transitionStatus !== "ending");
1270
+ if (l.length > r) {
1271
+ const d = l.length - r, f = l.slice(-d), p = new Set(f.map((h) => h.id));
1272
+ this.setToasts(i.map((h) => {
1273
+ const m = p.has(h.id);
1274
+ return h.limited !== m ? {
1275
+ ...h,
1276
+ limited: m
1277
+ } : h;
1278
+ }));
1279
+ } else
1280
+ this.setToasts(i.map((d) => d.limited ? {
1281
+ ...d,
1282
+ limited: !1
1283
+ } : d));
1284
+ const a = c.timeout ?? s;
1285
+ return c.type !== "loading" && a > 0 && this.scheduleTimer(o, a, () => this.closeToast(o)), H.expandedOrOutOfFocus(this.state) && this.pauseTimers(), o;
1286
+ };
1287
+ updateToast = (e, n) => {
1288
+ this.updateToastInternal(e, n);
1289
+ };
1290
+ updateToastInternal = (e, n) => {
1291
+ const {
1292
+ timeout: s,
1293
+ toasts: r
1294
+ } = this.state, o = H.toast(this.state, e) ?? null;
1295
+ if (!o || o.transitionStatus === "ending")
1296
+ return;
1297
+ const c = {
1298
+ ...o,
1299
+ ...n
1300
+ };
1301
+ this.setToasts(r.map((m) => m.id === e ? {
1302
+ ...m,
1303
+ ...n
1304
+ } : m));
1305
+ const i = c.timeout ?? s, l = o?.timeout ?? s, a = Object.hasOwn(n, "timeout"), d = c.transitionStatus !== "ending" && c.type !== "loading" && i > 0, f = this.timers.has(e), p = l !== i, h = o?.type === "loading";
1306
+ if (!d && f) {
1307
+ this.timers.get(e)?.timeout?.clear(), this.timers.delete(e);
1308
+ return;
1309
+ }
1310
+ if (d && (!f || p || a || h)) {
1311
+ const m = this.timers.get(e);
1312
+ m && (m.timeout?.clear(), this.timers.delete(e)), this.scheduleTimer(e, i, () => this.closeToast(e)), H.expandedOrOutOfFocus(this.state) && this.pauseTimers();
1313
+ }
1314
+ };
1315
+ closeToast = (e) => {
1316
+ H.toast(this.state, e)?.onClose?.();
1317
+ const {
1318
+ limit: s,
1319
+ toasts: r
1320
+ } = this.state;
1321
+ let o = 0;
1322
+ const c = r.map((l) => {
1323
+ if (l.id === e)
1324
+ return {
1325
+ ...l,
1326
+ transitionStatus: "ending",
1327
+ height: 0
1328
+ };
1329
+ if (l.transitionStatus === "ending")
1330
+ return l;
1331
+ const a = o >= s;
1332
+ return o += 1, l.limited !== a ? {
1333
+ ...l,
1334
+ limited: a
1335
+ } : l;
1336
+ }), i = this.timers.get(e);
1337
+ i && i.timeout && (i.timeout.clear(), this.timers.delete(e)), this.handleFocusManagement(e), this.setToasts(c);
1338
+ };
1339
+ promiseToast = (e, n) => {
1340
+ const s = _e(n.loading), r = this.addToast({
1341
+ ...s,
1342
+ type: "loading"
1343
+ }), o = e.then((c) => {
1344
+ const i = _e(n.success, c);
1345
+ return this.updateToast(r, {
1346
+ ...i,
1347
+ type: "success",
1348
+ timeout: i.timeout
1349
+ }), c;
1350
+ }).catch((c) => {
1351
+ const i = _e(n.error, c);
1352
+ return this.updateToast(r, {
1353
+ ...i,
1354
+ type: "error",
1355
+ timeout: i.timeout
1356
+ }), Promise.reject(c);
1357
+ });
1358
+ return {}.hasOwnProperty.call(n, "setPromise") && n.setPromise(o), o;
1359
+ };
1360
+ pauseTimers() {
1361
+ this.areTimersPaused || (this.areTimersPaused = !0, this.timers.forEach((e) => {
1362
+ if (e.timeout) {
1363
+ e.timeout.clear();
1364
+ const n = Date.now() - e.start, s = e.delay - n;
1365
+ e.remaining = s > 0 ? s : 0;
1366
+ }
1367
+ }));
1368
+ }
1369
+ resumeTimers() {
1370
+ this.areTimersPaused && (this.areTimersPaused = !1, this.timers.forEach((e, n) => {
1371
+ e.remaining = e.remaining > 0 ? e.remaining : e.delay, e.timeout ??= le.create(), e.timeout.start(e.remaining, () => {
1372
+ this.timers.delete(n), e.callback();
1373
+ }), e.start = Date.now();
1374
+ }));
1375
+ }
1376
+ restoreFocusToPrevElement() {
1377
+ this.state.prevFocusElement?.focus({
1378
+ preventScroll: !0
1379
+ });
1380
+ }
1381
+ handleDocumentPointerDown = (e) => {
1382
+ if (e.pointerType !== "touch")
1383
+ return;
1384
+ const n = Ke(e);
1385
+ Z(this.state.viewport, n) || (this.resumeTimers(), this.update({
1386
+ hovering: !1,
1387
+ focused: !1
1388
+ }));
1389
+ };
1390
+ scheduleTimer(e, n, s) {
1391
+ const r = Date.now(), o = !H.expandedOrOutOfFocus(this.state), c = o ? le.create() : void 0;
1392
+ c?.start(n, () => {
1393
+ this.timers.delete(e), s();
1394
+ }), this.timers.set(e, {
1395
+ timeout: c,
1396
+ start: o ? r : 0,
1397
+ delay: n,
1398
+ remaining: n,
1399
+ callback: s
1400
+ });
1401
+ }
1402
+ setToasts(e) {
1403
+ const n = {
1404
+ toasts: e
1405
+ };
1406
+ e.length === 0 && (n.hovering = !1, n.focused = !1), this.update(n);
1407
+ }
1408
+ handleFocusManagement(e) {
1409
+ const n = ue(K(this.state.viewport));
1410
+ if (!this.state.viewport || !Z(this.state.viewport, n) || !Be(n))
1411
+ return;
1412
+ const s = H.toasts(this.state), r = H.toastIndex(this.state, e);
1413
+ let o = null, c = r + 1;
1414
+ for (; c < s.length; ) {
1415
+ if (s[c].transitionStatus !== "ending") {
1416
+ o = s[c];
1417
+ break;
1418
+ }
1419
+ c += 1;
1420
+ }
1421
+ if (!o)
1422
+ for (c = r - 1; c >= 0; ) {
1423
+ if (s[c].transitionStatus !== "ending") {
1424
+ o = s[c];
1425
+ break;
1426
+ }
1427
+ c -= 1;
1428
+ }
1429
+ o ? o.ref?.current?.focus() : this.restoreFocusToPrevElement();
1430
+ }
1431
+ }
1432
+ const Pt = function(e) {
1433
+ const {
1434
+ children: n,
1435
+ timeout: s = 5e3,
1436
+ limit: r = 3,
1437
+ toastManager: o
1438
+ } = e, c = se(() => new _s({
1439
+ timeout: s,
1440
+ limit: r,
1441
+ viewport: null,
1442
+ toasts: [],
1443
+ hovering: !1,
1444
+ focused: !1,
1445
+ isWindowFocused: !0,
1446
+ prevFocusElement: null
1447
+ })).current;
1448
+ return qe(c.disposeEffect), u.useEffect(function() {
1449
+ return o ? o[" subscribe"](({
1450
+ action: a,
1451
+ options: d
1452
+ }) => {
1453
+ const f = d.id;
1454
+ a === "promise" && d.promise ? c.promiseToast(d.promise, d) : a === "update" && f ? c.updateToast(f, d) : a === "close" && f ? c.closeToast(f) : c.addToast(d);
1455
+ }) : void 0;
1456
+ }, [c, s, o]), c.useSyncedValues({
1457
+ timeout: s,
1458
+ limit: r
1459
+ }), /* @__PURE__ */ x(Ne.Provider, {
1460
+ value: c,
1461
+ children: n
1462
+ });
1463
+ };
1464
+ process.env.NODE_ENV !== "production" && (Pt.displayName = "ToastProvider");
1465
+ const ne = /* @__PURE__ */ u.forwardRef(function(e, n) {
1466
+ const [s, r] = u.useState();
1467
+ return $(() => {
1468
+ Xn && r("button");
1469
+ }, []), /* @__PURE__ */ x("span", {
1470
+ ...e,
1471
+ ref: n,
1472
+ style: It,
1473
+ "aria-hidden": s ? void 0 : !0,
1474
+ ...{
1475
+ tabIndex: 0,
1476
+ // Role is only for VoiceOver
1477
+ role: s
1478
+ },
1479
+ "data-base-ui-focus-guard": ""
1480
+ });
1481
+ });
1482
+ process.env.NODE_ENV !== "production" && (ne.displayName = "FocusGuard");
1483
+ let Ls = /* @__PURE__ */ (function(t) {
1484
+ return t.frontmostHeight = "--toast-frontmost-height", t;
1485
+ })({});
1486
+ const kt = /* @__PURE__ */ u.forwardRef(function(e, n) {
1487
+ const {
1488
+ render: s,
1489
+ className: r,
1490
+ children: o,
1491
+ ...c
1492
+ } = e, i = Ge(), l = As(), a = u.useRef(!1), d = u.useRef(!1), f = i.useState("isEmpty"), p = i.useState("toasts"), h = i.useState("focused"), m = i.useState("expanded"), v = i.useState("prevFocusElement"), T = p[0]?.height ?? 0, R = u.useMemo(() => p.some((b) => b.transitionStatus === "ending"), [p]);
1493
+ u.useEffect(() => {
1494
+ const b = i.state.viewport;
1495
+ if (!b)
1496
+ return;
1497
+ function N(k) {
1498
+ f || k.key === "F6" && k.target !== b && (k.preventDefault(), i.setPrevFocusElement(ue(K(b))), b?.focus({
1499
+ preventScroll: !0
1500
+ }), i.pauseTimers(), i.setFocused(!0));
1501
+ }
1502
+ const I = rt(b);
1503
+ return I.addEventListener("keydown", N), () => {
1504
+ I.removeEventListener("keydown", N);
1505
+ };
1506
+ }, [i, f]), u.useEffect(() => {
1507
+ const b = i.state.viewport;
1508
+ if (!b || f)
1509
+ return;
1510
+ const N = rt(b);
1511
+ function I(B) {
1512
+ B.target === N && (i.setIsWindowFocused(!1), i.pauseTimers());
1513
+ }
1514
+ function k(B) {
1515
+ if (B.relatedTarget || B.target === N)
1516
+ return;
1517
+ const te = Ke(B), re = ue(K(b));
1518
+ (!Z(b, te) || !Be(re)) && i.resumeTimers(), l.start(0, () => i.setIsWindowFocused(!0));
1519
+ }
1520
+ return N.addEventListener("blur", I, !0), N.addEventListener("focus", k, !0), () => {
1521
+ N.removeEventListener("blur", I, !0), N.removeEventListener("focus", k, !0);
1522
+ };
1523
+ }, [
1524
+ i,
1525
+ l,
1526
+ // `store.state.viewport` isn't available on the first render,
1527
+ // since the portal node hasn't yet been created.
1528
+ // By adding this dependency, we ensure the window listeners
1529
+ // are added when toasts have been created, once the ref is available.
1530
+ f
1531
+ ]), u.useEffect(() => {
1532
+ const b = i.state.viewport;
1533
+ if (!b || f)
1534
+ return;
1535
+ const N = K(b);
1536
+ return N.addEventListener("pointerdown", i.handleDocumentPointerDown, !0), () => {
1537
+ N.removeEventListener("pointerdown", i.handleDocumentPointerDown, !0);
1538
+ };
1539
+ }, [f, i]);
1540
+ function O(b) {
1541
+ const N = i.state.viewport;
1542
+ N && (a.current = !0, b.relatedTarget === N ? p[0]?.ref?.current?.focus() : i.restoreFocusToPrevElement());
1543
+ }
1544
+ function F(b) {
1545
+ b.key === "Tab" && b.shiftKey && b.target === i.state.viewport && (b.preventDefault(), i.restoreFocusToPrevElement(), i.resumeTimers());
1546
+ }
1547
+ u.useEffect(() => {
1548
+ !i.state.isWindowFocused || R || !d.current || (i.resumeTimers(), i.setHovering(!1), d.current = !1);
1549
+ }, [R, i]);
1550
+ function g() {
1551
+ i.pauseTimers(), i.setHovering(!0), d.current = !1;
1552
+ }
1553
+ function S() {
1554
+ R ? d.current = !0 : (i.resumeTimers(), i.setHovering(!1));
1555
+ }
1556
+ function E() {
1557
+ if (a.current) {
1558
+ a.current = !1;
1559
+ return;
1560
+ }
1561
+ h || Be(K(i.state.viewport).activeElement) && (i.setFocused(!0), i.pauseTimers());
1562
+ }
1563
+ function P(b) {
1564
+ !h || Z(i.state.viewport, b.relatedTarget) || (i.setFocused(!1), i.resumeTimers());
1565
+ }
1566
+ const j = {
1567
+ tabIndex: -1,
1568
+ role: "region",
1569
+ "aria-live": "polite",
1570
+ "aria-atomic": !1,
1571
+ "aria-relevant": "additions text",
1572
+ "aria-label": "Notifications",
1573
+ onMouseEnter: g,
1574
+ onMouseMove: g,
1575
+ onMouseLeave: S,
1576
+ onFocus: E,
1577
+ onBlur: P,
1578
+ onKeyDown: F,
1579
+ onClick: E
1580
+ }, ee = {
1581
+ expanded: m
1582
+ }, G = Q("div", e, {
1583
+ ref: [n, i.setViewport],
1584
+ state: ee,
1585
+ props: [j, {
1586
+ style: {
1587
+ [Ls.frontmostHeight]: T ? `${T}px` : void 0
1588
+ }
1589
+ }, c, {
1590
+ children: /* @__PURE__ */ U(u.Fragment, {
1591
+ children: [!f && v && /* @__PURE__ */ x(ne, {
1592
+ onFocus: O
1593
+ }), o, !f && v && /* @__PURE__ */ x(ne, {
1594
+ onFocus: O
1595
+ })]
1596
+ })
1597
+ }]
1598
+ }), pe = u.useMemo(() => p.filter((b) => b.priority === "high"), [p]);
1599
+ return /* @__PURE__ */ U(u.Fragment, {
1600
+ children: [!f && v && /* @__PURE__ */ x(ne, {
1601
+ onFocus: O
1602
+ }), G, !h && pe.length > 0 && /* @__PURE__ */ x("div", {
1603
+ style: It,
1604
+ children: pe.map((b) => /* @__PURE__ */ U("div", {
1605
+ role: "alert",
1606
+ "aria-atomic": !0,
1607
+ children: [/* @__PURE__ */ x("div", {
1608
+ children: b.title
1609
+ }), /* @__PURE__ */ x("div", {
1610
+ children: b.description
1611
+ })]
1612
+ }, b.id))
1613
+ })]
1614
+ });
1615
+ });
1616
+ process.env.NODE_ENV !== "production" && (kt.displayName = "ToastViewport");
1617
+ function $s(t) {
1618
+ return We(19) ? t : t ? "true" : void 0;
1619
+ }
1620
+ const Xe = /* @__PURE__ */ u.createContext(void 0);
1621
+ process.env.NODE_ENV !== "production" && (Xe.displayName = "ToastRootContext");
1622
+ function Ce() {
1623
+ const t = u.useContext(Xe);
1624
+ if (!t)
1625
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : Y(66));
1626
+ return t;
1627
+ }
1628
+ let Je = /* @__PURE__ */ (function(t) {
1629
+ return t.startingStyle = "data-starting-style", t.endingStyle = "data-ending-style", t;
1630
+ })({});
1631
+ const Us = {
1632
+ [Je.startingStyle]: ""
1633
+ }, js = {
1634
+ [Je.endingStyle]: ""
1635
+ }, Bs = {
1636
+ transitionStatus(t) {
1637
+ return t === "starting" ? Us : t === "ending" ? js : null;
1638
+ }
1639
+ };
1640
+ function zs(t) {
1641
+ return t == null ? t : "current" in t ? t.current : t;
1642
+ }
1643
+ function Hs(t, e = !1, n = !0) {
1644
+ const s = is();
1645
+ return J((r, o = null) => {
1646
+ s.cancel();
1647
+ function c() {
1648
+ de.flushSync(r);
1649
+ }
1650
+ const i = zs(t);
1651
+ if (i == null)
1652
+ return;
1653
+ const l = i;
1654
+ if (typeof l.getAnimations != "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED)
1655
+ r();
1656
+ else {
1657
+ let a = function() {
1658
+ const f = Je.startingStyle;
1659
+ if (!l.hasAttribute(f)) {
1660
+ s.request(d);
1661
+ return;
1662
+ }
1663
+ const p = new MutationObserver(() => {
1664
+ l.hasAttribute(f) || (p.disconnect(), d());
1665
+ });
1666
+ p.observe(l, {
1667
+ attributes: !0,
1668
+ attributeFilter: [f]
1669
+ }), o?.addEventListener("abort", () => p.disconnect(), {
1670
+ once: !0
1671
+ });
1672
+ }, d = function() {
1673
+ Promise.all(l.getAnimations().map((f) => f.finished)).then(() => {
1674
+ o?.aborted || c();
1675
+ }).catch(() => {
1676
+ const f = l.getAnimations();
1677
+ if (n) {
1678
+ if (o?.aborted)
1679
+ return;
1680
+ c();
1681
+ } else f.length > 0 && f.some((p) => p.pending || p.playState !== "finished") && d();
1682
+ });
1683
+ };
1684
+ if (e) {
1685
+ a();
1686
+ return;
1687
+ }
1688
+ s.request(d);
1689
+ }
1690
+ });
1691
+ }
1692
+ function Ws(t) {
1693
+ const {
1694
+ enabled: e = !0,
1695
+ open: n,
1696
+ ref: s,
1697
+ onComplete: r
1698
+ } = t, o = J(r), c = Hs(s, n, !1);
1699
+ u.useEffect(() => {
1700
+ if (!e)
1701
+ return;
1702
+ const i = new AbortController();
1703
+ return c(o, i.signal), () => {
1704
+ i.abort();
1705
+ };
1706
+ }, [e, n, o, c]);
1707
+ }
1708
+ let X = /* @__PURE__ */ (function(t) {
1709
+ return t.index = "--toast-index", t.offsetY = "--toast-offset-y", t.height = "--toast-height", t.swipeMovementX = "--toast-swipe-movement-x", t.swipeMovementY = "--toast-swipe-movement-y", t;
1710
+ })({});
1711
+ const Ks = {
1712
+ ...Bs,
1713
+ swipeDirection(t) {
1714
+ return t ? {
1715
+ "data-swipe-direction": t
1716
+ } : null;
1717
+ }
1718
+ }, ie = 40, qs = 10, q = 0.5, Ys = 1;
1719
+ function gt(t, e, n) {
1720
+ switch (t) {
1721
+ case "up":
1722
+ return -n;
1723
+ case "down":
1724
+ return n;
1725
+ case "left":
1726
+ return -e;
1727
+ case "right":
1728
+ return e;
1729
+ default:
1730
+ return 0;
1731
+ }
1732
+ }
1733
+ function Gs(t) {
1734
+ const n = window.getComputedStyle(t).transform;
1735
+ let s = 0, r = 0, o = 1;
1736
+ if (n && n !== "none") {
1737
+ const c = n.match(/matrix(?:3d)?\(([^)]+)\)/);
1738
+ if (c) {
1739
+ const i = c[1].split(", ").map(parseFloat);
1740
+ i.length === 6 ? (s = i[4], r = i[5], o = Math.sqrt(i[0] * i[0] + i[1] * i[1])) : i.length === 16 && (s = i[12], r = i[13], o = i[0]);
1741
+ }
1742
+ }
1743
+ return {
1744
+ x: s,
1745
+ y: r,
1746
+ scale: o
1747
+ };
1748
+ }
1749
+ const Ft = /* @__PURE__ */ u.forwardRef(function(e, n) {
1750
+ const {
1751
+ toast: s,
1752
+ render: r,
1753
+ className: o,
1754
+ swipeDirection: c = ["down", "right"],
1755
+ ...i
1756
+ } = e, l = s.positionerProps?.anchor !== void 0;
1757
+ let a = [];
1758
+ l || (a = Array.isArray(c) ? c : [c]);
1759
+ const d = a.length > 0, f = Ge(), [p, h] = u.useState(void 0), [m, v] = u.useState(!1), [T, R] = u.useState(!1), [O, F] = u.useState(!1), [g, S] = u.useState({
1760
+ x: 0,
1761
+ y: 0
1762
+ }), [E, P] = u.useState({
1763
+ x: 0,
1764
+ y: 0,
1765
+ scale: 1
1766
+ }), [j, ee] = u.useState(), [G, pe] = u.useState(), [b, N] = u.useState(null), I = u.useRef(null), k = u.useRef({
1767
+ x: 0,
1768
+ y: 0
1769
+ }), B = u.useRef({
1770
+ x: 0,
1771
+ y: 0,
1772
+ scale: 1
1773
+ }), te = u.useRef(void 0), re = u.useRef(0), he = u.useRef(!1), M = u.useRef({
1774
+ x: 0,
1775
+ y: 0
1776
+ }), Ie = u.useRef(!1), De = f.useState("toastIndex", s.id), Re = f.useState("toastVisibleIndex", s.id), zt = f.useState("toastOffsetY", s.id), Ht = f.useState("focused"), Oe = f.useState("expanded");
1777
+ Ws({
1778
+ open: s.transitionStatus !== "ending",
1779
+ ref: I,
1780
+ onComplete() {
1781
+ s.transitionStatus === "ending" && f.removeToast(s.id);
1782
+ }
1783
+ });
1784
+ const me = J((w = !1) => {
1785
+ const y = I.current;
1786
+ if (!y)
1787
+ return;
1788
+ const C = y.style.height;
1789
+ y.style.height = "auto";
1790
+ const D = y.offsetHeight;
1791
+ y.style.height = C;
1792
+ function A() {
1793
+ f.updateToastInternal(s.id, {
1794
+ ref: I,
1795
+ height: D,
1796
+ ...s.transitionStatus === "starting" ? {
1797
+ transitionStatus: void 0
1798
+ } : {}
1799
+ });
1800
+ }
1801
+ w ? de.flushSync(A) : A();
1802
+ });
1803
+ $(me, [me]);
1804
+ function Wt(w, y) {
1805
+ let C = w, D = y;
1806
+ return !a.includes("left") && !a.includes("right") ? C = w > 0 ? w ** q : -(Math.abs(w) ** q) : (!a.includes("right") && w > 0 && (C = w ** q), !a.includes("left") && w < 0 && (C = -(Math.abs(w) ** q))), !a.includes("up") && !a.includes("down") ? D = y > 0 ? y ** q : -(Math.abs(y) ** q) : (!a.includes("down") && y > 0 && (D = y ** q), !a.includes("up") && y < 0 && (D = -(Math.abs(y) ** q))), {
1807
+ x: C,
1808
+ y: D
1809
+ };
1810
+ }
1811
+ function Kt(w) {
1812
+ if (w.button !== 0)
1813
+ return;
1814
+ w.pointerType === "touch" && f.pauseTimers();
1815
+ const y = Ke(w.nativeEvent);
1816
+ if (!(y && y.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))) {
1817
+ if (he.current = !1, te.current = void 0, re.current = 0, k.current = {
1818
+ x: w.clientX,
1819
+ y: w.clientY
1820
+ }, M.current = k.current, I.current) {
1821
+ const D = Gs(I.current);
1822
+ B.current = D, P(D), S({
1823
+ x: D.x,
1824
+ y: D.y
1825
+ });
1826
+ }
1827
+ f.setHovering(!0), v(!0), R(!1), N(null), Ie.current = !0, I.current?.setPointerCapture(w.pointerId);
1828
+ }
1829
+ }
1830
+ function qt(w) {
1831
+ if (!m)
1832
+ return;
1833
+ w.preventDefault(), Ie.current && (k.current = {
1834
+ x: w.clientX,
1835
+ y: w.clientY
1836
+ }, Ie.current = !1);
1837
+ const {
1838
+ clientY: y,
1839
+ clientX: C,
1840
+ movementX: D,
1841
+ movementY: A
1842
+ } = w;
1843
+ (A < 0 && y > M.current.y || A > 0 && y < M.current.y) && (M.current = {
1844
+ x: M.current.x,
1845
+ y
1846
+ }), (D < 0 && C > M.current.x || D > 0 && C < M.current.x) && (M.current = {
1847
+ x: C,
1848
+ y: M.current.y
1849
+ });
1850
+ const V = C - k.current.x, z = y - k.current.y, en = y - M.current.y, tn = C - M.current.x;
1851
+ if (!T && Math.sqrt(V * V + z * z) >= Ys && (R(!0), b === null)) {
1852
+ const ye = a.includes("left") || a.includes("right"), nn = a.includes("up") || a.includes("down");
1853
+ if (ye && nn) {
1854
+ const sn = Math.abs(V), rn = Math.abs(z);
1855
+ N(sn > rn ? "horizontal" : "vertical");
1856
+ }
1857
+ }
1858
+ let _;
1859
+ if (!te.current)
1860
+ b === "vertical" ? z > 0 ? _ = "down" : z < 0 && (_ = "up") : b === "horizontal" ? V > 0 ? _ = "right" : V < 0 && (_ = "left") : Math.abs(V) >= Math.abs(z) ? _ = V > 0 ? "right" : "left" : _ = z > 0 ? "down" : "up", _ && a.includes(_) && (te.current = _, re.current = gt(_, V, z), h(_));
1861
+ else {
1862
+ const Fe = te.current, ye = gt(Fe, tn, en);
1863
+ ye > ie ? (he.current = !1, h(Fe)) : !(a.includes("left") && a.includes("right")) && !(a.includes("up") && a.includes("down")) && re.current - ye >= qs && (he.current = !0);
1864
+ }
1865
+ const be = Wt(V, z);
1866
+ let Pe = B.current.x, ke = B.current.y;
1867
+ b === "horizontal" ? (a.includes("left") || a.includes("right")) && (Pe += be.x) : (b === "vertical" || (a.includes("left") || a.includes("right")) && (Pe += be.x), (a.includes("up") || a.includes("down")) && (ke += be.y)), S({
1868
+ x: Pe,
1869
+ y: ke
1870
+ });
1871
+ }
1872
+ function Yt(w) {
1873
+ if (!m)
1874
+ return;
1875
+ if (v(!1), R(!1), N(null), I.current?.releasePointerCapture(w.pointerId), he.current) {
1876
+ S({
1877
+ x: E.x,
1878
+ y: E.y
1879
+ }), h(void 0);
1880
+ return;
1881
+ }
1882
+ let y = !1;
1883
+ const C = g.x - E.x, D = g.y - E.y;
1884
+ let A;
1885
+ for (const V of a) {
1886
+ switch (V) {
1887
+ case "right":
1888
+ C > ie && (y = !0, A = "right");
1889
+ break;
1890
+ case "left":
1891
+ C < -ie && (y = !0, A = "left");
1892
+ break;
1893
+ case "down":
1894
+ D > ie && (y = !0, A = "down");
1895
+ break;
1896
+ case "up":
1897
+ D < -ie && (y = !0, A = "up");
1898
+ break;
1899
+ }
1900
+ if (y)
1901
+ break;
1902
+ }
1903
+ y ? (h(A), F(!0), f.closeToast(s.id)) : (S({
1904
+ x: E.x,
1905
+ y: E.y
1906
+ }), h(void 0));
1907
+ }
1908
+ function Gt(w) {
1909
+ if (w.key === "Escape") {
1910
+ if (!I.current || !Z(I.current, ue(K(I.current))))
1911
+ return;
1912
+ f.closeToast(s.id);
1913
+ }
1914
+ }
1915
+ u.useEffect(() => {
1916
+ if (!d)
1917
+ return;
1918
+ const w = I.current;
1919
+ if (!w)
1920
+ return;
1921
+ function y(C) {
1922
+ Z(w, C.target) && C.preventDefault();
1923
+ }
1924
+ return w.addEventListener("touchmove", y, {
1925
+ passive: !1
1926
+ }), () => {
1927
+ w.removeEventListener("touchmove", y);
1928
+ };
1929
+ }, [d]);
1930
+ function Xt() {
1931
+ if (!m && g.x === E.x && g.y === E.y && !O)
1932
+ return {
1933
+ [X.swipeMovementX]: "0px",
1934
+ [X.swipeMovementY]: "0px"
1935
+ };
1936
+ const w = g.x - E.x, y = g.y - E.y;
1937
+ return {
1938
+ transition: m ? "none" : void 0,
1939
+ // While swiping, freeze the element at its current visual transform so it doesn't snap to the
1940
+ // end position.
1941
+ transform: m ? `translateX(${g.x}px) translateY(${g.y}px) scale(${E.scale})` : void 0,
1942
+ [X.swipeMovementX]: `${w}px`,
1943
+ [X.swipeMovementY]: `${y}px`
1944
+ };
1945
+ }
1946
+ const Qe = s.priority === "high", Jt = {
1947
+ role: Qe ? "alertdialog" : "dialog",
1948
+ tabIndex: 0,
1949
+ "aria-modal": !1,
1950
+ "aria-labelledby": j,
1951
+ "aria-describedby": G,
1952
+ "aria-hidden": Qe && !Ht ? !0 : void 0,
1953
+ onPointerDown: d ? Kt : void 0,
1954
+ onPointerMove: d ? qt : void 0,
1955
+ onPointerUp: d ? Yt : void 0,
1956
+ onKeyDown: Gt,
1957
+ inert: $s(s.limited),
1958
+ style: {
1959
+ ...Xt(),
1960
+ [X.index]: s.transitionStatus === "ending" ? De : Re,
1961
+ [X.offsetY]: `${zt}px`,
1962
+ [X.height]: s.height ? `${s.height}px` : void 0
1963
+ }
1964
+ }, ge = u.useMemo(() => ({
1965
+ rootRef: I,
1966
+ toast: s,
1967
+ titleId: j,
1968
+ setTitleId: ee,
1969
+ descriptionId: G,
1970
+ setDescriptionId: pe,
1971
+ swiping: m,
1972
+ swipeDirection: p,
1973
+ recalculateHeight: me,
1974
+ index: De,
1975
+ visibleIndex: Re,
1976
+ expanded: Oe
1977
+ }), [s, j, G, m, p, me, De, Re, Oe]), Zt = {
1978
+ transitionStatus: s.transitionStatus,
1979
+ expanded: Oe,
1980
+ limited: s.limited || !1,
1981
+ type: s.type,
1982
+ swiping: ge.swiping,
1983
+ swipeDirection: ge.swipeDirection
1984
+ }, Qt = Q("div", e, {
1985
+ ref: [n, ge.rootRef],
1986
+ state: Zt,
1987
+ stateAttributesMapping: Ks,
1988
+ props: [Jt, i]
1989
+ });
1990
+ return /* @__PURE__ */ x(Xe.Provider, {
1991
+ value: ge,
1992
+ children: Qt
1993
+ });
1994
+ });
1995
+ process.env.NODE_ENV !== "production" && (Ft.displayName = "ToastRoot");
1996
+ const Mt = /* @__PURE__ */ u.forwardRef(function(e, n) {
1997
+ const {
1998
+ render: s,
1999
+ className: r,
2000
+ ...o
2001
+ } = e, {
2002
+ visibleIndex: c,
2003
+ expanded: i,
2004
+ recalculateHeight: l
2005
+ } = Ce(), a = u.useRef(null);
2006
+ $(() => {
2007
+ const h = a.current;
2008
+ if (!h || (l(), typeof ResizeObserver != "function" || typeof MutationObserver != "function"))
2009
+ return;
2010
+ const m = new ResizeObserver(() => l(!0)), v = new MutationObserver(() => l(!0));
2011
+ return m.observe(h), v.observe(h, {
2012
+ childList: !0,
2013
+ subtree: !0,
2014
+ characterData: !0
2015
+ }), () => {
2016
+ m.disconnect(), v.disconnect();
2017
+ };
2018
+ }, [l]);
2019
+ const d = c > 0;
2020
+ return Q("div", e, {
2021
+ ref: [n, a],
2022
+ state: {
2023
+ expanded: i,
2024
+ behind: d
2025
+ },
2026
+ props: o
2027
+ });
2028
+ });
2029
+ process.env.NODE_ENV !== "production" && (Mt.displayName = "ToastContent");
2030
+ const At = /* @__PURE__ */ u.forwardRef(function(e, n) {
2031
+ const {
2032
+ render: s,
2033
+ className: r,
2034
+ id: o,
2035
+ children: c,
2036
+ ...i
2037
+ } = e, {
2038
+ toast: l,
2039
+ setDescriptionId: a
2040
+ } = Ce(), d = c ?? l.description, f = !!d, p = He(o);
2041
+ $(() => {
2042
+ if (f)
2043
+ return a(p), () => {
2044
+ a(void 0);
2045
+ };
2046
+ }, [f, p, a]);
2047
+ const h = {
2048
+ type: l.type
2049
+ }, m = Q("p", e, {
2050
+ ref: n,
2051
+ state: h,
2052
+ props: {
2053
+ ...i,
2054
+ id: p,
2055
+ children: d
2056
+ }
2057
+ });
2058
+ return f ? m : null;
2059
+ });
2060
+ process.env.NODE_ENV !== "production" && (At.displayName = "ToastDescription");
2061
+ const Vt = /* @__PURE__ */ u.forwardRef(function(e, n) {
2062
+ const {
2063
+ render: s,
2064
+ className: r,
2065
+ id: o,
2066
+ children: c,
2067
+ ...i
2068
+ } = e, {
2069
+ toast: l,
2070
+ setTitleId: a
2071
+ } = Ce(), d = c ?? l.title, f = !!d, p = He(o);
2072
+ $(() => {
2073
+ if (f)
2074
+ return a(p), () => {
2075
+ a(void 0);
2076
+ };
2077
+ }, [f, p, a]);
2078
+ const h = {
2079
+ type: l.type
2080
+ }, m = Q("h2", e, {
2081
+ ref: n,
2082
+ state: h,
2083
+ props: {
2084
+ ...i,
2085
+ id: p,
2086
+ children: d
2087
+ }
2088
+ });
2089
+ return f ? m : null;
2090
+ });
2091
+ process.env.NODE_ENV !== "production" && (Vt.displayName = "ToastTitle");
2092
+ let ze;
2093
+ process.env.NODE_ENV !== "production" && (ze = /* @__PURE__ */ new Set());
2094
+ function bt(...t) {
2095
+ if (process.env.NODE_ENV !== "production") {
2096
+ const e = t.join(" ");
2097
+ ze.has(e) || (ze.add(e), console.error(`Base UI: ${e}`));
2098
+ }
2099
+ }
2100
+ const _t = /* @__PURE__ */ u.createContext(void 0);
2101
+ process.env.NODE_ENV !== "production" && (_t.displayName = "CompositeRootContext");
2102
+ function Xs(t = !1) {
2103
+ const e = u.useContext(_t);
2104
+ if (e === void 0 && !t)
2105
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : Y(16));
2106
+ return e;
2107
+ }
2108
+ function Js(t) {
2109
+ const {
2110
+ focusableWhenDisabled: e,
2111
+ disabled: n,
2112
+ composite: s = !1,
2113
+ tabIndex: r = 0,
2114
+ isNativeButton: o
2115
+ } = t, c = s && e !== !1, i = s && e === !1;
2116
+ return {
2117
+ props: u.useMemo(() => {
2118
+ const a = {
2119
+ // allow Tabbing away from focusableWhenDisabled elements
2120
+ onKeyDown(d) {
2121
+ n && e && d.key !== "Tab" && d.preventDefault();
2122
+ }
2123
+ };
2124
+ return s || (a.tabIndex = r, !o && n && (a.tabIndex = e ? r : -1)), (o && (e || c) || !o && n) && (a["aria-disabled"] = n), o && (!e || i) && (a.disabled = n), a;
2125
+ }, [s, n, e, c, i, o, r])
2126
+ };
2127
+ }
2128
+ function Zs(t = {}) {
2129
+ const {
2130
+ disabled: e = !1,
2131
+ focusableWhenDisabled: n,
2132
+ tabIndex: s = 0,
2133
+ native: r = !0
2134
+ } = t, o = u.useRef(null), c = Xs(!0) !== void 0, i = J(() => {
2135
+ const p = o.current;
2136
+ return !!(p?.tagName === "A" && p?.href);
2137
+ }), {
2138
+ props: l
2139
+ } = Js({
2140
+ focusableWhenDisabled: n,
2141
+ disabled: e,
2142
+ composite: c,
2143
+ tabIndex: s,
2144
+ isNativeButton: r
2145
+ });
2146
+ process.env.NODE_ENV !== "production" && u.useEffect(() => {
2147
+ if (!o.current)
2148
+ return;
2149
+ const p = o.current.tagName === "BUTTON";
2150
+ if (r) {
2151
+ if (!p) {
2152
+ const h = Le.captureOwnerStack?.() || "";
2153
+ bt(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${h}`);
2154
+ }
2155
+ } else if (p) {
2156
+ const h = Le.captureOwnerStack?.() || "";
2157
+ bt(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${h}`);
2158
+ }
2159
+ }, [r]);
2160
+ const a = u.useCallback(() => {
2161
+ const p = o.current;
2162
+ Qs(p) && c && e && l.disabled === void 0 && p.disabled && (p.disabled = !1);
2163
+ }, [e, l.disabled, c]);
2164
+ $(a, [a]);
2165
+ const d = u.useCallback((p = {}) => {
2166
+ const {
2167
+ onClick: h,
2168
+ onMouseDown: m,
2169
+ onKeyUp: v,
2170
+ onKeyDown: T,
2171
+ onPointerDown: R,
2172
+ ...O
2173
+ } = p;
2174
+ return xt({
2175
+ type: r ? "button" : void 0,
2176
+ onClick(g) {
2177
+ if (e) {
2178
+ g.preventDefault();
2179
+ return;
2180
+ }
2181
+ h?.(g);
2182
+ },
2183
+ onMouseDown(g) {
2184
+ e || m?.(g);
2185
+ },
2186
+ onKeyDown(g) {
2187
+ if (e || (je(g), T?.(g)), g.baseUIHandlerPrevented)
2188
+ return;
2189
+ const S = g.target === g.currentTarget && !r && !i() && !e, E = g.key === "Enter", P = g.key === " ";
2190
+ S && ((P || E) && g.preventDefault(), E && h?.(g));
2191
+ },
2192
+ onKeyUp(g) {
2193
+ e || (je(g), v?.(g)), !g.baseUIHandlerPrevented && g.target === g.currentTarget && !r && !e && g.key === " " && h?.(g);
2194
+ },
2195
+ onPointerDown(g) {
2196
+ if (e) {
2197
+ g.preventDefault();
2198
+ return;
2199
+ }
2200
+ R?.(g);
2201
+ }
2202
+ }, r ? void 0 : {
2203
+ role: "button"
2204
+ }, l, O);
2205
+ }, [e, l, r, i]), f = J((p) => {
2206
+ o.current = p, a();
2207
+ });
2208
+ return {
2209
+ getButtonProps: d,
2210
+ buttonRef: f
2211
+ };
2212
+ }
2213
+ function Qs(t) {
2214
+ return vn(t) && t.tagName === "BUTTON";
2215
+ }
2216
+ const Lt = /* @__PURE__ */ u.forwardRef(function(e, n) {
2217
+ const {
2218
+ render: s,
2219
+ className: r,
2220
+ disabled: o,
2221
+ nativeButton: c = !0,
2222
+ ...i
2223
+ } = e, l = Ge(), {
2224
+ toast: a
2225
+ } = Ce(), d = l.useState("expanded"), [f, p] = u.useState(!1), {
2226
+ getButtonProps: h,
2227
+ buttonRef: m
2228
+ } = Zs({
2229
+ disabled: o,
2230
+ native: c
2231
+ }), v = {
2232
+ type: a.type
2233
+ };
2234
+ return Q("button", e, {
2235
+ ref: [n, m],
2236
+ state: v,
2237
+ props: [{
2238
+ "aria-hidden": !d && !f,
2239
+ onClick() {
2240
+ l.closeToast(a.id);
2241
+ },
2242
+ onFocus() {
2243
+ p(!0);
2244
+ },
2245
+ onBlur() {
2246
+ p(!1);
2247
+ }
2248
+ }, i, h]
2249
+ });
2250
+ });
2251
+ process.env.NODE_ENV !== "production" && (Lt.displayName = "ToastClose");
2252
+ function er(t) {
2253
+ return `data-base-ui-${t}`;
2254
+ }
2255
+ const Ze = /* @__PURE__ */ u.createContext(null);
2256
+ process.env.NODE_ENV !== "production" && (Ze.displayName = "PortalContext");
2257
+ const tr = () => u.useContext(Ze), nr = er("portal");
2258
+ function $t(t = {}) {
2259
+ const {
2260
+ ref: e,
2261
+ container: n,
2262
+ componentProps: s = W,
2263
+ elementProps: r
2264
+ } = t, o = He(), i = tr()?.portalNode, [l, a] = u.useState(null), [d, f] = u.useState(null), p = J((T) => {
2265
+ T !== null && f(T);
2266
+ }), h = u.useRef(null);
2267
+ $(() => {
2268
+ if (n === null) {
2269
+ h.current && (h.current = null, f(null), a(null));
2270
+ return;
2271
+ }
2272
+ if (o == null)
2273
+ return;
2274
+ const T = (n && (wn(n) ? n : n.current)) ?? i ?? document.body;
2275
+ if (T == null) {
2276
+ h.current && (h.current = null, f(null), a(null));
2277
+ return;
2278
+ }
2279
+ h.current !== T && (h.current = T, f(null), a(T));
2280
+ }, [n, i, o]);
2281
+ const m = Q("div", s, {
2282
+ ref: [e, p],
2283
+ props: [{
2284
+ id: o,
2285
+ [nr]: ""
2286
+ }, r]
2287
+ });
2288
+ return {
2289
+ portalNode: d,
2290
+ portalSubtree: l && m ? /* @__PURE__ */ de.createPortal(m, l) : null
2291
+ };
2292
+ }
2293
+ const sr = /* @__PURE__ */ u.forwardRef(function(e, n) {
2294
+ const {
2295
+ children: s,
2296
+ container: r,
2297
+ className: o,
2298
+ render: c,
2299
+ renderGuards: i,
2300
+ ...l
2301
+ } = e, {
2302
+ portalNode: a,
2303
+ portalSubtree: d
2304
+ } = $t({
2305
+ container: r,
2306
+ ref: n,
2307
+ componentProps: e,
2308
+ elementProps: l
2309
+ }), f = u.useRef(null), p = u.useRef(null), h = u.useRef(null), m = u.useRef(null), [v, T] = u.useState(null), R = v?.modal, O = v?.open, F = typeof i == "boolean" ? i : !!v && !v.modal && v.open && !!a;
2310
+ u.useEffect(() => {
2311
+ if (!a || R)
2312
+ return;
2313
+ function S(E) {
2314
+ a && E.relatedTarget && Ve(E) && (E.type === "focusin" ? lt : ss)(a);
2315
+ }
2316
+ return a.addEventListener("focusin", S, !0), a.addEventListener("focusout", S, !0), () => {
2317
+ a.removeEventListener("focusin", S, !0), a.removeEventListener("focusout", S, !0);
2318
+ };
2319
+ }, [a, R]), u.useEffect(() => {
2320
+ !a || O || lt(a);
2321
+ }, [O, a]);
2322
+ const g = u.useMemo(() => ({
2323
+ beforeOutsideRef: f,
2324
+ afterOutsideRef: p,
2325
+ beforeInsideRef: h,
2326
+ afterInsideRef: m,
2327
+ portalNode: a,
2328
+ setFocusManagerState: T
2329
+ }), [a]);
2330
+ return /* @__PURE__ */ U(u.Fragment, {
2331
+ children: [d, /* @__PURE__ */ U(Ze.Provider, {
2332
+ value: g,
2333
+ children: [F && a && /* @__PURE__ */ x(ne, {
2334
+ "data-type": "outside",
2335
+ ref: f,
2336
+ onFocus: (S) => {
2337
+ if (Ve(S, a))
2338
+ h.current?.focus();
2339
+ else {
2340
+ const E = v ? v.domReference : null;
2341
+ ns(E)?.focus();
2342
+ }
2343
+ }
2344
+ }), F && a && /* @__PURE__ */ x("span", {
2345
+ "aria-owns": a.id,
2346
+ style: Dn
2347
+ }), a && /* @__PURE__ */ de.createPortal(s, a), F && a && /* @__PURE__ */ x(ne, {
2348
+ "data-type": "outside",
2349
+ ref: p,
2350
+ onFocus: (S) => {
2351
+ if (Ve(S, a))
2352
+ m.current?.focus();
2353
+ else {
2354
+ const E = v ? v.domReference : null;
2355
+ ts(E)?.focus(), v?.closeOnFocusOut && v?.onOpenChange(!1, On(Rn, S.nativeEvent));
2356
+ }
2357
+ }
2358
+ })]
2359
+ })]
2360
+ });
2361
+ });
2362
+ process.env.NODE_ENV !== "production" && (sr.displayName = "FloatingPortal");
2363
+ const Ut = /* @__PURE__ */ u.forwardRef(function(e, n) {
2364
+ const {
2365
+ children: s,
2366
+ container: r,
2367
+ className: o,
2368
+ render: c,
2369
+ ...i
2370
+ } = e, {
2371
+ portalNode: l,
2372
+ portalSubtree: a
2373
+ } = $t({
2374
+ container: r,
2375
+ ref: n,
2376
+ componentProps: e,
2377
+ elementProps: i
2378
+ });
2379
+ return !a && !l ? null : /* @__PURE__ */ U(u.Fragment, {
2380
+ children: [a, l && /* @__PURE__ */ de.createPortal(s, l)]
2381
+ });
2382
+ });
2383
+ process.env.NODE_ENV !== "production" && (Ut.displayName = "FloatingPortalLite");
2384
+ const rr = Ut;
2385
+ function jt() {
2386
+ const t = u.useContext(Ne);
2387
+ if (!t)
2388
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: useToastManager must be used within <Toast.Provider>." : Y(73));
2389
+ const e = t.useState("toasts");
2390
+ return u.useMemo(() => ({
2391
+ toasts: e,
2392
+ add: t.addToast,
2393
+ close: t.closeToast,
2394
+ update: t.updateToast,
2395
+ promise: t.promiseToast
2396
+ }), [e, t]);
2397
+ }
2398
+ const or = (t) => {
2399
+ const [e, n] = an(!1), s = () => n(!0), r = () => n(!1);
2400
+ return cn(() => {
2401
+ const o = t.current;
2402
+ if (o)
2403
+ return o.addEventListener("mouseenter", s), o.addEventListener("mouseleave", r), () => {
2404
+ o.removeEventListener("mouseenter", s), o.removeEventListener("mouseleave", r);
2405
+ };
2406
+ }, []), e;
2407
+ }, ir = on(
2408
+ "relative isolate z-tooltip flex w-full flex-col overflow-hidden rounded-xl border bg-card-background backdrop-blur-md text-sm shadow-notification transition-all duration-300",
2409
+ {
2410
+ variants: {
2411
+ theme: {
2412
+ default: "border-card-border text-foreground shadow-black/5",
2413
+ info: "bg-alert-info-bg text-alert-info-text border-alert-info-border",
2414
+ warn: "bg-alert-warn-bg text-alert-warn-text border-alert-warn-border",
2415
+ muted: "bg-alert-muted-bg text-alert-muted-text border-alert-muted-border",
2416
+ danger: "bg-alert-danger-bg text-alert-danger-text border-alert-danger-border",
2417
+ success: "bg-alert-success-bg text-alert-success-text border-alert-success-border",
2418
+ secondary: "bg-alert-secondary-bg text-alert-secondary-text border-alert-secondary-border"
2419
+ }
2420
+ },
2421
+ defaultVariants: { theme: "default" }
2422
+ }
2423
+ ), ar = {
2424
+ default: ae,
2425
+ info: ae,
2426
+ warn: st,
2427
+ muted: ae,
2428
+ danger: st,
2429
+ success: hn,
2430
+ secondary: ae
2431
+ }, Bt = un(() => {
2432
+ throw new Error("Not implemented");
2433
+ }), Rr = () => ln(Bt);
2434
+ function cr(t) {
2435
+ const e = t.toast.data?.closable ?? !0, n = t.toast.data?.loading ?? !1, s = t.toast.data?.theme || "default", r = ir({ theme: s }), o = n ? xn : ar[s] || ae;
2436
+ return /* @__PURE__ */ x(Ft, { toast: t.toast, swipeDirection: "right", children: /* @__PURE__ */ x(
2437
+ yt.li,
2438
+ {
2439
+ layout: !0,
2440
+ initial: { opacity: 0, y: -20, scale: 0.95 },
2441
+ animate: { opacity: 1, y: 0, scale: 1 },
2442
+ exit: { opacity: 0, scale: 0.9, y: -20, transition: { duration: 0.2 } },
2443
+ transition: {
2444
+ type: "spring",
2445
+ damping: 25,
2446
+ stiffness: 300
2447
+ },
2448
+ className: "pointer-events-auto w-full list-none",
2449
+ children: /* @__PURE__ */ x(Mt, { className: nt(r, "shadow-lg"), children: /* @__PURE__ */ U("div", { className: "flex items-start gap-3 p-4", children: [
2450
+ /* @__PURE__ */ x("div", { className: nt("mt-0.5 shrink-0 opacity-80", n && "animate-spin"), children: /* @__PURE__ */ x(o, { className: "size-4" }) }),
2451
+ /* @__PURE__ */ U("div", { className: "flex flex-1 flex-col gap-1 overflow-hidden", children: [
2452
+ t.toast.title ? /* @__PURE__ */ x(Vt, { className: "select-text truncate font-semibold leading-tight tracking-tight" }) : null,
2453
+ /* @__PURE__ */ x(At, { className: "line-clamp-2 select-text text-xs font-medium leading-relaxed opacity-90" })
2454
+ ] }),
2455
+ e && !n ? /* @__PURE__ */ x(Lt, { className: "-mr-1 -mt-1 shrink-0 rounded-lg p-1.5 text-foreground/40 transition hover:bg-foreground/10 hover:text-foreground", children: /* @__PURE__ */ x(mn, { className: "size-3.5" }) }) : null
2456
+ ] }) })
2457
+ }
2458
+ ) });
2459
+ }
2460
+ function ur({ max: t = 5 }) {
2461
+ const e = dn(null), n = or(e), s = jt(), r = t ? s.toasts.slice(0, t) : s.toasts, o = n ? r : r.slice(0, 3), c = r.length - o.length;
2462
+ return /* @__PURE__ */ U(
2463
+ kt,
2464
+ {
2465
+ ref: e,
2466
+ className: "pointer-events-none fixed left-1/2 top-6 z-[100] flex w-full max-w-[380px] -translate-x-1/2 flex-col gap-3 overflow-visible outline-none",
2467
+ children: [
2468
+ /* @__PURE__ */ x(fn, { mode: "popLayout", initial: !1, children: o.map((i) => /* @__PURE__ */ x(cr, { toast: i }, i.id)) }),
2469
+ !n && c > 0 && /* @__PURE__ */ U(
2470
+ yt.div,
2471
+ {
2472
+ layout: !0,
2473
+ initial: { opacity: 0, y: -10 },
2474
+ animate: { opacity: 1, y: 0 },
2475
+ exit: { opacity: 0, y: -10 },
2476
+ className: "pointer-events-auto cursor-default self-center rounded-full border border-card-border bg-card-background/80 px-3 py-1 text-[10px] font-bold uppercase tracking-wider text-foreground/50 shadow-sm backdrop-blur transition-all hover:bg-card-background hover:text-foreground/80",
2477
+ children: [
2478
+ "+",
2479
+ c,
2480
+ " more"
2481
+ ]
2482
+ }
2483
+ )
2484
+ ]
2485
+ }
2486
+ );
2487
+ }
2488
+ function lr({ children: t, max: e = 5 }) {
2489
+ const n = jt(), s = tt(() => {
2490
+ n.toasts.forEach((o) => n.close(o.id));
2491
+ }, [n]), r = tt(
2492
+ (o, c) => {
2493
+ const i = { theme: c?.theme, closable: c?.closable, loading: c?.loading };
2494
+ if (c?.id && n.toasts.find((d) => d.id === c.id))
2495
+ return n.update(c.id, {
2496
+ description: o,
2497
+ title: c.title,
2498
+ timeout: c.timeout,
2499
+ data: i
2500
+ }), { close: () => n.close(c.id), clear: s };
2501
+ const l = n.add({
2502
+ description: o,
2503
+ id: c?.id,
2504
+ title: c?.title,
2505
+ timeout: c?.timeout,
2506
+ data: i
2507
+ });
2508
+ return {
2509
+ close: () => n.close(l),
2510
+ clear: s
2511
+ };
2512
+ },
2513
+ [n, s]
2514
+ );
2515
+ return /* @__PURE__ */ U(Bt.Provider, { value: r, children: [
2516
+ t,
2517
+ /* @__PURE__ */ x(rr, { children: /* @__PURE__ */ x(ur, { max: e }) })
2518
+ ] });
2519
+ }
2520
+ function Or({ children: t, max: e = 5, timeout: n = 5e3 }) {
2521
+ return /* @__PURE__ */ x(Pt, { limit: e, timeout: n, children: /* @__PURE__ */ x(lr, { max: e, children: t }) });
2522
+ }
2523
+ export {
2524
+ W as E,
2525
+ In as N,
2526
+ $ as a,
2527
+ J as b,
2528
+ He as c,
2529
+ ue as d,
2530
+ Q as e,
2531
+ Y as f,
2532
+ On as g,
2533
+ Dr as h,
2534
+ Nr as i,
2535
+ is as j,
2536
+ Cr as k,
2537
+ Ir as l,
2538
+ Z as m,
2539
+ Tr as n,
2540
+ K as o,
2541
+ qe as p,
2542
+ xt as q,
2543
+ ct as r,
2544
+ Rr as s,
2545
+ Sr as t,
2546
+ se as u,
2547
+ It as v,
2548
+ Or as w
2549
+ };
2550
+ //# sourceMappingURL=notifications-NPuFDsBp.js.map