@prokodo/ui 0.0.7 → 0.0.8

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 (225) hide show
  1. package/README.md +1 -2
  2. package/dist/components/Accordion2.js +1 -0
  3. package/dist/components/Animated2.js +1 -0
  4. package/dist/components/AnimatedText2.js +1 -0
  5. package/dist/components/Avatar2.js +1 -0
  6. package/dist/components/BaseLink.js +1 -0
  7. package/dist/components/Button2.js +1 -0
  8. package/dist/components/Calendly2.js +1 -0
  9. package/dist/components/Card2.js +1 -0
  10. package/dist/components/Carousel2.js +1 -0
  11. package/dist/components/Chip2.js +1 -0
  12. package/dist/components/{ClassNameConfigurator-C6UbdI-d.js → ClassNameConfigurator.js} +1 -1
  13. package/dist/components/DatePicker2.js +1 -0
  14. package/dist/components/Dialog2.js +1 -0
  15. package/dist/components/Drawer2.js +1 -0
  16. package/dist/components/Form2.js +1 -0
  17. package/dist/components/GridRow.js +1 -0
  18. package/dist/components/Headline2.js +1 -0
  19. package/dist/components/Icon2.js +1 -0
  20. package/dist/components/Image2.js +1 -0
  21. package/dist/components/ImageText.js +1 -0
  22. package/dist/components/Input2.js +1 -0
  23. package/dist/components/InputOTP2.js +1 -0
  24. package/dist/components/Label2.js +1 -0
  25. package/dist/components/Link2.js +1 -0
  26. package/dist/components/List2.js +1 -0
  27. package/dist/components/Loading2.js +1 -0
  28. package/dist/components/Lottie2.js +1 -0
  29. package/dist/components/Map2.js +1 -0
  30. package/dist/components/PostItem.js +1 -0
  31. package/dist/components/PostTeaser.js +1 -0
  32. package/dist/components/PostWidget.js +1 -0
  33. package/dist/components/PostWidgetCarousel.js +1 -0
  34. package/dist/components/Quote2.js +1 -0
  35. package/dist/components/RichText.js +1 -0
  36. package/dist/components/{Select-DbjU6dlH.js → Select2.js} +1 -1
  37. package/dist/components/Skeleton2.js +1 -0
  38. package/dist/components/Slider2.js +1 -0
  39. package/dist/components/Stepper2.js +1 -0
  40. package/dist/components/Switch2.js +1 -0
  41. package/dist/components/Table2.js +1 -0
  42. package/dist/components/Teaser2.js +1 -0
  43. package/dist/components/accordion.js +1 -1
  44. package/dist/components/animated.js +1 -1
  45. package/dist/components/animatedText.js +1 -1
  46. package/dist/components/avatar.js +1 -1
  47. package/dist/components/base-link.js +1 -1
  48. package/dist/components/button.js +1 -1
  49. package/dist/components/calendly.js +1 -1
  50. package/dist/components/card.js +1 -1
  51. package/dist/components/carousel.js +1 -1
  52. package/dist/components/chip.js +1 -1
  53. package/dist/components/datePicker.js +1 -1
  54. package/dist/components/dialog.js +1 -1
  55. package/dist/components/drawer.js +1 -1
  56. package/dist/components/form.js +1 -1
  57. package/dist/components/grid.js +1 -1
  58. package/dist/components/headline.js +1 -1
  59. package/dist/components/icon.js +1 -1
  60. package/dist/components/image-text.js +1 -1
  61. package/dist/components/image.js +1 -1
  62. package/dist/components/input.js +1 -1
  63. package/dist/components/inputOTP.js +1 -1
  64. package/dist/components/label.js +1 -1
  65. package/dist/components/link.js +1 -1
  66. package/dist/components/list.js +1 -1
  67. package/dist/components/loading.js +1 -1
  68. package/dist/components/lottie.js +1 -1
  69. package/dist/components/map.js +1 -1
  70. package/dist/components/post-item.js +1 -1
  71. package/dist/components/post-teaser.js +1 -1
  72. package/dist/components/post-widget-carousel.js +1 -1
  73. package/dist/components/post-widget.js +1 -1
  74. package/dist/components/quote.js +1 -1
  75. package/dist/components/rich-text.js +1 -1
  76. package/dist/components/select.js +1 -1
  77. package/dist/components/skeleton.js +1 -1
  78. package/dist/components/slider.js +1 -1
  79. package/dist/components/stepper.js +1 -1
  80. package/dist/components/switch.js +1 -1
  81. package/dist/components/table.js +1 -1
  82. package/dist/components/teaser.js +1 -1
  83. package/dist/index.cjs.js +1 -1
  84. package/dist/index.es.js +40 -40
  85. package/dist/tsconfig.build.tsbuildinfo +1 -1
  86. package/dist/tsconfig.typecheck.tsbuildinfo +1 -0
  87. package/dist/types/components/accordion/index.d.ts +1 -1
  88. package/dist/types/components/animated/index.d.ts +1 -1
  89. package/dist/types/components/animatedText/index.d.ts +1 -1
  90. package/dist/types/components/avatar/index.d.ts +1 -1
  91. package/dist/types/components/base-link/index.d.ts +1 -1
  92. package/dist/types/components/button/index.d.ts +1 -1
  93. package/dist/types/components/calendly/index.d.ts +1 -1
  94. package/dist/types/components/card/index.d.ts +1 -1
  95. package/dist/types/components/carousel/index.d.ts +1 -1
  96. package/dist/types/components/chip/index.d.ts +1 -1
  97. package/dist/types/components/datePicker/index.d.ts +1 -1
  98. package/dist/types/components/dialog/index.d.ts +1 -1
  99. package/dist/types/components/drawer/index.d.ts +1 -1
  100. package/dist/types/components/form/Form.model.d.ts +4 -1
  101. package/dist/types/components/form/FormResponse.d.ts +2 -5
  102. package/dist/types/components/form/index.d.ts +2 -1
  103. package/dist/types/components/grid/Grid.d.ts +2 -6
  104. package/dist/types/components/grid/Grid.model.d.ts +17 -0
  105. package/dist/types/components/grid/GridRow.d.ts +2 -12
  106. package/dist/types/components/grid/index.d.ts +1 -0
  107. package/dist/types/components/headline/index.d.ts +1 -1
  108. package/dist/types/components/icon/index.d.ts +1 -1
  109. package/dist/types/components/image/index.d.ts +1 -1
  110. package/dist/types/components/image-text/index.d.ts +1 -1
  111. package/dist/types/components/input/index.d.ts +1 -1
  112. package/dist/types/components/inputOTP/index.d.ts +1 -1
  113. package/dist/types/components/label/index.d.ts +1 -1
  114. package/dist/types/components/link/index.d.ts +1 -1
  115. package/dist/types/components/list/index.d.ts +1 -1
  116. package/dist/types/components/loading/index.d.ts +1 -1
  117. package/dist/types/components/lottie/index.d.ts +1 -1
  118. package/dist/types/components/map/index.d.ts +1 -1
  119. package/dist/types/components/post-item/index.d.ts +2 -2
  120. package/dist/types/components/post-teaser/index.d.ts +1 -1
  121. package/dist/types/components/post-widget/index.d.ts +1 -1
  122. package/dist/types/components/post-widget-carousel/index.d.ts +1 -1
  123. package/dist/types/components/quote/index.d.ts +1 -1
  124. package/dist/types/components/rich-text/index.d.ts +1 -1
  125. package/dist/types/components/select/index.d.ts +1 -1
  126. package/dist/types/components/skeleton/index.d.ts +1 -1
  127. package/dist/types/components/slider/index.d.ts +1 -1
  128. package/dist/types/components/stepper/index.d.ts +1 -1
  129. package/dist/types/components/switch/index.d.ts +1 -1
  130. package/dist/types/components/table/index.d.ts +1 -1
  131. package/dist/types/components/teaser/index.d.ts +1 -1
  132. package/dist/types/index.d.ts +0 -40
  133. package/package.json +1 -1
  134. package/dist/components/Accordion-V3d_aGvZ.js +0 -130
  135. package/dist/components/Accordion-o8oKA6Tq.js +0 -1
  136. package/dist/components/Animated-BBfAgsHL.js +0 -64
  137. package/dist/components/Animated-CO4IEerF.js +0 -1
  138. package/dist/components/AnimatedText-BmB5Vkyq.js +0 -31
  139. package/dist/components/AnimatedText-Sy1jofZl.js +0 -1
  140. package/dist/components/Avatar-Ci5YNFc5.js +0 -95
  141. package/dist/components/Avatar-CjlbA5a5.js +0 -1
  142. package/dist/components/BaseLink-Dd9htNXU.js +0 -1
  143. package/dist/components/BaseLink-w1q9Qc1U.js +0 -30
  144. package/dist/components/Button-B8chVgsB.js +0 -111
  145. package/dist/components/Button-yvFLX-6Q.js +0 -1
  146. package/dist/components/Calendly-CWCAs02R.js +0 -1
  147. package/dist/components/Calendly-WBM4oHyC.js +0 -82
  148. package/dist/components/Card-BPEoLzF1.js +0 -1
  149. package/dist/components/Card-IW4R7bKr.js +0 -202
  150. package/dist/components/Carousel-CdS7SVzA.js +0 -1
  151. package/dist/components/Carousel-DpO4a3lm.js +0 -257
  152. package/dist/components/Chip-BmBxJH5M.js +0 -80
  153. package/dist/components/Chip-Q2ttDAQn.js +0 -1
  154. package/dist/components/ClassNameConfigurator-Ce5BUPXc.js +0 -860
  155. package/dist/components/DatePicker-BTenaDN8.js +0 -1
  156. package/dist/components/DatePicker-PK173UTy.js +0 -93
  157. package/dist/components/Dialog-Bq3tfZ0_.js +0 -1
  158. package/dist/components/Dialog-KlXAOdt_.js +0 -172
  159. package/dist/components/Drawer-DulO9091.js +0 -1
  160. package/dist/components/Drawer-i9X07r74.js +0 -120
  161. package/dist/components/Form-B6963dT5.js +0 -368
  162. package/dist/components/Form-DVNzITG2.js +0 -1
  163. package/dist/components/GridRow-1h1JHuDl.js +0 -114
  164. package/dist/components/GridRow-C5v0sOZZ.js +0 -1
  165. package/dist/components/Headline-CnyLLQLB.js +0 -1
  166. package/dist/components/Headline-DzEinaZi.js +0 -98
  167. package/dist/components/Icon-BMrVlROP.js +0 -4195
  168. package/dist/components/Icon-eWdA85cf.js +0 -1
  169. package/dist/components/Image-B-lyA7ym.js +0 -1
  170. package/dist/components/Image-CVgvVlLE.js +0 -33
  171. package/dist/components/ImageText-Cqp4xp9y.js +0 -113
  172. package/dist/components/ImageText-D-06_EGf.js +0 -1
  173. package/dist/components/Input-BEO9ig1R.js +0 -1
  174. package/dist/components/Input-CrNLI_OY.js +0 -258
  175. package/dist/components/InputOTP-Db7DHrhS.js +0 -88
  176. package/dist/components/InputOTP-MnmjEmPU.js +0 -1
  177. package/dist/components/Label-BvCzZIGM.js +0 -1
  178. package/dist/components/Label-DRUCdGoX.js +0 -71
  179. package/dist/components/Link-DSQ1125B.js +0 -69
  180. package/dist/components/Link-Dg7XR4uY.js +0 -1
  181. package/dist/components/List-D_dSwMx5.js +0 -1
  182. package/dist/components/List-P6xbVrBc.js +0 -196
  183. package/dist/components/Loading-C7lyHDW7.js +0 -68
  184. package/dist/components/Loading-U-CrTVTi.js +0 -1
  185. package/dist/components/Lottie-Br7PmIzX.js +0 -1
  186. package/dist/components/Lottie-CrvbxK0R.js +0 -87
  187. package/dist/components/Map-D3xbPS1S.js +0 -1
  188. package/dist/components/Map-DEIB_y-M.js +0 -64
  189. package/dist/components/PostItem-B8Vfv_sW.js +0 -183
  190. package/dist/components/PostItem-BSTn6cHD.js +0 -1
  191. package/dist/components/PostTeaser-BmZyqFL2.js +0 -186
  192. package/dist/components/PostTeaser-DLynX43c.js +0 -1
  193. package/dist/components/PostWidget-Bo4KiSsV.js +0 -170
  194. package/dist/components/PostWidget-DYWA-B8d.js +0 -1
  195. package/dist/components/PostWidgetCarousel-CZ6ptOGv.js +0 -168
  196. package/dist/components/PostWidgetCarousel-D7-p3Pwr.js +0 -1
  197. package/dist/components/Quote-6aurOanD.js +0 -1
  198. package/dist/components/Quote-CV_UYE1G.js +0 -101
  199. package/dist/components/RichText-Cg_XzkUs.js +0 -152
  200. package/dist/components/RichText-DVg1dwMV.js +0 -1
  201. package/dist/components/Select-BMyrX8V0.js +0 -3081
  202. package/dist/components/Skeleton-BuY3bttw.js +0 -1
  203. package/dist/components/Skeleton-D6olNYTG.js +0 -40
  204. package/dist/components/Slider-C-lecSwc.js +0 -957
  205. package/dist/components/Slider-GvO3Xllf.js +0 -1
  206. package/dist/components/Stepper-BV3PGCr2.js +0 -1
  207. package/dist/components/Stepper-CA1DOm4D.js +0 -135
  208. package/dist/components/Switch-C_6EUOIc.js +0 -330
  209. package/dist/components/Switch-Db3HpOhM.js +0 -1
  210. package/dist/components/Table-Csc0FIbX.js +0 -1
  211. package/dist/components/Table-Cy8bIv_C.js +0 -95
  212. package/dist/components/Teaser-CkisYOs-.js +0 -1
  213. package/dist/components/Teaser-Cl2oBeh5.js +0 -118
  214. package/dist/components/areArraysEqual-CJkStQkx.js +0 -20
  215. package/dist/components/bem-CYKrPjje.js +0 -11
  216. package/dist/components/calculation-79PhfKvq.js +0 -4
  217. package/dist/components/jsx-runtime-C5mzlN2N.js +0 -284
  218. package/dist/components/useControlled-BYdyS7Pn.js +0 -31
  219. package/dist/components/validations-B_cxltQ_.js +0 -8
  220. /package/dist/components/{areArraysEqual-6R3bBH2E.js → areArraysEqual.js} +0 -0
  221. /package/dist/components/{bem-DC5wv0dD.js → bem.js} +0 -0
  222. /package/dist/components/{calculation-D-p0iqpk.js → calculation.js} +0 -0
  223. /package/dist/components/{jsx-runtime-CITbqOLs.js → jsx-runtime.js} +0 -0
  224. /package/dist/components/{useControlled-Ysk4KqoX.js → useControlled.js} +0 -0
  225. /package/dist/components/{validations-Cnxtn28y.js → validations.js} +0 -0
@@ -1,3081 +0,0 @@
1
- import { j as _ } from "./jsx-runtime-C5mzlN2N.js";
2
- import * as a from "react";
3
- import { useLayoutEffect as hn, useEffect as Vt, memo as mn, useState as ft, useCallback as bn } from "react";
4
- import { c as xn } from "./bem-CYKrPjje.js";
5
- import { i as dt, d as pt, a as gt } from "./validations-B_cxltQ_.js";
6
- import { L as yn } from "./Label-DRUCdGoX.js";
7
- import { a as tt, g as nt, u as le, e as ae, i as ht, b as Pe, c as ot, d as rt, P as m, s as mt } from "./ClassNameConfigurator-Ce5BUPXc.js";
8
- import * as At from "react-dom";
9
- import { a as bt, u as Oe, v as wn } from "./areArraysEqual-CJkStQkx.js";
10
- const Cn = "exact-prop: ​";
11
- function Rn(e) {
12
- return process.env.NODE_ENV === "production" ? e : {
13
- ...e,
14
- [Cn]: (t) => {
15
- const n = Object.keys(t).filter((o) => !e.hasOwnProperty(o));
16
- return n.length > 0 ? new Error(`The following props are not supported: ${n.map((o) => `\`${o}\``).join(", ")}. Please remove them.`) : null;
17
- }
18
- };
19
- }
20
- function Xe(e, t, n, o, r) {
21
- if (process.env.NODE_ENV === "production")
22
- return null;
23
- const i = e[t], s = r || t;
24
- return i == null ? null : i && i.nodeType !== 1 ? new Error(`Invalid ${o} \`${s}\` supplied to \`${n}\`. Expected an HTMLElement.`) : null;
25
- }
26
- let xt = 0;
27
- function vn(e) {
28
- const [t, n] = a.useState(e), o = e || t;
29
- return a.useEffect(() => {
30
- t == null && (xt += 1, n(`mui-${xt}`));
31
- }, [t]), o;
32
- }
33
- const yt = a.useId;
34
- function Mt(e) {
35
- if (yt !== void 0) {
36
- const t = yt();
37
- return e ?? t;
38
- }
39
- return vn(e);
40
- }
41
- function Sn(e) {
42
- return !e || !/* @__PURE__ */ a.isValidElement(e) ? null : e.props.propertyIsEnumerable("ref") ? e.props.ref : (
43
- // @ts-expect-error element.ref is not included in the ReactElement type
44
- // We cannot check for it, but isValidElement is true at this point
45
- // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
46
- e.ref
47
- );
48
- }
49
- const Dt = "Option";
50
- function Pn(e) {
51
- return tt(Dt, e);
52
- }
53
- nt(Dt, ["root", "disabled", "selected", "highlighted"]);
54
- function On(e) {
55
- const {
56
- rootElementName: t = "",
57
- componentName: n
58
- } = e, [o, r] = a.useState(t.toUpperCase());
59
- process.env.NODE_ENV !== "production" && a.useEffect(() => {
60
- t && o !== t.toUpperCase() && console.error(`useRootElementName: the \`rootElementName\` prop of ${n ? `the ${n} component` : "a component"} expected the '${t}' element, but a '${o.toLowerCase()}' was rendered instead`, "This may cause hydration issues in an SSR context, for example in a Next.js app");
61
- }, [t, o, n]);
62
- const i = a.useCallback((s) => {
63
- r((s == null ? void 0 : s.tagName) ?? "");
64
- }, []);
65
- return [o, i];
66
- }
67
- const z = {
68
- blur: "list:blur",
69
- itemClick: "list:itemClick",
70
- itemHover: "list:itemHover",
71
- itemsChange: "list:itemsChange",
72
- keyDown: "list:keyDown",
73
- resetHighlight: "list:resetHighlight",
74
- highlightLast: "list:highlightLast",
75
- textNavigation: "list:textNavigation",
76
- clearSelection: "list:clearSelection"
77
- };
78
- function kn(e, t, n, o, r, i) {
79
- if (n.length === 0 || !o && n.every((l, c) => r(l, c)))
80
- return -1;
81
- let s = e;
82
- for (; ; ) {
83
- if (!i && t === "next" && s === n.length || !i && t === "previous" && s === -1)
84
- return -1;
85
- if (o ? !1 : r(n[s], s))
86
- s += t === "next" ? 1 : -1, i && (s = (s + n.length) % n.length);
87
- else
88
- return s;
89
- }
90
- }
91
- function J(e, t, n) {
92
- const {
93
- items: o,
94
- isItemDisabled: r,
95
- disableListWrap: i,
96
- disabledItemsFocusable: s,
97
- itemComparer: l,
98
- focusManagement: c
99
- } = n, u = c === "DOM" ? 0 : -1, p = o.length - 1, f = e == null ? -1 : o.findIndex((R) => l(R, e));
100
- let g, d, h = !i;
101
- switch (t) {
102
- case "reset":
103
- if (u === -1)
104
- return null;
105
- g = 0, d = "next", h = !1;
106
- break;
107
- case "start":
108
- g = 0, d = "next", h = !1;
109
- break;
110
- case "end":
111
- g = p, d = "previous", h = !1;
112
- break;
113
- default: {
114
- const R = f + t;
115
- R < 0 ? !h && f !== -1 || Math.abs(t) > 1 ? (g = 0, d = "next") : (g = p, d = "previous") : R > p ? !h || Math.abs(t) > 1 ? (g = p, d = "previous") : (g = 0, d = "next") : (g = R, d = t >= 0 ? "next" : "previous");
116
- }
117
- }
118
- const w = kn(g, d, o, s, r, h);
119
- return w === -1 && e !== null && !r(e, f) ? e : o[w] ?? null;
120
- }
121
- function En(e, t, n, o) {
122
- return n === "none" ? [] : n === "single" ? o(t[0], e) ? t : [e] : t.some((r) => o(r, e)) ? t.filter((r) => !o(r, e)) : [...t, e];
123
- }
124
- function it(e, t, n) {
125
- const {
126
- itemComparer: o,
127
- isItemDisabled: r,
128
- selectionMode: i,
129
- items: s
130
- } = n, {
131
- selectedValues: l
132
- } = t, c = s.findIndex((p) => o(e, p));
133
- if (r(e, c))
134
- return t;
135
- const u = En(e, l, i, o);
136
- return {
137
- ...t,
138
- selectedValues: u,
139
- highlightedValue: e
140
- };
141
- }
142
- function Tn(e, t, n) {
143
- const o = t.highlightedValue, {
144
- orientation: r,
145
- pageSize: i
146
- } = n;
147
- switch (e) {
148
- case "Home":
149
- return {
150
- ...t,
151
- highlightedValue: J(o, "start", n)
152
- };
153
- case "End":
154
- return {
155
- ...t,
156
- highlightedValue: J(o, "end", n)
157
- };
158
- case "PageUp":
159
- return {
160
- ...t,
161
- highlightedValue: J(o, -i, n)
162
- };
163
- case "PageDown":
164
- return {
165
- ...t,
166
- highlightedValue: J(o, i, n)
167
- };
168
- case "ArrowUp":
169
- if (r !== "vertical")
170
- break;
171
- return {
172
- ...t,
173
- highlightedValue: J(o, -1, n)
174
- };
175
- case "ArrowDown":
176
- if (r !== "vertical")
177
- break;
178
- return {
179
- ...t,
180
- highlightedValue: J(o, 1, n)
181
- };
182
- case "ArrowLeft": {
183
- if (r === "vertical")
184
- break;
185
- return {
186
- ...t,
187
- highlightedValue: J(o, r === "horizontal-ltr" ? -1 : 1, n)
188
- };
189
- }
190
- case "ArrowRight": {
191
- if (r === "vertical")
192
- break;
193
- return {
194
- ...t,
195
- highlightedValue: J(o, r === "horizontal-ltr" ? 1 : -1, n)
196
- };
197
- }
198
- case "Enter":
199
- case " ":
200
- return t.highlightedValue === null ? t : it(t.highlightedValue, t, n);
201
- }
202
- return t;
203
- }
204
- function Nn(e, t) {
205
- return t.focusManagement === "DOM" ? e : {
206
- ...e,
207
- highlightedValue: null
208
- };
209
- }
210
- function Vn(e, t, n) {
211
- var r;
212
- const o = (r = n(e)) == null ? void 0 : r.trim().toLowerCase();
213
- return !o || o.length === 0 ? !1 : o.startsWith(t);
214
- }
215
- function An(e, t, n) {
216
- const {
217
- items: o,
218
- isItemDisabled: r,
219
- disabledItemsFocusable: i,
220
- getItemAsString: s
221
- } = n, l = t.length > 1;
222
- let c = l ? e.highlightedValue : J(e.highlightedValue, 1, n);
223
- for (let u = 0; u < o.length; u += 1) {
224
- if (!c || !l && e.highlightedValue === c)
225
- return e;
226
- if (Vn(c, t, s) && (!r(c, o.indexOf(c)) || i))
227
- return {
228
- ...e,
229
- highlightedValue: c
230
- };
231
- c = J(c, 1, n);
232
- }
233
- return e;
234
- }
235
- function Mn(e, t, n, o) {
236
- const {
237
- itemComparer: r,
238
- focusManagement: i
239
- } = o;
240
- let s = null;
241
- n.highlightedValue != null ? s = e.find((u) => r(u, n.highlightedValue)) ?? null : i === "DOM" && t.length === 0 && (s = J(null, "reset", o));
242
- const c = (n.selectedValues ?? []).filter((u) => e.some((p) => r(p, u)));
243
- return {
244
- ...n,
245
- highlightedValue: s,
246
- selectedValues: c
247
- };
248
- }
249
- function Dn(e, t) {
250
- return {
251
- ...e,
252
- highlightedValue: J(null, "reset", t)
253
- };
254
- }
255
- function In(e, t) {
256
- return {
257
- ...e,
258
- highlightedValue: J(null, "end", t)
259
- };
260
- }
261
- function _n(e, t) {
262
- return {
263
- ...e,
264
- selectedValues: [],
265
- highlightedValue: J(null, "reset", t)
266
- };
267
- }
268
- function It(e, t) {
269
- const {
270
- type: n,
271
- context: o
272
- } = t;
273
- switch (n) {
274
- case z.keyDown:
275
- return Tn(t.key, e, o);
276
- case z.itemClick:
277
- return it(t.item, e, o);
278
- case z.blur:
279
- return Nn(e, o);
280
- case z.textNavigation:
281
- return An(e, t.searchString, o);
282
- case z.itemsChange:
283
- return Mn(t.items, t.previousItems, e, o);
284
- case z.resetHighlight:
285
- return Dn(e, o);
286
- case z.highlightLast:
287
- return In(e, o);
288
- case z.clearSelection:
289
- return _n(e, o);
290
- default:
291
- return e;
292
- }
293
- }
294
- function Ln(e, t) {
295
- return e === t;
296
- }
297
- const Ye = {}, wt = () => {
298
- };
299
- function Qe(e, t) {
300
- const n = {
301
- ...e
302
- };
303
- return Object.keys(t).forEach((o) => {
304
- t[o] !== void 0 && (n[o] = t[o]);
305
- }), n;
306
- }
307
- function Fn(e) {
308
- const {
309
- nextState: t,
310
- initialState: n,
311
- stateComparers: o,
312
- onStateChange: r,
313
- controlledProps: i,
314
- lastActionRef: s
315
- } = e, l = a.useRef(n);
316
- a.useEffect(() => {
317
- if (s.current === null)
318
- return;
319
- const c = Qe(l.current, i);
320
- Object.keys(t).forEach((u) => {
321
- const p = o[u] ?? Ln, f = t[u], g = c[u];
322
- (g == null && f != null || g != null && f == null || g != null && f != null && !p(f, g)) && (r == null || r(s.current.event ?? null, u, f, s.current.type ?? "", t));
323
- }), l.current = t, s.current = null;
324
- }, [l, t, s, r, o, i]);
325
- }
326
- function jn(e) {
327
- const t = a.useRef(null), {
328
- reducer: n,
329
- initialState: o,
330
- controlledProps: r = Ye,
331
- stateComparers: i = Ye,
332
- onStateChange: s = wt,
333
- actionContext: l,
334
- componentName: c = ""
335
- } = e, u = a.useRef(r);
336
- process.env.NODE_ENV !== "production" && a.useEffect(() => {
337
- Object.keys(r).forEach((h) => {
338
- u.current[h] !== void 0 && r[h] === void 0 && console.error(`useControllableReducer: ${c ? `The ${c} component` : "A component"} is changing a controlled prop to be uncontrolled: ${h}`), u.current[h] === void 0 && r[h] !== void 0 && console.error(`useControllableReducer: ${c ? `The ${c} component` : "A component"} is changing an uncontrolled prop to be controlled: ${h}`);
339
- });
340
- }, [r, c]);
341
- const p = a.useCallback((h, w) => {
342
- t.current = w;
343
- const R = Qe(h, r);
344
- return n(R, w);
345
- }, [r, n]), [f, g] = a.useReducer(p, o), d = a.useCallback((h) => {
346
- g({
347
- ...h,
348
- context: l
349
- });
350
- }, [l]);
351
- return Fn({
352
- nextState: f,
353
- initialState: o,
354
- stateComparers: i ?? Ye,
355
- onStateChange: s ?? wt,
356
- controlledProps: r,
357
- lastActionRef: t
358
- }), [Qe(f, r), d];
359
- }
360
- const Bn = 500;
361
- function $n(e) {
362
- const t = a.useRef({
363
- searchString: "",
364
- lastTime: null
365
- });
366
- return a.useCallback((n) => {
367
- if (n.key.length === 1 && n.key !== " ") {
368
- const o = t.current, r = n.key.toLowerCase(), i = performance.now();
369
- o.searchString.length > 0 && o.lastTime && i - o.lastTime > Bn ? o.searchString = r : (o.searchString.length !== 1 || r !== o.searchString) && (o.searchString += r), o.lastTime = i, e(o.searchString, n);
370
- }
371
- }, [e]);
372
- }
373
- const Ct = {}, Un = () => {
374
- }, Wn = (e, t) => e === t, Kn = () => !1, zn = (e) => typeof e == "string" ? e : String(e), qn = () => ({
375
- highlightedValue: null,
376
- selectedValues: []
377
- });
378
- function Yn(e) {
379
- const {
380
- controlledProps: t = Ct,
381
- disabledItemsFocusable: n = !1,
382
- disableListWrap: o = !1,
383
- focusManagement: r = "activeDescendant",
384
- getInitialState: i = qn,
385
- getItemDomElement: s,
386
- getItemId: l,
387
- isItemDisabled: c = Kn,
388
- rootRef: u,
389
- onStateChange: p = Un,
390
- items: f,
391
- itemComparer: g = Wn,
392
- getItemAsString: d = zn,
393
- onChange: h,
394
- onHighlightChange: w,
395
- onItemsChange: R,
396
- orientation: P = "vertical",
397
- pageSize: C = 5,
398
- reducerActionContext: O = Ct,
399
- selectionMode: k = "single",
400
- stateReducer: E,
401
- componentName: A = "useList"
402
- } = e;
403
- if (process.env.NODE_ENV !== "production") {
404
- if (r === "DOM" && s == null)
405
- throw new Error("useList: The `getItemDomElement` prop is required when using the `DOM` focus management.");
406
- if (r === "activeDescendant" && l == null)
407
- throw new Error("useList: The `getItemId` prop is required when using the `activeDescendant` focus management.");
408
- }
409
- const L = a.useRef(null), W = le(u, L), D = a.useCallback(($, M, U) => {
410
- var Y;
411
- w == null || w($, M, U), r === "DOM" && M != null && (U === z.itemClick || U === z.keyDown || U === z.textNavigation) && ((Y = s == null ? void 0 : s(M)) == null || Y.focus());
412
- }, [s, w, r]), F = a.useMemo(() => ({
413
- highlightedValue: g,
414
- selectedValues: ($, M) => bt($, M, g)
415
- }), [g]), y = a.useCallback(($, M, U, Y, se) => {
416
- switch (p == null || p($, M, U, Y, se), M) {
417
- case "highlightedValue":
418
- D($, U, Y);
419
- break;
420
- case "selectedValues":
421
- h == null || h($, U, Y);
422
- break;
423
- }
424
- }, [D, h, p]), b = a.useMemo(() => ({
425
- disabledItemsFocusable: n,
426
- disableListWrap: o,
427
- focusManagement: r,
428
- isItemDisabled: c,
429
- itemComparer: g,
430
- items: f,
431
- getItemAsString: d,
432
- onHighlightChange: D,
433
- orientation: P,
434
- pageSize: C,
435
- selectionMode: k,
436
- stateComparers: F
437
- }), [n, o, r, c, g, f, d, D, P, C, k, F]), T = i(), j = E ?? It, q = a.useMemo(() => ({
438
- ...O,
439
- ...b
440
- }), [O, b]), [S, V] = jn({
441
- reducer: j,
442
- actionContext: q,
443
- initialState: T,
444
- controlledProps: t,
445
- stateComparers: F,
446
- onStateChange: y,
447
- componentName: A
448
- }), {
449
- highlightedValue: N,
450
- selectedValues: I
451
- } = S, B = $n(($, M) => V({
452
- type: z.textNavigation,
453
- event: M,
454
- searchString: $
455
- })), H = a.useRef([]);
456
- a.useEffect(() => {
457
- bt(H.current, f, g) || (V({
458
- type: z.itemsChange,
459
- event: null,
460
- items: f,
461
- previousItems: H.current
462
- }), H.current = f, R == null || R(f));
463
- }, [f, g, V, R]);
464
- const G = ($) => (M) => {
465
- var Y;
466
- if ((Y = $.onKeyDown) == null || Y.call($, M), M.defaultMuiPrevented)
467
- return;
468
- const U = ["Home", "End", "PageUp", "PageDown"];
469
- P === "vertical" ? U.push("ArrowUp", "ArrowDown") : U.push("ArrowLeft", "ArrowRight"), r === "activeDescendant" && U.push(" ", "Enter"), U.includes(M.key) && M.preventDefault(), V({
470
- type: z.keyDown,
471
- key: M.key,
472
- event: M
473
- }), B(M);
474
- }, ie = ($) => (M) => {
475
- var U, Y;
476
- (U = $.onBlur) == null || U.call($, M), !M.defaultMuiPrevented && ((Y = L.current) != null && Y.contains(M.relatedTarget) || V({
477
- type: z.blur,
478
- event: M
479
- }));
480
- }, ve = ($ = {}) => {
481
- const M = ae($);
482
- return {
483
- ...$,
484
- "aria-activedescendant": r === "activeDescendant" && N != null ? l(N) : void 0,
485
- tabIndex: r === "DOM" ? -1 : 0,
486
- ref: W,
487
- ...M,
488
- onBlur: ie(M),
489
- onKeyDown: G(M)
490
- };
491
- }, xe = a.useCallback(($) => {
492
- const M = (I ?? []).some((se) => se != null && g($, se)), U = N != null && g($, N);
493
- return {
494
- focusable: r === "DOM",
495
- highlighted: U,
496
- selected: M
497
- };
498
- }, [g, I, N, r]), ye = a.useMemo(() => ({
499
- dispatch: V,
500
- getItemState: xe
501
- }), [V, xe]);
502
- return a.useDebugValue({
503
- state: S
504
- }), {
505
- contextValue: ye,
506
- dispatch: V,
507
- getRootProps: ve,
508
- rootRef: W,
509
- state: S
510
- };
511
- }
512
- const Ee = /* @__PURE__ */ a.createContext(null);
513
- process.env.NODE_ENV !== "production" && (Ee.displayName = "ListContext");
514
- function Gn(e) {
515
- const {
516
- handlePointerOverEvents: t = !1,
517
- item: n
518
- } = e, o = a.useContext(Ee);
519
- if (!o)
520
- throw new Error("useListItem must be used within a ListProvider");
521
- const {
522
- dispatch: r,
523
- getItemState: i
524
- } = o, {
525
- highlighted: s,
526
- selected: l,
527
- focusable: c
528
- } = i(n), u = a.useCallback((d) => (h) => {
529
- var w;
530
- if ((w = d.onClick) == null || w.call(d, h), !h.defaultPrevented) {
531
- if (process.env.NODE_ENV !== "production" && n === void 0)
532
- throw new Error(["MUI: The `item` provided to useListItem() is undefined.", "This should happen only during server-side rendering under React 17."].join(`
533
- `));
534
- r({
535
- type: z.itemClick,
536
- item: n,
537
- event: h
538
- });
539
- }
540
- }, [r, n]), p = a.useCallback((d) => (h) => {
541
- var w;
542
- if ((w = d.onMouseOver) == null || w.call(d, h), !h.defaultPrevented) {
543
- if (process.env.NODE_ENV !== "production" && n === void 0)
544
- throw new Error(["MUI: The `item` provided to useListItem() is undefined.", "This should happen only during server-side rendering under React 17."].join(`
545
- `));
546
- r({
547
- type: z.itemHover,
548
- item: n,
549
- event: h
550
- });
551
- }
552
- }, [r, n]);
553
- let f;
554
- return c && (f = s ? 0 : -1), {
555
- getRootProps: (d = {}) => {
556
- const h = ae(d);
557
- return {
558
- ...d,
559
- onClick: u(h),
560
- onPointerOver: t ? p(h) : void 0,
561
- tabIndex: f
562
- };
563
- },
564
- highlighted: s,
565
- selected: l
566
- };
567
- }
568
- const st = /* @__PURE__ */ a.createContext(null);
569
- process.env.NODE_ENV !== "production" && (st.displayName = "CompoundComponentContext");
570
- function Jn(e) {
571
- const t = Array.from(e.keys()).map((n) => {
572
- const o = e.get(n);
573
- return {
574
- key: n,
575
- subitem: o
576
- };
577
- });
578
- return t.sort((n, o) => {
579
- const r = n.subitem.ref.current, i = o.subitem.ref.current;
580
- return r === null || i === null || r === i ? 0 : r.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1;
581
- }), new Map(t.map((n) => [n.key, n.subitem]));
582
- }
583
- function Xn() {
584
- const [e, t] = a.useState(/* @__PURE__ */ new Map()), n = a.useRef(/* @__PURE__ */ new Set()), o = a.useCallback(function(u) {
585
- n.current.delete(u), t((p) => {
586
- const f = new Map(p);
587
- return f.delete(u), f;
588
- });
589
- }, []), r = a.useCallback(function(u, p) {
590
- let f;
591
- return typeof u == "function" ? f = u(n.current) : f = u, n.current.add(f), t((g) => {
592
- const d = new Map(g);
593
- return d.set(f, p), d;
594
- }), {
595
- id: f,
596
- deregister: () => o(f)
597
- };
598
- }, [o]), i = a.useMemo(() => Jn(e), [e]), s = a.useCallback(function(u) {
599
- return Array.from(i.keys()).indexOf(u);
600
- }, [i]);
601
- return {
602
- contextValue: a.useMemo(() => ({
603
- getItemIndex: s,
604
- registerItem: r,
605
- totalSubitemCount: e.size
606
- }), [s, r, e.size]),
607
- subitems: i
608
- };
609
- }
610
- function Qn(e, t) {
611
- const n = a.useContext(st);
612
- if (n === null)
613
- throw new Error("useCompoundItem must be used within a useCompoundParent");
614
- const {
615
- registerItem: o
616
- } = n, [r, i] = a.useState(typeof e == "function" ? void 0 : e);
617
- return Oe(() => {
618
- const {
619
- id: s,
620
- deregister: l
621
- } = o(e, t);
622
- return i(s), l;
623
- }, [o, t, e]), {
624
- id: r,
625
- index: r !== void 0 ? n.getItemIndex(r) : -1,
626
- totalItemCount: n.totalSubitemCount
627
- };
628
- }
629
- function _t(e = {}) {
630
- const {
631
- disabled: t = !1,
632
- focusableWhenDisabled: n,
633
- href: o,
634
- rootRef: r,
635
- tabIndex: i,
636
- to: s,
637
- type: l,
638
- rootElementName: c
639
- } = e, u = a.useRef(null), [p, f] = a.useState(!1), [g, d] = a.useState(!1);
640
- t && !n && g && d(!1);
641
- const [h, w] = On({
642
- rootElementName: c ?? (o || s ? "a" : void 0),
643
- componentName: "Button"
644
- }), R = (y) => (b) => {
645
- var T;
646
- g && b.preventDefault(), (T = y.onMouseLeave) == null || T.call(y, b);
647
- }, P = (y) => (b) => {
648
- var T;
649
- ht(b.target) || d(!1), (T = y.onBlur) == null || T.call(y, b);
650
- }, C = (y) => (b) => {
651
- var T, j;
652
- u.current || (u.current = b.currentTarget), ht(b.target) && (d(!0), (T = y.onFocusVisible) == null || T.call(y, b)), (j = y.onFocus) == null || j.call(y, b);
653
- }, O = () => {
654
- const y = u.current;
655
- return h === "BUTTON" || h === "INPUT" && ["button", "submit", "reset"].includes(y == null ? void 0 : y.type) || h === "A" && (y == null ? void 0 : y.href);
656
- }, k = (y) => (b) => {
657
- var T;
658
- t || (T = y.onClick) == null || T.call(y, b);
659
- }, E = (y) => (b) => {
660
- var T;
661
- t || (f(!0), document.addEventListener("mouseup", () => {
662
- f(!1);
663
- }, {
664
- once: !0
665
- })), (T = y.onMouseDown) == null || T.call(y, b);
666
- }, A = (y) => (b) => {
667
- var T, j;
668
- (T = y.onKeyDown) == null || T.call(y, b), !b.defaultMuiPrevented && (b.target === b.currentTarget && !O() && b.key === " " && b.preventDefault(), b.target === b.currentTarget && b.key === " " && !t && f(!0), b.target === b.currentTarget && !O() && b.key === "Enter" && !t && ((j = y.onClick) == null || j.call(y, b), b.preventDefault()));
669
- }, L = (y) => (b) => {
670
- var T, j;
671
- b.target === b.currentTarget && f(!1), (T = y.onKeyUp) == null || T.call(y, b), b.target === b.currentTarget && !O() && !t && b.key === " " && !b.defaultMuiPrevented && ((j = y.onClick) == null || j.call(y, b));
672
- }, W = le(w, r, u), D = {};
673
- return i !== void 0 && (D.tabIndex = i), h === "BUTTON" ? (D.type = l ?? "button", n ? D["aria-disabled"] = t : D.disabled = t) : h === "INPUT" ? l && ["button", "submit", "reset"].includes(l) && (n ? D["aria-disabled"] = t : D.disabled = t) : h !== "" && (!o && !s && (D.role = "button", D.tabIndex = i ?? 0), t && (D["aria-disabled"] = t, D.tabIndex = n ? i ?? 0 : -1)), {
674
- getRootProps: (y = {}) => {
675
- const b = {
676
- ...ae(e),
677
- ...ae(y)
678
- }, T = {
679
- type: l,
680
- ...b,
681
- ...D,
682
- ...y,
683
- onBlur: P(b),
684
- onClick: k(b),
685
- onFocus: C(b),
686
- onKeyDown: A(b),
687
- onKeyUp: L(b),
688
- onMouseDown: E(b),
689
- onMouseLeave: R(b),
690
- ref: W
691
- };
692
- return delete T.onFocusVisible, T;
693
- },
694
- focusVisible: g,
695
- setFocusVisible: d,
696
- active: p,
697
- rootRef: W
698
- };
699
- }
700
- function Ae(e, t) {
701
- return function(o = {}) {
702
- const r = {
703
- ...o,
704
- ...e(o)
705
- };
706
- return {
707
- ...r,
708
- ...t(r)
709
- };
710
- };
711
- }
712
- function Zn(e) {
713
- const {
714
- value: t,
715
- label: n,
716
- disabled: o,
717
- rootRef: r,
718
- id: i
719
- } = e, {
720
- getRootProps: s,
721
- highlighted: l,
722
- selected: c
723
- } = Gn({
724
- item: t
725
- }), {
726
- getRootProps: u,
727
- rootRef: p
728
- } = _t({
729
- disabled: o,
730
- focusableWhenDisabled: !0
731
- }), f = Mt(i), g = a.useRef(null), d = a.useMemo(() => ({
732
- disabled: o,
733
- label: n,
734
- value: t,
735
- ref: g,
736
- id: f
737
- }), [o, n, t, f]), {
738
- index: h
739
- } = Qn(t, d), w = le(r, g, p), R = (C) => (O) => {
740
- var k;
741
- (k = C.onKeyDown) == null || k.call(C, O), !O.defaultMuiPrevented && [" ", "Enter"].includes(O.key) && (O.defaultMuiPrevented = !0);
742
- }, P = (C = {}) => ({
743
- onKeyDown: R(C)
744
- });
745
- return {
746
- getRootProps: (C = {}) => {
747
- const O = ae(C), k = Ae(s, Ae(u, P));
748
- return {
749
- ...C,
750
- ...O,
751
- ...k(O),
752
- id: f,
753
- ref: w,
754
- role: "option",
755
- "aria-selected": c
756
- };
757
- },
758
- highlighted: l,
759
- index: h,
760
- selected: c,
761
- rootRef: w
762
- };
763
- }
764
- function Hn(e) {
765
- const t = a.useContext(Ee);
766
- if (!t)
767
- throw new Error("Option: ListContext was not found.");
768
- const {
769
- getItemState: n,
770
- dispatch: o
771
- } = t, {
772
- highlighted: r,
773
- selected: i,
774
- focusable: s
775
- } = n(e), l = a.useCallback((u) => {
776
- if (u !== e)
777
- throw new Error(["Base UI Option: Tried to access the state of another Option.", "This is unsupported when the Option uses the OptionContextStabilizer as a performance optimization."].join("/n"));
778
- return {
779
- highlighted: r,
780
- selected: i,
781
- focusable: s
782
- };
783
- }, [r, i, s, e]);
784
- return {
785
- contextValue: a.useMemo(() => ({
786
- dispatch: o,
787
- getItemState: l
788
- }), [o, l])
789
- };
790
- }
791
- function eo(e) {
792
- const {
793
- disabled: t,
794
- highlighted: n,
795
- selected: o
796
- } = e;
797
- return ot({
798
- root: ["root", t && "disabled", n && "highlighted", o && "selected"]
799
- }, rt(Pn));
800
- }
801
- const to = /* @__PURE__ */ a.memo(/* @__PURE__ */ a.forwardRef(function(t, n) {
802
- var E, A;
803
- const {
804
- children: o,
805
- disabled: r = !1,
806
- label: i,
807
- slotProps: s = {},
808
- slots: l = {},
809
- value: c,
810
- ...u
811
- } = t, p = l.root ?? "li", f = a.useRef(null), g = le(f, n), d = i ?? (typeof o == "string" ? o : (A = (E = f.current) == null ? void 0 : E.textContent) == null ? void 0 : A.trim()), {
812
- getRootProps: h,
813
- selected: w,
814
- highlighted: R,
815
- index: P
816
- } = Zn({
817
- disabled: r,
818
- label: d,
819
- rootRef: g,
820
- value: c
821
- }), C = {
822
- ...t,
823
- disabled: r,
824
- highlighted: R,
825
- index: P,
826
- selected: w
827
- }, O = eo(C), k = Pe({
828
- getSlotProps: h,
829
- elementType: p,
830
- externalSlotProps: s.root,
831
- externalForwardedProps: u,
832
- className: O.root,
833
- ownerState: C
834
- });
835
- return /* @__PURE__ */ _.jsx(p, {
836
- ...k,
837
- children: o
838
- });
839
- })), Ze = /* @__PURE__ */ a.forwardRef(function(t, n) {
840
- const {
841
- value: o
842
- } = t, {
843
- contextValue: r
844
- } = Hn(o);
845
- return /* @__PURE__ */ _.jsx(Ee.Provider, {
846
- value: r,
847
- children: /* @__PURE__ */ _.jsx(to, {
848
- ...t,
849
- ref: n
850
- })
851
- });
852
- });
853
- process.env.NODE_ENV !== "production" && (Ze.propTypes = {
854
- // ┌────────────────────────────── Warning ──────────────────────────────┐
855
- // │ These PropTypes are generated from the TypeScript type definitions. │
856
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
857
- // └─────────────────────────────────────────────────────────────────────┘
858
- /**
859
- * @ignore
860
- */
861
- children: m.node,
862
- /**
863
- * @ignore
864
- */
865
- className: m.string,
866
- /**
867
- * If `true`, the option will be disabled.
868
- * @default false
869
- */
870
- disabled: m.bool,
871
- /**
872
- * A text representation of the option's content.
873
- * Used for keyboard text navigation matching.
874
- */
875
- label: m.string,
876
- /**
877
- * The props used for each slot inside the Option.
878
- * @default {}
879
- */
880
- slotProps: m.shape({
881
- root: m.oneOfType([m.func, m.object])
882
- }),
883
- /**
884
- * The components used for each slot inside the Option.
885
- * Either a string to use a HTML element or a component.
886
- * @default {}
887
- */
888
- slots: m.shape({
889
- root: m.elementType
890
- }),
891
- /**
892
- * The value of the option.
893
- */
894
- value: m.any.isRequired
895
- });
896
- const Me = {
897
- buttonClick: "buttonClick",
898
- browserAutoFill: "browserAutoFill"
899
- }, Lt = (e) => {
900
- const {
901
- label: t,
902
- value: n
903
- } = e;
904
- return typeof t == "string" ? t : typeof n == "string" ? n : String(e);
905
- };
906
- function no(e, t) {
907
- const {
908
- open: n
909
- } = e, {
910
- context: {
911
- selectionMode: o
912
- }
913
- } = t;
914
- if (t.type === Me.buttonClick) {
915
- const i = e.selectedValues[0] ?? J(null, "start", t.context);
916
- return {
917
- ...e,
918
- open: !n,
919
- highlightedValue: n ? null : i
920
- };
921
- }
922
- if (t.type === Me.browserAutoFill)
923
- return it(t.item, e, t.context);
924
- const r = It(e, t);
925
- switch (t.type) {
926
- case z.keyDown:
927
- if (e.open) {
928
- if (t.event.key === "Escape")
929
- return {
930
- ...r,
931
- open: !1
932
- };
933
- } else {
934
- if (t.event.key === "ArrowDown")
935
- return {
936
- ...e,
937
- open: !0,
938
- highlightedValue: e.selectedValues[0] ?? J(null, "start", t.context)
939
- };
940
- if (t.event.key === "ArrowUp")
941
- return {
942
- ...e,
943
- open: !0,
944
- highlightedValue: e.selectedValues[0] ?? J(null, "end", t.context)
945
- };
946
- }
947
- break;
948
- case z.itemClick:
949
- if (o === "single")
950
- return {
951
- ...r,
952
- open: !1
953
- };
954
- break;
955
- case z.blur:
956
- return {
957
- ...r,
958
- open: !1
959
- };
960
- default:
961
- return r;
962
- }
963
- return r;
964
- }
965
- function oo(e) {
966
- return Array.isArray(e) ? e.length === 0 ? "" : JSON.stringify(e.map((t) => t.value)) : (e == null ? void 0 : e.value) == null ? "" : typeof e.value == "string" || typeof e.value == "number" ? e.value : JSON.stringify(e.value);
967
- }
968
- function ro(e) {
969
- const {
970
- areOptionsEqual: t,
971
- buttonRef: n,
972
- defaultOpen: o = !1,
973
- defaultValue: r,
974
- disabled: i = !1,
975
- listboxId: s,
976
- listboxRef: l,
977
- multiple: c = !1,
978
- name: u,
979
- required: p,
980
- onChange: f,
981
- onHighlightChange: g,
982
- onOpenChange: d,
983
- open: h,
984
- options: w,
985
- getOptionAsString: R = Lt,
986
- getSerializedValue: P = oo,
987
- value: C,
988
- componentName: O = "useSelect"
989
- } = e, k = a.useRef(null), E = le(n, k), A = a.useRef(null), L = Mt(s);
990
- let W;
991
- C === void 0 && r === void 0 ? W = [] : r !== void 0 && (c ? W = r : W = r == null ? [] : [r]);
992
- const D = a.useMemo(() => {
993
- if (C !== void 0)
994
- return c ? C : C == null ? [] : [C];
995
- }, [C, c]), {
996
- subitems: F,
997
- contextValue: y
998
- } = Xn(), b = a.useMemo(() => w != null ? new Map(w.map((x, v) => [x.value, {
999
- value: x.value,
1000
- label: x.label,
1001
- disabled: x.disabled,
1002
- ref: /* @__PURE__ */ a.createRef(),
1003
- id: `${L}_${v}`
1004
- }])) : F, [w, F, L]), T = le(l, A), {
1005
- getRootProps: j,
1006
- active: q,
1007
- focusVisible: S,
1008
- rootRef: V
1009
- } = _t({
1010
- disabled: i,
1011
- rootRef: E
1012
- }), N = a.useMemo(() => Array.from(b.keys()), [b]), I = a.useCallback((x) => {
1013
- if (t !== void 0) {
1014
- const v = N.find((K) => t(K, x));
1015
- return b.get(v);
1016
- }
1017
- return b.get(x);
1018
- }, [b, t, N]), B = a.useCallback((x) => {
1019
- const v = I(x);
1020
- return (v == null ? void 0 : v.disabled) ?? !1;
1021
- }, [I]), H = a.useCallback((x) => {
1022
- const v = I(x);
1023
- return v ? R(v) : "";
1024
- }, [I, R]), G = a.useMemo(() => ({
1025
- selectedValues: D,
1026
- open: h
1027
- }), [D, h]), ie = a.useCallback((x) => {
1028
- var v;
1029
- return (v = b.get(x)) == null ? void 0 : v.id;
1030
- }, [b]), ve = a.useCallback((x, v) => {
1031
- c ? f == null || f(x, v) : f == null || f(x, v[0] ?? null);
1032
- }, [c, f]), xe = a.useCallback((x, v) => {
1033
- g == null || g(x, v ?? null);
1034
- }, [g]), ye = a.useCallback((x, v, K) => {
1035
- var X;
1036
- v === "open" && (d == null || d(K), K === !1 && (x == null ? void 0 : x.type) !== "blur" && ((X = k.current) == null || X.focus()));
1037
- }, [d]), $ = a.useCallback((x) => {
1038
- var v;
1039
- return x == null ? null : ((v = F.get(x)) == null ? void 0 : v.ref.current) ?? null;
1040
- }, [F]), M = {
1041
- getInitialState: () => ({
1042
- highlightedValue: null,
1043
- selectedValues: W ?? [],
1044
- open: o
1045
- }),
1046
- getItemId: ie,
1047
- controlledProps: G,
1048
- focusManagement: "DOM",
1049
- getItemDomElement: $,
1050
- itemComparer: t,
1051
- isItemDisabled: B,
1052
- rootRef: T,
1053
- onChange: ve,
1054
- onHighlightChange: xe,
1055
- onStateChange: ye,
1056
- reducerActionContext: a.useMemo(() => ({
1057
- multiple: c
1058
- }), [c]),
1059
- items: N,
1060
- getItemAsString: H,
1061
- selectionMode: c ? "multiple" : "single",
1062
- stateReducer: no,
1063
- componentName: O
1064
- }, {
1065
- dispatch: U,
1066
- getRootProps: Y,
1067
- contextValue: se,
1068
- state: {
1069
- open: ce,
1070
- highlightedValue: de,
1071
- selectedValues: ue
1072
- },
1073
- rootRef: pe
1074
- } = Yn(M), on = a.useRef(ce);
1075
- Oe(() => {
1076
- var x;
1077
- if (ce && de !== null) {
1078
- const v = (x = I(de)) == null ? void 0 : x.ref;
1079
- if (!A.current || !(v != null && v.current))
1080
- return;
1081
- on.current || v.current.focus({
1082
- preventScroll: !0
1083
- });
1084
- const K = A.current.getBoundingClientRect(), X = v.current.getBoundingClientRect();
1085
- X.top < K.top ? A.current.scrollTop -= K.top - X.top : X.bottom > K.bottom && (A.current.scrollTop += X.bottom - K.bottom);
1086
- }
1087
- }, [ce, de, I]);
1088
- const ze = a.useCallback((x) => I(x), [I]), rn = (x) => (v) => {
1089
- var K;
1090
- if ((K = x == null ? void 0 : x.onClick) == null || K.call(x, v), !v.defaultMuiPrevented) {
1091
- const X = {
1092
- type: Me.buttonClick,
1093
- event: v
1094
- };
1095
- U(X);
1096
- }
1097
- }, sn = (x) => (v) => {
1098
- var K;
1099
- (K = x.onKeyDown) == null || K.call(x, v), !v.defaultMuiPrevented && (v.key === "ArrowDown" || v.key === "ArrowUp") && (v.preventDefault(), U({
1100
- type: z.keyDown,
1101
- key: v.key,
1102
- event: v
1103
- }));
1104
- }, ln = (x = {}) => ({
1105
- onClick: rn(x),
1106
- onKeyDown: sn(x)
1107
- }), cn = (x = {}) => ({
1108
- ...x,
1109
- ...ln(x),
1110
- role: "combobox",
1111
- "aria-expanded": ce,
1112
- "aria-controls": L
1113
- }), un = (x = {}) => {
1114
- const v = ae(x), K = Ae(cn, j);
1115
- return {
1116
- ...x,
1117
- ...K(v)
1118
- };
1119
- }, an = (x) => (v) => {
1120
- var K, X;
1121
- (K = x.onBlur) == null || K.call(x, v), !v.defaultMuiPrevented && ((X = A.current) != null && X.contains(v.relatedTarget) || v.relatedTarget === k.current) && (v.defaultMuiPrevented = !0);
1122
- }, fn = (x = {}) => ({
1123
- onBlur: an(x)
1124
- }), dn = (x = {}) => {
1125
- const v = ae(x), K = Ae(fn, Y);
1126
- return {
1127
- id: L,
1128
- role: "listbox",
1129
- "aria-multiselectable": c ? "true" : void 0,
1130
- ...x,
1131
- ...K(v)
1132
- };
1133
- };
1134
- a.useDebugValue({
1135
- selectedOptions: ue,
1136
- highlightedOption: de,
1137
- open: ce
1138
- });
1139
- const pn = a.useMemo(() => ({
1140
- ...se,
1141
- ...y
1142
- }), [se, y]);
1143
- let Se;
1144
- e.multiple ? Se = ue : Se = ue.length > 0 ? ue[0] : null;
1145
- let qe;
1146
- c ? qe = Se.map((x) => ze(x)).filter((x) => x !== void 0) : qe = ze(Se) ?? null;
1147
- const gn = (x) => (v) => {
1148
- var X;
1149
- if ((X = x == null ? void 0 : x.onChange) == null || X.call(x, v), v.defaultMuiPrevented)
1150
- return;
1151
- const K = b.get(v.target.value);
1152
- v.target.value === "" ? U({
1153
- type: z.clearSelection
1154
- }) : K !== void 0 && U({
1155
- type: Me.browserAutoFill,
1156
- item: K.value,
1157
- event: v
1158
- });
1159
- };
1160
- return {
1161
- buttonActive: q,
1162
- buttonFocusVisible: S,
1163
- buttonRef: V,
1164
- contextValue: pn,
1165
- disabled: i,
1166
- dispatch: U,
1167
- getButtonProps: un,
1168
- getHiddenInputProps: (x = {}) => {
1169
- const v = ae(x);
1170
- return {
1171
- name: u,
1172
- tabIndex: -1,
1173
- "aria-hidden": !0,
1174
- required: p ? !0 : void 0,
1175
- value: P(qe),
1176
- style: wn,
1177
- ...x,
1178
- onChange: gn(v)
1179
- };
1180
- },
1181
- getListboxProps: dn,
1182
- getOptionMetadata: ze,
1183
- listboxRef: pe,
1184
- open: ce,
1185
- options: N,
1186
- value: Se,
1187
- highlightedOption: de
1188
- };
1189
- }
1190
- function io(e) {
1191
- const {
1192
- value: t,
1193
- children: n
1194
- } = e, {
1195
- dispatch: o,
1196
- getItemIndex: r,
1197
- getItemState: i,
1198
- registerItem: s,
1199
- totalSubitemCount: l
1200
- } = t, c = a.useMemo(() => ({
1201
- dispatch: o,
1202
- getItemState: i,
1203
- getItemIndex: r
1204
- }), [o, r, i]), u = a.useMemo(() => ({
1205
- getItemIndex: r,
1206
- registerItem: s,
1207
- totalSubitemCount: l
1208
- }), [s, r, l]);
1209
- return /* @__PURE__ */ _.jsx(st.Provider, {
1210
- value: u,
1211
- children: /* @__PURE__ */ _.jsx(Ee.Provider, {
1212
- value: c,
1213
- children: n
1214
- })
1215
- });
1216
- }
1217
- const De = Math.min, ge = Math.max, Ie = Math.round, Ne = Math.floor, ne = (e) => ({
1218
- x: e,
1219
- y: e
1220
- }), so = {
1221
- left: "right",
1222
- right: "left",
1223
- bottom: "top",
1224
- top: "bottom"
1225
- }, lo = {
1226
- start: "end",
1227
- end: "start"
1228
- };
1229
- function Rt(e, t, n) {
1230
- return ge(e, De(t, n));
1231
- }
1232
- function Be(e, t) {
1233
- return typeof e == "function" ? e(t) : e;
1234
- }
1235
- function me(e) {
1236
- return e.split("-")[0];
1237
- }
1238
- function $e(e) {
1239
- return e.split("-")[1];
1240
- }
1241
- function Ft(e) {
1242
- return e === "x" ? "y" : "x";
1243
- }
1244
- function jt(e) {
1245
- return e === "y" ? "height" : "width";
1246
- }
1247
- function he(e) {
1248
- return ["top", "bottom"].includes(me(e)) ? "y" : "x";
1249
- }
1250
- function Bt(e) {
1251
- return Ft(he(e));
1252
- }
1253
- function co(e, t, n) {
1254
- n === void 0 && (n = !1);
1255
- const o = $e(e), r = Bt(e), i = jt(r);
1256
- let s = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
1257
- return t.reference[i] > t.floating[i] && (s = _e(s)), [s, _e(s)];
1258
- }
1259
- function uo(e) {
1260
- const t = _e(e);
1261
- return [He(e), t, He(t)];
1262
- }
1263
- function He(e) {
1264
- return e.replace(/start|end/g, (t) => lo[t]);
1265
- }
1266
- function ao(e, t, n) {
1267
- const o = ["left", "right"], r = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
1268
- switch (e) {
1269
- case "top":
1270
- case "bottom":
1271
- return n ? t ? r : o : t ? o : r;
1272
- case "left":
1273
- case "right":
1274
- return t ? i : s;
1275
- default:
1276
- return [];
1277
- }
1278
- }
1279
- function fo(e, t, n, o) {
1280
- const r = $e(e);
1281
- let i = ao(me(e), n === "start", o);
1282
- return r && (i = i.map((s) => s + "-" + r), t && (i = i.concat(i.map(He)))), i;
1283
- }
1284
- function _e(e) {
1285
- return e.replace(/left|right|bottom|top/g, (t) => so[t]);
1286
- }
1287
- function po(e) {
1288
- return {
1289
- top: 0,
1290
- right: 0,
1291
- bottom: 0,
1292
- left: 0,
1293
- ...e
1294
- };
1295
- }
1296
- function go(e) {
1297
- return typeof e != "number" ? po(e) : {
1298
- top: e,
1299
- right: e,
1300
- bottom: e,
1301
- left: e
1302
- };
1303
- }
1304
- function Le(e) {
1305
- const {
1306
- x: t,
1307
- y: n,
1308
- width: o,
1309
- height: r
1310
- } = e;
1311
- return {
1312
- width: o,
1313
- height: r,
1314
- top: n,
1315
- left: t,
1316
- right: t + o,
1317
- bottom: n + r,
1318
- x: t,
1319
- y: n
1320
- };
1321
- }
1322
- function vt(e, t, n) {
1323
- let {
1324
- reference: o,
1325
- floating: r
1326
- } = e;
1327
- const i = he(t), s = Bt(t), l = jt(s), c = me(t), u = i === "y", p = o.x + o.width / 2 - r.width / 2, f = o.y + o.height / 2 - r.height / 2, g = o[l] / 2 - r[l] / 2;
1328
- let d;
1329
- switch (c) {
1330
- case "top":
1331
- d = {
1332
- x: p,
1333
- y: o.y - r.height
1334
- };
1335
- break;
1336
- case "bottom":
1337
- d = {
1338
- x: p,
1339
- y: o.y + o.height
1340
- };
1341
- break;
1342
- case "right":
1343
- d = {
1344
- x: o.x + o.width,
1345
- y: f
1346
- };
1347
- break;
1348
- case "left":
1349
- d = {
1350
- x: o.x - r.width,
1351
- y: f
1352
- };
1353
- break;
1354
- default:
1355
- d = {
1356
- x: o.x,
1357
- y: o.y
1358
- };
1359
- }
1360
- switch ($e(t)) {
1361
- case "start":
1362
- d[s] -= g * (n && u ? -1 : 1);
1363
- break;
1364
- case "end":
1365
- d[s] += g * (n && u ? -1 : 1);
1366
- break;
1367
- }
1368
- return d;
1369
- }
1370
- const ho = async (e, t, n) => {
1371
- const {
1372
- placement: o = "bottom",
1373
- strategy: r = "absolute",
1374
- middleware: i = [],
1375
- platform: s
1376
- } = n, l = i.filter(Boolean), c = await (s.isRTL == null ? void 0 : s.isRTL(t));
1377
- let u = await s.getElementRects({
1378
- reference: e,
1379
- floating: t,
1380
- strategy: r
1381
- }), {
1382
- x: p,
1383
- y: f
1384
- } = vt(u, o, c), g = o, d = {}, h = 0;
1385
- for (let w = 0; w < l.length; w++) {
1386
- const {
1387
- name: R,
1388
- fn: P
1389
- } = l[w], {
1390
- x: C,
1391
- y: O,
1392
- data: k,
1393
- reset: E
1394
- } = await P({
1395
- x: p,
1396
- y: f,
1397
- initialPlacement: o,
1398
- placement: g,
1399
- strategy: r,
1400
- middlewareData: d,
1401
- rects: u,
1402
- platform: s,
1403
- elements: {
1404
- reference: e,
1405
- floating: t
1406
- }
1407
- });
1408
- p = C ?? p, f = O ?? f, d = {
1409
- ...d,
1410
- [R]: {
1411
- ...d[R],
1412
- ...k
1413
- }
1414
- }, E && h <= 50 && (h++, typeof E == "object" && (E.placement && (g = E.placement), E.rects && (u = E.rects === !0 ? await s.getElementRects({
1415
- reference: e,
1416
- floating: t,
1417
- strategy: r
1418
- }) : E.rects), {
1419
- x: p,
1420
- y: f
1421
- } = vt(u, g, c)), w = -1);
1422
- }
1423
- return {
1424
- x: p,
1425
- y: f,
1426
- placement: g,
1427
- strategy: r,
1428
- middlewareData: d
1429
- };
1430
- };
1431
- async function $t(e, t) {
1432
- var n;
1433
- t === void 0 && (t = {});
1434
- const {
1435
- x: o,
1436
- y: r,
1437
- platform: i,
1438
- rects: s,
1439
- elements: l,
1440
- strategy: c
1441
- } = e, {
1442
- boundary: u = "clippingAncestors",
1443
- rootBoundary: p = "viewport",
1444
- elementContext: f = "floating",
1445
- altBoundary: g = !1,
1446
- padding: d = 0
1447
- } = Be(t, e), h = go(d), R = l[g ? f === "floating" ? "reference" : "floating" : f], P = Le(await i.getClippingRect({
1448
- element: (n = await (i.isElement == null ? void 0 : i.isElement(R))) == null || n ? R : R.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(l.floating)),
1449
- boundary: u,
1450
- rootBoundary: p,
1451
- strategy: c
1452
- })), C = f === "floating" ? {
1453
- x: o,
1454
- y: r,
1455
- width: s.floating.width,
1456
- height: s.floating.height
1457
- } : s.reference, O = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l.floating)), k = await (i.isElement == null ? void 0 : i.isElement(O)) ? await (i.getScale == null ? void 0 : i.getScale(O)) || {
1458
- x: 1,
1459
- y: 1
1460
- } : {
1461
- x: 1,
1462
- y: 1
1463
- }, E = Le(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
1464
- elements: l,
1465
- rect: C,
1466
- offsetParent: O,
1467
- strategy: c
1468
- }) : C);
1469
- return {
1470
- top: (P.top - E.top + h.top) / k.y,
1471
- bottom: (E.bottom - P.bottom + h.bottom) / k.y,
1472
- left: (P.left - E.left + h.left) / k.x,
1473
- right: (E.right - P.right + h.right) / k.x
1474
- };
1475
- }
1476
- const mo = function(e) {
1477
- return e === void 0 && (e = {}), {
1478
- name: "flip",
1479
- options: e,
1480
- async fn(t) {
1481
- var n, o;
1482
- const {
1483
- placement: r,
1484
- middlewareData: i,
1485
- rects: s,
1486
- initialPlacement: l,
1487
- platform: c,
1488
- elements: u
1489
- } = t, {
1490
- mainAxis: p = !0,
1491
- crossAxis: f = !0,
1492
- fallbackPlacements: g,
1493
- fallbackStrategy: d = "bestFit",
1494
- fallbackAxisSideDirection: h = "none",
1495
- flipAlignment: w = !0,
1496
- ...R
1497
- } = Be(e, t);
1498
- if ((n = i.arrow) != null && n.alignmentOffset)
1499
- return {};
1500
- const P = me(r), C = he(l), O = me(l) === l, k = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), E = g || (O || !w ? [_e(l)] : uo(l)), A = h !== "none";
1501
- !g && A && E.push(...fo(l, w, h, k));
1502
- const L = [l, ...E], W = await $t(t, R), D = [];
1503
- let F = ((o = i.flip) == null ? void 0 : o.overflows) || [];
1504
- if (p && D.push(W[P]), f) {
1505
- const q = co(r, s, k);
1506
- D.push(W[q[0]], W[q[1]]);
1507
- }
1508
- if (F = [...F, {
1509
- placement: r,
1510
- overflows: D
1511
- }], !D.every((q) => q <= 0)) {
1512
- var y, b;
1513
- const q = (((y = i.flip) == null ? void 0 : y.index) || 0) + 1, S = L[q];
1514
- if (S) {
1515
- var T;
1516
- const N = f === "alignment" ? C !== he(S) : !1, I = ((T = F[0]) == null ? void 0 : T.overflows[0]) > 0;
1517
- if (!N || I)
1518
- return {
1519
- data: {
1520
- index: q,
1521
- overflows: F
1522
- },
1523
- reset: {
1524
- placement: S
1525
- }
1526
- };
1527
- }
1528
- let V = (b = F.filter((N) => N.overflows[0] <= 0).sort((N, I) => N.overflows[1] - I.overflows[1])[0]) == null ? void 0 : b.placement;
1529
- if (!V)
1530
- switch (d) {
1531
- case "bestFit": {
1532
- var j;
1533
- const N = (j = F.filter((I) => {
1534
- if (A) {
1535
- const B = he(I.placement);
1536
- return B === C || // Create a bias to the `y` side axis due to horizontal
1537
- // reading directions favoring greater width.
1538
- B === "y";
1539
- }
1540
- return !0;
1541
- }).map((I) => [I.placement, I.overflows.filter((B) => B > 0).reduce((B, H) => B + H, 0)]).sort((I, B) => I[1] - B[1])[0]) == null ? void 0 : j[0];
1542
- N && (V = N);
1543
- break;
1544
- }
1545
- case "initialPlacement":
1546
- V = l;
1547
- break;
1548
- }
1549
- if (r !== V)
1550
- return {
1551
- reset: {
1552
- placement: V
1553
- }
1554
- };
1555
- }
1556
- return {};
1557
- }
1558
- };
1559
- };
1560
- async function bo(e, t) {
1561
- const {
1562
- placement: n,
1563
- platform: o,
1564
- elements: r
1565
- } = e, i = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), s = me(n), l = $e(n), c = he(n) === "y", u = ["left", "top"].includes(s) ? -1 : 1, p = i && c ? -1 : 1, f = Be(t, e);
1566
- let {
1567
- mainAxis: g,
1568
- crossAxis: d,
1569
- alignmentAxis: h
1570
- } = typeof f == "number" ? {
1571
- mainAxis: f,
1572
- crossAxis: 0,
1573
- alignmentAxis: null
1574
- } : {
1575
- mainAxis: f.mainAxis || 0,
1576
- crossAxis: f.crossAxis || 0,
1577
- alignmentAxis: f.alignmentAxis
1578
- };
1579
- return l && typeof h == "number" && (d = l === "end" ? h * -1 : h), c ? {
1580
- x: d * p,
1581
- y: g * u
1582
- } : {
1583
- x: g * u,
1584
- y: d * p
1585
- };
1586
- }
1587
- const xo = function(e) {
1588
- return e === void 0 && (e = 0), {
1589
- name: "offset",
1590
- options: e,
1591
- async fn(t) {
1592
- var n, o;
1593
- const {
1594
- x: r,
1595
- y: i,
1596
- placement: s,
1597
- middlewareData: l
1598
- } = t, c = await bo(t, e);
1599
- return s === ((n = l.offset) == null ? void 0 : n.placement) && (o = l.arrow) != null && o.alignmentOffset ? {} : {
1600
- x: r + c.x,
1601
- y: i + c.y,
1602
- data: {
1603
- ...c,
1604
- placement: s
1605
- }
1606
- };
1607
- }
1608
- };
1609
- }, yo = function(e) {
1610
- return e === void 0 && (e = {}), {
1611
- name: "shift",
1612
- options: e,
1613
- async fn(t) {
1614
- const {
1615
- x: n,
1616
- y: o,
1617
- placement: r
1618
- } = t, {
1619
- mainAxis: i = !0,
1620
- crossAxis: s = !1,
1621
- limiter: l = {
1622
- fn: (R) => {
1623
- let {
1624
- x: P,
1625
- y: C
1626
- } = R;
1627
- return {
1628
- x: P,
1629
- y: C
1630
- };
1631
- }
1632
- },
1633
- ...c
1634
- } = Be(e, t), u = {
1635
- x: n,
1636
- y: o
1637
- }, p = await $t(t, c), f = he(me(r)), g = Ft(f);
1638
- let d = u[g], h = u[f];
1639
- if (i) {
1640
- const R = g === "y" ? "top" : "left", P = g === "y" ? "bottom" : "right", C = d + p[R], O = d - p[P];
1641
- d = Rt(C, d, O);
1642
- }
1643
- if (s) {
1644
- const R = f === "y" ? "top" : "left", P = f === "y" ? "bottom" : "right", C = h + p[R], O = h - p[P];
1645
- h = Rt(C, h, O);
1646
- }
1647
- const w = l.fn({
1648
- ...t,
1649
- [g]: d,
1650
- [f]: h
1651
- });
1652
- return {
1653
- ...w,
1654
- data: {
1655
- x: w.x - n,
1656
- y: w.y - o,
1657
- enabled: {
1658
- [g]: i,
1659
- [f]: s
1660
- }
1661
- }
1662
- };
1663
- }
1664
- };
1665
- };
1666
- function Ue() {
1667
- return typeof window < "u";
1668
- }
1669
- function Re(e) {
1670
- return Ut(e) ? (e.nodeName || "").toLowerCase() : "#document";
1671
- }
1672
- function Z(e) {
1673
- var t;
1674
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1675
- }
1676
- function re(e) {
1677
- var t;
1678
- return (t = (Ut(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1679
- }
1680
- function Ut(e) {
1681
- return Ue() ? e instanceof Node || e instanceof Z(e).Node : !1;
1682
- }
1683
- function ee(e) {
1684
- return Ue() ? e instanceof Element || e instanceof Z(e).Element : !1;
1685
- }
1686
- function oe(e) {
1687
- return Ue() ? e instanceof HTMLElement || e instanceof Z(e).HTMLElement : !1;
1688
- }
1689
- function St(e) {
1690
- return !Ue() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Z(e).ShadowRoot;
1691
- }
1692
- function Te(e) {
1693
- const {
1694
- overflow: t,
1695
- overflowX: n,
1696
- overflowY: o,
1697
- display: r
1698
- } = te(e);
1699
- return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !["inline", "contents"].includes(r);
1700
- }
1701
- function wo(e) {
1702
- return ["table", "td", "th"].includes(Re(e));
1703
- }
1704
- function We(e) {
1705
- return [":popover-open", ":modal"].some((t) => {
1706
- try {
1707
- return e.matches(t);
1708
- } catch {
1709
- return !1;
1710
- }
1711
- });
1712
- }
1713
- function lt(e) {
1714
- const t = ct(), n = ee(e) ? te(e) : e;
1715
- return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
1716
- }
1717
- function Co(e) {
1718
- let t = fe(e);
1719
- for (; oe(t) && !Ce(t); ) {
1720
- if (lt(t))
1721
- return t;
1722
- if (We(t))
1723
- return null;
1724
- t = fe(t);
1725
- }
1726
- return null;
1727
- }
1728
- function ct() {
1729
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1730
- }
1731
- function Ce(e) {
1732
- return ["html", "body", "#document"].includes(Re(e));
1733
- }
1734
- function te(e) {
1735
- return Z(e).getComputedStyle(e);
1736
- }
1737
- function Ke(e) {
1738
- return ee(e) ? {
1739
- scrollLeft: e.scrollLeft,
1740
- scrollTop: e.scrollTop
1741
- } : {
1742
- scrollLeft: e.scrollX,
1743
- scrollTop: e.scrollY
1744
- };
1745
- }
1746
- function fe(e) {
1747
- if (Re(e) === "html")
1748
- return e;
1749
- const t = (
1750
- // Step into the shadow DOM of the parent of a slotted node.
1751
- e.assignedSlot || // DOM Element detected.
1752
- e.parentNode || // ShadowRoot detected.
1753
- St(e) && e.host || // Fallback.
1754
- re(e)
1755
- );
1756
- return St(t) ? t.host : t;
1757
- }
1758
- function Wt(e) {
1759
- const t = fe(e);
1760
- return Ce(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : oe(t) && Te(t) ? t : Wt(t);
1761
- }
1762
- function ke(e, t, n) {
1763
- var o;
1764
- t === void 0 && (t = []), n === void 0 && (n = !0);
1765
- const r = Wt(e), i = r === ((o = e.ownerDocument) == null ? void 0 : o.body), s = Z(r);
1766
- if (i) {
1767
- const l = et(s);
1768
- return t.concat(s, s.visualViewport || [], Te(r) ? r : [], l && n ? ke(l) : []);
1769
- }
1770
- return t.concat(r, ke(r, [], n));
1771
- }
1772
- function et(e) {
1773
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1774
- }
1775
- function Kt(e) {
1776
- const t = te(e);
1777
- let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
1778
- const r = oe(e), i = r ? e.offsetWidth : n, s = r ? e.offsetHeight : o, l = Ie(n) !== i || Ie(o) !== s;
1779
- return l && (n = i, o = s), {
1780
- width: n,
1781
- height: o,
1782
- $: l
1783
- };
1784
- }
1785
- function ut(e) {
1786
- return ee(e) ? e : e.contextElement;
1787
- }
1788
- function we(e) {
1789
- const t = ut(e);
1790
- if (!oe(t))
1791
- return ne(1);
1792
- const n = t.getBoundingClientRect(), {
1793
- width: o,
1794
- height: r,
1795
- $: i
1796
- } = Kt(t);
1797
- let s = (i ? Ie(n.width) : n.width) / o, l = (i ? Ie(n.height) : n.height) / r;
1798
- return (!s || !Number.isFinite(s)) && (s = 1), (!l || !Number.isFinite(l)) && (l = 1), {
1799
- x: s,
1800
- y: l
1801
- };
1802
- }
1803
- const Ro = /* @__PURE__ */ ne(0);
1804
- function zt(e) {
1805
- const t = Z(e);
1806
- return !ct() || !t.visualViewport ? Ro : {
1807
- x: t.visualViewport.offsetLeft,
1808
- y: t.visualViewport.offsetTop
1809
- };
1810
- }
1811
- function vo(e, t, n) {
1812
- return t === void 0 && (t = !1), !n || t && n !== Z(e) ? !1 : t;
1813
- }
1814
- function be(e, t, n, o) {
1815
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1816
- const r = e.getBoundingClientRect(), i = ut(e);
1817
- let s = ne(1);
1818
- t && (o ? ee(o) && (s = we(o)) : s = we(e));
1819
- const l = vo(i, n, o) ? zt(i) : ne(0);
1820
- let c = (r.left + l.x) / s.x, u = (r.top + l.y) / s.y, p = r.width / s.x, f = r.height / s.y;
1821
- if (i) {
1822
- const g = Z(i), d = o && ee(o) ? Z(o) : o;
1823
- let h = g, w = et(h);
1824
- for (; w && o && d !== h; ) {
1825
- const R = we(w), P = w.getBoundingClientRect(), C = te(w), O = P.left + (w.clientLeft + parseFloat(C.paddingLeft)) * R.x, k = P.top + (w.clientTop + parseFloat(C.paddingTop)) * R.y;
1826
- c *= R.x, u *= R.y, p *= R.x, f *= R.y, c += O, u += k, h = Z(w), w = et(h);
1827
- }
1828
- }
1829
- return Le({
1830
- width: p,
1831
- height: f,
1832
- x: c,
1833
- y: u
1834
- });
1835
- }
1836
- function at(e, t) {
1837
- const n = Ke(e).scrollLeft;
1838
- return t ? t.left + n : be(re(e)).left + n;
1839
- }
1840
- function qt(e, t, n) {
1841
- n === void 0 && (n = !1);
1842
- const o = e.getBoundingClientRect(), r = o.left + t.scrollLeft - (n ? 0 : (
1843
- // RTL <body> scrollbar.
1844
- at(e, o)
1845
- )), i = o.top + t.scrollTop;
1846
- return {
1847
- x: r,
1848
- y: i
1849
- };
1850
- }
1851
- function So(e) {
1852
- let {
1853
- elements: t,
1854
- rect: n,
1855
- offsetParent: o,
1856
- strategy: r
1857
- } = e;
1858
- const i = r === "fixed", s = re(o), l = t ? We(t.floating) : !1;
1859
- if (o === s || l && i)
1860
- return n;
1861
- let c = {
1862
- scrollLeft: 0,
1863
- scrollTop: 0
1864
- }, u = ne(1);
1865
- const p = ne(0), f = oe(o);
1866
- if ((f || !f && !i) && ((Re(o) !== "body" || Te(s)) && (c = Ke(o)), oe(o))) {
1867
- const d = be(o);
1868
- u = we(o), p.x = d.x + o.clientLeft, p.y = d.y + o.clientTop;
1869
- }
1870
- const g = s && !f && !i ? qt(s, c, !0) : ne(0);
1871
- return {
1872
- width: n.width * u.x,
1873
- height: n.height * u.y,
1874
- x: n.x * u.x - c.scrollLeft * u.x + p.x + g.x,
1875
- y: n.y * u.y - c.scrollTop * u.y + p.y + g.y
1876
- };
1877
- }
1878
- function Po(e) {
1879
- return Array.from(e.getClientRects());
1880
- }
1881
- function Oo(e) {
1882
- const t = re(e), n = Ke(e), o = e.ownerDocument.body, r = ge(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), i = ge(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
1883
- let s = -n.scrollLeft + at(e);
1884
- const l = -n.scrollTop;
1885
- return te(o).direction === "rtl" && (s += ge(t.clientWidth, o.clientWidth) - r), {
1886
- width: r,
1887
- height: i,
1888
- x: s,
1889
- y: l
1890
- };
1891
- }
1892
- function ko(e, t) {
1893
- const n = Z(e), o = re(e), r = n.visualViewport;
1894
- let i = o.clientWidth, s = o.clientHeight, l = 0, c = 0;
1895
- if (r) {
1896
- i = r.width, s = r.height;
1897
- const u = ct();
1898
- (!u || u && t === "fixed") && (l = r.offsetLeft, c = r.offsetTop);
1899
- }
1900
- return {
1901
- width: i,
1902
- height: s,
1903
- x: l,
1904
- y: c
1905
- };
1906
- }
1907
- function Eo(e, t) {
1908
- const n = be(e, !0, t === "fixed"), o = n.top + e.clientTop, r = n.left + e.clientLeft, i = oe(e) ? we(e) : ne(1), s = e.clientWidth * i.x, l = e.clientHeight * i.y, c = r * i.x, u = o * i.y;
1909
- return {
1910
- width: s,
1911
- height: l,
1912
- x: c,
1913
- y: u
1914
- };
1915
- }
1916
- function Pt(e, t, n) {
1917
- let o;
1918
- if (t === "viewport")
1919
- o = ko(e, n);
1920
- else if (t === "document")
1921
- o = Oo(re(e));
1922
- else if (ee(t))
1923
- o = Eo(t, n);
1924
- else {
1925
- const r = zt(e);
1926
- o = {
1927
- x: t.x - r.x,
1928
- y: t.y - r.y,
1929
- width: t.width,
1930
- height: t.height
1931
- };
1932
- }
1933
- return Le(o);
1934
- }
1935
- function Yt(e, t) {
1936
- const n = fe(e);
1937
- return n === t || !ee(n) || Ce(n) ? !1 : te(n).position === "fixed" || Yt(n, t);
1938
- }
1939
- function To(e, t) {
1940
- const n = t.get(e);
1941
- if (n)
1942
- return n;
1943
- let o = ke(e, [], !1).filter((l) => ee(l) && Re(l) !== "body"), r = null;
1944
- const i = te(e).position === "fixed";
1945
- let s = i ? fe(e) : e;
1946
- for (; ee(s) && !Ce(s); ) {
1947
- const l = te(s), c = lt(s);
1948
- !c && l.position === "fixed" && (r = null), (i ? !c && !r : !c && l.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || Te(s) && !c && Yt(e, s)) ? o = o.filter((p) => p !== s) : r = l, s = fe(s);
1949
- }
1950
- return t.set(e, o), o;
1951
- }
1952
- function No(e) {
1953
- let {
1954
- element: t,
1955
- boundary: n,
1956
- rootBoundary: o,
1957
- strategy: r
1958
- } = e;
1959
- const s = [...n === "clippingAncestors" ? We(t) ? [] : To(t, this._c) : [].concat(n), o], l = s[0], c = s.reduce((u, p) => {
1960
- const f = Pt(t, p, r);
1961
- return u.top = ge(f.top, u.top), u.right = De(f.right, u.right), u.bottom = De(f.bottom, u.bottom), u.left = ge(f.left, u.left), u;
1962
- }, Pt(t, l, r));
1963
- return {
1964
- width: c.right - c.left,
1965
- height: c.bottom - c.top,
1966
- x: c.left,
1967
- y: c.top
1968
- };
1969
- }
1970
- function Vo(e) {
1971
- const {
1972
- width: t,
1973
- height: n
1974
- } = Kt(e);
1975
- return {
1976
- width: t,
1977
- height: n
1978
- };
1979
- }
1980
- function Ao(e, t, n) {
1981
- const o = oe(t), r = re(t), i = n === "fixed", s = be(e, !0, i, t);
1982
- let l = {
1983
- scrollLeft: 0,
1984
- scrollTop: 0
1985
- };
1986
- const c = ne(0);
1987
- function u() {
1988
- c.x = at(r);
1989
- }
1990
- if (o || !o && !i)
1991
- if ((Re(t) !== "body" || Te(r)) && (l = Ke(t)), o) {
1992
- const d = be(t, !0, i, t);
1993
- c.x = d.x + t.clientLeft, c.y = d.y + t.clientTop;
1994
- } else r && u();
1995
- i && !o && r && u();
1996
- const p = r && !o && !i ? qt(r, l) : ne(0), f = s.left + l.scrollLeft - c.x - p.x, g = s.top + l.scrollTop - c.y - p.y;
1997
- return {
1998
- x: f,
1999
- y: g,
2000
- width: s.width,
2001
- height: s.height
2002
- };
2003
- }
2004
- function Ge(e) {
2005
- return te(e).position === "static";
2006
- }
2007
- function Ot(e, t) {
2008
- if (!oe(e) || te(e).position === "fixed")
2009
- return null;
2010
- if (t)
2011
- return t(e);
2012
- let n = e.offsetParent;
2013
- return re(e) === n && (n = n.ownerDocument.body), n;
2014
- }
2015
- function Gt(e, t) {
2016
- const n = Z(e);
2017
- if (We(e))
2018
- return n;
2019
- if (!oe(e)) {
2020
- let r = fe(e);
2021
- for (; r && !Ce(r); ) {
2022
- if (ee(r) && !Ge(r))
2023
- return r;
2024
- r = fe(r);
2025
- }
2026
- return n;
2027
- }
2028
- let o = Ot(e, t);
2029
- for (; o && wo(o) && Ge(o); )
2030
- o = Ot(o, t);
2031
- return o && Ce(o) && Ge(o) && !lt(o) ? n : o || Co(e) || n;
2032
- }
2033
- const Mo = async function(e) {
2034
- const t = this.getOffsetParent || Gt, n = this.getDimensions, o = await n(e.floating);
2035
- return {
2036
- reference: Ao(e.reference, await t(e.floating), e.strategy),
2037
- floating: {
2038
- x: 0,
2039
- y: 0,
2040
- width: o.width,
2041
- height: o.height
2042
- }
2043
- };
2044
- };
2045
- function Do(e) {
2046
- return te(e).direction === "rtl";
2047
- }
2048
- const Io = {
2049
- convertOffsetParentRelativeRectToViewportRelativeRect: So,
2050
- getDocumentElement: re,
2051
- getClippingRect: No,
2052
- getOffsetParent: Gt,
2053
- getElementRects: Mo,
2054
- getClientRects: Po,
2055
- getDimensions: Vo,
2056
- getScale: we,
2057
- isElement: ee,
2058
- isRTL: Do
2059
- };
2060
- function Jt(e, t) {
2061
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
2062
- }
2063
- function _o(e, t) {
2064
- let n = null, o;
2065
- const r = re(e);
2066
- function i() {
2067
- var l;
2068
- clearTimeout(o), (l = n) == null || l.disconnect(), n = null;
2069
- }
2070
- function s(l, c) {
2071
- l === void 0 && (l = !1), c === void 0 && (c = 1), i();
2072
- const u = e.getBoundingClientRect(), {
2073
- left: p,
2074
- top: f,
2075
- width: g,
2076
- height: d
2077
- } = u;
2078
- if (l || t(), !g || !d)
2079
- return;
2080
- const h = Ne(f), w = Ne(r.clientWidth - (p + g)), R = Ne(r.clientHeight - (f + d)), P = Ne(p), O = {
2081
- rootMargin: -h + "px " + -w + "px " + -R + "px " + -P + "px",
2082
- threshold: ge(0, De(1, c)) || 1
2083
- };
2084
- let k = !0;
2085
- function E(A) {
2086
- const L = A[0].intersectionRatio;
2087
- if (L !== c) {
2088
- if (!k)
2089
- return s();
2090
- L ? s(!1, L) : o = setTimeout(() => {
2091
- s(!1, 1e-7);
2092
- }, 1e3);
2093
- }
2094
- L === 1 && !Jt(u, e.getBoundingClientRect()) && s(), k = !1;
2095
- }
2096
- try {
2097
- n = new IntersectionObserver(E, {
2098
- ...O,
2099
- // Handle <iframe>s
2100
- root: r.ownerDocument
2101
- });
2102
- } catch {
2103
- n = new IntersectionObserver(E, O);
2104
- }
2105
- n.observe(e);
2106
- }
2107
- return s(!0), i;
2108
- }
2109
- function kt(e, t, n, o) {
2110
- o === void 0 && (o = {});
2111
- const {
2112
- ancestorScroll: r = !0,
2113
- ancestorResize: i = !0,
2114
- elementResize: s = typeof ResizeObserver == "function",
2115
- layoutShift: l = typeof IntersectionObserver == "function",
2116
- animationFrame: c = !1
2117
- } = o, u = ut(e), p = r || i ? [...u ? ke(u) : [], ...ke(t)] : [];
2118
- p.forEach((P) => {
2119
- r && P.addEventListener("scroll", n, {
2120
- passive: !0
2121
- }), i && P.addEventListener("resize", n);
2122
- });
2123
- const f = u && l ? _o(u, n) : null;
2124
- let g = -1, d = null;
2125
- s && (d = new ResizeObserver((P) => {
2126
- let [C] = P;
2127
- C && C.target === u && d && (d.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
2128
- var O;
2129
- (O = d) == null || O.observe(t);
2130
- })), n();
2131
- }), u && !c && d.observe(u), d.observe(t));
2132
- let h, w = c ? be(e) : null;
2133
- c && R();
2134
- function R() {
2135
- const P = be(e);
2136
- w && !Jt(w, P) && n(), w = P, h = requestAnimationFrame(R);
2137
- }
2138
- return n(), () => {
2139
- var P;
2140
- p.forEach((C) => {
2141
- r && C.removeEventListener("scroll", n), i && C.removeEventListener("resize", n);
2142
- }), f == null || f(), (P = d) == null || P.disconnect(), d = null, c && cancelAnimationFrame(h);
2143
- };
2144
- }
2145
- const Lo = xo, Fo = yo, jo = mo, Bo = (e, t, n) => {
2146
- const o = /* @__PURE__ */ new Map(), r = {
2147
- platform: Io,
2148
- ...n
2149
- }, i = {
2150
- ...r.platform,
2151
- _c: o
2152
- };
2153
- return ho(e, t, {
2154
- ...r,
2155
- platform: i
2156
- });
2157
- };
2158
- var Ve = typeof document < "u" ? hn : Vt;
2159
- function Fe(e, t) {
2160
- if (e === t)
2161
- return !0;
2162
- if (typeof e != typeof t)
2163
- return !1;
2164
- if (typeof e == "function" && e.toString() === t.toString())
2165
- return !0;
2166
- let n, o, r;
2167
- if (e && t && typeof e == "object") {
2168
- if (Array.isArray(e)) {
2169
- if (n = e.length, n !== t.length) return !1;
2170
- for (o = n; o-- !== 0; )
2171
- if (!Fe(e[o], t[o]))
2172
- return !1;
2173
- return !0;
2174
- }
2175
- if (r = Object.keys(e), n = r.length, n !== Object.keys(t).length)
2176
- return !1;
2177
- for (o = n; o-- !== 0; )
2178
- if (!{}.hasOwnProperty.call(t, r[o]))
2179
- return !1;
2180
- for (o = n; o-- !== 0; ) {
2181
- const i = r[o];
2182
- if (!(i === "_owner" && e.$$typeof) && !Fe(e[i], t[i]))
2183
- return !1;
2184
- }
2185
- return !0;
2186
- }
2187
- return e !== e && t !== t;
2188
- }
2189
- function Xt(e) {
2190
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
2191
- }
2192
- function Et(e, t) {
2193
- const n = Xt(e);
2194
- return Math.round(t * n) / n;
2195
- }
2196
- function Je(e) {
2197
- const t = a.useRef(e);
2198
- return Ve(() => {
2199
- t.current = e;
2200
- }), t;
2201
- }
2202
- function $o(e) {
2203
- e === void 0 && (e = {});
2204
- const {
2205
- placement: t = "bottom",
2206
- strategy: n = "absolute",
2207
- middleware: o = [],
2208
- platform: r,
2209
- elements: {
2210
- reference: i,
2211
- floating: s
2212
- } = {},
2213
- transform: l = !0,
2214
- whileElementsMounted: c,
2215
- open: u
2216
- } = e, [p, f] = a.useState({
2217
- x: 0,
2218
- y: 0,
2219
- strategy: n,
2220
- placement: t,
2221
- middlewareData: {},
2222
- isPositioned: !1
2223
- }), [g, d] = a.useState(o);
2224
- Fe(g, o) || d(o);
2225
- const [h, w] = a.useState(null), [R, P] = a.useState(null), C = a.useCallback((N) => {
2226
- N !== A.current && (A.current = N, w(N));
2227
- }, []), O = a.useCallback((N) => {
2228
- N !== L.current && (L.current = N, P(N));
2229
- }, []), k = i || h, E = s || R, A = a.useRef(null), L = a.useRef(null), W = a.useRef(p), D = c != null, F = Je(c), y = Je(r), b = Je(u), T = a.useCallback(() => {
2230
- if (!A.current || !L.current)
2231
- return;
2232
- const N = {
2233
- placement: t,
2234
- strategy: n,
2235
- middleware: g
2236
- };
2237
- y.current && (N.platform = y.current), Bo(A.current, L.current, N).then((I) => {
2238
- const B = {
2239
- ...I,
2240
- // The floating element's position may be recomputed while it's closed
2241
- // but still mounted (such as when transitioning out). To ensure
2242
- // `isPositioned` will be `false` initially on the next open, avoid
2243
- // setting it to `true` when `open === false` (must be specified).
2244
- isPositioned: b.current !== !1
2245
- };
2246
- j.current && !Fe(W.current, B) && (W.current = B, At.flushSync(() => {
2247
- f(B);
2248
- }));
2249
- });
2250
- }, [g, t, n, y, b]);
2251
- Ve(() => {
2252
- u === !1 && W.current.isPositioned && (W.current.isPositioned = !1, f((N) => ({
2253
- ...N,
2254
- isPositioned: !1
2255
- })));
2256
- }, [u]);
2257
- const j = a.useRef(!1);
2258
- Ve(() => (j.current = !0, () => {
2259
- j.current = !1;
2260
- }), []), Ve(() => {
2261
- if (k && (A.current = k), E && (L.current = E), k && E) {
2262
- if (F.current)
2263
- return F.current(k, E, T);
2264
- T();
2265
- }
2266
- }, [k, E, T, F, D]);
2267
- const q = a.useMemo(() => ({
2268
- reference: A,
2269
- floating: L,
2270
- setReference: C,
2271
- setFloating: O
2272
- }), [C, O]), S = a.useMemo(() => ({
2273
- reference: k,
2274
- floating: E
2275
- }), [k, E]), V = a.useMemo(() => {
2276
- const N = {
2277
- position: n,
2278
- left: 0,
2279
- top: 0
2280
- };
2281
- if (!S.floating)
2282
- return N;
2283
- const I = Et(S.floating, p.x), B = Et(S.floating, p.y);
2284
- return l ? {
2285
- ...N,
2286
- transform: "translate(" + I + "px, " + B + "px)",
2287
- ...Xt(S.floating) >= 1.5 && {
2288
- willChange: "transform"
2289
- }
2290
- } : {
2291
- position: n,
2292
- left: I,
2293
- top: B
2294
- };
2295
- }, [n, l, S.floating, p.x, p.y]);
2296
- return a.useMemo(() => ({
2297
- ...p,
2298
- update: T,
2299
- refs: q,
2300
- elements: S,
2301
- floatingStyles: V
2302
- }), [p, T, q, S, V]);
2303
- }
2304
- const Tt = (e, t) => ({
2305
- ...Lo(e),
2306
- options: [e, t]
2307
- }), Uo = (e, t) => ({
2308
- ...Fo(e),
2309
- options: [e, t]
2310
- }), Wo = (e, t) => ({
2311
- ...jo(e),
2312
- options: [e, t]
2313
- });
2314
- function Ko(e) {
2315
- return typeof e == "function" ? e() : e;
2316
- }
2317
- const je = /* @__PURE__ */ a.forwardRef(function(t, n) {
2318
- const {
2319
- children: o,
2320
- container: r,
2321
- disablePortal: i = !1
2322
- } = t, [s, l] = a.useState(null), c = le(Sn(o), n);
2323
- if (Oe(() => {
2324
- i || l(Ko(r) || document.body);
2325
- }, [r, i]), Oe(() => {
2326
- if (s && !i)
2327
- return mt(n, s), () => {
2328
- mt(n, null);
2329
- };
2330
- }, [n, s, i]), i) {
2331
- if (/* @__PURE__ */ a.isValidElement(o)) {
2332
- const u = {
2333
- ref: c
2334
- };
2335
- return /* @__PURE__ */ a.cloneElement(o, u);
2336
- }
2337
- return /* @__PURE__ */ _.jsx(a.Fragment, {
2338
- children: o
2339
- });
2340
- }
2341
- return /* @__PURE__ */ _.jsx(a.Fragment, {
2342
- children: s && /* @__PURE__ */ At.createPortal(o, s)
2343
- });
2344
- });
2345
- process.env.NODE_ENV !== "production" && (je.propTypes = {
2346
- // ┌────────────────────────────── Warning ──────────────────────────────┐
2347
- // │ These PropTypes are generated from the TypeScript type definitions. │
2348
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2349
- // └─────────────────────────────────────────────────────────────────────┘
2350
- /**
2351
- * The children to render into the `container`.
2352
- */
2353
- children: m.node,
2354
- /**
2355
- * An HTML element or function that returns one.
2356
- * The `container` will have the portal children appended to it.
2357
- *
2358
- * You can also provide a callback, which is called in a React layout effect.
2359
- * This lets you set the container from a ref, and also makes server-side rendering possible.
2360
- *
2361
- * By default, it uses the body of the top-level document object,
2362
- * so it's simply `document.body` most of the time.
2363
- */
2364
- container: m.oneOfType([Xe, m.func]),
2365
- /**
2366
- * The `children` will be under the DOM hierarchy of the parent component.
2367
- * @default false
2368
- */
2369
- disablePortal: m.bool
2370
- });
2371
- process.env.NODE_ENV !== "production" && (je.propTypes = Rn(je.propTypes));
2372
- const Qt = "Popup";
2373
- function zo(e) {
2374
- return tt(Qt, e);
2375
- }
2376
- nt(Qt, ["root", "open"]);
2377
- const Zt = /* @__PURE__ */ a.createContext(null);
2378
- process.env.NODE_ENV !== "production" && (Zt.displayName = "TransitionContext");
2379
- function qo(e) {
2380
- const [t, n] = a.useState(!0), o = a.useRef(!1), r = a.useRef(0), [i, s] = a.useState(!1), l = a.useRef(e);
2381
- a.useEffect(() => {
2382
- !e && // checking registeredTransitions.current instead of hasTransition to avoid this effect re-firing whenever hasTransition changes
2383
- r.current > 0 && // prevents waiting for a pending transition right after mounting
2384
- l.current !== e && (o.current = !0, n(!1)), l.current = e;
2385
- }, [e]);
2386
- const c = a.useCallback(() => {
2387
- o.current = !1, n(!0);
2388
- }, []), u = a.useCallback(() => (r.current += 1, s(!0), () => {
2389
- r.current -= 1, r.current === 0 && s(!1);
2390
- }), []);
2391
- let p;
2392
- return i ? e ? p = !1 : p = !o.current && t : p = !e, {
2393
- contextValue: a.useMemo(() => ({
2394
- requestedEnter: e,
2395
- onExited: c,
2396
- registerTransition: u,
2397
- hasExited: p
2398
- }), [c, e, u, p]),
2399
- hasExited: p
2400
- };
2401
- }
2402
- const Ht = /* @__PURE__ */ a.createContext(null);
2403
- process.env.NODE_ENV !== "production" && (Ht.displayName = "PopupContext");
2404
- function Yo(e) {
2405
- const {
2406
- open: t
2407
- } = e;
2408
- return ot({
2409
- root: ["root", t && "open"]
2410
- }, rt(zo));
2411
- }
2412
- function Go(e) {
2413
- return typeof e == "function" ? e() : e;
2414
- }
2415
- const en = /* @__PURE__ */ a.forwardRef(function(t, n) {
2416
- const {
2417
- anchor: o,
2418
- children: r,
2419
- container: i,
2420
- disablePortal: s = !1,
2421
- keepMounted: l = !1,
2422
- middleware: c,
2423
- offset: u = 0,
2424
- open: p = !1,
2425
- placement: f = "bottom",
2426
- slotProps: g = {},
2427
- slots: d = {},
2428
- strategy: h = "absolute",
2429
- ...w
2430
- } = t, {
2431
- refs: R,
2432
- elements: P,
2433
- floatingStyles: C,
2434
- update: O,
2435
- placement: k
2436
- } = $o({
2437
- elements: {
2438
- reference: Go(o)
2439
- },
2440
- open: p,
2441
- middleware: c ?? [Tt(u ?? 0), Wo(), Uo()],
2442
- placement: f,
2443
- strategy: h,
2444
- whileElementsMounted: l ? void 0 : kt
2445
- }), E = le(R.setFloating, n);
2446
- Oe(() => {
2447
- if (l && p && P.reference && P.floating)
2448
- return kt(P.reference, P.floating, O);
2449
- }, [l, p, P, O]);
2450
- const A = {
2451
- ...t,
2452
- disablePortal: s,
2453
- keepMounted: l,
2454
- offset: Tt,
2455
- open: p,
2456
- placement: f,
2457
- finalPlacement: k,
2458
- strategy: h
2459
- }, {
2460
- contextValue: L,
2461
- hasExited: W
2462
- } = qo(p), D = l && W ? "hidden" : void 0, F = Yo(A), y = (d == null ? void 0 : d.root) ?? "div", b = Pe({
2463
- elementType: y,
2464
- externalSlotProps: g.root,
2465
- externalForwardedProps: w,
2466
- ownerState: A,
2467
- className: F.root,
2468
- additionalProps: {
2469
- ref: E,
2470
- role: "tooltip",
2471
- style: {
2472
- ...C,
2473
- visibility: D
2474
- }
2475
- }
2476
- }), T = a.useMemo(() => ({
2477
- placement: k
2478
- }), [k]);
2479
- return l || !W ? /* @__PURE__ */ _.jsx(je, {
2480
- disablePortal: s,
2481
- container: i,
2482
- children: /* @__PURE__ */ _.jsx(Ht.Provider, {
2483
- value: T,
2484
- children: /* @__PURE__ */ _.jsx(Zt.Provider, {
2485
- value: L,
2486
- children: /* @__PURE__ */ _.jsx(y, {
2487
- ...b,
2488
- children: r
2489
- })
2490
- })
2491
- })
2492
- }) : null;
2493
- });
2494
- process.env.NODE_ENV !== "production" && (en.propTypes = {
2495
- // ┌────────────────────────────── Warning ──────────────────────────────┐
2496
- // │ These PropTypes are generated from the TypeScript type definitions. │
2497
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2498
- // └─────────────────────────────────────────────────────────────────────┘
2499
- /**
2500
- * An HTML element, [virtual element](https://floating-ui.com/docs/virtual-elements),
2501
- * or a function that returns either.
2502
- * It's used to set the position of the popup.
2503
- */
2504
- anchor: m.oneOfType([Xe, m.object, m.func]),
2505
- /**
2506
- * @ignore
2507
- */
2508
- children: m.oneOfType([m.node, m.func]),
2509
- /**
2510
- * An HTML element or function that returns one. The container will have the portal children appended to it.
2511
- * By default, it uses the body of the top-level document object, so it's `document.body` in these cases.
2512
- */
2513
- container: m.oneOfType([Xe, m.func]),
2514
- /**
2515
- * If `true`, the popup will be rendered where it is defined, without the use of portals.
2516
- * @default false
2517
- */
2518
- disablePortal: m.bool,
2519
- /**
2520
- * If `true`, the popup will exist in the DOM even if it's closed.
2521
- * Its visibility will be controlled by the `visibility` CSS property.
2522
- *
2523
- * Otherwise, a closed popup will be removed from the DOM.
2524
- *
2525
- * @default false
2526
- */
2527
- keepMounted: m.bool,
2528
- /**
2529
- * Collection of Floating UI middleware to use when positioning the popup.
2530
- * If not provided, the [`offset`](https://floating-ui.com/docs/offset)
2531
- * and [`flip`](https://floating-ui.com/docs/flip) functions will be used.
2532
- *
2533
- * @see https://floating-ui.com/docs/computePosition#middleware
2534
- */
2535
- middleware: m.arrayOf(m.oneOfType([m.oneOf([!1]), m.shape({
2536
- fn: m.func.isRequired,
2537
- name: m.string.isRequired,
2538
- options: m.any
2539
- })])),
2540
- /**
2541
- * Distance between a popup and the trigger element.
2542
- * This prop is ignored when custom `middleware` is provided.
2543
- *
2544
- * @default 0
2545
- * @see https://floating-ui.com/docs/offset
2546
- */
2547
- offset: m.oneOfType([m.func, m.number, m.shape({
2548
- alignmentAxis: m.number,
2549
- crossAxis: m.number,
2550
- mainAxis: m.number
2551
- })]),
2552
- /**
2553
- * If `true`, the popup is visible.
2554
- *
2555
- * @default false
2556
- */
2557
- open: m.bool,
2558
- /**
2559
- * Determines where to place the popup relative to the trigger element.
2560
- *
2561
- * @default 'bottom'
2562
- * @see https://floating-ui.com/docs/computePosition#placement
2563
- */
2564
- placement: m.oneOf(["bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
2565
- /**
2566
- * The props used for each slot inside the Popup.
2567
- *
2568
- * @default {}
2569
- */
2570
- slotProps: m.shape({
2571
- root: m.oneOfType([m.func, m.object])
2572
- }),
2573
- /**
2574
- * The components used for each slot inside the Popup.
2575
- * Either a string to use a HTML element or a component.
2576
- *
2577
- * @default {}
2578
- */
2579
- slots: m.shape({
2580
- root: m.elementType
2581
- }),
2582
- /**
2583
- * The type of CSS position property to use (absolute or fixed).
2584
- *
2585
- * @default 'absolute'
2586
- * @see https://floating-ui.com/docs/computePosition#strategy
2587
- */
2588
- strategy: m.oneOf(["absolute", "fixed"])
2589
- });
2590
- const tn = "Select";
2591
- function Jo(e) {
2592
- return tt(tn, e);
2593
- }
2594
- nt(tn, ["root", "button", "listbox", "popup", "active", "expanded", "disabled", "focusVisible"]);
2595
- var Nt;
2596
- function Xo(e) {
2597
- return Array.isArray(e) ? /* @__PURE__ */ _.jsx(a.Fragment, {
2598
- children: e.map((t) => t.label).join(", ")
2599
- }) : (e == null ? void 0 : e.label) ?? null;
2600
- }
2601
- function Qo(e) {
2602
- const {
2603
- active: t,
2604
- disabled: n,
2605
- open: o,
2606
- focusVisible: r
2607
- } = e;
2608
- return ot({
2609
- root: ["root", n && "disabled", r && "focusVisible", t && "active", o && "expanded"],
2610
- listbox: ["listbox", n && "disabled"],
2611
- popup: ["popup"]
2612
- }, rt(Jo));
2613
- }
2614
- const nn = /* @__PURE__ */ a.forwardRef(function(t, n) {
2615
- const {
2616
- areOptionsEqual: o,
2617
- autoComplete: r,
2618
- autoFocus: i,
2619
- children: s,
2620
- defaultValue: l,
2621
- defaultListboxOpen: c = !1,
2622
- disabled: u,
2623
- getSerializedValue: p,
2624
- listboxId: f,
2625
- listboxOpen: g,
2626
- multiple: d = !1,
2627
- name: h,
2628
- required: w = !1,
2629
- onChange: R,
2630
- onListboxOpenChange: P,
2631
- getOptionAsString: C = Lt,
2632
- renderValue: O,
2633
- placeholder: k,
2634
- slotProps: E = {},
2635
- slots: A = {},
2636
- value: L,
2637
- ...W
2638
- } = t, D = O ?? Xo, [F, y] = a.useState(!1), b = a.useRef(null), T = a.useRef(null), j = A.root ?? "button", q = A.listbox ?? "ul", S = A.popup ?? "div", V = a.useCallback((pe) => {
2639
- y(pe != null);
2640
- }, []), N = le(n, b, V);
2641
- a.useEffect(() => {
2642
- i && b.current.focus();
2643
- }, [i]);
2644
- const {
2645
- buttonActive: I,
2646
- buttonFocusVisible: B,
2647
- contextValue: H,
2648
- disabled: G,
2649
- getButtonProps: ie,
2650
- getListboxProps: ve,
2651
- getHiddenInputProps: xe,
2652
- getOptionMetadata: ye,
2653
- value: $,
2654
- open: M
2655
- } = ro({
2656
- name: h,
2657
- required: w,
2658
- getSerializedValue: p,
2659
- areOptionsEqual: o,
2660
- buttonRef: N,
2661
- defaultOpen: c,
2662
- defaultValue: l,
2663
- disabled: u,
2664
- listboxId: f,
2665
- multiple: d,
2666
- open: g,
2667
- onChange: R,
2668
- onOpenChange: P,
2669
- getOptionAsString: C,
2670
- value: L,
2671
- componentName: "Select"
2672
- }), U = {
2673
- ...t,
2674
- active: I,
2675
- defaultListboxOpen: c,
2676
- disabled: G,
2677
- focusVisible: B,
2678
- open: M,
2679
- multiple: d,
2680
- renderValue: D,
2681
- value: $
2682
- }, Y = Qo(U), se = Pe({
2683
- elementType: j,
2684
- getSlotProps: ie,
2685
- externalSlotProps: E.root,
2686
- externalForwardedProps: W,
2687
- ownerState: U,
2688
- className: Y.root
2689
- }), ce = Pe({
2690
- elementType: q,
2691
- getSlotProps: ve,
2692
- externalSlotProps: E.listbox,
2693
- additionalProps: {
2694
- ref: T
2695
- },
2696
- ownerState: U,
2697
- className: Y.listbox
2698
- }), de = Pe({
2699
- elementType: S,
2700
- externalSlotProps: E.popup,
2701
- additionalProps: {
2702
- anchor: b.current,
2703
- keepMounted: !0,
2704
- open: M,
2705
- placement: "bottom-start",
2706
- role: void 0
2707
- },
2708
- ownerState: U,
2709
- className: Y.popup
2710
- });
2711
- let ue;
2712
- return d ? ue = $.map((pe) => ye(pe)).filter((pe) => pe !== void 0) : ue = ye($) ?? null, /* @__PURE__ */ _.jsxs(a.Fragment, {
2713
- children: [/* @__PURE__ */ _.jsx(j, {
2714
- ...se,
2715
- children: D(ue) ?? k ?? // fall back to a zero-width space to prevent layout shift
2716
- // from https://github.com/mui/material-ui/pull/24563
2717
- (Nt || (Nt = /* @__PURE__ */ _.jsx("span", {
2718
- className: "notranslate",
2719
- children: "​"
2720
- })))
2721
- }), F && /* @__PURE__ */ _.jsx(en, {
2722
- slots: {
2723
- root: S
2724
- },
2725
- ...de,
2726
- children: /* @__PURE__ */ _.jsx(q, {
2727
- ...ce,
2728
- children: /* @__PURE__ */ _.jsx(io, {
2729
- value: H,
2730
- children: s
2731
- })
2732
- })
2733
- }), /* @__PURE__ */ _.jsx("input", {
2734
- ...xe(),
2735
- autoComplete: r
2736
- })]
2737
- });
2738
- });
2739
- process.env.NODE_ENV !== "production" && (nn.propTypes = {
2740
- // ┌────────────────────────────── Warning ──────────────────────────────┐
2741
- // │ These PropTypes are generated from the TypeScript type definitions. │
2742
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2743
- // └─────────────────────────────────────────────────────────────────────┘
2744
- /**
2745
- * A function used to determine if two options' values are equal.
2746
- * By default, reference equality is used.
2747
- *
2748
- * There is a performance impact when using the `areOptionsEqual` prop (proportional to the number of options).
2749
- * Therefore, it's recommented to use the default reference equality comparison whenever possible.
2750
- */
2751
- areOptionsEqual: m.func,
2752
- /**
2753
- * This prop helps users to fill forms faster, especially on mobile devices.
2754
- * The name can be confusing, as it's more like an autofill.
2755
- * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
2756
- */
2757
- autoComplete: m.string,
2758
- /**
2759
- * If `true`, the select element is focused during the first mount
2760
- * @default false
2761
- */
2762
- autoFocus: m.bool,
2763
- /**
2764
- * @ignore
2765
- */
2766
- children: m.node,
2767
- /**
2768
- * @ignore
2769
- */
2770
- className: m.string,
2771
- /**
2772
- * If `true`, the select will be initially open.
2773
- * @default false
2774
- */
2775
- defaultListboxOpen: m.bool,
2776
- /**
2777
- * The default selected value. Use when the component is not controlled.
2778
- */
2779
- defaultValue: m.any,
2780
- /**
2781
- * If `true`, the select is disabled.
2782
- * @default false
2783
- */
2784
- disabled: m.bool,
2785
- /**
2786
- * A function used to convert the option label to a string.
2787
- * It's useful when labels are elements and need to be converted to plain text
2788
- * to enable navigation using character keys on a keyboard.
2789
- *
2790
- * @default defaultOptionStringifier
2791
- */
2792
- getOptionAsString: m.func,
2793
- /**
2794
- * A function to convert the currently selected value to a string.
2795
- * Used to set a value of a hidden input associated with the select,
2796
- * so that the selected value can be posted with a form.
2797
- */
2798
- getSerializedValue: m.func,
2799
- /**
2800
- * `id` attribute of the listbox element.
2801
- */
2802
- listboxId: m.string,
2803
- /**
2804
- * Controls the open state of the select's listbox.
2805
- * @default undefined
2806
- */
2807
- listboxOpen: m.bool,
2808
- /**
2809
- * If `true`, selecting multiple values is allowed.
2810
- * This affects the type of the `value`, `defaultValue`, and `onChange` props.
2811
- *
2812
- * @default false
2813
- */
2814
- multiple: m.bool,
2815
- /**
2816
- * Name of the element. For example used by the server to identify the fields in form submits.
2817
- */
2818
- name: m.string,
2819
- /**
2820
- * Callback fired when an option is selected.
2821
- */
2822
- onChange: m.func,
2823
- /**
2824
- * Callback fired when the component requests to be opened.
2825
- * Use in controlled mode (see listboxOpen).
2826
- */
2827
- onListboxOpenChange: m.func,
2828
- /**
2829
- * Text to show when there is no selected value.
2830
- */
2831
- placeholder: m.node,
2832
- /**
2833
- * Function that customizes the rendering of the selected value.
2834
- */
2835
- renderValue: m.func,
2836
- /**
2837
- * If `true`, the Select cannot be empty when submitting form.
2838
- * @default false
2839
- */
2840
- required: m.bool,
2841
- /**
2842
- * The props used for each slot inside the Input.
2843
- * @default {}
2844
- */
2845
- slotProps: m.shape({
2846
- listbox: m.oneOfType([m.func, m.object]),
2847
- popup: m.oneOfType([m.func, m.object]),
2848
- root: m.oneOfType([m.func, m.object])
2849
- }),
2850
- /**
2851
- * The components used for each slot inside the Select.
2852
- * Either a string to use a HTML element or a component.
2853
- * @default {}
2854
- */
2855
- slots: m.shape({
2856
- listbox: m.elementType,
2857
- popup: m.elementType,
2858
- root: m.elementType
2859
- }),
2860
- /**
2861
- * The selected value.
2862
- * Set to `null` to deselect all options.
2863
- */
2864
- value: m.any
2865
- });
2866
- const Zo = "open", Ho = "closed", er = "disabled", tr = "gradientMove", nr = "fadeInKeyframe", or = {
2867
- "prokodo-Select": "prokodo-Select",
2868
- "prokodo-Select__field": "prokodo-Select__field",
2869
- "prokodo-Select__field--expanded": "prokodo-Select__field--expanded",
2870
- "prokodo-Select__button": "prokodo-Select__button",
2871
- "prokodo-Select__button__inner": "prokodo-Select__button__inner",
2872
- "prokodo-Select__button--expanded": "prokodo-Select__button--expanded",
2873
- "prokodo-Select__listbox": "prokodo-Select__listbox",
2874
- open: Zo,
2875
- "fade-in": "fade-in",
2876
- closed: Ho,
2877
- "fade-out": "fade-out",
2878
- "placement-top": "placement-top",
2879
- "placement-bottom": "placement-bottom",
2880
- "prokodo-Select__item": "prokodo-Select__item",
2881
- disabled: er,
2882
- "prokodo-Select__item--selected": "prokodo-Select__item--selected",
2883
- "base-Option-highlighted": "base-Option-highlighted",
2884
- "base--selected": "base--selected",
2885
- "prokodo-Select__item--disabled": "prokodo-Select__item--disabled",
2886
- "prokodo-Select__popup": "prokodo-Select__popup",
2887
- "prokodo-Select__checkbox": "prokodo-Select__checkbox",
2888
- "prokodo-Select__checkbox--checked": "prokodo-Select__checkbox--checked",
2889
- gradientMove: tr,
2890
- fadeInKeyframe: nr
2891
- }, Q = xn(or, "Select"), rr = mn(
2892
- ({
2893
- id: e,
2894
- iconVisible: t,
2895
- required: n,
2896
- multiple: o,
2897
- value: r,
2898
- placeholder: i,
2899
- color: s = "primary",
2900
- label: l,
2901
- labelProps: c = {},
2902
- hideLabel: u,
2903
- className: p,
2904
- classNameSelect: f,
2905
- items: g,
2906
- slotProps: d,
2907
- errorText: h,
2908
- helperText: w,
2909
- onChange: R,
2910
- ...P
2911
- }) => {
2912
- const [C, O] = ft(
2913
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
2914
- r ?? o ? [] : "default"
2915
- );
2916
- Vt(() => {
2917
- r !== void 0 && O(r);
2918
- }, [r, C]);
2919
- const k = bn(
2920
- (S, V) => {
2921
- V !== null && (O(V), R == null || R(S, V));
2922
- },
2923
- [R]
2924
- ), E = `${e}-label`, A = `${e}-error`, L = `${e}-helper`, [W, D] = ft(!1);
2925
- if (Array.isArray(g) ? g.length === 0 : Object.keys(g).length === 0)
2926
- return null;
2927
- const F = {
2928
- expanded: W
2929
- }, y = i ?? "-- Please choose --", b = dt(h), T = n === !0, j = o === !0, q = dt(w);
2930
- return /* @__PURE__ */ _.jsxs("div", { className: Q(void 0, void 0, p), children: [
2931
- (u === void 0 || u === !1) && /* @__PURE__ */ _.jsx(
2932
- yn,
2933
- {
2934
- ...c,
2935
- error: b,
2936
- htmlFor: E,
2937
- label: l,
2938
- required: n
2939
- }
2940
- ),
2941
- /* @__PURE__ */ _.jsx(
2942
- "div",
2943
- {
2944
- className: Q("field", {
2945
- ...F,
2946
- [s]: !!s
2947
- }),
2948
- children: /* @__PURE__ */ _.jsxs(
2949
- nn,
2950
- {
2951
- ...P,
2952
- "aria-invalid": b,
2953
- "aria-labelledby": E,
2954
- "aria-required": n ? "true" : void 0,
2955
- className: Q("select", void 0, f),
2956
- id: e,
2957
- multiple: o,
2958
- required: n,
2959
- slots: { root: "button", listbox: "ul", popup: "div" },
2960
- value: C,
2961
- "aria-describedby": b ? A : q ? L : void 0,
2962
- renderValue: (S) => {
2963
- var N, I, B, H;
2964
- if (S === null && (T || j) || Array.isArray(S) && S.length === 0 && (T || j))
2965
- return /* @__PURE__ */ _.jsx(
2966
- "span",
2967
- {
2968
- className: Q("button__inner", {
2969
- "is-placeholder": !0
2970
- }),
2971
- children: y
2972
- }
2973
- );
2974
- if (Array.isArray(S)) {
2975
- const G = g == null ? void 0 : g.find((ie) => ie.value === r);
2976
- return /* @__PURE__ */ _.jsxs("span", { className: Q("button__inner", F), children: [
2977
- pt(t) && !gt((N = G == null ? void 0 : G.icon) == null ? void 0 : N.call(G)) && ((I = G == null ? void 0 : G.icon) == null ? void 0 : I.call(G)),
2978
- S.map((ie) => ie.label).join(", ")
2979
- ] });
2980
- }
2981
- const V = g == null ? void 0 : g.find(
2982
- (G) => G.value === (S == null ? void 0 : S.value)
2983
- );
2984
- return /* @__PURE__ */ _.jsxs("span", { className: Q("button__inner", F), children: [
2985
- pt(t) && !gt((B = V == null ? void 0 : V.icon) == null ? void 0 : B.call(V)) && ((H = V == null ? void 0 : V.icon) == null ? void 0 : H.call(V)),
2986
- S == null ? void 0 : S.label
2987
- ] });
2988
- },
2989
- slotProps: {
2990
- ...d,
2991
- root: {
2992
- ...d == null ? void 0 : d.root,
2993
- className: Q("button", F),
2994
- role: "button",
2995
- "aria-haspopup": "listbox",
2996
- "aria-expanded": W ? "true" : "false"
2997
- },
2998
- listbox: {
2999
- ...d == null ? void 0 : d.listbox,
3000
- className: Q("listbox"),
3001
- role: "listbox"
3002
- },
3003
- popup: {
3004
- ...d == null ? void 0 : d.popup,
3005
- disablePortal: !0,
3006
- className: Q("popup", {
3007
- "is-expanded": W
3008
- })
3009
- }
3010
- },
3011
- onChange: k,
3012
- onListboxOpenChange: (S) => D(S),
3013
- children: [
3014
- !T && !j && /* @__PURE__ */ _.jsx(
3015
- Ze,
3016
- {
3017
- "aria-label": y.toString(),
3018
- "aria-selected": C === "default" ? "true" : "false",
3019
- value: "default",
3020
- className: Q("item", {
3021
- selected: C === "default"
3022
- }),
3023
- children: y
3024
- }
3025
- ),
3026
- g.map((S) => {
3027
- const { icon: V, ...N } = S, B = ((S == null ? void 0 : S.value) === C || (C == null ? void 0 : C.includes(S == null ? void 0 : S.value))) === !0;
3028
- return /* @__PURE__ */ _.jsxs(
3029
- Ze,
3030
- {
3031
- className: Q(
3032
- "item",
3033
- {
3034
- selected: B && !j
3035
- },
3036
- S == null ? void 0 : S.className
3037
- ),
3038
- ...N,
3039
- "aria-label": S == null ? void 0 : S.label,
3040
- "aria-selected": B ? "true" : "false",
3041
- children: [
3042
- j && /* @__PURE__ */ _.jsx(
3043
- "input",
3044
- {
3045
- "aria-hidden": "true",
3046
- defaultChecked: B,
3047
- type: "checkbox",
3048
- className: Q("checkbox", {
3049
- checked: B
3050
- })
3051
- }
3052
- ),
3053
- V && V(),
3054
- S == null ? void 0 : S.label
3055
- ]
3056
- },
3057
- `${E}-item-${S == null ? void 0 : S.value}`
3058
- );
3059
- })
3060
- ]
3061
- }
3062
- )
3063
- }
3064
- ),
3065
- (b || q) && /* @__PURE__ */ _.jsx(
3066
- "div",
3067
- {
3068
- "aria-live": b ? "assertive" : "polite",
3069
- className: Q("helperText", { "is-error": b }),
3070
- id: b ? A : L,
3071
- role: b ? "alert" : void 0,
3072
- children: /* @__PURE__ */ _.jsx("span", { className: Q("helperText__content"), children: h ?? w })
3073
- }
3074
- )
3075
- ] });
3076
- }
3077
- );
3078
- rr.displayName = "Select";
3079
- export {
3080
- rr as S
3081
- };