zudoku 0.3.0-dev.52 → 0.3.0-dev.54

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