@octaviaflow/core 3.1.0-beta.114 → 3.1.0-beta.115

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 (249) hide show
  1. package/dist/chunk-75JAQ4ZG.js +2694 -0
  2. package/dist/chunk-75JAQ4ZG.js.map +1 -0
  3. package/dist/chunk-LQVPNIO5.js +6789 -0
  4. package/dist/chunk-LQVPNIO5.js.map +1 -0
  5. package/dist/chunk-P46JGJC2.js +5619 -0
  6. package/dist/chunk-P46JGJC2.js.map +1 -0
  7. package/dist/chunk-ZALBYWCU.js +1547 -0
  8. package/dist/chunk-ZALBYWCU.js.map +1 -0
  9. package/dist/components/Accordion/Accordion.d.ts.map +1 -1
  10. package/dist/components/AgentAppMark/AgentAppMark.d.ts +28 -0
  11. package/dist/components/AgentAppMark/AgentAppMark.d.ts.map +1 -0
  12. package/dist/components/AgentAppMark/index.d.ts +3 -0
  13. package/dist/components/AgentAppMark/index.d.ts.map +1 -0
  14. package/dist/components/AgentCard/AgentCard.d.ts.map +1 -1
  15. package/dist/components/AlertCard/AlertCard.d.ts.map +1 -1
  16. package/dist/components/AuthCard/AuthCard.d.ts.map +1 -1
  17. package/dist/components/AuthScreen/AuthScreen.d.ts.map +1 -1
  18. package/dist/components/Badge/Badge.d.ts.map +1 -1
  19. package/dist/components/Banner/Banner.d.ts.map +1 -1
  20. package/dist/components/BarChart/BarChart.d.ts.map +1 -1
  21. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  22. package/dist/components/CalendarHeatmap/CalendarHeatmap.d.ts.map +1 -1
  23. package/dist/components/CalendarHeatmap/index.d.ts +1 -1
  24. package/dist/components/CalendarHeatmap/index.d.ts.map +1 -1
  25. package/dist/components/Callout/Callout.d.ts.map +1 -1
  26. package/dist/components/Card/Card.d.ts.map +1 -1
  27. package/dist/components/Catalog/Catalog.d.ts.map +1 -1
  28. package/dist/components/Catalog/index.d.ts +1 -1
  29. package/dist/components/Catalog/index.d.ts.map +1 -1
  30. package/dist/components/ChatAttachment/ChatAttachment.d.ts.map +1 -1
  31. package/dist/components/ChatAttachment/index.d.ts +1 -1
  32. package/dist/components/ChatAttachment/index.d.ts.map +1 -1
  33. package/dist/components/ChatBubble/ChatBubble.d.ts.map +1 -1
  34. package/dist/components/ChatCodeBlock/ChatCodeBlock.d.ts.map +1 -1
  35. package/dist/components/ChatDayDivider/ChatDayDivider.d.ts.map +1 -1
  36. package/dist/components/ChatFeedback/ChatFeedback.d.ts.map +1 -1
  37. package/dist/components/ChatPanel/ChatPanel.d.ts +1 -1
  38. package/dist/components/ChatPanel/ChatPanel.d.ts.map +1 -1
  39. package/dist/components/ChatScrollToBottom/ChatScrollToBottom.d.ts.map +1 -1
  40. package/dist/components/ChatSources/ChatSources.d.ts.map +1 -1
  41. package/dist/components/ChatSources/index.d.ts +1 -1
  42. package/dist/components/ChatSources/index.d.ts.map +1 -1
  43. package/dist/components/ChatSuggestions/ChatSuggestions.d.ts.map +1 -1
  44. package/dist/components/ChatSuggestions/index.d.ts +1 -1
  45. package/dist/components/ChatSuggestions/index.d.ts.map +1 -1
  46. package/dist/components/ChatThinking/ChatThinking.d.ts.map +1 -1
  47. package/dist/components/ChatThinking/index.d.ts +1 -1
  48. package/dist/components/ChatThinking/index.d.ts.map +1 -1
  49. package/dist/components/ChatThread/ChatThread.d.ts.map +1 -1
  50. package/dist/components/ChatThread/index.d.ts +1 -1
  51. package/dist/components/ChatThread/index.d.ts.map +1 -1
  52. package/dist/components/ChatToolTrace/ChatToolTrace.d.ts.map +1 -1
  53. package/dist/components/ChatToolTrace/index.d.ts +1 -1
  54. package/dist/components/ChatToolTrace/index.d.ts.map +1 -1
  55. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  56. package/dist/components/Chip/Chip.d.ts.map +1 -1
  57. package/dist/components/ChoiceCard/ChoiceCard.d.ts.map +1 -1
  58. package/dist/components/Coachmark/Coachmark.d.ts.map +1 -1
  59. package/dist/components/CodeEditor/CodeEditor.d.ts +15 -0
  60. package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  61. package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  62. package/dist/components/Combobox/Combobox.d.ts.map +1 -1
  63. package/dist/components/Combobox/index.d.ts +1 -1
  64. package/dist/components/Combobox/index.d.ts.map +1 -1
  65. package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
  66. package/dist/components/ConditionBuilder/ConditionBuilder.d.ts.map +1 -1
  67. package/dist/components/ConfigPanel/ConfigPanel.d.ts.map +1 -1
  68. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  69. package/dist/components/ConnectorCard/ConnectorCard.d.ts.map +1 -1
  70. package/dist/components/ConnectorCard/index.d.ts +1 -1
  71. package/dist/components/ConnectorCard/index.d.ts.map +1 -1
  72. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  73. package/dist/components/CountUp/CountUp.d.ts.map +1 -1
  74. package/dist/components/CsvViewer/CsvViewer.d.ts.map +1 -1
  75. package/dist/components/DataMapper/DataMapper.d.ts.map +1 -1
  76. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  77. package/dist/components/DatasetCard/DatasetCard.d.ts.map +1 -1
  78. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  79. package/dist/components/DescriptionList/DescriptionList.d.ts.map +1 -1
  80. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  81. package/dist/components/Divider/Divider.d.ts.map +1 -1
  82. package/dist/components/DonutChart/DonutChart.d.ts.map +1 -1
  83. package/dist/components/Drawer/Drawer.d.ts.map +1 -1
  84. package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  85. package/dist/components/EmptyState/EmptyState.d.ts.map +1 -1
  86. package/dist/components/ExecutionConsole/ExecutionConsole.d.ts.map +1 -1
  87. package/dist/components/ExpressionField/ExpressionField.d.ts +21 -3
  88. package/dist/components/ExpressionField/ExpressionField.d.ts.map +1 -1
  89. package/dist/components/ExpressionField/dataRefTokens.d.ts +52 -0
  90. package/dist/components/ExpressionField/dataRefTokens.d.ts.map +1 -0
  91. package/dist/components/ExpressionField/index.d.ts +3 -2
  92. package/dist/components/ExpressionField/index.d.ts.map +1 -1
  93. package/dist/components/FeatureCard/FeatureCard.d.ts.map +1 -1
  94. package/dist/components/FieldPicker/FieldPicker.d.ts.map +1 -1
  95. package/dist/components/FieldPicker/index.d.ts +1 -1
  96. package/dist/components/FieldPicker/index.d.ts.map +1 -1
  97. package/dist/components/FileBrowser/FileBrowser.d.ts.map +1 -1
  98. package/dist/components/FileDropzone/FileDropzone.d.ts.map +1 -1
  99. package/dist/components/FileList/FileList.d.ts.map +1 -1
  100. package/dist/components/FilePicker/FilePicker.d.ts +6 -1
  101. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  102. package/dist/components/FileViewer/FileViewer.d.ts.map +1 -1
  103. package/dist/components/FlowMinimap/FlowMinimap.d.ts.map +1 -1
  104. package/dist/components/Gauge/Gauge.d.ts.map +1 -1
  105. package/dist/components/Grid/Grid.d.ts.map +1 -1
  106. package/dist/components/GroupByBuilder/index.d.ts +1 -1
  107. package/dist/components/GroupByBuilder/index.d.ts.map +1 -1
  108. package/dist/components/Heatmap/Heatmap.d.ts.map +1 -1
  109. package/dist/components/IconCard/IconCard.d.ts.map +1 -1
  110. package/dist/components/InlineMessage/InlineMessage.d.ts.map +1 -1
  111. package/dist/components/IntegrationCard/IntegrationCard.d.ts.map +1 -1
  112. package/dist/components/ItemDetail/ItemDetail.d.ts.map +1 -1
  113. package/dist/components/ItemDetail/index.d.ts +1 -1
  114. package/dist/components/ItemDetail/index.d.ts.map +1 -1
  115. package/dist/components/JsonViewer/JsonViewer.d.ts.map +1 -1
  116. package/dist/components/Kbd/Kbd.d.ts.map +1 -1
  117. package/dist/components/KeyValueEditor/KeyValueEditor.d.ts +22 -1
  118. package/dist/components/KeyValueEditor/KeyValueEditor.d.ts.map +1 -1
  119. package/dist/components/KeyValueEditor/index.d.ts +1 -1
  120. package/dist/components/KeyValueEditor/index.d.ts.map +1 -1
  121. package/dist/components/LinkButton/LinkButton.d.ts.map +1 -1
  122. package/dist/components/MetricCard/MetricCard.d.ts.map +1 -1
  123. package/dist/components/MonacoEditor/MonacoDiffEditor.d.ts.map +1 -1
  124. package/dist/components/MonacoEditor/MonacoEditor.d.ts.map +1 -1
  125. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  126. package/dist/components/NumberInput/NumberInput.d.ts.map +1 -1
  127. package/dist/components/OnboardingFlow/OnboardingFlow.d.ts.map +1 -1
  128. package/dist/components/OrgSwitcher/OrgSwitcher.d.ts.map +1 -1
  129. package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
  130. package/dist/components/Pagination/Pagination.d.ts.map +1 -1
  131. package/dist/components/PasswordInput/PasswordInput.d.ts.map +1 -1
  132. package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -1
  133. package/dist/components/PhoneInput/countries.d.ts.map +1 -1
  134. package/dist/components/PhoneInput/index.d.ts +1 -1
  135. package/dist/components/PhoneInput/index.d.ts.map +1 -1
  136. package/dist/components/PipelineCard/PipelineCard.d.ts +1 -1
  137. package/dist/components/PipelineCard/PipelineCard.d.ts.map +1 -1
  138. package/dist/components/PlanCard/PlanCard.d.ts.map +1 -1
  139. package/dist/components/PlanPicker/PlanPicker.d.ts.map +1 -1
  140. package/dist/components/PlanPicker/context.d.ts.map +1 -1
  141. package/dist/components/PresenceBar/PresenceBar.d.ts +11 -0
  142. package/dist/components/PresenceBar/PresenceBar.d.ts.map +1 -1
  143. package/dist/components/PricingCard/PricingCard.d.ts.map +1 -1
  144. package/dist/components/ProductCard/ProductCard.d.ts.map +1 -1
  145. package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
  146. package/dist/components/ProgressRing/ProgressRing.d.ts.map +1 -1
  147. package/dist/components/PromptInput/PromptInput.d.ts.map +1 -1
  148. package/dist/components/Quote/Quote.d.ts.map +1 -1
  149. package/dist/components/Radio/Radio.d.ts.map +1 -1
  150. package/dist/components/Radio/RadioGroup.d.ts.map +1 -1
  151. package/dist/components/RangeSlider/RangeSlider.d.ts.map +1 -1
  152. package/dist/components/Rating/BinaryRating.d.ts.map +1 -1
  153. package/dist/components/Rating/Rating.d.ts.map +1 -1
  154. package/dist/components/Rating/index.d.ts +1 -1
  155. package/dist/components/Rating/index.d.ts.map +1 -1
  156. package/dist/components/Resizable/Resizable.d.ts.map +1 -1
  157. package/dist/components/Ribbon/Ribbon.d.ts.map +1 -1
  158. package/dist/components/Sankey/Sankey.d.ts.map +1 -1
  159. package/dist/components/ScheduleBuilder/ScheduleBuilder.d.ts.map +1 -1
  160. package/dist/components/ScheduleBuilder/index.d.ts +1 -1
  161. package/dist/components/ScheduleBuilder/index.d.ts.map +1 -1
  162. package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  163. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  164. package/dist/components/Select/Select.d.ts.map +1 -1
  165. package/dist/components/Show/Show.d.ts.map +1 -1
  166. package/dist/components/Skeleton/Skeleton.d.ts.map +1 -1
  167. package/dist/components/SlideoutPanel/SlideoutPanel.d.ts.map +1 -1
  168. package/dist/components/Slider/Slider.d.ts.map +1 -1
  169. package/dist/components/SocialButton/SocialButton.d.ts.map +1 -1
  170. package/dist/components/SortBuilder/index.d.ts +1 -1
  171. package/dist/components/SortBuilder/index.d.ts.map +1 -1
  172. package/dist/components/Sortable/Sortable.d.ts.map +1 -1
  173. package/dist/components/Sparkline/Sparkline.d.ts.map +1 -1
  174. package/dist/components/Spinner/Spinner.d.ts.map +1 -1
  175. package/dist/components/Spotlight/Spotlight.d.ts.map +1 -1
  176. package/dist/components/Stack/Stack.d.ts.map +1 -1
  177. package/dist/components/Stat/Stat.d.ts.map +1 -1
  178. package/dist/components/StatusList/StatusList.d.ts +1 -1
  179. package/dist/components/StatusList/StatusList.d.ts.map +1 -1
  180. package/dist/components/StatusList/index.d.ts +1 -1
  181. package/dist/components/StatusList/index.d.ts.map +1 -1
  182. package/dist/components/StatusTiles/StatusTiles.d.ts.map +1 -1
  183. package/dist/components/StatusTiles/index.d.ts +1 -1
  184. package/dist/components/StatusTiles/index.d.ts.map +1 -1
  185. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  186. package/dist/components/Switch/Switch.d.ts.map +1 -1
  187. package/dist/components/Table/Table.d.ts.map +1 -1
  188. package/dist/components/TagsInput/TagsInput.d.ts.map +1 -1
  189. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  190. package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
  191. package/dist/components/Timeline/Timeline.d.ts.map +1 -1
  192. package/dist/components/TimezonePicker/TimezonePicker.d.ts.map +1 -1
  193. package/dist/components/Toggle/Toggle.d.ts.map +1 -1
  194. package/dist/components/ToolCard/ToolCard.d.ts.map +1 -1
  195. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  196. package/dist/components/TraceStep/TraceStep.d.ts.map +1 -1
  197. package/dist/components/TreeView/TreeView.d.ts.map +1 -1
  198. package/dist/components/TreeView/index.d.ts +1 -1
  199. package/dist/components/TreeView/index.d.ts.map +1 -1
  200. package/dist/components/UsageMeter/UsageMeter.d.ts.map +1 -1
  201. package/dist/components/VersionHistory/VersionHistory.d.ts.map +1 -1
  202. package/dist/components/VersionHistory/index.d.ts +1 -1
  203. package/dist/components/VersionHistory/index.d.ts.map +1 -1
  204. package/dist/components/XmlViewer/XmlViewer.d.ts.map +1 -1
  205. package/dist/components/YamlViewer/YamlViewer.d.ts.map +1 -1
  206. package/dist/email/emailPalette.d.ts.map +1 -1
  207. package/dist/email/emailSystem.d.ts +3 -3
  208. package/dist/email/emailSystem.d.ts.map +1 -1
  209. package/dist/email/emailTemplates.d.ts +1 -1
  210. package/dist/email/emailTemplates.d.ts.map +1 -1
  211. package/dist/hooks/useRating.d.ts.map +1 -1
  212. package/dist/hooks/useTextareaCommands.d.ts.map +1 -1
  213. package/dist/hooks/useTextareaSelection.d.ts.map +1 -1
  214. package/dist/hooks/useTextareaTools.d.ts.map +1 -1
  215. package/dist/hooks/useTraceTimeline.d.ts.map +1 -1
  216. package/dist/index.cjs +15999 -17094
  217. package/dist/index.cjs.map +1 -1
  218. package/dist/index.d.ts +6 -5
  219. package/dist/index.d.ts.map +1 -1
  220. package/dist/index.js +14076 -16193
  221. package/dist/index.js.map +1 -1
  222. package/dist/marketing.cjs +580 -726
  223. package/dist/marketing.cjs.map +1 -1
  224. package/dist/marketing.js +2 -2
  225. package/dist/monaco.cjs +364 -389
  226. package/dist/monaco.cjs.map +1 -1
  227. package/dist/monaco.js +381 -410
  228. package/dist/monaco.js.map +1 -1
  229. package/dist/notifications/components/NotificationBell/NotificationBell.d.ts.map +1 -1
  230. package/dist/styles.css +1 -1
  231. package/dist/utils/Slot.d.ts.map +1 -1
  232. package/dist/utils/gradients.d.ts.map +1 -1
  233. package/dist/utils/useAnchoredPopover.d.ts +8 -1
  234. package/dist/utils/useAnchoredPopover.d.ts.map +1 -1
  235. package/dist/workflow/components/ConfigPanel/ConfigPanel.d.ts.map +1 -1
  236. package/dist/workflow/components/FlowNode/FlowNode.d.ts.map +1 -1
  237. package/dist/workflow/components/FxPanel/DataRefButton.d.ts +1 -1
  238. package/dist/workflow/components/FxPanel/DataRefButton.d.ts.map +1 -1
  239. package/dist/workflow/components/FxPanel/FxPanel.d.ts.map +1 -1
  240. package/dist/workflow/editor.d.ts +22 -0
  241. package/dist/workflow/editor.d.ts.map +1 -1
  242. package/dist/workflow/index.d.ts +6 -6
  243. package/dist/workflow/index.d.ts.map +1 -1
  244. package/dist/workflow/types.d.ts.map +1 -1
  245. package/dist/workflow.cjs +10310 -9355
  246. package/dist/workflow.cjs.map +1 -1
  247. package/dist/workflow.js +1932 -1963
  248. package/dist/workflow.js.map +1 -1
  249. package/package.json +2 -2
@@ -0,0 +1,2694 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-ZAUUGK2Y.js";
4
+
5
+ // src/components/Accordion/Accordion.tsx
6
+ import { ChevronDownIcon } from "@octaviaflow/icons";
7
+ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
8
+ import {
9
+ forwardRef,
10
+ useCallback,
11
+ useId,
12
+ useState
13
+ } from "react";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var Accordion = forwardRef(function Accordion2({
16
+ items,
17
+ mode = "single",
18
+ value: controlledValue,
19
+ defaultValue,
20
+ onValueChange,
21
+ collapsible = true,
22
+ variant = "default",
23
+ size = "md",
24
+ disabled = false,
25
+ id: providedId,
26
+ className,
27
+ ...rest
28
+ }, ref) {
29
+ const reactId = useId();
30
+ const baseId = providedId ?? `ods-accordion-${reactId}`;
31
+ const reducedMotion = useReducedMotion();
32
+ const [internalValue, setInternalValue] = useState(defaultValue ?? []);
33
+ const isControlled = controlledValue !== void 0;
34
+ const value = isControlled ? controlledValue : internalValue;
35
+ const valueSet = new Set(value);
36
+ const setValue = useCallback(
37
+ (next) => {
38
+ if (!isControlled) setInternalValue(next);
39
+ onValueChange?.(next);
40
+ },
41
+ [isControlled, onValueChange]
42
+ );
43
+ const toggleItem = useCallback(
44
+ (id) => {
45
+ const isOpen = valueSet.has(id);
46
+ if (mode === "multiple") {
47
+ const next = isOpen ? value.filter((v) => v !== id) : [...value, id];
48
+ setValue(next);
49
+ return;
50
+ }
51
+ if (isOpen) {
52
+ if (collapsible) setValue([]);
53
+ return;
54
+ }
55
+ setValue([id]);
56
+ },
57
+ [collapsible, mode, setValue, value, valueSet]
58
+ );
59
+ const handleKeyDown = (e, index) => {
60
+ const enabledIdx = items.map((it, i) => it.disabled ? -1 : i).filter((i) => i !== -1);
61
+ const curr = enabledIdx.indexOf(index);
62
+ const focusIdx = (i) => {
63
+ const target = enabledIdx[i];
64
+ if (target === void 0) return;
65
+ const btn = document.getElementById(`${baseId}-trigger-${items[target].id}`);
66
+ btn?.focus();
67
+ };
68
+ if (e.key === "ArrowDown") {
69
+ e.preventDefault();
70
+ focusIdx((curr + 1) % enabledIdx.length);
71
+ } else if (e.key === "ArrowUp") {
72
+ e.preventDefault();
73
+ focusIdx((curr - 1 + enabledIdx.length) % enabledIdx.length);
74
+ } else if (e.key === "Home") {
75
+ e.preventDefault();
76
+ focusIdx(0);
77
+ } else if (e.key === "End") {
78
+ e.preventDefault();
79
+ focusIdx(enabledIdx.length - 1);
80
+ }
81
+ };
82
+ return /* @__PURE__ */ jsx(
83
+ "div",
84
+ {
85
+ ...rest,
86
+ ref,
87
+ id: baseId,
88
+ className: cn(
89
+ "ods-accordion",
90
+ `ods-accordion--${variant}`,
91
+ `ods-accordion--${size}`,
92
+ disabled && "ods-accordion--disabled",
93
+ className
94
+ ),
95
+ children: items.map((item, i) => {
96
+ const isOpen = valueSet.has(item.id);
97
+ const itemDisabled = item.disabled || disabled;
98
+ const triggerId = `${baseId}-trigger-${item.id}`;
99
+ const panelId = `${baseId}-panel-${item.id}`;
100
+ return /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ className: cn(
104
+ "ods-accordion__item",
105
+ isOpen && "ods-accordion__item--open",
106
+ itemDisabled && "ods-accordion__item--disabled"
107
+ ),
108
+ children: [
109
+ /* @__PURE__ */ jsxs(
110
+ "button",
111
+ {
112
+ id: triggerId,
113
+ type: "button",
114
+ className: "ods-accordion__trigger",
115
+ "aria-expanded": isOpen,
116
+ "aria-controls": panelId,
117
+ disabled: itemDisabled,
118
+ onClick: () => toggleItem(item.id),
119
+ onKeyDown: (e) => handleKeyDown(e, i),
120
+ children: [
121
+ item.icon && /* @__PURE__ */ jsx("span", { className: "ods-accordion__icon", "aria-hidden": "true", children: item.icon }),
122
+ /* @__PURE__ */ jsxs("span", { className: "ods-accordion__label-wrap", children: [
123
+ /* @__PURE__ */ jsx("span", { className: "ods-accordion__label", children: item.label }),
124
+ item.description && /* @__PURE__ */ jsx("span", { className: "ods-accordion__description", children: item.description })
125
+ ] }),
126
+ item.trailing && /* @__PURE__ */ jsx("span", { className: "ods-accordion__trailing", onClick: (e) => e.stopPropagation(), children: item.trailing }),
127
+ /* @__PURE__ */ jsx(
128
+ "span",
129
+ {
130
+ className: cn("ods-accordion__chevron", isOpen && "ods-accordion__chevron--open"),
131
+ "aria-hidden": "true",
132
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "sm", "aria-hidden": true })
133
+ }
134
+ )
135
+ ]
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsx(
139
+ motion.div,
140
+ {
141
+ role: "region",
142
+ id: panelId,
143
+ "aria-labelledby": triggerId,
144
+ className: "ods-accordion__panel",
145
+ initial: reducedMotion ? false : { height: 0, opacity: 0 },
146
+ animate: reducedMotion ? void 0 : { height: "auto", opacity: 1 },
147
+ exit: reducedMotion ? void 0 : { height: 0, opacity: 0 },
148
+ transition: reducedMotion ? { duration: 0 } : { duration: 0.18 },
149
+ style: { overflow: "hidden" },
150
+ children: /* @__PURE__ */ jsx("div", { className: "ods-accordion__content", children: item.content })
151
+ }
152
+ ) })
153
+ ]
154
+ },
155
+ item.id
156
+ );
157
+ })
158
+ }
159
+ );
160
+ });
161
+ Accordion.displayName = "Accordion";
162
+
163
+ // src/components/Button/Button.tsx
164
+ import { motion as motion2, useReducedMotion as useReducedMotion2 } from "framer-motion";
165
+ import {
166
+ forwardRef as forwardRef3,
167
+ useImperativeHandle,
168
+ useRef
169
+ } from "react";
170
+ import { useButton } from "react-aria";
171
+
172
+ // src/utils/a11y.ts
173
+ import { isValidElement } from "react";
174
+ function hasRenderableText(node) {
175
+ if (node === null || node === void 0 || typeof node === "boolean") return false;
176
+ if (typeof node === "string") return node.trim().length > 0;
177
+ if (typeof node === "number") return true;
178
+ if (Array.isArray(node)) return node.some(hasRenderableText);
179
+ if (isValidElement(node)) {
180
+ return hasRenderableText(node.props.children);
181
+ }
182
+ return false;
183
+ }
184
+ function getRenderableText(node) {
185
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
186
+ if (typeof node === "string") return node;
187
+ if (typeof node === "number") return String(node);
188
+ if (Array.isArray(node)) return node.map(getRenderableText).join("");
189
+ if (isValidElement(node)) {
190
+ return getRenderableText(node.props.children);
191
+ }
192
+ return "";
193
+ }
194
+ function resolveAccessibleName(input) {
195
+ if (input.ariaLabelledby) {
196
+ return { "aria-labelledby": input.ariaLabelledby };
197
+ }
198
+ if (input.ariaLabel) {
199
+ return { "aria-label": input.ariaLabel };
200
+ }
201
+ if (typeof input.label === "string" && input.label.trim().length > 0) {
202
+ return { "aria-label": input.label };
203
+ }
204
+ for (const candidate of input.fallbacks ?? []) {
205
+ if (typeof candidate === "string" && candidate.trim().length > 0) {
206
+ return { "aria-label": candidate };
207
+ }
208
+ }
209
+ if (process.env.NODE_ENV !== "production") {
210
+ console.error(
211
+ `[@octaviaflow/core ${input.componentName}] No accessible name. Pass a string \`label\`, or \`aria-label\`, or \`aria-labelledby\` so screen readers can announce this control.`
212
+ );
213
+ }
214
+ return { "aria-label": `Unlabeled ${input.componentName}` };
215
+ }
216
+
217
+ // src/utils/Slot.tsx
218
+ import {
219
+ Children,
220
+ cloneElement,
221
+ forwardRef as forwardRef2,
222
+ isValidElement as isValidElement2
223
+ } from "react";
224
+
225
+ // src/utils/composeRefs.ts
226
+ function composeRefs(...refs) {
227
+ return (node) => {
228
+ for (const ref of refs) {
229
+ if (typeof ref === "function") {
230
+ ref(node);
231
+ } else if (ref != null) {
232
+ ref.current = node;
233
+ }
234
+ }
235
+ };
236
+ }
237
+
238
+ // src/utils/Slot.tsx
239
+ var Slot = forwardRef2(function Slot2({ children, ...slotProps }, forwardedRef) {
240
+ if (!isValidElement2(children)) {
241
+ return null;
242
+ }
243
+ const child = Children.only(children);
244
+ const childProps = child.props ?? {};
245
+ const childRef = child.ref;
246
+ return cloneElement(child, {
247
+ ...mergeProps(slotProps, childProps),
248
+ ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
249
+ });
250
+ });
251
+ function mergeProps(slotProps, childProps) {
252
+ const merged = { ...slotProps, ...childProps };
253
+ for (const key of Object.keys(slotProps)) {
254
+ const slotValue = slotProps[key];
255
+ const childValue = childProps[key];
256
+ if (/^on[A-Z]/.test(key) && typeof slotValue === "function" && typeof childValue === "function") {
257
+ merged[key] = (...args) => {
258
+ slotValue(...args);
259
+ const event = args[0];
260
+ if (event?.defaultPrevented) return;
261
+ childValue(...args);
262
+ };
263
+ continue;
264
+ }
265
+ if (key === "className") {
266
+ merged.className = [slotValue, childValue].filter(Boolean).join(" ");
267
+ continue;
268
+ }
269
+ if (key === "style") {
270
+ merged.style = {
271
+ ...slotValue,
272
+ ...childValue
273
+ };
274
+ }
275
+ }
276
+ return merged;
277
+ }
278
+
279
+ // src/components/Button/Button.tsx
280
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
281
+ var Button = forwardRef3(function Button2({
282
+ variant = "primary",
283
+ size = "md",
284
+ loading = false,
285
+ loadingText,
286
+ loadingLabel = "Loading",
287
+ disabled = false,
288
+ leftIcon,
289
+ rightIcon,
290
+ fullWidth = false,
291
+ pressed,
292
+ asChild = false,
293
+ className,
294
+ children,
295
+ type,
296
+ cursor,
297
+ style,
298
+ ...props
299
+ }, forwardedRef) {
300
+ const ref = useRef(null);
301
+ useImperativeHandle(forwardedRef, () => ref.current);
302
+ const isDisabled = disabled || loading;
303
+ const prefersReducedMotion = useReducedMotion2();
304
+ const hasAction = Boolean(props.onClick) || type === "submit" || type === "reset";
305
+ const resolvedCursor = cursor ?? (disabled ? "not-allowed" : loading ? "progress" : hasAction ? "pointer" : "default");
306
+ const resolvedType = type ?? "button";
307
+ const hasVisibleText = hasRenderableText(children);
308
+ const needsAriaName = !hasVisibleText && !asChild;
309
+ const ariaNameProps = needsAriaName ? resolveAccessibleName({
310
+ ariaLabel: props["aria-label"],
311
+ ariaLabelledby: props["aria-labelledby"],
312
+ componentName: "Button"
313
+ }) : void 0;
314
+ const onClick = props.onClick;
315
+ const onPress = onClick ? (press) => {
316
+ const event = press;
317
+ if (typeof event.stopPropagation !== "function") event.stopPropagation = () => {
318
+ };
319
+ if (typeof event.preventDefault !== "function") event.preventDefault = () => {
320
+ };
321
+ if (event.currentTarget === void 0) event.currentTarget = event.target;
322
+ onClick(event);
323
+ } : void 0;
324
+ const { buttonProps } = useButton(
325
+ {
326
+ isDisabled,
327
+ onPress,
328
+ type: resolvedType,
329
+ ...ariaNameProps ?? {}
330
+ },
331
+ ref
332
+ );
333
+ const { onDrag, onDragStart, onDragEnd, onAnimationStart, ...safeButtonProps } = buttonProps;
334
+ const {
335
+ onClick: _onClick,
336
+ onKeyDown: _onKeyDown,
337
+ onKeyUp: _onKeyUp,
338
+ onMouseDown: _onMouseDown,
339
+ onPointerDown: _onPointerDown,
340
+ onPointerUp: _onPointerUp,
341
+ onFocus: _onFocus,
342
+ onBlur: _onBlur,
343
+ ...passthroughProps
344
+ } = props;
345
+ const rootClassName = cn(
346
+ "ods-btn",
347
+ `ods-btn--${variant}`,
348
+ `ods-btn--${size}`,
349
+ loading && "ods-btn--loading",
350
+ fullWidth && "ods-btn--full",
351
+ pressed && "ods-btn--pressed",
352
+ className
353
+ );
354
+ if (asChild) {
355
+ return /* @__PURE__ */ jsx2(
356
+ Slot,
357
+ {
358
+ ...passthroughProps,
359
+ ref: forwardedRef,
360
+ className: rootClassName,
361
+ style: { cursor: resolvedCursor, ...style },
362
+ "aria-pressed": pressed,
363
+ "aria-disabled": isDisabled || void 0,
364
+ children
365
+ }
366
+ );
367
+ }
368
+ const visibleLabel = loading && loadingText !== void 0 ? loadingText : children;
369
+ return /* @__PURE__ */ jsx2(
370
+ motion2.button,
371
+ {
372
+ ...passthroughProps,
373
+ ...safeButtonProps,
374
+ type: resolvedType,
375
+ ref,
376
+ className: rootClassName,
377
+ style: { cursor: resolvedCursor, ...style },
378
+ "data-loading": loading || void 0,
379
+ "aria-busy": loading || void 0,
380
+ "aria-pressed": pressed,
381
+ whileTap: isDisabled || prefersReducedMotion ? void 0 : { scale: 0.97 },
382
+ transition: { duration: 0.1 },
383
+ children: /* @__PURE__ */ jsxs2("span", { className: "ods-btn__content", children: [
384
+ loading ? /* @__PURE__ */ jsx2(
385
+ "span",
386
+ {
387
+ className: "ods-btn__icon ods-btn__icon--left ods-btn__icon--spinner",
388
+ role: "status",
389
+ "aria-label": loadingLabel,
390
+ children: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(
391
+ "circle",
392
+ {
393
+ cx: "12",
394
+ cy: "12",
395
+ r: "10",
396
+ fill: "none",
397
+ stroke: "currentColor",
398
+ strokeWidth: "2.5",
399
+ strokeLinecap: "round",
400
+ strokeDasharray: "32",
401
+ strokeDashoffset: "12"
402
+ }
403
+ ) })
404
+ }
405
+ ) : leftIcon && /* @__PURE__ */ jsx2("span", { className: "ods-btn__icon ods-btn__icon--left", children: leftIcon }),
406
+ visibleLabel != null && visibleLabel !== false && /* @__PURE__ */ jsx2("span", { className: "ods-btn__label", children: visibleLabel }),
407
+ rightIcon && !loading && /* @__PURE__ */ jsx2("span", { className: "ods-btn__icon ods-btn__icon--right", children: rightIcon })
408
+ ] })
409
+ }
410
+ );
411
+ });
412
+ Button.displayName = "Button";
413
+
414
+ // src/components/Input/Input.tsx
415
+ import { CloseIcon } from "@octaviaflow/icons";
416
+ import {
417
+ forwardRef as forwardRef4,
418
+ useId as useId2,
419
+ useImperativeHandle as useImperativeHandle2,
420
+ useRef as useRef2
421
+ } from "react";
422
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
423
+ var CLEAR_GLYPH = /* @__PURE__ */ jsx3(CloseIcon, { width: 12, height: 12, "aria-hidden": "true" });
424
+ var Input = forwardRef4(
425
+ ({
426
+ type = "text",
427
+ size = "md",
428
+ error = false,
429
+ errorMessage,
430
+ label,
431
+ helperText,
432
+ leftIcon,
433
+ rightIcon,
434
+ clearable,
435
+ onClear,
436
+ shortcutHint,
437
+ disabled = false,
438
+ required,
439
+ id,
440
+ className,
441
+ value,
442
+ defaultValue,
443
+ onChange,
444
+ onKeyDown,
445
+ ...props
446
+ }, forwardedRef) => {
447
+ const innerRef = useRef2(null);
448
+ useImperativeHandle2(forwardedRef, () => innerRef.current);
449
+ const reactId = useId2();
450
+ const inputId = id ?? `${reactId}-input`;
451
+ const errorId = `${reactId}-err`;
452
+ const helperId = `${reactId}-help`;
453
+ const isControlled = value !== void 0;
454
+ const isClearable = (clearable ?? type === "search") && !disabled;
455
+ const isSearch = type === "search";
456
+ const currentValue = isControlled ? String(value ?? "") : innerRef.current?.value ?? String(defaultValue ?? "");
457
+ const showClear = isClearable && currentValue.length > 0;
458
+ const clearValue = () => {
459
+ const el = innerRef.current;
460
+ if (el && !isControlled) {
461
+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
462
+ setter?.call(el, "");
463
+ el.dispatchEvent(new Event("input", { bubbles: true }));
464
+ }
465
+ onClear?.();
466
+ el?.focus();
467
+ };
468
+ const handleClear = (e) => {
469
+ e.preventDefault();
470
+ e.stopPropagation();
471
+ clearValue();
472
+ };
473
+ const handleKeyDown = (e) => {
474
+ onKeyDown?.(e);
475
+ if (e.defaultPrevented) return;
476
+ if (isClearable && isSearch && e.key === "Escape" && currentValue) {
477
+ e.preventDefault();
478
+ clearValue();
479
+ }
480
+ };
481
+ const describedBy = error && errorMessage ? errorId : helperText ? helperId : void 0;
482
+ return /* @__PURE__ */ jsxs3(
483
+ "div",
484
+ {
485
+ className: cn(
486
+ "ods-input",
487
+ `ods-input--${size}`,
488
+ error && "ods-input--error",
489
+ disabled && "ods-input--disabled",
490
+ isSearch && "ods-input--search",
491
+ className
492
+ ),
493
+ children: [
494
+ label && /* @__PURE__ */ jsxs3("label", { htmlFor: inputId, className: "ods-input__label", children: [
495
+ label,
496
+ required && /* @__PURE__ */ jsx3("span", { className: "ods-input__required", "aria-hidden": "true", children: "*" })
497
+ ] }),
498
+ /* @__PURE__ */ jsxs3("div", { className: "ods-input__wrapper", children: [
499
+ leftIcon && /* @__PURE__ */ jsx3("span", { className: "ods-input__icon--left", "aria-hidden": "true", children: leftIcon }),
500
+ /* @__PURE__ */ jsx3(
501
+ "input",
502
+ {
503
+ ...props,
504
+ id: inputId,
505
+ ref: innerRef,
506
+ type,
507
+ disabled,
508
+ required,
509
+ value,
510
+ defaultValue,
511
+ onChange,
512
+ onKeyDown: handleKeyDown,
513
+ className: cn(
514
+ "ods-input__field",
515
+ leftIcon && "ods-input__field--with-left-icon",
516
+ (rightIcon || showClear || shortcutHint) && "ods-input__field--with-right-icon",
517
+ showClear && shortcutHint && "ods-input__field--with-right-actions"
518
+ ),
519
+ "aria-invalid": error || void 0,
520
+ "aria-required": required || void 0,
521
+ "aria-describedby": describedBy
522
+ }
523
+ ),
524
+ /* @__PURE__ */ jsxs3("span", { className: "ods-input__right", children: [
525
+ showClear && /* @__PURE__ */ jsx3(
526
+ "button",
527
+ {
528
+ type: "button",
529
+ className: "ods-input__clear",
530
+ onClick: handleClear,
531
+ "aria-label": "Clear",
532
+ tabIndex: -1,
533
+ children: CLEAR_GLYPH
534
+ }
535
+ ),
536
+ shortcutHint && !showClear && /* @__PURE__ */ jsx3("span", { className: "ods-input__kbd", "aria-hidden": "true", children: shortcutHint }),
537
+ rightIcon && !showClear && !shortcutHint && /* @__PURE__ */ jsx3("span", { className: "ods-input__icon--right", "aria-hidden": "true", children: rightIcon })
538
+ ] })
539
+ ] }),
540
+ error && errorMessage && /* @__PURE__ */ jsx3("div", { id: errorId, className: "ods-input__error-message", role: "alert", children: errorMessage }),
541
+ !error && helperText && /* @__PURE__ */ jsx3("div", { id: helperId, className: "ods-input__helper", children: helperText })
542
+ ]
543
+ }
544
+ );
545
+ }
546
+ );
547
+ Input.displayName = "Input";
548
+
549
+ // src/components/Tooltip/Tooltip.tsx
550
+ import { AnimatePresence as AnimatePresence2, motion as motion3 } from "framer-motion";
551
+ import {
552
+ cloneElement as cloneElement2,
553
+ isValidElement as isValidElement3,
554
+ useCallback as useCallback2,
555
+ useEffect,
556
+ useId as useId3,
557
+ useLayoutEffect,
558
+ useRef as useRef3,
559
+ useState as useState2
560
+ } from "react";
561
+ import { useTooltip, useTooltipTrigger } from "react-aria";
562
+ import { createPortal } from "react-dom";
563
+
564
+ // ../../node_modules/react-stately/dist/private/utils/useControlledState.mjs
565
+ import $1CcWn$react, { useState as $1CcWn$useState, useRef as $1CcWn$useRef, useEffect as $1CcWn$useEffect, useReducer as $1CcWn$useReducer, useCallback as $1CcWn$useCallback } from "react";
566
+ var $3e6197669829fe11$var$useEarlyEffect = typeof document !== "undefined" ? (0, $1CcWn$react)["useInsertionEffect"] ?? (0, $1CcWn$react).useLayoutEffect : () => {
567
+ };
568
+ function $3e6197669829fe11$export$40bfa8c7b0832715(value, defaultValue, onChange) {
569
+ let [stateValue, setStateValue] = (0, $1CcWn$useState)(value || defaultValue);
570
+ let valueRef = (0, $1CcWn$useRef)(stateValue);
571
+ let isControlledRef = (0, $1CcWn$useRef)(value !== void 0);
572
+ let isControlled = value !== void 0;
573
+ (0, $1CcWn$useEffect)(() => {
574
+ let wasControlled = isControlledRef.current;
575
+ if (wasControlled !== isControlled && process.env.NODE_ENV !== "production") console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
576
+ isControlledRef.current = isControlled;
577
+ }, [
578
+ isControlled
579
+ ]);
580
+ let currentValue = isControlled ? value : stateValue;
581
+ $3e6197669829fe11$var$useEarlyEffect(() => {
582
+ valueRef.current = currentValue;
583
+ });
584
+ let [, forceUpdate] = (0, $1CcWn$useReducer)(() => ({}), {});
585
+ let setValue = (0, $1CcWn$useCallback)((value2, ...args) => {
586
+ let newValue = typeof value2 === "function" ? value2(valueRef.current) : value2;
587
+ if (!Object.is(valueRef.current, newValue)) {
588
+ valueRef.current = newValue;
589
+ setStateValue(newValue);
590
+ forceUpdate();
591
+ onChange?.(newValue, ...args);
592
+ }
593
+ }, [
594
+ onChange
595
+ ]);
596
+ return [
597
+ currentValue,
598
+ setValue
599
+ ];
600
+ }
601
+
602
+ // ../../node_modules/react-stately/dist/private/form/useFormValidationState.mjs
603
+ import { createContext as $8AuPP$createContext, useMemo as $8AuPP$useMemo, useContext as $8AuPP$useContext, useState as $8AuPP$useState, useRef as $8AuPP$useRef, useEffect as $8AuPP$useEffect } from "react";
604
+ var $fd2148440a13ec26$export$aca958c65c314e6c = {
605
+ badInput: false,
606
+ customError: false,
607
+ patternMismatch: false,
608
+ rangeOverflow: false,
609
+ rangeUnderflow: false,
610
+ stepMismatch: false,
611
+ tooLong: false,
612
+ tooShort: false,
613
+ typeMismatch: false,
614
+ valueMissing: false,
615
+ valid: true
616
+ };
617
+ var $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE = {
618
+ ...$fd2148440a13ec26$export$aca958c65c314e6c,
619
+ customError: true,
620
+ valid: false
621
+ };
622
+ var $fd2148440a13ec26$export$dad6ae84456c676a = {
623
+ isInvalid: false,
624
+ validationDetails: $fd2148440a13ec26$export$aca958c65c314e6c,
625
+ validationErrors: []
626
+ };
627
+ var $fd2148440a13ec26$export$571b5131b7e65c11 = (0, $8AuPP$createContext)({});
628
+ var $fd2148440a13ec26$export$a763b9476acd3eb = "__reactAriaFormValidationState";
629
+ function $fd2148440a13ec26$export$fc1a364ae1f3ff10(props) {
630
+ if (props[$fd2148440a13ec26$export$a763b9476acd3eb]) {
631
+ let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$fd2148440a13ec26$export$a763b9476acd3eb];
632
+ return {
633
+ realtimeValidation,
634
+ displayValidation,
635
+ updateValidation,
636
+ resetValidation,
637
+ commitValidation
638
+ };
639
+ }
640
+ return $fd2148440a13ec26$var$useFormValidationStateImpl(props);
641
+ }
642
+ function $fd2148440a13ec26$var$useFormValidationStateImpl(props) {
643
+ let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
644
+ if (validationState) isInvalid ||= validationState === "invalid";
645
+ let controlledError = isInvalid !== void 0 ? {
646
+ isInvalid,
647
+ validationErrors: [],
648
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
649
+ } : null;
650
+ let clientError = (0, $8AuPP$useMemo)(() => {
651
+ if (!validate || value == null) return null;
652
+ let validateErrors = $fd2148440a13ec26$var$runValidate(validate, value);
653
+ return $fd2148440a13ec26$var$getValidationResult(validateErrors);
654
+ }, [
655
+ validate,
656
+ value
657
+ ]);
658
+ if (builtinValidation?.validationDetails.valid) builtinValidation = void 0;
659
+ let serverErrors = (0, $8AuPP$useContext)($fd2148440a13ec26$export$571b5131b7e65c11);
660
+ let serverErrorMessages = (0, $8AuPP$useMemo)(() => {
661
+ if (name) return Array.isArray(name) ? name.flatMap((name2) => $fd2148440a13ec26$var$asArray(serverErrors[name2])) : $fd2148440a13ec26$var$asArray(serverErrors[name]);
662
+ return [];
663
+ }, [
664
+ serverErrors,
665
+ name
666
+ ]);
667
+ let [lastServerErrors, setLastServerErrors] = (0, $8AuPP$useState)(serverErrors);
668
+ let [isServerErrorCleared, setServerErrorCleared] = (0, $8AuPP$useState)(false);
669
+ if (serverErrors !== lastServerErrors) {
670
+ setLastServerErrors(serverErrors);
671
+ setServerErrorCleared(false);
672
+ }
673
+ let serverError = (0, $8AuPP$useMemo)(() => $fd2148440a13ec26$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
674
+ isServerErrorCleared,
675
+ serverErrorMessages
676
+ ]);
677
+ let nextValidation = (0, $8AuPP$useRef)($fd2148440a13ec26$export$dad6ae84456c676a);
678
+ let [currentValidity, setCurrentValidity] = (0, $8AuPP$useState)($fd2148440a13ec26$export$dad6ae84456c676a);
679
+ let lastError = (0, $8AuPP$useRef)($fd2148440a13ec26$export$dad6ae84456c676a);
680
+ let commitValidation = () => {
681
+ if (!commitQueued) return;
682
+ setCommitQueued(false);
683
+ let error = clientError || builtinValidation || nextValidation.current;
684
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
685
+ lastError.current = error;
686
+ setCurrentValidity(error);
687
+ }
688
+ };
689
+ let [commitQueued, setCommitQueued] = (0, $8AuPP$useState)(false);
690
+ (0, $8AuPP$useEffect)(commitValidation);
691
+ let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $fd2148440a13ec26$export$dad6ae84456c676a;
692
+ let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
693
+ return {
694
+ realtimeValidation,
695
+ displayValidation,
696
+ updateValidation(value2) {
697
+ if (validationBehavior === "aria" && !$fd2148440a13ec26$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
698
+ else nextValidation.current = value2;
699
+ },
700
+ resetValidation() {
701
+ let error = $fd2148440a13ec26$export$dad6ae84456c676a;
702
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
703
+ lastError.current = error;
704
+ setCurrentValidity(error);
705
+ }
706
+ if (validationBehavior === "native") setCommitQueued(false);
707
+ setServerErrorCleared(true);
708
+ },
709
+ commitValidation() {
710
+ if (validationBehavior === "native") setCommitQueued(true);
711
+ setServerErrorCleared(true);
712
+ }
713
+ };
714
+ }
715
+ function $fd2148440a13ec26$var$asArray(v) {
716
+ if (!v) return [];
717
+ return Array.isArray(v) ? v : [
718
+ v
719
+ ];
720
+ }
721
+ function $fd2148440a13ec26$var$runValidate(validate, value) {
722
+ if (typeof validate === "function") {
723
+ let e = validate(value);
724
+ if (e && typeof e !== "boolean") return $fd2148440a13ec26$var$asArray(e);
725
+ }
726
+ return [];
727
+ }
728
+ function $fd2148440a13ec26$var$getValidationResult(errors) {
729
+ return errors.length ? {
730
+ isInvalid: true,
731
+ validationErrors: errors,
732
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
733
+ } : null;
734
+ }
735
+ function $fd2148440a13ec26$var$isEqualValidation(a, b) {
736
+ if (a === b) return true;
737
+ return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
738
+ }
739
+
740
+ // ../../node_modules/react-stately/dist/private/collections/getChildNodes.mjs
741
+ function $cd5ea4b915021f1d$export$1005530eda016c13(node, collection) {
742
+ if (typeof collection.getChildren === "function") return collection.getChildren(node.key);
743
+ return node.childNodes;
744
+ }
745
+ function $cd5ea4b915021f1d$export$fbdeaa6a76694f71(iterable) {
746
+ return $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, 0);
747
+ }
748
+ function $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, index) {
749
+ if (index < 0) return void 0;
750
+ let i = 0;
751
+ for (let item of iterable) {
752
+ if (i === index) return item;
753
+ i++;
754
+ }
755
+ }
756
+ function $cd5ea4b915021f1d$export$8c434b3a7a4dad6(collection, a, b) {
757
+ if (a.parentKey === b.parentKey) return a.index - b.index;
758
+ let aAncestors = [
759
+ ...$cd5ea4b915021f1d$var$getAncestors(collection, a),
760
+ a
761
+ ];
762
+ let bAncestors = [
763
+ ...$cd5ea4b915021f1d$var$getAncestors(collection, b),
764
+ b
765
+ ];
766
+ let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
767
+ if (firstNonMatchingAncestor !== -1) {
768
+ a = aAncestors[firstNonMatchingAncestor];
769
+ b = bAncestors[firstNonMatchingAncestor];
770
+ return a.index - b.index;
771
+ }
772
+ if (aAncestors.findIndex((node) => node === b) >= 0) return 1;
773
+ else if (bAncestors.findIndex((node) => node === a) >= 0) return -1;
774
+ return -1;
775
+ }
776
+ function $cd5ea4b915021f1d$var$getAncestors(collection, node) {
777
+ let parents = [];
778
+ let currNode = node;
779
+ while (currNode?.parentKey != null) {
780
+ currNode = collection.getItem(currNode.parentKey);
781
+ if (currNode) parents.unshift(currNode);
782
+ }
783
+ return parents;
784
+ }
785
+
786
+ // ../../node_modules/react-stately/dist/private/list/ListCollection.mjs
787
+ var $f664a81d022446b5$export$d085fb9e920b5ca7 = class {
788
+ constructor(nodes) {
789
+ this.keyMap = /* @__PURE__ */ new Map();
790
+ this.firstKey = null;
791
+ this.lastKey = null;
792
+ this.iterable = nodes;
793
+ let visit = (node) => {
794
+ this.keyMap.set(node.key, node);
795
+ if (node.childNodes && node.type === "section") for (let child of node.childNodes) visit(child);
796
+ };
797
+ for (let node of nodes) visit(node);
798
+ let last = null;
799
+ let index = 0;
800
+ let size = 0;
801
+ for (let [key, node] of this.keyMap) {
802
+ if (last) {
803
+ last.nextKey = key;
804
+ node.prevKey = last.key;
805
+ } else {
806
+ this.firstKey = key;
807
+ node.prevKey = void 0;
808
+ }
809
+ if (node.type === "item") node.index = index++;
810
+ if (node.type === "section" || node.type === "item") size++;
811
+ last = node;
812
+ last.nextKey = void 0;
813
+ }
814
+ this._size = size;
815
+ this.lastKey = last?.key ?? null;
816
+ }
817
+ *[Symbol.iterator]() {
818
+ yield* this.iterable;
819
+ }
820
+ get size() {
821
+ return this._size;
822
+ }
823
+ getKeys() {
824
+ return this.keyMap.keys();
825
+ }
826
+ getKeyBefore(key) {
827
+ let node = this.keyMap.get(key);
828
+ return node ? node.prevKey ?? null : null;
829
+ }
830
+ getKeyAfter(key) {
831
+ let node = this.keyMap.get(key);
832
+ return node ? node.nextKey ?? null : null;
833
+ }
834
+ getFirstKey() {
835
+ return this.firstKey;
836
+ }
837
+ getLastKey() {
838
+ return this.lastKey;
839
+ }
840
+ getItem(key) {
841
+ return this.keyMap.get(key) ?? null;
842
+ }
843
+ at(idx) {
844
+ const keys = [
845
+ ...this.getKeys()
846
+ ];
847
+ return this.getItem(keys[idx]);
848
+ }
849
+ getChildren(key) {
850
+ let node = this.keyMap.get(key);
851
+ return node?.childNodes || [];
852
+ }
853
+ };
854
+
855
+ // ../../node_modules/react-stately/dist/private/selection/Selection.mjs
856
+ var $8b2540e09867b15e$export$52baac22726c72bf = class _$8b2540e09867b15e$export$52baac22726c72bf extends Set {
857
+ constructor(keys, anchorKey, currentKey) {
858
+ super(keys);
859
+ if (keys instanceof _$8b2540e09867b15e$export$52baac22726c72bf) {
860
+ this.anchorKey = anchorKey ?? keys.anchorKey;
861
+ this.currentKey = currentKey ?? keys.currentKey;
862
+ } else {
863
+ this.anchorKey = anchorKey ?? null;
864
+ this.currentKey = currentKey ?? null;
865
+ }
866
+ }
867
+ };
868
+
869
+ // ../../node_modules/react-stately/dist/private/selection/useMultipleSelectionState.mjs
870
+ import { useRef as $7w3VE$useRef, useState as $7w3VE$useState, useMemo as $7w3VE$useMemo, useEffect as $7w3VE$useEffect } from "react";
871
+ function $60f19cefd567a3e4$var$equalSets(setA, setB) {
872
+ if (setA.size !== setB.size) return false;
873
+ for (let item of setA) {
874
+ if (!setB.has(item)) return false;
875
+ }
876
+ return true;
877
+ }
878
+ function $60f19cefd567a3e4$export$253fe78d46329472(props) {
879
+ let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
880
+ let isFocusedRef = (0, $7w3VE$useRef)(false);
881
+ let [, setFocused] = (0, $7w3VE$useState)(false);
882
+ let focusedKeyRef = (0, $7w3VE$useRef)(null);
883
+ let childFocusStrategyRef = (0, $7w3VE$useRef)(null);
884
+ let [, setFocusedKey] = (0, $7w3VE$useState)(null);
885
+ let selectedKeysProp = (0, $7w3VE$useMemo)(() => $60f19cefd567a3e4$var$convertSelection(props.selectedKeys), [
886
+ props.selectedKeys
887
+ ]);
888
+ let defaultSelectedKeys = (0, $7w3VE$useMemo)(() => $60f19cefd567a3e4$var$convertSelection(props.defaultSelectedKeys, new (0, $8b2540e09867b15e$export$52baac22726c72bf)()), [
889
+ props.defaultSelectedKeys
890
+ ]);
891
+ let [selectedKeys, setSelectedKeys] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
892
+ let disabledKeysProp = (0, $7w3VE$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
893
+ props.disabledKeys
894
+ ]);
895
+ let [selectionBehavior, setSelectionBehavior] = (0, $7w3VE$useState)(selectionBehaviorProp);
896
+ if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0) setSelectionBehavior("replace");
897
+ let lastSelectionBehavior = (0, $7w3VE$useRef)(selectionBehaviorProp);
898
+ (0, $7w3VE$useEffect)(() => {
899
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
900
+ setSelectionBehavior(selectionBehaviorProp);
901
+ lastSelectionBehavior.current = selectionBehaviorProp;
902
+ }
903
+ }, [
904
+ selectionBehaviorProp
905
+ ]);
906
+ return {
907
+ selectionMode,
908
+ disallowEmptySelection,
909
+ selectionBehavior,
910
+ setSelectionBehavior,
911
+ get isFocused() {
912
+ return isFocusedRef.current;
913
+ },
914
+ setFocused(f) {
915
+ isFocusedRef.current = f;
916
+ setFocused(f);
917
+ },
918
+ get focusedKey() {
919
+ return focusedKeyRef.current;
920
+ },
921
+ get childFocusStrategy() {
922
+ return childFocusStrategyRef.current;
923
+ },
924
+ setFocusedKey(k, childFocusStrategy = "first") {
925
+ focusedKeyRef.current = k;
926
+ childFocusStrategyRef.current = childFocusStrategy;
927
+ setFocusedKey(k);
928
+ },
929
+ selectedKeys,
930
+ setSelectedKeys(keys) {
931
+ if (allowDuplicateSelectionEvents || !$60f19cefd567a3e4$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
932
+ },
933
+ disabledKeys: disabledKeysProp,
934
+ disabledBehavior
935
+ };
936
+ }
937
+ function $60f19cefd567a3e4$var$convertSelection(selection, defaultValue) {
938
+ if (!selection) return defaultValue;
939
+ return selection === "all" ? "all" : new (0, $8b2540e09867b15e$export$52baac22726c72bf)(selection);
940
+ }
941
+
942
+ // ../../node_modules/react-stately/dist/private/selection/SelectionManager.mjs
943
+ var $4a07ac835f260f78$export$6c8a5aaad13c9852 = class _$4a07ac835f260f78$export$6c8a5aaad13c9852 {
944
+ constructor(collection, state, options) {
945
+ this.collection = collection;
946
+ this.state = state;
947
+ this.allowsCellSelection = options?.allowsCellSelection ?? false;
948
+ this._isSelectAll = null;
949
+ this.layoutDelegate = options?.layoutDelegate || null;
950
+ this.fullCollection = options?.fullCollection || null;
951
+ }
952
+ /**
953
+ * The type of selection that is allowed in the collection.
954
+ */
955
+ get selectionMode() {
956
+ return this.state.selectionMode;
957
+ }
958
+ /**
959
+ * Whether the collection allows empty selection.
960
+ */
961
+ get disallowEmptySelection() {
962
+ return this.state.disallowEmptySelection;
963
+ }
964
+ /**
965
+ * The selection behavior for the collection.
966
+ */
967
+ get selectionBehavior() {
968
+ return this.state.selectionBehavior;
969
+ }
970
+ /**
971
+ * Sets the selection behavior for the collection.
972
+ */
973
+ setSelectionBehavior(selectionBehavior) {
974
+ this.state.setSelectionBehavior(selectionBehavior);
975
+ }
976
+ /**
977
+ * Whether the collection is currently focused.
978
+ */
979
+ get isFocused() {
980
+ return this.state.isFocused;
981
+ }
982
+ /**
983
+ * Sets whether the collection is focused.
984
+ */
985
+ setFocused(isFocused) {
986
+ this.state.setFocused(isFocused);
987
+ }
988
+ /**
989
+ * The current focused key in the collection.
990
+ */
991
+ get focusedKey() {
992
+ return this.state.focusedKey;
993
+ }
994
+ /** Whether the first or last child of the focused key should receive focus. */
995
+ get childFocusStrategy() {
996
+ return this.state.childFocusStrategy;
997
+ }
998
+ /**
999
+ * Sets the focused key.
1000
+ */
1001
+ setFocusedKey(key, childFocusStrategy) {
1002
+ if (key == null || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
1003
+ }
1004
+ /**
1005
+ * The currently selected keys in the collection.
1006
+ */
1007
+ get selectedKeys() {
1008
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
1009
+ }
1010
+ /**
1011
+ * The raw selection value for the collection.
1012
+ * Either 'all' for select all, or a set of keys.
1013
+ */
1014
+ get rawSelection() {
1015
+ return this.state.selectedKeys;
1016
+ }
1017
+ /**
1018
+ * Returns whether a key is selected.
1019
+ */
1020
+ isSelected(key) {
1021
+ if (this.state.selectionMode === "none") return false;
1022
+ let mappedKey = this.getKey(key);
1023
+ if (mappedKey == null) return false;
1024
+ return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
1025
+ }
1026
+ /**
1027
+ * Whether the selection is empty.
1028
+ */
1029
+ get isEmpty() {
1030
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
1031
+ }
1032
+ /**
1033
+ * Whether all items in the collection are selected.
1034
+ */
1035
+ get isSelectAll() {
1036
+ if (this.isEmpty) return false;
1037
+ if (this.state.selectedKeys === "all") return true;
1038
+ if (this._isSelectAll != null) return this._isSelectAll;
1039
+ let allKeys = this.getSelectAllKeys();
1040
+ let selectedKeys = this.state.selectedKeys;
1041
+ this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
1042
+ return this._isSelectAll;
1043
+ }
1044
+ get firstSelectedKey() {
1045
+ let first = null;
1046
+ for (let key of this.state.selectedKeys) {
1047
+ let item = this.collection.getItem(key);
1048
+ if (!first || item && (0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, item, first) < 0) first = item;
1049
+ }
1050
+ return first?.key ?? null;
1051
+ }
1052
+ get lastSelectedKey() {
1053
+ let last = null;
1054
+ for (let key of this.state.selectedKeys) {
1055
+ let item = this.collection.getItem(key);
1056
+ if (!last || item && (0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, item, last) > 0) last = item;
1057
+ }
1058
+ return last?.key ?? null;
1059
+ }
1060
+ get disabledKeys() {
1061
+ return this.state.disabledKeys;
1062
+ }
1063
+ get disabledBehavior() {
1064
+ return this.state.disabledBehavior;
1065
+ }
1066
+ /**
1067
+ * Extends the selection to the given key.
1068
+ */
1069
+ extendSelection(toKey) {
1070
+ if (this.selectionMode === "none") return;
1071
+ if (this.selectionMode === "single") {
1072
+ this.replaceSelection(toKey);
1073
+ return;
1074
+ }
1075
+ let mappedToKey = this.getKey(toKey);
1076
+ if (mappedToKey == null) return;
1077
+ let selection;
1078
+ if (this.state.selectedKeys === "all") selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)([
1079
+ mappedToKey
1080
+ ], mappedToKey, mappedToKey);
1081
+ else {
1082
+ let selectedKeys = this.state.selectedKeys;
1083
+ let anchorKey = selectedKeys.anchorKey ?? mappedToKey;
1084
+ selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)(selectedKeys, anchorKey, mappedToKey);
1085
+ for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? mappedToKey)) selection.delete(key);
1086
+ for (let key of this.getKeyRange(mappedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
1087
+ }
1088
+ this.state.setSelectedKeys(selection);
1089
+ }
1090
+ getKeyRange(from, to) {
1091
+ let fromItem = this.collection.getItem(from);
1092
+ let toItem = this.collection.getItem(to);
1093
+ if (fromItem && toItem) {
1094
+ if ((0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
1095
+ return this.getKeyRangeInternal(to, from);
1096
+ }
1097
+ return [];
1098
+ }
1099
+ getKeyRangeInternal(from, to) {
1100
+ if (this.layoutDelegate?.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
1101
+ let keys = [];
1102
+ let key = from;
1103
+ while (key != null) {
1104
+ let item = this.collection.getItem(key);
1105
+ if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection)) keys.push(key);
1106
+ if (key === to) return keys;
1107
+ key = this.collection.getKeyAfter(key);
1108
+ }
1109
+ return [];
1110
+ }
1111
+ getKey(key) {
1112
+ let item = this.collection.getItem(key);
1113
+ if (!item)
1114
+ return key;
1115
+ if (item.type === "cell" && this.allowsCellSelection) return key;
1116
+ while (item && item.type !== "item" && item.parentKey != null) item = this.collection.getItem(item.parentKey);
1117
+ if (!item || item.type !== "item") return null;
1118
+ return item.key;
1119
+ }
1120
+ /**
1121
+ * Toggles whether the given key is selected.
1122
+ */
1123
+ toggleSelection(key) {
1124
+ if (this.selectionMode === "none") return;
1125
+ if (this.selectionMode === "single" && !this.isSelected(key)) {
1126
+ this.replaceSelection(key);
1127
+ return;
1128
+ }
1129
+ let mappedKey = this.getKey(key);
1130
+ if (mappedKey == null) return;
1131
+ let keys = new (0, $8b2540e09867b15e$export$52baac22726c72bf)(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
1132
+ if (keys.has(mappedKey)) keys.delete(mappedKey);
1133
+ else if (this.canSelectItem(mappedKey)) {
1134
+ keys.add(mappedKey);
1135
+ keys.anchorKey = mappedKey;
1136
+ keys.currentKey = mappedKey;
1137
+ }
1138
+ if (this.disallowEmptySelection && keys.size === 0) return;
1139
+ this.state.setSelectedKeys(keys);
1140
+ }
1141
+ /**
1142
+ * Replaces the selection with only the given key.
1143
+ */
1144
+ replaceSelection(key) {
1145
+ if (this.selectionMode === "none") return;
1146
+ let mappedKey = this.getKey(key);
1147
+ if (mappedKey == null) return;
1148
+ let selection = this.canSelectItem(mappedKey) ? new (0, $8b2540e09867b15e$export$52baac22726c72bf)([
1149
+ mappedKey
1150
+ ], mappedKey, mappedKey) : new (0, $8b2540e09867b15e$export$52baac22726c72bf)();
1151
+ this.state.setSelectedKeys(selection);
1152
+ }
1153
+ /**
1154
+ * Replaces the selection with the given keys.
1155
+ */
1156
+ setSelectedKeys(keys) {
1157
+ if (this.selectionMode === "none") return;
1158
+ let selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)();
1159
+ for (let key of keys) {
1160
+ let mappedKey = this.getKey(key);
1161
+ if (mappedKey != null) {
1162
+ selection.add(mappedKey);
1163
+ if (this.selectionMode === "single") break;
1164
+ }
1165
+ }
1166
+ this.state.setSelectedKeys(selection);
1167
+ }
1168
+ getSelectAllKeys() {
1169
+ let collection = this.fullCollection ?? this.collection;
1170
+ let keys = [];
1171
+ let addKeys = (key) => {
1172
+ while (key != null) {
1173
+ if (this.canSelectItemIn(key, collection)) {
1174
+ let item = collection.getItem(key);
1175
+ if (item?.type === "item") keys.push(key);
1176
+ if (item?.hasChildNodes && (this.allowsCellSelection || item.type !== "item")) addKeys((0, $cd5ea4b915021f1d$export$fbdeaa6a76694f71)((0, $cd5ea4b915021f1d$export$1005530eda016c13)(item, collection))?.key ?? null);
1177
+ }
1178
+ key = collection.getKeyAfter(key);
1179
+ }
1180
+ };
1181
+ addKeys(collection.getFirstKey());
1182
+ return keys;
1183
+ }
1184
+ /**
1185
+ * Selects all items in the collection.
1186
+ */
1187
+ selectAll() {
1188
+ if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
1189
+ }
1190
+ /**
1191
+ * Removes all keys from the selection.
1192
+ */
1193
+ clearSelection() {
1194
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new (0, $8b2540e09867b15e$export$52baac22726c72bf)());
1195
+ }
1196
+ /**
1197
+ * Toggles between select all and an empty selection.
1198
+ */
1199
+ toggleSelectAll() {
1200
+ if (this.isSelectAll) this.clearSelection();
1201
+ else this.selectAll();
1202
+ }
1203
+ select(key, e) {
1204
+ if (this.selectionMode === "none") return;
1205
+ if (this.selectionMode === "single") {
1206
+ if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
1207
+ else this.replaceSelection(key);
1208
+ } else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
1209
+ this.toggleSelection(key);
1210
+ else this.replaceSelection(key);
1211
+ }
1212
+ /**
1213
+ * Returns whether the current selection is equal to the given selection.
1214
+ */
1215
+ isSelectionEqual(selection) {
1216
+ if (selection === this.state.selectedKeys) return true;
1217
+ let selectedKeys = this.selectedKeys;
1218
+ if (selection.size !== selectedKeys.size) return false;
1219
+ for (let key of selection) {
1220
+ if (!selectedKeys.has(key)) return false;
1221
+ }
1222
+ for (let key of selectedKeys) {
1223
+ if (!selection.has(key)) return false;
1224
+ }
1225
+ return true;
1226
+ }
1227
+ canSelectItem(key) {
1228
+ return this.canSelectItemIn(key, this.collection);
1229
+ }
1230
+ canSelectItemIn(key, collection) {
1231
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
1232
+ let item = collection.getItem(key);
1233
+ if (!item || item?.props?.isDisabled || item.type === "cell" && !this.allowsCellSelection) return false;
1234
+ return true;
1235
+ }
1236
+ isDisabled(key) {
1237
+ return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled);
1238
+ }
1239
+ isLink(key) {
1240
+ return !!this.collection.getItem(key)?.props?.href;
1241
+ }
1242
+ getItemProps(key) {
1243
+ return this.collection.getItem(key)?.props;
1244
+ }
1245
+ withCollection(collection) {
1246
+ return new _$4a07ac835f260f78$export$6c8a5aaad13c9852(collection, this.state, {
1247
+ allowsCellSelection: this.allowsCellSelection,
1248
+ layoutDelegate: this.layoutDelegate || void 0,
1249
+ fullCollection: this.fullCollection ?? this.collection
1250
+ });
1251
+ }
1252
+ };
1253
+
1254
+ // ../../node_modules/react-stately/dist/private/collections/CollectionBuilder.mjs
1255
+ import $jO8i1$react from "react";
1256
+ var $bda7a7e55e1ff206$export$bf788dd355e3a401 = class {
1257
+ build(props, context) {
1258
+ this.context = context;
1259
+ return $bda7a7e55e1ff206$var$iterable(() => this.iterateCollection(props));
1260
+ }
1261
+ *iterateCollection(props) {
1262
+ let { children, items } = props;
1263
+ if ((0, $jO8i1$react).isValidElement(children) && children.type === (0, $jO8i1$react).Fragment) yield* this.iterateCollection({
1264
+ children: children.props.children,
1265
+ items
1266
+ });
1267
+ else if (typeof children === "function") {
1268
+ if (!items) throw new Error("props.children was a function but props.items is missing");
1269
+ let index = 0;
1270
+ for (let item of items) {
1271
+ yield* this.getFullNode({
1272
+ value: item,
1273
+ index
1274
+ }, {
1275
+ renderer: children
1276
+ });
1277
+ index++;
1278
+ }
1279
+ } else {
1280
+ let items2 = [];
1281
+ (0, $jO8i1$react).Children.forEach(children, (child) => {
1282
+ if (child) items2.push(child);
1283
+ });
1284
+ let index = 0;
1285
+ for (let item of items2) {
1286
+ let nodes = this.getFullNode({
1287
+ element: item,
1288
+ index
1289
+ }, {});
1290
+ for (let node of nodes) {
1291
+ index++;
1292
+ yield node;
1293
+ }
1294
+ }
1295
+ }
1296
+ }
1297
+ getKey(item, partialNode, state, parentKey) {
1298
+ if (item.key != null) return item.key;
1299
+ if (partialNode.type === "cell" && partialNode.key != null) return `${parentKey}${partialNode.key}`;
1300
+ let v = partialNode.value;
1301
+ if (v != null) {
1302
+ let key = v.key ?? v.id;
1303
+ if (key == null) throw new Error("No key found for item");
1304
+ return key;
1305
+ }
1306
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
1307
+ }
1308
+ getChildState(state, partialNode) {
1309
+ return {
1310
+ renderer: partialNode.renderer || state.renderer
1311
+ };
1312
+ }
1313
+ *getFullNode(partialNode, state, parentKey, parentNode) {
1314
+ if ((0, $jO8i1$react).isValidElement(partialNode.element) && partialNode.element.type === (0, $jO8i1$react).Fragment) {
1315
+ let children = [];
1316
+ (0, $jO8i1$react).Children.forEach(partialNode.element.props.children, (child) => {
1317
+ children.push(child);
1318
+ });
1319
+ let index = partialNode.index ?? 0;
1320
+ for (const child of children) yield* this.getFullNode({
1321
+ element: child,
1322
+ index: index++
1323
+ }, state, parentKey, parentNode);
1324
+ return;
1325
+ }
1326
+ let element = partialNode.element;
1327
+ if (!element && partialNode.value && state && state.renderer) {
1328
+ let cached = this.cache.get(partialNode.value);
1329
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
1330
+ cached.index = partialNode.index;
1331
+ cached.parentKey = parentNode ? parentNode.key : null;
1332
+ yield cached;
1333
+ return;
1334
+ }
1335
+ element = state.renderer(partialNode.value);
1336
+ }
1337
+ if ((0, $jO8i1$react).isValidElement(element)) {
1338
+ let type = element.type;
1339
+ if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
1340
+ let name = element.type;
1341
+ throw new Error(`Unknown element <${name}> in collection.`);
1342
+ }
1343
+ let childNodes = type.getCollectionNode(element.props, this.context);
1344
+ let index = partialNode.index ?? 0;
1345
+ let result = childNodes.next();
1346
+ while (!result.done && result.value) {
1347
+ let childNode = result.value;
1348
+ partialNode.index = index;
1349
+ let nodeKey = childNode.key ?? null;
1350
+ if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
1351
+ let nodes = this.getFullNode({
1352
+ ...childNode,
1353
+ key: nodeKey,
1354
+ index,
1355
+ wrapper: $bda7a7e55e1ff206$var$compose(partialNode.wrapper, childNode.wrapper)
1356
+ }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
1357
+ let children = [
1358
+ ...nodes
1359
+ ];
1360
+ for (let node2 of children) {
1361
+ node2.value = childNode.value ?? partialNode.value ?? null;
1362
+ if (node2.value) this.cache.set(node2.value, node2);
1363
+ if (partialNode.type && node2.type !== partialNode.type) throw new Error(`Unsupported type <${$bda7a7e55e1ff206$var$capitalize(node2.type)}> in <${$bda7a7e55e1ff206$var$capitalize(parentNode?.type ?? "unknown parent type")}>. Only <${$bda7a7e55e1ff206$var$capitalize(partialNode.type)}> is supported.`);
1364
+ index++;
1365
+ yield node2;
1366
+ }
1367
+ result = childNodes.next(children);
1368
+ }
1369
+ return;
1370
+ }
1371
+ if (partialNode.key == null || partialNode.type == null) return;
1372
+ let builder = this;
1373
+ let node = {
1374
+ type: partialNode.type,
1375
+ props: partialNode.props,
1376
+ key: partialNode.key,
1377
+ parentKey: parentNode ? parentNode.key : null,
1378
+ value: partialNode.value ?? null,
1379
+ level: (parentNode?.level ?? 0) + (parentNode?.type === "item" ? 1 : 0),
1380
+ index: partialNode.index,
1381
+ rendered: partialNode.rendered,
1382
+ textValue: partialNode.textValue ?? "",
1383
+ "aria-label": partialNode["aria-label"],
1384
+ wrapper: partialNode.wrapper,
1385
+ shouldInvalidate: partialNode.shouldInvalidate,
1386
+ hasChildNodes: partialNode.hasChildNodes || false,
1387
+ childNodes: $bda7a7e55e1ff206$var$iterable(function* () {
1388
+ if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
1389
+ let index = 0;
1390
+ for (let child of partialNode.childNodes()) {
1391
+ if (child.key != null)
1392
+ child.key = `${node.key}${child.key}`;
1393
+ let nodes = builder.getFullNode({
1394
+ ...child,
1395
+ index
1396
+ }, builder.getChildState(state, child), node.key, node);
1397
+ for (let node2 of nodes) {
1398
+ index++;
1399
+ yield node2;
1400
+ }
1401
+ }
1402
+ })
1403
+ };
1404
+ yield node;
1405
+ }
1406
+ constructor() {
1407
+ this.cache = /* @__PURE__ */ new WeakMap();
1408
+ }
1409
+ };
1410
+ function $bda7a7e55e1ff206$var$iterable(iterator) {
1411
+ let cache = [];
1412
+ let iterable = null;
1413
+ return {
1414
+ *[Symbol.iterator]() {
1415
+ for (let item of cache) yield item;
1416
+ if (!iterable) iterable = iterator();
1417
+ for (let item of iterable) {
1418
+ cache.push(item);
1419
+ yield item;
1420
+ }
1421
+ }
1422
+ };
1423
+ }
1424
+ function $bda7a7e55e1ff206$var$compose(outer, inner) {
1425
+ if (outer && inner) return (element) => outer(inner(element));
1426
+ if (outer) return outer;
1427
+ if (inner) return inner;
1428
+ }
1429
+ function $bda7a7e55e1ff206$var$capitalize(str) {
1430
+ return str[0].toUpperCase() + str.slice(1);
1431
+ }
1432
+
1433
+ // ../../node_modules/react-stately/dist/private/collections/useCollection.mjs
1434
+ import { useMemo as $emYU7$useMemo } from "react";
1435
+ function $d03379b88399b8c5$export$6cd28814d92fa9c9(props, factory, context) {
1436
+ let builder = (0, $emYU7$useMemo)(() => new (0, $bda7a7e55e1ff206$export$bf788dd355e3a401)(), []);
1437
+ let { children, items, collection } = props;
1438
+ let result = (0, $emYU7$useMemo)(() => {
1439
+ if (collection) return collection;
1440
+ let nodes = builder.build({
1441
+ children,
1442
+ items
1443
+ }, context);
1444
+ return factory(nodes);
1445
+ }, [
1446
+ builder,
1447
+ children,
1448
+ items,
1449
+ collection,
1450
+ context,
1451
+ factory
1452
+ ]);
1453
+ return result;
1454
+ }
1455
+
1456
+ // ../../node_modules/react-stately/dist/private/list/useListState.mjs
1457
+ import { useMemo as $3yt54$useMemo, useCallback as $3yt54$useCallback, useRef as $3yt54$useRef, useEffect as $3yt54$useEffect } from "react";
1458
+ function $b14b6f590b50af39$export$2f645645f7bca764(props) {
1459
+ let { filter, layoutDelegate } = props;
1460
+ let selectionState = (0, $60f19cefd567a3e4$export$253fe78d46329472)(props);
1461
+ let disabledKeys = (0, $3yt54$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1462
+ props.disabledKeys
1463
+ ]);
1464
+ let factory = (0, $3yt54$useCallback)((nodes) => filter ? new (0, $f664a81d022446b5$export$d085fb9e920b5ca7)(filter(nodes)) : new (0, $f664a81d022446b5$export$d085fb9e920b5ca7)(nodes), [
1465
+ filter
1466
+ ]);
1467
+ let context = (0, $3yt54$useMemo)(() => ({
1468
+ suppressTextValueWarning: props.suppressTextValueWarning
1469
+ }), [
1470
+ props.suppressTextValueWarning
1471
+ ]);
1472
+ let collection = (0, $d03379b88399b8c5$export$6cd28814d92fa9c9)(props, factory, context);
1473
+ let selectionManager = (0, $3yt54$useMemo)(() => new (0, $4a07ac835f260f78$export$6c8a5aaad13c9852)(collection, selectionState, {
1474
+ layoutDelegate
1475
+ }), [
1476
+ collection,
1477
+ selectionState,
1478
+ layoutDelegate
1479
+ ]);
1480
+ $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager);
1481
+ return {
1482
+ collection,
1483
+ disabledKeys,
1484
+ selectionManager
1485
+ };
1486
+ }
1487
+ function $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager) {
1488
+ const cachedCollection = (0, $3yt54$useRef)(null);
1489
+ (0, $3yt54$useEffect)(() => {
1490
+ if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
1491
+ let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);
1492
+ let nextFocusedKey = null;
1493
+ while (key != null) {
1494
+ let node = collection.getItem(key);
1495
+ if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
1496
+ nextFocusedKey = key;
1497
+ break;
1498
+ }
1499
+ key = cachedCollection.current.getKeyAfter(key);
1500
+ }
1501
+ if (nextFocusedKey == null) {
1502
+ key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);
1503
+ while (key != null) {
1504
+ let node = collection.getItem(key);
1505
+ if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
1506
+ nextFocusedKey = key;
1507
+ break;
1508
+ }
1509
+ key = cachedCollection.current.getKeyBefore(key);
1510
+ }
1511
+ }
1512
+ selectionManager.setFocusedKey(nextFocusedKey);
1513
+ }
1514
+ cachedCollection.current = collection;
1515
+ }, [
1516
+ collection,
1517
+ selectionManager
1518
+ ]);
1519
+ }
1520
+
1521
+ // ../../node_modules/react-stately/dist/private/overlays/useOverlayTriggerState.mjs
1522
+ import { useCallback as $kE40A$useCallback } from "react";
1523
+ function $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props) {
1524
+ let [isOpen, setOpen] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
1525
+ const open = (0, $kE40A$useCallback)(() => {
1526
+ setOpen(true);
1527
+ }, [
1528
+ setOpen
1529
+ ]);
1530
+ const close = (0, $kE40A$useCallback)(() => {
1531
+ setOpen(false);
1532
+ }, [
1533
+ setOpen
1534
+ ]);
1535
+ const toggle = (0, $kE40A$useCallback)(() => {
1536
+ setOpen(!isOpen);
1537
+ }, [
1538
+ setOpen,
1539
+ isOpen
1540
+ ]);
1541
+ return {
1542
+ isOpen,
1543
+ setOpen,
1544
+ open,
1545
+ close,
1546
+ toggle
1547
+ };
1548
+ }
1549
+
1550
+ // ../../node_modules/react-stately/dist/private/collections/Item.mjs
1551
+ import $dJmKC$react from "react";
1552
+ function $05678f3aee5e7d1a$var$Item(props) {
1553
+ return null;
1554
+ }
1555
+ $05678f3aee5e7d1a$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
1556
+ let { childItems, title, children } = props;
1557
+ let rendered = props.title || props.children;
1558
+ let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
1559
+ if (!textValue && !context?.suppressTextValueWarning && process.env.NODE_ENV !== "production") console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.");
1560
+ yield {
1561
+ type: "item",
1562
+ props,
1563
+ rendered,
1564
+ textValue,
1565
+ "aria-label": props["aria-label"],
1566
+ hasChildNodes: $05678f3aee5e7d1a$var$hasChildItems(props),
1567
+ *childNodes() {
1568
+ if (childItems) for (let child of childItems) yield {
1569
+ type: "item",
1570
+ value: child
1571
+ };
1572
+ else if (title) {
1573
+ let items = [];
1574
+ (0, $dJmKC$react).Children.forEach(children, (child) => {
1575
+ items.push({
1576
+ type: "item",
1577
+ element: child
1578
+ });
1579
+ });
1580
+ yield* items;
1581
+ }
1582
+ }
1583
+ };
1584
+ };
1585
+ function $05678f3aee5e7d1a$var$hasChildItems(props) {
1586
+ if (props.hasChildItems != null) return props.hasChildItems;
1587
+ if (props.childItems) return true;
1588
+ if (props.title && (0, $dJmKC$react).Children.count(props.children) > 0) return true;
1589
+ return false;
1590
+ }
1591
+ var $05678f3aee5e7d1a$export$6d08773d2e66f8f2 = $05678f3aee5e7d1a$var$Item;
1592
+
1593
+ // ../../node_modules/react-stately/dist/private/list/useSingleSelectListState.mjs
1594
+ import { useMemo as $jhfZc$useMemo } from "react";
1595
+ function $0fdb127d377ffd84$export$e7f05e985daf4b5f(props) {
1596
+ let [selectedKey, setSelectedKey] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange);
1597
+ let selectedKeys = (0, $jhfZc$useMemo)(() => selectedKey != null ? [
1598
+ selectedKey
1599
+ ] : [], [
1600
+ selectedKey
1601
+ ]);
1602
+ let { collection, disabledKeys, selectionManager } = (0, $b14b6f590b50af39$export$2f645645f7bca764)({
1603
+ ...props,
1604
+ selectionMode: "single",
1605
+ disallowEmptySelection: true,
1606
+ allowDuplicateSelectionEvents: true,
1607
+ selectedKeys,
1608
+ onSelectionChange: (keys) => {
1609
+ if (keys === "all") return;
1610
+ let key = keys.values().next().value ?? null;
1611
+ if (key === selectedKey && props.onSelectionChange) props.onSelectionChange(key);
1612
+ setSelectedKey(key);
1613
+ }
1614
+ });
1615
+ let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
1616
+ return {
1617
+ collection,
1618
+ disabledKeys,
1619
+ selectionManager,
1620
+ selectedKey,
1621
+ setSelectedKey,
1622
+ selectedItem
1623
+ };
1624
+ }
1625
+
1626
+ // ../../node_modules/react-stately/dist/private/menu/useMenuTriggerState.mjs
1627
+ import { useState as $aoDK0$useState } from "react";
1628
+ function $e3403870bfb691da$export$79fefeb1c2091ac3(props) {
1629
+ let overlayTriggerState = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1630
+ let [focusStrategy, setFocusStrategy] = (0, $aoDK0$useState)(null);
1631
+ let [expandedKeysStack, setExpandedKeysStack] = (0, $aoDK0$useState)([]);
1632
+ let closeAll = () => {
1633
+ setExpandedKeysStack([]);
1634
+ overlayTriggerState.close();
1635
+ };
1636
+ let openSubmenu = (triggerKey, level) => {
1637
+ setExpandedKeysStack((oldStack) => {
1638
+ if (level > oldStack.length) return oldStack;
1639
+ return [
1640
+ ...oldStack.slice(0, level),
1641
+ triggerKey
1642
+ ];
1643
+ });
1644
+ };
1645
+ let closeSubmenu = (triggerKey, level) => {
1646
+ setExpandedKeysStack((oldStack) => {
1647
+ let key = oldStack[level];
1648
+ if (key === triggerKey) return oldStack.slice(0, level);
1649
+ else return oldStack;
1650
+ });
1651
+ };
1652
+ return {
1653
+ focusStrategy,
1654
+ ...overlayTriggerState,
1655
+ open(focusStrategy2 = null) {
1656
+ setFocusStrategy(focusStrategy2);
1657
+ overlayTriggerState.open();
1658
+ },
1659
+ toggle(focusStrategy2 = null) {
1660
+ setFocusStrategy(focusStrategy2);
1661
+ overlayTriggerState.toggle();
1662
+ },
1663
+ close() {
1664
+ closeAll();
1665
+ },
1666
+ expandedKeysStack,
1667
+ openSubmenu,
1668
+ closeSubmenu
1669
+ };
1670
+ }
1671
+
1672
+ // ../../node_modules/react-stately/dist/private/radio/useRadioGroupState.mjs
1673
+ import { useMemo as $6Hs9a$useMemo, useState as $6Hs9a$useState } from "react";
1674
+ var $384704861d32dbed$var$instance = Math.round(Math.random() * 1e10);
1675
+ var $384704861d32dbed$var$i = 0;
1676
+ function $384704861d32dbed$export$bca9d026f8e704eb(props) {
1677
+ let name = (0, $6Hs9a$useMemo)(() => props.name || `radio-group-${$384704861d32dbed$var$instance}-${++$384704861d32dbed$var$i}`, [
1678
+ props.name
1679
+ ]);
1680
+ let [selectedValue, setSelected] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.value, props.defaultValue ?? null, props.onChange);
1681
+ let [initialValue] = (0, $6Hs9a$useState)(selectedValue);
1682
+ let [lastFocusedValue, setLastFocusedValue] = (0, $6Hs9a$useState)(null);
1683
+ let validation = (0, $fd2148440a13ec26$export$fc1a364ae1f3ff10)({
1684
+ ...props,
1685
+ value: selectedValue
1686
+ });
1687
+ let setSelectedValue = (value) => {
1688
+ if (!props.isReadOnly && !props.isDisabled) {
1689
+ setSelected(value);
1690
+ validation.commitValidation();
1691
+ }
1692
+ };
1693
+ let isInvalid = validation.displayValidation.isInvalid;
1694
+ return {
1695
+ ...validation,
1696
+ name,
1697
+ selectedValue,
1698
+ defaultSelectedValue: props.value !== void 0 ? initialValue : props.defaultValue ?? null,
1699
+ setSelectedValue,
1700
+ lastFocusedValue,
1701
+ setLastFocusedValue,
1702
+ isDisabled: props.isDisabled || false,
1703
+ isReadOnly: props.isReadOnly || false,
1704
+ isRequired: props.isRequired || false,
1705
+ validationState: props.validationState || (isInvalid ? "invalid" : null),
1706
+ isInvalid
1707
+ };
1708
+ }
1709
+
1710
+ // ../../node_modules/react-stately/dist/private/select/useSelectState.mjs
1711
+ import { useState as $5t5rb$useState, useMemo as $5t5rb$useMemo } from "react";
1712
+ function $29256f53a2edafe9$export$5159ec8b34d4ec12(props) {
1713
+ let { selectionMode = "single", shouldCloseOnSelect = selectionMode === "single" } = props;
1714
+ let triggerState = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1715
+ let [focusStrategy, setFocusStrategy] = (0, $5t5rb$useState)(null);
1716
+ let defaultValue = (0, $5t5rb$useMemo)(() => {
1717
+ return props.defaultValue !== void 0 ? props.defaultValue : selectionMode === "single" ? props.defaultSelectedKey ?? null : [];
1718
+ }, [
1719
+ props.defaultValue,
1720
+ props.defaultSelectedKey,
1721
+ selectionMode
1722
+ ]);
1723
+ let value = (0, $5t5rb$useMemo)(() => {
1724
+ return props.value !== void 0 ? props.value : selectionMode === "single" ? props.selectedKey : void 0;
1725
+ }, [
1726
+ props.value,
1727
+ props.selectedKey,
1728
+ selectionMode
1729
+ ]);
1730
+ let [controlledValue, setControlledValue] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(value, defaultValue, props.onChange);
1731
+ let displayValue = selectionMode === "single" && Array.isArray(controlledValue) ? controlledValue[0] : controlledValue;
1732
+ let setValue = (value2) => {
1733
+ if (selectionMode === "single") {
1734
+ let key = Array.isArray(value2) ? value2[0] ?? null : value2;
1735
+ setControlledValue(key);
1736
+ if (key !== displayValue) props.onSelectionChange?.(key);
1737
+ } else {
1738
+ let keys = [];
1739
+ if (Array.isArray(value2)) keys = value2;
1740
+ else if (value2 != null) keys = [
1741
+ value2
1742
+ ];
1743
+ setControlledValue(keys);
1744
+ }
1745
+ };
1746
+ let listState = (0, $b14b6f590b50af39$export$2f645645f7bca764)({
1747
+ ...props,
1748
+ selectionMode,
1749
+ disallowEmptySelection: selectionMode === "single",
1750
+ allowDuplicateSelectionEvents: true,
1751
+ selectedKeys: (0, $5t5rb$useMemo)(() => $29256f53a2edafe9$var$convertValue(displayValue), [
1752
+ displayValue
1753
+ ]),
1754
+ onSelectionChange: (keys) => {
1755
+ if (keys === "all") return;
1756
+ if (selectionMode === "single") {
1757
+ let key = keys.values().next().value ?? null;
1758
+ setValue(key);
1759
+ } else setValue([
1760
+ ...keys
1761
+ ]);
1762
+ if (shouldCloseOnSelect) triggerState.close();
1763
+ validationState.commitValidation();
1764
+ }
1765
+ });
1766
+ let selectedKey = listState.selectionManager.firstSelectedKey;
1767
+ let selectedItems = (0, $5t5rb$useMemo)(() => {
1768
+ return [
1769
+ ...listState.selectionManager.selectedKeys
1770
+ ].map((key) => listState.collection.getItem(key)).filter((item) => item != null);
1771
+ }, [
1772
+ listState.selectionManager.selectedKeys,
1773
+ listState.collection
1774
+ ]);
1775
+ let validationState = (0, $fd2148440a13ec26$export$fc1a364ae1f3ff10)({
1776
+ ...props,
1777
+ value: Array.isArray(displayValue) && displayValue.length === 0 ? null : displayValue
1778
+ });
1779
+ let [isFocused, setFocused] = (0, $5t5rb$useState)(false);
1780
+ let [initialValue] = (0, $5t5rb$useState)(displayValue);
1781
+ return {
1782
+ ...validationState,
1783
+ ...listState,
1784
+ ...triggerState,
1785
+ value: displayValue,
1786
+ defaultValue: defaultValue ?? initialValue,
1787
+ setValue,
1788
+ selectedKey,
1789
+ setSelectedKey: setValue,
1790
+ selectedItem: selectedItems[0] ?? null,
1791
+ selectedItems,
1792
+ defaultSelectedKey: props.defaultSelectedKey ?? (props.selectionMode === "single" ? initialValue : null),
1793
+ focusStrategy,
1794
+ open(focusStrategy2 = null) {
1795
+ if (listState.collection.size !== 0 || props.allowsEmptyCollection) {
1796
+ setFocusStrategy(focusStrategy2);
1797
+ triggerState.open();
1798
+ }
1799
+ },
1800
+ toggle(focusStrategy2 = null) {
1801
+ if (listState.collection.size !== 0 || props.allowsEmptyCollection) {
1802
+ setFocusStrategy(focusStrategy2);
1803
+ triggerState.toggle();
1804
+ }
1805
+ },
1806
+ isFocused,
1807
+ setFocused
1808
+ };
1809
+ }
1810
+ function $29256f53a2edafe9$var$convertValue(value) {
1811
+ if (value === void 0) return void 0;
1812
+ if (value === null) return [];
1813
+ return Array.isArray(value) ? value : [
1814
+ value
1815
+ ];
1816
+ }
1817
+
1818
+ // ../../node_modules/react-stately/dist/private/tabs/useTabListState.mjs
1819
+ import { useRef as $eOo4G$useRef, useEffect as $eOo4G$useEffect } from "react";
1820
+ function $caeb030f09a278a1$export$4ba071daf4e486(props) {
1821
+ let state = (0, $0fdb127d377ffd84$export$e7f05e985daf4b5f)({
1822
+ ...props,
1823
+ onSelectionChange: props.onSelectionChange ? (key) => {
1824
+ if (key != null) props.onSelectionChange?.(key);
1825
+ } : void 0,
1826
+ suppressTextValueWarning: true,
1827
+ defaultSelectedKey: props.defaultSelectedKey ?? $caeb030f09a278a1$var$findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set()) ?? void 0
1828
+ });
1829
+ let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
1830
+ let lastSelectedKey = (0, $eOo4G$useRef)(currentSelectedKey);
1831
+ (0, $eOo4G$useEffect)(() => {
1832
+ let selectedKey = currentSelectedKey;
1833
+ if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
1834
+ selectedKey = $caeb030f09a278a1$var$findDefaultSelectedKey(collection, state.disabledKeys);
1835
+ if (selectedKey != null)
1836
+ selectionManager.setSelectedKeys([
1837
+ selectedKey
1838
+ ]);
1839
+ }
1840
+ if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current) selectionManager.setFocusedKey(selectedKey);
1841
+ lastSelectedKey.current = selectedKey;
1842
+ });
1843
+ return {
1844
+ ...state,
1845
+ isDisabled: props.isDisabled || false
1846
+ };
1847
+ }
1848
+ function $caeb030f09a278a1$var$findDefaultSelectedKey(collection, disabledKeys) {
1849
+ let selectedKey = null;
1850
+ if (collection) {
1851
+ selectedKey = collection.getFirstKey();
1852
+ while (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey !== collection.getLastKey()) selectedKey = collection.getKeyAfter(selectedKey);
1853
+ if (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey === collection.getLastKey()) selectedKey = collection.getFirstKey();
1854
+ }
1855
+ return selectedKey;
1856
+ }
1857
+
1858
+ // ../../node_modules/react-stately/dist/private/toggle/useToggleState.mjs
1859
+ import { useState as $dAajM$useState } from "react";
1860
+ function $fd3c5e01e837dc20$export$8042c6c013fd5226(props = {}) {
1861
+ let { isReadOnly } = props;
1862
+ let [isSelected, setSelected] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.isSelected, props.defaultSelected || false, props.onChange);
1863
+ let [initialValue] = (0, $dAajM$useState)(isSelected);
1864
+ function updateSelected(value) {
1865
+ if (!isReadOnly) setSelected(value);
1866
+ }
1867
+ function toggleState() {
1868
+ if (!isReadOnly) setSelected(!isSelected);
1869
+ }
1870
+ return {
1871
+ isSelected,
1872
+ defaultSelected: props.defaultSelected ?? initialValue,
1873
+ setSelected: updateSelected,
1874
+ toggle: toggleState
1875
+ };
1876
+ }
1877
+
1878
+ // ../../node_modules/react-stately/dist/private/tooltip/useTooltipTriggerState.mjs
1879
+ import { useMemo as $auOuY$useMemo, useRef as $auOuY$useRef, useEffect as $auOuY$useEffect } from "react";
1880
+ var $3834487504f4fc00$var$TOOLTIP_DELAY = 1500;
1881
+ var $3834487504f4fc00$var$TOOLTIP_COOLDOWN = 500;
1882
+ var $3834487504f4fc00$var$tooltips = {};
1883
+ var $3834487504f4fc00$var$tooltipId = 0;
1884
+ var $3834487504f4fc00$var$globalWarmedUp = false;
1885
+ var $3834487504f4fc00$var$globalWarmUpTimeout = null;
1886
+ var $3834487504f4fc00$var$globalCooldownTimeout = null;
1887
+ function $3834487504f4fc00$export$4d40659c25ecb50b(props = {}) {
1888
+ let { delay = $3834487504f4fc00$var$TOOLTIP_DELAY, closeDelay = $3834487504f4fc00$var$TOOLTIP_COOLDOWN } = props;
1889
+ let { isOpen, open, close } = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1890
+ let id = (0, $auOuY$useMemo)(() => `${++$3834487504f4fc00$var$tooltipId}`, []);
1891
+ let closeTimeout = (0, $auOuY$useRef)(null);
1892
+ let closeCallback = (0, $auOuY$useRef)(close);
1893
+ let ensureTooltipEntry = () => {
1894
+ $3834487504f4fc00$var$tooltips[id] = hideTooltip;
1895
+ };
1896
+ let closeOpenTooltips = () => {
1897
+ for (let hideTooltipId in $3834487504f4fc00$var$tooltips) if (hideTooltipId !== id) {
1898
+ $3834487504f4fc00$var$tooltips[hideTooltipId](true);
1899
+ delete $3834487504f4fc00$var$tooltips[hideTooltipId];
1900
+ }
1901
+ };
1902
+ let showTooltip = () => {
1903
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1904
+ closeTimeout.current = null;
1905
+ closeOpenTooltips();
1906
+ ensureTooltipEntry();
1907
+ $3834487504f4fc00$var$globalWarmedUp = true;
1908
+ open();
1909
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1910
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1911
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1912
+ }
1913
+ if ($3834487504f4fc00$var$globalCooldownTimeout) {
1914
+ clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1915
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1916
+ }
1917
+ };
1918
+ let hideTooltip = (immediate) => {
1919
+ if (immediate || closeDelay <= 0) {
1920
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1921
+ closeTimeout.current = null;
1922
+ closeCallback.current();
1923
+ } else if (!closeTimeout.current) closeTimeout.current = setTimeout(() => {
1924
+ closeTimeout.current = null;
1925
+ closeCallback.current();
1926
+ }, closeDelay);
1927
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1928
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1929
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1930
+ }
1931
+ if ($3834487504f4fc00$var$globalWarmedUp) {
1932
+ if ($3834487504f4fc00$var$globalCooldownTimeout) clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1933
+ $3834487504f4fc00$var$globalCooldownTimeout = setTimeout(() => {
1934
+ delete $3834487504f4fc00$var$tooltips[id];
1935
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1936
+ $3834487504f4fc00$var$globalWarmedUp = false;
1937
+ }, Math.max($3834487504f4fc00$var$TOOLTIP_COOLDOWN, closeDelay));
1938
+ }
1939
+ };
1940
+ let warmupTooltip = () => {
1941
+ closeOpenTooltips();
1942
+ ensureTooltipEntry();
1943
+ if (!isOpen && !$3834487504f4fc00$var$globalWarmedUp) {
1944
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1945
+ $3834487504f4fc00$var$globalWarmUpTimeout = setTimeout(() => {
1946
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1947
+ $3834487504f4fc00$var$globalWarmedUp = true;
1948
+ showTooltip();
1949
+ }, delay);
1950
+ } else if (!isOpen) showTooltip();
1951
+ };
1952
+ (0, $auOuY$useEffect)(() => {
1953
+ closeCallback.current = close;
1954
+ }, [
1955
+ close
1956
+ ]);
1957
+ (0, $auOuY$useEffect)(() => {
1958
+ return () => {
1959
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1960
+ let tooltip = $3834487504f4fc00$var$tooltips[id];
1961
+ if (tooltip) delete $3834487504f4fc00$var$tooltips[id];
1962
+ };
1963
+ }, [
1964
+ id
1965
+ ]);
1966
+ return {
1967
+ isOpen,
1968
+ open: (immediate) => {
1969
+ if (!immediate && delay > 0 && !closeTimeout.current) warmupTooltip();
1970
+ else showTooltip();
1971
+ },
1972
+ close: hideTooltip
1973
+ };
1974
+ }
1975
+
1976
+ // ../../node_modules/react-stately/dist/private/tree/TreeCollection.mjs
1977
+ var $df1fcc684d3b021a$export$863faf230ee2118a = class {
1978
+ constructor(nodes, { expandedKeys } = {}) {
1979
+ this.keyMap = /* @__PURE__ */ new Map();
1980
+ this.firstKey = null;
1981
+ this.lastKey = null;
1982
+ this.iterable = nodes;
1983
+ expandedKeys = expandedKeys || /* @__PURE__ */ new Set();
1984
+ let visit = (node) => {
1985
+ this.keyMap.set(node.key, node);
1986
+ if (node.childNodes && (node.type === "section" || expandedKeys.has(node.key))) for (let child of node.childNodes) visit(child);
1987
+ };
1988
+ for (let node of nodes) visit(node);
1989
+ let last = null;
1990
+ let index = 0;
1991
+ for (let [key, node] of this.keyMap) {
1992
+ if (last) {
1993
+ last.nextKey = key;
1994
+ node.prevKey = last.key;
1995
+ } else {
1996
+ this.firstKey = key;
1997
+ node.prevKey = void 0;
1998
+ }
1999
+ if (node.type === "item") node.index = index++;
2000
+ last = node;
2001
+ last.nextKey = void 0;
2002
+ }
2003
+ this.lastKey = last?.key ?? null;
2004
+ }
2005
+ *[Symbol.iterator]() {
2006
+ yield* this.iterable;
2007
+ }
2008
+ get size() {
2009
+ return this.keyMap.size;
2010
+ }
2011
+ getKeys() {
2012
+ return this.keyMap.keys();
2013
+ }
2014
+ getKeyBefore(key) {
2015
+ let node = this.keyMap.get(key);
2016
+ return node ? node.prevKey ?? null : null;
2017
+ }
2018
+ getKeyAfter(key) {
2019
+ let node = this.keyMap.get(key);
2020
+ return node ? node.nextKey ?? null : null;
2021
+ }
2022
+ getFirstKey() {
2023
+ return this.firstKey;
2024
+ }
2025
+ getLastKey() {
2026
+ return this.lastKey;
2027
+ }
2028
+ getItem(key) {
2029
+ return this.keyMap.get(key) ?? null;
2030
+ }
2031
+ at(idx) {
2032
+ const keys = [
2033
+ ...this.getKeys()
2034
+ ];
2035
+ return this.getItem(keys[idx]);
2036
+ }
2037
+ };
2038
+
2039
+ // ../../node_modules/react-stately/dist/private/tree/useTreeState.mjs
2040
+ import { useMemo as $aXIpm$useMemo, useCallback as $aXIpm$useCallback, useEffect as $aXIpm$useEffect } from "react";
2041
+ function $6b915bde6cd300dd$export$728d6ba534403756(props) {
2042
+ let { onExpandedChange } = props;
2043
+ let [expandedKeys, setExpandedKeys] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.expandedKeys ? new Set(props.expandedKeys) : void 0, props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : /* @__PURE__ */ new Set(), onExpandedChange);
2044
+ let selectionState = (0, $60f19cefd567a3e4$export$253fe78d46329472)(props);
2045
+ let disabledKeys = (0, $aXIpm$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
2046
+ props.disabledKeys
2047
+ ]);
2048
+ let tree = (0, $d03379b88399b8c5$export$6cd28814d92fa9c9)(props, (0, $aXIpm$useCallback)((nodes) => new (0, $df1fcc684d3b021a$export$863faf230ee2118a)(nodes, {
2049
+ expandedKeys
2050
+ }), [
2051
+ expandedKeys
2052
+ ]), null);
2053
+ (0, $aXIpm$useEffect)(() => {
2054
+ if (selectionState.focusedKey != null && !tree.getItem(selectionState.focusedKey)) selectionState.setFocusedKey(null);
2055
+ }, [
2056
+ tree,
2057
+ selectionState.focusedKey
2058
+ ]);
2059
+ let onToggle = (key) => {
2060
+ setExpandedKeys($6b915bde6cd300dd$var$toggleKey(expandedKeys, key));
2061
+ };
2062
+ return {
2063
+ collection: tree,
2064
+ expandedKeys,
2065
+ disabledKeys,
2066
+ toggleKey: onToggle,
2067
+ setExpandedKeys,
2068
+ selectionManager: new (0, $4a07ac835f260f78$export$6c8a5aaad13c9852)(tree, selectionState)
2069
+ };
2070
+ }
2071
+ function $6b915bde6cd300dd$var$toggleKey(set, key) {
2072
+ let res = new Set(set);
2073
+ if (res.has(key)) res.delete(key);
2074
+ else res.add(key);
2075
+ return res;
2076
+ }
2077
+
2078
+ // src/components/Tooltip/Tooltip.tsx
2079
+ import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
2080
+ var FLIP = {
2081
+ top: "bottom",
2082
+ bottom: "top",
2083
+ left: "right",
2084
+ right: "left"
2085
+ };
2086
+ function placeOn(rect, tipRect, position, offset) {
2087
+ const cx = rect.left + rect.width / 2;
2088
+ const cy = rect.top + rect.height / 2;
2089
+ switch (position) {
2090
+ case "top":
2091
+ return {
2092
+ top: rect.top - tipRect.height - offset,
2093
+ left: cx - tipRect.width / 2
2094
+ };
2095
+ case "bottom":
2096
+ return { top: rect.bottom + offset, left: cx - tipRect.width / 2 };
2097
+ case "left":
2098
+ return {
2099
+ top: cy - tipRect.height / 2,
2100
+ left: rect.left - tipRect.width - offset
2101
+ };
2102
+ case "right":
2103
+ return { top: cy - tipRect.height / 2, left: rect.right + offset };
2104
+ }
2105
+ }
2106
+ function computePosition(rect, tipRect, position, offset, viewport) {
2107
+ const tryAt = (p) => {
2108
+ const c = placeOn(rect, tipRect, p, offset);
2109
+ const fits = c.top >= 0 && c.left >= 0 && c.top + tipRect.height <= viewport.height && c.left + tipRect.width <= viewport.width;
2110
+ return { ...c, position: p, fits };
2111
+ };
2112
+ const preferred = tryAt(position);
2113
+ if (preferred.fits) return preferred;
2114
+ const flipped = tryAt(FLIP[position]);
2115
+ if (flipped.fits) return flipped;
2116
+ const fallback = preferred;
2117
+ const clampedLeft = Math.max(4, Math.min(fallback.left, viewport.width - tipRect.width - 4));
2118
+ const clampedTop = Math.max(4, Math.min(fallback.top, viewport.height - tipRect.height - 4));
2119
+ return { top: clampedTop, left: clampedLeft, position: fallback.position };
2120
+ }
2121
+ var animVariants = {
2122
+ top: { initial: { opacity: 0, y: 4 }, animate: { opacity: 1, y: 0 } },
2123
+ bottom: { initial: { opacity: 0, y: -4 }, animate: { opacity: 1, y: 0 } },
2124
+ left: { initial: { opacity: 0, x: 4 }, animate: { opacity: 1, x: 0 } },
2125
+ right: { initial: { opacity: 0, x: -4 }, animate: { opacity: 1, x: 0 } }
2126
+ };
2127
+ function TooltipContent({
2128
+ state,
2129
+ content,
2130
+ position,
2131
+ triggerRef,
2132
+ className,
2133
+ offset,
2134
+ tooltipId
2135
+ }) {
2136
+ const { tooltipProps } = useTooltip({ isOpen: state.isOpen }, state);
2137
+ const tipRef = useRef3(null);
2138
+ const [coords, setCoords] = useState2(null);
2139
+ const reposition = useCallback2(() => {
2140
+ if (!triggerRef.current || !tipRef.current) return;
2141
+ const trigRect = triggerRef.current.getBoundingClientRect();
2142
+ const tipRect = tipRef.current.getBoundingClientRect();
2143
+ const viewport = {
2144
+ width: window.innerWidth || document.documentElement.clientWidth,
2145
+ height: window.innerHeight || document.documentElement.clientHeight
2146
+ };
2147
+ setCoords(computePosition(trigRect, tipRect, position, offset, viewport));
2148
+ }, [triggerRef, position, offset]);
2149
+ useLayoutEffect(() => {
2150
+ if (!state.isOpen) return;
2151
+ reposition();
2152
+ const id = requestAnimationFrame(reposition);
2153
+ return () => cancelAnimationFrame(id);
2154
+ }, [state.isOpen, reposition]);
2155
+ useEffect(() => {
2156
+ if (!state.isOpen) return;
2157
+ const handler = () => reposition();
2158
+ window.addEventListener("scroll", handler, true);
2159
+ window.addEventListener("resize", handler);
2160
+ return () => {
2161
+ window.removeEventListener("scroll", handler, true);
2162
+ window.removeEventListener("resize", handler);
2163
+ };
2164
+ }, [state.isOpen, reposition]);
2165
+ const resolvedPos = coords?.position ?? position;
2166
+ const variants = animVariants[resolvedPos];
2167
+ const {
2168
+ onDrag: _onDrag,
2169
+ onDragStart: _onDragStart,
2170
+ onDragEnd: _onDragEnd,
2171
+ onAnimationStart: _onAnimationStart,
2172
+ ...safeTipProps
2173
+ } = tooltipProps;
2174
+ const portalContent = /* @__PURE__ */ jsx4(AnimatePresence2, { children: state.isOpen && /* @__PURE__ */ jsx4(
2175
+ "div",
2176
+ {
2177
+ className: "ods-tooltip__wrapper",
2178
+ style: {
2179
+ position: "fixed",
2180
+ zIndex: 1500,
2181
+ top: coords?.top ?? -9999,
2182
+ left: coords?.left ?? -9999,
2183
+ visibility: coords ? "visible" : "hidden",
2184
+ pointerEvents: "none"
2185
+ },
2186
+ children: /* @__PURE__ */ jsxs4(
2187
+ motion3.div,
2188
+ {
2189
+ ref: tipRef,
2190
+ ...safeTipProps,
2191
+ id: tooltipId,
2192
+ role: "tooltip",
2193
+ "data-position": resolvedPos,
2194
+ className: cn("ods-tooltip", className),
2195
+ initial: variants.initial,
2196
+ animate: variants.animate,
2197
+ exit: { opacity: 0 },
2198
+ transition: { duration: 0.15, ease: "easeOut" },
2199
+ children: [
2200
+ content,
2201
+ /* @__PURE__ */ jsx4("span", { className: "ods-tooltip__arrow", "aria-hidden": "true" })
2202
+ ]
2203
+ }
2204
+ )
2205
+ }
2206
+ ) });
2207
+ if (typeof document === "undefined") return null;
2208
+ return createPortal(portalContent, document.body);
2209
+ }
2210
+ function mergeRefs(...refs) {
2211
+ return (node) => {
2212
+ for (const r of refs) {
2213
+ if (!r) continue;
2214
+ if (typeof r === "function") r(node);
2215
+ else r.current = node;
2216
+ }
2217
+ };
2218
+ }
2219
+ function mergeHandler(childHandler, ariaHandler) {
2220
+ if (!childHandler && !ariaHandler) return void 0;
2221
+ return (e) => {
2222
+ childHandler?.(e);
2223
+ if (!e.defaultPrevented) ariaHandler?.(e);
2224
+ };
2225
+ }
2226
+ function Tooltip({
2227
+ content,
2228
+ position = "top",
2229
+ delay = 200,
2230
+ offset = 8,
2231
+ disabled = false,
2232
+ id: providedId,
2233
+ children,
2234
+ className
2235
+ }) {
2236
+ const reactId = useId3();
2237
+ const tooltipId = providedId ?? `ods-tooltip-${reactId}`;
2238
+ const triggerRef = useRef3(null);
2239
+ const state = $3834487504f4fc00$export$4d40659c25ecb50b({ delay });
2240
+ const { triggerProps } = useTooltipTrigger({ delay, isDisabled: disabled }, state, triggerRef);
2241
+ if (!isValidElement3(children)) {
2242
+ return /* @__PURE__ */ jsx4(Fragment, { children });
2243
+ }
2244
+ const childProps = children.props;
2245
+ const childRef = childProps.ref ?? children.ref;
2246
+ const merged = { ...childProps };
2247
+ for (const [key, value] of Object.entries(triggerProps)) {
2248
+ if (key.startsWith("on") && typeof value === "function") {
2249
+ merged[key] = mergeHandler(childProps[key], value);
2250
+ } else {
2251
+ merged[key] = value;
2252
+ }
2253
+ }
2254
+ merged.ref = mergeRefs(triggerRef, childRef);
2255
+ merged["aria-describedby"] = [childProps["aria-describedby"], tooltipId].filter(Boolean).join(" ");
2256
+ return /* @__PURE__ */ jsxs4(Fragment, { children: [
2257
+ cloneElement2(children, merged),
2258
+ !disabled && /* @__PURE__ */ jsx4(
2259
+ TooltipContent,
2260
+ {
2261
+ state,
2262
+ content,
2263
+ position,
2264
+ triggerRef,
2265
+ offset,
2266
+ className,
2267
+ tooltipId
2268
+ }
2269
+ )
2270
+ ] });
2271
+ }
2272
+ Tooltip.displayName = "Tooltip";
2273
+
2274
+ // src/components/Select/Select.tsx
2275
+ import { CheckmarkIcon, ChevronDownIcon as ChevronDownIcon2 } from "@octaviaflow/icons";
2276
+ import { AnimatePresence as AnimatePresence3, motion as motion4 } from "framer-motion";
2277
+ import {
2278
+ forwardRef as forwardRef5,
2279
+ useCallback as useCallback3,
2280
+ useEffect as useEffect2,
2281
+ useId as useId4,
2282
+ useMemo,
2283
+ useRef as useRef4,
2284
+ useState as useState3
2285
+ } from "react";
2286
+ import { HiddenSelect, useButton as useButton2, useListBox, useOption, useSelect } from "react-aria";
2287
+ import { createPortal as createPortal2 } from "react-dom";
2288
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2289
+ function OverflowTooltip({
2290
+ enabled,
2291
+ content,
2292
+ children
2293
+ }) {
2294
+ if (!enabled || content == null || content === "") return children;
2295
+ return /* @__PURE__ */ jsx5(Tooltip, { content, children });
2296
+ }
2297
+ function ListBox(props) {
2298
+ const ref = useRef4(null);
2299
+ const { listBoxRef = ref, state, showCheckmark, showOverflowTooltips } = props;
2300
+ const { listBoxProps } = useListBox(props, state, listBoxRef);
2301
+ return /* @__PURE__ */ jsx5("ul", { ...listBoxProps, ref: listBoxRef, className: "ods-select__options", children: [...state.collection].map((item) => /* @__PURE__ */ jsx5(
2302
+ Option,
2303
+ {
2304
+ item,
2305
+ state,
2306
+ showCheckmark,
2307
+ showOverflowTooltips
2308
+ },
2309
+ item.key
2310
+ )) });
2311
+ }
2312
+ function Option({
2313
+ item,
2314
+ state,
2315
+ showCheckmark,
2316
+ showOverflowTooltips
2317
+ }) {
2318
+ const ref = useRef4(null);
2319
+ const { optionProps, isSelected, isFocused, isDisabled } = useOption(
2320
+ { key: item.key },
2321
+ state,
2322
+ ref
2323
+ );
2324
+ const raw = item.value;
2325
+ const option = raw?.value ?? raw;
2326
+ const tooltipContent = option?.description ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
2327
+ /* @__PURE__ */ jsx5("span", { children: option.label }),
2328
+ /* @__PURE__ */ jsx5("br", {}),
2329
+ /* @__PURE__ */ jsx5("span", { style: { opacity: 0.75 }, children: option.description })
2330
+ ] }) : option?.label;
2331
+ return /* @__PURE__ */ jsx5(OverflowTooltip, { enabled: !!showOverflowTooltips, content: tooltipContent, children: /* @__PURE__ */ jsxs5(
2332
+ "li",
2333
+ {
2334
+ ...optionProps,
2335
+ ref,
2336
+ className: cn(
2337
+ "ods-select__option",
2338
+ isFocused && "ods-select__option--highlighted",
2339
+ isSelected && "ods-select__option--selected",
2340
+ isDisabled && "ods-select__option--disabled"
2341
+ ),
2342
+ children: [
2343
+ option?.icon && /* @__PURE__ */ jsx5("span", { className: "ods-select__option-icon", children: option.icon }),
2344
+ /* @__PURE__ */ jsxs5("span", { className: "ods-select__option-text", children: [
2345
+ /* @__PURE__ */ jsx5("span", { className: "ods-select__option-label", children: item.rendered }),
2346
+ option?.description && /* @__PURE__ */ jsx5("span", { className: "ods-select__option-desc", children: option.description })
2347
+ ] }),
2348
+ isSelected && showCheckmark && /* @__PURE__ */ jsx5("span", { className: "ods-select__check", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(CheckmarkIcon, { size: "xs", tone: "accent" }) })
2349
+ ]
2350
+ }
2351
+ ) });
2352
+ }
2353
+ var DEFAULT_SELECT_PLACEHOLDER = "Select an option...";
2354
+ var Select = forwardRef5(function Select2({
2355
+ options,
2356
+ value,
2357
+ defaultValue,
2358
+ onChange,
2359
+ placeholder = DEFAULT_SELECT_PLACEHOLDER,
2360
+ searchable = false,
2361
+ label,
2362
+ error = false,
2363
+ errorMessage,
2364
+ helperText,
2365
+ disabled = false,
2366
+ size = "md",
2367
+ className,
2368
+ name,
2369
+ required,
2370
+ id: providedId,
2371
+ form,
2372
+ autoFocus,
2373
+ "aria-label": ariaLabel,
2374
+ "aria-labelledby": ariaLabelledBy,
2375
+ "aria-describedby": consumerDescribedBy,
2376
+ showCheckmark = false,
2377
+ closeOnOutsideClick = true,
2378
+ showOverflowTooltips = false,
2379
+ dropdownMinWidth
2380
+ }, forwardedRef) {
2381
+ const triggerRef = useRef4(null);
2382
+ const listBoxRef = useRef4(null);
2383
+ const dropdownRef = useRef4(null);
2384
+ const searchRef = useRef4(null);
2385
+ const [searchQuery, setSearchQuery] = useState3("");
2386
+ const [dropdownPos, setDropdownPos] = useState3({ left: 0, width: 0, maxHeight: 240, direction: "down" });
2387
+ const setTriggerRef = (node) => {
2388
+ triggerRef.current = node;
2389
+ if (typeof forwardedRef === "function") forwardedRef(node);
2390
+ else if (forwardedRef) forwardedRef.current = node;
2391
+ };
2392
+ const reactId = useId4();
2393
+ const baseId = providedId ?? `ods-select-${reactId}`;
2394
+ const hintId = error || helperText ? `${baseId}-hint` : void 0;
2395
+ const describedBy = [consumerDescribedBy, hintId].filter(Boolean).join(" ") || void 0;
2396
+ const filteredOptions = useMemo(() => {
2397
+ if (!searchable || !searchQuery) return options;
2398
+ const q = searchQuery.toLowerCase();
2399
+ return options.filter(
2400
+ (o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q)
2401
+ );
2402
+ }, [options, searchQuery, searchable]);
2403
+ const ariaNameProps = useMemo(
2404
+ () => resolveAccessibleName({
2405
+ label,
2406
+ ariaLabel,
2407
+ ariaLabelledby: ariaLabelledBy,
2408
+ componentName: "Select",
2409
+ fallbacks: [
2410
+ placeholder && placeholder !== DEFAULT_SELECT_PLACEHOLDER ? placeholder : void 0
2411
+ ]
2412
+ }),
2413
+ [label, ariaLabel, ariaLabelledBy, placeholder]
2414
+ );
2415
+ const ariaProps = useMemo(() => {
2416
+ const items = filteredOptions.map((o) => ({
2417
+ key: o.value,
2418
+ label: o.label,
2419
+ value: o,
2420
+ isDisabled: o.disabled
2421
+ }));
2422
+ const props = {
2423
+ // Visible string label when present; otherwise rely on the aria-*
2424
+ // props for screen-reader name.
2425
+ label: typeof label === "string" ? label : void 0,
2426
+ ...ariaNameProps,
2427
+ items,
2428
+ children: (item) => /* @__PURE__ */ jsx5($05678f3aee5e7d1a$export$6d08773d2e66f8f2, { textValue: item.label, children: item.label }, item.key),
2429
+ isDisabled: disabled,
2430
+ onSelectionChange: (key) => {
2431
+ onChange?.(String(key));
2432
+ setSearchQuery("");
2433
+ }
2434
+ };
2435
+ if (value !== void 0) {
2436
+ props.selectedKey = value;
2437
+ }
2438
+ if (defaultValue !== void 0) {
2439
+ props.defaultSelectedKey = defaultValue;
2440
+ }
2441
+ return props;
2442
+ }, [filteredOptions, label, disabled, value, defaultValue, onChange, ariaNameProps]);
2443
+ const state = $29256f53a2edafe9$export$5159ec8b34d4ec12(ariaProps);
2444
+ const { triggerProps, menuProps } = useSelect(ariaProps, state, triggerRef);
2445
+ const { buttonProps } = useButton2(triggerProps, triggerRef);
2446
+ const updatePosition = useCallback3(() => {
2447
+ if (!triggerRef.current) return;
2448
+ const rect = triggerRef.current.getBoundingClientRect();
2449
+ const viewportH = window.innerHeight;
2450
+ const margin = 8;
2451
+ const gap = 4;
2452
+ const spaceBelow = viewportH - rect.bottom - gap - margin;
2453
+ const spaceAbove = rect.top - gap - margin;
2454
+ const PREFERRED_MIN = 200;
2455
+ const openUp = spaceBelow < PREFERRED_MIN && spaceAbove > spaceBelow;
2456
+ setDropdownPos({
2457
+ ...openUp ? { bottom: viewportH - rect.top + gap } : { top: rect.bottom + gap },
2458
+ left: rect.left,
2459
+ width: rect.width,
2460
+ maxHeight: Math.max(120, openUp ? spaceAbove : spaceBelow),
2461
+ direction: openUp ? "up" : "down"
2462
+ });
2463
+ }, []);
2464
+ useEffect2(() => {
2465
+ if (state.isOpen) {
2466
+ updatePosition();
2467
+ window.addEventListener("scroll", updatePosition, true);
2468
+ window.addEventListener("resize", updatePosition);
2469
+ return () => {
2470
+ window.removeEventListener("scroll", updatePosition, true);
2471
+ window.removeEventListener("resize", updatePosition);
2472
+ };
2473
+ }
2474
+ }, [state.isOpen, updatePosition]);
2475
+ useEffect2(() => {
2476
+ if (state.isOpen && searchable && searchRef.current) {
2477
+ requestAnimationFrame(() => searchRef.current?.focus());
2478
+ }
2479
+ }, [state.isOpen, searchable]);
2480
+ useEffect2(() => {
2481
+ if (!state.isOpen || !closeOnOutsideClick) return;
2482
+ const onPointer = (e) => {
2483
+ const target = e.target;
2484
+ if (dropdownRef.current?.contains(target)) return;
2485
+ if (triggerRef.current?.contains(target)) return;
2486
+ state.close();
2487
+ };
2488
+ const onKey = (e) => {
2489
+ if (e.key === "Escape") state.close();
2490
+ };
2491
+ document.addEventListener("mousedown", onPointer);
2492
+ document.addEventListener("keydown", onKey);
2493
+ return () => {
2494
+ document.removeEventListener("mousedown", onPointer);
2495
+ document.removeEventListener("keydown", onKey);
2496
+ };
2497
+ }, [state.isOpen, state.close, closeOnOutsideClick]);
2498
+ const selectedOption = options.find((o) => o.value === String(state.selectedKey ?? ""));
2499
+ const wasOpenBeforePressRef = useRef4(false);
2500
+ const handleTriggerPointerDown = (e) => {
2501
+ wasOpenBeforePressRef.current = state.isOpen;
2502
+ const baseHandler = buttonProps.onPointerDown;
2503
+ baseHandler?.(e);
2504
+ };
2505
+ const handleTriggerClick = (e) => {
2506
+ const baseHandler = buttonProps.onClick;
2507
+ baseHandler?.(e);
2508
+ if (wasOpenBeforePressRef.current && state.isOpen) {
2509
+ state.close();
2510
+ }
2511
+ wasOpenBeforePressRef.current = false;
2512
+ };
2513
+ return /* @__PURE__ */ jsxs5(
2514
+ "div",
2515
+ {
2516
+ className: cn(
2517
+ "ods-select",
2518
+ `ods-select--${size}`,
2519
+ error && "ods-select--error",
2520
+ disabled && "ods-select--disabled",
2521
+ className
2522
+ ),
2523
+ children: [
2524
+ label && /* @__PURE__ */ jsx5("label", { className: "ods-select__label", htmlFor: baseId, children: label }),
2525
+ /* @__PURE__ */ jsx5(HiddenSelect, { state, triggerRef, label, name }),
2526
+ /* @__PURE__ */ jsxs5(
2527
+ "button",
2528
+ {
2529
+ ...buttonProps,
2530
+ onPointerDown: handleTriggerPointerDown,
2531
+ onClick: handleTriggerClick,
2532
+ ref: setTriggerRef,
2533
+ id: baseId,
2534
+ form,
2535
+ autoFocus,
2536
+ "aria-label": ariaLabel,
2537
+ "aria-labelledby": ariaLabelledBy,
2538
+ "aria-describedby": describedBy,
2539
+ "aria-required": required || void 0,
2540
+ "aria-invalid": error ? true : void 0,
2541
+ className: cn("ods-select__trigger", state.isOpen && "ods-select__trigger--open"),
2542
+ children: [
2543
+ /* @__PURE__ */ jsx5("span", { className: "ods-select__value", children: selectedOption ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
2544
+ selectedOption.icon && /* @__PURE__ */ jsx5("span", { className: "ods-select__value-icon", children: selectedOption.icon }),
2545
+ selectedOption.label
2546
+ ] }) : /* @__PURE__ */ jsx5("span", { className: "ods-select__placeholder", children: placeholder }) }),
2547
+ /* @__PURE__ */ jsx5(
2548
+ "span",
2549
+ {
2550
+ className: cn("ods-select__chevron", state.isOpen && "ods-select__chevron--open"),
2551
+ "aria-hidden": "true",
2552
+ children: /* @__PURE__ */ jsx5(ChevronDownIcon2, { size: "xs" })
2553
+ }
2554
+ )
2555
+ ]
2556
+ }
2557
+ ),
2558
+ typeof document !== "undefined" && createPortal2(
2559
+ /* @__PURE__ */ jsx5(AnimatePresence3, { children: state.isOpen && /* @__PURE__ */ jsxs5(
2560
+ motion4.div,
2561
+ {
2562
+ ref: dropdownRef,
2563
+ "data-ods-floating": "",
2564
+ className: "ods-select__dropdown",
2565
+ style: {
2566
+ position: "fixed",
2567
+ ...dropdownPos.top !== void 0 && { top: dropdownPos.top },
2568
+ ...dropdownPos.bottom !== void 0 && { bottom: dropdownPos.bottom },
2569
+ left: dropdownPos.left,
2570
+ // `minWidth` (not `width`) keeps the popover at
2571
+ // least as wide as the trigger — preserves visual
2572
+ // alignment — but allows the consumer to widen it
2573
+ // explicitly when option labels demand more room
2574
+ // (pass `dropdownMinWidth` to set a higher floor).
2575
+ // Avoids the previous `max-content` recipe which
2576
+ // made the popover grow uncomfortably wide on
2577
+ // searchable / long-option menus.
2578
+ minWidth: Math.max(dropdownPos.width, dropdownMinWidth ?? 0),
2579
+ // Bound the popover to the available viewport edge so
2580
+ // it never spills off-screen on tall pages. Pairs with
2581
+ // `overflow-y: auto` from the .ods-select__dropdown
2582
+ // SCSS so long option lists scroll internally.
2583
+ maxHeight: dropdownPos.maxHeight
2584
+ },
2585
+ initial: { opacity: 0, scale: 0.95 },
2586
+ animate: { opacity: 1, scale: 1 },
2587
+ exit: { opacity: 0, scale: 0.95 },
2588
+ transition: { duration: 0.2, ease: [0.16, 1, 0.3, 1] },
2589
+ children: [
2590
+ searchable && /* @__PURE__ */ jsx5("div", { className: "ods-select__search-wrap", children: /* @__PURE__ */ jsx5(
2591
+ "input",
2592
+ {
2593
+ ref: searchRef,
2594
+ className: "ods-select__search",
2595
+ type: "text",
2596
+ placeholder: "Search...",
2597
+ value: searchQuery,
2598
+ onChange: (e) => setSearchQuery(e.target.value),
2599
+ "aria-label": "Search options",
2600
+ onKeyDown: (e) => {
2601
+ if (e.key === "Escape") {
2602
+ state.close();
2603
+ }
2604
+ }
2605
+ }
2606
+ ) }),
2607
+ /* @__PURE__ */ jsx5(
2608
+ ListBox,
2609
+ {
2610
+ ...menuProps,
2611
+ listBoxRef,
2612
+ state,
2613
+ showCheckmark,
2614
+ showOverflowTooltips
2615
+ }
2616
+ ),
2617
+ filteredOptions.length === 0 && /* @__PURE__ */ jsx5("div", { className: "ods-select__empty", children: "No results found" })
2618
+ ]
2619
+ }
2620
+ ) }),
2621
+ document.body
2622
+ ),
2623
+ error && errorMessage ? /* @__PURE__ */ jsx5("span", { id: hintId, className: "ods-select__error", role: "alert", children: errorMessage }) : helperText ? /* @__PURE__ */ jsx5("span", { id: hintId, className: "ods-select__hint", children: helperText }) : null
2624
+ ]
2625
+ }
2626
+ );
2627
+ });
2628
+ Select.displayName = "Select";
2629
+
2630
+ // src/components/Spinner/Spinner.tsx
2631
+ import { forwardRef as forwardRef6 } from "react";
2632
+ import { jsx as jsx6 } from "react/jsx-runtime";
2633
+ var SIZE_PX = {
2634
+ sm: 16,
2635
+ md: 24,
2636
+ lg: 32,
2637
+ xl: 48
2638
+ };
2639
+ var Spinner = forwardRef6(function Spinner2({ size = "md", tone = "accent", label = "Loading", className, style, ...rest }, ref) {
2640
+ const px = typeof size === "number" ? size : SIZE_PX[size];
2641
+ const isKeyword = typeof size === "string";
2642
+ return /* @__PURE__ */ jsx6(
2643
+ "svg",
2644
+ {
2645
+ ...rest,
2646
+ ref,
2647
+ className: cn(
2648
+ "ods-spinner",
2649
+ isKeyword && `ods-spinner--${size}`,
2650
+ `ods-spinner--${tone}`,
2651
+ className
2652
+ ),
2653
+ width: px,
2654
+ height: px,
2655
+ viewBox: "0 0 24 24",
2656
+ fill: "none",
2657
+ role: "status",
2658
+ "aria-label": label,
2659
+ style,
2660
+ children: /* @__PURE__ */ jsx6(
2661
+ "circle",
2662
+ {
2663
+ cx: "12",
2664
+ cy: "12",
2665
+ r: "10",
2666
+ strokeWidth: "3",
2667
+ strokeLinecap: "round",
2668
+ strokeDasharray: "31.4 31.4",
2669
+ className: "ods-spinner__circle"
2670
+ }
2671
+ )
2672
+ }
2673
+ );
2674
+ });
2675
+ Spinner.displayName = "Spinner";
2676
+
2677
+ export {
2678
+ Accordion,
2679
+ Slot,
2680
+ $05678f3aee5e7d1a$export$6d08773d2e66f8f2,
2681
+ $e3403870bfb691da$export$79fefeb1c2091ac3,
2682
+ $384704861d32dbed$export$bca9d026f8e704eb,
2683
+ $caeb030f09a278a1$export$4ba071daf4e486,
2684
+ $fd3c5e01e837dc20$export$8042c6c013fd5226,
2685
+ $6b915bde6cd300dd$export$728d6ba534403756,
2686
+ getRenderableText,
2687
+ resolveAccessibleName,
2688
+ Button,
2689
+ Input,
2690
+ Tooltip,
2691
+ Select,
2692
+ Spinner
2693
+ };
2694
+ //# sourceMappingURL=chunk-75JAQ4ZG.js.map