zudoku 0.3.0-dev.30 → 0.3.0-dev.32

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