zudoku 0.7.2-dev.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/app/main.js +19 -0
  2. package/dist/app/main.js.map +1 -1
  3. package/dist/cli/dev/handler.js +5 -0
  4. package/dist/cli/dev/handler.js.map +1 -1
  5. package/dist/config/validators/validate.d.ts +122 -0
  6. package/dist/config/validators/validate.js +44 -0
  7. package/dist/config/validators/validate.js.map +1 -1
  8. package/dist/lib/components/context/ZudokuContext.d.ts +2 -0
  9. package/dist/lib/core/DevPortalContext.d.ts +1 -0
  10. package/dist/vite/config.d.ts +2 -2
  11. package/dist/vite/config.js +21 -20
  12. package/dist/vite/config.js.map +1 -1
  13. package/dist/vite/config.test.js +1 -4
  14. package/dist/vite/config.test.js.map +1 -1
  15. package/dist/vite/dev-server.js +1 -4
  16. package/dist/vite/dev-server.js.map +1 -1
  17. package/dist/vite/prerender.js +7 -0
  18. package/dist/vite/prerender.js.map +1 -1
  19. package/dist/vite/sitemap.js +33 -29
  20. package/dist/vite/sitemap.js.map +1 -1
  21. package/lib/AuthenticationPlugin-Bx9FK124.js +55 -0
  22. package/lib/{AuthenticationPlugin-BMjOjKqE.js.map → AuthenticationPlugin-Bx9FK124.js.map} +1 -1
  23. package/lib/CategoryHeading-XnFqN2lJ.js +10 -0
  24. package/lib/{CategoryHeading-BE8e6QdS.js.map → CategoryHeading-XnFqN2lJ.js.map} +1 -1
  25. package/lib/DeveloperHint-FBb2uXJe.js +16 -0
  26. package/lib/{DeveloperHint-Bl9gIdNI.js.map → DeveloperHint-FBb2uXJe.js.map} +1 -1
  27. package/lib/ErrorPage-knunPbKI.js +18 -0
  28. package/lib/{ErrorPage-CPR1XVKW.js.map → ErrorPage-knunPbKI.js.map} +1 -1
  29. package/lib/Input-BEDZAKw0.js +2198 -0
  30. package/lib/{Input-BBlyeDuG.js.map → Input-BEDZAKw0.js.map} +1 -1
  31. package/lib/{Markdown-CCNihH_N.js → Markdown-B4aR03g6.js} +2650 -2641
  32. package/lib/{Markdown-CCNihH_N.js.map → Markdown-B4aR03g6.js.map} +1 -1
  33. package/lib/MdxPage-BZyQsH8Z.js +172 -0
  34. package/lib/{MdxPage-BavkYqzi.js.map → MdxPage-BZyQsH8Z.js.map} +1 -1
  35. package/lib/OperationList-2NeWEM0u.js +560 -0
  36. package/lib/{OperationList-C6Ps2keZ.js.map → OperationList-2NeWEM0u.js.map} +1 -1
  37. package/lib/Route-BZPewmrN.js +14 -0
  38. package/lib/{Route-xRJ9mJgH.js.map → Route-BZPewmrN.js.map} +1 -1
  39. package/lib/{SidebarBadge-2JcxswKF.js → SidebarBadge-COz0hgfa.js} +41 -41
  40. package/lib/{SidebarBadge-2JcxswKF.js.map → SidebarBadge-COz0hgfa.js.map} +1 -1
  41. package/lib/SlotletProvider-DJMaOUDs.js +238 -0
  42. package/lib/{SlotletProvider-CuB3Ts8r.js.map → SlotletProvider-DJMaOUDs.js.map} +1 -1
  43. package/lib/Spinner-3cQDBVGr.js +7 -0
  44. package/lib/Spinner-3cQDBVGr.js.map +1 -0
  45. package/lib/{ZudokuContext-JoyeA9dT.js → ZudokuContext-cr-pTRY1.js} +66 -65
  46. package/lib/{ZudokuContext-JoyeA9dT.js.map → ZudokuContext-cr-pTRY1.js.map} +1 -1
  47. package/lib/{index-G1-TGLO1.js → index-1EDgIO6b.js} +4 -4
  48. package/lib/{index-G1-TGLO1.js.map → index-1EDgIO6b.js.map} +1 -1
  49. package/lib/index-BG0g4WW0.js +1771 -0
  50. package/lib/index-BG0g4WW0.js.map +1 -0
  51. package/lib/{index-BF4cn28H.js → index-Dv2KZuEw.js} +1991 -1804
  52. package/lib/{index-BF4cn28H.js.map → index-Dv2KZuEw.js.map} +1 -1
  53. package/lib/{index-BLvMkqjO.js → index-Zezcv0xb.js} +5 -5
  54. package/lib/{index-BLvMkqjO.js.map → index-Zezcv0xb.js.map} +1 -1
  55. package/lib/jsx-runtime-B6kdoens.js +635 -0
  56. package/lib/jsx-runtime-B6kdoens.js.map +1 -0
  57. package/lib/{utils-B8R4grFM.js → utils-ByIc_KIM.js} +98 -97
  58. package/lib/{utils-B8R4grFM.js.map → utils-ByIc_KIM.js.map} +1 -1
  59. package/lib/zudoku.auth-auth0.js +21 -16
  60. package/lib/zudoku.auth-auth0.js.map +1 -1
  61. package/lib/zudoku.auth-clerk.js +37 -32
  62. package/lib/zudoku.auth-clerk.js.map +1 -1
  63. package/lib/zudoku.auth-openid.js +505 -485
  64. package/lib/zudoku.auth-openid.js.map +1 -1
  65. package/lib/zudoku.components.js +1659 -1531
  66. package/lib/zudoku.components.js.map +1 -1
  67. package/lib/zudoku.plugin-api-keys.js +214 -150
  68. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  69. package/lib/zudoku.plugin-custom-page.js +6 -5
  70. package/lib/zudoku.plugin-custom-page.js.map +1 -1
  71. package/lib/zudoku.plugin-markdown.js +13 -12
  72. package/lib/zudoku.plugin-markdown.js.map +1 -1
  73. package/lib/zudoku.plugin-openapi.js +8 -7
  74. package/lib/zudoku.plugin-openapi.js.map +1 -1
  75. package/lib/zudoku.plugin-search-inkeep.js +21 -20
  76. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  77. package/package.json +3 -2
  78. package/src/app/main.tsx +22 -1
  79. package/src/lib/core/DevPortalContext.ts +1 -1
  80. package/dist/lib/util/fetchTimeout.d.ts +0 -1
  81. package/dist/lib/util/fetchTimeout.js +0 -14
  82. package/dist/lib/util/fetchTimeout.js.map +0 -1
  83. package/dist/vite/esbuild-yaml.d.ts +0 -2
  84. package/dist/vite/esbuild-yaml.js +0 -50
  85. package/dist/vite/esbuild-yaml.js.map +0 -1
  86. package/dist/vite/plugin-vercel.d.ts +0 -3
  87. package/dist/vite/plugin-vercel.js +0 -8
  88. package/dist/vite/plugin-vercel.js.map +0 -1
  89. package/dist/vite/plugin-yaml.d.ts +0 -3
  90. package/dist/vite/plugin-yaml.js +0 -24
  91. package/dist/vite/plugin-yaml.js.map +0 -1
  92. package/lib/AuthenticationPlugin-BMjOjKqE.js +0 -54
  93. package/lib/CategoryHeading-BE8e6QdS.js +0 -9
  94. package/lib/DeveloperHint-Bl9gIdNI.js +0 -12
  95. package/lib/ErrorPage-CPR1XVKW.js +0 -12
  96. package/lib/Input-BBlyeDuG.js +0 -2192
  97. package/lib/MdxPage-BavkYqzi.js +0 -140
  98. package/lib/OperationList-C6Ps2keZ.js +0 -460
  99. package/lib/Route-xRJ9mJgH.js +0 -13
  100. package/lib/SlotletProvider-CuB3Ts8r.js +0 -213
  101. package/lib/Spinner-BlxzaFFF.js +0 -6
  102. package/lib/Spinner-BlxzaFFF.js.map +0 -1
  103. package/lib/jsx-runtime-lNnQYwFN.js +0 -2403
  104. package/lib/jsx-runtime-lNnQYwFN.js.map +0 -1
@@ -0,0 +1,2198 @@
1
+ var zt = (e) => {
2
+ throw TypeError(e);
3
+ };
4
+ var St = (e, r, t) => r.has(e) || zt("Cannot " + t);
5
+ var G = (e, r, t) => (St(e, r, "read from private field"), t ? t.call(e) : r.get(e)), Ue = (e, r, t) => r.has(e) ? zt("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), He = (e, r, t, s) => (St(e, r, "write to private field"), s ? s.call(e, t) : r.set(e, t), t), We = (e, r, t) => (St(e, r, "access private method"), t);
6
+ import * as h from "react";
7
+ import I from "react";
8
+ import { n as fs, f as ps, c as hs, o as nr, d as xe, A as ms, P as he, b as ne, e as Ne, i as ys, j as gs, R as vs, S as xs, F as Ss, D as _s, C as bs, a as Bt, p as ws, V as As, h as Cs, l as Vs, g as Es, u as Yt, q as Fs } from "./index-Zezcv0xb.js";
9
+ import { S as Ts, s as Rs, h as Xt, n as ir, a as Is, d as Ns, e as Ds } from "./ZudokuContext-cr-pTRY1.js";
10
+ import { j as b } from "./jsx-runtime-B6kdoens.js";
11
+ import * as ar from "react-dom";
12
+ import { ChevronDown as lr, ChevronUp as Ps, Check as ks } from "lucide-react";
13
+ import { a as Ee } from "./Markdown-B4aR03g6.js";
14
+ var Te, Re, ae, Ce, Ve, nt, Nt, or, Ms = (or = class extends Ts {
15
+ constructor(r, t) {
16
+ super();
17
+ Ue(this, Ve);
18
+ Ue(this, Te);
19
+ Ue(this, Re);
20
+ Ue(this, ae);
21
+ Ue(this, Ce);
22
+ He(this, Te, r), this.setOptions(t), this.bindMethods(), We(this, Ve, nt).call(this);
23
+ }
24
+ bindMethods() {
25
+ this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
26
+ }
27
+ setOptions(r) {
28
+ var s;
29
+ const t = this.options;
30
+ this.options = G(this, Te).defaultMutationOptions(r), Rs(this.options, t) || G(this, Te).getMutationCache().notify({
31
+ type: "observerOptionsUpdated",
32
+ mutation: G(this, ae),
33
+ observer: this
34
+ }), t != null && t.mutationKey && this.options.mutationKey && Xt(t.mutationKey) !== Xt(this.options.mutationKey) ? this.reset() : ((s = G(this, ae)) == null ? void 0 : s.state.status) === "pending" && G(this, ae).setOptions(this.options);
35
+ }
36
+ onUnsubscribe() {
37
+ var r;
38
+ this.hasListeners() || (r = G(this, ae)) == null || r.removeObserver(this);
39
+ }
40
+ onMutationUpdate(r) {
41
+ We(this, Ve, nt).call(this), We(this, Ve, Nt).call(this, r);
42
+ }
43
+ getCurrentResult() {
44
+ return G(this, Re);
45
+ }
46
+ reset() {
47
+ var r;
48
+ (r = G(this, ae)) == null || r.removeObserver(this), He(this, ae, void 0), We(this, Ve, nt).call(this), We(this, Ve, Nt).call(this);
49
+ }
50
+ mutate(r, t) {
51
+ var s;
52
+ return He(this, Ce, t), (s = G(this, ae)) == null || s.removeObserver(this), He(this, ae, G(this, Te).getMutationCache().build(G(this, Te), this.options)), G(this, ae).addObserver(this), G(this, ae).execute(r);
53
+ }
54
+ }, Te = new WeakMap(), Re = new WeakMap(), ae = new WeakMap(), Ce = new WeakMap(), Ve = new WeakSet(), nt = function() {
55
+ var t;
56
+ const r = ((t = G(this, ae)) == null ? void 0 : t.state) ?? fs();
57
+ He(this, Re, {
58
+ ...r,
59
+ isPending: r.status === "pending",
60
+ isSuccess: r.status === "success",
61
+ isError: r.status === "error",
62
+ isIdle: r.status === "idle",
63
+ mutate: this.mutate,
64
+ reset: this.reset
65
+ });
66
+ }, Nt = function(r) {
67
+ ir.batch(() => {
68
+ var t, s, n, i, l, c, d, S;
69
+ if (G(this, Ce) && this.hasListeners()) {
70
+ const m = G(this, Re).variables, y = G(this, Re).context;
71
+ (r == null ? void 0 : r.type) === "success" ? ((s = (t = G(this, Ce)).onSuccess) == null || s.call(t, r.data, m, y), (i = (n = G(this, Ce)).onSettled) == null || i.call(n, r.data, null, m, y)) : (r == null ? void 0 : r.type) === "error" && ((c = (l = G(this, Ce)).onError) == null || c.call(l, r.error, m, y), (S = (d = G(this, Ce)).onSettled) == null || S.call(
72
+ d,
73
+ void 0,
74
+ r.error,
75
+ m,
76
+ y
77
+ ));
78
+ }
79
+ this.listeners.forEach((m) => {
80
+ m(G(this, Re));
81
+ });
82
+ });
83
+ }, or);
84
+ function Bo(e, r) {
85
+ const t = Is(), [s] = h.useState(
86
+ () => new Ms(
87
+ t,
88
+ e
89
+ )
90
+ );
91
+ h.useEffect(() => {
92
+ s.setOptions(e);
93
+ }, [s, e]);
94
+ const n = h.useSyncExternalStore(
95
+ h.useCallback(
96
+ (l) => s.subscribe(ir.batchCalls(l)),
97
+ [s]
98
+ ),
99
+ () => s.getCurrentResult(),
100
+ () => s.getCurrentResult()
101
+ ), i = h.useCallback(
102
+ (l, c) => {
103
+ s.mutate(l, c).catch(Ns);
104
+ },
105
+ [s]
106
+ );
107
+ if (n.error && Ds(s.options.throwOnError, [n.error]))
108
+ throw n.error;
109
+ return { ...n, mutate: i, mutateAsync: n.mutate };
110
+ }
111
+ var Qe = (e) => e.type === "checkbox", $e = (e) => e instanceof Date, oe = (e) => e == null;
112
+ const cr = (e) => typeof e == "object";
113
+ var re = (e) => !oe(e) && !Array.isArray(e) && cr(e) && !$e(e), ur = (e) => re(e) && e.target ? Qe(e.target) ? e.target.checked : e.target.value : e, Os = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, dr = (e, r) => e.has(Os(r)), js = (e) => {
114
+ const r = e.constructor && e.constructor.prototype;
115
+ return re(r) && r.hasOwnProperty("isPrototypeOf");
116
+ }, Ut = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
117
+ function te(e) {
118
+ let r;
119
+ const t = Array.isArray(e);
120
+ if (e instanceof Date)
121
+ r = new Date(e);
122
+ else if (e instanceof Set)
123
+ r = new Set(e);
124
+ else if (!(Ut && (e instanceof Blob || e instanceof FileList)) && (t || re(e)))
125
+ if (r = t ? [] : {}, !t && !js(e))
126
+ r = e;
127
+ else
128
+ for (const s in e)
129
+ e.hasOwnProperty(s) && (r[s] = te(e[s]));
130
+ else
131
+ return e;
132
+ return r;
133
+ }
134
+ var Je = (e) => Array.isArray(e) ? e.filter(Boolean) : [], $ = (e) => e === void 0, p = (e, r, t) => {
135
+ if (!r || !re(e))
136
+ return t;
137
+ const s = Je(r.split(/[,[\].]+?/)).reduce((n, i) => oe(n) ? n : n[i], e);
138
+ return $(s) || s === e ? $(e[r]) ? t : e[r] : s;
139
+ }, ge = (e) => typeof e == "boolean", Ht = (e) => /^\w*$/.test(e), fr = (e) => Je(e.replace(/["|']|\]/g, "").split(/\.|\[/)), H = (e, r, t) => {
140
+ let s = -1;
141
+ const n = Ht(r) ? [r] : fr(r), i = n.length, l = i - 1;
142
+ for (; ++s < i; ) {
143
+ const c = n[s];
144
+ let d = t;
145
+ if (s !== l) {
146
+ const S = e[c];
147
+ d = re(S) || Array.isArray(S) ? S : isNaN(+n[s + 1]) ? {} : [];
148
+ }
149
+ if (c === "__proto__")
150
+ return;
151
+ e[c] = d, e = e[c];
152
+ }
153
+ return e;
154
+ };
155
+ const at = {
156
+ BLUR: "blur",
157
+ FOCUS_OUT: "focusout",
158
+ CHANGE: "change"
159
+ }, pe = {
160
+ onBlur: "onBlur",
161
+ onChange: "onChange",
162
+ onSubmit: "onSubmit",
163
+ onTouched: "onTouched",
164
+ all: "all"
165
+ }, we = {
166
+ max: "max",
167
+ min: "min",
168
+ maxLength: "maxLength",
169
+ minLength: "minLength",
170
+ pattern: "pattern",
171
+ required: "required",
172
+ validate: "validate"
173
+ }, pr = I.createContext(null), pt = () => I.useContext(pr), Uo = (e) => {
174
+ const { children: r, ...t } = e;
175
+ return I.createElement(pr.Provider, { value: t }, r);
176
+ };
177
+ var hr = (e, r, t, s = !0) => {
178
+ const n = {
179
+ defaultValues: r._defaultValues
180
+ };
181
+ for (const i in e)
182
+ Object.defineProperty(n, i, {
183
+ get: () => {
184
+ const l = i;
185
+ return r._proxyFormState[l] !== pe.all && (r._proxyFormState[l] = !s || pe.all), t && (t[l] = !0), e[l];
186
+ }
187
+ });
188
+ return n;
189
+ }, le = (e) => re(e) && !Object.keys(e).length, mr = (e, r, t, s) => {
190
+ t(e);
191
+ const { name: n, ...i } = e;
192
+ return le(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((l) => r[l] === (!s || pe.all));
193
+ }, ce = (e) => Array.isArray(e) ? e : [e], yr = (e, r, t) => !e || !r || e === r || ce(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s)));
194
+ function ht(e) {
195
+ const r = I.useRef(e);
196
+ r.current = e, I.useEffect(() => {
197
+ const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
198
+ next: r.current.next
199
+ });
200
+ return () => {
201
+ t && t.unsubscribe();
202
+ };
203
+ }, [e.disabled]);
204
+ }
205
+ function Ls(e) {
206
+ const r = pt(), { control: t = r.control, disabled: s, name: n, exact: i } = e || {}, [l, c] = I.useState(t._formState), d = I.useRef(!0), S = I.useRef({
207
+ isDirty: !1,
208
+ isLoading: !1,
209
+ dirtyFields: !1,
210
+ touchedFields: !1,
211
+ validatingFields: !1,
212
+ isValidating: !1,
213
+ isValid: !1,
214
+ errors: !1
215
+ }), m = I.useRef(n);
216
+ return m.current = n, ht({
217
+ disabled: s,
218
+ next: (y) => d.current && yr(m.current, y.name, i) && mr(y, S.current, t._updateFormState) && c({
219
+ ...t._formState,
220
+ ...y
221
+ }),
222
+ subject: t._subjects.state
223
+ }), I.useEffect(() => (d.current = !0, S.current.isValid && t._updateValid(!0), () => {
224
+ d.current = !1;
225
+ }), [t]), hr(l, t, S.current, !1);
226
+ }
227
+ var ve = (e) => typeof e == "string", gr = (e, r, t, s, n) => ve(e) ? (s && r.watch.add(e), p(t, e, n)) : Array.isArray(e) ? e.map((i) => (s && r.watch.add(i), p(t, i))) : (s && (r.watchAll = !0), t);
228
+ function Bs(e) {
229
+ const r = pt(), { control: t = r.control, name: s, defaultValue: n, disabled: i, exact: l } = e || {}, c = I.useRef(s);
230
+ c.current = s, ht({
231
+ disabled: i,
232
+ subject: t._subjects.values,
233
+ next: (m) => {
234
+ yr(c.current, m.name, l) && S(te(gr(c.current, t._names, m.values || t._formValues, !1, n)));
235
+ }
236
+ });
237
+ const [d, S] = I.useState(t._getWatch(s, n));
238
+ return I.useEffect(() => t._removeUnmounted()), d;
239
+ }
240
+ function Us(e) {
241
+ const r = pt(), { name: t, disabled: s, control: n = r.control, shouldUnregister: i } = e, l = dr(n._names.array, t), c = Bs({
242
+ control: n,
243
+ name: t,
244
+ defaultValue: p(n._formValues, t, p(n._defaultValues, t, e.defaultValue)),
245
+ exact: !0
246
+ }), d = Ls({
247
+ control: n,
248
+ name: t
249
+ }), S = I.useRef(n.register(t, {
250
+ ...e.rules,
251
+ value: c,
252
+ ...ge(e.disabled) ? { disabled: e.disabled } : {}
253
+ }));
254
+ return I.useEffect(() => {
255
+ const m = n._options.shouldUnregister || i, y = (E, O) => {
256
+ const w = p(n._fields, E);
257
+ w && w._f && (w._f.mount = O);
258
+ };
259
+ if (y(t, !0), m) {
260
+ const E = te(p(n._options.defaultValues, t));
261
+ H(n._defaultValues, t, E), $(p(n._formValues, t)) && H(n._formValues, t, E);
262
+ }
263
+ return () => {
264
+ (l ? m && !n._state.action : m) ? n.unregister(t) : y(t, !1);
265
+ };
266
+ }, [t, n, l, i]), I.useEffect(() => {
267
+ p(n._fields, t) && n._updateDisabledField({
268
+ disabled: s,
269
+ fields: n._fields,
270
+ name: t,
271
+ value: p(n._fields, t)._f.value
272
+ });
273
+ }, [s, t, n]), {
274
+ field: {
275
+ name: t,
276
+ value: c,
277
+ ...ge(s) || d.disabled ? { disabled: d.disabled || s } : {},
278
+ onChange: I.useCallback((m) => S.current.onChange({
279
+ target: {
280
+ value: ur(m),
281
+ name: t
282
+ },
283
+ type: at.CHANGE
284
+ }), [t]),
285
+ onBlur: I.useCallback(() => S.current.onBlur({
286
+ target: {
287
+ value: p(n._formValues, t),
288
+ name: t
289
+ },
290
+ type: at.BLUR
291
+ }), [t, n]),
292
+ ref: (m) => {
293
+ const y = p(n._fields, t);
294
+ y && m && (y._f.ref = {
295
+ focus: () => m.focus(),
296
+ select: () => m.select(),
297
+ setCustomValidity: (E) => m.setCustomValidity(E),
298
+ reportValidity: () => m.reportValidity()
299
+ });
300
+ }
301
+ },
302
+ formState: d,
303
+ fieldState: Object.defineProperties({}, {
304
+ invalid: {
305
+ enumerable: !0,
306
+ get: () => !!p(d.errors, t)
307
+ },
308
+ isDirty: {
309
+ enumerable: !0,
310
+ get: () => !!p(d.dirtyFields, t)
311
+ },
312
+ isTouched: {
313
+ enumerable: !0,
314
+ get: () => !!p(d.touchedFields, t)
315
+ },
316
+ isValidating: {
317
+ enumerable: !0,
318
+ get: () => !!p(d.validatingFields, t)
319
+ },
320
+ error: {
321
+ enumerable: !0,
322
+ get: () => p(d.errors, t)
323
+ }
324
+ })
325
+ };
326
+ }
327
+ const Ho = (e) => e.render(Us(e));
328
+ var Hs = (e, r, t, s, n) => r ? {
329
+ ...t[e],
330
+ types: {
331
+ ...t[e] && t[e].types ? t[e].types : {},
332
+ [s]: n || !0
333
+ }
334
+ } : {}, Fe = () => {
335
+ const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
336
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
337
+ const t = (Math.random() * 16 + e) % 16 | 0;
338
+ return (r == "x" ? t : t & 3 | 8).toString(16);
339
+ });
340
+ }, _t = (e, r, t = {}) => t.shouldFocus || $(t.shouldFocus) ? t.focusName || `${e}.${$(t.focusIndex) ? r : t.focusIndex}.` : "", Ze = (e) => ({
341
+ isOnSubmit: !e || e === pe.onSubmit,
342
+ isOnBlur: e === pe.onBlur,
343
+ isOnChange: e === pe.onChange,
344
+ isOnAll: e === pe.all,
345
+ isOnTouch: e === pe.onTouched
346
+ }), Dt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
347
+ const qe = (e, r, t, s) => {
348
+ for (const n of t || Object.keys(e)) {
349
+ const i = p(e, n);
350
+ if (i) {
351
+ const { _f: l, ...c } = i;
352
+ if (l) {
353
+ if (l.refs && l.refs[0] && r(l.refs[0], n) && !s)
354
+ break;
355
+ if (l.ref && r(l.ref, l.name) && !s)
356
+ break;
357
+ qe(c, r);
358
+ } else re(c) && qe(c, r);
359
+ }
360
+ }
361
+ };
362
+ var vr = (e, r, t) => {
363
+ const s = ce(p(e, t));
364
+ return H(s, "root", r[t]), H(e, t, s), e;
365
+ }, Wt = (e) => e.type === "file", Ie = (e) => typeof e == "function", lt = (e) => {
366
+ if (!Ut)
367
+ return !1;
368
+ const r = e ? e.ownerDocument : 0;
369
+ return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
370
+ }, it = (e) => ve(e), Kt = (e) => e.type === "radio", ct = (e) => e instanceof RegExp;
371
+ const Zt = {
372
+ value: !1,
373
+ isValid: !1
374
+ }, Qt = { value: !0, isValid: !0 };
375
+ var xr = (e) => {
376
+ if (Array.isArray(e)) {
377
+ if (e.length > 1) {
378
+ const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
379
+ return { value: r, isValid: !!r.length };
380
+ }
381
+ return e[0].checked && !e[0].disabled ? (
382
+ // @ts-expect-error expected to work in the browser
383
+ e[0].attributes && !$(e[0].attributes.value) ? $(e[0].value) || e[0].value === "" ? Qt : { value: e[0].value, isValid: !0 } : Qt
384
+ ) : Zt;
385
+ }
386
+ return Zt;
387
+ };
388
+ const Jt = {
389
+ isValid: !1,
390
+ value: null
391
+ };
392
+ var Sr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
393
+ isValid: !0,
394
+ value: t.value
395
+ } : r, Jt) : Jt;
396
+ function er(e, r, t = "validate") {
397
+ if (it(e) || Array.isArray(e) && e.every(it) || ge(e) && !e)
398
+ return {
399
+ type: t,
400
+ message: it(e) ? e : "",
401
+ ref: r
402
+ };
403
+ }
404
+ var Ke = (e) => re(e) && !ct(e) ? e : {
405
+ value: e,
406
+ message: ""
407
+ }, Pt = async (e, r, t, s, n) => {
408
+ const { ref: i, refs: l, required: c, maxLength: d, minLength: S, min: m, max: y, pattern: E, validate: O, name: w, valueAsNumber: P, mount: M, disabled: T } = e._f, g = p(r, w);
409
+ if (!M || T)
410
+ return {};
411
+ const D = l ? l[0] : i, Z = (F) => {
412
+ s && D.reportValidity && (D.setCustomValidity(ge(F) ? "" : F || ""), D.reportValidity());
413
+ }, v = {}, A = Kt(i), V = Qe(i), k = A || V, Q = (P || Wt(i)) && $(i.value) && $(g) || lt(i) && i.value === "" || g === "" || Array.isArray(g) && !g.length, z = Hs.bind(null, w, t, v), de = (F, N, B, j = we.maxLength, Y = we.minLength) => {
414
+ const X = F ? N : B;
415
+ v[w] = {
416
+ type: F ? j : Y,
417
+ message: X,
418
+ ref: i,
419
+ ...z(F ? j : Y, X)
420
+ };
421
+ };
422
+ if (n ? !Array.isArray(g) || !g.length : c && (!k && (Q || oe(g)) || ge(g) && !g || V && !xr(l).isValid || A && !Sr(l).isValid)) {
423
+ const { value: F, message: N } = it(c) ? { value: !!c, message: c } : Ke(c);
424
+ if (F && (v[w] = {
425
+ type: we.required,
426
+ message: N,
427
+ ref: D,
428
+ ...z(we.required, N)
429
+ }, !t))
430
+ return Z(N), v;
431
+ }
432
+ if (!Q && (!oe(m) || !oe(y))) {
433
+ let F, N;
434
+ const B = Ke(y), j = Ke(m);
435
+ if (!oe(g) && !isNaN(g)) {
436
+ const Y = i.valueAsNumber || g && +g;
437
+ oe(B.value) || (F = Y > B.value), oe(j.value) || (N = Y < j.value);
438
+ } else {
439
+ const Y = i.valueAsDate || new Date(g), X = (Se) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Se), fe = i.type == "time", ie = i.type == "week";
440
+ ve(B.value) && g && (F = fe ? X(g) > X(B.value) : ie ? g > B.value : Y > new Date(B.value)), ve(j.value) && g && (N = fe ? X(g) < X(j.value) : ie ? g < j.value : Y < new Date(j.value));
441
+ }
442
+ if ((F || N) && (de(!!F, B.message, j.message, we.max, we.min), !t))
443
+ return Z(v[w].message), v;
444
+ }
445
+ if ((d || S) && !Q && (ve(g) || n && Array.isArray(g))) {
446
+ const F = Ke(d), N = Ke(S), B = !oe(F.value) && g.length > +F.value, j = !oe(N.value) && g.length < +N.value;
447
+ if ((B || j) && (de(B, F.message, N.message), !t))
448
+ return Z(v[w].message), v;
449
+ }
450
+ if (E && !Q && ve(g)) {
451
+ const { value: F, message: N } = Ke(E);
452
+ if (ct(F) && !g.match(F) && (v[w] = {
453
+ type: we.pattern,
454
+ message: N,
455
+ ref: i,
456
+ ...z(we.pattern, N)
457
+ }, !t))
458
+ return Z(N), v;
459
+ }
460
+ if (O) {
461
+ if (Ie(O)) {
462
+ const F = await O(g, r), N = er(F, D);
463
+ if (N && (v[w] = {
464
+ ...N,
465
+ ...z(we.validate, N.message)
466
+ }, !t))
467
+ return Z(N.message), v;
468
+ } else if (re(O)) {
469
+ let F = {};
470
+ for (const N in O) {
471
+ if (!le(F) && !t)
472
+ break;
473
+ const B = er(await O[N](g, r), D, N);
474
+ B && (F = {
475
+ ...B,
476
+ ...z(N, B.message)
477
+ }, Z(B.message), t && (v[w] = F));
478
+ }
479
+ if (!le(F) && (v[w] = {
480
+ ref: D,
481
+ ...F
482
+ }, !t))
483
+ return v;
484
+ }
485
+ }
486
+ return Z(!0), v;
487
+ }, bt = (e, r) => [
488
+ ...e,
489
+ ...ce(r)
490
+ ], wt = (e) => Array.isArray(e) ? e.map(() => {
491
+ }) : void 0;
492
+ function At(e, r, t) {
493
+ return [
494
+ ...e.slice(0, r),
495
+ ...ce(t),
496
+ ...e.slice(r)
497
+ ];
498
+ }
499
+ var Ct = (e, r, t) => Array.isArray(e) ? ($(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], Vt = (e, r) => [
500
+ ...ce(r),
501
+ ...ce(e)
502
+ ];
503
+ function Ws(e, r) {
504
+ let t = 0;
505
+ const s = [...e];
506
+ for (const n of r)
507
+ s.splice(n - t, 1), t++;
508
+ return Je(s).length ? s : [];
509
+ }
510
+ var Et = (e, r) => $(r) ? [] : Ws(e, ce(r).sort((t, s) => t - s)), Ft = (e, r, t) => {
511
+ [e[r], e[t]] = [e[t], e[r]];
512
+ };
513
+ function Ks(e, r) {
514
+ const t = r.slice(0, -1).length;
515
+ let s = 0;
516
+ for (; s < t; )
517
+ e = $(e) ? s++ : e[r[s++]];
518
+ return e;
519
+ }
520
+ function $s(e) {
521
+ for (const r in e)
522
+ if (e.hasOwnProperty(r) && !$(e[r]))
523
+ return !1;
524
+ return !0;
525
+ }
526
+ function ee(e, r) {
527
+ const t = Array.isArray(r) ? r : Ht(r) ? [r] : fr(r), s = t.length === 1 ? e : Ks(e, t), n = t.length - 1, i = t[n];
528
+ return s && delete s[i], n !== 0 && (re(s) && le(s) || Array.isArray(s) && $s(s)) && ee(e, t.slice(0, -1)), e;
529
+ }
530
+ var tr = (e, r, t) => (e[r] = t, e);
531
+ function Wo(e) {
532
+ const r = pt(), { control: t = r.control, name: s, keyName: n = "id", shouldUnregister: i } = e, [l, c] = I.useState(t._getFieldArray(s)), d = I.useRef(t._getFieldArray(s).map(Fe)), S = I.useRef(l), m = I.useRef(s), y = I.useRef(!1);
533
+ m.current = s, S.current = l, t._names.array.add(s), e.rules && t.register(s, e.rules), ht({
534
+ next: ({ values: v, name: A }) => {
535
+ if (A === m.current || !A) {
536
+ const V = p(v, m.current);
537
+ Array.isArray(V) && (c(V), d.current = V.map(Fe));
538
+ }
539
+ },
540
+ subject: t._subjects.array
541
+ });
542
+ const E = I.useCallback((v) => {
543
+ y.current = !0, t._updateFieldArray(s, v);
544
+ }, [t, s]), O = (v, A) => {
545
+ const V = ce(te(v)), k = bt(t._getFieldArray(s), V);
546
+ t._names.focus = _t(s, k.length - 1, A), d.current = bt(d.current, V.map(Fe)), E(k), c(k), t._updateFieldArray(s, k, bt, {
547
+ argA: wt(v)
548
+ });
549
+ }, w = (v, A) => {
550
+ const V = ce(te(v)), k = Vt(t._getFieldArray(s), V);
551
+ t._names.focus = _t(s, 0, A), d.current = Vt(d.current, V.map(Fe)), E(k), c(k), t._updateFieldArray(s, k, Vt, {
552
+ argA: wt(v)
553
+ });
554
+ }, P = (v) => {
555
+ const A = Et(t._getFieldArray(s), v);
556
+ d.current = Et(d.current, v), E(A), c(A), t._updateFieldArray(s, A, Et, {
557
+ argA: v
558
+ });
559
+ }, M = (v, A, V) => {
560
+ const k = ce(te(A)), Q = At(t._getFieldArray(s), v, k);
561
+ t._names.focus = _t(s, v, V), d.current = At(d.current, v, k.map(Fe)), E(Q), c(Q), t._updateFieldArray(s, Q, At, {
562
+ argA: v,
563
+ argB: wt(A)
564
+ });
565
+ }, T = (v, A) => {
566
+ const V = t._getFieldArray(s);
567
+ Ft(V, v, A), Ft(d.current, v, A), E(V), c(V), t._updateFieldArray(s, V, Ft, {
568
+ argA: v,
569
+ argB: A
570
+ }, !1);
571
+ }, g = (v, A) => {
572
+ const V = t._getFieldArray(s);
573
+ Ct(V, v, A), Ct(d.current, v, A), E(V), c(V), t._updateFieldArray(s, V, Ct, {
574
+ argA: v,
575
+ argB: A
576
+ }, !1);
577
+ }, D = (v, A) => {
578
+ const V = te(A), k = tr(t._getFieldArray(s), v, V);
579
+ d.current = [...k].map((Q, z) => !Q || z === v ? Fe() : d.current[z]), E(k), c([...k]), t._updateFieldArray(s, k, tr, {
580
+ argA: v,
581
+ argB: V
582
+ }, !0, !1);
583
+ }, Z = (v) => {
584
+ const A = ce(te(v));
585
+ d.current = A.map(Fe), E([...A]), c([...A]), t._updateFieldArray(s, [...A], (V) => V, {}, !0, !1);
586
+ };
587
+ return I.useEffect(() => {
588
+ if (t._state.action = !1, Dt(s, t._names) && t._subjects.state.next({
589
+ ...t._formState
590
+ }), y.current && (!Ze(t._options.mode).isOnSubmit || t._formState.isSubmitted))
591
+ if (t._options.resolver)
592
+ t._executeSchema([s]).then((v) => {
593
+ const A = p(v.errors, s), V = p(t._formState.errors, s);
594
+ (V ? !A && V.type || A && (V.type !== A.type || V.message !== A.message) : A && A.type) && (A ? H(t._formState.errors, s, A) : ee(t._formState.errors, s), t._subjects.state.next({
595
+ errors: t._formState.errors
596
+ }));
597
+ });
598
+ else {
599
+ const v = p(t._fields, s);
600
+ v && v._f && !(Ze(t._options.reValidateMode).isOnSubmit && Ze(t._options.mode).isOnSubmit) && Pt(v, t._formValues, t._options.criteriaMode === pe.all, t._options.shouldUseNativeValidation, !0).then((A) => !le(A) && t._subjects.state.next({
601
+ errors: vr(t._formState.errors, A, s)
602
+ }));
603
+ }
604
+ t._subjects.values.next({
605
+ name: s,
606
+ values: { ...t._formValues }
607
+ }), t._names.focus && qe(t._fields, (v, A) => {
608
+ if (t._names.focus && A.startsWith(t._names.focus) && v.focus)
609
+ return v.focus(), 1;
610
+ }), t._names.focus = "", t._updateValid(), y.current = !1;
611
+ }, [l, s, t]), I.useEffect(() => (!p(t._formValues, s) && t._updateFieldArray(s), () => {
612
+ (t._options.shouldUnregister || i) && t.unregister(s);
613
+ }), [s, t, n, i]), {
614
+ swap: I.useCallback(T, [E, s, t]),
615
+ move: I.useCallback(g, [E, s, t]),
616
+ prepend: I.useCallback(w, [E, s, t]),
617
+ append: I.useCallback(O, [E, s, t]),
618
+ remove: I.useCallback(P, [E, s, t]),
619
+ insert: I.useCallback(M, [E, s, t]),
620
+ update: I.useCallback(D, [E, s, t]),
621
+ replace: I.useCallback(Z, [E, s, t]),
622
+ fields: I.useMemo(() => l.map((v, A) => ({
623
+ ...v,
624
+ [n]: d.current[A] || Fe()
625
+ })), [l, n])
626
+ };
627
+ }
628
+ var Tt = () => {
629
+ let e = [];
630
+ return {
631
+ get observers() {
632
+ return e;
633
+ },
634
+ next: (n) => {
635
+ for (const i of e)
636
+ i.next && i.next(n);
637
+ },
638
+ subscribe: (n) => (e.push(n), {
639
+ unsubscribe: () => {
640
+ e = e.filter((i) => i !== n);
641
+ }
642
+ }),
643
+ unsubscribe: () => {
644
+ e = [];
645
+ }
646
+ };
647
+ }, ut = (e) => oe(e) || !cr(e);
648
+ function Me(e, r) {
649
+ if (ut(e) || ut(r))
650
+ return e === r;
651
+ if ($e(e) && $e(r))
652
+ return e.getTime() === r.getTime();
653
+ const t = Object.keys(e), s = Object.keys(r);
654
+ if (t.length !== s.length)
655
+ return !1;
656
+ for (const n of t) {
657
+ const i = e[n];
658
+ if (!s.includes(n))
659
+ return !1;
660
+ if (n !== "ref") {
661
+ const l = r[n];
662
+ if ($e(i) && $e(l) || re(i) && re(l) || Array.isArray(i) && Array.isArray(l) ? !Me(i, l) : i !== l)
663
+ return !1;
664
+ }
665
+ }
666
+ return !0;
667
+ }
668
+ var _r = (e) => e.type === "select-multiple", qs = (e) => Kt(e) || Qe(e), Rt = (e) => lt(e) && e.isConnected, br = (e) => {
669
+ for (const r in e)
670
+ if (Ie(e[r]))
671
+ return !0;
672
+ return !1;
673
+ };
674
+ function dt(e, r = {}) {
675
+ const t = Array.isArray(e);
676
+ if (re(e) || t)
677
+ for (const s in e)
678
+ Array.isArray(e[s]) || re(e[s]) && !br(e[s]) ? (r[s] = Array.isArray(e[s]) ? [] : {}, dt(e[s], r[s])) : oe(e[s]) || (r[s] = !0);
679
+ return r;
680
+ }
681
+ function wr(e, r, t) {
682
+ const s = Array.isArray(e);
683
+ if (re(e) || s)
684
+ for (const n in e)
685
+ Array.isArray(e[n]) || re(e[n]) && !br(e[n]) ? $(r) || ut(t[n]) ? t[n] = Array.isArray(e[n]) ? dt(e[n], []) : { ...dt(e[n]) } : wr(e[n], oe(r) ? {} : r[n], t[n]) : t[n] = !Me(e[n], r[n]);
686
+ return t;
687
+ }
688
+ var ot = (e, r) => wr(e, r, dt(r)), Ar = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: s }) => $(e) ? e : r ? e === "" ? NaN : e && +e : t && ve(e) ? new Date(e) : s ? s(e) : e;
689
+ function It(e) {
690
+ const r = e.ref;
691
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : r.disabled))
692
+ return Wt(r) ? r.files : Kt(r) ? Sr(e.refs).value : _r(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Qe(r) ? xr(e.refs).value : Ar($(r.value) ? e.ref.value : r.value, e);
693
+ }
694
+ var Gs = (e, r, t, s) => {
695
+ const n = {};
696
+ for (const i of e) {
697
+ const l = p(r, i);
698
+ l && H(n, i, l._f);
699
+ }
700
+ return {
701
+ criteriaMode: t,
702
+ names: [...e],
703
+ fields: n,
704
+ shouldUseNativeValidation: s
705
+ };
706
+ }, Ye = (e) => $(e) ? e : ct(e) ? e.source : re(e) ? ct(e.value) ? e.value.source : e.value : e, zs = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
707
+ function rr(e, r, t) {
708
+ const s = p(e, t);
709
+ if (s || Ht(t))
710
+ return {
711
+ error: s,
712
+ name: t
713
+ };
714
+ const n = t.split(".");
715
+ for (; n.length; ) {
716
+ const i = n.join("."), l = p(r, i), c = p(e, i);
717
+ if (l && !Array.isArray(l) && t !== i)
718
+ return { name: t };
719
+ if (c && c.type)
720
+ return {
721
+ name: i,
722
+ error: c
723
+ };
724
+ n.pop();
725
+ }
726
+ return {
727
+ name: t
728
+ };
729
+ }
730
+ var Ys = (e, r, t, s, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(r || e) : (t ? s.isOnBlur : n.isOnBlur) ? !e : (t ? s.isOnChange : n.isOnChange) ? e : !0, Xs = (e, r) => !Je(p(e, r)).length && ee(e, r);
731
+ const Zs = {
732
+ mode: pe.onSubmit,
733
+ reValidateMode: pe.onChange,
734
+ shouldFocusError: !0
735
+ };
736
+ function Qs(e = {}) {
737
+ let r = {
738
+ ...Zs,
739
+ ...e
740
+ }, t = {
741
+ submitCount: 0,
742
+ isDirty: !1,
743
+ isLoading: Ie(r.defaultValues),
744
+ isValidating: !1,
745
+ isSubmitted: !1,
746
+ isSubmitting: !1,
747
+ isSubmitSuccessful: !1,
748
+ isValid: !1,
749
+ touchedFields: {},
750
+ dirtyFields: {},
751
+ validatingFields: {},
752
+ errors: r.errors || {},
753
+ disabled: r.disabled || !1
754
+ }, s = {}, n = re(r.defaultValues) || re(r.values) ? te(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : te(n), l = {
755
+ action: !1,
756
+ mount: !1,
757
+ watch: !1
758
+ }, c = {
759
+ mount: /* @__PURE__ */ new Set(),
760
+ unMount: /* @__PURE__ */ new Set(),
761
+ array: /* @__PURE__ */ new Set(),
762
+ watch: /* @__PURE__ */ new Set()
763
+ }, d, S = 0;
764
+ const m = {
765
+ isDirty: !1,
766
+ dirtyFields: !1,
767
+ validatingFields: !1,
768
+ touchedFields: !1,
769
+ isValidating: !1,
770
+ isValid: !1,
771
+ errors: !1
772
+ }, y = {
773
+ values: Tt(),
774
+ array: Tt(),
775
+ state: Tt()
776
+ }, E = Ze(r.mode), O = Ze(r.reValidateMode), w = r.criteriaMode === pe.all, P = (o) => (a) => {
777
+ clearTimeout(S), S = setTimeout(o, a);
778
+ }, M = async (o) => {
779
+ if (m.isValid || o) {
780
+ const a = r.resolver ? le((await k()).errors) : await z(s, !0);
781
+ a !== t.isValid && y.state.next({
782
+ isValid: a
783
+ });
784
+ }
785
+ }, T = (o, a) => {
786
+ (m.isValidating || m.validatingFields) && ((o || Array.from(c.mount)).forEach((u) => {
787
+ u && (a ? H(t.validatingFields, u, a) : ee(t.validatingFields, u));
788
+ }), y.state.next({
789
+ validatingFields: t.validatingFields,
790
+ isValidating: !le(t.validatingFields)
791
+ }));
792
+ }, g = (o, a = [], u, _, x = !0, f = !0) => {
793
+ if (_ && u) {
794
+ if (l.action = !0, f && Array.isArray(p(s, o))) {
795
+ const C = u(p(s, o), _.argA, _.argB);
796
+ x && H(s, o, C);
797
+ }
798
+ if (f && Array.isArray(p(t.errors, o))) {
799
+ const C = u(p(t.errors, o), _.argA, _.argB);
800
+ x && H(t.errors, o, C), Xs(t.errors, o);
801
+ }
802
+ if (m.touchedFields && f && Array.isArray(p(t.touchedFields, o))) {
803
+ const C = u(p(t.touchedFields, o), _.argA, _.argB);
804
+ x && H(t.touchedFields, o, C);
805
+ }
806
+ m.dirtyFields && (t.dirtyFields = ot(n, i)), y.state.next({
807
+ name: o,
808
+ isDirty: F(o, a),
809
+ dirtyFields: t.dirtyFields,
810
+ errors: t.errors,
811
+ isValid: t.isValid
812
+ });
813
+ } else
814
+ H(i, o, a);
815
+ }, D = (o, a) => {
816
+ H(t.errors, o, a), y.state.next({
817
+ errors: t.errors
818
+ });
819
+ }, Z = (o) => {
820
+ t.errors = o, y.state.next({
821
+ errors: t.errors,
822
+ isValid: !1
823
+ });
824
+ }, v = (o, a, u, _) => {
825
+ const x = p(s, o);
826
+ if (x) {
827
+ const f = p(i, o, $(u) ? p(n, o) : u);
828
+ $(f) || _ && _.defaultChecked || a ? H(i, o, a ? f : It(x._f)) : j(o, f), l.mount && M();
829
+ }
830
+ }, A = (o, a, u, _, x) => {
831
+ let f = !1, C = !1;
832
+ const L = {
833
+ name: o
834
+ }, J = !!(p(s, o) && p(s, o)._f && p(s, o)._f.disabled);
835
+ if (!u || _) {
836
+ m.isDirty && (C = t.isDirty, t.isDirty = L.isDirty = F(), f = C !== L.isDirty);
837
+ const ue = J || Me(p(n, o), a);
838
+ C = !!(!J && p(t.dirtyFields, o)), ue || J ? ee(t.dirtyFields, o) : H(t.dirtyFields, o, !0), L.dirtyFields = t.dirtyFields, f = f || m.dirtyFields && C !== !ue;
839
+ }
840
+ if (u) {
841
+ const ue = p(t.touchedFields, o);
842
+ ue || (H(t.touchedFields, o, u), L.touchedFields = t.touchedFields, f = f || m.touchedFields && ue !== u);
843
+ }
844
+ return f && x && y.state.next(L), f ? L : {};
845
+ }, V = (o, a, u, _) => {
846
+ const x = p(t.errors, o), f = m.isValid && ge(a) && t.isValid !== a;
847
+ if (e.delayError && u ? (d = P(() => D(o, u)), d(e.delayError)) : (clearTimeout(S), d = null, u ? H(t.errors, o, u) : ee(t.errors, o)), (u ? !Me(x, u) : x) || !le(_) || f) {
848
+ const C = {
849
+ ..._,
850
+ ...f && ge(a) ? { isValid: a } : {},
851
+ errors: t.errors,
852
+ name: o
853
+ };
854
+ t = {
855
+ ...t,
856
+ ...C
857
+ }, y.state.next(C);
858
+ }
859
+ }, k = async (o) => {
860
+ T(o, !0);
861
+ const a = await r.resolver(i, r.context, Gs(o || c.mount, s, r.criteriaMode, r.shouldUseNativeValidation));
862
+ return T(o), a;
863
+ }, Q = async (o) => {
864
+ const { errors: a } = await k(o);
865
+ if (o)
866
+ for (const u of o) {
867
+ const _ = p(a, u);
868
+ _ ? H(t.errors, u, _) : ee(t.errors, u);
869
+ }
870
+ else
871
+ t.errors = a;
872
+ return a;
873
+ }, z = async (o, a, u = {
874
+ valid: !0
875
+ }) => {
876
+ for (const _ in o) {
877
+ const x = o[_];
878
+ if (x) {
879
+ const { _f: f, ...C } = x;
880
+ if (f) {
881
+ const L = c.array.has(f.name);
882
+ T([_], !0);
883
+ const J = await Pt(x, i, w, r.shouldUseNativeValidation && !a, L);
884
+ if (T([_]), J[f.name] && (u.valid = !1, a))
885
+ break;
886
+ !a && (p(J, f.name) ? L ? vr(t.errors, J, f.name) : H(t.errors, f.name, J[f.name]) : ee(t.errors, f.name));
887
+ }
888
+ C && await z(C, a, u);
889
+ }
890
+ }
891
+ return u.valid;
892
+ }, de = () => {
893
+ for (const o of c.unMount) {
894
+ const a = p(s, o);
895
+ a && (a._f.refs ? a._f.refs.every((u) => !Rt(u)) : !Rt(a._f.ref)) && be(o);
896
+ }
897
+ c.unMount = /* @__PURE__ */ new Set();
898
+ }, F = (o, a) => (o && a && H(i, o, a), !Me(ke(), n)), N = (o, a, u) => gr(o, c, {
899
+ ...l.mount ? i : $(a) ? n : ve(o) ? { [o]: a } : a
900
+ }, u, a), B = (o) => Je(p(l.mount ? i : n, o, e.shouldUnregister ? p(n, o, []) : [])), j = (o, a, u = {}) => {
901
+ const _ = p(s, o);
902
+ let x = a;
903
+ if (_) {
904
+ const f = _._f;
905
+ f && (!f.disabled && H(i, o, Ar(a, f)), x = lt(f.ref) && oe(a) ? "" : a, _r(f.ref) ? [...f.ref.options].forEach((C) => C.selected = x.includes(C.value)) : f.refs ? Qe(f.ref) ? f.refs.length > 1 ? f.refs.forEach((C) => (!C.defaultChecked || !C.disabled) && (C.checked = Array.isArray(x) ? !!x.find((L) => L === C.value) : x === C.value)) : f.refs[0] && (f.refs[0].checked = !!x) : f.refs.forEach((C) => C.checked = C.value === x) : Wt(f.ref) ? f.ref.value = "" : (f.ref.value = x, f.ref.type || y.values.next({
906
+ name: o,
907
+ values: { ...i }
908
+ })));
909
+ }
910
+ (u.shouldDirty || u.shouldTouch) && A(o, x, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && Se(o);
911
+ }, Y = (o, a, u) => {
912
+ for (const _ in a) {
913
+ const x = a[_], f = `${o}.${_}`, C = p(s, f);
914
+ (c.array.has(o) || !ut(x) || C && !C._f) && !$e(x) ? Y(f, x, u) : j(f, x, u);
915
+ }
916
+ }, X = (o, a, u = {}) => {
917
+ const _ = p(s, o), x = c.array.has(o), f = te(a);
918
+ H(i, o, f), x ? (y.array.next({
919
+ name: o,
920
+ values: { ...i }
921
+ }), (m.isDirty || m.dirtyFields) && u.shouldDirty && y.state.next({
922
+ name: o,
923
+ dirtyFields: ot(n, i),
924
+ isDirty: F(o, f)
925
+ })) : _ && !_._f && !oe(f) ? Y(o, f, u) : j(o, f, u), Dt(o, c) && y.state.next({ ...t }), y.values.next({
926
+ name: l.mount ? o : void 0,
927
+ values: { ...i }
928
+ });
929
+ }, fe = async (o) => {
930
+ l.mount = !0;
931
+ const a = o.target;
932
+ let u = a.name, _ = !0;
933
+ const x = p(s, u), f = () => a.type ? It(x._f) : ur(o), C = (L) => {
934
+ _ = Number.isNaN(L) || L === p(i, u, L);
935
+ };
936
+ if (x) {
937
+ let L, J;
938
+ const ue = f(), Be = o.type === at.BLUR || o.type === at.FOCUS_OUT, cs = !zs(x._f) && !r.resolver && !p(t.errors, u) && !x._f.deps || Ys(Be, p(t.touchedFields, u), t.isSubmitted, O, E), vt = Dt(u, c, Be);
939
+ H(i, u, ue), Be ? (x._f.onBlur && x._f.onBlur(o), d && d(0)) : x._f.onChange && x._f.onChange(o);
940
+ const xt = A(u, ue, Be, !1), us = !le(xt) || vt;
941
+ if (!Be && y.values.next({
942
+ name: u,
943
+ type: o.type,
944
+ values: { ...i }
945
+ }), cs)
946
+ return m.isValid && M(), us && y.state.next({ name: u, ...vt ? {} : xt });
947
+ if (!Be && vt && y.state.next({ ...t }), r.resolver) {
948
+ const { errors: qt } = await k([u]);
949
+ if (C(ue), _) {
950
+ const ds = rr(t.errors, s, u), Gt = rr(qt, s, ds.name || u);
951
+ L = Gt.error, u = Gt.name, J = le(qt);
952
+ }
953
+ } else
954
+ T([u], !0), L = (await Pt(x, i, w, r.shouldUseNativeValidation))[u], T([u]), C(ue), _ && (L ? J = !1 : m.isValid && (J = await z(s, !0)));
955
+ _ && (x._f.deps && Se(x._f.deps), V(u, J, L, xt));
956
+ }
957
+ }, ie = (o, a) => {
958
+ if (p(t.errors, a) && o.focus)
959
+ return o.focus(), 1;
960
+ }, Se = async (o, a = {}) => {
961
+ let u, _;
962
+ const x = ce(o);
963
+ if (r.resolver) {
964
+ const f = await Q($(o) ? o : x);
965
+ u = le(f), _ = o ? !x.some((C) => p(f, C)) : u;
966
+ } else o ? (_ = (await Promise.all(x.map(async (f) => {
967
+ const C = p(s, f);
968
+ return await z(C && C._f ? { [f]: C } : C);
969
+ }))).every(Boolean), !(!_ && !t.isValid) && M()) : _ = u = await z(s);
970
+ return y.state.next({
971
+ ...!ve(o) || m.isValid && u !== t.isValid ? {} : { name: o },
972
+ ...r.resolver || !o ? { isValid: u } : {},
973
+ errors: t.errors
974
+ }), a.shouldFocus && !_ && qe(s, ie, o ? x : c.mount), _;
975
+ }, ke = (o) => {
976
+ const a = {
977
+ ...l.mount ? i : n
978
+ };
979
+ return $(o) ? a : ve(o) ? p(a, o) : o.map((u) => p(a, u));
980
+ }, je = (o, a) => ({
981
+ invalid: !!p((a || t).errors, o),
982
+ isDirty: !!p((a || t).dirtyFields, o),
983
+ error: p((a || t).errors, o),
984
+ isValidating: !!p(t.validatingFields, o),
985
+ isTouched: !!p((a || t).touchedFields, o)
986
+ }), ze = (o) => {
987
+ o && ce(o).forEach((a) => ee(t.errors, a)), y.state.next({
988
+ errors: o ? t.errors : {}
989
+ });
990
+ }, _e = (o, a, u) => {
991
+ const _ = (p(s, o, { _f: {} })._f || {}).ref, x = p(t.errors, o) || {}, { ref: f, message: C, type: L, ...J } = x;
992
+ H(t.errors, o, {
993
+ ...J,
994
+ ...a,
995
+ ref: _
996
+ }), y.state.next({
997
+ name: o,
998
+ errors: t.errors,
999
+ isValid: !1
1000
+ }), u && u.shouldFocus && _ && _.focus && _.focus();
1001
+ }, Le = (o, a) => Ie(o) ? y.values.subscribe({
1002
+ next: (u) => o(N(void 0, a), u)
1003
+ }) : N(o, a, !0), be = (o, a = {}) => {
1004
+ for (const u of o ? ce(o) : c.mount)
1005
+ c.mount.delete(u), c.array.delete(u), a.keepValue || (ee(s, u), ee(i, u)), !a.keepError && ee(t.errors, u), !a.keepDirty && ee(t.dirtyFields, u), !a.keepTouched && ee(t.touchedFields, u), !a.keepIsValidating && ee(t.validatingFields, u), !r.shouldUnregister && !a.keepDefaultValue && ee(n, u);
1006
+ y.values.next({
1007
+ values: { ...i }
1008
+ }), y.state.next({
1009
+ ...t,
1010
+ ...a.keepDirty ? { isDirty: F() } : {}
1011
+ }), !a.keepIsValid && M();
1012
+ }, R = ({ disabled: o, name: a, field: u, fields: _, value: x }) => {
1013
+ if (ge(o) && l.mount || o) {
1014
+ const f = o ? void 0 : $(x) ? It(u ? u._f : p(_, a)._f) : x;
1015
+ H(i, a, f), A(a, f, !1, !1, !0);
1016
+ }
1017
+ }, K = (o, a = {}) => {
1018
+ let u = p(s, o);
1019
+ const _ = ge(a.disabled);
1020
+ return H(s, o, {
1021
+ ...u || {},
1022
+ _f: {
1023
+ ...u && u._f ? u._f : { ref: { name: o } },
1024
+ name: o,
1025
+ mount: !0,
1026
+ ...a
1027
+ }
1028
+ }), c.mount.add(o), u ? R({
1029
+ field: u,
1030
+ disabled: a.disabled,
1031
+ name: o,
1032
+ value: a.value
1033
+ }) : v(o, !0, a.value), {
1034
+ ..._ ? { disabled: a.disabled } : {},
1035
+ ...r.progressive ? {
1036
+ required: !!a.required,
1037
+ min: Ye(a.min),
1038
+ max: Ye(a.max),
1039
+ minLength: Ye(a.minLength),
1040
+ maxLength: Ye(a.maxLength),
1041
+ pattern: Ye(a.pattern)
1042
+ } : {},
1043
+ name: o,
1044
+ onChange: fe,
1045
+ onBlur: fe,
1046
+ ref: (x) => {
1047
+ if (x) {
1048
+ K(o, a), u = p(s, o);
1049
+ const f = $(x.value) && x.querySelectorAll && x.querySelectorAll("input,select,textarea")[0] || x, C = qs(f), L = u._f.refs || [];
1050
+ if (C ? L.find((J) => J === f) : f === u._f.ref)
1051
+ return;
1052
+ H(s, o, {
1053
+ _f: {
1054
+ ...u._f,
1055
+ ...C ? {
1056
+ refs: [
1057
+ ...L.filter(Rt),
1058
+ f,
1059
+ ...Array.isArray(p(n, o)) ? [{}] : []
1060
+ ],
1061
+ ref: { type: f.type, name: o }
1062
+ } : { ref: f }
1063
+ }
1064
+ }), v(o, !1, void 0, f);
1065
+ } else
1066
+ u = p(s, o, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(dr(c.array, o) && l.action) && c.unMount.add(o);
1067
+ }
1068
+ };
1069
+ }, se = () => r.shouldFocusError && qe(s, ie, c.mount), q = (o) => {
1070
+ ge(o) && (y.state.next({ disabled: o }), qe(s, (a, u) => {
1071
+ const _ = p(s, u);
1072
+ _ && (a.disabled = _._f.disabled || o, Array.isArray(_._f.refs) && _._f.refs.forEach((x) => {
1073
+ x.disabled = _._f.disabled || o;
1074
+ }));
1075
+ }, 0, !1));
1076
+ }, U = (o, a) => async (u) => {
1077
+ let _;
1078
+ u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1079
+ let x = te(i);
1080
+ if (y.state.next({
1081
+ isSubmitting: !0
1082
+ }), r.resolver) {
1083
+ const { errors: f, values: C } = await k();
1084
+ t.errors = f, x = C;
1085
+ } else
1086
+ await z(s);
1087
+ if (ee(t.errors, "root"), le(t.errors)) {
1088
+ y.state.next({
1089
+ errors: {}
1090
+ });
1091
+ try {
1092
+ await o(x, u);
1093
+ } catch (f) {
1094
+ _ = f;
1095
+ }
1096
+ } else
1097
+ a && await a({ ...t.errors }, u), se(), setTimeout(se);
1098
+ if (y.state.next({
1099
+ isSubmitted: !0,
1100
+ isSubmitting: !1,
1101
+ isSubmitSuccessful: le(t.errors) && !_,
1102
+ submitCount: t.submitCount + 1,
1103
+ errors: t.errors
1104
+ }), _)
1105
+ throw _;
1106
+ }, W = (o, a = {}) => {
1107
+ p(s, o) && ($(a.defaultValue) ? X(o, te(p(n, o))) : (X(o, a.defaultValue), H(n, o, te(a.defaultValue))), a.keepTouched || ee(t.touchedFields, o), a.keepDirty || (ee(t.dirtyFields, o), t.isDirty = a.defaultValue ? F(o, te(p(n, o))) : F()), a.keepError || (ee(t.errors, o), m.isValid && M()), y.state.next({ ...t }));
1108
+ }, me = (o, a = {}) => {
1109
+ const u = o ? te(o) : n, _ = te(u), x = le(o), f = x ? n : _;
1110
+ if (a.keepDefaultValues || (n = u), !a.keepValues) {
1111
+ if (a.keepDirtyValues)
1112
+ for (const C of c.mount)
1113
+ p(t.dirtyFields, C) ? H(f, C, p(i, C)) : X(C, p(f, C));
1114
+ else {
1115
+ if (Ut && $(o))
1116
+ for (const C of c.mount) {
1117
+ const L = p(s, C);
1118
+ if (L && L._f) {
1119
+ const J = Array.isArray(L._f.refs) ? L._f.refs[0] : L._f.ref;
1120
+ if (lt(J)) {
1121
+ const ue = J.closest("form");
1122
+ if (ue) {
1123
+ ue.reset();
1124
+ break;
1125
+ }
1126
+ }
1127
+ }
1128
+ }
1129
+ s = {};
1130
+ }
1131
+ i = e.shouldUnregister ? a.keepDefaultValues ? te(n) : {} : te(f), y.array.next({
1132
+ values: { ...f }
1133
+ }), y.values.next({
1134
+ values: { ...f }
1135
+ });
1136
+ }
1137
+ c = {
1138
+ mount: a.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
1139
+ unMount: /* @__PURE__ */ new Set(),
1140
+ array: /* @__PURE__ */ new Set(),
1141
+ watch: /* @__PURE__ */ new Set(),
1142
+ watchAll: !1,
1143
+ focus: ""
1144
+ }, l.mount = !m.isValid || !!a.keepIsValid || !!a.keepDirtyValues, l.watch = !!e.shouldUnregister, y.state.next({
1145
+ submitCount: a.keepSubmitCount ? t.submitCount : 0,
1146
+ isDirty: x ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !Me(o, n)),
1147
+ isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
1148
+ dirtyFields: x ? {} : a.keepDirtyValues ? a.keepDefaultValues && i ? ot(n, i) : t.dirtyFields : a.keepDefaultValues && o ? ot(n, o) : a.keepDirty ? t.dirtyFields : {},
1149
+ touchedFields: a.keepTouched ? t.touchedFields : {},
1150
+ errors: a.keepErrors ? t.errors : {},
1151
+ isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1152
+ isSubmitting: !1
1153
+ });
1154
+ }, ye = (o, a) => me(Ie(o) ? o(i) : o, a);
1155
+ return {
1156
+ control: {
1157
+ register: K,
1158
+ unregister: be,
1159
+ getFieldState: je,
1160
+ handleSubmit: U,
1161
+ setError: _e,
1162
+ _executeSchema: k,
1163
+ _getWatch: N,
1164
+ _getDirty: F,
1165
+ _updateValid: M,
1166
+ _removeUnmounted: de,
1167
+ _updateFieldArray: g,
1168
+ _updateDisabledField: R,
1169
+ _getFieldArray: B,
1170
+ _reset: me,
1171
+ _resetDefaultValues: () => Ie(r.defaultValues) && r.defaultValues().then((o) => {
1172
+ ye(o, r.resetOptions), y.state.next({
1173
+ isLoading: !1
1174
+ });
1175
+ }),
1176
+ _updateFormState: (o) => {
1177
+ t = {
1178
+ ...t,
1179
+ ...o
1180
+ };
1181
+ },
1182
+ _disableForm: q,
1183
+ _subjects: y,
1184
+ _proxyFormState: m,
1185
+ _setErrors: Z,
1186
+ get _fields() {
1187
+ return s;
1188
+ },
1189
+ get _formValues() {
1190
+ return i;
1191
+ },
1192
+ get _state() {
1193
+ return l;
1194
+ },
1195
+ set _state(o) {
1196
+ l = o;
1197
+ },
1198
+ get _defaultValues() {
1199
+ return n;
1200
+ },
1201
+ get _names() {
1202
+ return c;
1203
+ },
1204
+ set _names(o) {
1205
+ c = o;
1206
+ },
1207
+ get _formState() {
1208
+ return t;
1209
+ },
1210
+ set _formState(o) {
1211
+ t = o;
1212
+ },
1213
+ get _options() {
1214
+ return r;
1215
+ },
1216
+ set _options(o) {
1217
+ r = {
1218
+ ...r,
1219
+ ...o
1220
+ };
1221
+ }
1222
+ },
1223
+ trigger: Se,
1224
+ register: K,
1225
+ handleSubmit: U,
1226
+ watch: Le,
1227
+ setValue: X,
1228
+ getValues: ke,
1229
+ reset: ye,
1230
+ resetField: W,
1231
+ clearErrors: ze,
1232
+ unregister: be,
1233
+ setError: _e,
1234
+ setFocus: (o, a = {}) => {
1235
+ const u = p(s, o), _ = u && u._f;
1236
+ if (_) {
1237
+ const x = _.refs ? _.refs[0] : _.ref;
1238
+ x.focus && (x.focus(), a.shouldSelect && x.select());
1239
+ }
1240
+ },
1241
+ getFieldState: je
1242
+ };
1243
+ }
1244
+ function Ko(e = {}) {
1245
+ const r = I.useRef(), t = I.useRef(), [s, n] = I.useState({
1246
+ isDirty: !1,
1247
+ isValidating: !1,
1248
+ isLoading: Ie(e.defaultValues),
1249
+ isSubmitted: !1,
1250
+ isSubmitting: !1,
1251
+ isSubmitSuccessful: !1,
1252
+ isValid: !1,
1253
+ submitCount: 0,
1254
+ dirtyFields: {},
1255
+ touchedFields: {},
1256
+ validatingFields: {},
1257
+ errors: e.errors || {},
1258
+ disabled: e.disabled || !1,
1259
+ defaultValues: Ie(e.defaultValues) ? void 0 : e.defaultValues
1260
+ });
1261
+ r.current || (r.current = {
1262
+ ...Qs(e),
1263
+ formState: s
1264
+ });
1265
+ const i = r.current.control;
1266
+ return i._options = e, ht({
1267
+ subject: i._subjects.state,
1268
+ next: (l) => {
1269
+ mr(l, i._proxyFormState, i._updateFormState, !0) && n({ ...i._formState });
1270
+ }
1271
+ }), I.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), I.useEffect(() => {
1272
+ if (i._proxyFormState.isDirty) {
1273
+ const l = i._getDirty();
1274
+ l !== s.isDirty && i._subjects.state.next({
1275
+ isDirty: l
1276
+ });
1277
+ }
1278
+ }, [i, s.isDirty]), I.useEffect(() => {
1279
+ e.values && !Me(e.values, t.current) ? (i._reset(e.values, i._options.resetOptions), t.current = e.values, n((l) => ({ ...l }))) : i._resetDefaultValues();
1280
+ }, [e.values, i]), I.useEffect(() => {
1281
+ e.errors && i._setErrors(e.errors);
1282
+ }, [e.errors, i]), I.useEffect(() => {
1283
+ i._state.mount || (i._updateValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1284
+ }), I.useEffect(() => {
1285
+ e.shouldUnregister && i._subjects.values.next({
1286
+ values: i._getWatch()
1287
+ });
1288
+ }, [e.shouldUnregister, i]), r.current.formState = hr(s, i), r.current;
1289
+ }
1290
+ function sr(e, [r, t]) {
1291
+ return Math.min(t, Math.max(r, e));
1292
+ }
1293
+ function Js(e) {
1294
+ const r = h.useRef({ value: e, previous: e });
1295
+ return h.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
1296
+ }
1297
+ var eo = [" ", "Enter", "ArrowUp", "ArrowDown"], to = [" ", "Enter"], et = "Select", [mt, yt, ro] = ps(et), [Ge, $o] = hs(et, [
1298
+ ro,
1299
+ nr
1300
+ ]), gt = nr(), [so, De] = Ge(et), [oo, no] = Ge(et), Cr = (e) => {
1301
+ const {
1302
+ __scopeSelect: r,
1303
+ children: t,
1304
+ open: s,
1305
+ defaultOpen: n,
1306
+ onOpenChange: i,
1307
+ value: l,
1308
+ defaultValue: c,
1309
+ onValueChange: d,
1310
+ dir: S,
1311
+ name: m,
1312
+ autoComplete: y,
1313
+ disabled: E,
1314
+ required: O
1315
+ } = e, w = gt(r), [P, M] = h.useState(null), [T, g] = h.useState(null), [D, Z] = h.useState(!1), v = Es(S), [A = !1, V] = Yt({
1316
+ prop: s,
1317
+ defaultProp: n,
1318
+ onChange: i
1319
+ }), [k, Q] = Yt({
1320
+ prop: l,
1321
+ defaultProp: c,
1322
+ onChange: d
1323
+ }), z = h.useRef(null), de = P ? !!P.closest("form") : !0, [F, N] = h.useState(/* @__PURE__ */ new Set()), B = Array.from(F).map((j) => j.props.value).join(";");
1324
+ return /* @__PURE__ */ b.jsx(Fs, { ...w, children: /* @__PURE__ */ b.jsxs(
1325
+ so,
1326
+ {
1327
+ required: O,
1328
+ scope: r,
1329
+ trigger: P,
1330
+ onTriggerChange: M,
1331
+ valueNode: T,
1332
+ onValueNodeChange: g,
1333
+ valueNodeHasChildren: D,
1334
+ onValueNodeHasChildrenChange: Z,
1335
+ contentId: Bt(),
1336
+ value: k,
1337
+ onValueChange: Q,
1338
+ open: A,
1339
+ onOpenChange: V,
1340
+ dir: v,
1341
+ triggerPointerDownPosRef: z,
1342
+ disabled: E,
1343
+ children: [
1344
+ /* @__PURE__ */ b.jsx(mt.Provider, { scope: r, children: /* @__PURE__ */ b.jsx(
1345
+ oo,
1346
+ {
1347
+ scope: e.__scopeSelect,
1348
+ onNativeOptionAdd: h.useCallback((j) => {
1349
+ N((Y) => new Set(Y).add(j));
1350
+ }, []),
1351
+ onNativeOptionRemove: h.useCallback((j) => {
1352
+ N((Y) => {
1353
+ const X = new Set(Y);
1354
+ return X.delete(j), X;
1355
+ });
1356
+ }, []),
1357
+ children: t
1358
+ }
1359
+ ) }),
1360
+ de ? /* @__PURE__ */ b.jsxs(
1361
+ Zr,
1362
+ {
1363
+ "aria-hidden": !0,
1364
+ required: O,
1365
+ tabIndex: -1,
1366
+ name: m,
1367
+ autoComplete: y,
1368
+ value: k,
1369
+ onChange: (j) => Q(j.target.value),
1370
+ disabled: E,
1371
+ children: [
1372
+ k === void 0 ? /* @__PURE__ */ b.jsx("option", { value: "" }) : null,
1373
+ Array.from(F)
1374
+ ]
1375
+ },
1376
+ B
1377
+ ) : null
1378
+ ]
1379
+ }
1380
+ ) });
1381
+ };
1382
+ Cr.displayName = et;
1383
+ var Vr = "SelectTrigger", Er = h.forwardRef(
1384
+ (e, r) => {
1385
+ const { __scopeSelect: t, disabled: s = !1, ...n } = e, i = gt(t), l = De(Vr, t), c = l.disabled || s, d = xe(r, l.onTriggerChange), S = yt(t), [m, y, E] = Qr((w) => {
1386
+ const P = S().filter((g) => !g.disabled), M = P.find((g) => g.value === l.value), T = Jr(P, w, M);
1387
+ T !== void 0 && l.onValueChange(T.value);
1388
+ }), O = () => {
1389
+ c || (l.onOpenChange(!0), E());
1390
+ };
1391
+ return /* @__PURE__ */ b.jsx(ms, { asChild: !0, ...i, children: /* @__PURE__ */ b.jsx(
1392
+ he.button,
1393
+ {
1394
+ type: "button",
1395
+ role: "combobox",
1396
+ "aria-controls": l.contentId,
1397
+ "aria-expanded": l.open,
1398
+ "aria-required": l.required,
1399
+ "aria-autocomplete": "none",
1400
+ dir: l.dir,
1401
+ "data-state": l.open ? "open" : "closed",
1402
+ disabled: c,
1403
+ "data-disabled": c ? "" : void 0,
1404
+ "data-placeholder": Xr(l.value) ? "" : void 0,
1405
+ ...n,
1406
+ ref: d,
1407
+ onClick: ne(n.onClick, (w) => {
1408
+ w.currentTarget.focus();
1409
+ }),
1410
+ onPointerDown: ne(n.onPointerDown, (w) => {
1411
+ const P = w.target;
1412
+ P.hasPointerCapture(w.pointerId) && P.releasePointerCapture(w.pointerId), w.button === 0 && w.ctrlKey === !1 && (O(), l.triggerPointerDownPosRef.current = {
1413
+ x: Math.round(w.pageX),
1414
+ y: Math.round(w.pageY)
1415
+ }, w.preventDefault());
1416
+ }),
1417
+ onKeyDown: ne(n.onKeyDown, (w) => {
1418
+ const P = m.current !== "";
1419
+ !(w.ctrlKey || w.altKey || w.metaKey) && w.key.length === 1 && y(w.key), !(P && w.key === " ") && eo.includes(w.key) && (O(), w.preventDefault());
1420
+ })
1421
+ }
1422
+ ) });
1423
+ }
1424
+ );
1425
+ Er.displayName = Vr;
1426
+ var Fr = "SelectValue", Tr = h.forwardRef(
1427
+ (e, r) => {
1428
+ const { __scopeSelect: t, className: s, style: n, children: i, placeholder: l = "", ...c } = e, d = De(Fr, t), { onValueNodeHasChildrenChange: S } = d, m = i !== void 0, y = xe(r, d.onValueNodeChange);
1429
+ return Ne(() => {
1430
+ S(m);
1431
+ }, [S, m]), /* @__PURE__ */ b.jsx(
1432
+ he.span,
1433
+ {
1434
+ ...c,
1435
+ ref: y,
1436
+ style: { pointerEvents: "none" },
1437
+ children: Xr(d.value) ? /* @__PURE__ */ b.jsx(b.Fragment, { children: l }) : i
1438
+ }
1439
+ );
1440
+ }
1441
+ );
1442
+ Tr.displayName = Fr;
1443
+ var io = "SelectIcon", Rr = h.forwardRef(
1444
+ (e, r) => {
1445
+ const { __scopeSelect: t, children: s, ...n } = e;
1446
+ return /* @__PURE__ */ b.jsx(he.span, { "aria-hidden": !0, ...n, ref: r, children: s || "▼" });
1447
+ }
1448
+ );
1449
+ Rr.displayName = io;
1450
+ var ao = "SelectPortal", Ir = (e) => /* @__PURE__ */ b.jsx(Vs, { asChild: !0, ...e });
1451
+ Ir.displayName = ao;
1452
+ var Oe = "SelectContent", Nr = h.forwardRef(
1453
+ (e, r) => {
1454
+ const t = De(Oe, e.__scopeSelect), [s, n] = h.useState();
1455
+ if (Ne(() => {
1456
+ n(new DocumentFragment());
1457
+ }, []), !t.open) {
1458
+ const i = s;
1459
+ return i ? ar.createPortal(
1460
+ /* @__PURE__ */ b.jsx(Dr, { scope: e.__scopeSelect, children: /* @__PURE__ */ b.jsx(mt.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ b.jsx("div", { children: e.children }) }) }),
1461
+ i
1462
+ ) : null;
1463
+ }
1464
+ return /* @__PURE__ */ b.jsx(Pr, { ...e, ref: r });
1465
+ }
1466
+ );
1467
+ Nr.displayName = Oe;
1468
+ var Ae = 10, [Dr, Pe] = Ge(Oe), lo = "SelectContentImpl", Pr = h.forwardRef(
1469
+ (e, r) => {
1470
+ const {
1471
+ __scopeSelect: t,
1472
+ position: s = "item-aligned",
1473
+ onCloseAutoFocus: n,
1474
+ onEscapeKeyDown: i,
1475
+ onPointerDownOutside: l,
1476
+ //
1477
+ // PopperContent props
1478
+ side: c,
1479
+ sideOffset: d,
1480
+ align: S,
1481
+ alignOffset: m,
1482
+ arrowPadding: y,
1483
+ collisionBoundary: E,
1484
+ collisionPadding: O,
1485
+ sticky: w,
1486
+ hideWhenDetached: P,
1487
+ avoidCollisions: M,
1488
+ //
1489
+ ...T
1490
+ } = e, g = De(Oe, t), [D, Z] = h.useState(null), [v, A] = h.useState(null), V = xe(r, (R) => Z(R)), [k, Q] = h.useState(null), [z, de] = h.useState(
1491
+ null
1492
+ ), F = yt(t), [N, B] = h.useState(!1), j = h.useRef(!1);
1493
+ h.useEffect(() => {
1494
+ if (D) return ys(D);
1495
+ }, [D]), gs();
1496
+ const Y = h.useCallback(
1497
+ (R) => {
1498
+ const [K, ...se] = F().map((W) => W.ref.current), [q] = se.slice(-1), U = document.activeElement;
1499
+ for (const W of R)
1500
+ if (W === U || (W == null || W.scrollIntoView({ block: "nearest" }), W === K && v && (v.scrollTop = 0), W === q && v && (v.scrollTop = v.scrollHeight), W == null || W.focus(), document.activeElement !== U)) return;
1501
+ },
1502
+ [F, v]
1503
+ ), X = h.useCallback(
1504
+ () => Y([k, D]),
1505
+ [Y, k, D]
1506
+ );
1507
+ h.useEffect(() => {
1508
+ N && X();
1509
+ }, [N, X]);
1510
+ const { onOpenChange: fe, triggerPointerDownPosRef: ie } = g;
1511
+ h.useEffect(() => {
1512
+ if (D) {
1513
+ let R = { x: 0, y: 0 };
1514
+ const K = (q) => {
1515
+ var U, W;
1516
+ R = {
1517
+ x: Math.abs(Math.round(q.pageX) - (((U = ie.current) == null ? void 0 : U.x) ?? 0)),
1518
+ y: Math.abs(Math.round(q.pageY) - (((W = ie.current) == null ? void 0 : W.y) ?? 0))
1519
+ };
1520
+ }, se = (q) => {
1521
+ R.x <= 10 && R.y <= 10 ? q.preventDefault() : D.contains(q.target) || fe(!1), document.removeEventListener("pointermove", K), ie.current = null;
1522
+ };
1523
+ return ie.current !== null && (document.addEventListener("pointermove", K), document.addEventListener("pointerup", se, { capture: !0, once: !0 })), () => {
1524
+ document.removeEventListener("pointermove", K), document.removeEventListener("pointerup", se, { capture: !0 });
1525
+ };
1526
+ }
1527
+ }, [D, fe, ie]), h.useEffect(() => {
1528
+ const R = () => fe(!1);
1529
+ return window.addEventListener("blur", R), window.addEventListener("resize", R), () => {
1530
+ window.removeEventListener("blur", R), window.removeEventListener("resize", R);
1531
+ };
1532
+ }, [fe]);
1533
+ const [Se, ke] = Qr((R) => {
1534
+ const K = F().filter((U) => !U.disabled), se = K.find((U) => U.ref.current === document.activeElement), q = Jr(K, R, se);
1535
+ q && setTimeout(() => q.ref.current.focus());
1536
+ }), je = h.useCallback(
1537
+ (R, K, se) => {
1538
+ const q = !j.current && !se;
1539
+ (g.value !== void 0 && g.value === K || q) && (Q(R), q && (j.current = !0));
1540
+ },
1541
+ [g.value]
1542
+ ), ze = h.useCallback(() => D == null ? void 0 : D.focus(), [D]), _e = h.useCallback(
1543
+ (R, K, se) => {
1544
+ const q = !j.current && !se;
1545
+ (g.value !== void 0 && g.value === K || q) && de(R);
1546
+ },
1547
+ [g.value]
1548
+ ), Le = s === "popper" ? kt : kr, be = Le === kt ? {
1549
+ side: c,
1550
+ sideOffset: d,
1551
+ align: S,
1552
+ alignOffset: m,
1553
+ arrowPadding: y,
1554
+ collisionBoundary: E,
1555
+ collisionPadding: O,
1556
+ sticky: w,
1557
+ hideWhenDetached: P,
1558
+ avoidCollisions: M
1559
+ } : {};
1560
+ return /* @__PURE__ */ b.jsx(
1561
+ Dr,
1562
+ {
1563
+ scope: t,
1564
+ content: D,
1565
+ viewport: v,
1566
+ onViewportChange: A,
1567
+ itemRefCallback: je,
1568
+ selectedItem: k,
1569
+ onItemLeave: ze,
1570
+ itemTextRefCallback: _e,
1571
+ focusSelectedItem: X,
1572
+ selectedItemText: z,
1573
+ position: s,
1574
+ isPositioned: N,
1575
+ searchRef: Se,
1576
+ children: /* @__PURE__ */ b.jsx(vs, { as: xs, allowPinchZoom: !0, children: /* @__PURE__ */ b.jsx(
1577
+ Ss,
1578
+ {
1579
+ asChild: !0,
1580
+ trapped: g.open,
1581
+ onMountAutoFocus: (R) => {
1582
+ R.preventDefault();
1583
+ },
1584
+ onUnmountAutoFocus: ne(n, (R) => {
1585
+ var K;
1586
+ (K = g.trigger) == null || K.focus({ preventScroll: !0 }), R.preventDefault();
1587
+ }),
1588
+ children: /* @__PURE__ */ b.jsx(
1589
+ _s,
1590
+ {
1591
+ asChild: !0,
1592
+ disableOutsidePointerEvents: !0,
1593
+ onEscapeKeyDown: i,
1594
+ onPointerDownOutside: l,
1595
+ onFocusOutside: (R) => R.preventDefault(),
1596
+ onDismiss: () => g.onOpenChange(!1),
1597
+ children: /* @__PURE__ */ b.jsx(
1598
+ Le,
1599
+ {
1600
+ role: "listbox",
1601
+ id: g.contentId,
1602
+ "data-state": g.open ? "open" : "closed",
1603
+ dir: g.dir,
1604
+ onContextMenu: (R) => R.preventDefault(),
1605
+ ...T,
1606
+ ...be,
1607
+ onPlaced: () => B(!0),
1608
+ ref: V,
1609
+ style: {
1610
+ // flex layout so we can place the scroll buttons properly
1611
+ display: "flex",
1612
+ flexDirection: "column",
1613
+ // reset the outline by default as the content MAY get focused
1614
+ outline: "none",
1615
+ ...T.style
1616
+ },
1617
+ onKeyDown: ne(T.onKeyDown, (R) => {
1618
+ const K = R.ctrlKey || R.altKey || R.metaKey;
1619
+ if (R.key === "Tab" && R.preventDefault(), !K && R.key.length === 1 && ke(R.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(R.key)) {
1620
+ let q = F().filter((U) => !U.disabled).map((U) => U.ref.current);
1621
+ if (["ArrowUp", "End"].includes(R.key) && (q = q.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(R.key)) {
1622
+ const U = R.target, W = q.indexOf(U);
1623
+ q = q.slice(W + 1);
1624
+ }
1625
+ setTimeout(() => Y(q)), R.preventDefault();
1626
+ }
1627
+ })
1628
+ }
1629
+ )
1630
+ }
1631
+ )
1632
+ }
1633
+ ) })
1634
+ }
1635
+ );
1636
+ }
1637
+ );
1638
+ Pr.displayName = lo;
1639
+ var co = "SelectItemAlignedPosition", kr = h.forwardRef((e, r) => {
1640
+ const { __scopeSelect: t, onPlaced: s, ...n } = e, i = De(Oe, t), l = Pe(Oe, t), [c, d] = h.useState(null), [S, m] = h.useState(null), y = xe(r, (V) => m(V)), E = yt(t), O = h.useRef(!1), w = h.useRef(!0), { viewport: P, selectedItem: M, selectedItemText: T, focusSelectedItem: g } = l, D = h.useCallback(() => {
1641
+ if (i.trigger && i.valueNode && c && S && P && M && T) {
1642
+ const V = i.trigger.getBoundingClientRect(), k = S.getBoundingClientRect(), Q = i.valueNode.getBoundingClientRect(), z = T.getBoundingClientRect();
1643
+ if (i.dir !== "rtl") {
1644
+ const U = z.left - k.left, W = Q.left - U, me = V.left - W, ye = V.width + me, tt = Math.max(ye, k.width), rt = window.innerWidth - Ae, st = sr(W, [Ae, rt - tt]);
1645
+ c.style.minWidth = ye + "px", c.style.left = st + "px";
1646
+ } else {
1647
+ const U = k.right - z.right, W = window.innerWidth - Q.right - U, me = window.innerWidth - V.right - W, ye = V.width + me, tt = Math.max(ye, k.width), rt = window.innerWidth - Ae, st = sr(W, [Ae, rt - tt]);
1648
+ c.style.minWidth = ye + "px", c.style.right = st + "px";
1649
+ }
1650
+ const de = E(), F = window.innerHeight - Ae * 2, N = P.scrollHeight, B = window.getComputedStyle(S), j = parseInt(B.borderTopWidth, 10), Y = parseInt(B.paddingTop, 10), X = parseInt(B.borderBottomWidth, 10), fe = parseInt(B.paddingBottom, 10), ie = j + Y + N + fe + X, Se = Math.min(M.offsetHeight * 5, ie), ke = window.getComputedStyle(P), je = parseInt(ke.paddingTop, 10), ze = parseInt(ke.paddingBottom, 10), _e = V.top + V.height / 2 - Ae, Le = F - _e, be = M.offsetHeight / 2, R = M.offsetTop + be, K = j + Y + R, se = ie - K;
1651
+ if (K <= _e) {
1652
+ const U = M === de[de.length - 1].ref.current;
1653
+ c.style.bottom = "0px";
1654
+ const W = S.clientHeight - P.offsetTop - P.offsetHeight, me = Math.max(
1655
+ Le,
1656
+ be + // viewport might have padding bottom, include it to avoid a scrollable viewport
1657
+ (U ? ze : 0) + W + X
1658
+ ), ye = K + me;
1659
+ c.style.height = ye + "px";
1660
+ } else {
1661
+ const U = M === de[0].ref.current;
1662
+ c.style.top = "0px";
1663
+ const me = Math.max(
1664
+ _e,
1665
+ j + P.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1666
+ (U ? je : 0) + be
1667
+ ) + se;
1668
+ c.style.height = me + "px", P.scrollTop = K - _e + P.offsetTop;
1669
+ }
1670
+ c.style.margin = `${Ae}px 0`, c.style.minHeight = Se + "px", c.style.maxHeight = F + "px", s == null || s(), requestAnimationFrame(() => O.current = !0);
1671
+ }
1672
+ }, [
1673
+ E,
1674
+ i.trigger,
1675
+ i.valueNode,
1676
+ c,
1677
+ S,
1678
+ P,
1679
+ M,
1680
+ T,
1681
+ i.dir,
1682
+ s
1683
+ ]);
1684
+ Ne(() => D(), [D]);
1685
+ const [Z, v] = h.useState();
1686
+ Ne(() => {
1687
+ S && v(window.getComputedStyle(S).zIndex);
1688
+ }, [S]);
1689
+ const A = h.useCallback(
1690
+ (V) => {
1691
+ V && w.current === !0 && (D(), g == null || g(), w.current = !1);
1692
+ },
1693
+ [D, g]
1694
+ );
1695
+ return /* @__PURE__ */ b.jsx(
1696
+ fo,
1697
+ {
1698
+ scope: t,
1699
+ contentWrapper: c,
1700
+ shouldExpandOnScrollRef: O,
1701
+ onScrollButtonChange: A,
1702
+ children: /* @__PURE__ */ b.jsx(
1703
+ "div",
1704
+ {
1705
+ ref: d,
1706
+ style: {
1707
+ display: "flex",
1708
+ flexDirection: "column",
1709
+ position: "fixed",
1710
+ zIndex: Z
1711
+ },
1712
+ children: /* @__PURE__ */ b.jsx(
1713
+ he.div,
1714
+ {
1715
+ ...n,
1716
+ ref: y,
1717
+ style: {
1718
+ // When we get the height of the content, it includes borders. If we were to set
1719
+ // the height without having `boxSizing: 'border-box'` it would be too big.
1720
+ boxSizing: "border-box",
1721
+ // We need to ensure the content doesn't get taller than the wrapper
1722
+ maxHeight: "100%",
1723
+ ...n.style
1724
+ }
1725
+ }
1726
+ )
1727
+ }
1728
+ )
1729
+ }
1730
+ );
1731
+ });
1732
+ kr.displayName = co;
1733
+ var uo = "SelectPopperPosition", kt = h.forwardRef((e, r) => {
1734
+ const {
1735
+ __scopeSelect: t,
1736
+ align: s = "start",
1737
+ collisionPadding: n = Ae,
1738
+ ...i
1739
+ } = e, l = gt(t);
1740
+ return /* @__PURE__ */ b.jsx(
1741
+ bs,
1742
+ {
1743
+ ...l,
1744
+ ...i,
1745
+ ref: r,
1746
+ align: s,
1747
+ collisionPadding: n,
1748
+ style: {
1749
+ // Ensure border-box for floating-ui calculations
1750
+ boxSizing: "border-box",
1751
+ ...i.style,
1752
+ "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1753
+ "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1754
+ "--radix-select-content-available-height": "var(--radix-popper-available-height)",
1755
+ "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
1756
+ "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
1757
+ }
1758
+ }
1759
+ );
1760
+ });
1761
+ kt.displayName = uo;
1762
+ var [fo, $t] = Ge(Oe, {}), Mt = "SelectViewport", Mr = h.forwardRef(
1763
+ (e, r) => {
1764
+ const { __scopeSelect: t, nonce: s, ...n } = e, i = Pe(Mt, t), l = $t(Mt, t), c = xe(r, i.onViewportChange), d = h.useRef(0);
1765
+ return /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
1766
+ /* @__PURE__ */ b.jsx(
1767
+ "style",
1768
+ {
1769
+ dangerouslySetInnerHTML: {
1770
+ __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
1771
+ },
1772
+ nonce: s
1773
+ }
1774
+ ),
1775
+ /* @__PURE__ */ b.jsx(mt.Slot, { scope: t, children: /* @__PURE__ */ b.jsx(
1776
+ he.div,
1777
+ {
1778
+ "data-radix-select-viewport": "",
1779
+ role: "presentation",
1780
+ ...n,
1781
+ ref: c,
1782
+ style: {
1783
+ // we use position: 'relative' here on the `viewport` so that when we call
1784
+ // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
1785
+ // (independent of the scrollUpButton).
1786
+ position: "relative",
1787
+ flex: 1,
1788
+ overflow: "auto",
1789
+ ...n.style
1790
+ },
1791
+ onScroll: ne(n.onScroll, (S) => {
1792
+ const m = S.currentTarget, { contentWrapper: y, shouldExpandOnScrollRef: E } = l;
1793
+ if (E != null && E.current && y) {
1794
+ const O = Math.abs(d.current - m.scrollTop);
1795
+ if (O > 0) {
1796
+ const w = window.innerHeight - Ae * 2, P = parseFloat(y.style.minHeight), M = parseFloat(y.style.height), T = Math.max(P, M);
1797
+ if (T < w) {
1798
+ const g = T + O, D = Math.min(w, g), Z = g - D;
1799
+ y.style.height = D + "px", y.style.bottom === "0px" && (m.scrollTop = Z > 0 ? Z : 0, y.style.justifyContent = "flex-end");
1800
+ }
1801
+ }
1802
+ }
1803
+ d.current = m.scrollTop;
1804
+ })
1805
+ }
1806
+ ) })
1807
+ ] });
1808
+ }
1809
+ );
1810
+ Mr.displayName = Mt;
1811
+ var Or = "SelectGroup", [po, ho] = Ge(Or), jr = h.forwardRef(
1812
+ (e, r) => {
1813
+ const { __scopeSelect: t, ...s } = e, n = Bt();
1814
+ return /* @__PURE__ */ b.jsx(po, { scope: t, id: n, children: /* @__PURE__ */ b.jsx(he.div, { role: "group", "aria-labelledby": n, ...s, ref: r }) });
1815
+ }
1816
+ );
1817
+ jr.displayName = Or;
1818
+ var Lr = "SelectLabel", Br = h.forwardRef(
1819
+ (e, r) => {
1820
+ const { __scopeSelect: t, ...s } = e, n = ho(Lr, t);
1821
+ return /* @__PURE__ */ b.jsx(he.div, { id: n.id, ...s, ref: r });
1822
+ }
1823
+ );
1824
+ Br.displayName = Lr;
1825
+ var ft = "SelectItem", [mo, Ur] = Ge(ft), Hr = h.forwardRef(
1826
+ (e, r) => {
1827
+ const {
1828
+ __scopeSelect: t,
1829
+ value: s,
1830
+ disabled: n = !1,
1831
+ textValue: i,
1832
+ ...l
1833
+ } = e, c = De(ft, t), d = Pe(ft, t), S = c.value === s, [m, y] = h.useState(i ?? ""), [E, O] = h.useState(!1), w = xe(
1834
+ r,
1835
+ (T) => {
1836
+ var g;
1837
+ return (g = d.itemRefCallback) == null ? void 0 : g.call(d, T, s, n);
1838
+ }
1839
+ ), P = Bt(), M = () => {
1840
+ n || (c.onValueChange(s), c.onOpenChange(!1));
1841
+ };
1842
+ if (s === "")
1843
+ throw new Error(
1844
+ "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."
1845
+ );
1846
+ return /* @__PURE__ */ b.jsx(
1847
+ mo,
1848
+ {
1849
+ scope: t,
1850
+ value: s,
1851
+ disabled: n,
1852
+ textId: P,
1853
+ isSelected: S,
1854
+ onItemTextChange: h.useCallback((T) => {
1855
+ y((g) => g || ((T == null ? void 0 : T.textContent) ?? "").trim());
1856
+ }, []),
1857
+ children: /* @__PURE__ */ b.jsx(
1858
+ mt.ItemSlot,
1859
+ {
1860
+ scope: t,
1861
+ value: s,
1862
+ disabled: n,
1863
+ textValue: m,
1864
+ children: /* @__PURE__ */ b.jsx(
1865
+ he.div,
1866
+ {
1867
+ role: "option",
1868
+ "aria-labelledby": P,
1869
+ "data-highlighted": E ? "" : void 0,
1870
+ "aria-selected": S && E,
1871
+ "data-state": S ? "checked" : "unchecked",
1872
+ "aria-disabled": n || void 0,
1873
+ "data-disabled": n ? "" : void 0,
1874
+ tabIndex: n ? void 0 : -1,
1875
+ ...l,
1876
+ ref: w,
1877
+ onFocus: ne(l.onFocus, () => O(!0)),
1878
+ onBlur: ne(l.onBlur, () => O(!1)),
1879
+ onPointerUp: ne(l.onPointerUp, M),
1880
+ onPointerMove: ne(l.onPointerMove, (T) => {
1881
+ var g;
1882
+ n ? (g = d.onItemLeave) == null || g.call(d) : T.currentTarget.focus({ preventScroll: !0 });
1883
+ }),
1884
+ onPointerLeave: ne(l.onPointerLeave, (T) => {
1885
+ var g;
1886
+ T.currentTarget === document.activeElement && ((g = d.onItemLeave) == null || g.call(d));
1887
+ }),
1888
+ onKeyDown: ne(l.onKeyDown, (T) => {
1889
+ var D;
1890
+ ((D = d.searchRef) == null ? void 0 : D.current) !== "" && T.key === " " || (to.includes(T.key) && M(), T.key === " " && T.preventDefault());
1891
+ })
1892
+ }
1893
+ )
1894
+ }
1895
+ )
1896
+ }
1897
+ );
1898
+ }
1899
+ );
1900
+ Hr.displayName = ft;
1901
+ var Xe = "SelectItemText", Wr = h.forwardRef(
1902
+ (e, r) => {
1903
+ const { __scopeSelect: t, className: s, style: n, ...i } = e, l = De(Xe, t), c = Pe(Xe, t), d = Ur(Xe, t), S = no(Xe, t), [m, y] = h.useState(null), E = xe(
1904
+ r,
1905
+ (T) => y(T),
1906
+ d.onItemTextChange,
1907
+ (T) => {
1908
+ var g;
1909
+ return (g = c.itemTextRefCallback) == null ? void 0 : g.call(c, T, d.value, d.disabled);
1910
+ }
1911
+ ), O = m == null ? void 0 : m.textContent, w = h.useMemo(
1912
+ () => /* @__PURE__ */ b.jsx("option", { value: d.value, disabled: d.disabled, children: O }, d.value),
1913
+ [d.disabled, d.value, O]
1914
+ ), { onNativeOptionAdd: P, onNativeOptionRemove: M } = S;
1915
+ return Ne(() => (P(w), () => M(w)), [P, M, w]), /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
1916
+ /* @__PURE__ */ b.jsx(he.span, { id: d.textId, ...i, ref: E }),
1917
+ d.isSelected && l.valueNode && !l.valueNodeHasChildren ? ar.createPortal(i.children, l.valueNode) : null
1918
+ ] });
1919
+ }
1920
+ );
1921
+ Wr.displayName = Xe;
1922
+ var Kr = "SelectItemIndicator", $r = h.forwardRef(
1923
+ (e, r) => {
1924
+ const { __scopeSelect: t, ...s } = e;
1925
+ return Ur(Kr, t).isSelected ? /* @__PURE__ */ b.jsx(he.span, { "aria-hidden": !0, ...s, ref: r }) : null;
1926
+ }
1927
+ );
1928
+ $r.displayName = Kr;
1929
+ var Ot = "SelectScrollUpButton", qr = h.forwardRef((e, r) => {
1930
+ const t = Pe(Ot, e.__scopeSelect), s = $t(Ot, e.__scopeSelect), [n, i] = h.useState(!1), l = xe(r, s.onScrollButtonChange);
1931
+ return Ne(() => {
1932
+ if (t.viewport && t.isPositioned) {
1933
+ let c = function() {
1934
+ const S = d.scrollTop > 0;
1935
+ i(S);
1936
+ };
1937
+ const d = t.viewport;
1938
+ return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
1939
+ }
1940
+ }, [t.viewport, t.isPositioned]), n ? /* @__PURE__ */ b.jsx(
1941
+ zr,
1942
+ {
1943
+ ...e,
1944
+ ref: l,
1945
+ onAutoScroll: () => {
1946
+ const { viewport: c, selectedItem: d } = t;
1947
+ c && d && (c.scrollTop = c.scrollTop - d.offsetHeight);
1948
+ }
1949
+ }
1950
+ ) : null;
1951
+ });
1952
+ qr.displayName = Ot;
1953
+ var jt = "SelectScrollDownButton", Gr = h.forwardRef((e, r) => {
1954
+ const t = Pe(jt, e.__scopeSelect), s = $t(jt, e.__scopeSelect), [n, i] = h.useState(!1), l = xe(r, s.onScrollButtonChange);
1955
+ return Ne(() => {
1956
+ if (t.viewport && t.isPositioned) {
1957
+ let c = function() {
1958
+ const S = d.scrollHeight - d.clientHeight, m = Math.ceil(d.scrollTop) < S;
1959
+ i(m);
1960
+ };
1961
+ const d = t.viewport;
1962
+ return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
1963
+ }
1964
+ }, [t.viewport, t.isPositioned]), n ? /* @__PURE__ */ b.jsx(
1965
+ zr,
1966
+ {
1967
+ ...e,
1968
+ ref: l,
1969
+ onAutoScroll: () => {
1970
+ const { viewport: c, selectedItem: d } = t;
1971
+ c && d && (c.scrollTop = c.scrollTop + d.offsetHeight);
1972
+ }
1973
+ }
1974
+ ) : null;
1975
+ });
1976
+ Gr.displayName = jt;
1977
+ var zr = h.forwardRef((e, r) => {
1978
+ const { __scopeSelect: t, onAutoScroll: s, ...n } = e, i = Pe("SelectScrollButton", t), l = h.useRef(null), c = yt(t), d = h.useCallback(() => {
1979
+ l.current !== null && (window.clearInterval(l.current), l.current = null);
1980
+ }, []);
1981
+ return h.useEffect(() => () => d(), [d]), Ne(() => {
1982
+ var m;
1983
+ const S = c().find((y) => y.ref.current === document.activeElement);
1984
+ (m = S == null ? void 0 : S.ref.current) == null || m.scrollIntoView({ block: "nearest" });
1985
+ }, [c]), /* @__PURE__ */ b.jsx(
1986
+ he.div,
1987
+ {
1988
+ "aria-hidden": !0,
1989
+ ...n,
1990
+ ref: r,
1991
+ style: { flexShrink: 0, ...n.style },
1992
+ onPointerDown: ne(n.onPointerDown, () => {
1993
+ l.current === null && (l.current = window.setInterval(s, 50));
1994
+ }),
1995
+ onPointerMove: ne(n.onPointerMove, () => {
1996
+ var S;
1997
+ (S = i.onItemLeave) == null || S.call(i), l.current === null && (l.current = window.setInterval(s, 50));
1998
+ }),
1999
+ onPointerLeave: ne(n.onPointerLeave, () => {
2000
+ d();
2001
+ })
2002
+ }
2003
+ );
2004
+ }), yo = "SelectSeparator", Yr = h.forwardRef(
2005
+ (e, r) => {
2006
+ const { __scopeSelect: t, ...s } = e;
2007
+ return /* @__PURE__ */ b.jsx(he.div, { "aria-hidden": !0, ...s, ref: r });
2008
+ }
2009
+ );
2010
+ Yr.displayName = yo;
2011
+ var Lt = "SelectArrow", go = h.forwardRef(
2012
+ (e, r) => {
2013
+ const { __scopeSelect: t, ...s } = e, n = gt(t), i = De(Lt, t), l = Pe(Lt, t);
2014
+ return i.open && l.position === "popper" ? /* @__PURE__ */ b.jsx(ws, { ...n, ...s, ref: r }) : null;
2015
+ }
2016
+ );
2017
+ go.displayName = Lt;
2018
+ function Xr(e) {
2019
+ return e === "" || e === void 0;
2020
+ }
2021
+ var Zr = h.forwardRef(
2022
+ (e, r) => {
2023
+ const { value: t, ...s } = e, n = h.useRef(null), i = xe(r, n), l = Js(t);
2024
+ return h.useEffect(() => {
2025
+ const c = n.current, d = window.HTMLSelectElement.prototype, m = Object.getOwnPropertyDescriptor(
2026
+ d,
2027
+ "value"
2028
+ ).set;
2029
+ if (l !== t && m) {
2030
+ const y = new Event("change", { bubbles: !0 });
2031
+ m.call(c, t), c.dispatchEvent(y);
2032
+ }
2033
+ }, [l, t]), /* @__PURE__ */ b.jsx(As, { asChild: !0, children: /* @__PURE__ */ b.jsx("select", { ...s, ref: i, defaultValue: t }) });
2034
+ }
2035
+ );
2036
+ Zr.displayName = "BubbleSelect";
2037
+ function Qr(e) {
2038
+ const r = Cs(e), t = h.useRef(""), s = h.useRef(0), n = h.useCallback(
2039
+ (l) => {
2040
+ const c = t.current + l;
2041
+ r(c), function d(S) {
2042
+ t.current = S, window.clearTimeout(s.current), S !== "" && (s.current = window.setTimeout(() => d(""), 1e3));
2043
+ }(c);
2044
+ },
2045
+ [r]
2046
+ ), i = h.useCallback(() => {
2047
+ t.current = "", window.clearTimeout(s.current);
2048
+ }, []);
2049
+ return h.useEffect(() => () => window.clearTimeout(s.current), []), [t, n, i];
2050
+ }
2051
+ function Jr(e, r, t) {
2052
+ const n = r.length > 1 && Array.from(r).every((S) => S === r[0]) ? r[0] : r, i = t ? e.indexOf(t) : -1;
2053
+ let l = vo(e, Math.max(i, 0));
2054
+ n.length === 1 && (l = l.filter((S) => S !== t));
2055
+ const d = l.find(
2056
+ (S) => S.textValue.toLowerCase().startsWith(n.toLowerCase())
2057
+ );
2058
+ return d !== t ? d : void 0;
2059
+ }
2060
+ function vo(e, r) {
2061
+ return e.map((t, s) => e[(r + s) % e.length]);
2062
+ }
2063
+ var xo = Cr, es = Er, So = Tr, _o = Rr, bo = Ir, ts = Nr, wo = Mr, Ao = jr, rs = Br, ss = Hr, Co = Wr, Vo = $r, os = qr, ns = Gr, is = Yr;
2064
+ const qo = xo, Go = Ao, zo = So, Eo = h.forwardRef(({ className: e, children: r, ...t }, s) => /* @__PURE__ */ b.jsxs(
2065
+ es,
2066
+ {
2067
+ ref: s,
2068
+ className: Ee(
2069
+ "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",
2070
+ e
2071
+ ),
2072
+ ...t,
2073
+ children: [
2074
+ /* @__PURE__ */ b.jsx("span", { className: "truncate", children: r }),
2075
+ /* @__PURE__ */ b.jsx(_o, { asChild: !0, children: /* @__PURE__ */ b.jsx(lr, { className: "flex-shrink-0 h-4 w-4 opacity-50" }) })
2076
+ ]
2077
+ }
2078
+ ));
2079
+ Eo.displayName = es.displayName;
2080
+ const as = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
2081
+ os,
2082
+ {
2083
+ ref: t,
2084
+ className: Ee(
2085
+ "flex cursor-default items-center justify-center py-1",
2086
+ e
2087
+ ),
2088
+ ...r,
2089
+ children: /* @__PURE__ */ b.jsx(Ps, { className: "h-4 w-4" })
2090
+ }
2091
+ ));
2092
+ as.displayName = os.displayName;
2093
+ const ls = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
2094
+ ns,
2095
+ {
2096
+ ref: t,
2097
+ className: Ee(
2098
+ "flex cursor-default items-center justify-center py-1",
2099
+ e
2100
+ ),
2101
+ ...r,
2102
+ children: /* @__PURE__ */ b.jsx(lr, { className: "h-4 w-4" })
2103
+ }
2104
+ ));
2105
+ ls.displayName = ns.displayName;
2106
+ const Fo = h.forwardRef(({ className: e, children: r, position: t = "popper", ...s }, n) => /* @__PURE__ */ b.jsx(bo, { children: /* @__PURE__ */ b.jsxs(
2107
+ ts,
2108
+ {
2109
+ ref: n,
2110
+ className: Ee(
2111
+ "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",
2112
+ 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",
2113
+ e
2114
+ ),
2115
+ position: t,
2116
+ ...s,
2117
+ children: [
2118
+ /* @__PURE__ */ b.jsx(as, {}),
2119
+ /* @__PURE__ */ b.jsx(
2120
+ wo,
2121
+ {
2122
+ className: Ee(
2123
+ "p-1",
2124
+ t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
2125
+ ),
2126
+ children: r
2127
+ }
2128
+ ),
2129
+ /* @__PURE__ */ b.jsx(ls, {})
2130
+ ]
2131
+ }
2132
+ ) }));
2133
+ Fo.displayName = ts.displayName;
2134
+ const To = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
2135
+ rs,
2136
+ {
2137
+ ref: t,
2138
+ className: Ee("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
2139
+ ...r
2140
+ }
2141
+ ));
2142
+ To.displayName = rs.displayName;
2143
+ const Ro = h.forwardRef(({ className: e, children: r, ...t }, s) => /* @__PURE__ */ b.jsxs(
2144
+ ss,
2145
+ {
2146
+ ref: s,
2147
+ className: Ee(
2148
+ "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",
2149
+ e
2150
+ ),
2151
+ ...t,
2152
+ children: [
2153
+ /* @__PURE__ */ b.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ b.jsx(Vo, { children: /* @__PURE__ */ b.jsx(ks, { className: "h-4 w-4" }) }) }),
2154
+ /* @__PURE__ */ b.jsx(Co, { children: r })
2155
+ ]
2156
+ }
2157
+ ));
2158
+ Ro.displayName = ss.displayName;
2159
+ const Io = h.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ b.jsx(
2160
+ is,
2161
+ {
2162
+ ref: t,
2163
+ className: Ee("-mx-1 my-1 h-px bg-muted", e),
2164
+ ...r
2165
+ }
2166
+ ));
2167
+ Io.displayName = is.displayName;
2168
+ const No = h.forwardRef(
2169
+ ({ className: e, type: r, ...t }, s) => /* @__PURE__ */ b.jsx(
2170
+ "input",
2171
+ {
2172
+ type: r,
2173
+ className: Ee(
2174
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
2175
+ e
2176
+ ),
2177
+ ref: s,
2178
+ ...t
2179
+ }
2180
+ )
2181
+ );
2182
+ No.displayName = "Input";
2183
+ export {
2184
+ Ho as C,
2185
+ Uo as F,
2186
+ No as I,
2187
+ qo as S,
2188
+ Bo as a,
2189
+ Eo as b,
2190
+ zo as c,
2191
+ Fo as d,
2192
+ Go as e,
2193
+ Ro as f,
2194
+ Wo as g,
2195
+ pt as h,
2196
+ Ko as u
2197
+ };
2198
+ //# sourceMappingURL=Input-BEDZAKw0.js.map