@konstructio/ui 0.1.2-alpha.101 → 0.1.2-alpha.103

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 (221) hide show
  1. package/dist/AlertDialogTrigger-CgcsW_ta.js +109 -0
  2. package/dist/{Breadcrumb-Bmv0vzgt.js → Breadcrumb-Cp3abB2w.js} +1 -1
  3. package/dist/Checkbox-DzAx7n67.js +249 -0
  4. package/dist/{CommandInput-CYYsk_31.js → CommandInput-BnvRMfLI.js} +2 -2
  5. package/dist/{Counter-DWKyr569.js → Counter-CY0xGnVM.js} +2 -2
  6. package/dist/{DayPicker-CwO8Zff5.js → DayPicker-kweJz134.js} +750 -746
  7. package/dist/{DropdownButton-Beel5_gN.js → DropdownButton-DnlwdPmb.js} +1 -1
  8. package/dist/FlagSelectorList-BoYG-_It.js +852 -0
  9. package/dist/{HamburgerTrigger-7a4POUaM.js → HamburgerTrigger-1vOTrm8-.js} +2 -2
  10. package/dist/{Input-DG3snJf_.js → Input-CW0VwW2T.js} +4 -4
  11. package/dist/{Modal-Bcu6LLAp.js → Modal-Bfzggwlr.js} +2 -2
  12. package/dist/{Spinner-BegZ5yd7.js → Spinner-Lw9mZYhg.js} +1 -1
  13. package/dist/Switch-WBRr8uOJ.js +196 -0
  14. package/dist/Toast-ByH-l4XK.js +459 -0
  15. package/dist/{Wrapper-DwxJAkNQ.js → Wrapper-ClJ_Mham.js} +2 -2
  16. package/dist/{Wrapper-DtT29fc5.js → Wrapper-XeeD3av7.js} +1 -1
  17. package/dist/components/Alert/Alert.js +2 -2
  18. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  19. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  20. package/dist/components/AlertDialog/components/index.js +1 -1
  21. package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
  22. package/dist/components/Checkbox/Checkbox.js +1 -1
  23. package/dist/components/Command/Command.js +2 -2
  24. package/dist/components/Command/components/Command.js +1 -1
  25. package/dist/components/Command/components/CommandEmpty.js +1 -1
  26. package/dist/components/Command/components/CommandGroup.js +1 -1
  27. package/dist/components/Command/components/CommandInput.js +1 -1
  28. package/dist/components/Command/components/CommandItem.js +1 -1
  29. package/dist/components/Command/components/CommandList.js +1 -1
  30. package/dist/components/Command/components/CommandSeparator.js +1 -1
  31. package/dist/components/Command/components/DialogContent.js +2 -2
  32. package/dist/components/Command/components/DialogOverlay.js +1 -1
  33. package/dist/components/Command/components/index.js +1 -1
  34. package/dist/components/Counter/Counter.js +1 -1
  35. package/dist/components/DateRangePicker/components/CalendarPanel/components/CalendarMonth/CalendarMonth.js +1 -1
  36. package/dist/components/DateRangePicker/components/DateTimeInputs/components/EndInputFields/EndInputFields.js +1 -1
  37. package/dist/components/DateRangePicker/components/DateTimeInputs/components/StartInputFields/StartInputFields.js +1 -1
  38. package/dist/components/Datepicker/DatePicker.js +2 -3
  39. package/dist/components/Drawer/Drawer.js +2 -2
  40. package/dist/components/DropdownButton/DropdownButton.js +1 -1
  41. package/dist/components/Filter/Filter.js +4 -3
  42. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +23 -24
  43. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +60 -65
  44. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +35 -43
  45. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +40 -45
  46. package/dist/components/Filter/components/DateRangeFilterDropdown/DateRangeFilterDropdown.hook.js +33 -34
  47. package/dist/components/Filter/components/DateRangeFilterDropdown/DateRangeFilterDropdown.js +45 -51
  48. package/dist/components/Filter/components/FilterDropdown/FilterDropdown.js +28 -0
  49. package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.js +56 -61
  50. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.js +33 -34
  51. package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.js +70 -75
  52. package/dist/components/Filter/contexts/filter.provider.js +8 -5
  53. package/dist/components/Filter/utils/index.js +1 -1
  54. package/dist/components/Input/Input.js +1 -1
  55. package/dist/components/LineChart/LineChart.js +1 -1
  56. package/dist/components/Modal/Modal.js +1 -1
  57. package/dist/components/Modal/components/Wrapper/Wrapper.js +1 -1
  58. package/dist/components/Modal/components/index.js +1 -1
  59. package/dist/components/MultiSelectDropdown/MultiSelectDropdown.js +1 -1
  60. package/dist/components/MultiSelectDropdown/components/List/List.js +1 -1
  61. package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +1 -1
  62. package/dist/components/MultiSelectDropdown/components/index.js +1 -1
  63. package/dist/components/PhoneNumberInput/PhoneNumberInput.js +2 -2
  64. package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +1 -1
  65. package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +2 -2
  66. package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +2 -2
  67. package/dist/components/PhoneNumberInput/components/Wrapper.js +1 -1
  68. package/dist/components/PhoneNumberInput/components/index.js +2 -2
  69. package/dist/components/PhoneNumberInput/contexts/index.js +1 -1
  70. package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +1 -1
  71. package/dist/components/PieChart/PieChart.js +1 -1
  72. package/dist/components/Range/Range.js +1 -1
  73. package/dist/components/Select/components/List/List.js +1 -1
  74. package/dist/components/Sidebar/components/HamburgerTrigger/HamburgerTrigger.js +1 -1
  75. package/dist/components/Sidebar/components/NavigationOption/NavigationOption.js +1 -1
  76. package/dist/components/Sidebar/components/Wrapper/Wrapper.js +1 -1
  77. package/dist/components/Sidebar/components/index.js +1 -1
  78. package/dist/components/Slider/Slider.js +1 -1
  79. package/dist/components/Spinner/Spinner.js +1 -1
  80. package/dist/components/Switch/Switch.js +1 -1
  81. package/dist/components/Table/components/Filter.js +1 -1
  82. package/dist/components/Tabs/Tabs.js +1 -1
  83. package/dist/components/Tabs/components/Content.js +1 -1
  84. package/dist/components/Tabs/components/List.js +1 -1
  85. package/dist/components/Tabs/components/Trigger.js +1 -1
  86. package/dist/components/TagSelect/TagSelect.js +1 -1
  87. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +1 -1
  88. package/dist/components/TagSelect/components/index.js +1 -1
  89. package/dist/components/Toast/Toast.js +1 -1
  90. package/dist/components/Tooltip/Tooltip.js +1 -1
  91. package/dist/components/VirtualizedTable/VirtualizedTable.js +87 -87
  92. package/dist/components/VirtualizedTable/components/Actions/Actions.js +19 -19
  93. package/dist/components/VirtualizedTable/components/Body/Body.js +50 -49
  94. package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +67 -21
  95. package/dist/components/VirtualizedTable/components/ExpandableRow/ExpandableRow.js +1 -1
  96. package/dist/components/VirtualizedTable/components/Filter/Filter.js +53 -63
  97. package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +10 -10
  98. package/dist/components/VirtualizedTable/components/Header/Header.js +47 -34
  99. package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +19 -15
  100. package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +10 -10
  101. package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +1 -1
  102. package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +8 -8
  103. package/dist/components/VirtualizedTable/contexts/index.js +1 -1
  104. package/dist/components/VirtualizedTable/contexts/table.context.js +1 -0
  105. package/dist/components/VirtualizedTable/contexts/table.provider.js +1 -1
  106. package/dist/components/index.js +10 -10
  107. package/dist/{components-CYt24H4n.js → components-BIHlj4yH.js} +1 -1
  108. package/dist/{debounce-KoeGNmnW.js → debounce-C5Ycjilj.js} +14 -14
  109. package/dist/dist-2bGlmy8N2.js +165 -0
  110. package/dist/dist-BiJrNvNo.js +193 -0
  111. package/dist/dist-BuFiu480.js +13 -0
  112. package/dist/dist-C2aTw0m62.js +1320 -0
  113. package/dist/{dist-DvoMuWKO2.js → dist-C2s4VX-42.js} +4 -4
  114. package/dist/dist-CT6d9xe7.js +441 -0
  115. package/dist/dist-CTvBzxW8.js +31 -0
  116. package/dist/dist-CVDFmWf2.js +358 -0
  117. package/dist/dist-D4FePjTS.js +194 -0
  118. package/dist/dist-DISvWx7U.js +99 -0
  119. package/dist/dist-Db6UeFo4.js +291 -0
  120. package/dist/{dist-DGO9opgu.js → dist-Dse3gSmZ.js} +49 -49
  121. package/dist/dist-j7FOUrFU.js +206 -0
  122. package/dist/{dist-C8NWUTUh.js → dist-l-aDnQZC.js} +1 -1
  123. package/dist/es2015-BWf6xQHm.js +222 -0
  124. package/dist/index.js +10 -10
  125. package/dist/{isObject-1ZmdWuhC.js → isObject-BeFFiVJK.js} +8 -8
  126. package/dist/lib/components/Alert/Alert.types.d.ts +1 -1
  127. package/dist/lib/components/AlertDialog/AlertDialog.types.d.ts +1 -1
  128. package/dist/lib/components/AlertDialog/components/AlertDialogTrigger.types.d.ts +2 -2
  129. package/dist/lib/components/Autocomplete/Autocomplete.types.d.ts +1 -1
  130. package/dist/lib/components/Breadcrumb/Breadcrumb.types.d.ts +1 -1
  131. package/dist/lib/components/Breadcrumb/components/BackButton/BackButton.types.d.ts +1 -1
  132. package/dist/lib/components/Breadcrumb/components/Item/Item.types.d.ts +1 -1
  133. package/dist/lib/components/Button/Button.types.d.ts +1 -1
  134. package/dist/lib/components/ButtonGroup/ButtonGroup.types.d.ts +1 -1
  135. package/dist/lib/components/Card/Card.types.d.ts +1 -1
  136. package/dist/lib/components/Checkbox/Checkbox.types.d.ts +1 -1
  137. package/dist/lib/components/Command/Command.types.d.ts +1 -1
  138. package/dist/lib/components/Counter/Counter.types.d.ts +1 -1
  139. package/dist/lib/components/DateRangePicker/DateRangePicker.types.d.ts +1 -1
  140. package/dist/lib/components/Drawer/Drawer.types.d.ts +1 -1
  141. package/dist/lib/components/Filter/Filter.types.d.ts +1 -1
  142. package/dist/lib/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.d.ts +2 -3
  143. package/dist/lib/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.d.ts +1 -2
  144. package/dist/lib/components/Filter/components/DateRangeFilterDropdown/DateRangeFilterDropdown.hook.d.ts +2 -3
  145. package/dist/lib/components/Filter/components/DateRangeFilterDropdown/DateRangeFilterDropdown.types.d.ts +1 -1
  146. package/dist/lib/components/Filter/components/FilterDropdown/FilterDropdown.d.ts +3 -0
  147. package/dist/lib/components/Filter/components/FilterDropdown/FilterDropdown.types.d.ts +9 -0
  148. package/dist/lib/components/Filter/components/ResetButton/ResetButton.types.d.ts +1 -1
  149. package/dist/lib/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.d.ts +1 -2
  150. package/dist/lib/components/Filter/contexts/filter.context.d.ts +1 -0
  151. package/dist/lib/components/ImageUpload/ImageUpload.types.d.ts +1 -1
  152. package/dist/lib/components/Input/Input.types.d.ts +1 -1
  153. package/dist/lib/components/LineChart/LineChart.types.d.ts +1 -1
  154. package/dist/lib/components/Loading/Loading.types.d.ts +1 -1
  155. package/dist/lib/components/Modal/Modal.types.d.ts +1 -1
  156. package/dist/lib/components/Modal/components/Wrapper/Wrapper.types.d.ts +1 -1
  157. package/dist/lib/components/MultiSelectDropdown/components/Item/Item.types.d.ts +1 -1
  158. package/dist/lib/components/MultiSelectDropdown/components/List/List.types.d.ts +1 -1
  159. package/dist/lib/components/MultiSelectDropdown/components/Wrapper/Wrapper.types.d.ts +1 -1
  160. package/dist/lib/components/ProgressBar/ProgressBar.types.d.ts +1 -1
  161. package/dist/lib/components/Radio/Radio.types.d.ts +1 -1
  162. package/dist/lib/components/RadioCard/RadioCard.types.d.ts +1 -1
  163. package/dist/lib/components/RadioCardGroup/RadioCardGroup.types.d.ts +1 -1
  164. package/dist/lib/components/RadioGroup/RadioGroup.types.d.ts +1 -1
  165. package/dist/lib/components/Range/Range.types.d.ts +1 -1
  166. package/dist/lib/components/Select/Select.types.d.ts +1 -1
  167. package/dist/lib/components/Sidebar/Sidebar.types.d.ts +2 -2
  168. package/dist/lib/components/Sidebar/components/Label/Label.types.d.ts +1 -1
  169. package/dist/lib/components/Slider/Slider.types.d.ts +1 -1
  170. package/dist/lib/components/Spinner/Spinner.types.d.ts +2 -2
  171. package/dist/lib/components/Stepper/Stepper.types.d.ts +1 -1
  172. package/dist/lib/components/Stepper/components/StepItem/StepItem.types.d.ts +1 -1
  173. package/dist/lib/components/Switch/Switch.types.d.ts +1 -1
  174. package/dist/lib/components/Table/Table.types.d.ts +1 -1
  175. package/dist/lib/components/Tabs/Tabs.types.d.ts +1 -1
  176. package/dist/lib/components/TagSelect/TagSelect.types.d.ts +1 -1
  177. package/dist/lib/components/TagSelect/components/Item/Item.types.d.ts +2 -2
  178. package/dist/lib/components/TagSelect/components/List/List.types.d.ts +1 -1
  179. package/dist/lib/components/TagSelect/components/Wrapper/Wrapper.types.d.ts +1 -1
  180. package/dist/lib/components/TagSelect/contexts/TagSelect.types.d.ts +1 -1
  181. package/dist/lib/components/TextArea/TextArea.types.d.ts +1 -1
  182. package/dist/lib/components/Toast/Toast.types.d.ts +1 -1
  183. package/dist/lib/components/Typography/Typography.types.d.ts +1 -1
  184. package/dist/lib/components/VirtualizedTable/VirtualizedTable.types.d.ts +27 -3
  185. package/dist/lib/components/VirtualizedTable/components/Body/Body.d.ts +1 -1
  186. package/dist/lib/components/VirtualizedTable/components/Body/Body.types.d.ts +1 -0
  187. package/dist/lib/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.types.d.ts +2 -0
  188. package/dist/lib/components/VirtualizedTable/components/Filter/Filter.types.d.ts +1 -1
  189. package/dist/lib/components/VirtualizedTable/components/Header/Header.d.ts +1 -1
  190. package/dist/lib/components/VirtualizedTable/components/Header/Header.types.d.ts +1 -0
  191. package/dist/lib/components/VirtualizedTable/components/Pagination/Pagination.types.d.ts +2 -0
  192. package/dist/lib/components/VirtualizedTable/components/TruncateText/TruncateText.types.d.ts +1 -1
  193. package/dist/lib/components/VirtualizedTable/contexts/table.context.d.ts +2 -0
  194. package/dist/lib/components/VirtualizedTable/contexts/table.provider.d.ts +1 -1
  195. package/dist/lib/components/VirtualizedTable/contexts/table.types.d.ts +1 -0
  196. package/dist/lib/contexts/theme.context.d.ts +1 -1
  197. package/dist/lib/contexts/theme.hook.d.ts +1 -1
  198. package/dist/package.json +34 -33
  199. package/dist/{phone-number.provider-CJJOFYk-.js → phone-number.provider-BxQCTxp8.js} +457 -457
  200. package/dist/{prop-types-CaJpPVsa.js → prop-types-CfEYxTbR.js} +52 -52
  201. package/dist/styles.css +1 -1
  202. package/dist/{table.provider-9uUt5a-s.js → table.provider-2sAkE7z_.js} +395 -368
  203. package/dist/{utils-B6A9pnrH.js → utils-B-BTGYA5.js} +193 -193
  204. package/dist/{x-CESTrenk.js → x-BI9jmc7e.js} +1 -1
  205. package/package.json +34 -33
  206. package/dist/AlertDialogTrigger-HhbFOOUE.js +0 -124
  207. package/dist/Checkbox-B1rTwzR3.js +0 -240
  208. package/dist/FlagSelectorList-BARhzfj2.js +0 -848
  209. package/dist/Switch-1RGhhTtg.js +0 -178
  210. package/dist/Toast-CS-igZor.js +0 -467
  211. package/dist/dist-7edduNXi.js +0 -398
  212. package/dist/dist-BkYHh2kH.js +0 -408
  213. package/dist/dist-C6Cif8-U.js +0 -28
  214. package/dist/dist-CeuUxVmT.js +0 -13
  215. package/dist/dist-CfYOvauX.js +0 -125
  216. package/dist/dist-CktbIsHq.js +0 -264
  217. package/dist/dist-DGqWMRtc.js +0 -183
  218. package/dist/dist-DdFwUrO22.js +0 -11
  219. package/dist/dist-DnGj9MTf.js +0 -1692
  220. package/dist/dist-eAwtFCCA.js +0 -87
  221. /package/dist/{dist-AihTpWdF2.js → dist-AihTpWdF.js} +0 -0
@@ -0,0 +1,852 @@
1
+ import { t as j } from "./utils-Cx-WzRZF.js";
2
+ import { Typography as L } from "./components/Typography/Typography.js";
3
+ import { usePhoneNumberContext as K } from "./components/PhoneNumberInput/contexts/phone-number.hook.js";
4
+ import { TruncateText as $ } from "./components/PhoneNumberInput/components/TruncateText/TruncateText.js";
5
+ import * as M from "react";
6
+ import { useEffect as B, useMemo as H, useRef as J } from "react";
7
+ import { flushSync as q } from "react-dom";
8
+ import { jsx as x, jsxs as U } from "react/jsx-runtime";
9
+ function G(l, t, e) {
10
+ const s = new Array(l);
11
+ return new Proxy(s, { get(i, n, o) {
12
+ if (typeof n == "string") {
13
+ const c = n.charCodeAt(0);
14
+ if (c >= 48 && c <= 57) {
15
+ const r = +n;
16
+ if (Number.isInteger(r) && r >= 0 && r < l) {
17
+ let h = i[r];
18
+ if (!h) {
19
+ const u = t[r * 2];
20
+ h = i[r] = {
21
+ index: r,
22
+ key: e(r),
23
+ start: u,
24
+ size: t[r * 2 + 1],
25
+ end: u + t[r * 2 + 1],
26
+ lane: 0
27
+ };
28
+ }
29
+ return h;
30
+ }
31
+ }
32
+ if (n === "length") return l;
33
+ }
34
+ return Reflect.get(i, n, o);
35
+ } });
36
+ }
37
+ function I(l, t, e) {
38
+ let s = e.initialDeps ?? [], i, n = !0;
39
+ function o() {
40
+ var c;
41
+ const r = process.env.NODE_ENV !== "production" && !!e.key && !!((c = e.debug) != null && c.call(e));
42
+ let h = 0;
43
+ r && (h = Date.now());
44
+ const u = l();
45
+ if (!(u.length !== s.length || u.some((f, g) => s[g] !== f))) return i;
46
+ s = u;
47
+ let a = 0;
48
+ if (r && (a = Date.now()), i = t(...u), r) {
49
+ const f = Math.round((Date.now() - h) * 100) / 100, g = Math.round((Date.now() - a) * 100) / 100, p = g / 16, v = (d, m) => {
50
+ for (d = String(d); d.length < m; ) d = " " + d;
51
+ return d;
52
+ };
53
+ console.info(`%c⏱ ${v(g, 5)} /${v(f, 5)} ms`, `
54
+ font-size: .6rem;
55
+ font-weight: bold;
56
+ color: hsl(${Math.max(0, Math.min(120 - 120 * p, 120))}deg 100% 31%);`, e?.key);
57
+ }
58
+ return e?.onChange && !(n && e.skipInitialOnChange) && e.onChange(i), n = !1, i;
59
+ }
60
+ return o.updateDeps = (c) => {
61
+ s = c;
62
+ }, o;
63
+ }
64
+ function V(l, t) {
65
+ if (l === void 0) throw new Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
66
+ return l;
67
+ }
68
+ var Q = (l, t) => Math.abs(l - t) < 1.01, X = (l, t, e) => {
69
+ let s;
70
+ return function(...i) {
71
+ l.clearTimeout(s), s = l.setTimeout(() => t.apply(this, i), e);
72
+ };
73
+ }, T, D = () => {
74
+ if (T !== void 0) return T;
75
+ if (typeof navigator > "u") return T = !1;
76
+ if (/iP(hone|od|ad)/.test(navigator.userAgent)) return T = !0;
77
+ const l = navigator.maxTouchPoints;
78
+ return T = navigator.platform === "MacIntel" && l !== void 0 && l > 0;
79
+ }, W = (l) => {
80
+ const { offsetWidth: t, offsetHeight: e } = l;
81
+ return {
82
+ width: t,
83
+ height: e
84
+ };
85
+ }, Y = (l) => l, Z = (l) => {
86
+ const t = Math.max(l.startIndex - l.overscan, 0), e = Math.min(l.endIndex + l.overscan, l.count - 1) - t + 1, s = new Array(e);
87
+ for (let i = 0; i < e; i++) s[i] = t + i;
88
+ return s;
89
+ }, tt = (l, t) => {
90
+ const e = l.scrollElement;
91
+ if (!e) return;
92
+ const s = l.targetWindow;
93
+ if (!s) return;
94
+ const i = (o) => {
95
+ const { width: c, height: r } = o;
96
+ t({
97
+ width: Math.round(c),
98
+ height: Math.round(r)
99
+ });
100
+ };
101
+ if (i(W(e)), !s.ResizeObserver) return () => {
102
+ };
103
+ const n = new s.ResizeObserver((o) => {
104
+ const c = () => {
105
+ const r = o[0];
106
+ if (r?.borderBoxSize) {
107
+ const h = r.borderBoxSize[0];
108
+ if (h) {
109
+ i({
110
+ width: h.inlineSize,
111
+ height: h.blockSize
112
+ });
113
+ return;
114
+ }
115
+ }
116
+ i(W(e));
117
+ };
118
+ l.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(c) : c();
119
+ });
120
+ return n.observe(e, { box: "border-box" }), () => {
121
+ n.unobserve(e);
122
+ };
123
+ }, C = { passive: !0 }, et = typeof window > "u" ? !0 : "onscrollend" in window, st = (l, t, e) => {
124
+ const s = l.scrollElement;
125
+ if (!s) return;
126
+ const i = l.targetWindow;
127
+ if (!i) return;
128
+ const n = l.options.useScrollendEvent && et;
129
+ let o = 0;
130
+ const c = n ? null : X(i, () => t(o, !1), l.options.isScrollingResetDelay), r = (a) => () => {
131
+ o = e(s), c?.(), t(o, a);
132
+ }, h = r(!0), u = r(!1);
133
+ return s.addEventListener("scroll", h, C), n && s.addEventListener("scrollend", u, C), () => {
134
+ s.removeEventListener("scroll", h), n && s.removeEventListener("scrollend", u);
135
+ };
136
+ }, it = (l, t) => st(l, t, (e) => {
137
+ const { horizontal: s, isRtl: i } = l.options;
138
+ return s ? e.scrollLeft * (i && -1 || 1) : e.scrollTop;
139
+ }), nt = (l, t, e) => {
140
+ if (e.options.useCachedMeasurements) {
141
+ const s = e.indexFromElement(l), i = e.options.getItemKey(s);
142
+ return e.itemSizeCache.get(i) ?? e.options.estimateSize(s);
143
+ }
144
+ if (t?.borderBoxSize) {
145
+ const s = t.borderBoxSize[0];
146
+ if (s) return Math.round(s[e.options.horizontal ? "inlineSize" : "blockSize"]);
147
+ }
148
+ if (!t) {
149
+ const s = e.indexFromElement(l), i = e.options.getItemKey(s), n = e.itemSizeCache.get(i);
150
+ if (n !== void 0) return n;
151
+ }
152
+ return l[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
153
+ }, ot = (l, { adjustments: t = 0, behavior: e }, s) => {
154
+ var i, n;
155
+ (n = (i = s.scrollElement) == null ? void 0 : i.scrollTo) == null || n.call(i, {
156
+ [s.options.horizontal ? "left" : "top"]: l + t,
157
+ behavior: e
158
+ });
159
+ }, lt = ot, rt = class {
160
+ constructor(l) {
161
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._flatMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._intendedScrollOffset = null, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
162
+ var t, e, s;
163
+ return ((s = (e = (t = this.targetWindow) == null ? void 0 : t.performance) == null ? void 0 : e.now) == null ? void 0 : s.call(e)) ?? Date.now();
164
+ }, this.observer = /* @__PURE__ */ (() => {
165
+ let t = null;
166
+ const e = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((s) => {
167
+ s.forEach((i) => {
168
+ const n = () => {
169
+ const o = i.target, c = this.indexFromElement(o);
170
+ if (!o.isConnected) {
171
+ this.observer.unobserve(o);
172
+ for (const [r, h] of this.elementsCache) if (h === o) {
173
+ this.elementsCache.delete(r);
174
+ break;
175
+ }
176
+ return;
177
+ }
178
+ this.shouldMeasureDuringScroll(c) && this.resizeItem(c, this.options.measureElement(o, i, this));
179
+ };
180
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(n) : n();
181
+ });
182
+ }));
183
+ return {
184
+ disconnect: () => {
185
+ var s;
186
+ (s = e()) == null || s.disconnect(), t = null;
187
+ },
188
+ observe: (s) => {
189
+ var i;
190
+ return (i = e()) == null ? void 0 : i.observe(s, { box: "border-box" });
191
+ },
192
+ unobserve: (s) => {
193
+ var i;
194
+ return (i = e()) == null ? void 0 : i.unobserve(s);
195
+ }
196
+ };
197
+ })(), this.range = null, this.setOptions = (t) => {
198
+ var e, s;
199
+ const i = {
200
+ debug: !1,
201
+ initialOffset: 0,
202
+ overscan: 1,
203
+ paddingStart: 0,
204
+ paddingEnd: 0,
205
+ scrollPaddingStart: 0,
206
+ scrollPaddingEnd: 0,
207
+ horizontal: !1,
208
+ getItemKey: Y,
209
+ rangeExtractor: Z,
210
+ onChange: () => {
211
+ },
212
+ measureElement: nt,
213
+ initialRect: {
214
+ width: 0,
215
+ height: 0
216
+ },
217
+ scrollMargin: 0,
218
+ gap: 0,
219
+ indexAttribute: "data-index",
220
+ initialMeasurementsCache: [],
221
+ lanes: 1,
222
+ anchorTo: "start",
223
+ followOnAppend: !1,
224
+ scrollEndThreshold: 1,
225
+ isScrollingResetDelay: 150,
226
+ enabled: !0,
227
+ isRtl: !1,
228
+ useScrollendEvent: !1,
229
+ useAnimationFrameWithResizeObserver: !1,
230
+ laneAssignmentMode: "estimate",
231
+ useCachedMeasurements: !1
232
+ };
233
+ for (const a in t) {
234
+ const f = t[a];
235
+ f !== void 0 && (i[a] = f);
236
+ }
237
+ const n = this.options;
238
+ let o = null, c = null, r = !1;
239
+ if (n !== void 0 && n.enabled && i.enabled && i.anchorTo === "end" && this.scrollElement !== null) {
240
+ const a = n.count, f = i.count, g = this.getMeasurements(), p = a > 0 ? ((e = g[0]) == null ? void 0 : e.key) ?? n.getItemKey(0) : null, v = a > 0 ? ((s = g[a - 1]) == null ? void 0 : s.key) ?? n.getItemKey(a - 1) : null;
241
+ if (f !== a || a > 0 && f > 0 && (i.getItemKey(0) !== p || i.getItemKey(f - 1) !== v)) {
242
+ r = !0;
243
+ const d = a > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? g[0] : null;
244
+ d && (o = [d.key, this.getScrollOffset() - d.start]);
245
+ const m = i.followOnAppend === !0 ? "auto" : i.followOnAppend || null;
246
+ m && f > a && this.isAtEnd(n.scrollEndThreshold) && (a === 0 || i.getItemKey(f - 1) !== v) && (c = m);
247
+ }
248
+ }
249
+ this.options = i, r && (this.pendingMin = 0, this.itemSizeCacheVersion++);
250
+ let h = !1, u = 0;
251
+ if (o && this.scrollOffset !== null) {
252
+ const [a, f] = o, g = this.getMeasurements(), { count: p, getItemKey: v } = this.options;
253
+ let d = 0;
254
+ for (; d < p && v(d) !== a; ) d++;
255
+ if (d < p) {
256
+ const m = g[d];
257
+ if (m) {
258
+ const E = Math.max(0, m.start + f);
259
+ E !== this.scrollOffset && (u = E - this.scrollOffset, this.scrollOffset = E, h = !0);
260
+ }
261
+ }
262
+ }
263
+ (h || c) && (this.pendingScrollAnchor = [
264
+ h ? o[0] : null,
265
+ h ? o[1] : 0,
266
+ c,
267
+ u
268
+ ]);
269
+ }, this.notify = (t) => {
270
+ var e, s;
271
+ (s = (e = this.options).onChange) == null || s.call(e, this, t);
272
+ }, this.maybeNotify = I(() => (this.calculateRange(), [
273
+ this.isScrolling,
274
+ this.range ? this.range.startIndex : null,
275
+ this.range ? this.range.endIndex : null
276
+ ]), (t) => {
277
+ this.notify(t);
278
+ }, {
279
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
280
+ debug: () => this.options.debug,
281
+ initialDeps: [
282
+ this.isScrolling,
283
+ this.range ? this.range.startIndex : null,
284
+ this.range ? this.range.endIndex : null
285
+ ]
286
+ }), this.cleanup = () => {
287
+ this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this.scrollElement = null, this.targetWindow = null;
288
+ }, this._didMount = () => () => {
289
+ this.cleanup();
290
+ }, this._willUpdate = () => {
291
+ var t;
292
+ const e = this.options.enabled ? this.options.getScrollElement() : null;
293
+ if (this.scrollElement !== e) {
294
+ if (this.cleanup(), !e) {
295
+ this.maybeNotify();
296
+ return;
297
+ }
298
+ if (this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this.elementsCache.forEach((i) => {
299
+ this.observer.observe(i);
300
+ }), this.unsubs.push(this.options.observeElementRect(this, (i) => {
301
+ this.scrollRect = i, this.maybeNotify();
302
+ })), this.unsubs.push(this.options.observeElementOffset(this, (i, n) => {
303
+ if (n && this._intendedScrollOffset === null && i === this.scrollOffset) return;
304
+ this._intendedScrollOffset !== null && Math.abs(i - this._intendedScrollOffset) < 1.5 && (i = this._intendedScrollOffset), this._intendedScrollOffset = null, this.scrollAdjustments = 0;
305
+ const o = this.getScrollOffset();
306
+ this.scrollDirection = n ? o === i ? this.scrollDirection : o < i ? "forward" : "backward" : null, this.scrollOffset = i, this.isScrolling = n, this._flushIosDeferredIfReady(), this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
307
+ })), "addEventListener" in this.scrollElement) {
308
+ const i = this.scrollElement, n = () => {
309
+ this._iosTouching = !0, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
310
+ }, o = () => {
311
+ this._iosTouching = !1, !(!D() || this.targetWindow == null) && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => {
312
+ this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._flushIosDeferredIfReady();
313
+ }, 150));
314
+ };
315
+ i.addEventListener("touchstart", n, C), i.addEventListener("touchend", o, C), this.unsubs.push(() => {
316
+ i.removeEventListener("touchstart", n), i.removeEventListener("touchend", o), this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null);
317
+ });
318
+ }
319
+ this._scrollToOffset(this.getScrollOffset(), {
320
+ adjustments: void 0,
321
+ behavior: void 0
322
+ });
323
+ }
324
+ const s = this.pendingScrollAnchor;
325
+ if (this.pendingScrollAnchor = null, s && this.scrollElement && this.options.enabled) {
326
+ const [i, n, o, c] = s;
327
+ i !== null && !o && (D() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? c !== 0 && (this._iosDeferredAdjustment += c) : this._scrollToOffset(this.getScrollOffset(), {
328
+ adjustments: void 0,
329
+ behavior: void 0
330
+ })), o && this.scrollToEnd({ behavior: o });
331
+ }
332
+ }, this._flushIosDeferredIfReady = () => {
333
+ if (this._iosDeferredAdjustment === 0 || this.isScrolling || this._iosTouching || this._iosJustTouchEnded) return;
334
+ const t = this.getScrollOffset(), e = this.getMaxScrollOffset();
335
+ if (t < 0 || t > e) return;
336
+ if (this._iosDeferredAdjustment < 0 && t >= e - 1) {
337
+ this._iosDeferredAdjustment = 0;
338
+ return;
339
+ }
340
+ const s = this._iosDeferredAdjustment;
341
+ this._iosDeferredAdjustment = 0, this._scrollToOffset(t, {
342
+ adjustments: this.scrollAdjustments += s,
343
+ behavior: void 0
344
+ });
345
+ }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getMeasurementOptions = I(() => [
346
+ this.options.count,
347
+ this.options.paddingStart,
348
+ this.options.scrollMargin,
349
+ this.options.getItemKey,
350
+ this.options.enabled,
351
+ this.options.lanes,
352
+ this.options.laneAssignmentMode,
353
+ this.options.gap
354
+ ], (t, e, s, i, n, o, c, r) => (this.prevLanes !== void 0 && this.prevLanes !== o && (this.lanesChangedFlag = !0), this.prevLanes = o, this.pendingMin = null, {
355
+ count: t,
356
+ paddingStart: e,
357
+ scrollMargin: s,
358
+ getItemKey: i,
359
+ enabled: n,
360
+ lanes: o,
361
+ laneAssignmentMode: c,
362
+ gap: r
363
+ }), { key: !1 }), this.getMeasurements = I(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: t, paddingStart: e, scrollMargin: s, getItemKey: i, enabled: n, lanes: o, laneAssignmentMode: c, gap: r }, h) => {
364
+ const u = this.itemSizeCache;
365
+ if (!n)
366
+ return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
367
+ if (this.laneAssignments.size > t)
368
+ for (const d of this.laneAssignments.keys()) d >= t && this.laneAssignments.delete(d);
369
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((d) => {
370
+ this.itemSizeCache.set(d.key, d.size);
371
+ }));
372
+ const a = this.lanesSettling ? 0 : this.pendingMin ?? 0;
373
+ if (this.pendingMin = null, this.lanesSettling && this.measurementsCache.length === t && (this.lanesSettling = !1), o === 1) {
374
+ const d = t * 2;
375
+ let m = this._flatMeasurements;
376
+ if (!m || m.length < d) {
377
+ const b = new Float64Array(d);
378
+ m && a > 0 && b.set(m.subarray(0, a * 2)), m = b, this._flatMeasurements = m;
379
+ }
380
+ let E;
381
+ if (a === 0) E = e + s;
382
+ else {
383
+ const b = a - 1;
384
+ E = m[b * 2] + m[b * 2 + 1] + r;
385
+ }
386
+ for (let b = a; b < t; b++) {
387
+ const A = i(b), w = u.get(A), z = typeof w == "number" ? w : this.options.estimateSize(b);
388
+ m[b * 2] = E, m[b * 2 + 1] = z, E += z + r;
389
+ }
390
+ const S = G(t, m, i);
391
+ return this.measurementsCache = S, S;
392
+ }
393
+ const f = this.measurementsCache.slice(0, a), g = new Array(o).fill(void 0), p = new Float64Array(o);
394
+ let v = 0;
395
+ for (let d = 0; d < a; d++) {
396
+ const m = f[d];
397
+ m && (g[m.lane] === void 0 && v++, g[m.lane] = d, p[m.lane] = m.end);
398
+ }
399
+ for (let d = a; d < t; d++) {
400
+ const m = i(d), E = this.laneAssignments.get(d);
401
+ let S, b;
402
+ const A = c === "estimate" || u.has(m);
403
+ if (E !== void 0 && this.options.lanes > 1) {
404
+ S = E;
405
+ const _ = g[S], y = _ !== void 0 ? f[_] : void 0;
406
+ b = y ? y.end + r : e + s;
407
+ } else if (v === o) {
408
+ let _ = 0, y = p[0], N = g[0];
409
+ for (let O = 1; O < o; O++) {
410
+ const R = p[O];
411
+ (R < y || R === y && g[O] < N) && (_ = O, y = R, N = g[O]);
412
+ }
413
+ S = _, b = y + r, A && this.laneAssignments.set(d, S);
414
+ } else
415
+ S = d % this.options.lanes, b = e + s, A && this.laneAssignments.set(d, S);
416
+ const w = u.get(m), z = typeof w == "number" ? w : this.options.estimateSize(d), k = b + z;
417
+ f[d] = {
418
+ index: d,
419
+ start: b,
420
+ size: z,
421
+ end: k,
422
+ key: m,
423
+ lane: S
424
+ }, g[S] === void 0 && v++, g[S] = d, p[S] = k;
425
+ }
426
+ return this.measurementsCache = f, f;
427
+ }, {
428
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
429
+ debug: () => this.options.debug
430
+ }), this.calculateRange = I(() => [
431
+ this.getMeasurements(),
432
+ this.getSize(),
433
+ this.getScrollOffset(),
434
+ this.options.lanes
435
+ ], (t, e, s, i) => t.length === 0 || e === 0 ? (this.range = null, null) : (this.range = ht(t, e, s, i, i === 1 && this._flatMeasurements != null ? this._flatMeasurements : null), this.range), {
436
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
437
+ debug: () => this.options.debug
438
+ }), this.getVirtualIndexes = I(() => {
439
+ let t = null, e = null;
440
+ const s = this.calculateRange();
441
+ return s && (t = s.startIndex, e = s.endIndex), this.maybeNotify.updateDeps([
442
+ this.isScrolling,
443
+ t,
444
+ e
445
+ ]), [
446
+ this.options.rangeExtractor,
447
+ this.options.overscan,
448
+ this.options.count,
449
+ t,
450
+ e
451
+ ];
452
+ }, (t, e, s, i, n) => i === null || n === null ? [] : t({
453
+ startIndex: i,
454
+ endIndex: n,
455
+ overscan: e,
456
+ count: s
457
+ }), {
458
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
459
+ debug: () => this.options.debug
460
+ }), this.indexFromElement = (t) => {
461
+ const e = this.options.indexAttribute, s = t.getAttribute(e);
462
+ return s ? parseInt(s, 10) : (console.warn(`Missing attribute name '${e}={index}' on measured element.`), -1);
463
+ }, this.shouldMeasureDuringScroll = (t) => {
464
+ var e;
465
+ if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
466
+ const s = this.scrollState.index ?? ((e = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : e.index);
467
+ if (s !== void 0 && this.range) {
468
+ const i = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), n = Math.max(0, s - i), o = Math.min(this.options.count - 1, s + i);
469
+ return t >= n && t <= o;
470
+ }
471
+ return !0;
472
+ }, this.measureElement = (t) => {
473
+ if (!t) {
474
+ this.elementsCache.forEach((n, o) => {
475
+ n.isConnected || (this.observer.unobserve(n), this.elementsCache.delete(o));
476
+ });
477
+ return;
478
+ }
479
+ const e = this.indexFromElement(t), s = this.options.getItemKey(e), i = this.elementsCache.get(s);
480
+ i !== t && (i && this.observer.unobserve(i), this.observer.observe(t), this.elementsCache.set(s, t)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(e) && this.resizeItem(e, this.options.measureElement(t, void 0, this));
481
+ }, this.resizeItem = (t, e) => {
482
+ var s, i;
483
+ if (t < 0 || t >= this.options.count) return;
484
+ let n, o, c;
485
+ const r = this._flatMeasurements;
486
+ if (this.options.lanes === 1 && r !== null)
487
+ c = this.options.getItemKey(t), o = r[t * 2], n = r[t * 2 + 1];
488
+ else {
489
+ const u = this.measurementsCache[t];
490
+ if (!u) return;
491
+ c = u.key, o = u.start, n = u.size;
492
+ }
493
+ const h = e - (this.itemSizeCache.get(c) ?? n);
494
+ if (h !== 0) {
495
+ const u = this.options.anchorTo === "end" && ((s = this.scrollState) == null ? void 0 : s.behavior) !== "smooth" && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, a = u ? this.getTotalSize() : 0, f = ((i = this.scrollState) == null ? void 0 : i.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t] ?? {
496
+ index: t,
497
+ key: c,
498
+ start: o,
499
+ size: n,
500
+ end: o + n,
501
+ lane: 0
502
+ }, h, this) : o < this.getScrollOffset() + this.scrollAdjustments && (!this.itemSizeCache.has(c) || this.scrollDirection !== "backward"));
503
+ (this.pendingMin === null || t < this.pendingMin) && (this.pendingMin = t), this.itemSizeCache.set(c, e), this.itemSizeCacheVersion++, u ? this.applyScrollAdjustment(this.getTotalSize() - a) : f && this.applyScrollAdjustment(h), this.notify(!1);
504
+ }
505
+ }, this.getVirtualItems = I(() => [this.getVirtualIndexes(), this.getMeasurements()], (t, e) => {
506
+ const s = [];
507
+ for (let i = 0, n = t.length; i < n; i++) {
508
+ const o = e[t[i]];
509
+ s.push(o);
510
+ }
511
+ return s;
512
+ }, {
513
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
514
+ debug: () => this.options.debug
515
+ }), this.getVirtualItemForOffset = (t) => {
516
+ const e = this.getMeasurements();
517
+ if (e.length === 0) return;
518
+ const s = this._flatMeasurements, i = this.options.lanes === 1 && s != null;
519
+ return V(e[P(0, e.length - 1, i ? (n) => s[n * 2] : (n) => V(e[n]).start, t)]);
520
+ }, this.getMaxScrollOffset = () => {
521
+ if (!this.scrollElement) return 0;
522
+ if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
523
+ {
524
+ const t = this.scrollElement.document.documentElement;
525
+ return this.options.horizontal ? t.scrollWidth - this.scrollElement.innerWidth : t.scrollHeight - this.scrollElement.innerHeight;
526
+ }
527
+ }, this.getVirtualDistanceFromEnd = () => Math.max(this.getTotalSize() - this.getSize() - this.getScrollOffset(), 0), this.getDistanceFromEnd = () => Math.max(this.getMaxScrollOffset() - this.getScrollOffset(), 0), this.isAtEnd = (t = this.options.scrollEndThreshold) => this.getDistanceFromEnd() <= t, this.getOffsetForAlignment = (t, e, s = 0) => {
528
+ if (!this.scrollElement) return 0;
529
+ const i = this.getSize(), n = this.getScrollOffset();
530
+ e === "auto" && (e = t >= n + i ? "end" : "start"), e === "center" ? t += (s - i) / 2 : e === "end" && (t -= i);
531
+ const o = this.getMaxScrollOffset();
532
+ return Math.max(Math.min(o, t), 0);
533
+ }, this.getOffsetForIndex = (t, e = "auto") => {
534
+ t = Math.max(0, Math.min(t, this.options.count - 1));
535
+ const s = this.getSize(), i = this.getScrollOffset(), n = this.measurementsCache[t];
536
+ if (!n) return;
537
+ if (e === "auto") if (n.end >= i + s - this.options.scrollPaddingEnd) e = "end";
538
+ else if (n.start <= i + this.options.scrollPaddingStart) e = "start";
539
+ else return [i, e];
540
+ if (e === "end" && t === this.options.count - 1) return [this.getMaxScrollOffset(), e];
541
+ const o = e === "end" ? n.end + this.options.scrollPaddingEnd : n.start - this.options.scrollPaddingStart;
542
+ return [this.getOffsetForAlignment(o, e, n.size), e];
543
+ }, this.scrollToOffset = (t, { align: e = "start", behavior: s = "auto" } = {}) => {
544
+ this._iosDeferredAdjustment = 0;
545
+ const i = this.getOffsetForAlignment(t, e), n = this.now();
546
+ this.scrollState = {
547
+ index: null,
548
+ align: e,
549
+ behavior: s,
550
+ startedAt: n,
551
+ lastTargetOffset: i,
552
+ stableFrames: 0
553
+ }, this._scrollToOffset(i, {
554
+ adjustments: void 0,
555
+ behavior: s
556
+ }), this.scheduleScrollReconcile();
557
+ }, this.scrollToIndex = (t, { align: e = "auto", behavior: s = "auto" } = {}) => {
558
+ this._iosDeferredAdjustment = 0, t = Math.max(0, Math.min(t, this.options.count - 1));
559
+ const i = this.getOffsetForIndex(t, e);
560
+ if (!i) return;
561
+ const [n, o] = i, c = this.now();
562
+ this.scrollState = {
563
+ index: t,
564
+ align: o,
565
+ behavior: s,
566
+ startedAt: c,
567
+ lastTargetOffset: n,
568
+ stableFrames: 0
569
+ }, this._scrollToOffset(n, {
570
+ adjustments: void 0,
571
+ behavior: s
572
+ }), this.scheduleScrollReconcile();
573
+ }, this.scrollBy = (t, { behavior: e = "auto" } = {}) => {
574
+ const s = this.getScrollOffset() + t, i = this.now();
575
+ this.scrollState = {
576
+ index: null,
577
+ align: "start",
578
+ behavior: e,
579
+ startedAt: i,
580
+ lastTargetOffset: s,
581
+ stableFrames: 0
582
+ }, this._scrollToOffset(s, {
583
+ adjustments: void 0,
584
+ behavior: e
585
+ }), this.scheduleScrollReconcile();
586
+ }, this.scrollToEnd = ({ behavior: t = "auto" } = {}) => {
587
+ if (this.options.count > 0) {
588
+ this.scrollToIndex(this.options.count - 1, {
589
+ align: "end",
590
+ behavior: t
591
+ });
592
+ return;
593
+ }
594
+ this.scrollToOffset(Math.max(this.getTotalSize() - this.getSize(), 0), { behavior: t });
595
+ }, this.getTotalSize = () => {
596
+ var t;
597
+ const e = this.getMeasurements();
598
+ let s;
599
+ if (e.length === 0) s = this.options.paddingStart;
600
+ else if (this.options.lanes === 1) {
601
+ const i = e.length - 1, n = this._flatMeasurements;
602
+ n != null ? s = n[i * 2] + n[i * 2 + 1] : s = ((t = e[i]) == null ? void 0 : t.end) ?? 0;
603
+ } else {
604
+ const i = Array(this.options.lanes).fill(null);
605
+ let n = e.length - 1;
606
+ for (; n >= 0 && i.some((o) => o === null); ) {
607
+ const o = e[n];
608
+ i[o.lane] === null && (i[o.lane] = o.end), n--;
609
+ }
610
+ s = Math.max(...i.filter((o) => o !== null));
611
+ }
612
+ return Math.max(s - this.options.scrollMargin + this.options.paddingEnd, 0);
613
+ }, this.takeSnapshot = () => {
614
+ const t = [];
615
+ if (this.itemSizeCache.size === 0) return t;
616
+ const e = this.getMeasurements();
617
+ for (const s of e) s && this.itemSizeCache.has(s.key) && t.push({
618
+ index: s.index,
619
+ key: s.key,
620
+ start: s.start,
621
+ size: s.size,
622
+ end: s.end,
623
+ lane: s.lane
624
+ });
625
+ return t;
626
+ }, this._scrollToOffset = (t, { adjustments: e, behavior: s }) => {
627
+ this._intendedScrollOffset = t + (e ?? 0), this.options.scrollToFn(t, {
628
+ behavior: s,
629
+ adjustments: e
630
+ }, this);
631
+ }, this.measure = () => {
632
+ this.pendingMin = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), this.itemSizeCacheVersion++, this.notify(!1);
633
+ }, this.setOptions(l);
634
+ }
635
+ applyScrollAdjustment(l, t) {
636
+ l !== 0 && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", l), D() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? this._iosDeferredAdjustment += l : (this._scrollToOffset(this.getScrollOffset(), {
637
+ adjustments: this.scrollAdjustments += l,
638
+ behavior: t
639
+ }), this.scrollOffset !== null && (this.scrollOffset += this.scrollAdjustments, this.scrollOffset < 0 && (this.scrollOffset = 0), this.scrollAdjustments = 0)));
640
+ }
641
+ scheduleScrollReconcile() {
642
+ if (!this.targetWindow) {
643
+ this.scrollState = null;
644
+ return;
645
+ }
646
+ this.rafId == null && (this.rafId = this.targetWindow.requestAnimationFrame(() => {
647
+ this.rafId = null, this.reconcileScroll();
648
+ }));
649
+ }
650
+ reconcileScroll() {
651
+ if (!this.scrollState || !this.scrollElement) return;
652
+ if (this.now() - this.scrollState.startedAt > 5e3) {
653
+ this.scrollState = null;
654
+ return;
655
+ }
656
+ const l = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0, t = l ? l[0] : this.scrollState.lastTargetOffset, e = 1, s = t !== this.scrollState.lastTargetOffset;
657
+ if (!s && Q(t, this.getScrollOffset())) {
658
+ if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= e) {
659
+ this.getScrollOffset() !== t && this._scrollToOffset(t, {
660
+ adjustments: void 0,
661
+ behavior: "auto"
662
+ }), this.scrollState = null;
663
+ return;
664
+ }
665
+ } else if (this.scrollState.stableFrames = 0, s) {
666
+ const i = this.getSize() || 600, n = Math.abs(t - this.getScrollOffset()), o = this.scrollState.behavior === "smooth" && n > i;
667
+ this.scrollState.lastTargetOffset = t, o || (this.scrollState.behavior = "auto"), this._scrollToOffset(t, {
668
+ adjustments: void 0,
669
+ behavior: o ? "smooth" : "auto"
670
+ });
671
+ }
672
+ this.scheduleScrollReconcile();
673
+ }
674
+ }, P = (l, t, e, s) => {
675
+ for (; l <= t; ) {
676
+ const i = (l + t) / 2 | 0, n = e(i);
677
+ if (n < s) l = i + 1;
678
+ else if (n > s) t = i - 1;
679
+ else return i;
680
+ }
681
+ return l > 0 ? l - 1 : 0;
682
+ };
683
+ function at(l, t, e) {
684
+ let s = 0;
685
+ for (; s <= t; ) {
686
+ const i = (s + t) / 2 | 0, n = l[i * 2];
687
+ if (n < e) s = i + 1;
688
+ else if (n > e) t = i - 1;
689
+ else return i;
690
+ }
691
+ return s > 0 ? s - 1 : 0;
692
+ }
693
+ function ht(l, t, e, s, i) {
694
+ const n = l.length - 1;
695
+ if (l.length <= s) return {
696
+ startIndex: 0,
697
+ endIndex: n
698
+ };
699
+ if (s === 1 && i !== null) {
700
+ const h = at(i, n, e);
701
+ let u = h;
702
+ const a = e + t;
703
+ for (; u < n && i[u * 2] + i[u * 2 + 1] < a; ) u++;
704
+ return {
705
+ startIndex: h,
706
+ endIndex: u
707
+ };
708
+ }
709
+ let c = P(0, n, (h) => l[h].start, e), r = c;
710
+ if (s === 1) for (; r < n && l[r].end < e + t; ) r++;
711
+ else if (s > 1) {
712
+ const h = Array(s).fill(0);
713
+ for (; r < n && h.some((a) => a < e + t); ) {
714
+ const a = l[r];
715
+ h[a.lane] = a.end, r++;
716
+ }
717
+ const u = Array(s).fill(e + t);
718
+ for (; c >= 0 && u.some((a) => a >= e); ) {
719
+ const a = l[c];
720
+ u[a.lane] = a.start, c--;
721
+ }
722
+ c = Math.max(0, c - c % s), r = Math.min(n, r + (s - 1 - r % s));
723
+ }
724
+ return {
725
+ startIndex: c,
726
+ endIndex: r
727
+ };
728
+ }
729
+ var F = typeof document < "u" ? M.useLayoutEffect : M.useEffect;
730
+ function ct({ useFlushSync: l = !0, directDomUpdates: t = !1, directDomUpdatesMode: e = "transform", ...s }) {
731
+ const i = M.useReducer((h) => h + 1, 0)[1], n = M.useRef({
732
+ enabled: t,
733
+ mode: e,
734
+ container: null,
735
+ lastSize: null,
736
+ lastPositions: /* @__PURE__ */ new WeakMap(),
737
+ prevRange: null
738
+ });
739
+ n.current.enabled = t, n.current.mode = e;
740
+ const o = (h) => {
741
+ const u = n.current;
742
+ if (!u.enabled || !u.container) return;
743
+ const a = h.getTotalSize();
744
+ if (a !== u.lastSize) {
745
+ u.lastSize = a;
746
+ const m = h.options.horizontal ? "width" : "height";
747
+ u.container.style[m] = `${a}px`;
748
+ }
749
+ const f = !!h.options.horizontal, g = u.mode === "transform", p = f ? "left" : "top", v = h.options.scrollMargin, d = h.getVirtualItems();
750
+ for (const m of d) {
751
+ const E = m.start - v, S = h.elementsCache.get(m.key);
752
+ S && u.lastPositions.get(S) !== E && (u.lastPositions.set(S, E), g ? S.style.transform = f ? `translate3d(${E}px, 0, 0)` : `translate3d(0, ${E}px, 0)` : S.style[p] = `${E}px`);
753
+ }
754
+ }, c = {
755
+ ...s,
756
+ onChange: (h, u) => {
757
+ var a;
758
+ const f = n.current;
759
+ let g = !0;
760
+ if (f.enabled) {
761
+ o(h);
762
+ const p = h.range, v = f.prevRange;
763
+ g = !v || v.isScrolling !== h.isScrolling || v.startIndex !== p?.startIndex || v.endIndex !== p?.endIndex, g && (f.prevRange = p ? {
764
+ startIndex: p.startIndex,
765
+ endIndex: p.endIndex,
766
+ isScrolling: h.isScrolling
767
+ } : null);
768
+ }
769
+ g && (l && u ? q(i) : i()), (a = s.onChange) == null || a.call(s, h, u);
770
+ }
771
+ }, [r] = M.useState(() => {
772
+ const h = new rt(c);
773
+ return Object.assign(h, { containerRef: (u) => {
774
+ const a = n.current;
775
+ if (a.container = u, a.lastSize = null, u && a.enabled) {
776
+ const f = h.getTotalSize();
777
+ a.lastSize = f;
778
+ const g = h.options.horizontal ? "width" : "height";
779
+ u.style[g] = `${f}px`;
780
+ }
781
+ } });
782
+ });
783
+ return r.setOptions(c), F(() => r._didMount(), []), F(() => r._willUpdate()), F(() => {
784
+ o(r);
785
+ }), r;
786
+ }
787
+ function ut(l) {
788
+ return ct({
789
+ observeElementRect: tt,
790
+ observeElementOffset: it,
791
+ scrollToFn: lt,
792
+ ...l
793
+ });
794
+ }
795
+ var bt = ({ showFlagOnSearch: l, showNameOnSearch: t }) => {
796
+ const e = J(null), { termOfSearch: s, countries: i, handleSelectCountry: n } = K(), o = H(() => i.filter((r) => r.name.toLocaleLowerCase().includes(s.toLowerCase())), [s]), c = ut({
797
+ count: o.length,
798
+ overscan: 5,
799
+ getScrollElement: () => e.current,
800
+ estimateSize: () => 40
801
+ });
802
+ return B(() => {
803
+ o.length > 0 && c.scrollToIndex(0);
804
+ }, [s, c]), o.length === 0 ? /* @__PURE__ */ x("div", {
805
+ className: "overflow-y-auto max-h-60 snap-y snap-mandatory",
806
+ children: /* @__PURE__ */ x("ul", {
807
+ className: "relative",
808
+ children: /* @__PURE__ */ x("li", {
809
+ className: "w-full flex items-center h-10 select-none px-6",
810
+ children: /* @__PURE__ */ x(L, {
811
+ variant: "body2",
812
+ component: "span",
813
+ className: "flex gap-2 items-center text-left",
814
+ children: "No options"
815
+ })
816
+ })
817
+ })
818
+ }) : /* @__PURE__ */ x("div", {
819
+ ref: e,
820
+ className: "overflow-y-auto max-h-60 snap-y snap-mandatory scrollbar",
821
+ children: /* @__PURE__ */ x("ul", {
822
+ className: "relative",
823
+ style: { height: c.getTotalSize() },
824
+ children: c.getVirtualItems().map((r) => {
825
+ const h = o[r.index], { flag: u, name: a, prefix: f } = h;
826
+ return /* @__PURE__ */ x("li", {
827
+ className: j("absolute", "w-full", "snap-start", "snap-always", "scroll-m-0", "flex", "items-center", "h-10"),
828
+ style: {
829
+ top: r.start,
830
+ height: r.size
831
+ },
832
+ children: /* @__PURE__ */ x("button", {
833
+ className: j("w-full", "h-full", "cursor-pointer", "px-6", "hover:bg-gray-50", "transition-colors", "duration-150", "focus-visible:outline-0", "hover:outline-gray-100", "focus:bg-gray-50", "dark:hover:bg-metal-700"),
834
+ onClick: () => n(h),
835
+ children: /* @__PURE__ */ U(L, {
836
+ variant: "body2",
837
+ component: "span",
838
+ className: "flex gap-2 items-center text-left",
839
+ children: [l && /* @__PURE__ */ x(u, {}), t && /* @__PURE__ */ x($, {
840
+ text: a,
841
+ prefix: f
842
+ })]
843
+ })
844
+ })
845
+ }, r.key);
846
+ })
847
+ })
848
+ });
849
+ };
850
+ export {
851
+ bt as t
852
+ };