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