zudoku 0.3.0-dev.34 → 0.3.0-dev.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/app/entry.client.js +2 -1
  2. package/dist/app/entry.client.js.map +1 -1
  3. package/dist/app/entry.server.js +10 -2
  4. package/dist/app/entry.server.js.map +1 -1
  5. package/dist/app/main.js +1 -3
  6. package/dist/app/main.js.map +1 -1
  7. package/dist/lib/components/DevPortal.js +9 -3
  8. package/dist/lib/components/DevPortal.js.map +1 -1
  9. package/dist/lib/components/Layout.js +4 -1
  10. package/dist/lib/components/Layout.js.map +1 -1
  11. package/dist/lib/components/index.d.ts +5 -0
  12. package/dist/lib/components/index.js +4 -0
  13. package/dist/lib/components/index.js.map +1 -1
  14. package/dist/lib/plugins/markdown/MdxPage.js +3 -1
  15. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  16. package/dist/vite/config.js +1 -1
  17. package/dist/vite/config.js.map +1 -1
  18. package/dist/vite/plugin-component.js +1 -1
  19. package/dist/vite/plugin-component.js.map +1 -1
  20. package/lib/AnchorLink-Sx89bfCW.js +704 -0
  21. package/lib/AnchorLink-Sx89bfCW.js.map +1 -0
  22. package/lib/{DevPortalProvider-BlxLX6GG.js → DevPortalProvider-Demv4Ngx.js} +250 -230
  23. package/lib/DevPortalProvider-Demv4Ngx.js.map +1 -0
  24. package/lib/Markdown-DMEnjeMH.js +14499 -0
  25. package/lib/Markdown-DMEnjeMH.js.map +1 -0
  26. package/lib/{MdxPage-BRKQDcVW.js → MdxPage-s9RlKFtt.js} +102 -108
  27. package/lib/MdxPage-s9RlKFtt.js.map +1 -0
  28. package/lib/{OperationList-DfkWNe8Y.js → OperationList-9NIdTqS0.js} +1692 -1862
  29. package/lib/OperationList-9NIdTqS0.js.map +1 -0
  30. package/lib/{Route-Bf1_D_vC.js → Route-BqfQoDR2.js} +2 -2
  31. package/lib/{Route-Bf1_D_vC.js.map → Route-BqfQoDR2.js.map} +1 -1
  32. package/lib/Select-CJamK_wp.js +4571 -0
  33. package/lib/Select-CJamK_wp.js.map +1 -0
  34. package/lib/Spinner-3YT-WUu5.js +182 -0
  35. package/lib/Spinner-3YT-WUu5.js.map +1 -0
  36. package/lib/hook-Cq3Jb1lX.js +77 -0
  37. package/lib/hook-Cq3Jb1lX.js.map +1 -0
  38. package/lib/index-BB2EBBgh.js +412 -0
  39. package/lib/index-BB2EBBgh.js.map +1 -0
  40. package/lib/{index-BjSy8IQO.js → index-DhKGMJM2.js} +19 -20
  41. package/lib/{index-BjSy8IQO.js.map → index-DhKGMJM2.js.map} +1 -1
  42. package/lib/{jsx-runtime-CM0TzjGp.js → jsx-runtime-Bt86M5tA.js} +5 -5
  43. package/lib/{jsx-runtime-CM0TzjGp.js.map → jsx-runtime-Bt86M5tA.js.map} +1 -1
  44. package/lib/util-CYBrkBUo.js +41 -0
  45. package/lib/util-CYBrkBUo.js.map +1 -0
  46. package/lib/zudoku.auth-openid.js +1 -1
  47. package/lib/zudoku.components.js +564 -286
  48. package/lib/zudoku.components.js.map +1 -1
  49. package/lib/zudoku.plugin-api-keys.js +99 -153
  50. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  51. package/lib/zudoku.plugin-markdown.js +46 -2
  52. package/lib/zudoku.plugin-markdown.js.map +1 -1
  53. package/lib/zudoku.plugin-openapi.js +3 -3
  54. package/package.json +2 -1
  55. package/src/app/entry.client.tsx +4 -1
  56. package/src/app/entry.server.tsx +17 -2
  57. package/src/app/main.tsx +1 -3
  58. package/src/lib/components/DevPortal.tsx +15 -1
  59. package/src/lib/components/Layout.tsx +9 -0
  60. package/src/lib/components/index.ts +4 -0
  61. package/src/lib/plugins/markdown/MdxPage.tsx +6 -0
  62. package/lib/DevPortalProvider-BlxLX6GG.js.map +0 -1
  63. package/lib/Markdown-CL8KPvJN.js +0 -8620
  64. package/lib/Markdown-CL8KPvJN.js.map +0 -1
  65. package/lib/MdxComponents-Ev_hBHb2.js +0 -5885
  66. package/lib/MdxComponents-Ev_hBHb2.js.map +0 -1
  67. package/lib/MdxPage-BRKQDcVW.js.map +0 -1
  68. package/lib/OperationList-DfkWNe8Y.js.map +0 -1
  69. package/lib/Select-DSa3bN4t.js +0 -4770
  70. package/lib/Select-DSa3bN4t.js.map +0 -1
  71. package/lib/hook-CTmJ6CWq.js +0 -35
  72. package/lib/hook-CTmJ6CWq.js.map +0 -1
  73. package/lib/index-Brq2ztwd.js +0 -74
  74. package/lib/index-Brq2ztwd.js.map +0 -1
  75. package/lib/index-QzXzw_ra.js +0 -24
  76. package/lib/index-QzXzw_ra.js.map +0 -1
  77. package/lib/mutation-91kw0lHb.js +0 -208
  78. package/lib/mutation-91kw0lHb.js.map +0 -1
@@ -1,4770 +0,0 @@
1
- var an = (e) => {
2
- throw TypeError(e);
3
- };
4
- var lr = (e, r, t) => r.has(e) || an("Cannot " + t);
5
- var te = (e, r, t) => (lr(e, r, "read from private field"), t ? t.call(e) : r.get(e)), it = (e, r, t) => r.has(e) ? an("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), at = (e, r, t, n) => (lr(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t), ct = (e, r, t) => (lr(e, r, "access private method"), t);
6
- import * as l from "react";
7
- import j, { useLayoutEffect as Os, useEffect as Ts, useState as Fs } from "react";
8
- import { g as Ns } from "./mutation-91kw0lHb.js";
9
- import { S as Ds, x as Ms, i as cn, n as jn, t as Vs, y as Is, z as ks } from "./DevPortalProvider-BlxLX6GG.js";
10
- import { j as R } from "./jsx-runtime-CM0TzjGp.js";
11
- import { c as Bn, g as Ls, b as Ve, h as js } from "./MdxComponents-Ev_hBHb2.js";
12
- import * as Jt from "react-dom";
13
- import Bs from "react-dom";
14
- /**
15
- * @license lucide-react v0.378.0 - ISC
16
- *
17
- * This source code is licensed under the ISC license.
18
- * See the LICENSE file in the root directory of this source tree.
19
- */
20
- const Wn = Bn("ChevronDown", [
21
- ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
22
- ]);
23
- /**
24
- * @license lucide-react v0.378.0 - ISC
25
- *
26
- * This source code is licensed under the ISC license.
27
- * See the LICENSE file in the root directory of this source tree.
28
- */
29
- const Ws = Bn("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
30
- var $e, ze, de, De, Me, Lt, Or, Ln, Hs = (Ln = class extends Ds {
31
- constructor(t, n) {
32
- super();
33
- it(this, Me);
34
- it(this, $e);
35
- it(this, ze);
36
- it(this, de);
37
- it(this, De);
38
- at(this, $e, t), this.setOptions(n), this.bindMethods(), ct(this, Me, Lt).call(this);
39
- }
40
- bindMethods() {
41
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
42
- }
43
- setOptions(t) {
44
- var o;
45
- const n = this.options;
46
- this.options = te(this, $e).defaultMutationOptions(t), Ms(this.options, n) || te(this, $e).getMutationCache().notify({
47
- type: "observerOptionsUpdated",
48
- mutation: te(this, de),
49
- observer: this
50
- }), n != null && n.mutationKey && this.options.mutationKey && cn(n.mutationKey) !== cn(this.options.mutationKey) ? this.reset() : ((o = te(this, de)) == null ? void 0 : o.state.status) === "pending" && te(this, de).setOptions(this.options);
51
- }
52
- onUnsubscribe() {
53
- var t;
54
- this.hasListeners() || (t = te(this, de)) == null || t.removeObserver(this);
55
- }
56
- onMutationUpdate(t) {
57
- ct(this, Me, Lt).call(this), ct(this, Me, Or).call(this, t);
58
- }
59
- getCurrentResult() {
60
- return te(this, ze);
61
- }
62
- reset() {
63
- var t;
64
- (t = te(this, de)) == null || t.removeObserver(this), at(this, de, void 0), ct(this, Me, Lt).call(this), ct(this, Me, Or).call(this);
65
- }
66
- mutate(t, n) {
67
- var o;
68
- return at(this, De, n), (o = te(this, de)) == null || o.removeObserver(this), at(this, de, te(this, $e).getMutationCache().build(te(this, $e), this.options)), te(this, de).addObserver(this), te(this, de).execute(t);
69
- }
70
- }, $e = new WeakMap(), ze = new WeakMap(), de = new WeakMap(), De = new WeakMap(), Me = new WeakSet(), Lt = function() {
71
- var n;
72
- const t = ((n = te(this, de)) == null ? void 0 : n.state) ?? Ns();
73
- at(this, ze, {
74
- ...t,
75
- isPending: t.status === "pending",
76
- isSuccess: t.status === "success",
77
- isError: t.status === "error",
78
- isIdle: t.status === "idle",
79
- mutate: this.mutate,
80
- reset: this.reset
81
- });
82
- }, Or = function(t) {
83
- jn.batch(() => {
84
- var n, o, s, i, a, c, f, h;
85
- if (te(this, De) && this.hasListeners()) {
86
- const d = te(this, ze).variables, m = te(this, ze).context;
87
- (t == null ? void 0 : t.type) === "success" ? ((o = (n = te(this, De)).onSuccess) == null || o.call(n, t.data, d, m), (i = (s = te(this, De)).onSettled) == null || i.call(s, t.data, null, d, m)) : (t == null ? void 0 : t.type) === "error" && ((c = (a = te(this, De)).onError) == null || c.call(a, t.error, d, m), (h = (f = te(this, De)).onSettled) == null || h.call(
88
- f,
89
- void 0,
90
- t.error,
91
- d,
92
- m
93
- ));
94
- }
95
- this.listeners.forEach((d) => {
96
- d(te(this, ze));
97
- });
98
- });
99
- }, Ln);
100
- function ml(e, r) {
101
- const t = Vs(), [n] = l.useState(
102
- () => new Hs(
103
- t,
104
- e
105
- )
106
- );
107
- l.useEffect(() => {
108
- n.setOptions(e);
109
- }, [n, e]);
110
- const o = l.useSyncExternalStore(
111
- l.useCallback(
112
- (i) => n.subscribe(jn.batchCalls(i)),
113
- [n]
114
- ),
115
- () => n.getCurrentResult(),
116
- () => n.getCurrentResult()
117
- ), s = l.useCallback(
118
- (i, a) => {
119
- n.mutate(i, a).catch(Is);
120
- },
121
- [n]
122
- );
123
- if (o.error && ks(n.options.throwOnError, [o.error]))
124
- throw o.error;
125
- return { ...o, mutate: s, mutateAsync: o.mutate };
126
- }
127
- function Us(e, r) {
128
- typeof e == "function" ? e(r) : e != null && (e.current = r);
129
- }
130
- function Hn(...e) {
131
- return (r) => e.forEach((t) => Us(t, r));
132
- }
133
- function le(...e) {
134
- return l.useCallback(Hn(...e), e);
135
- }
136
- var gt = l.forwardRef((e, r) => {
137
- const { children: t, ...n } = e, o = l.Children.toArray(t), s = o.find(zs);
138
- if (s) {
139
- const i = s.props.children, a = o.map((c) => c === s ? l.Children.count(i) > 1 ? l.Children.only(null) : l.isValidElement(i) ? i.props.children : null : c);
140
- return /* @__PURE__ */ R.jsx(Tr, { ...n, ref: r, children: l.isValidElement(i) ? l.cloneElement(i, void 0, a) : null });
141
- }
142
- return /* @__PURE__ */ R.jsx(Tr, { ...n, ref: r, children: t });
143
- });
144
- gt.displayName = "Slot";
145
- var Tr = l.forwardRef((e, r) => {
146
- const { children: t, ...n } = e;
147
- if (l.isValidElement(t)) {
148
- const o = Ys(t);
149
- return l.cloneElement(t, {
150
- ...Ks(n, t.props),
151
- // @ts-ignore
152
- ref: r ? Hn(r, o) : o
153
- });
154
- }
155
- return l.Children.count(t) > 1 ? l.Children.only(null) : null;
156
- });
157
- Tr.displayName = "SlotClone";
158
- var $s = ({ children: e }) => /* @__PURE__ */ R.jsx(R.Fragment, { children: e });
159
- function zs(e) {
160
- return l.isValidElement(e) && e.type === $s;
161
- }
162
- function Ks(e, r) {
163
- const t = { ...r };
164
- for (const n in r) {
165
- const o = e[n], s = r[n];
166
- /^on[A-Z]/.test(n) ? o && s ? t[n] = (...a) => {
167
- s(...a), o(...a);
168
- } : o && (t[n] = o) : n === "style" ? t[n] = { ...o, ...s } : n === "className" && (t[n] = [o, s].filter(Boolean).join(" "));
169
- }
170
- return { ...e, ...t };
171
- }
172
- function Ys(e) {
173
- var n, o;
174
- let r = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, t = r && "isReactWarning" in r && r.isReactWarning;
175
- return t ? e.ref : (r = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, t = r && "isReactWarning" in r && r.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
176
- }
177
- const qs = Ls(
178
- "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
179
- {
180
- variants: {
181
- variant: {
182
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
183
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
184
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
185
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
186
- ghost: "hover:bg-accent hover:text-accent-foreground",
187
- link: "text-primary underline-offset-4 hover:underline"
188
- },
189
- size: {
190
- default: "h-9 px-4 py-2",
191
- sm: "h-8 rounded-md px-3 text-xs",
192
- lg: "h-10 rounded-md px-8",
193
- icon: "h-9 w-9"
194
- }
195
- },
196
- defaultVariants: {
197
- variant: "default",
198
- size: "default"
199
- }
200
- }
201
- ), Xs = l.forwardRef(
202
- ({ className: e, variant: r, size: t, asChild: n = !1, ...o }, s) => {
203
- const i = n ? gt : "button";
204
- return /* @__PURE__ */ R.jsx(
205
- i,
206
- {
207
- className: Ve(qs({ variant: r, size: t, className: e })),
208
- ref: s,
209
- ...o
210
- }
211
- );
212
- }
213
- );
214
- Xs.displayName = "Button";
215
- var Pt = (e) => e.type === "checkbox", ht = (e) => e instanceof Date, fe = (e) => e == null;
216
- const Un = (e) => typeof e == "object";
217
- var ae = (e) => !fe(e) && !Array.isArray(e) && Un(e) && !ht(e), $n = (e) => ae(e) && e.target ? Pt(e.target) ? e.target.checked : e.target.value : e, Gs = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, zn = (e, r) => e.has(Gs(r)), Zs = (e) => {
218
- const r = e.constructor && e.constructor.prototype;
219
- return ae(r) && r.hasOwnProperty("isPrototypeOf");
220
- }, Hr = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
221
- function ie(e) {
222
- let r;
223
- const t = Array.isArray(e);
224
- if (e instanceof Date)
225
- r = new Date(e);
226
- else if (e instanceof Set)
227
- r = new Set(e);
228
- else if (!(Hr && (e instanceof Blob || e instanceof FileList)) && (t || ae(e)))
229
- if (r = t ? [] : {}, !t && !Zs(e))
230
- r = e;
231
- else
232
- for (const n in e)
233
- e.hasOwnProperty(n) && (r[n] = ie(e[n]));
234
- else
235
- return e;
236
- return r;
237
- }
238
- var Ot = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Q = (e) => e === void 0, T = (e, r, t) => {
239
- if (!r || !ae(e))
240
- return t;
241
- const n = Ot(r.split(/[,[\].]+?/)).reduce((o, s) => fe(o) ? o : o[s], e);
242
- return Q(n) || n === e ? Q(e[r]) ? t : e[r] : n;
243
- }, _e = (e) => typeof e == "boolean", Ur = (e) => /^\w*$/.test(e), Kn = (e) => Ot(e.replace(/["|']|\]/g, "").split(/\.|\[/)), G = (e, r, t) => {
244
- let n = -1;
245
- const o = Ur(r) ? [r] : Kn(r), s = o.length, i = s - 1;
246
- for (; ++n < s; ) {
247
- const a = o[n];
248
- let c = t;
249
- if (n !== i) {
250
- const f = e[a];
251
- c = ae(f) || Array.isArray(f) ? f : isNaN(+o[n + 1]) ? {} : [];
252
- }
253
- if (a === "__proto__")
254
- return;
255
- e[a] = c, e = e[a];
256
- }
257
- return e;
258
- };
259
- const Ut = {
260
- BLUR: "blur",
261
- FOCUS_OUT: "focusout",
262
- CHANGE: "change"
263
- }, be = {
264
- onBlur: "onBlur",
265
- onChange: "onChange",
266
- onSubmit: "onSubmit",
267
- onTouched: "onTouched",
268
- all: "all"
269
- }, Fe = {
270
- max: "max",
271
- min: "min",
272
- maxLength: "maxLength",
273
- minLength: "minLength",
274
- pattern: "pattern",
275
- required: "required",
276
- validate: "validate"
277
- }, Yn = j.createContext(null), er = () => j.useContext(Yn), vl = (e) => {
278
- const { children: r, ...t } = e;
279
- return j.createElement(Yn.Provider, { value: t }, r);
280
- };
281
- var qn = (e, r, t, n = !0) => {
282
- const o = {
283
- defaultValues: r._defaultValues
284
- };
285
- for (const s in e)
286
- Object.defineProperty(o, s, {
287
- get: () => {
288
- const i = s;
289
- return r._proxyFormState[i] !== be.all && (r._proxyFormState[i] = !n || be.all), t && (t[i] = !0), e[i];
290
- }
291
- });
292
- return o;
293
- }, he = (e) => ae(e) && !Object.keys(e).length, Xn = (e, r, t, n) => {
294
- t(e);
295
- const { name: o, ...s } = e;
296
- return he(s) || Object.keys(s).length >= Object.keys(r).length || Object.keys(s).find((i) => r[i] === (!n || be.all));
297
- }, pe = (e) => Array.isArray(e) ? e : [e], Gn = (e, r, t) => !e || !r || e === r || pe(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n)));
298
- function tr(e) {
299
- const r = j.useRef(e);
300
- r.current = e, j.useEffect(() => {
301
- const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
302
- next: r.current.next
303
- });
304
- return () => {
305
- t && t.unsubscribe();
306
- };
307
- }, [e.disabled]);
308
- }
309
- function Qs(e) {
310
- const r = er(), { control: t = r.control, disabled: n, name: o, exact: s } = e || {}, [i, a] = j.useState(t._formState), c = j.useRef(!0), f = j.useRef({
311
- isDirty: !1,
312
- isLoading: !1,
313
- dirtyFields: !1,
314
- touchedFields: !1,
315
- validatingFields: !1,
316
- isValidating: !1,
317
- isValid: !1,
318
- errors: !1
319
- }), h = j.useRef(o);
320
- return h.current = o, tr({
321
- disabled: n,
322
- next: (d) => c.current && Gn(h.current, d.name, s) && Xn(d, f.current, t._updateFormState) && a({
323
- ...t._formState,
324
- ...d
325
- }),
326
- subject: t._subjects.state
327
- }), j.useEffect(() => (c.current = !0, f.current.isValid && t._updateValid(!0), () => {
328
- c.current = !1;
329
- }), [t]), qn(i, t, f.current, !1);
330
- }
331
- var Pe = (e) => typeof e == "string", Zn = (e, r, t, n, o) => Pe(e) ? (n && r.watch.add(e), T(t, e, o)) : Array.isArray(e) ? e.map((s) => (n && r.watch.add(s), T(t, s))) : (n && (r.watchAll = !0), t);
332
- function Js(e) {
333
- const r = er(), { control: t = r.control, name: n, defaultValue: o, disabled: s, exact: i } = e || {}, a = j.useRef(n);
334
- a.current = n, tr({
335
- disabled: s,
336
- subject: t._subjects.values,
337
- next: (h) => {
338
- Gn(a.current, h.name, i) && f(ie(Zn(a.current, t._names, h.values || t._formValues, !1, o)));
339
- }
340
- });
341
- const [c, f] = j.useState(t._getWatch(n, o));
342
- return j.useEffect(() => t._removeUnmounted()), c;
343
- }
344
- function ei(e) {
345
- const r = er(), { name: t, disabled: n, control: o = r.control, shouldUnregister: s } = e, i = zn(o._names.array, t), a = Js({
346
- control: o,
347
- name: t,
348
- defaultValue: T(o._formValues, t, T(o._defaultValues, t, e.defaultValue)),
349
- exact: !0
350
- }), c = Qs({
351
- control: o,
352
- name: t
353
- }), f = j.useRef(o.register(t, {
354
- ...e.rules,
355
- value: a,
356
- ..._e(e.disabled) ? { disabled: e.disabled } : {}
357
- }));
358
- return j.useEffect(() => {
359
- const h = o._options.shouldUnregister || s, d = (m, w) => {
360
- const v = T(o._fields, m);
361
- v && v._f && (v._f.mount = w);
362
- };
363
- if (d(t, !0), h) {
364
- const m = ie(T(o._options.defaultValues, t));
365
- G(o._defaultValues, t, m), Q(T(o._formValues, t)) && G(o._formValues, t, m);
366
- }
367
- return () => {
368
- (i ? h && !o._state.action : h) ? o.unregister(t) : d(t, !1);
369
- };
370
- }, [t, o, i, s]), j.useEffect(() => {
371
- T(o._fields, t) && o._updateDisabledField({
372
- disabled: n,
373
- fields: o._fields,
374
- name: t,
375
- value: T(o._fields, t)._f.value
376
- });
377
- }, [n, t, o]), {
378
- field: {
379
- name: t,
380
- value: a,
381
- ..._e(n) || c.disabled ? { disabled: c.disabled || n } : {},
382
- onChange: j.useCallback((h) => f.current.onChange({
383
- target: {
384
- value: $n(h),
385
- name: t
386
- },
387
- type: Ut.CHANGE
388
- }), [t]),
389
- onBlur: j.useCallback(() => f.current.onBlur({
390
- target: {
391
- value: T(o._formValues, t),
392
- name: t
393
- },
394
- type: Ut.BLUR
395
- }), [t, o]),
396
- ref: (h) => {
397
- const d = T(o._fields, t);
398
- d && h && (d._f.ref = {
399
- focus: () => h.focus(),
400
- select: () => h.select(),
401
- setCustomValidity: (m) => h.setCustomValidity(m),
402
- reportValidity: () => h.reportValidity()
403
- });
404
- }
405
- },
406
- formState: c,
407
- fieldState: Object.defineProperties({}, {
408
- invalid: {
409
- enumerable: !0,
410
- get: () => !!T(c.errors, t)
411
- },
412
- isDirty: {
413
- enumerable: !0,
414
- get: () => !!T(c.dirtyFields, t)
415
- },
416
- isTouched: {
417
- enumerable: !0,
418
- get: () => !!T(c.touchedFields, t)
419
- },
420
- isValidating: {
421
- enumerable: !0,
422
- get: () => !!T(c.validatingFields, t)
423
- },
424
- error: {
425
- enumerable: !0,
426
- get: () => T(c.errors, t)
427
- }
428
- })
429
- };
430
- }
431
- const gl = (e) => e.render(ei(e));
432
- var ti = (e, r, t, n, o) => r ? {
433
- ...t[e],
434
- types: {
435
- ...t[e] && t[e].types ? t[e].types : {},
436
- [n]: o || !0
437
- }
438
- } : {}, He = () => {
439
- const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
440
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
441
- const t = (Math.random() * 16 + e) % 16 | 0;
442
- return (r == "x" ? t : t & 3 | 8).toString(16);
443
- });
444
- }, ur = (e, r, t = {}) => t.shouldFocus || Q(t.shouldFocus) ? t.focusName || `${e}.${Q(t.focusIndex) ? r : t.focusIndex}.` : "", At = (e) => ({
445
- isOnSubmit: !e || e === be.onSubmit,
446
- isOnBlur: e === be.onBlur,
447
- isOnChange: e === be.onChange,
448
- isOnAll: e === be.all,
449
- isOnTouch: e === be.onTouched
450
- }), Fr = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
451
- const pt = (e, r, t, n) => {
452
- for (const o of t || Object.keys(e)) {
453
- const s = T(e, o);
454
- if (s) {
455
- const { _f: i, ...a } = s;
456
- if (i) {
457
- if (i.refs && i.refs[0] && r(i.refs[0], o) && !n)
458
- break;
459
- if (i.ref && r(i.ref, i.name) && !n)
460
- break;
461
- pt(a, r);
462
- } else ae(a) && pt(a, r);
463
- }
464
- }
465
- };
466
- var Qn = (e, r, t) => {
467
- const n = pe(T(e, t));
468
- return G(n, "root", r[t]), G(e, t, n), e;
469
- }, $r = (e) => e.type === "file", Ke = (e) => typeof e == "function", $t = (e) => {
470
- if (!Hr)
471
- return !1;
472
- const r = e ? e.ownerDocument : 0;
473
- return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
474
- }, jt = (e) => Pe(e), zr = (e) => e.type === "radio", zt = (e) => e instanceof RegExp;
475
- const ln = {
476
- value: !1,
477
- isValid: !1
478
- }, un = { value: !0, isValid: !0 };
479
- var Jn = (e) => {
480
- if (Array.isArray(e)) {
481
- if (e.length > 1) {
482
- const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
483
- return { value: r, isValid: !!r.length };
484
- }
485
- return e[0].checked && !e[0].disabled ? (
486
- // @ts-expect-error expected to work in the browser
487
- e[0].attributes && !Q(e[0].attributes.value) ? Q(e[0].value) || e[0].value === "" ? un : { value: e[0].value, isValid: !0 } : un
488
- ) : ln;
489
- }
490
- return ln;
491
- };
492
- const fn = {
493
- isValid: !1,
494
- value: null
495
- };
496
- var eo = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
497
- isValid: !0,
498
- value: t.value
499
- } : r, fn) : fn;
500
- function dn(e, r, t = "validate") {
501
- if (jt(e) || Array.isArray(e) && e.every(jt) || _e(e) && !e)
502
- return {
503
- type: t,
504
- message: jt(e) ? e : "",
505
- ref: r
506
- };
507
- }
508
- var lt = (e) => ae(e) && !zt(e) ? e : {
509
- value: e,
510
- message: ""
511
- }, Nr = async (e, r, t, n, o) => {
512
- const { ref: s, refs: i, required: a, maxLength: c, minLength: f, min: h, max: d, pattern: m, validate: w, name: v, valueAsNumber: p, mount: S, disabled: b } = e._f, y = T(r, v);
513
- if (!S || b)
514
- return {};
515
- const E = i ? i[0] : s, P = (D) => {
516
- n && E.reportValidity && (E.setCustomValidity(_e(D) ? "" : D || ""), E.reportValidity());
517
- }, x = {}, A = zr(s), _ = Pt(s), M = A || _, H = (p || $r(s)) && Q(s.value) && Q(y) || $t(s) && s.value === "" || y === "" || Array.isArray(y) && !y.length, U = ti.bind(null, v, t, x), J = (D, I, B, k = Fe.maxLength, $ = Fe.minLength) => {
518
- const L = D ? I : B;
519
- x[v] = {
520
- type: D ? k : $,
521
- message: L,
522
- ref: s,
523
- ...U(D ? k : $, L)
524
- };
525
- };
526
- if (o ? !Array.isArray(y) || !y.length : a && (!M && (H || fe(y)) || _e(y) && !y || _ && !Jn(i).isValid || A && !eo(i).isValid)) {
527
- const { value: D, message: I } = jt(a) ? { value: !!a, message: a } : lt(a);
528
- if (D && (x[v] = {
529
- type: Fe.required,
530
- message: I,
531
- ref: E,
532
- ...U(Fe.required, I)
533
- }, !t))
534
- return P(I), x;
535
- }
536
- if (!H && (!fe(h) || !fe(d))) {
537
- let D, I;
538
- const B = lt(d), k = lt(h);
539
- if (!fe(y) && !isNaN(y)) {
540
- const $ = s.valueAsNumber || y && +y;
541
- fe(B.value) || (D = $ > B.value), fe(k.value) || (I = $ < k.value);
542
- } else {
543
- const $ = s.valueAsDate || new Date(y), L = (Se) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Se), Z = s.type == "time", ee = s.type == "week";
544
- Pe(B.value) && y && (D = Z ? L(y) > L(B.value) : ee ? y > B.value : $ > new Date(B.value)), Pe(k.value) && y && (I = Z ? L(y) < L(k.value) : ee ? y < k.value : $ < new Date(k.value));
545
- }
546
- if ((D || I) && (J(!!D, B.message, k.message, Fe.max, Fe.min), !t))
547
- return P(x[v].message), x;
548
- }
549
- if ((c || f) && !H && (Pe(y) || o && Array.isArray(y))) {
550
- const D = lt(c), I = lt(f), B = !fe(D.value) && y.length > +D.value, k = !fe(I.value) && y.length < +I.value;
551
- if ((B || k) && (J(B, D.message, I.message), !t))
552
- return P(x[v].message), x;
553
- }
554
- if (m && !H && Pe(y)) {
555
- const { value: D, message: I } = lt(m);
556
- if (zt(D) && !y.match(D) && (x[v] = {
557
- type: Fe.pattern,
558
- message: I,
559
- ref: s,
560
- ...U(Fe.pattern, I)
561
- }, !t))
562
- return P(I), x;
563
- }
564
- if (w) {
565
- if (Ke(w)) {
566
- const D = await w(y, r), I = dn(D, E);
567
- if (I && (x[v] = {
568
- ...I,
569
- ...U(Fe.validate, I.message)
570
- }, !t))
571
- return P(I.message), x;
572
- } else if (ae(w)) {
573
- let D = {};
574
- for (const I in w) {
575
- if (!he(D) && !t)
576
- break;
577
- const B = dn(await w[I](y, r), E, I);
578
- B && (D = {
579
- ...B,
580
- ...U(I, B.message)
581
- }, P(B.message), t && (x[v] = D));
582
- }
583
- if (!he(D) && (x[v] = {
584
- ref: E,
585
- ...D
586
- }, !t))
587
- return x;
588
- }
589
- }
590
- return P(!0), x;
591
- }, fr = (e, r) => [
592
- ...e,
593
- ...pe(r)
594
- ], dr = (e) => Array.isArray(e) ? e.map(() => {
595
- }) : void 0;
596
- function hr(e, r, t) {
597
- return [
598
- ...e.slice(0, r),
599
- ...pe(t),
600
- ...e.slice(r)
601
- ];
602
- }
603
- var pr = (e, r, t) => Array.isArray(e) ? (Q(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], mr = (e, r) => [
604
- ...pe(r),
605
- ...pe(e)
606
- ];
607
- function ri(e, r) {
608
- let t = 0;
609
- const n = [...e];
610
- for (const o of r)
611
- n.splice(o - t, 1), t++;
612
- return Ot(n).length ? n : [];
613
- }
614
- var vr = (e, r) => Q(r) ? [] : ri(e, pe(r).sort((t, n) => t - n)), gr = (e, r, t) => {
615
- [e[r], e[t]] = [e[t], e[r]];
616
- };
617
- function ni(e, r) {
618
- const t = r.slice(0, -1).length;
619
- let n = 0;
620
- for (; n < t; )
621
- e = Q(e) ? n++ : e[r[n++]];
622
- return e;
623
- }
624
- function oi(e) {
625
- for (const r in e)
626
- if (e.hasOwnProperty(r) && !Q(e[r]))
627
- return !1;
628
- return !0;
629
- }
630
- function ne(e, r) {
631
- const t = Array.isArray(r) ? r : Ur(r) ? [r] : Kn(r), n = t.length === 1 ? e : ni(e, t), o = t.length - 1, s = t[o];
632
- return n && delete n[s], o !== 0 && (ae(n) && he(n) || Array.isArray(n) && oi(n)) && ne(e, t.slice(0, -1)), e;
633
- }
634
- var hn = (e, r, t) => (e[r] = t, e);
635
- function yl(e) {
636
- const r = er(), { control: t = r.control, name: n, keyName: o = "id", shouldUnregister: s } = e, [i, a] = j.useState(t._getFieldArray(n)), c = j.useRef(t._getFieldArray(n).map(He)), f = j.useRef(i), h = j.useRef(n), d = j.useRef(!1);
637
- h.current = n, f.current = i, t._names.array.add(n), e.rules && t.register(n, e.rules), tr({
638
- next: ({ values: x, name: A }) => {
639
- if (A === h.current || !A) {
640
- const _ = T(x, h.current);
641
- Array.isArray(_) && (a(_), c.current = _.map(He));
642
- }
643
- },
644
- subject: t._subjects.array
645
- });
646
- const m = j.useCallback((x) => {
647
- d.current = !0, t._updateFieldArray(n, x);
648
- }, [t, n]), w = (x, A) => {
649
- const _ = pe(ie(x)), M = fr(t._getFieldArray(n), _);
650
- t._names.focus = ur(n, M.length - 1, A), c.current = fr(c.current, _.map(He)), m(M), a(M), t._updateFieldArray(n, M, fr, {
651
- argA: dr(x)
652
- });
653
- }, v = (x, A) => {
654
- const _ = pe(ie(x)), M = mr(t._getFieldArray(n), _);
655
- t._names.focus = ur(n, 0, A), c.current = mr(c.current, _.map(He)), m(M), a(M), t._updateFieldArray(n, M, mr, {
656
- argA: dr(x)
657
- });
658
- }, p = (x) => {
659
- const A = vr(t._getFieldArray(n), x);
660
- c.current = vr(c.current, x), m(A), a(A), t._updateFieldArray(n, A, vr, {
661
- argA: x
662
- });
663
- }, S = (x, A, _) => {
664
- const M = pe(ie(A)), H = hr(t._getFieldArray(n), x, M);
665
- t._names.focus = ur(n, x, _), c.current = hr(c.current, x, M.map(He)), m(H), a(H), t._updateFieldArray(n, H, hr, {
666
- argA: x,
667
- argB: dr(A)
668
- });
669
- }, b = (x, A) => {
670
- const _ = t._getFieldArray(n);
671
- gr(_, x, A), gr(c.current, x, A), m(_), a(_), t._updateFieldArray(n, _, gr, {
672
- argA: x,
673
- argB: A
674
- }, !1);
675
- }, y = (x, A) => {
676
- const _ = t._getFieldArray(n);
677
- pr(_, x, A), pr(c.current, x, A), m(_), a(_), t._updateFieldArray(n, _, pr, {
678
- argA: x,
679
- argB: A
680
- }, !1);
681
- }, E = (x, A) => {
682
- const _ = ie(A), M = hn(t._getFieldArray(n), x, _);
683
- c.current = [...M].map((H, U) => !H || U === x ? He() : c.current[U]), m(M), a([...M]), t._updateFieldArray(n, M, hn, {
684
- argA: x,
685
- argB: _
686
- }, !0, !1);
687
- }, P = (x) => {
688
- const A = pe(ie(x));
689
- c.current = A.map(He), m([...A]), a([...A]), t._updateFieldArray(n, [...A], (_) => _, {}, !0, !1);
690
- };
691
- return j.useEffect(() => {
692
- if (t._state.action = !1, Fr(n, t._names) && t._subjects.state.next({
693
- ...t._formState
694
- }), d.current && (!At(t._options.mode).isOnSubmit || t._formState.isSubmitted))
695
- if (t._options.resolver)
696
- t._executeSchema([n]).then((x) => {
697
- const A = T(x.errors, n), _ = T(t._formState.errors, n);
698
- (_ ? !A && _.type || A && (_.type !== A.type || _.message !== A.message) : A && A.type) && (A ? G(t._formState.errors, n, A) : ne(t._formState.errors, n), t._subjects.state.next({
699
- errors: t._formState.errors
700
- }));
701
- });
702
- else {
703
- const x = T(t._fields, n);
704
- x && x._f && !(At(t._options.reValidateMode).isOnSubmit && At(t._options.mode).isOnSubmit) && Nr(x, t._formValues, t._options.criteriaMode === be.all, t._options.shouldUseNativeValidation, !0).then((A) => !he(A) && t._subjects.state.next({
705
- errors: Qn(t._formState.errors, A, n)
706
- }));
707
- }
708
- t._subjects.values.next({
709
- name: n,
710
- values: { ...t._formValues }
711
- }), t._names.focus && pt(t._fields, (x, A) => {
712
- if (t._names.focus && A.startsWith(t._names.focus) && x.focus)
713
- return x.focus(), 1;
714
- }), t._names.focus = "", t._updateValid(), d.current = !1;
715
- }, [i, n, t]), j.useEffect(() => (!T(t._formValues, n) && t._updateFieldArray(n), () => {
716
- (t._options.shouldUnregister || s) && t.unregister(n);
717
- }), [n, t, o, s]), {
718
- swap: j.useCallback(b, [m, n, t]),
719
- move: j.useCallback(y, [m, n, t]),
720
- prepend: j.useCallback(v, [m, n, t]),
721
- append: j.useCallback(w, [m, n, t]),
722
- remove: j.useCallback(p, [m, n, t]),
723
- insert: j.useCallback(S, [m, n, t]),
724
- update: j.useCallback(E, [m, n, t]),
725
- replace: j.useCallback(P, [m, n, t]),
726
- fields: j.useMemo(() => i.map((x, A) => ({
727
- ...x,
728
- [o]: c.current[A] || He()
729
- })), [i, o])
730
- };
731
- }
732
- var yr = () => {
733
- let e = [];
734
- return {
735
- get observers() {
736
- return e;
737
- },
738
- next: (o) => {
739
- for (const s of e)
740
- s.next && s.next(o);
741
- },
742
- subscribe: (o) => (e.push(o), {
743
- unsubscribe: () => {
744
- e = e.filter((s) => s !== o);
745
- }
746
- }),
747
- unsubscribe: () => {
748
- e = [];
749
- }
750
- };
751
- }, Kt = (e) => fe(e) || !Un(e);
752
- function Je(e, r) {
753
- if (Kt(e) || Kt(r))
754
- return e === r;
755
- if (ht(e) && ht(r))
756
- return e.getTime() === r.getTime();
757
- const t = Object.keys(e), n = Object.keys(r);
758
- if (t.length !== n.length)
759
- return !1;
760
- for (const o of t) {
761
- const s = e[o];
762
- if (!n.includes(o))
763
- return !1;
764
- if (o !== "ref") {
765
- const i = r[o];
766
- if (ht(s) && ht(i) || ae(s) && ae(i) || Array.isArray(s) && Array.isArray(i) ? !Je(s, i) : s !== i)
767
- return !1;
768
- }
769
- }
770
- return !0;
771
- }
772
- var to = (e) => e.type === "select-multiple", si = (e) => zr(e) || Pt(e), wr = (e) => $t(e) && e.isConnected, ro = (e) => {
773
- for (const r in e)
774
- if (Ke(e[r]))
775
- return !0;
776
- return !1;
777
- };
778
- function Yt(e, r = {}) {
779
- const t = Array.isArray(e);
780
- if (ae(e) || t)
781
- for (const n in e)
782
- Array.isArray(e[n]) || ae(e[n]) && !ro(e[n]) ? (r[n] = Array.isArray(e[n]) ? [] : {}, Yt(e[n], r[n])) : fe(e[n]) || (r[n] = !0);
783
- return r;
784
- }
785
- function no(e, r, t) {
786
- const n = Array.isArray(e);
787
- if (ae(e) || n)
788
- for (const o in e)
789
- Array.isArray(e[o]) || ae(e[o]) && !ro(e[o]) ? Q(r) || Kt(t[o]) ? t[o] = Array.isArray(e[o]) ? Yt(e[o], []) : { ...Yt(e[o]) } : no(e[o], fe(r) ? {} : r[o], t[o]) : t[o] = !Je(e[o], r[o]);
790
- return t;
791
- }
792
- var Nt = (e, r) => no(e, r, Yt(r)), oo = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => Q(e) ? e : r ? e === "" ? NaN : e && +e : t && Pe(e) ? new Date(e) : n ? n(e) : e;
793
- function xr(e) {
794
- const r = e.ref;
795
- if (!(e.refs ? e.refs.every((t) => t.disabled) : r.disabled))
796
- return $r(r) ? r.files : zr(r) ? eo(e.refs).value : to(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Pt(r) ? Jn(e.refs).value : oo(Q(r.value) ? e.ref.value : r.value, e);
797
- }
798
- var ii = (e, r, t, n) => {
799
- const o = {};
800
- for (const s of e) {
801
- const i = T(r, s);
802
- i && G(o, s, i._f);
803
- }
804
- return {
805
- criteriaMode: t,
806
- names: [...e],
807
- fields: o,
808
- shouldUseNativeValidation: n
809
- };
810
- }, Ct = (e) => Q(e) ? e : zt(e) ? e.source : ae(e) ? zt(e.value) ? e.value.source : e.value : e, ai = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
811
- function pn(e, r, t) {
812
- const n = T(e, t);
813
- if (n || Ur(t))
814
- return {
815
- error: n,
816
- name: t
817
- };
818
- const o = t.split(".");
819
- for (; o.length; ) {
820
- const s = o.join("."), i = T(r, s), a = T(e, s);
821
- if (i && !Array.isArray(i) && t !== s)
822
- return { name: t };
823
- if (a && a.type)
824
- return {
825
- name: s,
826
- error: a
827
- };
828
- o.pop();
829
- }
830
- return {
831
- name: t
832
- };
833
- }
834
- var ci = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, li = (e, r) => !Ot(T(e, r)).length && ne(e, r);
835
- const ui = {
836
- mode: be.onSubmit,
837
- reValidateMode: be.onChange,
838
- shouldFocusError: !0
839
- };
840
- function fi(e = {}) {
841
- let r = {
842
- ...ui,
843
- ...e
844
- }, t = {
845
- submitCount: 0,
846
- isDirty: !1,
847
- isLoading: Ke(r.defaultValues),
848
- isValidating: !1,
849
- isSubmitted: !1,
850
- isSubmitting: !1,
851
- isSubmitSuccessful: !1,
852
- isValid: !1,
853
- touchedFields: {},
854
- dirtyFields: {},
855
- validatingFields: {},
856
- errors: r.errors || {},
857
- disabled: r.disabled || !1
858
- }, n = {}, o = ae(r.defaultValues) || ae(r.values) ? ie(r.defaultValues || r.values) || {} : {}, s = r.shouldUnregister ? {} : ie(o), i = {
859
- action: !1,
860
- mount: !1,
861
- watch: !1
862
- }, a = {
863
- mount: /* @__PURE__ */ new Set(),
864
- unMount: /* @__PURE__ */ new Set(),
865
- array: /* @__PURE__ */ new Set(),
866
- watch: /* @__PURE__ */ new Set()
867
- }, c, f = 0;
868
- const h = {
869
- isDirty: !1,
870
- dirtyFields: !1,
871
- validatingFields: !1,
872
- touchedFields: !1,
873
- isValidating: !1,
874
- isValid: !1,
875
- errors: !1
876
- }, d = {
877
- values: yr(),
878
- array: yr(),
879
- state: yr()
880
- }, m = At(r.mode), w = At(r.reValidateMode), v = r.criteriaMode === be.all, p = (u) => (g) => {
881
- clearTimeout(f), f = setTimeout(u, g);
882
- }, S = async (u) => {
883
- if (h.isValid || u) {
884
- const g = r.resolver ? he((await M()).errors) : await U(n, !0);
885
- g !== t.isValid && d.state.next({
886
- isValid: g
887
- });
888
- }
889
- }, b = (u, g) => {
890
- (h.isValidating || h.validatingFields) && ((u || Array.from(a.mount)).forEach((C) => {
891
- C && (g ? G(t.validatingFields, C, g) : ne(t.validatingFields, C));
892
- }), d.state.next({
893
- validatingFields: t.validatingFields,
894
- isValidating: !he(t.validatingFields)
895
- }));
896
- }, y = (u, g = [], C, N, F = !0, O = !0) => {
897
- if (N && C) {
898
- if (i.action = !0, O && Array.isArray(T(n, u))) {
899
- const V = C(T(n, u), N.argA, N.argB);
900
- F && G(n, u, V);
901
- }
902
- if (O && Array.isArray(T(t.errors, u))) {
903
- const V = C(T(t.errors, u), N.argA, N.argB);
904
- F && G(t.errors, u, V), li(t.errors, u);
905
- }
906
- if (h.touchedFields && O && Array.isArray(T(t.touchedFields, u))) {
907
- const V = C(T(t.touchedFields, u), N.argA, N.argB);
908
- F && G(t.touchedFields, u, V);
909
- }
910
- h.dirtyFields && (t.dirtyFields = Nt(o, s)), d.state.next({
911
- name: u,
912
- isDirty: D(u, g),
913
- dirtyFields: t.dirtyFields,
914
- errors: t.errors,
915
- isValid: t.isValid
916
- });
917
- } else
918
- G(s, u, g);
919
- }, E = (u, g) => {
920
- G(t.errors, u, g), d.state.next({
921
- errors: t.errors
922
- });
923
- }, P = (u) => {
924
- t.errors = u, d.state.next({
925
- errors: t.errors,
926
- isValid: !1
927
- });
928
- }, x = (u, g, C, N) => {
929
- const F = T(n, u);
930
- if (F) {
931
- const O = T(s, u, Q(C) ? T(o, u) : C);
932
- Q(O) || N && N.defaultChecked || g ? G(s, u, g ? O : xr(F._f)) : k(u, O), i.mount && S();
933
- }
934
- }, A = (u, g, C, N, F) => {
935
- let O = !1, V = !1;
936
- const Y = {
937
- name: u
938
- }, re = !!(T(n, u) && T(n, u)._f && T(n, u)._f.disabled);
939
- if (!C || N) {
940
- h.isDirty && (V = t.isDirty, t.isDirty = Y.isDirty = D(), O = V !== Y.isDirty);
941
- const ve = re || Je(T(o, u), g);
942
- V = !!(!re && T(t.dirtyFields, u)), ve || re ? ne(t.dirtyFields, u) : G(t.dirtyFields, u, !0), Y.dirtyFields = t.dirtyFields, O = O || h.dirtyFields && V !== !ve;
943
- }
944
- if (C) {
945
- const ve = T(t.touchedFields, u);
946
- ve || (G(t.touchedFields, u, C), Y.touchedFields = t.touchedFields, O = O || h.touchedFields && ve !== C);
947
- }
948
- return O && F && d.state.next(Y), O ? Y : {};
949
- }, _ = (u, g, C, N) => {
950
- const F = T(t.errors, u), O = h.isValid && _e(g) && t.isValid !== g;
951
- if (e.delayError && C ? (c = p(() => E(u, C)), c(e.delayError)) : (clearTimeout(f), c = null, C ? G(t.errors, u, C) : ne(t.errors, u)), (C ? !Je(F, C) : F) || !he(N) || O) {
952
- const V = {
953
- ...N,
954
- ...O && _e(g) ? { isValid: g } : {},
955
- errors: t.errors,
956
- name: u
957
- };
958
- t = {
959
- ...t,
960
- ...V
961
- }, d.state.next(V);
962
- }
963
- }, M = async (u) => {
964
- b(u, !0);
965
- const g = await r.resolver(s, r.context, ii(u || a.mount, n, r.criteriaMode, r.shouldUseNativeValidation));
966
- return b(u), g;
967
- }, H = async (u) => {
968
- const { errors: g } = await M(u);
969
- if (u)
970
- for (const C of u) {
971
- const N = T(g, C);
972
- N ? G(t.errors, C, N) : ne(t.errors, C);
973
- }
974
- else
975
- t.errors = g;
976
- return g;
977
- }, U = async (u, g, C = {
978
- valid: !0
979
- }) => {
980
- for (const N in u) {
981
- const F = u[N];
982
- if (F) {
983
- const { _f: O, ...V } = F;
984
- if (O) {
985
- const Y = a.array.has(O.name);
986
- b([N], !0);
987
- const re = await Nr(F, s, v, r.shouldUseNativeValidation && !g, Y);
988
- if (b([N]), re[O.name] && (C.valid = !1, g))
989
- break;
990
- !g && (T(re, O.name) ? Y ? Qn(t.errors, re, O.name) : G(t.errors, O.name, re[O.name]) : ne(t.errors, O.name));
991
- }
992
- V && await U(V, g, C);
993
- }
994
- }
995
- return C.valid;
996
- }, J = () => {
997
- for (const u of a.unMount) {
998
- const g = T(n, u);
999
- g && (g._f.refs ? g._f.refs.every((C) => !wr(C)) : !wr(g._f.ref)) && Ee(u);
1000
- }
1001
- a.unMount = /* @__PURE__ */ new Set();
1002
- }, D = (u, g) => (u && g && G(s, u, g), !Je(xe(), o)), I = (u, g, C) => Zn(u, a, {
1003
- ...i.mount ? s : Q(g) ? o : Pe(u) ? { [u]: g } : g
1004
- }, C, g), B = (u) => Ot(T(i.mount ? s : o, u, e.shouldUnregister ? T(o, u, []) : [])), k = (u, g, C = {}) => {
1005
- const N = T(n, u);
1006
- let F = g;
1007
- if (N) {
1008
- const O = N._f;
1009
- O && (!O.disabled && G(s, u, oo(g, O)), F = $t(O.ref) && fe(g) ? "" : g, to(O.ref) ? [...O.ref.options].forEach((V) => V.selected = F.includes(V.value)) : O.refs ? Pt(O.ref) ? O.refs.length > 1 ? O.refs.forEach((V) => (!V.defaultChecked || !V.disabled) && (V.checked = Array.isArray(F) ? !!F.find((Y) => Y === V.value) : F === V.value)) : O.refs[0] && (O.refs[0].checked = !!F) : O.refs.forEach((V) => V.checked = V.value === F) : $r(O.ref) ? O.ref.value = "" : (O.ref.value = F, O.ref.type || d.values.next({
1010
- name: u,
1011
- values: { ...s }
1012
- })));
1013
- }
1014
- (C.shouldDirty || C.shouldTouch) && A(u, F, C.shouldTouch, C.shouldDirty, !0), C.shouldValidate && Se(u);
1015
- }, $ = (u, g, C) => {
1016
- for (const N in g) {
1017
- const F = g[N], O = `${u}.${N}`, V = T(n, O);
1018
- (a.array.has(u) || !Kt(F) || V && !V._f) && !ht(F) ? $(O, F, C) : k(O, F, C);
1019
- }
1020
- }, L = (u, g, C = {}) => {
1021
- const N = T(n, u), F = a.array.has(u), O = ie(g);
1022
- G(s, u, O), F ? (d.array.next({
1023
- name: u,
1024
- values: { ...s }
1025
- }), (h.isDirty || h.dirtyFields) && C.shouldDirty && d.state.next({
1026
- name: u,
1027
- dirtyFields: Nt(o, s),
1028
- isDirty: D(u, O)
1029
- })) : N && !N._f && !fe(O) ? $(u, O, C) : k(u, O, C), Fr(u, a) && d.state.next({ ...t }), d.values.next({
1030
- name: i.mount ? u : void 0,
1031
- values: { ...s }
1032
- });
1033
- }, Z = async (u) => {
1034
- i.mount = !0;
1035
- const g = u.target;
1036
- let C = g.name, N = !0;
1037
- const F = T(n, C), O = () => g.type ? xr(F._f) : $n(u), V = (Y) => {
1038
- N = Number.isNaN(Y) || Y === T(s, C, Y);
1039
- };
1040
- if (F) {
1041
- let Y, re;
1042
- const ve = O(), st = u.type === Ut.BLUR || u.type === Ut.FOCUS_OUT, _s = !ai(F._f) && !r.resolver && !T(t.errors, C) && !F._f.deps || ci(st, T(t.touchedFields, C), t.isSubmitted, w, m), ar = Fr(C, a, st);
1043
- G(s, C, ve), st ? (F._f.onBlur && F._f.onBlur(u), c && c(0)) : F._f.onChange && F._f.onChange(u);
1044
- const cr = A(C, ve, st, !1), Rs = !he(cr) || ar;
1045
- if (!st && d.values.next({
1046
- name: C,
1047
- type: u.type,
1048
- values: { ...s }
1049
- }), _s)
1050
- return h.isValid && S(), Rs && d.state.next({ name: C, ...ar ? {} : cr });
1051
- if (!st && ar && d.state.next({ ...t }), r.resolver) {
1052
- const { errors: on } = await M([C]);
1053
- if (V(ve), N) {
1054
- const Ps = pn(t.errors, n, C), sn = pn(on, n, Ps.name || C);
1055
- Y = sn.error, C = sn.name, re = he(on);
1056
- }
1057
- } else
1058
- b([C], !0), Y = (await Nr(F, s, v, r.shouldUseNativeValidation))[C], b([C]), V(ve), N && (Y ? re = !1 : h.isValid && (re = await U(n, !0)));
1059
- N && (F._f.deps && Se(F._f.deps), _(C, re, Y, cr));
1060
- }
1061
- }, ee = (u, g) => {
1062
- if (T(t.errors, g) && u.focus)
1063
- return u.focus(), 1;
1064
- }, Se = async (u, g = {}) => {
1065
- let C, N;
1066
- const F = pe(u);
1067
- if (r.resolver) {
1068
- const O = await H(Q(u) ? u : F);
1069
- C = he(O), N = u ? !F.some((V) => T(O, V)) : C;
1070
- } else u ? (N = (await Promise.all(F.map(async (O) => {
1071
- const V = T(n, O);
1072
- return await U(V && V._f ? { [O]: V } : V);
1073
- }))).every(Boolean), !(!N && !t.isValid) && S()) : N = C = await U(n);
1074
- return d.state.next({
1075
- ...!Pe(u) || h.isValid && C !== t.isValid ? {} : { name: u },
1076
- ...r.resolver || !u ? { isValid: C } : {},
1077
- errors: t.errors
1078
- }), g.shouldFocus && !N && pt(n, ee, u ? F : a.mount), N;
1079
- }, xe = (u) => {
1080
- const g = {
1081
- ...i.mount ? s : o
1082
- };
1083
- return Q(u) ? g : Pe(u) ? T(g, u) : u.map((C) => T(g, C));
1084
- }, Be = (u, g) => ({
1085
- invalid: !!T((g || t).errors, u),
1086
- isDirty: !!T((g || t).dirtyFields, u),
1087
- error: T((g || t).errors, u),
1088
- isValidating: !!T(t.validatingFields, u),
1089
- isTouched: !!T((g || t).touchedFields, u)
1090
- }), Qe = (u) => {
1091
- u && pe(u).forEach((g) => ne(t.errors, g)), d.state.next({
1092
- errors: u ? t.errors : {}
1093
- });
1094
- }, Ce = (u, g, C) => {
1095
- const N = (T(n, u, { _f: {} })._f || {}).ref, F = T(t.errors, u) || {}, { ref: O, message: V, type: Y, ...re } = F;
1096
- G(t.errors, u, {
1097
- ...re,
1098
- ...g,
1099
- ref: N
1100
- }), d.state.next({
1101
- name: u,
1102
- errors: t.errors,
1103
- isValid: !1
1104
- }), C && C.shouldFocus && N && N.focus && N.focus();
1105
- }, We = (u, g) => Ke(u) ? d.values.subscribe({
1106
- next: (C) => u(I(void 0, g), C)
1107
- }) : I(u, g, !0), Ee = (u, g = {}) => {
1108
- for (const C of u ? pe(u) : a.mount)
1109
- a.mount.delete(C), a.array.delete(C), g.keepValue || (ne(n, C), ne(s, C)), !g.keepError && ne(t.errors, C), !g.keepDirty && ne(t.dirtyFields, C), !g.keepTouched && ne(t.touchedFields, C), !g.keepIsValidating && ne(t.validatingFields, C), !r.shouldUnregister && !g.keepDefaultValue && ne(o, C);
1110
- d.values.next({
1111
- values: { ...s }
1112
- }), d.state.next({
1113
- ...t,
1114
- ...g.keepDirty ? { isDirty: D() } : {}
1115
- }), !g.keepIsValid && S();
1116
- }, W = ({ disabled: u, name: g, field: C, fields: N, value: F }) => {
1117
- if (_e(u) && i.mount || u) {
1118
- const O = u ? void 0 : Q(F) ? xr(C ? C._f : T(N, g)._f) : F;
1119
- G(s, g, O), A(g, O, !1, !1, !0);
1120
- }
1121
- }, q = (u, g = {}) => {
1122
- let C = T(n, u);
1123
- const N = _e(g.disabled);
1124
- return G(n, u, {
1125
- ...C || {},
1126
- _f: {
1127
- ...C && C._f ? C._f : { ref: { name: u } },
1128
- name: u,
1129
- mount: !0,
1130
- ...g
1131
- }
1132
- }), a.mount.add(u), C ? W({
1133
- field: C,
1134
- disabled: g.disabled,
1135
- name: u,
1136
- value: g.value
1137
- }) : x(u, !0, g.value), {
1138
- ...N ? { disabled: g.disabled } : {},
1139
- ...r.progressive ? {
1140
- required: !!g.required,
1141
- min: Ct(g.min),
1142
- max: Ct(g.max),
1143
- minLength: Ct(g.minLength),
1144
- maxLength: Ct(g.maxLength),
1145
- pattern: Ct(g.pattern)
1146
- } : {},
1147
- name: u,
1148
- onChange: Z,
1149
- onBlur: Z,
1150
- ref: (F) => {
1151
- if (F) {
1152
- q(u, g), C = T(n, u);
1153
- const O = Q(F.value) && F.querySelectorAll && F.querySelectorAll("input,select,textarea")[0] || F, V = si(O), Y = C._f.refs || [];
1154
- if (V ? Y.find((re) => re === O) : O === C._f.ref)
1155
- return;
1156
- G(n, u, {
1157
- _f: {
1158
- ...C._f,
1159
- ...V ? {
1160
- refs: [
1161
- ...Y.filter(wr),
1162
- O,
1163
- ...Array.isArray(T(o, u)) ? [{}] : []
1164
- ],
1165
- ref: { type: O.type, name: u }
1166
- } : { ref: O }
1167
- }
1168
- }), x(u, !1, void 0, O);
1169
- } else
1170
- C = T(n, u, {}), C._f && (C._f.mount = !1), (r.shouldUnregister || g.shouldUnregister) && !(zn(a.array, u) && i.action) && a.unMount.add(u);
1171
- }
1172
- };
1173
- }, se = () => r.shouldFocusError && pt(n, ee, a.mount), X = (u) => {
1174
- _e(u) && (d.state.next({ disabled: u }), pt(n, (g, C) => {
1175
- const N = T(n, C);
1176
- N && (g.disabled = N._f.disabled || u, Array.isArray(N._f.refs) && N._f.refs.forEach((F) => {
1177
- F.disabled = N._f.disabled || u;
1178
- }));
1179
- }, 0, !1));
1180
- }, z = (u, g) => async (C) => {
1181
- let N;
1182
- C && (C.preventDefault && C.preventDefault(), C.persist && C.persist());
1183
- let F = ie(s);
1184
- if (d.state.next({
1185
- isSubmitting: !0
1186
- }), r.resolver) {
1187
- const { errors: O, values: V } = await M();
1188
- t.errors = O, F = V;
1189
- } else
1190
- await U(n);
1191
- if (ne(t.errors, "root"), he(t.errors)) {
1192
- d.state.next({
1193
- errors: {}
1194
- });
1195
- try {
1196
- await u(F, C);
1197
- } catch (O) {
1198
- N = O;
1199
- }
1200
- } else
1201
- g && await g({ ...t.errors }, C), se(), setTimeout(se);
1202
- if (d.state.next({
1203
- isSubmitted: !0,
1204
- isSubmitting: !1,
1205
- isSubmitSuccessful: he(t.errors) && !N,
1206
- submitCount: t.submitCount + 1,
1207
- errors: t.errors
1208
- }), N)
1209
- throw N;
1210
- }, K = (u, g = {}) => {
1211
- T(n, u) && (Q(g.defaultValue) ? L(u, ie(T(o, u))) : (L(u, g.defaultValue), G(o, u, ie(g.defaultValue))), g.keepTouched || ne(t.touchedFields, u), g.keepDirty || (ne(t.dirtyFields, u), t.isDirty = g.defaultValue ? D(u, ie(T(o, u))) : D()), g.keepError || (ne(t.errors, u), h.isValid && S()), d.state.next({ ...t }));
1212
- }, ue = (u, g = {}) => {
1213
- const C = u ? ie(u) : o, N = ie(C), F = he(u), O = F ? o : N;
1214
- if (g.keepDefaultValues || (o = C), !g.keepValues) {
1215
- if (g.keepDirtyValues)
1216
- for (const V of a.mount)
1217
- T(t.dirtyFields, V) ? G(O, V, T(s, V)) : L(V, T(O, V));
1218
- else {
1219
- if (Hr && Q(u))
1220
- for (const V of a.mount) {
1221
- const Y = T(n, V);
1222
- if (Y && Y._f) {
1223
- const re = Array.isArray(Y._f.refs) ? Y._f.refs[0] : Y._f.ref;
1224
- if ($t(re)) {
1225
- const ve = re.closest("form");
1226
- if (ve) {
1227
- ve.reset();
1228
- break;
1229
- }
1230
- }
1231
- }
1232
- }
1233
- n = {};
1234
- }
1235
- s = e.shouldUnregister ? g.keepDefaultValues ? ie(o) : {} : ie(O), d.array.next({
1236
- values: { ...O }
1237
- }), d.values.next({
1238
- values: { ...O }
1239
- });
1240
- }
1241
- a = {
1242
- mount: g.keepDirtyValues ? a.mount : /* @__PURE__ */ new Set(),
1243
- unMount: /* @__PURE__ */ new Set(),
1244
- array: /* @__PURE__ */ new Set(),
1245
- watch: /* @__PURE__ */ new Set(),
1246
- watchAll: !1,
1247
- focus: ""
1248
- }, i.mount = !h.isValid || !!g.keepIsValid || !!g.keepDirtyValues, i.watch = !!e.shouldUnregister, d.state.next({
1249
- submitCount: g.keepSubmitCount ? t.submitCount : 0,
1250
- isDirty: F ? !1 : g.keepDirty ? t.isDirty : !!(g.keepDefaultValues && !Je(u, o)),
1251
- isSubmitted: g.keepIsSubmitted ? t.isSubmitted : !1,
1252
- dirtyFields: F ? {} : g.keepDirtyValues ? g.keepDefaultValues && s ? Nt(o, s) : t.dirtyFields : g.keepDefaultValues && u ? Nt(o, u) : g.keepDirty ? t.dirtyFields : {},
1253
- touchedFields: g.keepTouched ? t.touchedFields : {},
1254
- errors: g.keepErrors ? t.errors : {},
1255
- isSubmitSuccessful: g.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1256
- isSubmitting: !1
1257
- });
1258
- }, me = (u, g) => ue(Ke(u) ? u(s) : u, g);
1259
- return {
1260
- control: {
1261
- register: q,
1262
- unregister: Ee,
1263
- getFieldState: Be,
1264
- handleSubmit: z,
1265
- setError: Ce,
1266
- _executeSchema: M,
1267
- _getWatch: I,
1268
- _getDirty: D,
1269
- _updateValid: S,
1270
- _removeUnmounted: J,
1271
- _updateFieldArray: y,
1272
- _updateDisabledField: W,
1273
- _getFieldArray: B,
1274
- _reset: ue,
1275
- _resetDefaultValues: () => Ke(r.defaultValues) && r.defaultValues().then((u) => {
1276
- me(u, r.resetOptions), d.state.next({
1277
- isLoading: !1
1278
- });
1279
- }),
1280
- _updateFormState: (u) => {
1281
- t = {
1282
- ...t,
1283
- ...u
1284
- };
1285
- },
1286
- _disableForm: X,
1287
- _subjects: d,
1288
- _proxyFormState: h,
1289
- _setErrors: P,
1290
- get _fields() {
1291
- return n;
1292
- },
1293
- get _formValues() {
1294
- return s;
1295
- },
1296
- get _state() {
1297
- return i;
1298
- },
1299
- set _state(u) {
1300
- i = u;
1301
- },
1302
- get _defaultValues() {
1303
- return o;
1304
- },
1305
- get _names() {
1306
- return a;
1307
- },
1308
- set _names(u) {
1309
- a = u;
1310
- },
1311
- get _formState() {
1312
- return t;
1313
- },
1314
- set _formState(u) {
1315
- t = u;
1316
- },
1317
- get _options() {
1318
- return r;
1319
- },
1320
- set _options(u) {
1321
- r = {
1322
- ...r,
1323
- ...u
1324
- };
1325
- }
1326
- },
1327
- trigger: Se,
1328
- register: q,
1329
- handleSubmit: z,
1330
- watch: We,
1331
- setValue: L,
1332
- getValues: xe,
1333
- reset: me,
1334
- resetField: K,
1335
- clearErrors: Qe,
1336
- unregister: Ee,
1337
- setError: Ce,
1338
- setFocus: (u, g = {}) => {
1339
- const C = T(n, u), N = C && C._f;
1340
- if (N) {
1341
- const F = N.refs ? N.refs[0] : N.ref;
1342
- F.focus && (F.focus(), g.shouldSelect && F.select());
1343
- }
1344
- },
1345
- getFieldState: Be
1346
- };
1347
- }
1348
- function wl(e = {}) {
1349
- const r = j.useRef(), t = j.useRef(), [n, o] = j.useState({
1350
- isDirty: !1,
1351
- isValidating: !1,
1352
- isLoading: Ke(e.defaultValues),
1353
- isSubmitted: !1,
1354
- isSubmitting: !1,
1355
- isSubmitSuccessful: !1,
1356
- isValid: !1,
1357
- submitCount: 0,
1358
- dirtyFields: {},
1359
- touchedFields: {},
1360
- validatingFields: {},
1361
- errors: e.errors || {},
1362
- disabled: e.disabled || !1,
1363
- defaultValues: Ke(e.defaultValues) ? void 0 : e.defaultValues
1364
- });
1365
- r.current || (r.current = {
1366
- ...fi(e),
1367
- formState: n
1368
- });
1369
- const s = r.current.control;
1370
- return s._options = e, tr({
1371
- subject: s._subjects.state,
1372
- next: (i) => {
1373
- Xn(i, s._proxyFormState, s._updateFormState, !0) && o({ ...s._formState });
1374
- }
1375
- }), j.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), j.useEffect(() => {
1376
- if (s._proxyFormState.isDirty) {
1377
- const i = s._getDirty();
1378
- i !== n.isDirty && s._subjects.state.next({
1379
- isDirty: i
1380
- });
1381
- }
1382
- }, [s, n.isDirty]), j.useEffect(() => {
1383
- e.values && !Je(e.values, t.current) ? (s._reset(e.values, s._options.resetOptions), t.current = e.values, o((i) => ({ ...i }))) : s._resetDefaultValues();
1384
- }, [e.values, s]), j.useEffect(() => {
1385
- e.errors && s._setErrors(e.errors);
1386
- }, [e.errors, s]), j.useEffect(() => {
1387
- s._state.mount || (s._updateValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
1388
- }), j.useEffect(() => {
1389
- e.shouldUnregister && s._subjects.values.next({
1390
- values: s._getWatch()
1391
- });
1392
- }, [e.shouldUnregister, s]), r.current.formState = qn(n, s), r.current;
1393
- }
1394
- function mn(e, [r, t]) {
1395
- return Math.min(t, Math.max(r, e));
1396
- }
1397
- function ce(e, r, { checkForDefaultPrevented: t = !0 } = {}) {
1398
- return function(o) {
1399
- if (e == null || e(o), t === !1 || !o.defaultPrevented)
1400
- return r == null ? void 0 : r(o);
1401
- };
1402
- }
1403
- function xl(e, r) {
1404
- const t = l.createContext(r);
1405
- function n(s) {
1406
- const { children: i, ...a } = s, c = l.useMemo(() => a, Object.values(a));
1407
- return /* @__PURE__ */ R.jsx(t.Provider, { value: c, children: i });
1408
- }
1409
- function o(s) {
1410
- const i = l.useContext(t);
1411
- if (i) return i;
1412
- if (r !== void 0) return r;
1413
- throw new Error(`\`${s}\` must be used within \`${e}\``);
1414
- }
1415
- return n.displayName = e + "Provider", [n, o];
1416
- }
1417
- function Kr(e, r = []) {
1418
- let t = [];
1419
- function n(s, i) {
1420
- const a = l.createContext(i), c = t.length;
1421
- t = [...t, i];
1422
- function f(d) {
1423
- const { scope: m, children: w, ...v } = d, p = (m == null ? void 0 : m[e][c]) || a, S = l.useMemo(() => v, Object.values(v));
1424
- return /* @__PURE__ */ R.jsx(p.Provider, { value: S, children: w });
1425
- }
1426
- function h(d, m) {
1427
- const w = (m == null ? void 0 : m[e][c]) || a, v = l.useContext(w);
1428
- if (v) return v;
1429
- if (i !== void 0) return i;
1430
- throw new Error(`\`${d}\` must be used within \`${s}\``);
1431
- }
1432
- return f.displayName = s + "Provider", [f, h];
1433
- }
1434
- const o = () => {
1435
- const s = t.map((i) => l.createContext(i));
1436
- return function(a) {
1437
- const c = (a == null ? void 0 : a[e]) || s;
1438
- return l.useMemo(
1439
- () => ({ [`__scope${e}`]: { ...a, [e]: c } }),
1440
- [a, c]
1441
- );
1442
- };
1443
- };
1444
- return o.scopeName = e, [n, di(o, ...r)];
1445
- }
1446
- function di(...e) {
1447
- const r = e[0];
1448
- if (e.length === 1) return r;
1449
- const t = () => {
1450
- const n = e.map((o) => ({
1451
- useScope: o(),
1452
- scopeName: o.scopeName
1453
- }));
1454
- return function(s) {
1455
- const i = n.reduce((a, { useScope: c, scopeName: f }) => {
1456
- const d = c(s)[`__scope${f}`];
1457
- return { ...a, ...d };
1458
- }, {});
1459
- return l.useMemo(() => ({ [`__scope${r.scopeName}`]: i }), [i]);
1460
- };
1461
- };
1462
- return t.scopeName = r.scopeName, t;
1463
- }
1464
- function hi(e) {
1465
- const r = e + "CollectionProvider", [t, n] = Kr(r), [o, s] = t(
1466
- r,
1467
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
1468
- ), i = (w) => {
1469
- const { scope: v, children: p } = w, S = j.useRef(null), b = j.useRef(/* @__PURE__ */ new Map()).current;
1470
- return /* @__PURE__ */ R.jsx(o, { scope: v, itemMap: b, collectionRef: S, children: p });
1471
- };
1472
- i.displayName = r;
1473
- const a = e + "CollectionSlot", c = j.forwardRef(
1474
- (w, v) => {
1475
- const { scope: p, children: S } = w, b = s(a, p), y = le(v, b.collectionRef);
1476
- return /* @__PURE__ */ R.jsx(gt, { ref: y, children: S });
1477
- }
1478
- );
1479
- c.displayName = a;
1480
- const f = e + "CollectionItemSlot", h = "data-radix-collection-item", d = j.forwardRef(
1481
- (w, v) => {
1482
- const { scope: p, children: S, ...b } = w, y = j.useRef(null), E = le(v, y), P = s(f, p);
1483
- return j.useEffect(() => (P.itemMap.set(y, { ref: y, ...b }), () => void P.itemMap.delete(y))), /* @__PURE__ */ R.jsx(gt, { [h]: "", ref: E, children: S });
1484
- }
1485
- );
1486
- d.displayName = f;
1487
- function m(w) {
1488
- const v = s(e + "CollectionConsumer", w);
1489
- return j.useCallback(() => {
1490
- const S = v.collectionRef.current;
1491
- if (!S) return [];
1492
- const b = Array.from(S.querySelectorAll(`[${h}]`));
1493
- return Array.from(v.itemMap.values()).sort(
1494
- (P, x) => b.indexOf(P.ref.current) - b.indexOf(x.ref.current)
1495
- );
1496
- }, [v.collectionRef, v.itemMap]);
1497
- }
1498
- return [
1499
- { Provider: i, Slot: c, ItemSlot: d },
1500
- m,
1501
- n
1502
- ];
1503
- }
1504
- var pi = l.createContext(void 0);
1505
- function mi(e) {
1506
- const r = l.useContext(pi);
1507
- return e || r || "ltr";
1508
- }
1509
- var vi = [
1510
- "a",
1511
- "button",
1512
- "div",
1513
- "form",
1514
- "h2",
1515
- "h3",
1516
- "img",
1517
- "input",
1518
- "label",
1519
- "li",
1520
- "nav",
1521
- "ol",
1522
- "p",
1523
- "span",
1524
- "svg",
1525
- "ul"
1526
- ], oe = vi.reduce((e, r) => {
1527
- const t = l.forwardRef((n, o) => {
1528
- const { asChild: s, ...i } = n, a = s ? gt : r;
1529
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ R.jsx(a, { ...i, ref: o });
1530
- });
1531
- return t.displayName = `Primitive.${r}`, { ...e, [r]: t };
1532
- }, {});
1533
- function gi(e, r) {
1534
- e && Jt.flushSync(() => e.dispatchEvent(r));
1535
- }
1536
- function Ie(e) {
1537
- const r = l.useRef(e);
1538
- return l.useEffect(() => {
1539
- r.current = e;
1540
- }), l.useMemo(() => (...t) => {
1541
- var n;
1542
- return (n = r.current) == null ? void 0 : n.call(r, ...t);
1543
- }, []);
1544
- }
1545
- function yi(e, r = globalThis == null ? void 0 : globalThis.document) {
1546
- const t = Ie(e);
1547
- l.useEffect(() => {
1548
- const n = (o) => {
1549
- o.key === "Escape" && t(o);
1550
- };
1551
- return r.addEventListener("keydown", n, { capture: !0 }), () => r.removeEventListener("keydown", n, { capture: !0 });
1552
- }, [t, r]);
1553
- }
1554
- var wi = "DismissableLayer", Dr = "dismissableLayer.update", xi = "dismissableLayer.pointerDownOutside", bi = "dismissableLayer.focusOutside", vn, so = l.createContext({
1555
- layers: /* @__PURE__ */ new Set(),
1556
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
1557
- branches: /* @__PURE__ */ new Set()
1558
- }), io = l.forwardRef(
1559
- (e, r) => {
1560
- const {
1561
- disableOutsidePointerEvents: t = !1,
1562
- onEscapeKeyDown: n,
1563
- onPointerDownOutside: o,
1564
- onFocusOutside: s,
1565
- onInteractOutside: i,
1566
- onDismiss: a,
1567
- ...c
1568
- } = e, f = l.useContext(so), [h, d] = l.useState(null), m = (h == null ? void 0 : h.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, w] = l.useState({}), v = le(r, (_) => d(_)), p = Array.from(f.layers), [S] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), b = p.indexOf(S), y = h ? p.indexOf(h) : -1, E = f.layersWithOutsidePointerEventsDisabled.size > 0, P = y >= b, x = Ei((_) => {
1569
- const M = _.target, H = [...f.branches].some((U) => U.contains(M));
1570
- !P || H || (o == null || o(_), i == null || i(_), _.defaultPrevented || a == null || a());
1571
- }, m), A = Ai((_) => {
1572
- const M = _.target;
1573
- [...f.branches].some((U) => U.contains(M)) || (s == null || s(_), i == null || i(_), _.defaultPrevented || a == null || a());
1574
- }, m);
1575
- return yi((_) => {
1576
- y === f.layers.size - 1 && (n == null || n(_), !_.defaultPrevented && a && (_.preventDefault(), a()));
1577
- }, m), l.useEffect(() => {
1578
- if (h)
1579
- return t && (f.layersWithOutsidePointerEventsDisabled.size === 0 && (vn = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), f.layersWithOutsidePointerEventsDisabled.add(h)), f.layers.add(h), gn(), () => {
1580
- t && f.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = vn);
1581
- };
1582
- }, [h, m, t, f]), l.useEffect(() => () => {
1583
- h && (f.layers.delete(h), f.layersWithOutsidePointerEventsDisabled.delete(h), gn());
1584
- }, [h, f]), l.useEffect(() => {
1585
- const _ = () => w({});
1586
- return document.addEventListener(Dr, _), () => document.removeEventListener(Dr, _);
1587
- }, []), /* @__PURE__ */ R.jsx(
1588
- oe.div,
1589
- {
1590
- ...c,
1591
- ref: v,
1592
- style: {
1593
- pointerEvents: E ? P ? "auto" : "none" : void 0,
1594
- ...e.style
1595
- },
1596
- onFocusCapture: ce(e.onFocusCapture, A.onFocusCapture),
1597
- onBlurCapture: ce(e.onBlurCapture, A.onBlurCapture),
1598
- onPointerDownCapture: ce(
1599
- e.onPointerDownCapture,
1600
- x.onPointerDownCapture
1601
- )
1602
- }
1603
- );
1604
- }
1605
- );
1606
- io.displayName = wi;
1607
- var Si = "DismissableLayerBranch", Ci = l.forwardRef((e, r) => {
1608
- const t = l.useContext(so), n = l.useRef(null), o = le(r, n);
1609
- return l.useEffect(() => {
1610
- const s = n.current;
1611
- if (s)
1612
- return t.branches.add(s), () => {
1613
- t.branches.delete(s);
1614
- };
1615
- }, [t.branches]), /* @__PURE__ */ R.jsx(oe.div, { ...e, ref: o });
1616
- });
1617
- Ci.displayName = Si;
1618
- function Ei(e, r = globalThis == null ? void 0 : globalThis.document) {
1619
- const t = Ie(e), n = l.useRef(!1), o = l.useRef(() => {
1620
- });
1621
- return l.useEffect(() => {
1622
- const s = (a) => {
1623
- if (a.target && !n.current) {
1624
- let c = function() {
1625
- ao(
1626
- xi,
1627
- t,
1628
- f,
1629
- { discrete: !0 }
1630
- );
1631
- };
1632
- const f = { originalEvent: a };
1633
- a.pointerType === "touch" ? (r.removeEventListener("click", o.current), o.current = c, r.addEventListener("click", o.current, { once: !0 })) : c();
1634
- } else
1635
- r.removeEventListener("click", o.current);
1636
- n.current = !1;
1637
- }, i = window.setTimeout(() => {
1638
- r.addEventListener("pointerdown", s);
1639
- }, 0);
1640
- return () => {
1641
- window.clearTimeout(i), r.removeEventListener("pointerdown", s), r.removeEventListener("click", o.current);
1642
- };
1643
- }, [r, t]), {
1644
- // ensures we check React component tree (not just DOM tree)
1645
- onPointerDownCapture: () => n.current = !0
1646
- };
1647
- }
1648
- function Ai(e, r = globalThis == null ? void 0 : globalThis.document) {
1649
- const t = Ie(e), n = l.useRef(!1);
1650
- return l.useEffect(() => {
1651
- const o = (s) => {
1652
- s.target && !n.current && ao(bi, t, { originalEvent: s }, {
1653
- discrete: !1
1654
- });
1655
- };
1656
- return r.addEventListener("focusin", o), () => r.removeEventListener("focusin", o);
1657
- }, [r, t]), {
1658
- onFocusCapture: () => n.current = !0,
1659
- onBlurCapture: () => n.current = !1
1660
- };
1661
- }
1662
- function gn() {
1663
- const e = new CustomEvent(Dr);
1664
- document.dispatchEvent(e);
1665
- }
1666
- function ao(e, r, t, { discrete: n }) {
1667
- const o = t.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: t });
1668
- r && o.addEventListener(e, r, { once: !0 }), n ? gi(o, s) : o.dispatchEvent(s);
1669
- }
1670
- var br = 0;
1671
- function _i() {
1672
- l.useEffect(() => {
1673
- const e = document.querySelectorAll("[data-radix-focus-guard]");
1674
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? yn()), document.body.insertAdjacentElement("beforeend", e[1] ?? yn()), br++, () => {
1675
- br === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((r) => r.remove()), br--;
1676
- };
1677
- }, []);
1678
- }
1679
- function yn() {
1680
- const e = document.createElement("span");
1681
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
1682
- }
1683
- var Sr = "focusScope.autoFocusOnMount", Cr = "focusScope.autoFocusOnUnmount", wn = { bubbles: !1, cancelable: !0 }, Ri = "FocusScope", co = l.forwardRef((e, r) => {
1684
- const {
1685
- loop: t = !1,
1686
- trapped: n = !1,
1687
- onMountAutoFocus: o,
1688
- onUnmountAutoFocus: s,
1689
- ...i
1690
- } = e, [a, c] = l.useState(null), f = Ie(o), h = Ie(s), d = l.useRef(null), m = le(r, (p) => c(p)), w = l.useRef({
1691
- paused: !1,
1692
- pause() {
1693
- this.paused = !0;
1694
- },
1695
- resume() {
1696
- this.paused = !1;
1697
- }
1698
- }).current;
1699
- l.useEffect(() => {
1700
- if (n) {
1701
- let p = function(E) {
1702
- if (w.paused || !a) return;
1703
- const P = E.target;
1704
- a.contains(P) ? d.current = P : Ue(d.current, { select: !0 });
1705
- }, S = function(E) {
1706
- if (w.paused || !a) return;
1707
- const P = E.relatedTarget;
1708
- P !== null && (a.contains(P) || Ue(d.current, { select: !0 }));
1709
- }, b = function(E) {
1710
- if (document.activeElement === document.body)
1711
- for (const x of E)
1712
- x.removedNodes.length > 0 && Ue(a);
1713
- };
1714
- document.addEventListener("focusin", p), document.addEventListener("focusout", S);
1715
- const y = new MutationObserver(b);
1716
- return a && y.observe(a, { childList: !0, subtree: !0 }), () => {
1717
- document.removeEventListener("focusin", p), document.removeEventListener("focusout", S), y.disconnect();
1718
- };
1719
- }
1720
- }, [n, a, w.paused]), l.useEffect(() => {
1721
- if (a) {
1722
- bn.add(w);
1723
- const p = document.activeElement;
1724
- if (!a.contains(p)) {
1725
- const b = new CustomEvent(Sr, wn);
1726
- a.addEventListener(Sr, f), a.dispatchEvent(b), b.defaultPrevented || (Pi(Di(lo(a)), { select: !0 }), document.activeElement === p && Ue(a));
1727
- }
1728
- return () => {
1729
- a.removeEventListener(Sr, f), setTimeout(() => {
1730
- const b = new CustomEvent(Cr, wn);
1731
- a.addEventListener(Cr, h), a.dispatchEvent(b), b.defaultPrevented || Ue(p ?? document.body, { select: !0 }), a.removeEventListener(Cr, h), bn.remove(w);
1732
- }, 0);
1733
- };
1734
- }
1735
- }, [a, f, h, w]);
1736
- const v = l.useCallback(
1737
- (p) => {
1738
- if (!t && !n || w.paused) return;
1739
- const S = p.key === "Tab" && !p.altKey && !p.ctrlKey && !p.metaKey, b = document.activeElement;
1740
- if (S && b) {
1741
- const y = p.currentTarget, [E, P] = Oi(y);
1742
- E && P ? !p.shiftKey && b === P ? (p.preventDefault(), t && Ue(E, { select: !0 })) : p.shiftKey && b === E && (p.preventDefault(), t && Ue(P, { select: !0 })) : b === y && p.preventDefault();
1743
- }
1744
- },
1745
- [t, n, w.paused]
1746
- );
1747
- return /* @__PURE__ */ R.jsx(oe.div, { tabIndex: -1, ...i, ref: m, onKeyDown: v });
1748
- });
1749
- co.displayName = Ri;
1750
- function Pi(e, { select: r = !1 } = {}) {
1751
- const t = document.activeElement;
1752
- for (const n of e)
1753
- if (Ue(n, { select: r }), document.activeElement !== t) return;
1754
- }
1755
- function Oi(e) {
1756
- const r = lo(e), t = xn(r, e), n = xn(r.reverse(), e);
1757
- return [t, n];
1758
- }
1759
- function lo(e) {
1760
- const r = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
1761
- acceptNode: (n) => {
1762
- const o = n.tagName === "INPUT" && n.type === "hidden";
1763
- return n.disabled || n.hidden || o ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1764
- }
1765
- });
1766
- for (; t.nextNode(); ) r.push(t.currentNode);
1767
- return r;
1768
- }
1769
- function xn(e, r) {
1770
- for (const t of e)
1771
- if (!Ti(t, { upTo: r })) return t;
1772
- }
1773
- function Ti(e, { upTo: r }) {
1774
- if (getComputedStyle(e).visibility === "hidden") return !0;
1775
- for (; e; ) {
1776
- if (r !== void 0 && e === r) return !1;
1777
- if (getComputedStyle(e).display === "none") return !0;
1778
- e = e.parentElement;
1779
- }
1780
- return !1;
1781
- }
1782
- function Fi(e) {
1783
- return e instanceof HTMLInputElement && "select" in e;
1784
- }
1785
- function Ue(e, { select: r = !1 } = {}) {
1786
- if (e && e.focus) {
1787
- const t = document.activeElement;
1788
- e.focus({ preventScroll: !0 }), e !== t && Fi(e) && r && e.select();
1789
- }
1790
- }
1791
- var bn = Ni();
1792
- function Ni() {
1793
- let e = [];
1794
- return {
1795
- add(r) {
1796
- const t = e[0];
1797
- r !== t && (t == null || t.pause()), e = Sn(e, r), e.unshift(r);
1798
- },
1799
- remove(r) {
1800
- var t;
1801
- e = Sn(e, r), (t = e[0]) == null || t.resume();
1802
- }
1803
- };
1804
- }
1805
- function Sn(e, r) {
1806
- const t = [...e], n = t.indexOf(r);
1807
- return n !== -1 && t.splice(n, 1), t;
1808
- }
1809
- function Di(e) {
1810
- return e.filter((r) => r.tagName !== "A");
1811
- }
1812
- var we = globalThis != null && globalThis.document ? l.useLayoutEffect : () => {
1813
- }, Mi = l.useId || (() => {
1814
- }), Vi = 0;
1815
- function Yr(e) {
1816
- const [r, t] = l.useState(Mi());
1817
- return we(() => {
1818
- t((n) => n ?? String(Vi++));
1819
- }, [e]), r ? `radix-${r}` : "";
1820
- }
1821
- const Ii = ["top", "right", "bottom", "left"], Ye = Math.min, ge = Math.max, qt = Math.round, Dt = Math.floor, qe = (e) => ({
1822
- x: e,
1823
- y: e
1824
- }), ki = {
1825
- left: "right",
1826
- right: "left",
1827
- bottom: "top",
1828
- top: "bottom"
1829
- }, Li = {
1830
- start: "end",
1831
- end: "start"
1832
- };
1833
- function Mr(e, r, t) {
1834
- return ge(e, Ye(r, t));
1835
- }
1836
- function ke(e, r) {
1837
- return typeof e == "function" ? e(r) : e;
1838
- }
1839
- function Le(e) {
1840
- return e.split("-")[0];
1841
- }
1842
- function wt(e) {
1843
- return e.split("-")[1];
1844
- }
1845
- function qr(e) {
1846
- return e === "x" ? "y" : "x";
1847
- }
1848
- function Xr(e) {
1849
- return e === "y" ? "height" : "width";
1850
- }
1851
- function xt(e) {
1852
- return ["top", "bottom"].includes(Le(e)) ? "y" : "x";
1853
- }
1854
- function Gr(e) {
1855
- return qr(xt(e));
1856
- }
1857
- function ji(e, r, t) {
1858
- t === void 0 && (t = !1);
1859
- const n = wt(e), o = Gr(e), s = Xr(o);
1860
- let i = o === "x" ? n === (t ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
1861
- return r.reference[s] > r.floating[s] && (i = Xt(i)), [i, Xt(i)];
1862
- }
1863
- function Bi(e) {
1864
- const r = Xt(e);
1865
- return [Vr(e), r, Vr(r)];
1866
- }
1867
- function Vr(e) {
1868
- return e.replace(/start|end/g, (r) => Li[r]);
1869
- }
1870
- function Wi(e, r, t) {
1871
- const n = ["left", "right"], o = ["right", "left"], s = ["top", "bottom"], i = ["bottom", "top"];
1872
- switch (e) {
1873
- case "top":
1874
- case "bottom":
1875
- return t ? r ? o : n : r ? n : o;
1876
- case "left":
1877
- case "right":
1878
- return r ? s : i;
1879
- default:
1880
- return [];
1881
- }
1882
- }
1883
- function Hi(e, r, t, n) {
1884
- const o = wt(e);
1885
- let s = Wi(Le(e), t === "start", n);
1886
- return o && (s = s.map((i) => i + "-" + o), r && (s = s.concat(s.map(Vr)))), s;
1887
- }
1888
- function Xt(e) {
1889
- return e.replace(/left|right|bottom|top/g, (r) => ki[r]);
1890
- }
1891
- function Ui(e) {
1892
- return {
1893
- top: 0,
1894
- right: 0,
1895
- bottom: 0,
1896
- left: 0,
1897
- ...e
1898
- };
1899
- }
1900
- function uo(e) {
1901
- return typeof e != "number" ? Ui(e) : {
1902
- top: e,
1903
- right: e,
1904
- bottom: e,
1905
- left: e
1906
- };
1907
- }
1908
- function Gt(e) {
1909
- const {
1910
- x: r,
1911
- y: t,
1912
- width: n,
1913
- height: o
1914
- } = e;
1915
- return {
1916
- width: n,
1917
- height: o,
1918
- top: t,
1919
- left: r,
1920
- right: r + n,
1921
- bottom: t + o,
1922
- x: r,
1923
- y: t
1924
- };
1925
- }
1926
- function Cn(e, r, t) {
1927
- let {
1928
- reference: n,
1929
- floating: o
1930
- } = e;
1931
- const s = xt(r), i = Gr(r), a = Xr(i), c = Le(r), f = s === "y", h = n.x + n.width / 2 - o.width / 2, d = n.y + n.height / 2 - o.height / 2, m = n[a] / 2 - o[a] / 2;
1932
- let w;
1933
- switch (c) {
1934
- case "top":
1935
- w = {
1936
- x: h,
1937
- y: n.y - o.height
1938
- };
1939
- break;
1940
- case "bottom":
1941
- w = {
1942
- x: h,
1943
- y: n.y + n.height
1944
- };
1945
- break;
1946
- case "right":
1947
- w = {
1948
- x: n.x + n.width,
1949
- y: d
1950
- };
1951
- break;
1952
- case "left":
1953
- w = {
1954
- x: n.x - o.width,
1955
- y: d
1956
- };
1957
- break;
1958
- default:
1959
- w = {
1960
- x: n.x,
1961
- y: n.y
1962
- };
1963
- }
1964
- switch (wt(r)) {
1965
- case "start":
1966
- w[i] -= m * (t && f ? -1 : 1);
1967
- break;
1968
- case "end":
1969
- w[i] += m * (t && f ? -1 : 1);
1970
- break;
1971
- }
1972
- return w;
1973
- }
1974
- const $i = async (e, r, t) => {
1975
- const {
1976
- placement: n = "bottom",
1977
- strategy: o = "absolute",
1978
- middleware: s = [],
1979
- platform: i
1980
- } = t, a = s.filter(Boolean), c = await (i.isRTL == null ? void 0 : i.isRTL(r));
1981
- let f = await i.getElementRects({
1982
- reference: e,
1983
- floating: r,
1984
- strategy: o
1985
- }), {
1986
- x: h,
1987
- y: d
1988
- } = Cn(f, n, c), m = n, w = {}, v = 0;
1989
- for (let p = 0; p < a.length; p++) {
1990
- const {
1991
- name: S,
1992
- fn: b
1993
- } = a[p], {
1994
- x: y,
1995
- y: E,
1996
- data: P,
1997
- reset: x
1998
- } = await b({
1999
- x: h,
2000
- y: d,
2001
- initialPlacement: n,
2002
- placement: m,
2003
- strategy: o,
2004
- middlewareData: w,
2005
- rects: f,
2006
- platform: i,
2007
- elements: {
2008
- reference: e,
2009
- floating: r
2010
- }
2011
- });
2012
- h = y ?? h, d = E ?? d, w = {
2013
- ...w,
2014
- [S]: {
2015
- ...w[S],
2016
- ...P
2017
- }
2018
- }, x && v <= 50 && (v++, typeof x == "object" && (x.placement && (m = x.placement), x.rects && (f = x.rects === !0 ? await i.getElementRects({
2019
- reference: e,
2020
- floating: r,
2021
- strategy: o
2022
- }) : x.rects), {
2023
- x: h,
2024
- y: d
2025
- } = Cn(f, m, c)), p = -1);
2026
- }
2027
- return {
2028
- x: h,
2029
- y: d,
2030
- placement: m,
2031
- strategy: o,
2032
- middlewareData: w
2033
- };
2034
- };
2035
- async function _t(e, r) {
2036
- var t;
2037
- r === void 0 && (r = {});
2038
- const {
2039
- x: n,
2040
- y: o,
2041
- platform: s,
2042
- rects: i,
2043
- elements: a,
2044
- strategy: c
2045
- } = e, {
2046
- boundary: f = "clippingAncestors",
2047
- rootBoundary: h = "viewport",
2048
- elementContext: d = "floating",
2049
- altBoundary: m = !1,
2050
- padding: w = 0
2051
- } = ke(r, e), v = uo(w), S = a[m ? d === "floating" ? "reference" : "floating" : d], b = Gt(await s.getClippingRect({
2052
- element: (t = await (s.isElement == null ? void 0 : s.isElement(S))) == null || t ? S : S.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(a.floating)),
2053
- boundary: f,
2054
- rootBoundary: h,
2055
- strategy: c
2056
- })), y = d === "floating" ? {
2057
- x: n,
2058
- y: o,
2059
- width: i.floating.width,
2060
- height: i.floating.height
2061
- } : i.reference, E = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), P = await (s.isElement == null ? void 0 : s.isElement(E)) ? await (s.getScale == null ? void 0 : s.getScale(E)) || {
2062
- x: 1,
2063
- y: 1
2064
- } : {
2065
- x: 1,
2066
- y: 1
2067
- }, x = Gt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
2068
- elements: a,
2069
- rect: y,
2070
- offsetParent: E,
2071
- strategy: c
2072
- }) : y);
2073
- return {
2074
- top: (b.top - x.top + v.top) / P.y,
2075
- bottom: (x.bottom - b.bottom + v.bottom) / P.y,
2076
- left: (b.left - x.left + v.left) / P.x,
2077
- right: (x.right - b.right + v.right) / P.x
2078
- };
2079
- }
2080
- const zi = (e) => ({
2081
- name: "arrow",
2082
- options: e,
2083
- async fn(r) {
2084
- const {
2085
- x: t,
2086
- y: n,
2087
- placement: o,
2088
- rects: s,
2089
- platform: i,
2090
- elements: a,
2091
- middlewareData: c
2092
- } = r, {
2093
- element: f,
2094
- padding: h = 0
2095
- } = ke(e, r) || {};
2096
- if (f == null)
2097
- return {};
2098
- const d = uo(h), m = {
2099
- x: t,
2100
- y: n
2101
- }, w = Gr(o), v = Xr(w), p = await i.getDimensions(f), S = w === "y", b = S ? "top" : "left", y = S ? "bottom" : "right", E = S ? "clientHeight" : "clientWidth", P = s.reference[v] + s.reference[w] - m[w] - s.floating[v], x = m[w] - s.reference[w], A = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(f));
2102
- let _ = A ? A[E] : 0;
2103
- (!_ || !await (i.isElement == null ? void 0 : i.isElement(A))) && (_ = a.floating[E] || s.floating[v]);
2104
- const M = P / 2 - x / 2, H = _ / 2 - p[v] / 2 - 1, U = Ye(d[b], H), J = Ye(d[y], H), D = U, I = _ - p[v] - J, B = _ / 2 - p[v] / 2 + M, k = Mr(D, B, I), $ = !c.arrow && wt(o) != null && B !== k && s.reference[v] / 2 - (B < D ? U : J) - p[v] / 2 < 0, L = $ ? B < D ? B - D : B - I : 0;
2105
- return {
2106
- [w]: m[w] + L,
2107
- data: {
2108
- [w]: k,
2109
- centerOffset: B - k - L,
2110
- ...$ && {
2111
- alignmentOffset: L
2112
- }
2113
- },
2114
- reset: $
2115
- };
2116
- }
2117
- }), Ki = function(e) {
2118
- return e === void 0 && (e = {}), {
2119
- name: "flip",
2120
- options: e,
2121
- async fn(r) {
2122
- var t, n;
2123
- const {
2124
- placement: o,
2125
- middlewareData: s,
2126
- rects: i,
2127
- initialPlacement: a,
2128
- platform: c,
2129
- elements: f
2130
- } = r, {
2131
- mainAxis: h = !0,
2132
- crossAxis: d = !0,
2133
- fallbackPlacements: m,
2134
- fallbackStrategy: w = "bestFit",
2135
- fallbackAxisSideDirection: v = "none",
2136
- flipAlignment: p = !0,
2137
- ...S
2138
- } = ke(e, r);
2139
- if ((t = s.arrow) != null && t.alignmentOffset)
2140
- return {};
2141
- const b = Le(o), y = Le(a) === a, E = await (c.isRTL == null ? void 0 : c.isRTL(f.floating)), P = m || (y || !p ? [Xt(a)] : Bi(a));
2142
- !m && v !== "none" && P.push(...Hi(a, p, v, E));
2143
- const x = [a, ...P], A = await _t(r, S), _ = [];
2144
- let M = ((n = s.flip) == null ? void 0 : n.overflows) || [];
2145
- if (h && _.push(A[b]), d) {
2146
- const D = ji(o, i, E);
2147
- _.push(A[D[0]], A[D[1]]);
2148
- }
2149
- if (M = [...M, {
2150
- placement: o,
2151
- overflows: _
2152
- }], !_.every((D) => D <= 0)) {
2153
- var H, U;
2154
- const D = (((H = s.flip) == null ? void 0 : H.index) || 0) + 1, I = x[D];
2155
- if (I)
2156
- return {
2157
- data: {
2158
- index: D,
2159
- overflows: M
2160
- },
2161
- reset: {
2162
- placement: I
2163
- }
2164
- };
2165
- let B = (U = M.filter((k) => k.overflows[0] <= 0).sort((k, $) => k.overflows[1] - $.overflows[1])[0]) == null ? void 0 : U.placement;
2166
- if (!B)
2167
- switch (w) {
2168
- case "bestFit": {
2169
- var J;
2170
- const k = (J = M.map(($) => [$.placement, $.overflows.filter((L) => L > 0).reduce((L, Z) => L + Z, 0)]).sort(($, L) => $[1] - L[1])[0]) == null ? void 0 : J[0];
2171
- k && (B = k);
2172
- break;
2173
- }
2174
- case "initialPlacement":
2175
- B = a;
2176
- break;
2177
- }
2178
- if (o !== B)
2179
- return {
2180
- reset: {
2181
- placement: B
2182
- }
2183
- };
2184
- }
2185
- return {};
2186
- }
2187
- };
2188
- };
2189
- function En(e, r) {
2190
- return {
2191
- top: e.top - r.height,
2192
- right: e.right - r.width,
2193
- bottom: e.bottom - r.height,
2194
- left: e.left - r.width
2195
- };
2196
- }
2197
- function An(e) {
2198
- return Ii.some((r) => e[r] >= 0);
2199
- }
2200
- const Yi = function(e) {
2201
- return e === void 0 && (e = {}), {
2202
- name: "hide",
2203
- options: e,
2204
- async fn(r) {
2205
- const {
2206
- rects: t
2207
- } = r, {
2208
- strategy: n = "referenceHidden",
2209
- ...o
2210
- } = ke(e, r);
2211
- switch (n) {
2212
- case "referenceHidden": {
2213
- const s = await _t(r, {
2214
- ...o,
2215
- elementContext: "reference"
2216
- }), i = En(s, t.reference);
2217
- return {
2218
- data: {
2219
- referenceHiddenOffsets: i,
2220
- referenceHidden: An(i)
2221
- }
2222
- };
2223
- }
2224
- case "escaped": {
2225
- const s = await _t(r, {
2226
- ...o,
2227
- altBoundary: !0
2228
- }), i = En(s, t.floating);
2229
- return {
2230
- data: {
2231
- escapedOffsets: i,
2232
- escaped: An(i)
2233
- }
2234
- };
2235
- }
2236
- default:
2237
- return {};
2238
- }
2239
- }
2240
- };
2241
- };
2242
- async function qi(e, r) {
2243
- const {
2244
- placement: t,
2245
- platform: n,
2246
- elements: o
2247
- } = e, s = await (n.isRTL == null ? void 0 : n.isRTL(o.floating)), i = Le(t), a = wt(t), c = xt(t) === "y", f = ["left", "top"].includes(i) ? -1 : 1, h = s && c ? -1 : 1, d = ke(r, e);
2248
- let {
2249
- mainAxis: m,
2250
- crossAxis: w,
2251
- alignmentAxis: v
2252
- } = typeof d == "number" ? {
2253
- mainAxis: d,
2254
- crossAxis: 0,
2255
- alignmentAxis: null
2256
- } : {
2257
- mainAxis: 0,
2258
- crossAxis: 0,
2259
- alignmentAxis: null,
2260
- ...d
2261
- };
2262
- return a && typeof v == "number" && (w = a === "end" ? v * -1 : v), c ? {
2263
- x: w * h,
2264
- y: m * f
2265
- } : {
2266
- x: m * f,
2267
- y: w * h
2268
- };
2269
- }
2270
- const Xi = function(e) {
2271
- return e === void 0 && (e = 0), {
2272
- name: "offset",
2273
- options: e,
2274
- async fn(r) {
2275
- var t, n;
2276
- const {
2277
- x: o,
2278
- y: s,
2279
- placement: i,
2280
- middlewareData: a
2281
- } = r, c = await qi(r, e);
2282
- return i === ((t = a.offset) == null ? void 0 : t.placement) && (n = a.arrow) != null && n.alignmentOffset ? {} : {
2283
- x: o + c.x,
2284
- y: s + c.y,
2285
- data: {
2286
- ...c,
2287
- placement: i
2288
- }
2289
- };
2290
- }
2291
- };
2292
- }, Gi = function(e) {
2293
- return e === void 0 && (e = {}), {
2294
- name: "shift",
2295
- options: e,
2296
- async fn(r) {
2297
- const {
2298
- x: t,
2299
- y: n,
2300
- placement: o
2301
- } = r, {
2302
- mainAxis: s = !0,
2303
- crossAxis: i = !1,
2304
- limiter: a = {
2305
- fn: (S) => {
2306
- let {
2307
- x: b,
2308
- y
2309
- } = S;
2310
- return {
2311
- x: b,
2312
- y
2313
- };
2314
- }
2315
- },
2316
- ...c
2317
- } = ke(e, r), f = {
2318
- x: t,
2319
- y: n
2320
- }, h = await _t(r, c), d = xt(Le(o)), m = qr(d);
2321
- let w = f[m], v = f[d];
2322
- if (s) {
2323
- const S = m === "y" ? "top" : "left", b = m === "y" ? "bottom" : "right", y = w + h[S], E = w - h[b];
2324
- w = Mr(y, w, E);
2325
- }
2326
- if (i) {
2327
- const S = d === "y" ? "top" : "left", b = d === "y" ? "bottom" : "right", y = v + h[S], E = v - h[b];
2328
- v = Mr(y, v, E);
2329
- }
2330
- const p = a.fn({
2331
- ...r,
2332
- [m]: w,
2333
- [d]: v
2334
- });
2335
- return {
2336
- ...p,
2337
- data: {
2338
- x: p.x - t,
2339
- y: p.y - n
2340
- }
2341
- };
2342
- }
2343
- };
2344
- }, Zi = function(e) {
2345
- return e === void 0 && (e = {}), {
2346
- options: e,
2347
- fn(r) {
2348
- const {
2349
- x: t,
2350
- y: n,
2351
- placement: o,
2352
- rects: s,
2353
- middlewareData: i
2354
- } = r, {
2355
- offset: a = 0,
2356
- mainAxis: c = !0,
2357
- crossAxis: f = !0
2358
- } = ke(e, r), h = {
2359
- x: t,
2360
- y: n
2361
- }, d = xt(o), m = qr(d);
2362
- let w = h[m], v = h[d];
2363
- const p = ke(a, r), S = typeof p == "number" ? {
2364
- mainAxis: p,
2365
- crossAxis: 0
2366
- } : {
2367
- mainAxis: 0,
2368
- crossAxis: 0,
2369
- ...p
2370
- };
2371
- if (c) {
2372
- const E = m === "y" ? "height" : "width", P = s.reference[m] - s.floating[E] + S.mainAxis, x = s.reference[m] + s.reference[E] - S.mainAxis;
2373
- w < P ? w = P : w > x && (w = x);
2374
- }
2375
- if (f) {
2376
- var b, y;
2377
- const E = m === "y" ? "width" : "height", P = ["top", "left"].includes(Le(o)), x = s.reference[d] - s.floating[E] + (P && ((b = i.offset) == null ? void 0 : b[d]) || 0) + (P ? 0 : S.crossAxis), A = s.reference[d] + s.reference[E] + (P ? 0 : ((y = i.offset) == null ? void 0 : y[d]) || 0) - (P ? S.crossAxis : 0);
2378
- v < x ? v = x : v > A && (v = A);
2379
- }
2380
- return {
2381
- [m]: w,
2382
- [d]: v
2383
- };
2384
- }
2385
- };
2386
- }, Qi = function(e) {
2387
- return e === void 0 && (e = {}), {
2388
- name: "size",
2389
- options: e,
2390
- async fn(r) {
2391
- const {
2392
- placement: t,
2393
- rects: n,
2394
- platform: o,
2395
- elements: s
2396
- } = r, {
2397
- apply: i = () => {
2398
- },
2399
- ...a
2400
- } = ke(e, r), c = await _t(r, a), f = Le(t), h = wt(t), d = xt(t) === "y", {
2401
- width: m,
2402
- height: w
2403
- } = n.floating;
2404
- let v, p;
2405
- f === "top" || f === "bottom" ? (v = f, p = h === (await (o.isRTL == null ? void 0 : o.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (p = f, v = h === "end" ? "top" : "bottom");
2406
- const S = w - c[v], b = m - c[p], y = !r.middlewareData.shift;
2407
- let E = S, P = b;
2408
- if (d) {
2409
- const A = m - c.left - c.right;
2410
- P = h || y ? Ye(b, A) : A;
2411
- } else {
2412
- const A = w - c.top - c.bottom;
2413
- E = h || y ? Ye(S, A) : A;
2414
- }
2415
- if (y && !h) {
2416
- const A = ge(c.left, 0), _ = ge(c.right, 0), M = ge(c.top, 0), H = ge(c.bottom, 0);
2417
- d ? P = m - 2 * (A !== 0 || _ !== 0 ? A + _ : ge(c.left, c.right)) : E = w - 2 * (M !== 0 || H !== 0 ? M + H : ge(c.top, c.bottom));
2418
- }
2419
- await i({
2420
- ...r,
2421
- availableWidth: P,
2422
- availableHeight: E
2423
- });
2424
- const x = await o.getDimensions(s.floating);
2425
- return m !== x.width || w !== x.height ? {
2426
- reset: {
2427
- rects: !0
2428
- }
2429
- } : {};
2430
- }
2431
- };
2432
- };
2433
- function bt(e) {
2434
- return fo(e) ? (e.nodeName || "").toLowerCase() : "#document";
2435
- }
2436
- function ye(e) {
2437
- var r;
2438
- return (e == null || (r = e.ownerDocument) == null ? void 0 : r.defaultView) || window;
2439
- }
2440
- function je(e) {
2441
- var r;
2442
- return (r = (fo(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : r.documentElement;
2443
- }
2444
- function fo(e) {
2445
- return e instanceof Node || e instanceof ye(e).Node;
2446
- }
2447
- function Oe(e) {
2448
- return e instanceof Element || e instanceof ye(e).Element;
2449
- }
2450
- function Te(e) {
2451
- return e instanceof HTMLElement || e instanceof ye(e).HTMLElement;
2452
- }
2453
- function _n(e) {
2454
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ye(e).ShadowRoot;
2455
- }
2456
- function Tt(e) {
2457
- const {
2458
- overflow: r,
2459
- overflowX: t,
2460
- overflowY: n,
2461
- display: o
2462
- } = Ae(e);
2463
- return /auto|scroll|overlay|hidden|clip/.test(r + n + t) && !["inline", "contents"].includes(o);
2464
- }
2465
- function Ji(e) {
2466
- return ["table", "td", "th"].includes(bt(e));
2467
- }
2468
- function Zr(e) {
2469
- const r = Qr(), t = Ae(e);
2470
- return t.transform !== "none" || t.perspective !== "none" || (t.containerType ? t.containerType !== "normal" : !1) || !r && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !r && (t.filter ? t.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((n) => (t.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (t.contain || "").includes(n));
2471
- }
2472
- function ea(e) {
2473
- let r = Xe(e);
2474
- for (; Te(r) && !yt(r); ) {
2475
- if (Zr(r))
2476
- return r;
2477
- r = Xe(r);
2478
- }
2479
- return null;
2480
- }
2481
- function Qr() {
2482
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
2483
- }
2484
- function yt(e) {
2485
- return ["html", "body", "#document"].includes(bt(e));
2486
- }
2487
- function Ae(e) {
2488
- return ye(e).getComputedStyle(e);
2489
- }
2490
- function rr(e) {
2491
- return Oe(e) ? {
2492
- scrollLeft: e.scrollLeft,
2493
- scrollTop: e.scrollTop
2494
- } : {
2495
- scrollLeft: e.pageXOffset,
2496
- scrollTop: e.pageYOffset
2497
- };
2498
- }
2499
- function Xe(e) {
2500
- if (bt(e) === "html")
2501
- return e;
2502
- const r = (
2503
- // Step into the shadow DOM of the parent of a slotted node.
2504
- e.assignedSlot || // DOM Element detected.
2505
- e.parentNode || // ShadowRoot detected.
2506
- _n(e) && e.host || // Fallback.
2507
- je(e)
2508
- );
2509
- return _n(r) ? r.host : r;
2510
- }
2511
- function ho(e) {
2512
- const r = Xe(e);
2513
- return yt(r) ? e.ownerDocument ? e.ownerDocument.body : e.body : Te(r) && Tt(r) ? r : ho(r);
2514
- }
2515
- function Rt(e, r, t) {
2516
- var n;
2517
- r === void 0 && (r = []), t === void 0 && (t = !0);
2518
- const o = ho(e), s = o === ((n = e.ownerDocument) == null ? void 0 : n.body), i = ye(o);
2519
- return s ? r.concat(i, i.visualViewport || [], Tt(o) ? o : [], i.frameElement && t ? Rt(i.frameElement) : []) : r.concat(o, Rt(o, [], t));
2520
- }
2521
- function po(e) {
2522
- const r = Ae(e);
2523
- let t = parseFloat(r.width) || 0, n = parseFloat(r.height) || 0;
2524
- const o = Te(e), s = o ? e.offsetWidth : t, i = o ? e.offsetHeight : n, a = qt(t) !== s || qt(n) !== i;
2525
- return a && (t = s, n = i), {
2526
- width: t,
2527
- height: n,
2528
- $: a
2529
- };
2530
- }
2531
- function Jr(e) {
2532
- return Oe(e) ? e : e.contextElement;
2533
- }
2534
- function mt(e) {
2535
- const r = Jr(e);
2536
- if (!Te(r))
2537
- return qe(1);
2538
- const t = r.getBoundingClientRect(), {
2539
- width: n,
2540
- height: o,
2541
- $: s
2542
- } = po(r);
2543
- let i = (s ? qt(t.width) : t.width) / n, a = (s ? qt(t.height) : t.height) / o;
2544
- return (!i || !Number.isFinite(i)) && (i = 1), (!a || !Number.isFinite(a)) && (a = 1), {
2545
- x: i,
2546
- y: a
2547
- };
2548
- }
2549
- const ta = /* @__PURE__ */ qe(0);
2550
- function mo(e) {
2551
- const r = ye(e);
2552
- return !Qr() || !r.visualViewport ? ta : {
2553
- x: r.visualViewport.offsetLeft,
2554
- y: r.visualViewport.offsetTop
2555
- };
2556
- }
2557
- function ra(e, r, t) {
2558
- return r === void 0 && (r = !1), !t || r && t !== ye(e) ? !1 : r;
2559
- }
2560
- function et(e, r, t, n) {
2561
- r === void 0 && (r = !1), t === void 0 && (t = !1);
2562
- const o = e.getBoundingClientRect(), s = Jr(e);
2563
- let i = qe(1);
2564
- r && (n ? Oe(n) && (i = mt(n)) : i = mt(e));
2565
- const a = ra(s, t, n) ? mo(s) : qe(0);
2566
- let c = (o.left + a.x) / i.x, f = (o.top + a.y) / i.y, h = o.width / i.x, d = o.height / i.y;
2567
- if (s) {
2568
- const m = ye(s), w = n && Oe(n) ? ye(n) : n;
2569
- let v = m, p = v.frameElement;
2570
- for (; p && n && w !== v; ) {
2571
- const S = mt(p), b = p.getBoundingClientRect(), y = Ae(p), E = b.left + (p.clientLeft + parseFloat(y.paddingLeft)) * S.x, P = b.top + (p.clientTop + parseFloat(y.paddingTop)) * S.y;
2572
- c *= S.x, f *= S.y, h *= S.x, d *= S.y, c += E, f += P, v = ye(p), p = v.frameElement;
2573
- }
2574
- }
2575
- return Gt({
2576
- width: h,
2577
- height: d,
2578
- x: c,
2579
- y: f
2580
- });
2581
- }
2582
- const na = [":popover-open", ":modal"];
2583
- function en(e) {
2584
- return na.some((r) => {
2585
- try {
2586
- return e.matches(r);
2587
- } catch {
2588
- return !1;
2589
- }
2590
- });
2591
- }
2592
- function oa(e) {
2593
- let {
2594
- elements: r,
2595
- rect: t,
2596
- offsetParent: n,
2597
- strategy: o
2598
- } = e;
2599
- const s = o === "fixed", i = je(n), a = r ? en(r.floating) : !1;
2600
- if (n === i || a && s)
2601
- return t;
2602
- let c = {
2603
- scrollLeft: 0,
2604
- scrollTop: 0
2605
- }, f = qe(1);
2606
- const h = qe(0), d = Te(n);
2607
- if ((d || !d && !s) && ((bt(n) !== "body" || Tt(i)) && (c = rr(n)), Te(n))) {
2608
- const m = et(n);
2609
- f = mt(n), h.x = m.x + n.clientLeft, h.y = m.y + n.clientTop;
2610
- }
2611
- return {
2612
- width: t.width * f.x,
2613
- height: t.height * f.y,
2614
- x: t.x * f.x - c.scrollLeft * f.x + h.x,
2615
- y: t.y * f.y - c.scrollTop * f.y + h.y
2616
- };
2617
- }
2618
- function sa(e) {
2619
- return Array.from(e.getClientRects());
2620
- }
2621
- function vo(e) {
2622
- return et(je(e)).left + rr(e).scrollLeft;
2623
- }
2624
- function ia(e) {
2625
- const r = je(e), t = rr(e), n = e.ownerDocument.body, o = ge(r.scrollWidth, r.clientWidth, n.scrollWidth, n.clientWidth), s = ge(r.scrollHeight, r.clientHeight, n.scrollHeight, n.clientHeight);
2626
- let i = -t.scrollLeft + vo(e);
2627
- const a = -t.scrollTop;
2628
- return Ae(n).direction === "rtl" && (i += ge(r.clientWidth, n.clientWidth) - o), {
2629
- width: o,
2630
- height: s,
2631
- x: i,
2632
- y: a
2633
- };
2634
- }
2635
- function aa(e, r) {
2636
- const t = ye(e), n = je(e), o = t.visualViewport;
2637
- let s = n.clientWidth, i = n.clientHeight, a = 0, c = 0;
2638
- if (o) {
2639
- s = o.width, i = o.height;
2640
- const f = Qr();
2641
- (!f || f && r === "fixed") && (a = o.offsetLeft, c = o.offsetTop);
2642
- }
2643
- return {
2644
- width: s,
2645
- height: i,
2646
- x: a,
2647
- y: c
2648
- };
2649
- }
2650
- function ca(e, r) {
2651
- const t = et(e, !0, r === "fixed"), n = t.top + e.clientTop, o = t.left + e.clientLeft, s = Te(e) ? mt(e) : qe(1), i = e.clientWidth * s.x, a = e.clientHeight * s.y, c = o * s.x, f = n * s.y;
2652
- return {
2653
- width: i,
2654
- height: a,
2655
- x: c,
2656
- y: f
2657
- };
2658
- }
2659
- function Rn(e, r, t) {
2660
- let n;
2661
- if (r === "viewport")
2662
- n = aa(e, t);
2663
- else if (r === "document")
2664
- n = ia(je(e));
2665
- else if (Oe(r))
2666
- n = ca(r, t);
2667
- else {
2668
- const o = mo(e);
2669
- n = {
2670
- ...r,
2671
- x: r.x - o.x,
2672
- y: r.y - o.y
2673
- };
2674
- }
2675
- return Gt(n);
2676
- }
2677
- function go(e, r) {
2678
- const t = Xe(e);
2679
- return t === r || !Oe(t) || yt(t) ? !1 : Ae(t).position === "fixed" || go(t, r);
2680
- }
2681
- function la(e, r) {
2682
- const t = r.get(e);
2683
- if (t)
2684
- return t;
2685
- let n = Rt(e, [], !1).filter((a) => Oe(a) && bt(a) !== "body"), o = null;
2686
- const s = Ae(e).position === "fixed";
2687
- let i = s ? Xe(e) : e;
2688
- for (; Oe(i) && !yt(i); ) {
2689
- const a = Ae(i), c = Zr(i);
2690
- !c && a.position === "fixed" && (o = null), (s ? !c && !o : !c && a.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || Tt(i) && !c && go(e, i)) ? n = n.filter((h) => h !== i) : o = a, i = Xe(i);
2691
- }
2692
- return r.set(e, n), n;
2693
- }
2694
- function ua(e) {
2695
- let {
2696
- element: r,
2697
- boundary: t,
2698
- rootBoundary: n,
2699
- strategy: o
2700
- } = e;
2701
- const i = [...t === "clippingAncestors" ? en(r) ? [] : la(r, this._c) : [].concat(t), n], a = i[0], c = i.reduce((f, h) => {
2702
- const d = Rn(r, h, o);
2703
- return f.top = ge(d.top, f.top), f.right = Ye(d.right, f.right), f.bottom = Ye(d.bottom, f.bottom), f.left = ge(d.left, f.left), f;
2704
- }, Rn(r, a, o));
2705
- return {
2706
- width: c.right - c.left,
2707
- height: c.bottom - c.top,
2708
- x: c.left,
2709
- y: c.top
2710
- };
2711
- }
2712
- function fa(e) {
2713
- const {
2714
- width: r,
2715
- height: t
2716
- } = po(e);
2717
- return {
2718
- width: r,
2719
- height: t
2720
- };
2721
- }
2722
- function da(e, r, t) {
2723
- const n = Te(r), o = je(r), s = t === "fixed", i = et(e, !0, s, r);
2724
- let a = {
2725
- scrollLeft: 0,
2726
- scrollTop: 0
2727
- };
2728
- const c = qe(0);
2729
- if (n || !n && !s)
2730
- if ((bt(r) !== "body" || Tt(o)) && (a = rr(r)), n) {
2731
- const d = et(r, !0, s, r);
2732
- c.x = d.x + r.clientLeft, c.y = d.y + r.clientTop;
2733
- } else o && (c.x = vo(o));
2734
- const f = i.left + a.scrollLeft - c.x, h = i.top + a.scrollTop - c.y;
2735
- return {
2736
- x: f,
2737
- y: h,
2738
- width: i.width,
2739
- height: i.height
2740
- };
2741
- }
2742
- function Er(e) {
2743
- return Ae(e).position === "static";
2744
- }
2745
- function Pn(e, r) {
2746
- return !Te(e) || Ae(e).position === "fixed" ? null : r ? r(e) : e.offsetParent;
2747
- }
2748
- function yo(e, r) {
2749
- const t = ye(e);
2750
- if (en(e))
2751
- return t;
2752
- if (!Te(e)) {
2753
- let o = Xe(e);
2754
- for (; o && !yt(o); ) {
2755
- if (Oe(o) && !Er(o))
2756
- return o;
2757
- o = Xe(o);
2758
- }
2759
- return t;
2760
- }
2761
- let n = Pn(e, r);
2762
- for (; n && Ji(n) && Er(n); )
2763
- n = Pn(n, r);
2764
- return n && yt(n) && Er(n) && !Zr(n) ? t : n || ea(e) || t;
2765
- }
2766
- const ha = async function(e) {
2767
- const r = this.getOffsetParent || yo, t = this.getDimensions, n = await t(e.floating);
2768
- return {
2769
- reference: da(e.reference, await r(e.floating), e.strategy),
2770
- floating: {
2771
- x: 0,
2772
- y: 0,
2773
- width: n.width,
2774
- height: n.height
2775
- }
2776
- };
2777
- };
2778
- function pa(e) {
2779
- return Ae(e).direction === "rtl";
2780
- }
2781
- const ma = {
2782
- convertOffsetParentRelativeRectToViewportRelativeRect: oa,
2783
- getDocumentElement: je,
2784
- getClippingRect: ua,
2785
- getOffsetParent: yo,
2786
- getElementRects: ha,
2787
- getClientRects: sa,
2788
- getDimensions: fa,
2789
- getScale: mt,
2790
- isElement: Oe,
2791
- isRTL: pa
2792
- };
2793
- function va(e, r) {
2794
- let t = null, n;
2795
- const o = je(e);
2796
- function s() {
2797
- var a;
2798
- clearTimeout(n), (a = t) == null || a.disconnect(), t = null;
2799
- }
2800
- function i(a, c) {
2801
- a === void 0 && (a = !1), c === void 0 && (c = 1), s();
2802
- const {
2803
- left: f,
2804
- top: h,
2805
- width: d,
2806
- height: m
2807
- } = e.getBoundingClientRect();
2808
- if (a || r(), !d || !m)
2809
- return;
2810
- const w = Dt(h), v = Dt(o.clientWidth - (f + d)), p = Dt(o.clientHeight - (h + m)), S = Dt(f), y = {
2811
- rootMargin: -w + "px " + -v + "px " + -p + "px " + -S + "px",
2812
- threshold: ge(0, Ye(1, c)) || 1
2813
- };
2814
- let E = !0;
2815
- function P(x) {
2816
- const A = x[0].intersectionRatio;
2817
- if (A !== c) {
2818
- if (!E)
2819
- return i();
2820
- A ? i(!1, A) : n = setTimeout(() => {
2821
- i(!1, 1e-7);
2822
- }, 1e3);
2823
- }
2824
- E = !1;
2825
- }
2826
- try {
2827
- t = new IntersectionObserver(P, {
2828
- ...y,
2829
- // Handle <iframe>s
2830
- root: o.ownerDocument
2831
- });
2832
- } catch {
2833
- t = new IntersectionObserver(P, y);
2834
- }
2835
- t.observe(e);
2836
- }
2837
- return i(!0), s;
2838
- }
2839
- function ga(e, r, t, n) {
2840
- n === void 0 && (n = {});
2841
- const {
2842
- ancestorScroll: o = !0,
2843
- ancestorResize: s = !0,
2844
- elementResize: i = typeof ResizeObserver == "function",
2845
- layoutShift: a = typeof IntersectionObserver == "function",
2846
- animationFrame: c = !1
2847
- } = n, f = Jr(e), h = o || s ? [...f ? Rt(f) : [], ...Rt(r)] : [];
2848
- h.forEach((b) => {
2849
- o && b.addEventListener("scroll", t, {
2850
- passive: !0
2851
- }), s && b.addEventListener("resize", t);
2852
- });
2853
- const d = f && a ? va(f, t) : null;
2854
- let m = -1, w = null;
2855
- i && (w = new ResizeObserver((b) => {
2856
- let [y] = b;
2857
- y && y.target === f && w && (w.unobserve(r), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
2858
- var E;
2859
- (E = w) == null || E.observe(r);
2860
- })), t();
2861
- }), f && !c && w.observe(f), w.observe(r));
2862
- let v, p = c ? et(e) : null;
2863
- c && S();
2864
- function S() {
2865
- const b = et(e);
2866
- p && (b.x !== p.x || b.y !== p.y || b.width !== p.width || b.height !== p.height) && t(), p = b, v = requestAnimationFrame(S);
2867
- }
2868
- return t(), () => {
2869
- var b;
2870
- h.forEach((y) => {
2871
- o && y.removeEventListener("scroll", t), s && y.removeEventListener("resize", t);
2872
- }), d == null || d(), (b = w) == null || b.disconnect(), w = null, c && cancelAnimationFrame(v);
2873
- };
2874
- }
2875
- const ya = Xi, wa = Gi, xa = Ki, ba = Qi, Sa = Yi, On = zi, Ca = Zi, Ea = (e, r, t) => {
2876
- const n = /* @__PURE__ */ new Map(), o = {
2877
- platform: ma,
2878
- ...t
2879
- }, s = {
2880
- ...o.platform,
2881
- _c: n
2882
- };
2883
- return $i(e, r, {
2884
- ...o,
2885
- platform: s
2886
- });
2887
- }, Aa = (e) => {
2888
- function r(t) {
2889
- return {}.hasOwnProperty.call(t, "current");
2890
- }
2891
- return {
2892
- name: "arrow",
2893
- options: e,
2894
- fn(t) {
2895
- const {
2896
- element: n,
2897
- padding: o
2898
- } = typeof e == "function" ? e(t) : e;
2899
- return n && r(n) ? n.current != null ? On({
2900
- element: n.current,
2901
- padding: o
2902
- }).fn(t) : {} : n ? On({
2903
- element: n,
2904
- padding: o
2905
- }).fn(t) : {};
2906
- }
2907
- };
2908
- };
2909
- var Bt = typeof document < "u" ? Os : Ts;
2910
- function Zt(e, r) {
2911
- if (e === r)
2912
- return !0;
2913
- if (typeof e != typeof r)
2914
- return !1;
2915
- if (typeof e == "function" && e.toString() === r.toString())
2916
- return !0;
2917
- let t, n, o;
2918
- if (e && r && typeof e == "object") {
2919
- if (Array.isArray(e)) {
2920
- if (t = e.length, t !== r.length) return !1;
2921
- for (n = t; n-- !== 0; )
2922
- if (!Zt(e[n], r[n]))
2923
- return !1;
2924
- return !0;
2925
- }
2926
- if (o = Object.keys(e), t = o.length, t !== Object.keys(r).length)
2927
- return !1;
2928
- for (n = t; n-- !== 0; )
2929
- if (!{}.hasOwnProperty.call(r, o[n]))
2930
- return !1;
2931
- for (n = t; n-- !== 0; ) {
2932
- const s = o[n];
2933
- if (!(s === "_owner" && e.$$typeof) && !Zt(e[s], r[s]))
2934
- return !1;
2935
- }
2936
- return !0;
2937
- }
2938
- return e !== e && r !== r;
2939
- }
2940
- function wo(e) {
2941
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
2942
- }
2943
- function Tn(e, r) {
2944
- const t = wo(e);
2945
- return Math.round(r * t) / t;
2946
- }
2947
- function Fn(e) {
2948
- const r = l.useRef(e);
2949
- return Bt(() => {
2950
- r.current = e;
2951
- }), r;
2952
- }
2953
- function _a(e) {
2954
- e === void 0 && (e = {});
2955
- const {
2956
- placement: r = "bottom",
2957
- strategy: t = "absolute",
2958
- middleware: n = [],
2959
- platform: o,
2960
- elements: {
2961
- reference: s,
2962
- floating: i
2963
- } = {},
2964
- transform: a = !0,
2965
- whileElementsMounted: c,
2966
- open: f
2967
- } = e, [h, d] = l.useState({
2968
- x: 0,
2969
- y: 0,
2970
- strategy: t,
2971
- placement: r,
2972
- middlewareData: {},
2973
- isPositioned: !1
2974
- }), [m, w] = l.useState(n);
2975
- Zt(m, n) || w(n);
2976
- const [v, p] = l.useState(null), [S, b] = l.useState(null), y = l.useCallback((L) => {
2977
- L !== A.current && (A.current = L, p(L));
2978
- }, []), E = l.useCallback((L) => {
2979
- L !== _.current && (_.current = L, b(L));
2980
- }, []), P = s || v, x = i || S, A = l.useRef(null), _ = l.useRef(null), M = l.useRef(h), H = c != null, U = Fn(c), J = Fn(o), D = l.useCallback(() => {
2981
- if (!A.current || !_.current)
2982
- return;
2983
- const L = {
2984
- placement: r,
2985
- strategy: t,
2986
- middleware: m
2987
- };
2988
- J.current && (L.platform = J.current), Ea(A.current, _.current, L).then((Z) => {
2989
- const ee = {
2990
- ...Z,
2991
- isPositioned: !0
2992
- };
2993
- I.current && !Zt(M.current, ee) && (M.current = ee, Jt.flushSync(() => {
2994
- d(ee);
2995
- }));
2996
- });
2997
- }, [m, r, t, J]);
2998
- Bt(() => {
2999
- f === !1 && M.current.isPositioned && (M.current.isPositioned = !1, d((L) => ({
3000
- ...L,
3001
- isPositioned: !1
3002
- })));
3003
- }, [f]);
3004
- const I = l.useRef(!1);
3005
- Bt(() => (I.current = !0, () => {
3006
- I.current = !1;
3007
- }), []), Bt(() => {
3008
- if (P && (A.current = P), x && (_.current = x), P && x) {
3009
- if (U.current)
3010
- return U.current(P, x, D);
3011
- D();
3012
- }
3013
- }, [P, x, D, U, H]);
3014
- const B = l.useMemo(() => ({
3015
- reference: A,
3016
- floating: _,
3017
- setReference: y,
3018
- setFloating: E
3019
- }), [y, E]), k = l.useMemo(() => ({
3020
- reference: P,
3021
- floating: x
3022
- }), [P, x]), $ = l.useMemo(() => {
3023
- const L = {
3024
- position: t,
3025
- left: 0,
3026
- top: 0
3027
- };
3028
- if (!k.floating)
3029
- return L;
3030
- const Z = Tn(k.floating, h.x), ee = Tn(k.floating, h.y);
3031
- return a ? {
3032
- ...L,
3033
- transform: "translate(" + Z + "px, " + ee + "px)",
3034
- ...wo(k.floating) >= 1.5 && {
3035
- willChange: "transform"
3036
- }
3037
- } : {
3038
- position: t,
3039
- left: Z,
3040
- top: ee
3041
- };
3042
- }, [t, a, k.floating, h.x, h.y]);
3043
- return l.useMemo(() => ({
3044
- ...h,
3045
- update: D,
3046
- refs: B,
3047
- elements: k,
3048
- floatingStyles: $
3049
- }), [h, D, B, k, $]);
3050
- }
3051
- var Ra = "Arrow", xo = l.forwardRef((e, r) => {
3052
- const { children: t, width: n = 10, height: o = 5, ...s } = e;
3053
- return /* @__PURE__ */ R.jsx(
3054
- oe.svg,
3055
- {
3056
- ...s,
3057
- ref: r,
3058
- width: n,
3059
- height: o,
3060
- viewBox: "0 0 30 10",
3061
- preserveAspectRatio: "none",
3062
- children: e.asChild ? t : /* @__PURE__ */ R.jsx("polygon", { points: "0,0 30,0 15,10" })
3063
- }
3064
- );
3065
- });
3066
- xo.displayName = Ra;
3067
- var Pa = xo;
3068
- function Oa(e) {
3069
- const [r, t] = l.useState(void 0);
3070
- return we(() => {
3071
- if (e) {
3072
- t({ width: e.offsetWidth, height: e.offsetHeight });
3073
- const n = new ResizeObserver((o) => {
3074
- if (!Array.isArray(o) || !o.length)
3075
- return;
3076
- const s = o[0];
3077
- let i, a;
3078
- if ("borderBoxSize" in s) {
3079
- const c = s.borderBoxSize, f = Array.isArray(c) ? c[0] : c;
3080
- i = f.inlineSize, a = f.blockSize;
3081
- } else
3082
- i = e.offsetWidth, a = e.offsetHeight;
3083
- t({ width: i, height: a });
3084
- });
3085
- return n.observe(e, { box: "border-box" }), () => n.unobserve(e);
3086
- } else
3087
- t(void 0);
3088
- }, [e]), r;
3089
- }
3090
- var tn = "Popper", [bo, So] = Kr(tn), [Ta, Co] = bo(tn), Eo = (e) => {
3091
- const { __scopePopper: r, children: t } = e, [n, o] = l.useState(null);
3092
- return /* @__PURE__ */ R.jsx(Ta, { scope: r, anchor: n, onAnchorChange: o, children: t });
3093
- };
3094
- Eo.displayName = tn;
3095
- var Ao = "PopperAnchor", _o = l.forwardRef(
3096
- (e, r) => {
3097
- const { __scopePopper: t, virtualRef: n, ...o } = e, s = Co(Ao, t), i = l.useRef(null), a = le(r, i);
3098
- return l.useEffect(() => {
3099
- s.onAnchorChange((n == null ? void 0 : n.current) || i.current);
3100
- }), n ? null : /* @__PURE__ */ R.jsx(oe.div, { ...o, ref: a });
3101
- }
3102
- );
3103
- _o.displayName = Ao;
3104
- var rn = "PopperContent", [Fa, Na] = bo(rn), Ro = l.forwardRef(
3105
- (e, r) => {
3106
- var W, q, se, X, z, K;
3107
- const {
3108
- __scopePopper: t,
3109
- side: n = "bottom",
3110
- sideOffset: o = 0,
3111
- align: s = "center",
3112
- alignOffset: i = 0,
3113
- arrowPadding: a = 0,
3114
- avoidCollisions: c = !0,
3115
- collisionBoundary: f = [],
3116
- collisionPadding: h = 0,
3117
- sticky: d = "partial",
3118
- hideWhenDetached: m = !1,
3119
- updatePositionStrategy: w = "optimized",
3120
- onPlaced: v,
3121
- ...p
3122
- } = e, S = Co(rn, t), [b, y] = l.useState(null), E = le(r, (ue) => y(ue)), [P, x] = l.useState(null), A = Oa(P), _ = (A == null ? void 0 : A.width) ?? 0, M = (A == null ? void 0 : A.height) ?? 0, H = n + (s !== "center" ? "-" + s : ""), U = typeof h == "number" ? h : { top: 0, right: 0, bottom: 0, left: 0, ...h }, J = Array.isArray(f) ? f : [f], D = J.length > 0, I = {
3123
- padding: U,
3124
- boundary: J.filter(Ma),
3125
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
3126
- altBoundary: D
3127
- }, { refs: B, floatingStyles: k, placement: $, isPositioned: L, middlewareData: Z } = _a({
3128
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
3129
- strategy: "fixed",
3130
- placement: H,
3131
- whileElementsMounted: (...ue) => ga(...ue, {
3132
- animationFrame: w === "always"
3133
- }),
3134
- elements: {
3135
- reference: S.anchor
3136
- },
3137
- middleware: [
3138
- ya({ mainAxis: o + M, alignmentAxis: i }),
3139
- c && wa({
3140
- mainAxis: !0,
3141
- crossAxis: !1,
3142
- limiter: d === "partial" ? Ca() : void 0,
3143
- ...I
3144
- }),
3145
- c && xa({ ...I }),
3146
- ba({
3147
- ...I,
3148
- apply: ({ elements: ue, rects: me, availableWidth: rt, availableHeight: nt }) => {
3149
- const { width: ot, height: u } = me.reference, g = ue.floating.style;
3150
- g.setProperty("--radix-popper-available-width", `${rt}px`), g.setProperty("--radix-popper-available-height", `${nt}px`), g.setProperty("--radix-popper-anchor-width", `${ot}px`), g.setProperty("--radix-popper-anchor-height", `${u}px`);
3151
- }
3152
- }),
3153
- P && Aa({ element: P, padding: a }),
3154
- Va({ arrowWidth: _, arrowHeight: M }),
3155
- m && Sa({ strategy: "referenceHidden", ...I })
3156
- ]
3157
- }), [ee, Se] = To($), xe = Ie(v);
3158
- we(() => {
3159
- L && (xe == null || xe());
3160
- }, [L, xe]);
3161
- const Be = (W = Z.arrow) == null ? void 0 : W.x, Qe = (q = Z.arrow) == null ? void 0 : q.y, Ce = ((se = Z.arrow) == null ? void 0 : se.centerOffset) !== 0, [We, Ee] = l.useState();
3162
- return we(() => {
3163
- b && Ee(window.getComputedStyle(b).zIndex);
3164
- }, [b]), /* @__PURE__ */ R.jsx(
3165
- "div",
3166
- {
3167
- ref: B.setFloating,
3168
- "data-radix-popper-content-wrapper": "",
3169
- style: {
3170
- ...k,
3171
- transform: L ? k.transform : "translate(0, -200%)",
3172
- // keep off the page when measuring
3173
- minWidth: "max-content",
3174
- zIndex: We,
3175
- "--radix-popper-transform-origin": [
3176
- (X = Z.transformOrigin) == null ? void 0 : X.x,
3177
- (z = Z.transformOrigin) == null ? void 0 : z.y
3178
- ].join(" "),
3179
- // hide the content if using the hide middleware and should be hidden
3180
- // set visibility to hidden and disable pointer events so the UI behaves
3181
- // as if the PopperContent isn't there at all
3182
- ...((K = Z.hide) == null ? void 0 : K.referenceHidden) && {
3183
- visibility: "hidden",
3184
- pointerEvents: "none"
3185
- }
3186
- },
3187
- dir: e.dir,
3188
- children: /* @__PURE__ */ R.jsx(
3189
- Fa,
3190
- {
3191
- scope: t,
3192
- placedSide: ee,
3193
- onArrowChange: x,
3194
- arrowX: Be,
3195
- arrowY: Qe,
3196
- shouldHideArrow: Ce,
3197
- children: /* @__PURE__ */ R.jsx(
3198
- oe.div,
3199
- {
3200
- "data-side": ee,
3201
- "data-align": Se,
3202
- ...p,
3203
- ref: E,
3204
- style: {
3205
- ...p.style,
3206
- // if the PopperContent hasn't been placed yet (not all measurements done)
3207
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
3208
- animation: L ? void 0 : "none"
3209
- }
3210
- }
3211
- )
3212
- }
3213
- )
3214
- }
3215
- );
3216
- }
3217
- );
3218
- Ro.displayName = rn;
3219
- var Po = "PopperArrow", Da = {
3220
- top: "bottom",
3221
- right: "left",
3222
- bottom: "top",
3223
- left: "right"
3224
- }, Oo = l.forwardRef(function(r, t) {
3225
- const { __scopePopper: n, ...o } = r, s = Na(Po, n), i = Da[s.placedSide];
3226
- return (
3227
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
3228
- // doesn't report size as we'd expect on SVG elements.
3229
- // it reports their bounding box which is effectively the largest path inside the SVG.
3230
- /* @__PURE__ */ R.jsx(
3231
- "span",
3232
- {
3233
- ref: s.onArrowChange,
3234
- style: {
3235
- position: "absolute",
3236
- left: s.arrowX,
3237
- top: s.arrowY,
3238
- [i]: 0,
3239
- transformOrigin: {
3240
- top: "",
3241
- right: "0 0",
3242
- bottom: "center 0",
3243
- left: "100% 0"
3244
- }[s.placedSide],
3245
- transform: {
3246
- top: "translateY(100%)",
3247
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
3248
- bottom: "rotate(180deg)",
3249
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
3250
- }[s.placedSide],
3251
- visibility: s.shouldHideArrow ? "hidden" : void 0
3252
- },
3253
- children: /* @__PURE__ */ R.jsx(
3254
- Pa,
3255
- {
3256
- ...o,
3257
- ref: t,
3258
- style: {
3259
- ...o.style,
3260
- // ensures the element can be measured correctly (mostly for if SVG)
3261
- display: "block"
3262
- }
3263
- }
3264
- )
3265
- }
3266
- )
3267
- );
3268
- });
3269
- Oo.displayName = Po;
3270
- function Ma(e) {
3271
- return e !== null;
3272
- }
3273
- var Va = (e) => ({
3274
- name: "transformOrigin",
3275
- options: e,
3276
- fn(r) {
3277
- var S, b, y;
3278
- const { placement: t, rects: n, middlewareData: o } = r, i = ((S = o.arrow) == null ? void 0 : S.centerOffset) !== 0, a = i ? 0 : e.arrowWidth, c = i ? 0 : e.arrowHeight, [f, h] = To(t), d = { start: "0%", center: "50%", end: "100%" }[h], m = (((b = o.arrow) == null ? void 0 : b.x) ?? 0) + a / 2, w = (((y = o.arrow) == null ? void 0 : y.y) ?? 0) + c / 2;
3279
- let v = "", p = "";
3280
- return f === "bottom" ? (v = i ? d : `${m}px`, p = `${-c}px`) : f === "top" ? (v = i ? d : `${m}px`, p = `${n.floating.height + c}px`) : f === "right" ? (v = `${-c}px`, p = i ? d : `${w}px`) : f === "left" && (v = `${n.floating.width + c}px`, p = i ? d : `${w}px`), { data: { x: v, y: p } };
3281
- }
3282
- });
3283
- function To(e) {
3284
- const [r, t = "center"] = e.split("-");
3285
- return [r, t];
3286
- }
3287
- var Ia = Eo, ka = _o, La = Ro, ja = Oo, Ba = "Portal", Fo = l.forwardRef((e, r) => {
3288
- var a;
3289
- const { container: t, ...n } = e, [o, s] = l.useState(!1);
3290
- we(() => s(!0), []);
3291
- const i = t || o && ((a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : a.body);
3292
- return i ? Bs.createPortal(/* @__PURE__ */ R.jsx(oe.div, { ...n, ref: r }), i) : null;
3293
- });
3294
- Fo.displayName = Ba;
3295
- function Nn({
3296
- prop: e,
3297
- defaultProp: r,
3298
- onChange: t = () => {
3299
- }
3300
- }) {
3301
- const [n, o] = Wa({ defaultProp: r, onChange: t }), s = e !== void 0, i = s ? e : n, a = Ie(t), c = l.useCallback(
3302
- (f) => {
3303
- if (s) {
3304
- const d = typeof f == "function" ? f(e) : f;
3305
- d !== e && a(d);
3306
- } else
3307
- o(f);
3308
- },
3309
- [s, e, o, a]
3310
- );
3311
- return [i, c];
3312
- }
3313
- function Wa({
3314
- defaultProp: e,
3315
- onChange: r
3316
- }) {
3317
- const t = l.useState(e), [n] = t, o = l.useRef(n), s = Ie(r);
3318
- return l.useEffect(() => {
3319
- o.current !== n && (s(n), o.current = n);
3320
- }, [n, o, s]), t;
3321
- }
3322
- function Ha(e) {
3323
- const r = l.useRef({ value: e, previous: e });
3324
- return l.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
3325
- }
3326
- var Ua = "VisuallyHidden", No = l.forwardRef(
3327
- (e, r) => /* @__PURE__ */ R.jsx(
3328
- oe.span,
3329
- {
3330
- ...e,
3331
- ref: r,
3332
- style: {
3333
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
3334
- position: "absolute",
3335
- border: 0,
3336
- width: 1,
3337
- height: 1,
3338
- padding: 0,
3339
- margin: -1,
3340
- overflow: "hidden",
3341
- clip: "rect(0, 0, 0, 0)",
3342
- whiteSpace: "nowrap",
3343
- wordWrap: "normal",
3344
- ...e.style
3345
- }
3346
- }
3347
- )
3348
- );
3349
- No.displayName = Ua;
3350
- var $a = function(e) {
3351
- if (typeof document > "u")
3352
- return null;
3353
- var r = Array.isArray(e) ? e[0] : e;
3354
- return r.ownerDocument.body;
3355
- }, ut = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Vt = {}, Ar = 0, Do = function(e) {
3356
- return e && (e.host || Do(e.parentNode));
3357
- }, za = function(e, r) {
3358
- return r.map(function(t) {
3359
- if (e.contains(t))
3360
- return t;
3361
- var n = Do(t);
3362
- return n && e.contains(n) ? n : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
3363
- }).filter(function(t) {
3364
- return !!t;
3365
- });
3366
- }, Ka = function(e, r, t, n) {
3367
- var o = za(r, Array.isArray(e) ? e : [e]);
3368
- Vt[t] || (Vt[t] = /* @__PURE__ */ new WeakMap());
3369
- var s = Vt[t], i = [], a = /* @__PURE__ */ new Set(), c = new Set(o), f = function(d) {
3370
- !d || a.has(d) || (a.add(d), f(d.parentNode));
3371
- };
3372
- o.forEach(f);
3373
- var h = function(d) {
3374
- !d || c.has(d) || Array.prototype.forEach.call(d.children, function(m) {
3375
- if (a.has(m))
3376
- h(m);
3377
- else
3378
- try {
3379
- var w = m.getAttribute(n), v = w !== null && w !== "false", p = (ut.get(m) || 0) + 1, S = (s.get(m) || 0) + 1;
3380
- ut.set(m, p), s.set(m, S), i.push(m), p === 1 && v && Mt.set(m, !0), S === 1 && m.setAttribute(t, "true"), v || m.setAttribute(n, "true");
3381
- } catch (b) {
3382
- console.error("aria-hidden: cannot operate on ", m, b);
3383
- }
3384
- });
3385
- };
3386
- return h(r), a.clear(), Ar++, function() {
3387
- i.forEach(function(d) {
3388
- var m = ut.get(d) - 1, w = s.get(d) - 1;
3389
- ut.set(d, m), s.set(d, w), m || (Mt.has(d) || d.removeAttribute(n), Mt.delete(d)), w || d.removeAttribute(t);
3390
- }), Ar--, Ar || (ut = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Vt = {});
3391
- };
3392
- }, Ya = function(e, r, t) {
3393
- t === void 0 && (t = "data-aria-hidden");
3394
- var n = Array.from(Array.isArray(e) ? e : [e]), o = $a(e);
3395
- return o ? (n.push.apply(n, Array.from(o.querySelectorAll("[aria-live]"))), Ka(n, o, t, "aria-hidden")) : function() {
3396
- return null;
3397
- };
3398
- }, Re = function() {
3399
- return Re = Object.assign || function(r) {
3400
- for (var t, n = 1, o = arguments.length; n < o; n++) {
3401
- t = arguments[n];
3402
- for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (r[s] = t[s]);
3403
- }
3404
- return r;
3405
- }, Re.apply(this, arguments);
3406
- };
3407
- function Mo(e, r) {
3408
- var t = {};
3409
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
3410
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
3411
- for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
3412
- r.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (t[n[o]] = e[n[o]]);
3413
- return t;
3414
- }
3415
- function qa(e, r, t) {
3416
- if (t || arguments.length === 2) for (var n = 0, o = r.length, s; n < o; n++)
3417
- (s || !(n in r)) && (s || (s = Array.prototype.slice.call(r, 0, n)), s[n] = r[n]);
3418
- return e.concat(s || Array.prototype.slice.call(r));
3419
- }
3420
- var Wt = "right-scroll-bar-position", Ht = "width-before-scroll-bar", Xa = "with-scroll-bars-hidden", Ga = "--removed-body-scroll-bar-size";
3421
- function _r(e, r) {
3422
- return typeof e == "function" ? e(r) : e && (e.current = r), e;
3423
- }
3424
- function Za(e, r) {
3425
- var t = Fs(function() {
3426
- return {
3427
- // value
3428
- value: e,
3429
- // last callback
3430
- callback: r,
3431
- // "memoized" public interface
3432
- facade: {
3433
- get current() {
3434
- return t.value;
3435
- },
3436
- set current(n) {
3437
- var o = t.value;
3438
- o !== n && (t.value = n, t.callback(n, o));
3439
- }
3440
- }
3441
- };
3442
- })[0];
3443
- return t.callback = r, t.facade;
3444
- }
3445
- var Qa = typeof window < "u" ? l.useLayoutEffect : l.useEffect, Dn = /* @__PURE__ */ new WeakMap();
3446
- function Ja(e, r) {
3447
- var t = Za(null, function(n) {
3448
- return e.forEach(function(o) {
3449
- return _r(o, n);
3450
- });
3451
- });
3452
- return Qa(function() {
3453
- var n = Dn.get(t);
3454
- if (n) {
3455
- var o = new Set(n), s = new Set(e), i = t.current;
3456
- o.forEach(function(a) {
3457
- s.has(a) || _r(a, null);
3458
- }), s.forEach(function(a) {
3459
- o.has(a) || _r(a, i);
3460
- });
3461
- }
3462
- Dn.set(t, e);
3463
- }, [e]), t;
3464
- }
3465
- function ec(e) {
3466
- return e;
3467
- }
3468
- function tc(e, r) {
3469
- r === void 0 && (r = ec);
3470
- var t = [], n = !1, o = {
3471
- read: function() {
3472
- if (n)
3473
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
3474
- return t.length ? t[t.length - 1] : e;
3475
- },
3476
- useMedium: function(s) {
3477
- var i = r(s, n);
3478
- return t.push(i), function() {
3479
- t = t.filter(function(a) {
3480
- return a !== i;
3481
- });
3482
- };
3483
- },
3484
- assignSyncMedium: function(s) {
3485
- for (n = !0; t.length; ) {
3486
- var i = t;
3487
- t = [], i.forEach(s);
3488
- }
3489
- t = {
3490
- push: function(a) {
3491
- return s(a);
3492
- },
3493
- filter: function() {
3494
- return t;
3495
- }
3496
- };
3497
- },
3498
- assignMedium: function(s) {
3499
- n = !0;
3500
- var i = [];
3501
- if (t.length) {
3502
- var a = t;
3503
- t = [], a.forEach(s), i = t;
3504
- }
3505
- var c = function() {
3506
- var h = i;
3507
- i = [], h.forEach(s);
3508
- }, f = function() {
3509
- return Promise.resolve().then(c);
3510
- };
3511
- f(), t = {
3512
- push: function(h) {
3513
- i.push(h), f();
3514
- },
3515
- filter: function(h) {
3516
- return i = i.filter(h), t;
3517
- }
3518
- };
3519
- }
3520
- };
3521
- return o;
3522
- }
3523
- function rc(e) {
3524
- e === void 0 && (e = {});
3525
- var r = tc(null);
3526
- return r.options = Re({ async: !0, ssr: !1 }, e), r;
3527
- }
3528
- var Vo = function(e) {
3529
- var r = e.sideCar, t = Mo(e, ["sideCar"]);
3530
- if (!r)
3531
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
3532
- var n = r.read();
3533
- if (!n)
3534
- throw new Error("Sidecar medium not found");
3535
- return l.createElement(n, Re({}, t));
3536
- };
3537
- Vo.isSideCarExport = !0;
3538
- function nc(e, r) {
3539
- return e.useMedium(r), Vo;
3540
- }
3541
- var Io = rc(), Rr = function() {
3542
- }, nr = l.forwardRef(function(e, r) {
3543
- var t = l.useRef(null), n = l.useState({
3544
- onScrollCapture: Rr,
3545
- onWheelCapture: Rr,
3546
- onTouchMoveCapture: Rr
3547
- }), o = n[0], s = n[1], i = e.forwardProps, a = e.children, c = e.className, f = e.removeScrollBar, h = e.enabled, d = e.shards, m = e.sideCar, w = e.noIsolation, v = e.inert, p = e.allowPinchZoom, S = e.as, b = S === void 0 ? "div" : S, y = e.gapMode, E = Mo(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), P = m, x = Ja([t, r]), A = Re(Re({}, E), o);
3548
- return l.createElement(
3549
- l.Fragment,
3550
- null,
3551
- h && l.createElement(P, { sideCar: Io, removeScrollBar: f, shards: d, noIsolation: w, inert: v, setCallbacks: s, allowPinchZoom: !!p, lockRef: t, gapMode: y }),
3552
- i ? l.cloneElement(l.Children.only(a), Re(Re({}, A), { ref: x })) : l.createElement(b, Re({}, A, { className: c, ref: x }), a)
3553
- );
3554
- });
3555
- nr.defaultProps = {
3556
- enabled: !0,
3557
- removeScrollBar: !0,
3558
- inert: !1
3559
- };
3560
- nr.classNames = {
3561
- fullWidth: Ht,
3562
- zeroRight: Wt
3563
- };
3564
- var oc = function() {
3565
- if (typeof __webpack_nonce__ < "u")
3566
- return __webpack_nonce__;
3567
- };
3568
- function sc() {
3569
- if (!document)
3570
- return null;
3571
- var e = document.createElement("style");
3572
- e.type = "text/css";
3573
- var r = oc();
3574
- return r && e.setAttribute("nonce", r), e;
3575
- }
3576
- function ic(e, r) {
3577
- e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r));
3578
- }
3579
- function ac(e) {
3580
- var r = document.head || document.getElementsByTagName("head")[0];
3581
- r.appendChild(e);
3582
- }
3583
- var cc = function() {
3584
- var e = 0, r = null;
3585
- return {
3586
- add: function(t) {
3587
- e == 0 && (r = sc()) && (ic(r, t), ac(r)), e++;
3588
- },
3589
- remove: function() {
3590
- e--, !e && r && (r.parentNode && r.parentNode.removeChild(r), r = null);
3591
- }
3592
- };
3593
- }, lc = function() {
3594
- var e = cc();
3595
- return function(r, t) {
3596
- l.useEffect(function() {
3597
- return e.add(r), function() {
3598
- e.remove();
3599
- };
3600
- }, [r && t]);
3601
- };
3602
- }, ko = function() {
3603
- var e = lc(), r = function(t) {
3604
- var n = t.styles, o = t.dynamic;
3605
- return e(n, o), null;
3606
- };
3607
- return r;
3608
- }, uc = {
3609
- left: 0,
3610
- top: 0,
3611
- right: 0,
3612
- gap: 0
3613
- }, Pr = function(e) {
3614
- return parseInt(e || "", 10) || 0;
3615
- }, fc = function(e) {
3616
- var r = window.getComputedStyle(document.body), t = r[e === "padding" ? "paddingLeft" : "marginLeft"], n = r[e === "padding" ? "paddingTop" : "marginTop"], o = r[e === "padding" ? "paddingRight" : "marginRight"];
3617
- return [Pr(t), Pr(n), Pr(o)];
3618
- }, dc = function(e) {
3619
- if (e === void 0 && (e = "margin"), typeof window > "u")
3620
- return uc;
3621
- var r = fc(e), t = document.documentElement.clientWidth, n = window.innerWidth;
3622
- return {
3623
- left: r[0],
3624
- top: r[1],
3625
- right: r[2],
3626
- gap: Math.max(0, n - t + r[2] - r[0])
3627
- };
3628
- }, hc = ko(), vt = "data-scroll-locked", pc = function(e, r, t, n) {
3629
- var o = e.left, s = e.top, i = e.right, a = e.gap;
3630
- return t === void 0 && (t = "margin"), `
3631
- .`.concat(Xa, ` {
3632
- overflow: hidden `).concat(n, `;
3633
- padding-right: `).concat(a, "px ").concat(n, `;
3634
- }
3635
- body[`).concat(vt, `] {
3636
- overflow: hidden `).concat(n, `;
3637
- overscroll-behavior: contain;
3638
- `).concat([
3639
- r && "position: relative ".concat(n, ";"),
3640
- t === "margin" && `
3641
- padding-left: `.concat(o, `px;
3642
- padding-top: `).concat(s, `px;
3643
- padding-right: `).concat(i, `px;
3644
- margin-left:0;
3645
- margin-top:0;
3646
- margin-right: `).concat(a, "px ").concat(n, `;
3647
- `),
3648
- t === "padding" && "padding-right: ".concat(a, "px ").concat(n, ";")
3649
- ].filter(Boolean).join(""), `
3650
- }
3651
-
3652
- .`).concat(Wt, ` {
3653
- right: `).concat(a, "px ").concat(n, `;
3654
- }
3655
-
3656
- .`).concat(Ht, ` {
3657
- margin-right: `).concat(a, "px ").concat(n, `;
3658
- }
3659
-
3660
- .`).concat(Wt, " .").concat(Wt, ` {
3661
- right: 0 `).concat(n, `;
3662
- }
3663
-
3664
- .`).concat(Ht, " .").concat(Ht, ` {
3665
- margin-right: 0 `).concat(n, `;
3666
- }
3667
-
3668
- body[`).concat(vt, `] {
3669
- `).concat(Ga, ": ").concat(a, `px;
3670
- }
3671
- `);
3672
- }, Mn = function() {
3673
- var e = parseInt(document.body.getAttribute(vt) || "0", 10);
3674
- return isFinite(e) ? e : 0;
3675
- }, mc = function() {
3676
- l.useEffect(function() {
3677
- return document.body.setAttribute(vt, (Mn() + 1).toString()), function() {
3678
- var e = Mn() - 1;
3679
- e <= 0 ? document.body.removeAttribute(vt) : document.body.setAttribute(vt, e.toString());
3680
- };
3681
- }, []);
3682
- }, vc = function(e) {
3683
- var r = e.noRelative, t = e.noImportant, n = e.gapMode, o = n === void 0 ? "margin" : n;
3684
- mc();
3685
- var s = l.useMemo(function() {
3686
- return dc(o);
3687
- }, [o]);
3688
- return l.createElement(hc, { styles: pc(s, !r, o, t ? "" : "!important") });
3689
- }, Ir = !1;
3690
- if (typeof window < "u")
3691
- try {
3692
- var It = Object.defineProperty({}, "passive", {
3693
- get: function() {
3694
- return Ir = !0, !0;
3695
- }
3696
- });
3697
- window.addEventListener("test", It, It), window.removeEventListener("test", It, It);
3698
- } catch {
3699
- Ir = !1;
3700
- }
3701
- var ft = Ir ? { passive: !1 } : !1, gc = function(e) {
3702
- return e.tagName === "TEXTAREA";
3703
- }, Lo = function(e, r) {
3704
- var t = window.getComputedStyle(e);
3705
- return (
3706
- // not-not-scrollable
3707
- t[r] !== "hidden" && // contains scroll inside self
3708
- !(t.overflowY === t.overflowX && !gc(e) && t[r] === "visible")
3709
- );
3710
- }, yc = function(e) {
3711
- return Lo(e, "overflowY");
3712
- }, wc = function(e) {
3713
- return Lo(e, "overflowX");
3714
- }, Vn = function(e, r) {
3715
- var t = r.ownerDocument, n = r;
3716
- do {
3717
- typeof ShadowRoot < "u" && n instanceof ShadowRoot && (n = n.host);
3718
- var o = jo(e, n);
3719
- if (o) {
3720
- var s = Bo(e, n), i = s[1], a = s[2];
3721
- if (i > a)
3722
- return !0;
3723
- }
3724
- n = n.parentNode;
3725
- } while (n && n !== t.body);
3726
- return !1;
3727
- }, xc = function(e) {
3728
- var r = e.scrollTop, t = e.scrollHeight, n = e.clientHeight;
3729
- return [
3730
- r,
3731
- t,
3732
- n
3733
- ];
3734
- }, bc = function(e) {
3735
- var r = e.scrollLeft, t = e.scrollWidth, n = e.clientWidth;
3736
- return [
3737
- r,
3738
- t,
3739
- n
3740
- ];
3741
- }, jo = function(e, r) {
3742
- return e === "v" ? yc(r) : wc(r);
3743
- }, Bo = function(e, r) {
3744
- return e === "v" ? xc(r) : bc(r);
3745
- }, Sc = function(e, r) {
3746
- return e === "h" && r === "rtl" ? -1 : 1;
3747
- }, Cc = function(e, r, t, n, o) {
3748
- var s = Sc(e, window.getComputedStyle(r).direction), i = s * n, a = t.target, c = r.contains(a), f = !1, h = i > 0, d = 0, m = 0;
3749
- do {
3750
- var w = Bo(e, a), v = w[0], p = w[1], S = w[2], b = p - S - s * v;
3751
- (v || b) && jo(e, a) && (d += b, m += v), a instanceof ShadowRoot ? a = a.host : a = a.parentNode;
3752
- } while (
3753
- // portaled content
3754
- !c && a !== document.body || // self content
3755
- c && (r.contains(a) || r === a)
3756
- );
3757
- return (h && (Math.abs(d) < 1 || !o) || !h && (Math.abs(m) < 1 || !o)) && (f = !0), f;
3758
- }, kt = function(e) {
3759
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
3760
- }, In = function(e) {
3761
- return [e.deltaX, e.deltaY];
3762
- }, kn = function(e) {
3763
- return e && "current" in e ? e.current : e;
3764
- }, Ec = function(e, r) {
3765
- return e[0] === r[0] && e[1] === r[1];
3766
- }, Ac = function(e) {
3767
- return `
3768
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
3769
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
3770
- `);
3771
- }, _c = 0, dt = [];
3772
- function Rc(e) {
3773
- var r = l.useRef([]), t = l.useRef([0, 0]), n = l.useRef(), o = l.useState(_c++)[0], s = l.useState(ko)[0], i = l.useRef(e);
3774
- l.useEffect(function() {
3775
- i.current = e;
3776
- }, [e]), l.useEffect(function() {
3777
- if (e.inert) {
3778
- document.body.classList.add("block-interactivity-".concat(o));
3779
- var p = qa([e.lockRef.current], (e.shards || []).map(kn), !0).filter(Boolean);
3780
- return p.forEach(function(S) {
3781
- return S.classList.add("allow-interactivity-".concat(o));
3782
- }), function() {
3783
- document.body.classList.remove("block-interactivity-".concat(o)), p.forEach(function(S) {
3784
- return S.classList.remove("allow-interactivity-".concat(o));
3785
- });
3786
- };
3787
- }
3788
- }, [e.inert, e.lockRef.current, e.shards]);
3789
- var a = l.useCallback(function(p, S) {
3790
- if ("touches" in p && p.touches.length === 2)
3791
- return !i.current.allowPinchZoom;
3792
- var b = kt(p), y = t.current, E = "deltaX" in p ? p.deltaX : y[0] - b[0], P = "deltaY" in p ? p.deltaY : y[1] - b[1], x, A = p.target, _ = Math.abs(E) > Math.abs(P) ? "h" : "v";
3793
- if ("touches" in p && _ === "h" && A.type === "range")
3794
- return !1;
3795
- var M = Vn(_, A);
3796
- if (!M)
3797
- return !0;
3798
- if (M ? x = _ : (x = _ === "v" ? "h" : "v", M = Vn(_, A)), !M)
3799
- return !1;
3800
- if (!n.current && "changedTouches" in p && (E || P) && (n.current = x), !x)
3801
- return !0;
3802
- var H = n.current || x;
3803
- return Cc(H, S, p, H === "h" ? E : P, !0);
3804
- }, []), c = l.useCallback(function(p) {
3805
- var S = p;
3806
- if (!(!dt.length || dt[dt.length - 1] !== s)) {
3807
- var b = "deltaY" in S ? In(S) : kt(S), y = r.current.filter(function(x) {
3808
- return x.name === S.type && (x.target === S.target || S.target === x.shadowParent) && Ec(x.delta, b);
3809
- })[0];
3810
- if (y && y.should) {
3811
- S.cancelable && S.preventDefault();
3812
- return;
3813
- }
3814
- if (!y) {
3815
- var E = (i.current.shards || []).map(kn).filter(Boolean).filter(function(x) {
3816
- return x.contains(S.target);
3817
- }), P = E.length > 0 ? a(S, E[0]) : !i.current.noIsolation;
3818
- P && S.cancelable && S.preventDefault();
3819
- }
3820
- }
3821
- }, []), f = l.useCallback(function(p, S, b, y) {
3822
- var E = { name: p, delta: S, target: b, should: y, shadowParent: Pc(b) };
3823
- r.current.push(E), setTimeout(function() {
3824
- r.current = r.current.filter(function(P) {
3825
- return P !== E;
3826
- });
3827
- }, 1);
3828
- }, []), h = l.useCallback(function(p) {
3829
- t.current = kt(p), n.current = void 0;
3830
- }, []), d = l.useCallback(function(p) {
3831
- f(p.type, In(p), p.target, a(p, e.lockRef.current));
3832
- }, []), m = l.useCallback(function(p) {
3833
- f(p.type, kt(p), p.target, a(p, e.lockRef.current));
3834
- }, []);
3835
- l.useEffect(function() {
3836
- return dt.push(s), e.setCallbacks({
3837
- onScrollCapture: d,
3838
- onWheelCapture: d,
3839
- onTouchMoveCapture: m
3840
- }), document.addEventListener("wheel", c, ft), document.addEventListener("touchmove", c, ft), document.addEventListener("touchstart", h, ft), function() {
3841
- dt = dt.filter(function(p) {
3842
- return p !== s;
3843
- }), document.removeEventListener("wheel", c, ft), document.removeEventListener("touchmove", c, ft), document.removeEventListener("touchstart", h, ft);
3844
- };
3845
- }, []);
3846
- var w = e.removeScrollBar, v = e.inert;
3847
- return l.createElement(
3848
- l.Fragment,
3849
- null,
3850
- v ? l.createElement(s, { styles: Ac(o) }) : null,
3851
- w ? l.createElement(vc, { gapMode: e.gapMode }) : null
3852
- );
3853
- }
3854
- function Pc(e) {
3855
- for (var r = null; e !== null; )
3856
- e instanceof ShadowRoot && (r = e.host, e = e.host), e = e.parentNode;
3857
- return r;
3858
- }
3859
- const Oc = nc(Io, Rc);
3860
- var Wo = l.forwardRef(function(e, r) {
3861
- return l.createElement(nr, Re({}, e, { ref: r, sideCar: Oc }));
3862
- });
3863
- Wo.classNames = nr.classNames;
3864
- var Tc = [" ", "Enter", "ArrowUp", "ArrowDown"], Fc = [" ", "Enter"], Ft = "Select", [or, sr, Nc] = hi(Ft), [St, bl] = Kr(Ft, [
3865
- Nc,
3866
- So
3867
- ]), ir = So(), [Dc, Ge] = St(Ft), [Mc, Vc] = St(Ft), Ho = (e) => {
3868
- const {
3869
- __scopeSelect: r,
3870
- children: t,
3871
- open: n,
3872
- defaultOpen: o,
3873
- onOpenChange: s,
3874
- value: i,
3875
- defaultValue: a,
3876
- onValueChange: c,
3877
- dir: f,
3878
- name: h,
3879
- autoComplete: d,
3880
- disabled: m,
3881
- required: w
3882
- } = e, v = ir(r), [p, S] = l.useState(null), [b, y] = l.useState(null), [E, P] = l.useState(!1), x = mi(f), [A = !1, _] = Nn({
3883
- prop: n,
3884
- defaultProp: o,
3885
- onChange: s
3886
- }), [M, H] = Nn({
3887
- prop: i,
3888
- defaultProp: a,
3889
- onChange: c
3890
- }), U = l.useRef(null), J = p ? !!p.closest("form") : !0, [D, I] = l.useState(/* @__PURE__ */ new Set()), B = Array.from(D).map((k) => k.props.value).join(";");
3891
- return /* @__PURE__ */ R.jsx(Ia, { ...v, children: /* @__PURE__ */ R.jsxs(
3892
- Dc,
3893
- {
3894
- required: w,
3895
- scope: r,
3896
- trigger: p,
3897
- onTriggerChange: S,
3898
- valueNode: b,
3899
- onValueNodeChange: y,
3900
- valueNodeHasChildren: E,
3901
- onValueNodeHasChildrenChange: P,
3902
- contentId: Yr(),
3903
- value: M,
3904
- onValueChange: H,
3905
- open: A,
3906
- onOpenChange: _,
3907
- dir: x,
3908
- triggerPointerDownPosRef: U,
3909
- disabled: m,
3910
- children: [
3911
- /* @__PURE__ */ R.jsx(or.Provider, { scope: r, children: /* @__PURE__ */ R.jsx(
3912
- Mc,
3913
- {
3914
- scope: e.__scopeSelect,
3915
- onNativeOptionAdd: l.useCallback((k) => {
3916
- I(($) => new Set($).add(k));
3917
- }, []),
3918
- onNativeOptionRemove: l.useCallback((k) => {
3919
- I(($) => {
3920
- const L = new Set($);
3921
- return L.delete(k), L;
3922
- });
3923
- }, []),
3924
- children: t
3925
- }
3926
- ) }),
3927
- J ? /* @__PURE__ */ R.jsxs(
3928
- ps,
3929
- {
3930
- "aria-hidden": !0,
3931
- required: w,
3932
- tabIndex: -1,
3933
- name: h,
3934
- autoComplete: d,
3935
- value: M,
3936
- onChange: (k) => H(k.target.value),
3937
- disabled: m,
3938
- children: [
3939
- M === void 0 ? /* @__PURE__ */ R.jsx("option", { value: "" }) : null,
3940
- Array.from(D)
3941
- ]
3942
- },
3943
- B
3944
- ) : null
3945
- ]
3946
- }
3947
- ) });
3948
- };
3949
- Ho.displayName = Ft;
3950
- var Uo = "SelectTrigger", $o = l.forwardRef(
3951
- (e, r) => {
3952
- const { __scopeSelect: t, disabled: n = !1, ...o } = e, s = ir(t), i = Ge(Uo, t), a = i.disabled || n, c = le(r, i.onTriggerChange), f = sr(t), [h, d, m] = ms((v) => {
3953
- const p = f().filter((y) => !y.disabled), S = p.find((y) => y.value === i.value), b = vs(p, v, S);
3954
- b !== void 0 && i.onValueChange(b.value);
3955
- }), w = () => {
3956
- a || (i.onOpenChange(!0), m());
3957
- };
3958
- return /* @__PURE__ */ R.jsx(ka, { asChild: !0, ...s, children: /* @__PURE__ */ R.jsx(
3959
- oe.button,
3960
- {
3961
- type: "button",
3962
- role: "combobox",
3963
- "aria-controls": i.contentId,
3964
- "aria-expanded": i.open,
3965
- "aria-required": i.required,
3966
- "aria-autocomplete": "none",
3967
- dir: i.dir,
3968
- "data-state": i.open ? "open" : "closed",
3969
- disabled: a,
3970
- "data-disabled": a ? "" : void 0,
3971
- "data-placeholder": hs(i.value) ? "" : void 0,
3972
- ...o,
3973
- ref: c,
3974
- onClick: ce(o.onClick, (v) => {
3975
- v.currentTarget.focus();
3976
- }),
3977
- onPointerDown: ce(o.onPointerDown, (v) => {
3978
- const p = v.target;
3979
- p.hasPointerCapture(v.pointerId) && p.releasePointerCapture(v.pointerId), v.button === 0 && v.ctrlKey === !1 && (w(), i.triggerPointerDownPosRef.current = {
3980
- x: Math.round(v.pageX),
3981
- y: Math.round(v.pageY)
3982
- }, v.preventDefault());
3983
- }),
3984
- onKeyDown: ce(o.onKeyDown, (v) => {
3985
- const p = h.current !== "";
3986
- !(v.ctrlKey || v.altKey || v.metaKey) && v.key.length === 1 && d(v.key), !(p && v.key === " ") && Tc.includes(v.key) && (w(), v.preventDefault());
3987
- })
3988
- }
3989
- ) });
3990
- }
3991
- );
3992
- $o.displayName = Uo;
3993
- var zo = "SelectValue", Ko = l.forwardRef(
3994
- (e, r) => {
3995
- const { __scopeSelect: t, className: n, style: o, children: s, placeholder: i = "", ...a } = e, c = Ge(zo, t), { onValueNodeHasChildrenChange: f } = c, h = s !== void 0, d = le(r, c.onValueNodeChange);
3996
- return we(() => {
3997
- f(h);
3998
- }, [f, h]), /* @__PURE__ */ R.jsx(
3999
- oe.span,
4000
- {
4001
- ...a,
4002
- ref: d,
4003
- style: { pointerEvents: "none" },
4004
- children: hs(c.value) ? /* @__PURE__ */ R.jsx(R.Fragment, { children: i }) : s
4005
- }
4006
- );
4007
- }
4008
- );
4009
- Ko.displayName = zo;
4010
- var Ic = "SelectIcon", Yo = l.forwardRef(
4011
- (e, r) => {
4012
- const { __scopeSelect: t, children: n, ...o } = e;
4013
- return /* @__PURE__ */ R.jsx(oe.span, { "aria-hidden": !0, ...o, ref: r, children: n || "▼" });
4014
- }
4015
- );
4016
- Yo.displayName = Ic;
4017
- var kc = "SelectPortal", qo = (e) => /* @__PURE__ */ R.jsx(Fo, { asChild: !0, ...e });
4018
- qo.displayName = kc;
4019
- var tt = "SelectContent", Xo = l.forwardRef(
4020
- (e, r) => {
4021
- const t = Ge(tt, e.__scopeSelect), [n, o] = l.useState();
4022
- if (we(() => {
4023
- o(new DocumentFragment());
4024
- }, []), !t.open) {
4025
- const s = n;
4026
- return s ? Jt.createPortal(
4027
- /* @__PURE__ */ R.jsx(Go, { scope: e.__scopeSelect, children: /* @__PURE__ */ R.jsx(or.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ R.jsx("div", { children: e.children }) }) }),
4028
- s
4029
- ) : null;
4030
- }
4031
- return /* @__PURE__ */ R.jsx(Zo, { ...e, ref: r });
4032
- }
4033
- );
4034
- Xo.displayName = tt;
4035
- var Ne = 10, [Go, Ze] = St(tt), Lc = "SelectContentImpl", Zo = l.forwardRef(
4036
- (e, r) => {
4037
- const {
4038
- __scopeSelect: t,
4039
- position: n = "item-aligned",
4040
- onCloseAutoFocus: o,
4041
- onEscapeKeyDown: s,
4042
- onPointerDownOutside: i,
4043
- //
4044
- // PopperContent props
4045
- side: a,
4046
- sideOffset: c,
4047
- align: f,
4048
- alignOffset: h,
4049
- arrowPadding: d,
4050
- collisionBoundary: m,
4051
- collisionPadding: w,
4052
- sticky: v,
4053
- hideWhenDetached: p,
4054
- avoidCollisions: S,
4055
- //
4056
- ...b
4057
- } = e, y = Ge(tt, t), [E, P] = l.useState(null), [x, A] = l.useState(null), _ = le(r, (W) => P(W)), [M, H] = l.useState(null), [U, J] = l.useState(
4058
- null
4059
- ), D = sr(t), [I, B] = l.useState(!1), k = l.useRef(!1);
4060
- l.useEffect(() => {
4061
- if (E) return Ya(E);
4062
- }, [E]), _i();
4063
- const $ = l.useCallback(
4064
- (W) => {
4065
- const [q, ...se] = D().map((K) => K.ref.current), [X] = se.slice(-1), z = document.activeElement;
4066
- for (const K of W)
4067
- if (K === z || (K == null || K.scrollIntoView({ block: "nearest" }), K === q && x && (x.scrollTop = 0), K === X && x && (x.scrollTop = x.scrollHeight), K == null || K.focus(), document.activeElement !== z)) return;
4068
- },
4069
- [D, x]
4070
- ), L = l.useCallback(
4071
- () => $([M, E]),
4072
- [$, M, E]
4073
- );
4074
- l.useEffect(() => {
4075
- I && L();
4076
- }, [I, L]);
4077
- const { onOpenChange: Z, triggerPointerDownPosRef: ee } = y;
4078
- l.useEffect(() => {
4079
- if (E) {
4080
- let W = { x: 0, y: 0 };
4081
- const q = (X) => {
4082
- var z, K;
4083
- W = {
4084
- x: Math.abs(Math.round(X.pageX) - (((z = ee.current) == null ? void 0 : z.x) ?? 0)),
4085
- y: Math.abs(Math.round(X.pageY) - (((K = ee.current) == null ? void 0 : K.y) ?? 0))
4086
- };
4087
- }, se = (X) => {
4088
- W.x <= 10 && W.y <= 10 ? X.preventDefault() : E.contains(X.target) || Z(!1), document.removeEventListener("pointermove", q), ee.current = null;
4089
- };
4090
- return ee.current !== null && (document.addEventListener("pointermove", q), document.addEventListener("pointerup", se, { capture: !0, once: !0 })), () => {
4091
- document.removeEventListener("pointermove", q), document.removeEventListener("pointerup", se, { capture: !0 });
4092
- };
4093
- }
4094
- }, [E, Z, ee]), l.useEffect(() => {
4095
- const W = () => Z(!1);
4096
- return window.addEventListener("blur", W), window.addEventListener("resize", W), () => {
4097
- window.removeEventListener("blur", W), window.removeEventListener("resize", W);
4098
- };
4099
- }, [Z]);
4100
- const [Se, xe] = ms((W) => {
4101
- const q = D().filter((z) => !z.disabled), se = q.find((z) => z.ref.current === document.activeElement), X = vs(q, W, se);
4102
- X && setTimeout(() => X.ref.current.focus());
4103
- }), Be = l.useCallback(
4104
- (W, q, se) => {
4105
- const X = !k.current && !se;
4106
- (y.value !== void 0 && y.value === q || X) && (H(W), X && (k.current = !0));
4107
- },
4108
- [y.value]
4109
- ), Qe = l.useCallback(() => E == null ? void 0 : E.focus(), [E]), Ce = l.useCallback(
4110
- (W, q, se) => {
4111
- const X = !k.current && !se;
4112
- (y.value !== void 0 && y.value === q || X) && J(W);
4113
- },
4114
- [y.value]
4115
- ), We = n === "popper" ? kr : Qo, Ee = We === kr ? {
4116
- side: a,
4117
- sideOffset: c,
4118
- align: f,
4119
- alignOffset: h,
4120
- arrowPadding: d,
4121
- collisionBoundary: m,
4122
- collisionPadding: w,
4123
- sticky: v,
4124
- hideWhenDetached: p,
4125
- avoidCollisions: S
4126
- } : {};
4127
- return /* @__PURE__ */ R.jsx(
4128
- Go,
4129
- {
4130
- scope: t,
4131
- content: E,
4132
- viewport: x,
4133
- onViewportChange: A,
4134
- itemRefCallback: Be,
4135
- selectedItem: M,
4136
- onItemLeave: Qe,
4137
- itemTextRefCallback: Ce,
4138
- focusSelectedItem: L,
4139
- selectedItemText: U,
4140
- position: n,
4141
- isPositioned: I,
4142
- searchRef: Se,
4143
- children: /* @__PURE__ */ R.jsx(Wo, { as: gt, allowPinchZoom: !0, children: /* @__PURE__ */ R.jsx(
4144
- co,
4145
- {
4146
- asChild: !0,
4147
- trapped: y.open,
4148
- onMountAutoFocus: (W) => {
4149
- W.preventDefault();
4150
- },
4151
- onUnmountAutoFocus: ce(o, (W) => {
4152
- var q;
4153
- (q = y.trigger) == null || q.focus({ preventScroll: !0 }), W.preventDefault();
4154
- }),
4155
- children: /* @__PURE__ */ R.jsx(
4156
- io,
4157
- {
4158
- asChild: !0,
4159
- disableOutsidePointerEvents: !0,
4160
- onEscapeKeyDown: s,
4161
- onPointerDownOutside: i,
4162
- onFocusOutside: (W) => W.preventDefault(),
4163
- onDismiss: () => y.onOpenChange(!1),
4164
- children: /* @__PURE__ */ R.jsx(
4165
- We,
4166
- {
4167
- role: "listbox",
4168
- id: y.contentId,
4169
- "data-state": y.open ? "open" : "closed",
4170
- dir: y.dir,
4171
- onContextMenu: (W) => W.preventDefault(),
4172
- ...b,
4173
- ...Ee,
4174
- onPlaced: () => B(!0),
4175
- ref: _,
4176
- style: {
4177
- // flex layout so we can place the scroll buttons properly
4178
- display: "flex",
4179
- flexDirection: "column",
4180
- // reset the outline by default as the content MAY get focused
4181
- outline: "none",
4182
- ...b.style
4183
- },
4184
- onKeyDown: ce(b.onKeyDown, (W) => {
4185
- const q = W.ctrlKey || W.altKey || W.metaKey;
4186
- if (W.key === "Tab" && W.preventDefault(), !q && W.key.length === 1 && xe(W.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(W.key)) {
4187
- let X = D().filter((z) => !z.disabled).map((z) => z.ref.current);
4188
- if (["ArrowUp", "End"].includes(W.key) && (X = X.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(W.key)) {
4189
- const z = W.target, K = X.indexOf(z);
4190
- X = X.slice(K + 1);
4191
- }
4192
- setTimeout(() => $(X)), W.preventDefault();
4193
- }
4194
- })
4195
- }
4196
- )
4197
- }
4198
- )
4199
- }
4200
- ) })
4201
- }
4202
- );
4203
- }
4204
- );
4205
- Zo.displayName = Lc;
4206
- var jc = "SelectItemAlignedPosition", Qo = l.forwardRef((e, r) => {
4207
- const { __scopeSelect: t, onPlaced: n, ...o } = e, s = Ge(tt, t), i = Ze(tt, t), [a, c] = l.useState(null), [f, h] = l.useState(null), d = le(r, (_) => h(_)), m = sr(t), w = l.useRef(!1), v = l.useRef(!0), { viewport: p, selectedItem: S, selectedItemText: b, focusSelectedItem: y } = i, E = l.useCallback(() => {
4208
- if (s.trigger && s.valueNode && a && f && p && S && b) {
4209
- const _ = s.trigger.getBoundingClientRect(), M = f.getBoundingClientRect(), H = s.valueNode.getBoundingClientRect(), U = b.getBoundingClientRect();
4210
- if (s.dir !== "rtl") {
4211
- const z = U.left - M.left, K = H.left - z, ue = _.left - K, me = _.width + ue, rt = Math.max(me, M.width), nt = window.innerWidth - Ne, ot = mn(K, [Ne, nt - rt]);
4212
- a.style.minWidth = me + "px", a.style.left = ot + "px";
4213
- } else {
4214
- const z = M.right - U.right, K = window.innerWidth - H.right - z, ue = window.innerWidth - _.right - K, me = _.width + ue, rt = Math.max(me, M.width), nt = window.innerWidth - Ne, ot = mn(K, [Ne, nt - rt]);
4215
- a.style.minWidth = me + "px", a.style.right = ot + "px";
4216
- }
4217
- const J = m(), D = window.innerHeight - Ne * 2, I = p.scrollHeight, B = window.getComputedStyle(f), k = parseInt(B.borderTopWidth, 10), $ = parseInt(B.paddingTop, 10), L = parseInt(B.borderBottomWidth, 10), Z = parseInt(B.paddingBottom, 10), ee = k + $ + I + Z + L, Se = Math.min(S.offsetHeight * 5, ee), xe = window.getComputedStyle(p), Be = parseInt(xe.paddingTop, 10), Qe = parseInt(xe.paddingBottom, 10), Ce = _.top + _.height / 2 - Ne, We = D - Ce, Ee = S.offsetHeight / 2, W = S.offsetTop + Ee, q = k + $ + W, se = ee - q;
4218
- if (q <= Ce) {
4219
- const z = S === J[J.length - 1].ref.current;
4220
- a.style.bottom = "0px";
4221
- const K = f.clientHeight - p.offsetTop - p.offsetHeight, ue = Math.max(
4222
- We,
4223
- Ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
4224
- (z ? Qe : 0) + K + L
4225
- ), me = q + ue;
4226
- a.style.height = me + "px";
4227
- } else {
4228
- const z = S === J[0].ref.current;
4229
- a.style.top = "0px";
4230
- const ue = Math.max(
4231
- Ce,
4232
- k + p.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
4233
- (z ? Be : 0) + Ee
4234
- ) + se;
4235
- a.style.height = ue + "px", p.scrollTop = q - Ce + p.offsetTop;
4236
- }
4237
- a.style.margin = `${Ne}px 0`, a.style.minHeight = Se + "px", a.style.maxHeight = D + "px", n == null || n(), requestAnimationFrame(() => w.current = !0);
4238
- }
4239
- }, [
4240
- m,
4241
- s.trigger,
4242
- s.valueNode,
4243
- a,
4244
- f,
4245
- p,
4246
- S,
4247
- b,
4248
- s.dir,
4249
- n
4250
- ]);
4251
- we(() => E(), [E]);
4252
- const [P, x] = l.useState();
4253
- we(() => {
4254
- f && x(window.getComputedStyle(f).zIndex);
4255
- }, [f]);
4256
- const A = l.useCallback(
4257
- (_) => {
4258
- _ && v.current === !0 && (E(), y == null || y(), v.current = !1);
4259
- },
4260
- [E, y]
4261
- );
4262
- return /* @__PURE__ */ R.jsx(
4263
- Wc,
4264
- {
4265
- scope: t,
4266
- contentWrapper: a,
4267
- shouldExpandOnScrollRef: w,
4268
- onScrollButtonChange: A,
4269
- children: /* @__PURE__ */ R.jsx(
4270
- "div",
4271
- {
4272
- ref: c,
4273
- style: {
4274
- display: "flex",
4275
- flexDirection: "column",
4276
- position: "fixed",
4277
- zIndex: P
4278
- },
4279
- children: /* @__PURE__ */ R.jsx(
4280
- oe.div,
4281
- {
4282
- ...o,
4283
- ref: d,
4284
- style: {
4285
- // When we get the height of the content, it includes borders. If we were to set
4286
- // the height without having `boxSizing: 'border-box'` it would be too big.
4287
- boxSizing: "border-box",
4288
- // We need to ensure the content doesn't get taller than the wrapper
4289
- maxHeight: "100%",
4290
- ...o.style
4291
- }
4292
- }
4293
- )
4294
- }
4295
- )
4296
- }
4297
- );
4298
- });
4299
- Qo.displayName = jc;
4300
- var Bc = "SelectPopperPosition", kr = l.forwardRef((e, r) => {
4301
- const {
4302
- __scopeSelect: t,
4303
- align: n = "start",
4304
- collisionPadding: o = Ne,
4305
- ...s
4306
- } = e, i = ir(t);
4307
- return /* @__PURE__ */ R.jsx(
4308
- La,
4309
- {
4310
- ...i,
4311
- ...s,
4312
- ref: r,
4313
- align: n,
4314
- collisionPadding: o,
4315
- style: {
4316
- // Ensure border-box for floating-ui calculations
4317
- boxSizing: "border-box",
4318
- ...s.style,
4319
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
4320
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
4321
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
4322
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
4323
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
4324
- }
4325
- }
4326
- );
4327
- });
4328
- kr.displayName = Bc;
4329
- var [Wc, nn] = St(tt, {}), Lr = "SelectViewport", Jo = l.forwardRef(
4330
- (e, r) => {
4331
- const { __scopeSelect: t, nonce: n, ...o } = e, s = Ze(Lr, t), i = nn(Lr, t), a = le(r, s.onViewportChange), c = l.useRef(0);
4332
- return /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
4333
- /* @__PURE__ */ R.jsx(
4334
- "style",
4335
- {
4336
- dangerouslySetInnerHTML: {
4337
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
4338
- },
4339
- nonce: n
4340
- }
4341
- ),
4342
- /* @__PURE__ */ R.jsx(or.Slot, { scope: t, children: /* @__PURE__ */ R.jsx(
4343
- oe.div,
4344
- {
4345
- "data-radix-select-viewport": "",
4346
- role: "presentation",
4347
- ...o,
4348
- ref: a,
4349
- style: {
4350
- // we use position: 'relative' here on the `viewport` so that when we call
4351
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
4352
- // (independent of the scrollUpButton).
4353
- position: "relative",
4354
- flex: 1,
4355
- overflow: "auto",
4356
- ...o.style
4357
- },
4358
- onScroll: ce(o.onScroll, (f) => {
4359
- const h = f.currentTarget, { contentWrapper: d, shouldExpandOnScrollRef: m } = i;
4360
- if (m != null && m.current && d) {
4361
- const w = Math.abs(c.current - h.scrollTop);
4362
- if (w > 0) {
4363
- const v = window.innerHeight - Ne * 2, p = parseFloat(d.style.minHeight), S = parseFloat(d.style.height), b = Math.max(p, S);
4364
- if (b < v) {
4365
- const y = b + w, E = Math.min(v, y), P = y - E;
4366
- d.style.height = E + "px", d.style.bottom === "0px" && (h.scrollTop = P > 0 ? P : 0, d.style.justifyContent = "flex-end");
4367
- }
4368
- }
4369
- }
4370
- c.current = h.scrollTop;
4371
- })
4372
- }
4373
- ) })
4374
- ] });
4375
- }
4376
- );
4377
- Jo.displayName = Lr;
4378
- var es = "SelectGroup", [Hc, Uc] = St(es), ts = l.forwardRef(
4379
- (e, r) => {
4380
- const { __scopeSelect: t, ...n } = e, o = Yr();
4381
- return /* @__PURE__ */ R.jsx(Hc, { scope: t, id: o, children: /* @__PURE__ */ R.jsx(oe.div, { role: "group", "aria-labelledby": o, ...n, ref: r }) });
4382
- }
4383
- );
4384
- ts.displayName = es;
4385
- var rs = "SelectLabel", ns = l.forwardRef(
4386
- (e, r) => {
4387
- const { __scopeSelect: t, ...n } = e, o = Uc(rs, t);
4388
- return /* @__PURE__ */ R.jsx(oe.div, { id: o.id, ...n, ref: r });
4389
- }
4390
- );
4391
- ns.displayName = rs;
4392
- var Qt = "SelectItem", [$c, os] = St(Qt), ss = l.forwardRef(
4393
- (e, r) => {
4394
- const {
4395
- __scopeSelect: t,
4396
- value: n,
4397
- disabled: o = !1,
4398
- textValue: s,
4399
- ...i
4400
- } = e, a = Ge(Qt, t), c = Ze(Qt, t), f = a.value === n, [h, d] = l.useState(s ?? ""), [m, w] = l.useState(!1), v = le(
4401
- r,
4402
- (b) => {
4403
- var y;
4404
- return (y = c.itemRefCallback) == null ? void 0 : y.call(c, b, n, o);
4405
- }
4406
- ), p = Yr(), S = () => {
4407
- o || (a.onValueChange(n), a.onOpenChange(!1));
4408
- };
4409
- if (n === "")
4410
- throw new Error(
4411
- "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
4412
- );
4413
- return /* @__PURE__ */ R.jsx(
4414
- $c,
4415
- {
4416
- scope: t,
4417
- value: n,
4418
- disabled: o,
4419
- textId: p,
4420
- isSelected: f,
4421
- onItemTextChange: l.useCallback((b) => {
4422
- d((y) => y || ((b == null ? void 0 : b.textContent) ?? "").trim());
4423
- }, []),
4424
- children: /* @__PURE__ */ R.jsx(
4425
- or.ItemSlot,
4426
- {
4427
- scope: t,
4428
- value: n,
4429
- disabled: o,
4430
- textValue: h,
4431
- children: /* @__PURE__ */ R.jsx(
4432
- oe.div,
4433
- {
4434
- role: "option",
4435
- "aria-labelledby": p,
4436
- "data-highlighted": m ? "" : void 0,
4437
- "aria-selected": f && m,
4438
- "data-state": f ? "checked" : "unchecked",
4439
- "aria-disabled": o || void 0,
4440
- "data-disabled": o ? "" : void 0,
4441
- tabIndex: o ? void 0 : -1,
4442
- ...i,
4443
- ref: v,
4444
- onFocus: ce(i.onFocus, () => w(!0)),
4445
- onBlur: ce(i.onBlur, () => w(!1)),
4446
- onPointerUp: ce(i.onPointerUp, S),
4447
- onPointerMove: ce(i.onPointerMove, (b) => {
4448
- var y;
4449
- o ? (y = c.onItemLeave) == null || y.call(c) : b.currentTarget.focus({ preventScroll: !0 });
4450
- }),
4451
- onPointerLeave: ce(i.onPointerLeave, (b) => {
4452
- var y;
4453
- b.currentTarget === document.activeElement && ((y = c.onItemLeave) == null || y.call(c));
4454
- }),
4455
- onKeyDown: ce(i.onKeyDown, (b) => {
4456
- var E;
4457
- ((E = c.searchRef) == null ? void 0 : E.current) !== "" && b.key === " " || (Fc.includes(b.key) && S(), b.key === " " && b.preventDefault());
4458
- })
4459
- }
4460
- )
4461
- }
4462
- )
4463
- }
4464
- );
4465
- }
4466
- );
4467
- ss.displayName = Qt;
4468
- var Et = "SelectItemText", is = l.forwardRef(
4469
- (e, r) => {
4470
- const { __scopeSelect: t, className: n, style: o, ...s } = e, i = Ge(Et, t), a = Ze(Et, t), c = os(Et, t), f = Vc(Et, t), [h, d] = l.useState(null), m = le(
4471
- r,
4472
- (b) => d(b),
4473
- c.onItemTextChange,
4474
- (b) => {
4475
- var y;
4476
- return (y = a.itemTextRefCallback) == null ? void 0 : y.call(a, b, c.value, c.disabled);
4477
- }
4478
- ), w = h == null ? void 0 : h.textContent, v = l.useMemo(
4479
- () => /* @__PURE__ */ R.jsx("option", { value: c.value, disabled: c.disabled, children: w }, c.value),
4480
- [c.disabled, c.value, w]
4481
- ), { onNativeOptionAdd: p, onNativeOptionRemove: S } = f;
4482
- return we(() => (p(v), () => S(v)), [p, S, v]), /* @__PURE__ */ R.jsxs(R.Fragment, { children: [
4483
- /* @__PURE__ */ R.jsx(oe.span, { id: c.textId, ...s, ref: m }),
4484
- c.isSelected && i.valueNode && !i.valueNodeHasChildren ? Jt.createPortal(s.children, i.valueNode) : null
4485
- ] });
4486
- }
4487
- );
4488
- is.displayName = Et;
4489
- var as = "SelectItemIndicator", cs = l.forwardRef(
4490
- (e, r) => {
4491
- const { __scopeSelect: t, ...n } = e;
4492
- return os(as, t).isSelected ? /* @__PURE__ */ R.jsx(oe.span, { "aria-hidden": !0, ...n, ref: r }) : null;
4493
- }
4494
- );
4495
- cs.displayName = as;
4496
- var jr = "SelectScrollUpButton", ls = l.forwardRef((e, r) => {
4497
- const t = Ze(jr, e.__scopeSelect), n = nn(jr, e.__scopeSelect), [o, s] = l.useState(!1), i = le(r, n.onScrollButtonChange);
4498
- return we(() => {
4499
- if (t.viewport && t.isPositioned) {
4500
- let a = function() {
4501
- const f = c.scrollTop > 0;
4502
- s(f);
4503
- };
4504
- const c = t.viewport;
4505
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
4506
- }
4507
- }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ R.jsx(
4508
- fs,
4509
- {
4510
- ...e,
4511
- ref: i,
4512
- onAutoScroll: () => {
4513
- const { viewport: a, selectedItem: c } = t;
4514
- a && c && (a.scrollTop = a.scrollTop - c.offsetHeight);
4515
- }
4516
- }
4517
- ) : null;
4518
- });
4519
- ls.displayName = jr;
4520
- var Br = "SelectScrollDownButton", us = l.forwardRef((e, r) => {
4521
- const t = Ze(Br, e.__scopeSelect), n = nn(Br, e.__scopeSelect), [o, s] = l.useState(!1), i = le(r, n.onScrollButtonChange);
4522
- return we(() => {
4523
- if (t.viewport && t.isPositioned) {
4524
- let a = function() {
4525
- const f = c.scrollHeight - c.clientHeight, h = Math.ceil(c.scrollTop) < f;
4526
- s(h);
4527
- };
4528
- const c = t.viewport;
4529
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
4530
- }
4531
- }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ R.jsx(
4532
- fs,
4533
- {
4534
- ...e,
4535
- ref: i,
4536
- onAutoScroll: () => {
4537
- const { viewport: a, selectedItem: c } = t;
4538
- a && c && (a.scrollTop = a.scrollTop + c.offsetHeight);
4539
- }
4540
- }
4541
- ) : null;
4542
- });
4543
- us.displayName = Br;
4544
- var fs = l.forwardRef((e, r) => {
4545
- const { __scopeSelect: t, onAutoScroll: n, ...o } = e, s = Ze("SelectScrollButton", t), i = l.useRef(null), a = sr(t), c = l.useCallback(() => {
4546
- i.current !== null && (window.clearInterval(i.current), i.current = null);
4547
- }, []);
4548
- return l.useEffect(() => () => c(), [c]), we(() => {
4549
- var h;
4550
- const f = a().find((d) => d.ref.current === document.activeElement);
4551
- (h = f == null ? void 0 : f.ref.current) == null || h.scrollIntoView({ block: "nearest" });
4552
- }, [a]), /* @__PURE__ */ R.jsx(
4553
- oe.div,
4554
- {
4555
- "aria-hidden": !0,
4556
- ...o,
4557
- ref: r,
4558
- style: { flexShrink: 0, ...o.style },
4559
- onPointerDown: ce(o.onPointerDown, () => {
4560
- i.current === null && (i.current = window.setInterval(n, 50));
4561
- }),
4562
- onPointerMove: ce(o.onPointerMove, () => {
4563
- var f;
4564
- (f = s.onItemLeave) == null || f.call(s), i.current === null && (i.current = window.setInterval(n, 50));
4565
- }),
4566
- onPointerLeave: ce(o.onPointerLeave, () => {
4567
- c();
4568
- })
4569
- }
4570
- );
4571
- }), zc = "SelectSeparator", ds = l.forwardRef(
4572
- (e, r) => {
4573
- const { __scopeSelect: t, ...n } = e;
4574
- return /* @__PURE__ */ R.jsx(oe.div, { "aria-hidden": !0, ...n, ref: r });
4575
- }
4576
- );
4577
- ds.displayName = zc;
4578
- var Wr = "SelectArrow", Kc = l.forwardRef(
4579
- (e, r) => {
4580
- const { __scopeSelect: t, ...n } = e, o = ir(t), s = Ge(Wr, t), i = Ze(Wr, t);
4581
- return s.open && i.position === "popper" ? /* @__PURE__ */ R.jsx(ja, { ...o, ...n, ref: r }) : null;
4582
- }
4583
- );
4584
- Kc.displayName = Wr;
4585
- function hs(e) {
4586
- return e === "" || e === void 0;
4587
- }
4588
- var ps = l.forwardRef(
4589
- (e, r) => {
4590
- const { value: t, ...n } = e, o = l.useRef(null), s = le(r, o), i = Ha(t);
4591
- return l.useEffect(() => {
4592
- const a = o.current, c = window.HTMLSelectElement.prototype, h = Object.getOwnPropertyDescriptor(
4593
- c,
4594
- "value"
4595
- ).set;
4596
- if (i !== t && h) {
4597
- const d = new Event("change", { bubbles: !0 });
4598
- h.call(a, t), a.dispatchEvent(d);
4599
- }
4600
- }, [i, t]), /* @__PURE__ */ R.jsx(No, { asChild: !0, children: /* @__PURE__ */ R.jsx("select", { ...n, ref: s, defaultValue: t }) });
4601
- }
4602
- );
4603
- ps.displayName = "BubbleSelect";
4604
- function ms(e) {
4605
- const r = Ie(e), t = l.useRef(""), n = l.useRef(0), o = l.useCallback(
4606
- (i) => {
4607
- const a = t.current + i;
4608
- r(a), function c(f) {
4609
- t.current = f, window.clearTimeout(n.current), f !== "" && (n.current = window.setTimeout(() => c(""), 1e3));
4610
- }(a);
4611
- },
4612
- [r]
4613
- ), s = l.useCallback(() => {
4614
- t.current = "", window.clearTimeout(n.current);
4615
- }, []);
4616
- return l.useEffect(() => () => window.clearTimeout(n.current), []), [t, o, s];
4617
- }
4618
- function vs(e, r, t) {
4619
- const o = r.length > 1 && Array.from(r).every((f) => f === r[0]) ? r[0] : r, s = t ? e.indexOf(t) : -1;
4620
- let i = Yc(e, Math.max(s, 0));
4621
- o.length === 1 && (i = i.filter((f) => f !== t));
4622
- const c = i.find(
4623
- (f) => f.textValue.toLowerCase().startsWith(o.toLowerCase())
4624
- );
4625
- return c !== t ? c : void 0;
4626
- }
4627
- function Yc(e, r) {
4628
- return e.map((t, n) => e[(r + n) % e.length]);
4629
- }
4630
- var qc = Ho, gs = $o, Xc = Ko, Gc = Yo, Zc = qo, ys = Xo, Qc = Jo, Jc = ts, ws = ns, xs = ss, el = is, tl = cs, bs = ls, Ss = us, Cs = ds;
4631
- const Sl = qc, Cl = Jc, El = Xc, rl = l.forwardRef(({ className: e, children: r, ...t }, n) => /* @__PURE__ */ R.jsxs(
4632
- gs,
4633
- {
4634
- ref: n,
4635
- className: Ve(
4636
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
4637
- e
4638
- ),
4639
- ...t,
4640
- children: [
4641
- /* @__PURE__ */ R.jsx("span", { className: "truncate", children: r }),
4642
- /* @__PURE__ */ R.jsx(Gc, { asChild: !0, children: /* @__PURE__ */ R.jsx(Wn, { className: "flex-shrink-0 h-4 w-4 opacity-50" }) })
4643
- ]
4644
- }
4645
- ));
4646
- rl.displayName = gs.displayName;
4647
- const Es = l.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ R.jsx(
4648
- bs,
4649
- {
4650
- ref: t,
4651
- className: Ve(
4652
- "flex cursor-default items-center justify-center py-1",
4653
- e
4654
- ),
4655
- ...r,
4656
- children: /* @__PURE__ */ R.jsx(Ws, { className: "h-4 w-4" })
4657
- }
4658
- ));
4659
- Es.displayName = bs.displayName;
4660
- const As = l.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ R.jsx(
4661
- Ss,
4662
- {
4663
- ref: t,
4664
- className: Ve(
4665
- "flex cursor-default items-center justify-center py-1",
4666
- e
4667
- ),
4668
- ...r,
4669
- children: /* @__PURE__ */ R.jsx(Wn, { className: "h-4 w-4" })
4670
- }
4671
- ));
4672
- As.displayName = Ss.displayName;
4673
- const nl = l.forwardRef(({ className: e, children: r, position: t = "popper", ...n }, o) => /* @__PURE__ */ R.jsx(Zc, { children: /* @__PURE__ */ R.jsxs(
4674
- ys,
4675
- {
4676
- ref: o,
4677
- className: Ve(
4678
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
4679
- t === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
4680
- e
4681
- ),
4682
- position: t,
4683
- ...n,
4684
- children: [
4685
- /* @__PURE__ */ R.jsx(Es, {}),
4686
- /* @__PURE__ */ R.jsx(
4687
- Qc,
4688
- {
4689
- className: Ve(
4690
- "p-1",
4691
- t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
4692
- ),
4693
- children: r
4694
- }
4695
- ),
4696
- /* @__PURE__ */ R.jsx(As, {})
4697
- ]
4698
- }
4699
- ) }));
4700
- nl.displayName = ys.displayName;
4701
- const ol = l.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ R.jsx(
4702
- ws,
4703
- {
4704
- ref: t,
4705
- className: Ve("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
4706
- ...r
4707
- }
4708
- ));
4709
- ol.displayName = ws.displayName;
4710
- const sl = l.forwardRef(({ className: e, children: r, ...t }, n) => /* @__PURE__ */ R.jsxs(
4711
- xs,
4712
- {
4713
- ref: n,
4714
- className: Ve(
4715
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
4716
- e
4717
- ),
4718
- ...t,
4719
- children: [
4720
- /* @__PURE__ */ R.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ R.jsx(tl, { children: /* @__PURE__ */ R.jsx(js, { className: "h-4 w-4" }) }) }),
4721
- /* @__PURE__ */ R.jsx(el, { children: r })
4722
- ]
4723
- }
4724
- ));
4725
- sl.displayName = xs.displayName;
4726
- const il = l.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ R.jsx(
4727
- Cs,
4728
- {
4729
- ref: t,
4730
- className: Ve("-mx-1 my-1 h-px bg-muted", e),
4731
- ...r
4732
- }
4733
- ));
4734
- il.displayName = Cs.displayName;
4735
- export {
4736
- Xs as B,
4737
- gl as C,
4738
- io as D,
4739
- co as F,
4740
- oe as P,
4741
- Wo as R,
4742
- Sl as S,
4743
- No as V,
4744
- ml as a,
4745
- rl as b,
4746
- El as c,
4747
- nl as d,
4748
- Cl as e,
4749
- sl as f,
4750
- hi as g,
4751
- Kr as h,
4752
- le as i,
4753
- mi as j,
4754
- Nn as k,
4755
- Ie as l,
4756
- ce as m,
4757
- Yr as n,
4758
- we as o,
4759
- gt as p,
4760
- Ya as q,
4761
- _i as r,
4762
- xl as s,
4763
- Fo as t,
4764
- wl as u,
4765
- yl as v,
4766
- Js as w,
4767
- er as x,
4768
- vl as y
4769
- };
4770
- //# sourceMappingURL=Select-DSa3bN4t.js.map