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

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 (92) hide show
  1. package/dist/chunk-23K2RF7Z.js +2694 -0
  2. package/dist/chunk-23K2RF7Z.js.map +1 -0
  3. package/dist/chunk-H3FCGN4P.js +6628 -0
  4. package/dist/chunk-H3FCGN4P.js.map +1 -0
  5. package/dist/chunk-ISJSOF3Z.js +3646 -0
  6. package/dist/chunk-ISJSOF3Z.js.map +1 -0
  7. package/dist/chunk-KSIZ7DLS.js +3582 -0
  8. package/dist/chunk-KSIZ7DLS.js.map +1 -0
  9. package/dist/chunk-NAG3EFQ6.js +6789 -0
  10. package/dist/chunk-NAG3EFQ6.js.map +1 -0
  11. package/dist/chunk-NMZWNZV7.js +1547 -0
  12. package/dist/chunk-NMZWNZV7.js.map +1 -0
  13. package/dist/chunk-QWOH2E3F.js +3189 -0
  14. package/dist/chunk-QWOH2E3F.js.map +1 -0
  15. package/dist/chunk-V22HCPVO.js +2856 -0
  16. package/dist/chunk-V22HCPVO.js.map +1 -0
  17. package/dist/chunk-VGAUSBP4.js +3181 -0
  18. package/dist/chunk-VGAUSBP4.js.map +1 -0
  19. package/dist/chunk-WTIM6E4X.js +3677 -0
  20. package/dist/chunk-WTIM6E4X.js.map +1 -0
  21. package/dist/chunk-XUBJHPJT.js +3680 -0
  22. package/dist/chunk-XUBJHPJT.js.map +1 -0
  23. package/dist/components/AgentCard/AgentCard.d.ts.map +1 -1
  24. package/dist/components/AssistantAura/AssistantAura.d.ts +21 -0
  25. package/dist/components/AssistantAura/AssistantAura.d.ts.map +1 -0
  26. package/dist/components/AssistantAura/index.d.ts +2 -0
  27. package/dist/components/AssistantAura/index.d.ts.map +1 -0
  28. package/dist/components/AssistantConversation/AssistantConversation.d.ts +112 -0
  29. package/dist/components/AssistantConversation/AssistantConversation.d.ts.map +1 -0
  30. package/dist/components/AssistantConversation/assistant.fixtures.d.ts +29 -0
  31. package/dist/components/AssistantConversation/assistant.fixtures.d.ts.map +1 -0
  32. package/dist/components/AssistantConversation/assistantGlyphs.d.ts +13 -0
  33. package/dist/components/AssistantConversation/assistantGlyphs.d.ts.map +1 -0
  34. package/dist/components/AssistantConversation/index.d.ts +2 -0
  35. package/dist/components/AssistantConversation/index.d.ts.map +1 -0
  36. package/dist/components/AssistantDock/AssistantDock.d.ts +25 -0
  37. package/dist/components/AssistantDock/AssistantDock.d.ts.map +1 -0
  38. package/dist/components/AssistantDock/index.d.ts +2 -0
  39. package/dist/components/AssistantDock/index.d.ts.map +1 -0
  40. package/dist/components/AssistantOrb/AssistantOrb.d.ts +14 -0
  41. package/dist/components/AssistantOrb/AssistantOrb.d.ts.map +1 -0
  42. package/dist/components/AssistantOrb/explorations/OvaIconConcepts.d.ts +22 -0
  43. package/dist/components/AssistantOrb/explorations/OvaIconConcepts.d.ts.map +1 -0
  44. package/dist/components/AssistantOrb/index.d.ts +2 -0
  45. package/dist/components/AssistantOrb/index.d.ts.map +1 -0
  46. package/dist/components/AssistantTrigger/AssistantTrigger.d.ts +17 -0
  47. package/dist/components/AssistantTrigger/AssistantTrigger.d.ts.map +1 -0
  48. package/dist/components/AssistantTrigger/index.d.ts +2 -0
  49. package/dist/components/AssistantTrigger/index.d.ts.map +1 -0
  50. package/dist/components/ChatComposer/ChatComposer.d.ts +8 -0
  51. package/dist/components/ChatComposer/ChatComposer.d.ts.map +1 -1
  52. package/dist/components/ChatDocPreview/ChatDocPreview.d.ts +20 -0
  53. package/dist/components/ChatDocPreview/ChatDocPreview.d.ts.map +1 -0
  54. package/dist/components/ChatDocPreview/index.d.ts +2 -0
  55. package/dist/components/ChatDocPreview/index.d.ts.map +1 -0
  56. package/dist/components/ChatInputRequest/ChatInputRequest.d.ts +68 -0
  57. package/dist/components/ChatInputRequest/ChatInputRequest.d.ts.map +1 -0
  58. package/dist/components/ChatInputRequest/index.d.ts +2 -0
  59. package/dist/components/ChatInputRequest/index.d.ts.map +1 -0
  60. package/dist/components/ChatLinkPreview/ChatLinkPreview.d.ts +33 -0
  61. package/dist/components/ChatLinkPreview/ChatLinkPreview.d.ts.map +1 -0
  62. package/dist/components/ChatLinkPreview/index.d.ts +2 -0
  63. package/dist/components/ChatLinkPreview/index.d.ts.map +1 -0
  64. package/dist/components/ChatSources/ChatSources.d.ts +10 -1
  65. package/dist/components/ChatSources/ChatSources.d.ts.map +1 -1
  66. package/dist/components/ChatSources/index.d.ts +1 -1
  67. package/dist/components/ChatSources/index.d.ts.map +1 -1
  68. package/dist/components/ChatVideoPreview/ChatVideoPreview.d.ts +37 -0
  69. package/dist/components/ChatVideoPreview/ChatVideoPreview.d.ts.map +1 -0
  70. package/dist/components/ChatVideoPreview/index.d.ts +2 -0
  71. package/dist/components/ChatVideoPreview/index.d.ts.map +1 -0
  72. package/dist/components/TruncatedText/TruncatedText.d.ts +15 -0
  73. package/dist/components/TruncatedText/TruncatedText.d.ts.map +1 -0
  74. package/dist/components/TruncatedText/index.d.ts +2 -0
  75. package/dist/components/TruncatedText/index.d.ts.map +1 -0
  76. package/dist/index.cjs +7716 -6548
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.d.ts +10 -1
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +4742 -5654
  81. package/dist/index.js.map +1 -1
  82. package/dist/marketing/components/AssistantWidget/AssistantWidget.d.ts +60 -0
  83. package/dist/marketing/components/AssistantWidget/AssistantWidget.d.ts.map +1 -0
  84. package/dist/marketing/index.d.ts +1 -0
  85. package/dist/marketing/index.d.ts.map +1 -1
  86. package/dist/marketing.cjs +3710 -1196
  87. package/dist/marketing.cjs.map +1 -1
  88. package/dist/marketing.js +738 -482
  89. package/dist/marketing.js.map +1 -1
  90. package/dist/styles.css +1 -1
  91. package/dist/workflow.js +2 -2
  92. package/package.json +1 -1
@@ -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/Tooltip/Tooltip.tsx
164
+ import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
165
+ import {
166
+ cloneElement,
167
+ isValidElement,
168
+ useCallback as useCallback2,
169
+ useEffect,
170
+ useId as useId2,
171
+ useLayoutEffect,
172
+ useRef,
173
+ useState as useState2
174
+ } from "react";
175
+ import { useTooltip, useTooltipTrigger } from "react-aria";
176
+ import { createPortal } from "react-dom";
177
+
178
+ // ../../node_modules/react-stately/dist/private/utils/useControlledState.mjs
179
+ 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";
180
+ var $3e6197669829fe11$var$useEarlyEffect = typeof document !== "undefined" ? (0, $1CcWn$react)["useInsertionEffect"] ?? (0, $1CcWn$react).useLayoutEffect : () => {
181
+ };
182
+ function $3e6197669829fe11$export$40bfa8c7b0832715(value, defaultValue, onChange) {
183
+ let [stateValue, setStateValue] = (0, $1CcWn$useState)(value || defaultValue);
184
+ let valueRef = (0, $1CcWn$useRef)(stateValue);
185
+ let isControlledRef = (0, $1CcWn$useRef)(value !== void 0);
186
+ let isControlled = value !== void 0;
187
+ (0, $1CcWn$useEffect)(() => {
188
+ let wasControlled = isControlledRef.current;
189
+ if (wasControlled !== isControlled && process.env.NODE_ENV !== "production") console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
190
+ isControlledRef.current = isControlled;
191
+ }, [
192
+ isControlled
193
+ ]);
194
+ let currentValue = isControlled ? value : stateValue;
195
+ $3e6197669829fe11$var$useEarlyEffect(() => {
196
+ valueRef.current = currentValue;
197
+ });
198
+ let [, forceUpdate] = (0, $1CcWn$useReducer)(() => ({}), {});
199
+ let setValue = (0, $1CcWn$useCallback)((value2, ...args) => {
200
+ let newValue = typeof value2 === "function" ? value2(valueRef.current) : value2;
201
+ if (!Object.is(valueRef.current, newValue)) {
202
+ valueRef.current = newValue;
203
+ setStateValue(newValue);
204
+ forceUpdate();
205
+ onChange?.(newValue, ...args);
206
+ }
207
+ }, [
208
+ onChange
209
+ ]);
210
+ return [
211
+ currentValue,
212
+ setValue
213
+ ];
214
+ }
215
+
216
+ // ../../node_modules/react-stately/dist/private/form/useFormValidationState.mjs
217
+ 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";
218
+ var $fd2148440a13ec26$export$aca958c65c314e6c = {
219
+ badInput: false,
220
+ customError: false,
221
+ patternMismatch: false,
222
+ rangeOverflow: false,
223
+ rangeUnderflow: false,
224
+ stepMismatch: false,
225
+ tooLong: false,
226
+ tooShort: false,
227
+ typeMismatch: false,
228
+ valueMissing: false,
229
+ valid: true
230
+ };
231
+ var $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE = {
232
+ ...$fd2148440a13ec26$export$aca958c65c314e6c,
233
+ customError: true,
234
+ valid: false
235
+ };
236
+ var $fd2148440a13ec26$export$dad6ae84456c676a = {
237
+ isInvalid: false,
238
+ validationDetails: $fd2148440a13ec26$export$aca958c65c314e6c,
239
+ validationErrors: []
240
+ };
241
+ var $fd2148440a13ec26$export$571b5131b7e65c11 = (0, $8AuPP$createContext)({});
242
+ var $fd2148440a13ec26$export$a763b9476acd3eb = "__reactAriaFormValidationState";
243
+ function $fd2148440a13ec26$export$fc1a364ae1f3ff10(props) {
244
+ if (props[$fd2148440a13ec26$export$a763b9476acd3eb]) {
245
+ let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$fd2148440a13ec26$export$a763b9476acd3eb];
246
+ return {
247
+ realtimeValidation,
248
+ displayValidation,
249
+ updateValidation,
250
+ resetValidation,
251
+ commitValidation
252
+ };
253
+ }
254
+ return $fd2148440a13ec26$var$useFormValidationStateImpl(props);
255
+ }
256
+ function $fd2148440a13ec26$var$useFormValidationStateImpl(props) {
257
+ let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
258
+ if (validationState) isInvalid ||= validationState === "invalid";
259
+ let controlledError = isInvalid !== void 0 ? {
260
+ isInvalid,
261
+ validationErrors: [],
262
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
263
+ } : null;
264
+ let clientError = (0, $8AuPP$useMemo)(() => {
265
+ if (!validate || value == null) return null;
266
+ let validateErrors = $fd2148440a13ec26$var$runValidate(validate, value);
267
+ return $fd2148440a13ec26$var$getValidationResult(validateErrors);
268
+ }, [
269
+ validate,
270
+ value
271
+ ]);
272
+ if (builtinValidation?.validationDetails.valid) builtinValidation = void 0;
273
+ let serverErrors = (0, $8AuPP$useContext)($fd2148440a13ec26$export$571b5131b7e65c11);
274
+ let serverErrorMessages = (0, $8AuPP$useMemo)(() => {
275
+ if (name) return Array.isArray(name) ? name.flatMap((name2) => $fd2148440a13ec26$var$asArray(serverErrors[name2])) : $fd2148440a13ec26$var$asArray(serverErrors[name]);
276
+ return [];
277
+ }, [
278
+ serverErrors,
279
+ name
280
+ ]);
281
+ let [lastServerErrors, setLastServerErrors] = (0, $8AuPP$useState)(serverErrors);
282
+ let [isServerErrorCleared, setServerErrorCleared] = (0, $8AuPP$useState)(false);
283
+ if (serverErrors !== lastServerErrors) {
284
+ setLastServerErrors(serverErrors);
285
+ setServerErrorCleared(false);
286
+ }
287
+ let serverError = (0, $8AuPP$useMemo)(() => $fd2148440a13ec26$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
288
+ isServerErrorCleared,
289
+ serverErrorMessages
290
+ ]);
291
+ let nextValidation = (0, $8AuPP$useRef)($fd2148440a13ec26$export$dad6ae84456c676a);
292
+ let [currentValidity, setCurrentValidity] = (0, $8AuPP$useState)($fd2148440a13ec26$export$dad6ae84456c676a);
293
+ let lastError = (0, $8AuPP$useRef)($fd2148440a13ec26$export$dad6ae84456c676a);
294
+ let commitValidation = () => {
295
+ if (!commitQueued) return;
296
+ setCommitQueued(false);
297
+ let error = clientError || builtinValidation || nextValidation.current;
298
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
299
+ lastError.current = error;
300
+ setCurrentValidity(error);
301
+ }
302
+ };
303
+ let [commitQueued, setCommitQueued] = (0, $8AuPP$useState)(false);
304
+ (0, $8AuPP$useEffect)(commitValidation);
305
+ let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $fd2148440a13ec26$export$dad6ae84456c676a;
306
+ let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
307
+ return {
308
+ realtimeValidation,
309
+ displayValidation,
310
+ updateValidation(value2) {
311
+ if (validationBehavior === "aria" && !$fd2148440a13ec26$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
312
+ else nextValidation.current = value2;
313
+ },
314
+ resetValidation() {
315
+ let error = $fd2148440a13ec26$export$dad6ae84456c676a;
316
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
317
+ lastError.current = error;
318
+ setCurrentValidity(error);
319
+ }
320
+ if (validationBehavior === "native") setCommitQueued(false);
321
+ setServerErrorCleared(true);
322
+ },
323
+ commitValidation() {
324
+ if (validationBehavior === "native") setCommitQueued(true);
325
+ setServerErrorCleared(true);
326
+ }
327
+ };
328
+ }
329
+ function $fd2148440a13ec26$var$asArray(v) {
330
+ if (!v) return [];
331
+ return Array.isArray(v) ? v : [
332
+ v
333
+ ];
334
+ }
335
+ function $fd2148440a13ec26$var$runValidate(validate, value) {
336
+ if (typeof validate === "function") {
337
+ let e = validate(value);
338
+ if (e && typeof e !== "boolean") return $fd2148440a13ec26$var$asArray(e);
339
+ }
340
+ return [];
341
+ }
342
+ function $fd2148440a13ec26$var$getValidationResult(errors) {
343
+ return errors.length ? {
344
+ isInvalid: true,
345
+ validationErrors: errors,
346
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
347
+ } : null;
348
+ }
349
+ function $fd2148440a13ec26$var$isEqualValidation(a, b) {
350
+ if (a === b) return true;
351
+ 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);
352
+ }
353
+
354
+ // ../../node_modules/react-stately/dist/private/collections/getChildNodes.mjs
355
+ function $cd5ea4b915021f1d$export$1005530eda016c13(node, collection) {
356
+ if (typeof collection.getChildren === "function") return collection.getChildren(node.key);
357
+ return node.childNodes;
358
+ }
359
+ function $cd5ea4b915021f1d$export$fbdeaa6a76694f71(iterable) {
360
+ return $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, 0);
361
+ }
362
+ function $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, index) {
363
+ if (index < 0) return void 0;
364
+ let i = 0;
365
+ for (let item of iterable) {
366
+ if (i === index) return item;
367
+ i++;
368
+ }
369
+ }
370
+ function $cd5ea4b915021f1d$export$8c434b3a7a4dad6(collection, a, b) {
371
+ if (a.parentKey === b.parentKey) return a.index - b.index;
372
+ let aAncestors = [
373
+ ...$cd5ea4b915021f1d$var$getAncestors(collection, a),
374
+ a
375
+ ];
376
+ let bAncestors = [
377
+ ...$cd5ea4b915021f1d$var$getAncestors(collection, b),
378
+ b
379
+ ];
380
+ let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
381
+ if (firstNonMatchingAncestor !== -1) {
382
+ a = aAncestors[firstNonMatchingAncestor];
383
+ b = bAncestors[firstNonMatchingAncestor];
384
+ return a.index - b.index;
385
+ }
386
+ if (aAncestors.findIndex((node) => node === b) >= 0) return 1;
387
+ else if (bAncestors.findIndex((node) => node === a) >= 0) return -1;
388
+ return -1;
389
+ }
390
+ function $cd5ea4b915021f1d$var$getAncestors(collection, node) {
391
+ let parents = [];
392
+ let currNode = node;
393
+ while (currNode?.parentKey != null) {
394
+ currNode = collection.getItem(currNode.parentKey);
395
+ if (currNode) parents.unshift(currNode);
396
+ }
397
+ return parents;
398
+ }
399
+
400
+ // ../../node_modules/react-stately/dist/private/list/ListCollection.mjs
401
+ var $f664a81d022446b5$export$d085fb9e920b5ca7 = class {
402
+ constructor(nodes) {
403
+ this.keyMap = /* @__PURE__ */ new Map();
404
+ this.firstKey = null;
405
+ this.lastKey = null;
406
+ this.iterable = nodes;
407
+ let visit = (node) => {
408
+ this.keyMap.set(node.key, node);
409
+ if (node.childNodes && node.type === "section") for (let child of node.childNodes) visit(child);
410
+ };
411
+ for (let node of nodes) visit(node);
412
+ let last = null;
413
+ let index = 0;
414
+ let size = 0;
415
+ for (let [key, node] of this.keyMap) {
416
+ if (last) {
417
+ last.nextKey = key;
418
+ node.prevKey = last.key;
419
+ } else {
420
+ this.firstKey = key;
421
+ node.prevKey = void 0;
422
+ }
423
+ if (node.type === "item") node.index = index++;
424
+ if (node.type === "section" || node.type === "item") size++;
425
+ last = node;
426
+ last.nextKey = void 0;
427
+ }
428
+ this._size = size;
429
+ this.lastKey = last?.key ?? null;
430
+ }
431
+ *[Symbol.iterator]() {
432
+ yield* this.iterable;
433
+ }
434
+ get size() {
435
+ return this._size;
436
+ }
437
+ getKeys() {
438
+ return this.keyMap.keys();
439
+ }
440
+ getKeyBefore(key) {
441
+ let node = this.keyMap.get(key);
442
+ return node ? node.prevKey ?? null : null;
443
+ }
444
+ getKeyAfter(key) {
445
+ let node = this.keyMap.get(key);
446
+ return node ? node.nextKey ?? null : null;
447
+ }
448
+ getFirstKey() {
449
+ return this.firstKey;
450
+ }
451
+ getLastKey() {
452
+ return this.lastKey;
453
+ }
454
+ getItem(key) {
455
+ return this.keyMap.get(key) ?? null;
456
+ }
457
+ at(idx) {
458
+ const keys = [
459
+ ...this.getKeys()
460
+ ];
461
+ return this.getItem(keys[idx]);
462
+ }
463
+ getChildren(key) {
464
+ let node = this.keyMap.get(key);
465
+ return node?.childNodes || [];
466
+ }
467
+ };
468
+
469
+ // ../../node_modules/react-stately/dist/private/selection/Selection.mjs
470
+ var $8b2540e09867b15e$export$52baac22726c72bf = class _$8b2540e09867b15e$export$52baac22726c72bf extends Set {
471
+ constructor(keys, anchorKey, currentKey) {
472
+ super(keys);
473
+ if (keys instanceof _$8b2540e09867b15e$export$52baac22726c72bf) {
474
+ this.anchorKey = anchorKey ?? keys.anchorKey;
475
+ this.currentKey = currentKey ?? keys.currentKey;
476
+ } else {
477
+ this.anchorKey = anchorKey ?? null;
478
+ this.currentKey = currentKey ?? null;
479
+ }
480
+ }
481
+ };
482
+
483
+ // ../../node_modules/react-stately/dist/private/selection/useMultipleSelectionState.mjs
484
+ import { useRef as $7w3VE$useRef, useState as $7w3VE$useState, useMemo as $7w3VE$useMemo, useEffect as $7w3VE$useEffect } from "react";
485
+ function $60f19cefd567a3e4$var$equalSets(setA, setB) {
486
+ if (setA.size !== setB.size) return false;
487
+ for (let item of setA) {
488
+ if (!setB.has(item)) return false;
489
+ }
490
+ return true;
491
+ }
492
+ function $60f19cefd567a3e4$export$253fe78d46329472(props) {
493
+ let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
494
+ let isFocusedRef = (0, $7w3VE$useRef)(false);
495
+ let [, setFocused] = (0, $7w3VE$useState)(false);
496
+ let focusedKeyRef = (0, $7w3VE$useRef)(null);
497
+ let childFocusStrategyRef = (0, $7w3VE$useRef)(null);
498
+ let [, setFocusedKey] = (0, $7w3VE$useState)(null);
499
+ let selectedKeysProp = (0, $7w3VE$useMemo)(() => $60f19cefd567a3e4$var$convertSelection(props.selectedKeys), [
500
+ props.selectedKeys
501
+ ]);
502
+ let defaultSelectedKeys = (0, $7w3VE$useMemo)(() => $60f19cefd567a3e4$var$convertSelection(props.defaultSelectedKeys, new (0, $8b2540e09867b15e$export$52baac22726c72bf)()), [
503
+ props.defaultSelectedKeys
504
+ ]);
505
+ let [selectedKeys, setSelectedKeys] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
506
+ let disabledKeysProp = (0, $7w3VE$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
507
+ props.disabledKeys
508
+ ]);
509
+ let [selectionBehavior, setSelectionBehavior] = (0, $7w3VE$useState)(selectionBehaviorProp);
510
+ if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0) setSelectionBehavior("replace");
511
+ let lastSelectionBehavior = (0, $7w3VE$useRef)(selectionBehaviorProp);
512
+ (0, $7w3VE$useEffect)(() => {
513
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
514
+ setSelectionBehavior(selectionBehaviorProp);
515
+ lastSelectionBehavior.current = selectionBehaviorProp;
516
+ }
517
+ }, [
518
+ selectionBehaviorProp
519
+ ]);
520
+ return {
521
+ selectionMode,
522
+ disallowEmptySelection,
523
+ selectionBehavior,
524
+ setSelectionBehavior,
525
+ get isFocused() {
526
+ return isFocusedRef.current;
527
+ },
528
+ setFocused(f) {
529
+ isFocusedRef.current = f;
530
+ setFocused(f);
531
+ },
532
+ get focusedKey() {
533
+ return focusedKeyRef.current;
534
+ },
535
+ get childFocusStrategy() {
536
+ return childFocusStrategyRef.current;
537
+ },
538
+ setFocusedKey(k, childFocusStrategy = "first") {
539
+ focusedKeyRef.current = k;
540
+ childFocusStrategyRef.current = childFocusStrategy;
541
+ setFocusedKey(k);
542
+ },
543
+ selectedKeys,
544
+ setSelectedKeys(keys) {
545
+ if (allowDuplicateSelectionEvents || !$60f19cefd567a3e4$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
546
+ },
547
+ disabledKeys: disabledKeysProp,
548
+ disabledBehavior
549
+ };
550
+ }
551
+ function $60f19cefd567a3e4$var$convertSelection(selection, defaultValue) {
552
+ if (!selection) return defaultValue;
553
+ return selection === "all" ? "all" : new (0, $8b2540e09867b15e$export$52baac22726c72bf)(selection);
554
+ }
555
+
556
+ // ../../node_modules/react-stately/dist/private/selection/SelectionManager.mjs
557
+ var $4a07ac835f260f78$export$6c8a5aaad13c9852 = class _$4a07ac835f260f78$export$6c8a5aaad13c9852 {
558
+ constructor(collection, state, options) {
559
+ this.collection = collection;
560
+ this.state = state;
561
+ this.allowsCellSelection = options?.allowsCellSelection ?? false;
562
+ this._isSelectAll = null;
563
+ this.layoutDelegate = options?.layoutDelegate || null;
564
+ this.fullCollection = options?.fullCollection || null;
565
+ }
566
+ /**
567
+ * The type of selection that is allowed in the collection.
568
+ */
569
+ get selectionMode() {
570
+ return this.state.selectionMode;
571
+ }
572
+ /**
573
+ * Whether the collection allows empty selection.
574
+ */
575
+ get disallowEmptySelection() {
576
+ return this.state.disallowEmptySelection;
577
+ }
578
+ /**
579
+ * The selection behavior for the collection.
580
+ */
581
+ get selectionBehavior() {
582
+ return this.state.selectionBehavior;
583
+ }
584
+ /**
585
+ * Sets the selection behavior for the collection.
586
+ */
587
+ setSelectionBehavior(selectionBehavior) {
588
+ this.state.setSelectionBehavior(selectionBehavior);
589
+ }
590
+ /**
591
+ * Whether the collection is currently focused.
592
+ */
593
+ get isFocused() {
594
+ return this.state.isFocused;
595
+ }
596
+ /**
597
+ * Sets whether the collection is focused.
598
+ */
599
+ setFocused(isFocused) {
600
+ this.state.setFocused(isFocused);
601
+ }
602
+ /**
603
+ * The current focused key in the collection.
604
+ */
605
+ get focusedKey() {
606
+ return this.state.focusedKey;
607
+ }
608
+ /** Whether the first or last child of the focused key should receive focus. */
609
+ get childFocusStrategy() {
610
+ return this.state.childFocusStrategy;
611
+ }
612
+ /**
613
+ * Sets the focused key.
614
+ */
615
+ setFocusedKey(key, childFocusStrategy) {
616
+ if (key == null || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
617
+ }
618
+ /**
619
+ * The currently selected keys in the collection.
620
+ */
621
+ get selectedKeys() {
622
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
623
+ }
624
+ /**
625
+ * The raw selection value for the collection.
626
+ * Either 'all' for select all, or a set of keys.
627
+ */
628
+ get rawSelection() {
629
+ return this.state.selectedKeys;
630
+ }
631
+ /**
632
+ * Returns whether a key is selected.
633
+ */
634
+ isSelected(key) {
635
+ if (this.state.selectionMode === "none") return false;
636
+ let mappedKey = this.getKey(key);
637
+ if (mappedKey == null) return false;
638
+ return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
639
+ }
640
+ /**
641
+ * Whether the selection is empty.
642
+ */
643
+ get isEmpty() {
644
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
645
+ }
646
+ /**
647
+ * Whether all items in the collection are selected.
648
+ */
649
+ get isSelectAll() {
650
+ if (this.isEmpty) return false;
651
+ if (this.state.selectedKeys === "all") return true;
652
+ if (this._isSelectAll != null) return this._isSelectAll;
653
+ let allKeys = this.getSelectAllKeys();
654
+ let selectedKeys = this.state.selectedKeys;
655
+ this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
656
+ return this._isSelectAll;
657
+ }
658
+ get firstSelectedKey() {
659
+ let first = null;
660
+ for (let key of this.state.selectedKeys) {
661
+ let item = this.collection.getItem(key);
662
+ if (!first || item && (0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, item, first) < 0) first = item;
663
+ }
664
+ return first?.key ?? null;
665
+ }
666
+ get lastSelectedKey() {
667
+ let last = null;
668
+ for (let key of this.state.selectedKeys) {
669
+ let item = this.collection.getItem(key);
670
+ if (!last || item && (0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, item, last) > 0) last = item;
671
+ }
672
+ return last?.key ?? null;
673
+ }
674
+ get disabledKeys() {
675
+ return this.state.disabledKeys;
676
+ }
677
+ get disabledBehavior() {
678
+ return this.state.disabledBehavior;
679
+ }
680
+ /**
681
+ * Extends the selection to the given key.
682
+ */
683
+ extendSelection(toKey) {
684
+ if (this.selectionMode === "none") return;
685
+ if (this.selectionMode === "single") {
686
+ this.replaceSelection(toKey);
687
+ return;
688
+ }
689
+ let mappedToKey = this.getKey(toKey);
690
+ if (mappedToKey == null) return;
691
+ let selection;
692
+ if (this.state.selectedKeys === "all") selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)([
693
+ mappedToKey
694
+ ], mappedToKey, mappedToKey);
695
+ else {
696
+ let selectedKeys = this.state.selectedKeys;
697
+ let anchorKey = selectedKeys.anchorKey ?? mappedToKey;
698
+ selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)(selectedKeys, anchorKey, mappedToKey);
699
+ for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? mappedToKey)) selection.delete(key);
700
+ for (let key of this.getKeyRange(mappedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
701
+ }
702
+ this.state.setSelectedKeys(selection);
703
+ }
704
+ getKeyRange(from, to) {
705
+ let fromItem = this.collection.getItem(from);
706
+ let toItem = this.collection.getItem(to);
707
+ if (fromItem && toItem) {
708
+ if ((0, $cd5ea4b915021f1d$export$8c434b3a7a4dad6)(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
709
+ return this.getKeyRangeInternal(to, from);
710
+ }
711
+ return [];
712
+ }
713
+ getKeyRangeInternal(from, to) {
714
+ if (this.layoutDelegate?.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
715
+ let keys = [];
716
+ let key = from;
717
+ while (key != null) {
718
+ let item = this.collection.getItem(key);
719
+ if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection)) keys.push(key);
720
+ if (key === to) return keys;
721
+ key = this.collection.getKeyAfter(key);
722
+ }
723
+ return [];
724
+ }
725
+ getKey(key) {
726
+ let item = this.collection.getItem(key);
727
+ if (!item)
728
+ return key;
729
+ if (item.type === "cell" && this.allowsCellSelection) return key;
730
+ while (item && item.type !== "item" && item.parentKey != null) item = this.collection.getItem(item.parentKey);
731
+ if (!item || item.type !== "item") return null;
732
+ return item.key;
733
+ }
734
+ /**
735
+ * Toggles whether the given key is selected.
736
+ */
737
+ toggleSelection(key) {
738
+ if (this.selectionMode === "none") return;
739
+ if (this.selectionMode === "single" && !this.isSelected(key)) {
740
+ this.replaceSelection(key);
741
+ return;
742
+ }
743
+ let mappedKey = this.getKey(key);
744
+ if (mappedKey == null) return;
745
+ let keys = new (0, $8b2540e09867b15e$export$52baac22726c72bf)(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
746
+ if (keys.has(mappedKey)) keys.delete(mappedKey);
747
+ else if (this.canSelectItem(mappedKey)) {
748
+ keys.add(mappedKey);
749
+ keys.anchorKey = mappedKey;
750
+ keys.currentKey = mappedKey;
751
+ }
752
+ if (this.disallowEmptySelection && keys.size === 0) return;
753
+ this.state.setSelectedKeys(keys);
754
+ }
755
+ /**
756
+ * Replaces the selection with only the given key.
757
+ */
758
+ replaceSelection(key) {
759
+ if (this.selectionMode === "none") return;
760
+ let mappedKey = this.getKey(key);
761
+ if (mappedKey == null) return;
762
+ let selection = this.canSelectItem(mappedKey) ? new (0, $8b2540e09867b15e$export$52baac22726c72bf)([
763
+ mappedKey
764
+ ], mappedKey, mappedKey) : new (0, $8b2540e09867b15e$export$52baac22726c72bf)();
765
+ this.state.setSelectedKeys(selection);
766
+ }
767
+ /**
768
+ * Replaces the selection with the given keys.
769
+ */
770
+ setSelectedKeys(keys) {
771
+ if (this.selectionMode === "none") return;
772
+ let selection = new (0, $8b2540e09867b15e$export$52baac22726c72bf)();
773
+ for (let key of keys) {
774
+ let mappedKey = this.getKey(key);
775
+ if (mappedKey != null) {
776
+ selection.add(mappedKey);
777
+ if (this.selectionMode === "single") break;
778
+ }
779
+ }
780
+ this.state.setSelectedKeys(selection);
781
+ }
782
+ getSelectAllKeys() {
783
+ let collection = this.fullCollection ?? this.collection;
784
+ let keys = [];
785
+ let addKeys = (key) => {
786
+ while (key != null) {
787
+ if (this.canSelectItemIn(key, collection)) {
788
+ let item = collection.getItem(key);
789
+ if (item?.type === "item") keys.push(key);
790
+ if (item?.hasChildNodes && (this.allowsCellSelection || item.type !== "item")) addKeys((0, $cd5ea4b915021f1d$export$fbdeaa6a76694f71)((0, $cd5ea4b915021f1d$export$1005530eda016c13)(item, collection))?.key ?? null);
791
+ }
792
+ key = collection.getKeyAfter(key);
793
+ }
794
+ };
795
+ addKeys(collection.getFirstKey());
796
+ return keys;
797
+ }
798
+ /**
799
+ * Selects all items in the collection.
800
+ */
801
+ selectAll() {
802
+ if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
803
+ }
804
+ /**
805
+ * Removes all keys from the selection.
806
+ */
807
+ clearSelection() {
808
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new (0, $8b2540e09867b15e$export$52baac22726c72bf)());
809
+ }
810
+ /**
811
+ * Toggles between select all and an empty selection.
812
+ */
813
+ toggleSelectAll() {
814
+ if (this.isSelectAll) this.clearSelection();
815
+ else this.selectAll();
816
+ }
817
+ select(key, e) {
818
+ if (this.selectionMode === "none") return;
819
+ if (this.selectionMode === "single") {
820
+ if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
821
+ else this.replaceSelection(key);
822
+ } else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
823
+ this.toggleSelection(key);
824
+ else this.replaceSelection(key);
825
+ }
826
+ /**
827
+ * Returns whether the current selection is equal to the given selection.
828
+ */
829
+ isSelectionEqual(selection) {
830
+ if (selection === this.state.selectedKeys) return true;
831
+ let selectedKeys = this.selectedKeys;
832
+ if (selection.size !== selectedKeys.size) return false;
833
+ for (let key of selection) {
834
+ if (!selectedKeys.has(key)) return false;
835
+ }
836
+ for (let key of selectedKeys) {
837
+ if (!selection.has(key)) return false;
838
+ }
839
+ return true;
840
+ }
841
+ canSelectItem(key) {
842
+ return this.canSelectItemIn(key, this.collection);
843
+ }
844
+ canSelectItemIn(key, collection) {
845
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
846
+ let item = collection.getItem(key);
847
+ if (!item || item?.props?.isDisabled || item.type === "cell" && !this.allowsCellSelection) return false;
848
+ return true;
849
+ }
850
+ isDisabled(key) {
851
+ return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled);
852
+ }
853
+ isLink(key) {
854
+ return !!this.collection.getItem(key)?.props?.href;
855
+ }
856
+ getItemProps(key) {
857
+ return this.collection.getItem(key)?.props;
858
+ }
859
+ withCollection(collection) {
860
+ return new _$4a07ac835f260f78$export$6c8a5aaad13c9852(collection, this.state, {
861
+ allowsCellSelection: this.allowsCellSelection,
862
+ layoutDelegate: this.layoutDelegate || void 0,
863
+ fullCollection: this.fullCollection ?? this.collection
864
+ });
865
+ }
866
+ };
867
+
868
+ // ../../node_modules/react-stately/dist/private/collections/CollectionBuilder.mjs
869
+ import $jO8i1$react from "react";
870
+ var $bda7a7e55e1ff206$export$bf788dd355e3a401 = class {
871
+ build(props, context) {
872
+ this.context = context;
873
+ return $bda7a7e55e1ff206$var$iterable(() => this.iterateCollection(props));
874
+ }
875
+ *iterateCollection(props) {
876
+ let { children, items } = props;
877
+ if ((0, $jO8i1$react).isValidElement(children) && children.type === (0, $jO8i1$react).Fragment) yield* this.iterateCollection({
878
+ children: children.props.children,
879
+ items
880
+ });
881
+ else if (typeof children === "function") {
882
+ if (!items) throw new Error("props.children was a function but props.items is missing");
883
+ let index = 0;
884
+ for (let item of items) {
885
+ yield* this.getFullNode({
886
+ value: item,
887
+ index
888
+ }, {
889
+ renderer: children
890
+ });
891
+ index++;
892
+ }
893
+ } else {
894
+ let items2 = [];
895
+ (0, $jO8i1$react).Children.forEach(children, (child) => {
896
+ if (child) items2.push(child);
897
+ });
898
+ let index = 0;
899
+ for (let item of items2) {
900
+ let nodes = this.getFullNode({
901
+ element: item,
902
+ index
903
+ }, {});
904
+ for (let node of nodes) {
905
+ index++;
906
+ yield node;
907
+ }
908
+ }
909
+ }
910
+ }
911
+ getKey(item, partialNode, state, parentKey) {
912
+ if (item.key != null) return item.key;
913
+ if (partialNode.type === "cell" && partialNode.key != null) return `${parentKey}${partialNode.key}`;
914
+ let v = partialNode.value;
915
+ if (v != null) {
916
+ let key = v.key ?? v.id;
917
+ if (key == null) throw new Error("No key found for item");
918
+ return key;
919
+ }
920
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
921
+ }
922
+ getChildState(state, partialNode) {
923
+ return {
924
+ renderer: partialNode.renderer || state.renderer
925
+ };
926
+ }
927
+ *getFullNode(partialNode, state, parentKey, parentNode) {
928
+ if ((0, $jO8i1$react).isValidElement(partialNode.element) && partialNode.element.type === (0, $jO8i1$react).Fragment) {
929
+ let children = [];
930
+ (0, $jO8i1$react).Children.forEach(partialNode.element.props.children, (child) => {
931
+ children.push(child);
932
+ });
933
+ let index = partialNode.index ?? 0;
934
+ for (const child of children) yield* this.getFullNode({
935
+ element: child,
936
+ index: index++
937
+ }, state, parentKey, parentNode);
938
+ return;
939
+ }
940
+ let element = partialNode.element;
941
+ if (!element && partialNode.value && state && state.renderer) {
942
+ let cached = this.cache.get(partialNode.value);
943
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
944
+ cached.index = partialNode.index;
945
+ cached.parentKey = parentNode ? parentNode.key : null;
946
+ yield cached;
947
+ return;
948
+ }
949
+ element = state.renderer(partialNode.value);
950
+ }
951
+ if ((0, $jO8i1$react).isValidElement(element)) {
952
+ let type = element.type;
953
+ if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
954
+ let name = element.type;
955
+ throw new Error(`Unknown element <${name}> in collection.`);
956
+ }
957
+ let childNodes = type.getCollectionNode(element.props, this.context);
958
+ let index = partialNode.index ?? 0;
959
+ let result = childNodes.next();
960
+ while (!result.done && result.value) {
961
+ let childNode = result.value;
962
+ partialNode.index = index;
963
+ let nodeKey = childNode.key ?? null;
964
+ if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
965
+ let nodes = this.getFullNode({
966
+ ...childNode,
967
+ key: nodeKey,
968
+ index,
969
+ wrapper: $bda7a7e55e1ff206$var$compose(partialNode.wrapper, childNode.wrapper)
970
+ }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
971
+ let children = [
972
+ ...nodes
973
+ ];
974
+ for (let node2 of children) {
975
+ node2.value = childNode.value ?? partialNode.value ?? null;
976
+ if (node2.value) this.cache.set(node2.value, node2);
977
+ 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.`);
978
+ index++;
979
+ yield node2;
980
+ }
981
+ result = childNodes.next(children);
982
+ }
983
+ return;
984
+ }
985
+ if (partialNode.key == null || partialNode.type == null) return;
986
+ let builder = this;
987
+ let node = {
988
+ type: partialNode.type,
989
+ props: partialNode.props,
990
+ key: partialNode.key,
991
+ parentKey: parentNode ? parentNode.key : null,
992
+ value: partialNode.value ?? null,
993
+ level: (parentNode?.level ?? 0) + (parentNode?.type === "item" ? 1 : 0),
994
+ index: partialNode.index,
995
+ rendered: partialNode.rendered,
996
+ textValue: partialNode.textValue ?? "",
997
+ "aria-label": partialNode["aria-label"],
998
+ wrapper: partialNode.wrapper,
999
+ shouldInvalidate: partialNode.shouldInvalidate,
1000
+ hasChildNodes: partialNode.hasChildNodes || false,
1001
+ childNodes: $bda7a7e55e1ff206$var$iterable(function* () {
1002
+ if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
1003
+ let index = 0;
1004
+ for (let child of partialNode.childNodes()) {
1005
+ if (child.key != null)
1006
+ child.key = `${node.key}${child.key}`;
1007
+ let nodes = builder.getFullNode({
1008
+ ...child,
1009
+ index
1010
+ }, builder.getChildState(state, child), node.key, node);
1011
+ for (let node2 of nodes) {
1012
+ index++;
1013
+ yield node2;
1014
+ }
1015
+ }
1016
+ })
1017
+ };
1018
+ yield node;
1019
+ }
1020
+ constructor() {
1021
+ this.cache = /* @__PURE__ */ new WeakMap();
1022
+ }
1023
+ };
1024
+ function $bda7a7e55e1ff206$var$iterable(iterator) {
1025
+ let cache = [];
1026
+ let iterable = null;
1027
+ return {
1028
+ *[Symbol.iterator]() {
1029
+ for (let item of cache) yield item;
1030
+ if (!iterable) iterable = iterator();
1031
+ for (let item of iterable) {
1032
+ cache.push(item);
1033
+ yield item;
1034
+ }
1035
+ }
1036
+ };
1037
+ }
1038
+ function $bda7a7e55e1ff206$var$compose(outer, inner) {
1039
+ if (outer && inner) return (element) => outer(inner(element));
1040
+ if (outer) return outer;
1041
+ if (inner) return inner;
1042
+ }
1043
+ function $bda7a7e55e1ff206$var$capitalize(str) {
1044
+ return str[0].toUpperCase() + str.slice(1);
1045
+ }
1046
+
1047
+ // ../../node_modules/react-stately/dist/private/collections/useCollection.mjs
1048
+ import { useMemo as $emYU7$useMemo } from "react";
1049
+ function $d03379b88399b8c5$export$6cd28814d92fa9c9(props, factory, context) {
1050
+ let builder = (0, $emYU7$useMemo)(() => new (0, $bda7a7e55e1ff206$export$bf788dd355e3a401)(), []);
1051
+ let { children, items, collection } = props;
1052
+ let result = (0, $emYU7$useMemo)(() => {
1053
+ if (collection) return collection;
1054
+ let nodes = builder.build({
1055
+ children,
1056
+ items
1057
+ }, context);
1058
+ return factory(nodes);
1059
+ }, [
1060
+ builder,
1061
+ children,
1062
+ items,
1063
+ collection,
1064
+ context,
1065
+ factory
1066
+ ]);
1067
+ return result;
1068
+ }
1069
+
1070
+ // ../../node_modules/react-stately/dist/private/list/useListState.mjs
1071
+ import { useMemo as $3yt54$useMemo, useCallback as $3yt54$useCallback, useRef as $3yt54$useRef, useEffect as $3yt54$useEffect } from "react";
1072
+ function $b14b6f590b50af39$export$2f645645f7bca764(props) {
1073
+ let { filter, layoutDelegate } = props;
1074
+ let selectionState = (0, $60f19cefd567a3e4$export$253fe78d46329472)(props);
1075
+ let disabledKeys = (0, $3yt54$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1076
+ props.disabledKeys
1077
+ ]);
1078
+ let factory = (0, $3yt54$useCallback)((nodes) => filter ? new (0, $f664a81d022446b5$export$d085fb9e920b5ca7)(filter(nodes)) : new (0, $f664a81d022446b5$export$d085fb9e920b5ca7)(nodes), [
1079
+ filter
1080
+ ]);
1081
+ let context = (0, $3yt54$useMemo)(() => ({
1082
+ suppressTextValueWarning: props.suppressTextValueWarning
1083
+ }), [
1084
+ props.suppressTextValueWarning
1085
+ ]);
1086
+ let collection = (0, $d03379b88399b8c5$export$6cd28814d92fa9c9)(props, factory, context);
1087
+ let selectionManager = (0, $3yt54$useMemo)(() => new (0, $4a07ac835f260f78$export$6c8a5aaad13c9852)(collection, selectionState, {
1088
+ layoutDelegate
1089
+ }), [
1090
+ collection,
1091
+ selectionState,
1092
+ layoutDelegate
1093
+ ]);
1094
+ $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager);
1095
+ return {
1096
+ collection,
1097
+ disabledKeys,
1098
+ selectionManager
1099
+ };
1100
+ }
1101
+ function $b14b6f590b50af39$var$useFocusedKeyReset(collection, selectionManager) {
1102
+ const cachedCollection = (0, $3yt54$useRef)(null);
1103
+ (0, $3yt54$useEffect)(() => {
1104
+ if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
1105
+ let key = cachedCollection.current.getKeyAfter(selectionManager.focusedKey);
1106
+ let nextFocusedKey = null;
1107
+ while (key != null) {
1108
+ let node = collection.getItem(key);
1109
+ if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
1110
+ nextFocusedKey = key;
1111
+ break;
1112
+ }
1113
+ key = cachedCollection.current.getKeyAfter(key);
1114
+ }
1115
+ if (nextFocusedKey == null) {
1116
+ key = cachedCollection.current.getKeyBefore(selectionManager.focusedKey);
1117
+ while (key != null) {
1118
+ let node = collection.getItem(key);
1119
+ if (node && node.type === "item" && !selectionManager.isDisabled(key)) {
1120
+ nextFocusedKey = key;
1121
+ break;
1122
+ }
1123
+ key = cachedCollection.current.getKeyBefore(key);
1124
+ }
1125
+ }
1126
+ selectionManager.setFocusedKey(nextFocusedKey);
1127
+ }
1128
+ cachedCollection.current = collection;
1129
+ }, [
1130
+ collection,
1131
+ selectionManager
1132
+ ]);
1133
+ }
1134
+
1135
+ // ../../node_modules/react-stately/dist/private/overlays/useOverlayTriggerState.mjs
1136
+ import { useCallback as $kE40A$useCallback } from "react";
1137
+ function $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props) {
1138
+ let [isOpen, setOpen] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
1139
+ const open = (0, $kE40A$useCallback)(() => {
1140
+ setOpen(true);
1141
+ }, [
1142
+ setOpen
1143
+ ]);
1144
+ const close = (0, $kE40A$useCallback)(() => {
1145
+ setOpen(false);
1146
+ }, [
1147
+ setOpen
1148
+ ]);
1149
+ const toggle = (0, $kE40A$useCallback)(() => {
1150
+ setOpen(!isOpen);
1151
+ }, [
1152
+ setOpen,
1153
+ isOpen
1154
+ ]);
1155
+ return {
1156
+ isOpen,
1157
+ setOpen,
1158
+ open,
1159
+ close,
1160
+ toggle
1161
+ };
1162
+ }
1163
+
1164
+ // ../../node_modules/react-stately/dist/private/collections/Item.mjs
1165
+ import $dJmKC$react from "react";
1166
+ function $05678f3aee5e7d1a$var$Item(props) {
1167
+ return null;
1168
+ }
1169
+ $05678f3aee5e7d1a$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
1170
+ let { childItems, title, children } = props;
1171
+ let rendered = props.title || props.children;
1172
+ let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
1173
+ 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.");
1174
+ yield {
1175
+ type: "item",
1176
+ props,
1177
+ rendered,
1178
+ textValue,
1179
+ "aria-label": props["aria-label"],
1180
+ hasChildNodes: $05678f3aee5e7d1a$var$hasChildItems(props),
1181
+ *childNodes() {
1182
+ if (childItems) for (let child of childItems) yield {
1183
+ type: "item",
1184
+ value: child
1185
+ };
1186
+ else if (title) {
1187
+ let items = [];
1188
+ (0, $dJmKC$react).Children.forEach(children, (child) => {
1189
+ items.push({
1190
+ type: "item",
1191
+ element: child
1192
+ });
1193
+ });
1194
+ yield* items;
1195
+ }
1196
+ }
1197
+ };
1198
+ };
1199
+ function $05678f3aee5e7d1a$var$hasChildItems(props) {
1200
+ if (props.hasChildItems != null) return props.hasChildItems;
1201
+ if (props.childItems) return true;
1202
+ if (props.title && (0, $dJmKC$react).Children.count(props.children) > 0) return true;
1203
+ return false;
1204
+ }
1205
+ var $05678f3aee5e7d1a$export$6d08773d2e66f8f2 = $05678f3aee5e7d1a$var$Item;
1206
+
1207
+ // ../../node_modules/react-stately/dist/private/list/useSingleSelectListState.mjs
1208
+ import { useMemo as $jhfZc$useMemo } from "react";
1209
+ function $0fdb127d377ffd84$export$e7f05e985daf4b5f(props) {
1210
+ let [selectedKey, setSelectedKey] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange);
1211
+ let selectedKeys = (0, $jhfZc$useMemo)(() => selectedKey != null ? [
1212
+ selectedKey
1213
+ ] : [], [
1214
+ selectedKey
1215
+ ]);
1216
+ let { collection, disabledKeys, selectionManager } = (0, $b14b6f590b50af39$export$2f645645f7bca764)({
1217
+ ...props,
1218
+ selectionMode: "single",
1219
+ disallowEmptySelection: true,
1220
+ allowDuplicateSelectionEvents: true,
1221
+ selectedKeys,
1222
+ onSelectionChange: (keys) => {
1223
+ if (keys === "all") return;
1224
+ let key = keys.values().next().value ?? null;
1225
+ if (key === selectedKey && props.onSelectionChange) props.onSelectionChange(key);
1226
+ setSelectedKey(key);
1227
+ }
1228
+ });
1229
+ let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
1230
+ return {
1231
+ collection,
1232
+ disabledKeys,
1233
+ selectionManager,
1234
+ selectedKey,
1235
+ setSelectedKey,
1236
+ selectedItem
1237
+ };
1238
+ }
1239
+
1240
+ // ../../node_modules/react-stately/dist/private/menu/useMenuTriggerState.mjs
1241
+ import { useState as $aoDK0$useState } from "react";
1242
+ function $e3403870bfb691da$export$79fefeb1c2091ac3(props) {
1243
+ let overlayTriggerState = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1244
+ let [focusStrategy, setFocusStrategy] = (0, $aoDK0$useState)(null);
1245
+ let [expandedKeysStack, setExpandedKeysStack] = (0, $aoDK0$useState)([]);
1246
+ let closeAll = () => {
1247
+ setExpandedKeysStack([]);
1248
+ overlayTriggerState.close();
1249
+ };
1250
+ let openSubmenu = (triggerKey, level) => {
1251
+ setExpandedKeysStack((oldStack) => {
1252
+ if (level > oldStack.length) return oldStack;
1253
+ return [
1254
+ ...oldStack.slice(0, level),
1255
+ triggerKey
1256
+ ];
1257
+ });
1258
+ };
1259
+ let closeSubmenu = (triggerKey, level) => {
1260
+ setExpandedKeysStack((oldStack) => {
1261
+ let key = oldStack[level];
1262
+ if (key === triggerKey) return oldStack.slice(0, level);
1263
+ else return oldStack;
1264
+ });
1265
+ };
1266
+ return {
1267
+ focusStrategy,
1268
+ ...overlayTriggerState,
1269
+ open(focusStrategy2 = null) {
1270
+ setFocusStrategy(focusStrategy2);
1271
+ overlayTriggerState.open();
1272
+ },
1273
+ toggle(focusStrategy2 = null) {
1274
+ setFocusStrategy(focusStrategy2);
1275
+ overlayTriggerState.toggle();
1276
+ },
1277
+ close() {
1278
+ closeAll();
1279
+ },
1280
+ expandedKeysStack,
1281
+ openSubmenu,
1282
+ closeSubmenu
1283
+ };
1284
+ }
1285
+
1286
+ // ../../node_modules/react-stately/dist/private/radio/useRadioGroupState.mjs
1287
+ import { useMemo as $6Hs9a$useMemo, useState as $6Hs9a$useState } from "react";
1288
+ var $384704861d32dbed$var$instance = Math.round(Math.random() * 1e10);
1289
+ var $384704861d32dbed$var$i = 0;
1290
+ function $384704861d32dbed$export$bca9d026f8e704eb(props) {
1291
+ let name = (0, $6Hs9a$useMemo)(() => props.name || `radio-group-${$384704861d32dbed$var$instance}-${++$384704861d32dbed$var$i}`, [
1292
+ props.name
1293
+ ]);
1294
+ let [selectedValue, setSelected] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.value, props.defaultValue ?? null, props.onChange);
1295
+ let [initialValue] = (0, $6Hs9a$useState)(selectedValue);
1296
+ let [lastFocusedValue, setLastFocusedValue] = (0, $6Hs9a$useState)(null);
1297
+ let validation = (0, $fd2148440a13ec26$export$fc1a364ae1f3ff10)({
1298
+ ...props,
1299
+ value: selectedValue
1300
+ });
1301
+ let setSelectedValue = (value) => {
1302
+ if (!props.isReadOnly && !props.isDisabled) {
1303
+ setSelected(value);
1304
+ validation.commitValidation();
1305
+ }
1306
+ };
1307
+ let isInvalid = validation.displayValidation.isInvalid;
1308
+ return {
1309
+ ...validation,
1310
+ name,
1311
+ selectedValue,
1312
+ defaultSelectedValue: props.value !== void 0 ? initialValue : props.defaultValue ?? null,
1313
+ setSelectedValue,
1314
+ lastFocusedValue,
1315
+ setLastFocusedValue,
1316
+ isDisabled: props.isDisabled || false,
1317
+ isReadOnly: props.isReadOnly || false,
1318
+ isRequired: props.isRequired || false,
1319
+ validationState: props.validationState || (isInvalid ? "invalid" : null),
1320
+ isInvalid
1321
+ };
1322
+ }
1323
+
1324
+ // ../../node_modules/react-stately/dist/private/select/useSelectState.mjs
1325
+ import { useState as $5t5rb$useState, useMemo as $5t5rb$useMemo } from "react";
1326
+ function $29256f53a2edafe9$export$5159ec8b34d4ec12(props) {
1327
+ let { selectionMode = "single", shouldCloseOnSelect = selectionMode === "single" } = props;
1328
+ let triggerState = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1329
+ let [focusStrategy, setFocusStrategy] = (0, $5t5rb$useState)(null);
1330
+ let defaultValue = (0, $5t5rb$useMemo)(() => {
1331
+ return props.defaultValue !== void 0 ? props.defaultValue : selectionMode === "single" ? props.defaultSelectedKey ?? null : [];
1332
+ }, [
1333
+ props.defaultValue,
1334
+ props.defaultSelectedKey,
1335
+ selectionMode
1336
+ ]);
1337
+ let value = (0, $5t5rb$useMemo)(() => {
1338
+ return props.value !== void 0 ? props.value : selectionMode === "single" ? props.selectedKey : void 0;
1339
+ }, [
1340
+ props.value,
1341
+ props.selectedKey,
1342
+ selectionMode
1343
+ ]);
1344
+ let [controlledValue, setControlledValue] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(value, defaultValue, props.onChange);
1345
+ let displayValue = selectionMode === "single" && Array.isArray(controlledValue) ? controlledValue[0] : controlledValue;
1346
+ let setValue = (value2) => {
1347
+ if (selectionMode === "single") {
1348
+ let key = Array.isArray(value2) ? value2[0] ?? null : value2;
1349
+ setControlledValue(key);
1350
+ if (key !== displayValue) props.onSelectionChange?.(key);
1351
+ } else {
1352
+ let keys = [];
1353
+ if (Array.isArray(value2)) keys = value2;
1354
+ else if (value2 != null) keys = [
1355
+ value2
1356
+ ];
1357
+ setControlledValue(keys);
1358
+ }
1359
+ };
1360
+ let listState = (0, $b14b6f590b50af39$export$2f645645f7bca764)({
1361
+ ...props,
1362
+ selectionMode,
1363
+ disallowEmptySelection: selectionMode === "single",
1364
+ allowDuplicateSelectionEvents: true,
1365
+ selectedKeys: (0, $5t5rb$useMemo)(() => $29256f53a2edafe9$var$convertValue(displayValue), [
1366
+ displayValue
1367
+ ]),
1368
+ onSelectionChange: (keys) => {
1369
+ if (keys === "all") return;
1370
+ if (selectionMode === "single") {
1371
+ let key = keys.values().next().value ?? null;
1372
+ setValue(key);
1373
+ } else setValue([
1374
+ ...keys
1375
+ ]);
1376
+ if (shouldCloseOnSelect) triggerState.close();
1377
+ validationState.commitValidation();
1378
+ }
1379
+ });
1380
+ let selectedKey = listState.selectionManager.firstSelectedKey;
1381
+ let selectedItems = (0, $5t5rb$useMemo)(() => {
1382
+ return [
1383
+ ...listState.selectionManager.selectedKeys
1384
+ ].map((key) => listState.collection.getItem(key)).filter((item) => item != null);
1385
+ }, [
1386
+ listState.selectionManager.selectedKeys,
1387
+ listState.collection
1388
+ ]);
1389
+ let validationState = (0, $fd2148440a13ec26$export$fc1a364ae1f3ff10)({
1390
+ ...props,
1391
+ value: Array.isArray(displayValue) && displayValue.length === 0 ? null : displayValue
1392
+ });
1393
+ let [isFocused, setFocused] = (0, $5t5rb$useState)(false);
1394
+ let [initialValue] = (0, $5t5rb$useState)(displayValue);
1395
+ return {
1396
+ ...validationState,
1397
+ ...listState,
1398
+ ...triggerState,
1399
+ value: displayValue,
1400
+ defaultValue: defaultValue ?? initialValue,
1401
+ setValue,
1402
+ selectedKey,
1403
+ setSelectedKey: setValue,
1404
+ selectedItem: selectedItems[0] ?? null,
1405
+ selectedItems,
1406
+ defaultSelectedKey: props.defaultSelectedKey ?? (props.selectionMode === "single" ? initialValue : null),
1407
+ focusStrategy,
1408
+ open(focusStrategy2 = null) {
1409
+ if (listState.collection.size !== 0 || props.allowsEmptyCollection) {
1410
+ setFocusStrategy(focusStrategy2);
1411
+ triggerState.open();
1412
+ }
1413
+ },
1414
+ toggle(focusStrategy2 = null) {
1415
+ if (listState.collection.size !== 0 || props.allowsEmptyCollection) {
1416
+ setFocusStrategy(focusStrategy2);
1417
+ triggerState.toggle();
1418
+ }
1419
+ },
1420
+ isFocused,
1421
+ setFocused
1422
+ };
1423
+ }
1424
+ function $29256f53a2edafe9$var$convertValue(value) {
1425
+ if (value === void 0) return void 0;
1426
+ if (value === null) return [];
1427
+ return Array.isArray(value) ? value : [
1428
+ value
1429
+ ];
1430
+ }
1431
+
1432
+ // ../../node_modules/react-stately/dist/private/tabs/useTabListState.mjs
1433
+ import { useRef as $eOo4G$useRef, useEffect as $eOo4G$useEffect } from "react";
1434
+ function $caeb030f09a278a1$export$4ba071daf4e486(props) {
1435
+ let state = (0, $0fdb127d377ffd84$export$e7f05e985daf4b5f)({
1436
+ ...props,
1437
+ onSelectionChange: props.onSelectionChange ? (key) => {
1438
+ if (key != null) props.onSelectionChange?.(key);
1439
+ } : void 0,
1440
+ suppressTextValueWarning: true,
1441
+ defaultSelectedKey: props.defaultSelectedKey ?? $caeb030f09a278a1$var$findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set()) ?? void 0
1442
+ });
1443
+ let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
1444
+ let lastSelectedKey = (0, $eOo4G$useRef)(currentSelectedKey);
1445
+ (0, $eOo4G$useEffect)(() => {
1446
+ let selectedKey = currentSelectedKey;
1447
+ if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
1448
+ selectedKey = $caeb030f09a278a1$var$findDefaultSelectedKey(collection, state.disabledKeys);
1449
+ if (selectedKey != null)
1450
+ selectionManager.setSelectedKeys([
1451
+ selectedKey
1452
+ ]);
1453
+ }
1454
+ if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current) selectionManager.setFocusedKey(selectedKey);
1455
+ lastSelectedKey.current = selectedKey;
1456
+ });
1457
+ return {
1458
+ ...state,
1459
+ isDisabled: props.isDisabled || false
1460
+ };
1461
+ }
1462
+ function $caeb030f09a278a1$var$findDefaultSelectedKey(collection, disabledKeys) {
1463
+ let selectedKey = null;
1464
+ if (collection) {
1465
+ selectedKey = collection.getFirstKey();
1466
+ while (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey !== collection.getLastKey()) selectedKey = collection.getKeyAfter(selectedKey);
1467
+ if (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey === collection.getLastKey()) selectedKey = collection.getFirstKey();
1468
+ }
1469
+ return selectedKey;
1470
+ }
1471
+
1472
+ // ../../node_modules/react-stately/dist/private/toggle/useToggleState.mjs
1473
+ import { useState as $dAajM$useState } from "react";
1474
+ function $fd3c5e01e837dc20$export$8042c6c013fd5226(props = {}) {
1475
+ let { isReadOnly } = props;
1476
+ let [isSelected, setSelected] = (0, $3e6197669829fe11$export$40bfa8c7b0832715)(props.isSelected, props.defaultSelected || false, props.onChange);
1477
+ let [initialValue] = (0, $dAajM$useState)(isSelected);
1478
+ function updateSelected(value) {
1479
+ if (!isReadOnly) setSelected(value);
1480
+ }
1481
+ function toggleState() {
1482
+ if (!isReadOnly) setSelected(!isSelected);
1483
+ }
1484
+ return {
1485
+ isSelected,
1486
+ defaultSelected: props.defaultSelected ?? initialValue,
1487
+ setSelected: updateSelected,
1488
+ toggle: toggleState
1489
+ };
1490
+ }
1491
+
1492
+ // ../../node_modules/react-stately/dist/private/tooltip/useTooltipTriggerState.mjs
1493
+ import { useMemo as $auOuY$useMemo, useRef as $auOuY$useRef, useEffect as $auOuY$useEffect } from "react";
1494
+ var $3834487504f4fc00$var$TOOLTIP_DELAY = 1500;
1495
+ var $3834487504f4fc00$var$TOOLTIP_COOLDOWN = 500;
1496
+ var $3834487504f4fc00$var$tooltips = {};
1497
+ var $3834487504f4fc00$var$tooltipId = 0;
1498
+ var $3834487504f4fc00$var$globalWarmedUp = false;
1499
+ var $3834487504f4fc00$var$globalWarmUpTimeout = null;
1500
+ var $3834487504f4fc00$var$globalCooldownTimeout = null;
1501
+ function $3834487504f4fc00$export$4d40659c25ecb50b(props = {}) {
1502
+ let { delay = $3834487504f4fc00$var$TOOLTIP_DELAY, closeDelay = $3834487504f4fc00$var$TOOLTIP_COOLDOWN } = props;
1503
+ let { isOpen, open, close } = (0, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6)(props);
1504
+ let id = (0, $auOuY$useMemo)(() => `${++$3834487504f4fc00$var$tooltipId}`, []);
1505
+ let closeTimeout = (0, $auOuY$useRef)(null);
1506
+ let closeCallback = (0, $auOuY$useRef)(close);
1507
+ let ensureTooltipEntry = () => {
1508
+ $3834487504f4fc00$var$tooltips[id] = hideTooltip;
1509
+ };
1510
+ let closeOpenTooltips = () => {
1511
+ for (let hideTooltipId in $3834487504f4fc00$var$tooltips) if (hideTooltipId !== id) {
1512
+ $3834487504f4fc00$var$tooltips[hideTooltipId](true);
1513
+ delete $3834487504f4fc00$var$tooltips[hideTooltipId];
1514
+ }
1515
+ };
1516
+ let showTooltip = () => {
1517
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1518
+ closeTimeout.current = null;
1519
+ closeOpenTooltips();
1520
+ ensureTooltipEntry();
1521
+ $3834487504f4fc00$var$globalWarmedUp = true;
1522
+ open();
1523
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1524
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1525
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1526
+ }
1527
+ if ($3834487504f4fc00$var$globalCooldownTimeout) {
1528
+ clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1529
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1530
+ }
1531
+ };
1532
+ let hideTooltip = (immediate) => {
1533
+ if (immediate || closeDelay <= 0) {
1534
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1535
+ closeTimeout.current = null;
1536
+ closeCallback.current();
1537
+ } else if (!closeTimeout.current) closeTimeout.current = setTimeout(() => {
1538
+ closeTimeout.current = null;
1539
+ closeCallback.current();
1540
+ }, closeDelay);
1541
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1542
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1543
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1544
+ }
1545
+ if ($3834487504f4fc00$var$globalWarmedUp) {
1546
+ if ($3834487504f4fc00$var$globalCooldownTimeout) clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1547
+ $3834487504f4fc00$var$globalCooldownTimeout = setTimeout(() => {
1548
+ delete $3834487504f4fc00$var$tooltips[id];
1549
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1550
+ $3834487504f4fc00$var$globalWarmedUp = false;
1551
+ }, Math.max($3834487504f4fc00$var$TOOLTIP_COOLDOWN, closeDelay));
1552
+ }
1553
+ };
1554
+ let warmupTooltip = () => {
1555
+ closeOpenTooltips();
1556
+ ensureTooltipEntry();
1557
+ if (!isOpen && !$3834487504f4fc00$var$globalWarmedUp) {
1558
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1559
+ $3834487504f4fc00$var$globalWarmUpTimeout = setTimeout(() => {
1560
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1561
+ $3834487504f4fc00$var$globalWarmedUp = true;
1562
+ showTooltip();
1563
+ }, delay);
1564
+ } else if (!isOpen) showTooltip();
1565
+ };
1566
+ (0, $auOuY$useEffect)(() => {
1567
+ closeCallback.current = close;
1568
+ }, [
1569
+ close
1570
+ ]);
1571
+ (0, $auOuY$useEffect)(() => {
1572
+ return () => {
1573
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1574
+ let tooltip = $3834487504f4fc00$var$tooltips[id];
1575
+ if (tooltip) delete $3834487504f4fc00$var$tooltips[id];
1576
+ };
1577
+ }, [
1578
+ id
1579
+ ]);
1580
+ return {
1581
+ isOpen,
1582
+ open: (immediate) => {
1583
+ if (!immediate && delay > 0 && !closeTimeout.current) warmupTooltip();
1584
+ else showTooltip();
1585
+ },
1586
+ close: hideTooltip
1587
+ };
1588
+ }
1589
+
1590
+ // ../../node_modules/react-stately/dist/private/tree/TreeCollection.mjs
1591
+ var $df1fcc684d3b021a$export$863faf230ee2118a = class {
1592
+ constructor(nodes, { expandedKeys } = {}) {
1593
+ this.keyMap = /* @__PURE__ */ new Map();
1594
+ this.firstKey = null;
1595
+ this.lastKey = null;
1596
+ this.iterable = nodes;
1597
+ expandedKeys = expandedKeys || /* @__PURE__ */ new Set();
1598
+ let visit = (node) => {
1599
+ this.keyMap.set(node.key, node);
1600
+ if (node.childNodes && (node.type === "section" || expandedKeys.has(node.key))) for (let child of node.childNodes) visit(child);
1601
+ };
1602
+ for (let node of nodes) visit(node);
1603
+ let last = null;
1604
+ let index = 0;
1605
+ for (let [key, node] of this.keyMap) {
1606
+ if (last) {
1607
+ last.nextKey = key;
1608
+ node.prevKey = last.key;
1609
+ } else {
1610
+ this.firstKey = key;
1611
+ node.prevKey = void 0;
1612
+ }
1613
+ if (node.type === "item") node.index = index++;
1614
+ last = node;
1615
+ last.nextKey = void 0;
1616
+ }
1617
+ this.lastKey = last?.key ?? null;
1618
+ }
1619
+ *[Symbol.iterator]() {
1620
+ yield* this.iterable;
1621
+ }
1622
+ get size() {
1623
+ return this.keyMap.size;
1624
+ }
1625
+ getKeys() {
1626
+ return this.keyMap.keys();
1627
+ }
1628
+ getKeyBefore(key) {
1629
+ let node = this.keyMap.get(key);
1630
+ return node ? node.prevKey ?? null : null;
1631
+ }
1632
+ getKeyAfter(key) {
1633
+ let node = this.keyMap.get(key);
1634
+ return node ? node.nextKey ?? null : null;
1635
+ }
1636
+ getFirstKey() {
1637
+ return this.firstKey;
1638
+ }
1639
+ getLastKey() {
1640
+ return this.lastKey;
1641
+ }
1642
+ getItem(key) {
1643
+ return this.keyMap.get(key) ?? null;
1644
+ }
1645
+ at(idx) {
1646
+ const keys = [
1647
+ ...this.getKeys()
1648
+ ];
1649
+ return this.getItem(keys[idx]);
1650
+ }
1651
+ };
1652
+
1653
+ // ../../node_modules/react-stately/dist/private/tree/useTreeState.mjs
1654
+ import { useMemo as $aXIpm$useMemo, useCallback as $aXIpm$useCallback, useEffect as $aXIpm$useEffect } from "react";
1655
+ function $6b915bde6cd300dd$export$728d6ba534403756(props) {
1656
+ let { onExpandedChange } = props;
1657
+ 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);
1658
+ let selectionState = (0, $60f19cefd567a3e4$export$253fe78d46329472)(props);
1659
+ let disabledKeys = (0, $aXIpm$useMemo)(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1660
+ props.disabledKeys
1661
+ ]);
1662
+ let tree = (0, $d03379b88399b8c5$export$6cd28814d92fa9c9)(props, (0, $aXIpm$useCallback)((nodes) => new (0, $df1fcc684d3b021a$export$863faf230ee2118a)(nodes, {
1663
+ expandedKeys
1664
+ }), [
1665
+ expandedKeys
1666
+ ]), null);
1667
+ (0, $aXIpm$useEffect)(() => {
1668
+ if (selectionState.focusedKey != null && !tree.getItem(selectionState.focusedKey)) selectionState.setFocusedKey(null);
1669
+ }, [
1670
+ tree,
1671
+ selectionState.focusedKey
1672
+ ]);
1673
+ let onToggle = (key) => {
1674
+ setExpandedKeys($6b915bde6cd300dd$var$toggleKey(expandedKeys, key));
1675
+ };
1676
+ return {
1677
+ collection: tree,
1678
+ expandedKeys,
1679
+ disabledKeys,
1680
+ toggleKey: onToggle,
1681
+ setExpandedKeys,
1682
+ selectionManager: new (0, $4a07ac835f260f78$export$6c8a5aaad13c9852)(tree, selectionState)
1683
+ };
1684
+ }
1685
+ function $6b915bde6cd300dd$var$toggleKey(set, key) {
1686
+ let res = new Set(set);
1687
+ if (res.has(key)) res.delete(key);
1688
+ else res.add(key);
1689
+ return res;
1690
+ }
1691
+
1692
+ // src/components/Tooltip/Tooltip.tsx
1693
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1694
+ var FLIP = {
1695
+ top: "bottom",
1696
+ bottom: "top",
1697
+ left: "right",
1698
+ right: "left"
1699
+ };
1700
+ function placeOn(rect, tipRect, position, offset) {
1701
+ const cx = rect.left + rect.width / 2;
1702
+ const cy = rect.top + rect.height / 2;
1703
+ switch (position) {
1704
+ case "top":
1705
+ return {
1706
+ top: rect.top - tipRect.height - offset,
1707
+ left: cx - tipRect.width / 2
1708
+ };
1709
+ case "bottom":
1710
+ return { top: rect.bottom + offset, left: cx - tipRect.width / 2 };
1711
+ case "left":
1712
+ return {
1713
+ top: cy - tipRect.height / 2,
1714
+ left: rect.left - tipRect.width - offset
1715
+ };
1716
+ case "right":
1717
+ return { top: cy - tipRect.height / 2, left: rect.right + offset };
1718
+ }
1719
+ }
1720
+ function computePosition(rect, tipRect, position, offset, viewport) {
1721
+ const tryAt = (p) => {
1722
+ const c = placeOn(rect, tipRect, p, offset);
1723
+ const fits = c.top >= 0 && c.left >= 0 && c.top + tipRect.height <= viewport.height && c.left + tipRect.width <= viewport.width;
1724
+ return { ...c, position: p, fits };
1725
+ };
1726
+ const preferred = tryAt(position);
1727
+ if (preferred.fits) return preferred;
1728
+ const flipped = tryAt(FLIP[position]);
1729
+ if (flipped.fits) return flipped;
1730
+ const fallback = preferred;
1731
+ const clampedLeft = Math.max(4, Math.min(fallback.left, viewport.width - tipRect.width - 4));
1732
+ const clampedTop = Math.max(4, Math.min(fallback.top, viewport.height - tipRect.height - 4));
1733
+ return { top: clampedTop, left: clampedLeft, position: fallback.position };
1734
+ }
1735
+ var animVariants = {
1736
+ top: { initial: { opacity: 0, y: 4 }, animate: { opacity: 1, y: 0 } },
1737
+ bottom: { initial: { opacity: 0, y: -4 }, animate: { opacity: 1, y: 0 } },
1738
+ left: { initial: { opacity: 0, x: 4 }, animate: { opacity: 1, x: 0 } },
1739
+ right: { initial: { opacity: 0, x: -4 }, animate: { opacity: 1, x: 0 } }
1740
+ };
1741
+ function TooltipContent({
1742
+ state,
1743
+ content,
1744
+ position,
1745
+ triggerRef,
1746
+ className,
1747
+ offset,
1748
+ tooltipId
1749
+ }) {
1750
+ const { tooltipProps } = useTooltip({ isOpen: state.isOpen }, state);
1751
+ const tipRef = useRef(null);
1752
+ const [coords, setCoords] = useState2(null);
1753
+ const reposition = useCallback2(() => {
1754
+ if (!triggerRef.current || !tipRef.current) return;
1755
+ const trigRect = triggerRef.current.getBoundingClientRect();
1756
+ const tipRect = tipRef.current.getBoundingClientRect();
1757
+ const viewport = {
1758
+ width: window.innerWidth || document.documentElement.clientWidth,
1759
+ height: window.innerHeight || document.documentElement.clientHeight
1760
+ };
1761
+ setCoords(computePosition(trigRect, tipRect, position, offset, viewport));
1762
+ }, [triggerRef, position, offset]);
1763
+ useLayoutEffect(() => {
1764
+ if (!state.isOpen) return;
1765
+ reposition();
1766
+ const id = requestAnimationFrame(reposition);
1767
+ return () => cancelAnimationFrame(id);
1768
+ }, [state.isOpen, reposition]);
1769
+ useEffect(() => {
1770
+ if (!state.isOpen) return;
1771
+ const handler = () => reposition();
1772
+ window.addEventListener("scroll", handler, true);
1773
+ window.addEventListener("resize", handler);
1774
+ return () => {
1775
+ window.removeEventListener("scroll", handler, true);
1776
+ window.removeEventListener("resize", handler);
1777
+ };
1778
+ }, [state.isOpen, reposition]);
1779
+ const resolvedPos = coords?.position ?? position;
1780
+ const variants = animVariants[resolvedPos];
1781
+ const {
1782
+ onDrag: _onDrag,
1783
+ onDragStart: _onDragStart,
1784
+ onDragEnd: _onDragEnd,
1785
+ onAnimationStart: _onAnimationStart,
1786
+ ...safeTipProps
1787
+ } = tooltipProps;
1788
+ const portalContent = /* @__PURE__ */ jsx2(AnimatePresence2, { children: state.isOpen && /* @__PURE__ */ jsx2(
1789
+ "div",
1790
+ {
1791
+ className: "ods-tooltip__wrapper",
1792
+ style: {
1793
+ position: "fixed",
1794
+ zIndex: 1500,
1795
+ top: coords?.top ?? -9999,
1796
+ left: coords?.left ?? -9999,
1797
+ visibility: coords ? "visible" : "hidden",
1798
+ pointerEvents: "none"
1799
+ },
1800
+ children: /* @__PURE__ */ jsxs2(
1801
+ motion2.div,
1802
+ {
1803
+ ref: tipRef,
1804
+ ...safeTipProps,
1805
+ id: tooltipId,
1806
+ role: "tooltip",
1807
+ "data-position": resolvedPos,
1808
+ className: cn("ods-tooltip", className),
1809
+ initial: variants.initial,
1810
+ animate: variants.animate,
1811
+ exit: { opacity: 0 },
1812
+ transition: { duration: 0.15, ease: "easeOut" },
1813
+ children: [
1814
+ content,
1815
+ /* @__PURE__ */ jsx2("span", { className: "ods-tooltip__arrow", "aria-hidden": "true" })
1816
+ ]
1817
+ }
1818
+ )
1819
+ }
1820
+ ) });
1821
+ if (typeof document === "undefined") return null;
1822
+ return createPortal(portalContent, document.body);
1823
+ }
1824
+ function mergeRefs(...refs) {
1825
+ return (node) => {
1826
+ for (const r of refs) {
1827
+ if (!r) continue;
1828
+ if (typeof r === "function") r(node);
1829
+ else r.current = node;
1830
+ }
1831
+ };
1832
+ }
1833
+ function mergeHandler(childHandler, ariaHandler) {
1834
+ if (!childHandler && !ariaHandler) return void 0;
1835
+ return (e) => {
1836
+ childHandler?.(e);
1837
+ if (!e.defaultPrevented) ariaHandler?.(e);
1838
+ };
1839
+ }
1840
+ function Tooltip({
1841
+ content,
1842
+ position = "top",
1843
+ delay = 200,
1844
+ offset = 8,
1845
+ disabled = false,
1846
+ id: providedId,
1847
+ children,
1848
+ className
1849
+ }) {
1850
+ const reactId = useId2();
1851
+ const tooltipId = providedId ?? `ods-tooltip-${reactId}`;
1852
+ const triggerRef = useRef(null);
1853
+ const state = $3834487504f4fc00$export$4d40659c25ecb50b({ delay });
1854
+ const { triggerProps } = useTooltipTrigger({ delay, isDisabled: disabled }, state, triggerRef);
1855
+ if (!isValidElement(children)) {
1856
+ return /* @__PURE__ */ jsx2(Fragment, { children });
1857
+ }
1858
+ const childProps = children.props;
1859
+ const childRef = childProps.ref ?? children.ref;
1860
+ const merged = { ...childProps };
1861
+ for (const [key, value] of Object.entries(triggerProps)) {
1862
+ if (key.startsWith("on") && typeof value === "function") {
1863
+ merged[key] = mergeHandler(childProps[key], value);
1864
+ } else {
1865
+ merged[key] = value;
1866
+ }
1867
+ }
1868
+ merged.ref = mergeRefs(triggerRef, childRef);
1869
+ merged["aria-describedby"] = [childProps["aria-describedby"], tooltipId].filter(Boolean).join(" ");
1870
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
1871
+ cloneElement(children, merged),
1872
+ !disabled && /* @__PURE__ */ jsx2(
1873
+ TooltipContent,
1874
+ {
1875
+ state,
1876
+ content,
1877
+ position,
1878
+ triggerRef,
1879
+ offset,
1880
+ className,
1881
+ tooltipId
1882
+ }
1883
+ )
1884
+ ] });
1885
+ }
1886
+ Tooltip.displayName = "Tooltip";
1887
+
1888
+ // src/components/Button/Button.tsx
1889
+ import { motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
1890
+ import {
1891
+ forwardRef as forwardRef3,
1892
+ useImperativeHandle,
1893
+ useRef as useRef2
1894
+ } from "react";
1895
+ import { useButton } from "react-aria";
1896
+
1897
+ // src/utils/a11y.ts
1898
+ import { isValidElement as isValidElement2 } from "react";
1899
+ function hasRenderableText(node) {
1900
+ if (node === null || node === void 0 || typeof node === "boolean") return false;
1901
+ if (typeof node === "string") return node.trim().length > 0;
1902
+ if (typeof node === "number") return true;
1903
+ if (Array.isArray(node)) return node.some(hasRenderableText);
1904
+ if (isValidElement2(node)) {
1905
+ return hasRenderableText(node.props.children);
1906
+ }
1907
+ return false;
1908
+ }
1909
+ function getRenderableText(node) {
1910
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
1911
+ if (typeof node === "string") return node;
1912
+ if (typeof node === "number") return String(node);
1913
+ if (Array.isArray(node)) return node.map(getRenderableText).join("");
1914
+ if (isValidElement2(node)) {
1915
+ return getRenderableText(node.props.children);
1916
+ }
1917
+ return "";
1918
+ }
1919
+ function resolveAccessibleName(input) {
1920
+ if (input.ariaLabelledby) {
1921
+ return { "aria-labelledby": input.ariaLabelledby };
1922
+ }
1923
+ if (input.ariaLabel) {
1924
+ return { "aria-label": input.ariaLabel };
1925
+ }
1926
+ if (typeof input.label === "string" && input.label.trim().length > 0) {
1927
+ return { "aria-label": input.label };
1928
+ }
1929
+ for (const candidate of input.fallbacks ?? []) {
1930
+ if (typeof candidate === "string" && candidate.trim().length > 0) {
1931
+ return { "aria-label": candidate };
1932
+ }
1933
+ }
1934
+ if (process.env.NODE_ENV !== "production") {
1935
+ console.error(
1936
+ `[@octaviaflow/core ${input.componentName}] No accessible name. Pass a string \`label\`, or \`aria-label\`, or \`aria-labelledby\` so screen readers can announce this control.`
1937
+ );
1938
+ }
1939
+ return { "aria-label": `Unlabeled ${input.componentName}` };
1940
+ }
1941
+
1942
+ // src/utils/Slot.tsx
1943
+ import {
1944
+ Children,
1945
+ cloneElement as cloneElement2,
1946
+ forwardRef as forwardRef2,
1947
+ isValidElement as isValidElement3
1948
+ } from "react";
1949
+
1950
+ // src/utils/composeRefs.ts
1951
+ function composeRefs(...refs) {
1952
+ return (node) => {
1953
+ for (const ref of refs) {
1954
+ if (typeof ref === "function") {
1955
+ ref(node);
1956
+ } else if (ref != null) {
1957
+ ref.current = node;
1958
+ }
1959
+ }
1960
+ };
1961
+ }
1962
+
1963
+ // src/utils/Slot.tsx
1964
+ var Slot = forwardRef2(function Slot2({ children, ...slotProps }, forwardedRef) {
1965
+ if (!isValidElement3(children)) {
1966
+ return null;
1967
+ }
1968
+ const child = Children.only(children);
1969
+ const childProps = child.props ?? {};
1970
+ const childRef = child.ref;
1971
+ return cloneElement2(child, {
1972
+ ...mergeProps(slotProps, childProps),
1973
+ ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
1974
+ });
1975
+ });
1976
+ function mergeProps(slotProps, childProps) {
1977
+ const merged = { ...slotProps, ...childProps };
1978
+ for (const key of Object.keys(slotProps)) {
1979
+ const slotValue = slotProps[key];
1980
+ const childValue = childProps[key];
1981
+ if (/^on[A-Z]/.test(key) && typeof slotValue === "function" && typeof childValue === "function") {
1982
+ merged[key] = (...args) => {
1983
+ slotValue(...args);
1984
+ const event = args[0];
1985
+ if (event?.defaultPrevented) return;
1986
+ childValue(...args);
1987
+ };
1988
+ continue;
1989
+ }
1990
+ if (key === "className") {
1991
+ merged.className = [slotValue, childValue].filter(Boolean).join(" ");
1992
+ continue;
1993
+ }
1994
+ if (key === "style") {
1995
+ merged.style = {
1996
+ ...slotValue,
1997
+ ...childValue
1998
+ };
1999
+ }
2000
+ }
2001
+ return merged;
2002
+ }
2003
+
2004
+ // src/components/Button/Button.tsx
2005
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2006
+ var Button = forwardRef3(function Button2({
2007
+ variant = "primary",
2008
+ size = "md",
2009
+ loading = false,
2010
+ loadingText,
2011
+ loadingLabel = "Loading",
2012
+ disabled = false,
2013
+ leftIcon,
2014
+ rightIcon,
2015
+ fullWidth = false,
2016
+ pressed,
2017
+ asChild = false,
2018
+ className,
2019
+ children,
2020
+ type,
2021
+ cursor,
2022
+ style,
2023
+ ...props
2024
+ }, forwardedRef) {
2025
+ const ref = useRef2(null);
2026
+ useImperativeHandle(forwardedRef, () => ref.current);
2027
+ const isDisabled = disabled || loading;
2028
+ const prefersReducedMotion = useReducedMotion2();
2029
+ const hasAction = Boolean(props.onClick) || type === "submit" || type === "reset";
2030
+ const resolvedCursor = cursor ?? (disabled ? "not-allowed" : loading ? "progress" : hasAction ? "pointer" : "default");
2031
+ const resolvedType = type ?? "button";
2032
+ const hasVisibleText = hasRenderableText(children);
2033
+ const needsAriaName = !hasVisibleText && !asChild;
2034
+ const ariaNameProps = needsAriaName ? resolveAccessibleName({
2035
+ ariaLabel: props["aria-label"],
2036
+ ariaLabelledby: props["aria-labelledby"],
2037
+ componentName: "Button"
2038
+ }) : void 0;
2039
+ const onClick = props.onClick;
2040
+ const onPress = onClick ? (press) => {
2041
+ const event = press;
2042
+ if (typeof event.stopPropagation !== "function") event.stopPropagation = () => {
2043
+ };
2044
+ if (typeof event.preventDefault !== "function") event.preventDefault = () => {
2045
+ };
2046
+ if (event.currentTarget === void 0) event.currentTarget = event.target;
2047
+ onClick(event);
2048
+ } : void 0;
2049
+ const { buttonProps } = useButton(
2050
+ {
2051
+ isDisabled,
2052
+ onPress,
2053
+ type: resolvedType,
2054
+ ...ariaNameProps ?? {}
2055
+ },
2056
+ ref
2057
+ );
2058
+ const { onDrag, onDragStart, onDragEnd, onAnimationStart, ...safeButtonProps } = buttonProps;
2059
+ const {
2060
+ onClick: _onClick,
2061
+ onKeyDown: _onKeyDown,
2062
+ onKeyUp: _onKeyUp,
2063
+ onMouseDown: _onMouseDown,
2064
+ onPointerDown: _onPointerDown,
2065
+ onPointerUp: _onPointerUp,
2066
+ onFocus: _onFocus,
2067
+ onBlur: _onBlur,
2068
+ ...passthroughProps
2069
+ } = props;
2070
+ const rootClassName = cn(
2071
+ "ods-btn",
2072
+ `ods-btn--${variant}`,
2073
+ `ods-btn--${size}`,
2074
+ loading && "ods-btn--loading",
2075
+ fullWidth && "ods-btn--full",
2076
+ pressed && "ods-btn--pressed",
2077
+ className
2078
+ );
2079
+ if (asChild) {
2080
+ return /* @__PURE__ */ jsx3(
2081
+ Slot,
2082
+ {
2083
+ ...passthroughProps,
2084
+ ref: forwardedRef,
2085
+ className: rootClassName,
2086
+ style: { cursor: resolvedCursor, ...style },
2087
+ "aria-pressed": pressed,
2088
+ "aria-disabled": isDisabled || void 0,
2089
+ children
2090
+ }
2091
+ );
2092
+ }
2093
+ const visibleLabel = loading && loadingText !== void 0 ? loadingText : children;
2094
+ return /* @__PURE__ */ jsx3(
2095
+ motion3.button,
2096
+ {
2097
+ ...passthroughProps,
2098
+ ...safeButtonProps,
2099
+ type: resolvedType,
2100
+ ref,
2101
+ className: rootClassName,
2102
+ style: { cursor: resolvedCursor, ...style },
2103
+ "data-loading": loading || void 0,
2104
+ "aria-busy": loading || void 0,
2105
+ "aria-pressed": pressed,
2106
+ whileTap: isDisabled || prefersReducedMotion ? void 0 : { scale: 0.97 },
2107
+ transition: { duration: 0.1 },
2108
+ children: /* @__PURE__ */ jsxs3("span", { className: "ods-btn__content", children: [
2109
+ loading ? /* @__PURE__ */ jsx3(
2110
+ "span",
2111
+ {
2112
+ className: "ods-btn__icon ods-btn__icon--left ods-btn__icon--spinner",
2113
+ role: "status",
2114
+ "aria-label": loadingLabel,
2115
+ children: /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
2116
+ "circle",
2117
+ {
2118
+ cx: "12",
2119
+ cy: "12",
2120
+ r: "10",
2121
+ fill: "none",
2122
+ stroke: "currentColor",
2123
+ strokeWidth: "2.5",
2124
+ strokeLinecap: "round",
2125
+ strokeDasharray: "32",
2126
+ strokeDashoffset: "12"
2127
+ }
2128
+ ) })
2129
+ }
2130
+ ) : leftIcon && /* @__PURE__ */ jsx3("span", { className: "ods-btn__icon ods-btn__icon--left", children: leftIcon }),
2131
+ visibleLabel != null && visibleLabel !== false && /* @__PURE__ */ jsx3("span", { className: "ods-btn__label", children: visibleLabel }),
2132
+ rightIcon && !loading && /* @__PURE__ */ jsx3("span", { className: "ods-btn__icon ods-btn__icon--right", children: rightIcon })
2133
+ ] })
2134
+ }
2135
+ );
2136
+ });
2137
+ Button.displayName = "Button";
2138
+
2139
+ // src/components/Input/Input.tsx
2140
+ import { CloseIcon } from "@octaviaflow/icons";
2141
+ import {
2142
+ forwardRef as forwardRef4,
2143
+ useId as useId3,
2144
+ useImperativeHandle as useImperativeHandle2,
2145
+ useRef as useRef3
2146
+ } from "react";
2147
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
2148
+ var CLEAR_GLYPH = /* @__PURE__ */ jsx4(CloseIcon, { width: 12, height: 12, "aria-hidden": "true" });
2149
+ var Input = forwardRef4(
2150
+ ({
2151
+ type = "text",
2152
+ size = "md",
2153
+ error = false,
2154
+ errorMessage,
2155
+ label,
2156
+ helperText,
2157
+ leftIcon,
2158
+ rightIcon,
2159
+ clearable,
2160
+ onClear,
2161
+ shortcutHint,
2162
+ disabled = false,
2163
+ required,
2164
+ id,
2165
+ className,
2166
+ value,
2167
+ defaultValue,
2168
+ onChange,
2169
+ onKeyDown,
2170
+ ...props
2171
+ }, forwardedRef) => {
2172
+ const innerRef = useRef3(null);
2173
+ useImperativeHandle2(forwardedRef, () => innerRef.current);
2174
+ const reactId = useId3();
2175
+ const inputId = id ?? `${reactId}-input`;
2176
+ const errorId = `${reactId}-err`;
2177
+ const helperId = `${reactId}-help`;
2178
+ const isControlled = value !== void 0;
2179
+ const isClearable = (clearable ?? type === "search") && !disabled;
2180
+ const isSearch = type === "search";
2181
+ const currentValue = isControlled ? String(value ?? "") : innerRef.current?.value ?? String(defaultValue ?? "");
2182
+ const showClear = isClearable && currentValue.length > 0;
2183
+ const clearValue = () => {
2184
+ const el = innerRef.current;
2185
+ if (el && !isControlled) {
2186
+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
2187
+ setter?.call(el, "");
2188
+ el.dispatchEvent(new Event("input", { bubbles: true }));
2189
+ }
2190
+ onClear?.();
2191
+ el?.focus();
2192
+ };
2193
+ const handleClear = (e) => {
2194
+ e.preventDefault();
2195
+ e.stopPropagation();
2196
+ clearValue();
2197
+ };
2198
+ const handleKeyDown = (e) => {
2199
+ onKeyDown?.(e);
2200
+ if (e.defaultPrevented) return;
2201
+ if (isClearable && isSearch && e.key === "Escape" && currentValue) {
2202
+ e.preventDefault();
2203
+ clearValue();
2204
+ }
2205
+ };
2206
+ const describedBy = error && errorMessage ? errorId : helperText ? helperId : void 0;
2207
+ return /* @__PURE__ */ jsxs4(
2208
+ "div",
2209
+ {
2210
+ className: cn(
2211
+ "ods-input",
2212
+ `ods-input--${size}`,
2213
+ error && "ods-input--error",
2214
+ disabled && "ods-input--disabled",
2215
+ isSearch && "ods-input--search",
2216
+ className
2217
+ ),
2218
+ children: [
2219
+ label && /* @__PURE__ */ jsxs4("label", { htmlFor: inputId, className: "ods-input__label", children: [
2220
+ label,
2221
+ required && /* @__PURE__ */ jsx4("span", { className: "ods-input__required", "aria-hidden": "true", children: "*" })
2222
+ ] }),
2223
+ /* @__PURE__ */ jsxs4("div", { className: "ods-input__wrapper", children: [
2224
+ leftIcon && /* @__PURE__ */ jsx4("span", { className: "ods-input__icon--left", "aria-hidden": "true", children: leftIcon }),
2225
+ /* @__PURE__ */ jsx4(
2226
+ "input",
2227
+ {
2228
+ ...props,
2229
+ id: inputId,
2230
+ ref: innerRef,
2231
+ type,
2232
+ disabled,
2233
+ required,
2234
+ value,
2235
+ defaultValue,
2236
+ onChange,
2237
+ onKeyDown: handleKeyDown,
2238
+ className: cn(
2239
+ "ods-input__field",
2240
+ leftIcon && "ods-input__field--with-left-icon",
2241
+ (rightIcon || showClear || shortcutHint) && "ods-input__field--with-right-icon",
2242
+ showClear && shortcutHint && "ods-input__field--with-right-actions"
2243
+ ),
2244
+ "aria-invalid": error || void 0,
2245
+ "aria-required": required || void 0,
2246
+ "aria-describedby": describedBy
2247
+ }
2248
+ ),
2249
+ /* @__PURE__ */ jsxs4("span", { className: "ods-input__right", children: [
2250
+ showClear && /* @__PURE__ */ jsx4(
2251
+ "button",
2252
+ {
2253
+ type: "button",
2254
+ className: "ods-input__clear",
2255
+ onClick: handleClear,
2256
+ "aria-label": "Clear",
2257
+ tabIndex: -1,
2258
+ children: CLEAR_GLYPH
2259
+ }
2260
+ ),
2261
+ shortcutHint && !showClear && /* @__PURE__ */ jsx4("span", { className: "ods-input__kbd", "aria-hidden": "true", children: shortcutHint }),
2262
+ rightIcon && !showClear && !shortcutHint && /* @__PURE__ */ jsx4("span", { className: "ods-input__icon--right", "aria-hidden": "true", children: rightIcon })
2263
+ ] })
2264
+ ] }),
2265
+ error && errorMessage && /* @__PURE__ */ jsx4("div", { id: errorId, className: "ods-input__error-message", role: "alert", children: errorMessage }),
2266
+ !error && helperText && /* @__PURE__ */ jsx4("div", { id: helperId, className: "ods-input__helper", children: helperText })
2267
+ ]
2268
+ }
2269
+ );
2270
+ }
2271
+ );
2272
+ Input.displayName = "Input";
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
+ Tooltip,
2689
+ Button,
2690
+ Input,
2691
+ Select,
2692
+ Spinner
2693
+ };
2694
+ //# sourceMappingURL=chunk-23K2RF7Z.js.map