@octaviaflow/core 3.1.0-beta.65 → 3.1.0-beta.68

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