@nation-a/ui 0.2.1 → 0.4.0

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 (158) hide show
  1. package/dist/index.cjs +4356 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.js +4356 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/styled-system/css/conditions.mjs +36 -0
  6. package/dist/styled-system/css/css.d.ts +22 -0
  7. package/dist/styled-system/css/css.mjs +45 -0
  8. package/dist/styled-system/css/cva.d.ts +6 -0
  9. package/dist/styled-system/css/cva.mjs +87 -0
  10. package/dist/styled-system/css/cx.d.ts +5 -0
  11. package/dist/styled-system/css/cx.mjs +15 -0
  12. package/dist/styled-system/css/index.d.ts +5 -0
  13. package/dist/styled-system/css/index.mjs +4 -0
  14. package/dist/styled-system/css/sva.d.ts +4 -0
  15. package/dist/styled-system/css/sva.mjs +41 -0
  16. package/dist/styled-system/helpers.mjs +336 -0
  17. package/dist/styled-system/jsx/aspect-ratio.d.ts +10 -0
  18. package/dist/styled-system/jsx/aspect-ratio.mjs +14 -0
  19. package/dist/styled-system/jsx/bleed.d.ts +10 -0
  20. package/dist/styled-system/jsx/bleed.mjs +14 -0
  21. package/dist/styled-system/jsx/box.d.ts +10 -0
  22. package/dist/styled-system/jsx/box.mjs +14 -0
  23. package/dist/styled-system/jsx/center.d.ts +10 -0
  24. package/dist/styled-system/jsx/center.mjs +14 -0
  25. package/dist/styled-system/jsx/circle.d.ts +10 -0
  26. package/dist/styled-system/jsx/circle.mjs +14 -0
  27. package/dist/styled-system/jsx/container.d.ts +10 -0
  28. package/dist/styled-system/jsx/container.mjs +14 -0
  29. package/dist/styled-system/jsx/cq.d.ts +10 -0
  30. package/dist/styled-system/jsx/cq.mjs +14 -0
  31. package/dist/styled-system/jsx/divider.d.ts +10 -0
  32. package/dist/styled-system/jsx/divider.mjs +14 -0
  33. package/dist/styled-system/jsx/factory-helper.mjs +22 -0
  34. package/dist/styled-system/jsx/factory.d.ts +3 -0
  35. package/dist/styled-system/jsx/factory.mjs +80 -0
  36. package/dist/styled-system/jsx/flex.d.ts +10 -0
  37. package/dist/styled-system/jsx/flex.mjs +14 -0
  38. package/dist/styled-system/jsx/float.d.ts +10 -0
  39. package/dist/styled-system/jsx/float.mjs +14 -0
  40. package/dist/styled-system/jsx/grid-item.d.ts +10 -0
  41. package/dist/styled-system/jsx/grid-item.mjs +14 -0
  42. package/dist/styled-system/jsx/grid.d.ts +10 -0
  43. package/dist/styled-system/jsx/grid.mjs +14 -0
  44. package/dist/styled-system/jsx/hstack.d.ts +10 -0
  45. package/dist/styled-system/jsx/hstack.mjs +14 -0
  46. package/dist/styled-system/jsx/index.d.ts +24 -0
  47. package/dist/styled-system/jsx/index.mjs +22 -0
  48. package/dist/styled-system/jsx/is-valid-prop.d.ts +11 -0
  49. package/dist/styled-system/jsx/is-valid-prop.mjs +17 -0
  50. package/dist/styled-system/jsx/link-overlay.d.ts +10 -0
  51. package/dist/styled-system/jsx/link-overlay.mjs +14 -0
  52. package/dist/styled-system/jsx/spacer.d.ts +10 -0
  53. package/dist/styled-system/jsx/spacer.mjs +14 -0
  54. package/dist/styled-system/jsx/square.d.ts +10 -0
  55. package/dist/styled-system/jsx/square.mjs +14 -0
  56. package/dist/styled-system/jsx/stack.d.ts +10 -0
  57. package/dist/styled-system/jsx/stack.mjs +14 -0
  58. package/dist/styled-system/jsx/visually-hidden.d.ts +10 -0
  59. package/dist/styled-system/jsx/visually-hidden.mjs +14 -0
  60. package/dist/styled-system/jsx/vstack.d.ts +10 -0
  61. package/dist/styled-system/jsx/vstack.mjs +14 -0
  62. package/dist/styled-system/jsx/wrap.d.ts +10 -0
  63. package/dist/styled-system/jsx/wrap.mjs +14 -0
  64. package/dist/styled-system/patterns/aspect-ratio.d.ts +21 -0
  65. package/dist/styled-system/patterns/aspect-ratio.mjs +38 -0
  66. package/dist/styled-system/patterns/bleed.d.ts +22 -0
  67. package/dist/styled-system/patterns/bleed.mjs +24 -0
  68. package/dist/styled-system/patterns/box.d.ts +21 -0
  69. package/dist/styled-system/patterns/box.mjs +15 -0
  70. package/dist/styled-system/patterns/center.d.ts +21 -0
  71. package/dist/styled-system/patterns/center.mjs +21 -0
  72. package/dist/styled-system/patterns/circle.d.ts +21 -0
  73. package/dist/styled-system/patterns/circle.mjs +25 -0
  74. package/dist/styled-system/patterns/container.d.ts +21 -0
  75. package/dist/styled-system/patterns/container.mjs +21 -0
  76. package/dist/styled-system/patterns/cq.d.ts +22 -0
  77. package/dist/styled-system/patterns/cq.mjs +21 -0
  78. package/dist/styled-system/patterns/divider.d.ts +23 -0
  79. package/dist/styled-system/patterns/divider.mjs +25 -0
  80. package/dist/styled-system/patterns/flex.d.ts +27 -0
  81. package/dist/styled-system/patterns/flex.mjs +26 -0
  82. package/dist/styled-system/patterns/float.d.ts +24 -0
  83. package/dist/styled-system/patterns/float.mjs +52 -0
  84. package/dist/styled-system/patterns/grid-item.d.ts +26 -0
  85. package/dist/styled-system/patterns/grid-item.mjs +25 -0
  86. package/dist/styled-system/patterns/grid.d.ts +25 -0
  87. package/dist/styled-system/patterns/grid.mjs +27 -0
  88. package/dist/styled-system/patterns/hstack.d.ts +22 -0
  89. package/dist/styled-system/patterns/hstack.mjs +24 -0
  90. package/dist/styled-system/patterns/index.d.ts +21 -0
  91. package/dist/styled-system/patterns/index.mjs +20 -0
  92. package/dist/styled-system/patterns/link-overlay.d.ts +21 -0
  93. package/dist/styled-system/patterns/link-overlay.mjs +24 -0
  94. package/dist/styled-system/patterns/spacer.d.ts +21 -0
  95. package/dist/styled-system/patterns/spacer.mjs +21 -0
  96. package/dist/styled-system/patterns/square.d.ts +21 -0
  97. package/dist/styled-system/patterns/square.mjs +24 -0
  98. package/dist/styled-system/patterns/stack.d.ts +24 -0
  99. package/dist/styled-system/patterns/stack.mjs +24 -0
  100. package/dist/styled-system/patterns/visually-hidden.d.ts +21 -0
  101. package/dist/styled-system/patterns/visually-hidden.mjs +18 -0
  102. package/dist/styled-system/patterns/vstack.d.ts +22 -0
  103. package/dist/styled-system/patterns/vstack.mjs +24 -0
  104. package/dist/styled-system/patterns/wrap.d.ts +25 -0
  105. package/dist/styled-system/patterns/wrap.mjs +25 -0
  106. package/dist/styled-system/styles.css +1497 -0
  107. package/dist/styled-system/tokens/index.d.ts +9 -0
  108. package/dist/styled-system/tokens/index.mjs +1884 -0
  109. package/dist/styled-system/tokens/tokens.d.ts +63 -0
  110. package/dist/styled-system/types/composition.d.ts +164 -0
  111. package/dist/styled-system/types/conditions.d.ts +288 -0
  112. package/dist/styled-system/types/csstype.d.ts +21298 -0
  113. package/dist/styled-system/types/global.d.ts +20 -0
  114. package/dist/styled-system/types/index.d.ts +8 -0
  115. package/dist/styled-system/types/jsx.d.ts +52 -0
  116. package/dist/styled-system/types/parts.d.ts +8 -0
  117. package/dist/styled-system/types/pattern.d.ts +78 -0
  118. package/dist/styled-system/types/prop-type.d.ts +253 -0
  119. package/dist/styled-system/types/recipe.d.ts +181 -0
  120. package/dist/styled-system/types/selectors.d.ts +59 -0
  121. package/dist/styled-system/types/static-css.d.ts +56 -0
  122. package/dist/styled-system/types/style-props.d.ts +7492 -0
  123. package/dist/styled-system/types/system-types.d.ts +193 -0
  124. package/dist/types/components/Button/button.recipe.d.ts +109 -0
  125. package/dist/types/components/Button/index.d.ts +17 -0
  126. package/dist/types/components/Dialog/dialog.recipe.d.ts +2 -0
  127. package/dist/types/components/Dialog/index.d.ts +15 -0
  128. package/dist/types/components/IconButton/icon-button.recipe.d.ts +79 -0
  129. package/dist/types/components/IconButton/index.d.ts +13 -0
  130. package/dist/types/components/Spinner/index.d.ts +24 -0
  131. package/dist/types/components/Spinner/spinner.recipe.d.ts +21 -0
  132. package/dist/types/components/Text/index.d.ts +7 -0
  133. package/dist/types/components/Text/text.recipe.d.ts +38 -0
  134. package/dist/types/components/index.d.ts +6 -0
  135. package/dist/types/index.d.ts +2 -1205
  136. package/dist/types/theme/breakpoints.d.ts +7 -0
  137. package/dist/types/theme/conditions.d.ts +16 -0
  138. package/dist/types/theme/global-css.d.ts +1 -0
  139. package/dist/types/theme/index.d.ts +1 -0
  140. package/dist/types/theme/keyframes.d.ts +1 -0
  141. package/dist/types/theme/tokens/animations.d.ts +41 -0
  142. package/dist/types/theme/tokens/blurs.d.ts +23 -0
  143. package/dist/types/theme/tokens/borders.d.ts +5 -0
  144. package/dist/types/theme/tokens/durations.d.ts +23 -0
  145. package/dist/types/theme/tokens/easings.d.ts +14 -0
  146. package/dist/types/theme/tokens/index.d.ts +833 -0
  147. package/dist/types/theme/tokens/radii.d.ts +32 -0
  148. package/dist/types/theme/tokens/sizes.d.ts +158 -0
  149. package/dist/types/theme/tokens/spacing.d.ts +107 -0
  150. package/dist/types/theme/tokens/typography.d.ts +121 -0
  151. package/dist/types/theme/tokens/z-index.d.ts +38 -0
  152. package/dist/types/utils/create-style-context.d.ts +20 -0
  153. package/dist/types/vite-env.d.ts +1 -0
  154. package/package.json +45 -14
  155. package/dist/cjs/index.cjs +0 -25
  156. package/dist/cjs/index.cjs.map +0 -1
  157. package/dist/esm/index.mjs +0 -26344
  158. package/dist/esm/index.mjs.map +0 -1
package/dist/index.cjs ADDED
@@ -0,0 +1,4356 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const reactDom = require("react-dom");
6
+ function isObject$1(value) {
7
+ return typeof value === "object" && value != null && !Array.isArray(value);
8
+ }
9
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
10
+ function compact$1(value) {
11
+ return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
12
+ }
13
+ var isBaseCondition = (v2) => v2 === "base";
14
+ function filterBaseConditions(c) {
15
+ return c.slice().filter((v2) => !isBaseCondition(v2));
16
+ }
17
+ function toChar(code) {
18
+ return String.fromCharCode(code + (code > 25 ? 39 : 97));
19
+ }
20
+ function toName(code) {
21
+ let name = "";
22
+ let x;
23
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0)
24
+ name = toChar(x % 52) + name;
25
+ return toChar(x % 52) + name;
26
+ }
27
+ function toPhash(h, x) {
28
+ let i = x.length;
29
+ while (i)
30
+ h = h * 33 ^ x.charCodeAt(--i);
31
+ return h;
32
+ }
33
+ function toHash(value) {
34
+ return toName(toPhash(5381, value) >>> 0);
35
+ }
36
+ var importantRegex = /\s*!(important)?/i;
37
+ function isImportant(value) {
38
+ return typeof value === "string" ? importantRegex.test(value) : false;
39
+ }
40
+ function withoutImportant(value) {
41
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
42
+ }
43
+ function withoutSpace(str) {
44
+ return typeof str === "string" ? str.replaceAll(" ", "_") : str;
45
+ }
46
+ var memo = (fn) => {
47
+ const cache = /* @__PURE__ */ new Map();
48
+ const get = (...args) => {
49
+ const key = JSON.stringify(args);
50
+ if (cache.has(key)) {
51
+ return cache.get(key);
52
+ }
53
+ const result = fn(...args);
54
+ cache.set(key, result);
55
+ return result;
56
+ };
57
+ return get;
58
+ };
59
+ function mergeProps$1(...sources) {
60
+ return sources.reduce((prev, obj) => {
61
+ if (!obj)
62
+ return prev;
63
+ Object.keys(obj).forEach((key) => {
64
+ const prevValue = prev[key];
65
+ const value = obj[key];
66
+ if (isObject$1(prevValue) && isObject$1(value)) {
67
+ prev[key] = mergeProps$1(prevValue, value);
68
+ } else {
69
+ prev[key] = value;
70
+ }
71
+ });
72
+ return prev;
73
+ }, {});
74
+ }
75
+ var isNotNullish = (element) => element != null;
76
+ function walkObject(target, predicate, options = {}) {
77
+ const { stop, getKey } = options;
78
+ function inner(value, path = []) {
79
+ if (isObjectOrArray(value)) {
80
+ const result = {};
81
+ for (const [prop, child] of Object.entries(value)) {
82
+ const key = (getKey == null ? void 0 : getKey(prop, child)) ?? prop;
83
+ const childPath = [...path, key];
84
+ if (stop == null ? void 0 : stop(value, childPath)) {
85
+ return predicate(value, path);
86
+ }
87
+ const next = inner(child, childPath);
88
+ if (isNotNullish(next)) {
89
+ result[key] = next;
90
+ }
91
+ }
92
+ return result;
93
+ }
94
+ return predicate(value, path);
95
+ }
96
+ return inner(target);
97
+ }
98
+ function mapObject(obj, fn) {
99
+ if (Array.isArray(obj))
100
+ return obj.map((value) => fn(value));
101
+ if (!isObject$1(obj))
102
+ return fn(obj);
103
+ return walkObject(obj, (value) => fn(value));
104
+ }
105
+ function toResponsiveObject(values, breakpoints2) {
106
+ return values.reduce(
107
+ (acc, current, index) => {
108
+ const key = breakpoints2[index];
109
+ if (current != null) {
110
+ acc[key] = current;
111
+ }
112
+ return acc;
113
+ },
114
+ {}
115
+ );
116
+ }
117
+ function normalizeStyleObject(styles, context2, shorthand = true) {
118
+ const { utility, conditions: conditions2 } = context2;
119
+ const { hasShorthand, resolveShorthand: resolveShorthand2 } = utility;
120
+ return walkObject(
121
+ styles,
122
+ (value) => {
123
+ return Array.isArray(value) ? toResponsiveObject(value, conditions2.breakpoints.keys) : value;
124
+ },
125
+ {
126
+ stop: (value) => Array.isArray(value),
127
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand2(prop) : prop : void 0
128
+ }
129
+ );
130
+ }
131
+ var fallbackCondition = {
132
+ shift: (v2) => v2,
133
+ finalize: (v2) => v2,
134
+ breakpoints: { keys: [] }
135
+ };
136
+ var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
137
+ function createCss(context2) {
138
+ const { utility, hash, conditions: conds = fallbackCondition } = context2;
139
+ const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
140
+ const hashFn = (conditions2, className) => {
141
+ let result;
142
+ if (hash) {
143
+ const baseArray = [...conds.finalize(conditions2), className];
144
+ result = formatClassName(utility.toHash(baseArray, toHash));
145
+ } else {
146
+ const baseArray = [...conds.finalize(conditions2), formatClassName(className)];
147
+ result = baseArray.join(":");
148
+ }
149
+ return result;
150
+ };
151
+ return memo(({ base, ...styles } = {}) => {
152
+ const styleObject = Object.assign(styles, base);
153
+ const normalizedObject = normalizeStyleObject(styleObject, context2);
154
+ const classNames = /* @__PURE__ */ new Set();
155
+ walkObject(normalizedObject, (value, paths) => {
156
+ if (value == null)
157
+ return;
158
+ const important = isImportant(value);
159
+ const [prop, ...allConditions] = conds.shift(paths);
160
+ const conditions2 = filterBaseConditions(allConditions);
161
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
162
+ let className = hashFn(conditions2, transformed.className);
163
+ if (important)
164
+ className = `${className}!`;
165
+ classNames.add(className);
166
+ });
167
+ return Array.from(classNames).join(" ");
168
+ });
169
+ }
170
+ function compactStyles(...styles) {
171
+ return styles.flat().filter((style) => isObject$1(style) && Object.keys(compact$1(style)).length > 0);
172
+ }
173
+ function createMergeCss(context2) {
174
+ function resolve(styles) {
175
+ const allStyles = compactStyles(...styles);
176
+ if (allStyles.length === 1)
177
+ return allStyles;
178
+ return allStyles.map((style) => normalizeStyleObject(style, context2));
179
+ }
180
+ function mergeCss2(...styles) {
181
+ return mergeProps$1(...resolve(styles));
182
+ }
183
+ function assignCss(...styles) {
184
+ return Object.assign({}, ...resolve(styles));
185
+ }
186
+ return { mergeCss: memo(mergeCss2), assignCss };
187
+ }
188
+ var wordRegex = /([A-Z])/g;
189
+ var msRegex = /^ms-/;
190
+ var hypenateProperty = memo((property) => {
191
+ if (property.startsWith("--"))
192
+ return property;
193
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
194
+ });
195
+ var fns = ["min", "max", "clamp", "calc"];
196
+ var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
197
+ var isCssFunction = (v2) => typeof v2 === "string" && fnRegExp.test(v2);
198
+ var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
199
+ var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
200
+ var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
201
+ var isCssUnit = (v2) => typeof v2 === "string" && lengthRegExp.test(v2);
202
+ var isCssVar = (v2) => typeof v2 === "string" && /^var\(--.+\)$/.test(v2);
203
+ var patternFns = {
204
+ map: mapObject,
205
+ isCssFunction,
206
+ isCssVar,
207
+ isCssUnit
208
+ };
209
+ var getPatternStyles = (pattern, styles) => {
210
+ if (!(pattern == null ? void 0 : pattern.defaultValues))
211
+ return styles;
212
+ const defaults2 = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
213
+ return Object.assign({}, defaults2, compact$1(styles));
214
+ };
215
+ var getSlotRecipes = (recipe = {}) => {
216
+ const init = (slot) => {
217
+ var _a;
218
+ return {
219
+ className: [recipe.className, slot].filter(Boolean).join("__"),
220
+ base: ((_a = recipe.base) == null ? void 0 : _a[slot]) ?? {},
221
+ variants: {},
222
+ defaultVariants: recipe.defaultVariants ?? {},
223
+ compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
224
+ };
225
+ };
226
+ const slots = recipe.slots ?? [];
227
+ const recipeParts = slots.map((slot) => [slot, init(slot)]);
228
+ for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {
229
+ for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {
230
+ recipeParts.forEach(([slot, slotRecipe]) => {
231
+ var _a;
232
+ (_a = slotRecipe.variants)[variantsKey] ?? (_a[variantsKey] = {});
233
+ slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
234
+ });
235
+ }
236
+ }
237
+ return Object.fromEntries(recipeParts);
238
+ };
239
+ var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
240
+ function splitProps(props, ...keys) {
241
+ const descriptors = Object.getOwnPropertyDescriptors(props);
242
+ const dKeys = Object.keys(descriptors);
243
+ const split = (k) => {
244
+ const clone = {};
245
+ for (let i = 0; i < k.length; i++) {
246
+ const key = k[i];
247
+ if (descriptors[key]) {
248
+ Object.defineProperty(clone, key, descriptors[key]);
249
+ delete descriptors[key];
250
+ }
251
+ }
252
+ return clone;
253
+ };
254
+ const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
255
+ return keys.map(fn).concat(split(dKeys));
256
+ }
257
+ var uniq = (...items) => {
258
+ const set2 = items.reduce((acc, currItems) => {
259
+ if (currItems) {
260
+ currItems.forEach((item) => acc.add(item));
261
+ }
262
+ return acc;
263
+ }, /* @__PURE__ */ new Set([]));
264
+ return Array.from(set2);
265
+ };
266
+ var htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];
267
+ function convert(key) {
268
+ return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;
269
+ }
270
+ function normalizeHTMLProps(props) {
271
+ return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));
272
+ }
273
+ normalizeHTMLProps.keys = htmlProps;
274
+ const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_collapsed,_off,_on,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,base";
275
+ const conditions$1 = new Set(conditionsStr.split(","));
276
+ const conditionRegex = /^@|&|&$/;
277
+ function isCondition(value) {
278
+ return conditions$1.has(value) || conditionRegex.test(value);
279
+ }
280
+ const underscoreRegex = /^_/;
281
+ const conditionsSelectorRegex = /&|@/;
282
+ function finalizeConditions(paths) {
283
+ return paths.map((path) => {
284
+ if (conditions$1.has(path)) {
285
+ return path.replace(underscoreRegex, "");
286
+ }
287
+ if (conditionsSelectorRegex.test(path)) {
288
+ return `[${withoutSpace(path.trim())}]`;
289
+ }
290
+ return path;
291
+ });
292
+ }
293
+ function sortConditions(paths) {
294
+ return paths.sort((a, b) => {
295
+ const aa = isCondition(a);
296
+ const bb = isCondition(b);
297
+ if (aa && !bb) return 1;
298
+ if (!aa && bb) return -1;
299
+ return 0;
300
+ });
301
+ }
302
+ const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,textStyle:textStyle";
303
+ const classNameByProp = /* @__PURE__ */ new Map();
304
+ const shorthands = /* @__PURE__ */ new Map();
305
+ utilities.split(",").forEach((utility) => {
306
+ const [prop, meta] = utility.split(":");
307
+ const [className, ...shorthandList] = meta.split("/");
308
+ classNameByProp.set(prop, className);
309
+ if (shorthandList.length) {
310
+ shorthandList.forEach((shorthand) => {
311
+ shorthands.set(shorthand === "1" ? className : shorthand, prop);
312
+ });
313
+ }
314
+ });
315
+ const resolveShorthand = (prop) => shorthands.get(prop) || prop;
316
+ const context = {
317
+ conditions: {
318
+ shift: sortConditions,
319
+ finalize: finalizeConditions,
320
+ breakpoints: { keys: ["base", "sm", "md", "lg", "xl", "2xl"] }
321
+ },
322
+ utility: {
323
+ transform: (prop, value) => {
324
+ const key = resolveShorthand(prop);
325
+ const propKey = classNameByProp.get(key) || hypenateProperty(key);
326
+ return { className: `${propKey}_${withoutSpace(value)}` };
327
+ },
328
+ hasShorthand: true,
329
+ toHash: (path, hashFn) => hashFn(path.join(":")),
330
+ resolveShorthand
331
+ }
332
+ };
333
+ const cssFn = createCss(context);
334
+ const css$1 = (...styles) => cssFn(mergeCss(...styles));
335
+ css$1.raw = (...styles) => mergeCss(...styles);
336
+ const { mergeCss } = createMergeCss(context);
337
+ function cx() {
338
+ let str = "", i = 0, arg;
339
+ for (; i < arguments.length; ) {
340
+ if ((arg = arguments[i++]) && typeof arg === "string") {
341
+ str && (str += " ");
342
+ str += arg;
343
+ }
344
+ }
345
+ return str;
346
+ }
347
+ const defaults = (conf) => ({
348
+ base: {},
349
+ variants: {},
350
+ defaultVariants: {},
351
+ compoundVariants: [],
352
+ ...conf
353
+ });
354
+ function cva(config) {
355
+ const { base, variants, defaultVariants, compoundVariants } = defaults(config);
356
+ const getVariantProps = (variants2) => ({ ...defaultVariants, ...compact$1(variants2) });
357
+ function resolve(props = {}) {
358
+ var _a;
359
+ const computedVariants = getVariantProps(props);
360
+ let variantCss = { ...base };
361
+ for (const [key, value] of Object.entries(computedVariants)) {
362
+ if ((_a = variants[key]) == null ? void 0 : _a[value]) {
363
+ variantCss = mergeCss(variantCss, variants[key][value]);
364
+ }
365
+ }
366
+ const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants);
367
+ return mergeCss(variantCss, compoundVariantCss);
368
+ }
369
+ function merge(__cva) {
370
+ const override = defaults(__cva.config);
371
+ const variantKeys2 = uniq(__cva.variantKeys, Object.keys(variants));
372
+ return cva({
373
+ base: mergeCss(base, override.base),
374
+ variants: Object.fromEntries(
375
+ variantKeys2.map((key) => [key, mergeCss(variants[key], override.variants[key])])
376
+ ),
377
+ defaultVariants: mergeProps$1(defaultVariants, override.defaultVariants),
378
+ compoundVariants: [...compoundVariants, ...override.compoundVariants]
379
+ });
380
+ }
381
+ function cvaFn(props) {
382
+ return css$1(resolve(props));
383
+ }
384
+ const variantKeys = Object.keys(variants);
385
+ function splitVariantProps(props) {
386
+ return splitProps(props, variantKeys);
387
+ }
388
+ const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]));
389
+ return Object.assign(memo(cvaFn), {
390
+ __cva__: true,
391
+ variantMap,
392
+ variantKeys,
393
+ raw: resolve,
394
+ config,
395
+ merge,
396
+ splitVariantProps,
397
+ getVariantProps
398
+ });
399
+ }
400
+ function getCompoundVariantCss(compoundVariants, variantMap) {
401
+ let result = {};
402
+ compoundVariants.forEach((compoundVariant) => {
403
+ const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
404
+ if (key === "css") return true;
405
+ const values = Array.isArray(value) ? value : [value];
406
+ return values.some((value2) => variantMap[key] === value2);
407
+ });
408
+ if (isMatching) {
409
+ result = mergeCss(result, compoundVariant.css);
410
+ }
411
+ });
412
+ return result;
413
+ }
414
+ const slotClass = (className, slot) => className + "__" + slot;
415
+ function sva(config) {
416
+ const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)]);
417
+ const defaultVariants = config.defaultVariants ?? {};
418
+ function svaFn(props) {
419
+ const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config.className && slotClass(config.className, slot))]);
420
+ return Object.fromEntries(result);
421
+ }
422
+ function raw(props) {
423
+ const result = slots.map(([slot, cvaFn]) => [slot, cvaFn.raw(props)]);
424
+ return Object.fromEntries(result);
425
+ }
426
+ const variants = config.variants ?? {};
427
+ const variantKeys = Object.keys(variants);
428
+ function splitVariantProps(props) {
429
+ return splitProps(props, variantKeys);
430
+ }
431
+ const getVariantProps = (variants2) => ({ ...defaultVariants || {}, ...compact$1(variants2) });
432
+ const variantMap = Object.fromEntries(
433
+ Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
434
+ );
435
+ return Object.assign(memo(svaFn), {
436
+ __cva__: false,
437
+ raw,
438
+ variantMap,
439
+ variantKeys,
440
+ splitVariantProps,
441
+ getVariantProps
442
+ });
443
+ }
444
+ var userGeneratedStr = "css,pos,insetX,insetY,insetEnd,end,insetStart,start,flexDir,p,pl,pr,pt,pb,py,paddingY,paddingX,px,pe,paddingEnd,ps,paddingStart,ml,mr,mt,mb,m,my,marginY,mx,marginX,me,marginEnd,ms,marginStart,ringWidth,ringColor,ring,ringOffset,w,minW,maxW,h,minH,maxH,textShadowColor,bgPosition,bgPositionX,bgPositionY,bgAttachment,bgClip,bg,bgColor,bgOrigin,bgImage,bgRepeat,bgBlendMode,bgSize,bgGradient,rounded,roundedTopLeft,roundedTopRight,roundedBottomRight,roundedBottomLeft,roundedTop,roundedRight,roundedBottom,roundedLeft,roundedStartStart,roundedStartEnd,roundedStart,roundedEndStart,roundedEndEnd,roundedEnd,borderX,borderXWidth,borderXColor,borderY,borderYWidth,borderYColor,borderStart,borderStartWidth,borderStartColor,borderEnd,borderEndWidth,borderEndColor,shadow,shadowColor,x,y,z,scrollMarginY,scrollMarginX,scrollPaddingY,scrollPaddingX,aspectRatio,boxDecorationBreak,zIndex,boxSizing,objectPosition,objectFit,overscrollBehavior,overscrollBehaviorX,overscrollBehaviorY,position,top,left,inset,insetInline,insetBlock,insetBlockEnd,insetBlockStart,insetInlineEnd,insetInlineStart,right,bottom,float,visibility,display,hideFrom,hideBelow,flexBasis,flex,flexDirection,flexGrow,flexShrink,gridTemplateColumns,gridTemplateRows,gridColumn,gridRow,gridColumnStart,gridColumnEnd,gridAutoFlow,gridAutoColumns,gridAutoRows,gap,gridGap,gridRowGap,gridColumnGap,rowGap,columnGap,justifyContent,alignContent,alignItems,alignSelf,padding,paddingLeft,paddingRight,paddingTop,paddingBottom,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingInline,paddingInlineEnd,paddingInlineStart,marginLeft,marginRight,marginTop,marginBottom,margin,marginBlock,marginBlockEnd,marginBlockStart,marginInline,marginInlineEnd,marginInlineStart,spaceX,spaceY,outlineWidth,outlineColor,outline,outlineOffset,divideX,divideY,divideColor,divideStyle,width,inlineSize,minWidth,minInlineSize,maxWidth,maxInlineSize,height,blockSize,minHeight,minBlockSize,maxHeight,maxBlockSize,color,fontFamily,fontSize,fontSizeAdjust,fontPalette,fontKerning,fontFeatureSettings,fontWeight,fontSmoothing,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariationSettings,fontVariantNumeric,letterSpacing,lineHeight,textAlign,textDecoration,textDecorationColor,textEmphasisColor,textDecorationStyle,textDecorationThickness,textUnderlineOffset,textTransform,textIndent,textShadow,textOverflow,verticalAlign,wordBreak,textWrap,truncate,lineClamp,listStyleType,listStylePosition,listStyleImage,listStyle,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundAttachment,backgroundClip,background,backgroundColor,backgroundOrigin,backgroundImage,backgroundRepeat,backgroundBlendMode,backgroundSize,backgroundGradient,textGradient,gradientFromPosition,gradientToPosition,gradientFrom,gradientTo,gradientVia,gradientViaPosition,borderRadius,borderTopLeftRadius,borderTopRightRadius,borderBottomRightRadius,borderBottomLeftRadius,borderTopRadius,borderRightRadius,borderBottomRadius,borderLeftRadius,borderStartStartRadius,borderStartEndRadius,borderStartRadius,borderEndStartRadius,borderEndEndRadius,borderEndRadius,border,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,borderColor,borderInline,borderInlineWidth,borderInlineColor,borderBlock,borderBlockWidth,borderBlockColor,borderLeft,borderLeftColor,borderInlineStart,borderInlineStartWidth,borderInlineStartColor,borderRight,borderRightColor,borderInlineEnd,borderInlineEndWidth,borderInlineEndColor,borderTop,borderTopColor,borderBottom,borderBottomColor,borderBlockEnd,borderBlockEndColor,borderBlockStart,borderBlockStartColor,opacity,boxShadow,boxShadowColor,mixBlendMode,filter,brightness,contrast,grayscale,hueRotate,invert,saturate,sepia,dropShadow,blur,backdropFilter,backdropBlur,backdropBrightness,backdropContrast,backdropGrayscale,backdropHueRotate,backdropInvert,backdropOpacity,backdropSaturate,backdropSepia,borderCollapse,borderSpacing,borderSpacingX,borderSpacingY,tableLayout,transitionTimingFunction,transitionDelay,transitionDuration,transitionProperty,transition,animation,animationName,animationTimingFunction,animationDuration,animationDelay,animationPlayState,animationComposition,animationFillMode,animationDirection,animationIterationCount,animationRange,animationState,animationRangeStart,animationRangeEnd,animationTimeline,transformOrigin,transformBox,transformStyle,transform,rotate,rotateX,rotateY,rotateZ,scale,scaleX,scaleY,translate,translateX,translateY,translateZ,accentColor,caretColor,scrollBehavior,scrollbar,scrollbarColor,scrollbarGutter,scrollbarWidth,scrollMargin,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollMarginBottom,scrollMarginBlock,scrollMarginBlockEnd,scrollMarginBlockStart,scrollMarginInline,scrollMarginInlineEnd,scrollMarginInlineStart,scrollPadding,scrollPaddingBlock,scrollPaddingBlockStart,scrollPaddingBlockEnd,scrollPaddingInline,scrollPaddingInlineEnd,scrollPaddingInlineStart,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollPaddingBottom,scrollSnapAlign,scrollSnapStop,scrollSnapType,scrollSnapStrictness,scrollSnapMargin,scrollSnapMarginTop,scrollSnapMarginBottom,scrollSnapMarginLeft,scrollSnapMarginRight,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,touchAction,userSelect,overflow,overflowWrap,overflowX,overflowY,overflowAnchor,overflowBlock,overflowInline,overflowClipBox,overflowClipMargin,overscrollBehaviorBlock,overscrollBehaviorInline,fill,stroke,strokeWidth,strokeDasharray,strokeDashoffset,strokeLinecap,strokeLinejoin,strokeMiterlimit,strokeOpacity,srOnly,debug,appearance,backfaceVisibility,clipPath,hyphens,mask,maskImage,maskSize,textSizeAdjust,container,containerName,containerType,colorPalette,_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_collapsed,_off,_on,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,textStyle";
445
+ var userGenerated = userGeneratedStr.split(",");
446
+ var cssPropertiesStr = "WebkitAppearance,WebkitBorderBefore,WebkitBorderBeforeColor,WebkitBorderBeforeStyle,WebkitBorderBeforeWidth,WebkitBoxReflect,WebkitLineClamp,WebkitMask,WebkitMaskAttachment,WebkitMaskClip,WebkitMaskComposite,WebkitMaskImage,WebkitMaskOrigin,WebkitMaskPosition,WebkitMaskPositionX,WebkitMaskPositionY,WebkitMaskRepeat,WebkitMaskRepeatX,WebkitMaskRepeatY,WebkitMaskSize,WebkitOverflowScrolling,WebkitTapHighlightColor,WebkitTextFillColor,WebkitTextStroke,WebkitTextStrokeColor,WebkitTextStrokeWidth,WebkitTouchCallout,WebkitUserModify,WebkitUserSelect,accentColor,alignContent,alignItems,alignSelf,alignTracks,all,anchorName,anchorScope,animation,animationComposition,animationDelay,animationDirection,animationDuration,animationFillMode,animationIterationCount,animationName,animationPlayState,animationRange,animationRangeEnd,animationRangeStart,animationTimeline,animationTimingFunction,appearance,aspectRatio,backdropFilter,backfaceVisibility,background,backgroundAttachment,backgroundBlendMode,backgroundClip,backgroundColor,backgroundImage,backgroundOrigin,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundRepeat,backgroundSize,blockSize,border,borderBlock,borderBlockColor,borderBlockEnd,borderBlockEndColor,borderBlockEndStyle,borderBlockEndWidth,borderBlockStart,borderBlockStartColor,borderBlockStartStyle,borderBlockStartWidth,borderBlockStyle,borderBlockWidth,borderBottom,borderBottomColor,borderBottomLeftRadius,borderBottomRightRadius,borderBottomStyle,borderBottomWidth,borderCollapse,borderColor,borderEndEndRadius,borderEndStartRadius,borderImage,borderImageOutset,borderImageRepeat,borderImageSlice,borderImageSource,borderImageWidth,borderInline,borderInlineColor,borderInlineEnd,borderInlineEndColor,borderInlineEndStyle,borderInlineEndWidth,borderInlineStart,borderInlineStartColor,borderInlineStartStyle,borderInlineStartWidth,borderInlineStyle,borderInlineWidth,borderLeft,borderLeftColor,borderLeftStyle,borderLeftWidth,borderRadius,borderRight,borderRightColor,borderRightStyle,borderRightWidth,borderSpacing,borderStartEndRadius,borderStartStartRadius,borderStyle,borderTop,borderTopColor,borderTopLeftRadius,borderTopRightRadius,borderTopStyle,borderTopWidth,borderWidth,bottom,boxAlign,boxDecorationBreak,boxDirection,boxFlex,boxFlexGroup,boxLines,boxOrdinalGroup,boxOrient,boxPack,boxShadow,boxSizing,breakAfter,breakBefore,breakInside,captionSide,caret,caretColor,caretShape,clear,clip,clipPath,clipRule,color,colorInterpolationFilters,colorScheme,columnCount,columnFill,columnGap,columnRule,columnRuleColor,columnRuleStyle,columnRuleWidth,columnSpan,columnWidth,columns,contain,containIntrinsicBlockSize,containIntrinsicHeight,containIntrinsicInlineSize,containIntrinsicSize,containIntrinsicWidth,container,containerName,containerType,content,contentVisibility,counterIncrement,counterReset,counterSet,cursor,cx,cy,d,direction,display,dominantBaseline,emptyCells,fieldSizing,fill,fillOpacity,fillRule,filter,flex,flexBasis,flexDirection,flexFlow,flexGrow,flexShrink,flexWrap,float,floodColor,floodOpacity,font,fontFamily,fontFeatureSettings,fontKerning,fontLanguageOverride,fontOpticalSizing,fontPalette,fontSize,fontSizeAdjust,fontSmooth,fontStretch,fontStyle,fontSynthesis,fontSynthesisPosition,fontSynthesisSmallCaps,fontSynthesisStyle,fontSynthesisWeight,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariantEastAsian,fontVariantEmoji,fontVariantLigatures,fontVariantNumeric,fontVariantPosition,fontVariationSettings,fontWeight,forcedColorAdjust,gap,grid,gridArea,gridAutoColumns,gridAutoFlow,gridAutoRows,gridColumn,gridColumnEnd,gridColumnGap,gridColumnStart,gridGap,gridRow,gridRowEnd,gridRowGap,gridRowStart,gridTemplate,gridTemplateAreas,gridTemplateColumns,gridTemplateRows,hangingPunctuation,height,hyphenateCharacter,hyphenateLimitChars,hyphens,imageOrientation,imageRendering,imageResolution,imeMode,initialLetter,initialLetterAlign,inlineSize,inset,insetBlock,insetBlockEnd,insetBlockStart,insetInline,insetInlineEnd,insetInlineStart,interpolateSize,isolation,justifyContent,justifyItems,justifySelf,justifyTracks,left,letterSpacing,lightingColor,lineBreak,lineClamp,lineHeight,lineHeightStep,listStyle,listStyleImage,listStylePosition,listStyleType,margin,marginBlock,marginBlockEnd,marginBlockStart,marginBottom,marginInline,marginInlineEnd,marginInlineStart,marginLeft,marginRight,marginTop,marginTrim,marker,markerEnd,markerMid,markerStart,mask,maskBorder,maskBorderMode,maskBorderOutset,maskBorderRepeat,maskBorderSlice,maskBorderSource,maskBorderWidth,maskClip,maskComposite,maskImage,maskMode,maskOrigin,maskPosition,maskRepeat,maskSize,maskType,masonryAutoFlow,mathDepth,mathShift,mathStyle,maxBlockSize,maxHeight,maxInlineSize,maxLines,maxWidth,minBlockSize,minHeight,minInlineSize,minWidth,mixBlendMode,objectFit,objectPosition,offset,offsetAnchor,offsetDistance,offsetPath,offsetPosition,offsetRotate,opacity,order,orphans,outline,outlineColor,outlineOffset,outlineStyle,outlineWidth,overflow,overflowAnchor,overflowBlock,overflowClipBox,overflowClipMargin,overflowInline,overflowWrap,overflowX,overflowY,overlay,overscrollBehavior,overscrollBehaviorBlock,overscrollBehaviorInline,overscrollBehaviorX,overscrollBehaviorY,padding,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingBottom,paddingInline,paddingInlineEnd,paddingInlineStart,paddingLeft,paddingRight,paddingTop,page,pageBreakAfter,pageBreakBefore,pageBreakInside,paintOrder,perspective,perspectiveOrigin,placeContent,placeItems,placeSelf,pointerEvents,position,positionAnchor,positionArea,positionTry,positionTryFallbacks,positionTryOrder,positionVisibility,printColorAdjust,quotes,r,resize,right,rotate,rowGap,rubyAlign,rubyMerge,rubyPosition,rx,ry,scale,scrollBehavior,scrollMargin,scrollMarginBlock,scrollMarginBlockEnd,scrollMarginBlockStart,scrollMarginBottom,scrollMarginInline,scrollMarginInlineEnd,scrollMarginInlineStart,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollPadding,scrollPaddingBlock,scrollPaddingBlockEnd,scrollPaddingBlockStart,scrollPaddingBottom,scrollPaddingInline,scrollPaddingInlineEnd,scrollPaddingInlineStart,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollSnapAlign,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapStop,scrollSnapType,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,scrollbarColor,scrollbarGutter,scrollbarWidth,shapeImageThreshold,shapeMargin,shapeOutside,shapeRendering,stopColor,stopOpacity,stroke,strokeDasharray,strokeDashoffset,strokeLinecap,strokeLinejoin,strokeMiterlimit,strokeOpacity,strokeWidth,tabSize,tableLayout,textAlign,textAlignLast,textAnchor,textBox,textBoxEdge,textBoxTrim,textCombineUpright,textDecoration,textDecorationColor,textDecorationLine,textDecorationSkip,textDecorationSkipInk,textDecorationStyle,textDecorationThickness,textEmphasis,textEmphasisColor,textEmphasisPosition,textEmphasisStyle,textIndent,textJustify,textOrientation,textOverflow,textRendering,textShadow,textSizeAdjust,textSpacingTrim,textTransform,textUnderlineOffset,textUnderlinePosition,textWrap,textWrapMode,textWrapStyle,timelineScope,top,touchAction,transform,transformBox,transformOrigin,transformStyle,transition,transitionBehavior,transitionDelay,transitionDuration,transitionProperty,transitionTimingFunction,translate,unicodeBidi,userSelect,vectorEffect,verticalAlign,viewTimeline,viewTimelineAxis,viewTimelineInset,viewTimelineName,viewTransitionName,visibility,whiteSpace,whiteSpaceCollapse,widows,width,willChange,wordBreak,wordSpacing,wordWrap,writingMode,x,y,zIndex,zoom,alignmentBaseline,baselineShift,colorInterpolation,colorRendering,glyphOrientationVertical";
447
+ var allCssProperties = cssPropertiesStr.split(",").concat(userGenerated);
448
+ var properties = new Map(allCssProperties.map((prop) => [prop, true]));
449
+ var cssPropertySelectorRegex = /&|@/;
450
+ var isCssProperty = /* @__PURE__ */ memo((prop) => {
451
+ return properties.has(prop) || prop.startsWith("--") || cssPropertySelectorRegex.test(prop);
452
+ });
453
+ const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop);
454
+ const composeShouldForwardProps = (tag, shouldForwardProp2) => tag.__shouldForwardProps__ && shouldForwardProp2 ? (propName) => tag.__shouldForwardProps__(propName) && shouldForwardProp2(propName) : shouldForwardProp2;
455
+ const composeCvaFn = (cvaA, cvaB) => {
456
+ var _a;
457
+ if (cvaA && !cvaB) return cvaA;
458
+ if (!cvaA && cvaB) return cvaB;
459
+ if (cvaA.__cva__ && cvaB.__cva__ || cvaA.__recipe__ && cvaB.__recipe__) return cvaA.merge(cvaB);
460
+ const error = new TypeError("Cannot merge cva with recipe. Please use either cva or recipe.");
461
+ (_a = TypeError.captureStackTrace) == null ? void 0 : _a.call(TypeError, error);
462
+ throw error;
463
+ };
464
+ const getDisplayName = (Component) => {
465
+ if (typeof Component === "string") return Component;
466
+ return (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Component";
467
+ };
468
+ function styledFn(Dynamic, configOrCva = {}, options = {}) {
469
+ const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva);
470
+ const forwardFn = options.shouldForwardProp || defaultShouldForwardProp;
471
+ const shouldForwardProp2 = (prop) => forwardFn(prop, cvaFn.variantKeys);
472
+ const defaultProps = Object.assign(
473
+ options.dataAttr && configOrCva.__name__ ? { "data-recipe": configOrCva.__name__ } : {},
474
+ options.defaultProps
475
+ );
476
+ const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn);
477
+ const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp2);
478
+ const __base__ = Dynamic.__base__ || Dynamic;
479
+ const StyledComponent = /* @__PURE__ */ React.forwardRef(function StyledComponent2(props, ref) {
480
+ const { as: Element = __base__, children, ...restProps } = props;
481
+ const combinedProps = React.useMemo(() => Object.assign({}, defaultProps, restProps), [restProps]);
482
+ const [htmlProps2, forwardedProps, variantProps, styleProps, elementProps] = React.useMemo(() => {
483
+ return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty);
484
+ }, [combinedProps]);
485
+ function recipeClass() {
486
+ var _a;
487
+ const { css: cssStyles, ...propStyles } = styleProps;
488
+ const compoundVariantStyles = (_a = __cvaFn__.__getCompoundVariantCss__) == null ? void 0 : _a.call(__cvaFn__, variantProps);
489
+ return cx(__cvaFn__(variantProps, false), css$1(compoundVariantStyles, propStyles, cssStyles), combinedProps.className);
490
+ }
491
+ function cvaClass() {
492
+ const { css: cssStyles, ...propStyles } = styleProps;
493
+ const cvaStyles = __cvaFn__.raw(variantProps);
494
+ return cx(css$1(cvaStyles, propStyles, cssStyles), combinedProps.className);
495
+ }
496
+ const classes = configOrCva.__recipe__ ? recipeClass : cvaClass;
497
+ return React.createElement(Element, {
498
+ ref,
499
+ ...forwardedProps,
500
+ ...elementProps,
501
+ ...normalizeHTMLProps(htmlProps2),
502
+ className: classes()
503
+ }, combinedProps.children ?? children);
504
+ });
505
+ const name = getDisplayName(__base__);
506
+ StyledComponent.displayName = `styled.${name}`;
507
+ StyledComponent.__cva__ = __cvaFn__;
508
+ StyledComponent.__base__ = __base__;
509
+ StyledComponent.__shouldForwardProps__ = shouldForwardProp2;
510
+ return StyledComponent;
511
+ }
512
+ function createJsxFactory() {
513
+ const cache = /* @__PURE__ */ new Map();
514
+ return new Proxy(styledFn, {
515
+ apply(_, __, args) {
516
+ return styledFn(...args);
517
+ },
518
+ get(_, el) {
519
+ if (!cache.has(el)) {
520
+ cache.set(el, styledFn(el));
521
+ }
522
+ return cache.get(el);
523
+ }
524
+ });
525
+ }
526
+ const styled = /* @__PURE__ */ createJsxFactory();
527
+ const centerConfig = {
528
+ transform(props) {
529
+ const { inline, ...rest } = props;
530
+ return {
531
+ display: inline ? "inline-flex" : "flex",
532
+ alignItems: "center",
533
+ justifyContent: "center",
534
+ ...rest
535
+ };
536
+ }
537
+ };
538
+ const getCenterStyle = (styles = {}) => {
539
+ const _styles = getPatternStyles(centerConfig, styles);
540
+ return centerConfig.transform(_styles, patternFns);
541
+ };
542
+ const Center = /* @__PURE__ */ React.forwardRef(function Center2(props, ref) {
543
+ const [patternProps, restProps] = splitProps(props, ["inline"]);
544
+ const styleProps = getCenterStyle(patternProps);
545
+ const mergedProps = { ref, ...styleProps, ...restProps };
546
+ return React.createElement(styled.div, mergedProps);
547
+ });
548
+ function getErrorMessage(hook, provider) {
549
+ return `${hook} returned \`undefined\`. Seems you forgot to wrap component within ${provider}`;
550
+ }
551
+ function createContext(options = {}) {
552
+ const {
553
+ name,
554
+ strict = true,
555
+ hookName = "useContext",
556
+ providerName = "Provider",
557
+ errorMessage,
558
+ defaultValue
559
+ } = options;
560
+ const Context = React.createContext(defaultValue);
561
+ Context.displayName = name;
562
+ function useContext$1() {
563
+ var _a;
564
+ const context2 = React.useContext(Context);
565
+ if (!context2 && strict) {
566
+ const error = new Error(errorMessage ?? getErrorMessage(hookName, providerName));
567
+ error.name = "ContextError";
568
+ (_a = Error.captureStackTrace) == null ? void 0 : _a.call(Error, error, useContext$1);
569
+ throw error;
570
+ }
571
+ return context2;
572
+ }
573
+ return [Context.Provider, useContext$1, Context];
574
+ }
575
+ function toArray(v2) {
576
+ if (!v2) return [];
577
+ return Array.isArray(v2) ? v2 : [v2];
578
+ }
579
+ var isString = (v2) => typeof v2 === "string";
580
+ var isFunction = (v2) => typeof v2 === "function";
581
+ var fnToString = Function.prototype.toString;
582
+ fnToString.call(Object);
583
+ var identity = (v2) => v2();
584
+ var callAll = (...fns2) => (...a) => {
585
+ fns2.forEach(function(fn) {
586
+ fn == null ? void 0 : fn(...a);
587
+ });
588
+ };
589
+ function compact(obj) {
590
+ if (!isPlainObject2(obj) || obj === void 0) return obj;
591
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
592
+ const filtered = {};
593
+ for (const key of keys) {
594
+ const value = obj[key];
595
+ if (value !== void 0) {
596
+ filtered[key] = compact(value);
597
+ }
598
+ }
599
+ return filtered;
600
+ }
601
+ var isPlainObject2 = (v2) => {
602
+ return v2 && typeof v2 === "object" && v2.constructor === Object;
603
+ };
604
+ function warn(...a) {
605
+ const m2 = a.length === 1 ? a[0] : a[1];
606
+ const c = a.length === 2 ? a[0] : true;
607
+ if (c && process.env.NODE_ENV !== "production") {
608
+ console.warn(m2);
609
+ }
610
+ }
611
+ function ensure(c, m2) {
612
+ if (c == null) throw new Error(m2);
613
+ }
614
+ var isObject = (v2) => typeof v2 === "object" && v2 !== null;
615
+ var ELEMENT_NODE = 1;
616
+ var DOCUMENT_NODE = 9;
617
+ var DOCUMENT_FRAGMENT_NODE = 11;
618
+ var isHTMLElement = (el) => isObject(el) && el.nodeType === ELEMENT_NODE && typeof el.nodeName === "string";
619
+ var isDocument = (el) => isObject(el) && el.nodeType === DOCUMENT_NODE;
620
+ var isWindow = (el) => isObject(el) && el === el.window;
621
+ var getNodeName = (node) => {
622
+ if (isHTMLElement(node)) return node.localName || "";
623
+ return "#document";
624
+ };
625
+ function isRootElement(node) {
626
+ return ["html", "body", "#document"].includes(getNodeName(node));
627
+ }
628
+ var isNode = (el) => isObject(el) && el.nodeType !== void 0;
629
+ var isShadowRoot = (el) => isNode(el) && el.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in el;
630
+ var isInputElement = (el) => isHTMLElement(el) && el.localName === "input";
631
+ var isElementVisible = (el) => {
632
+ if (!isHTMLElement(el)) return false;
633
+ return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
634
+ };
635
+ var TEXTAREA_SELECT_REGEX = /(textarea|select)/;
636
+ function isEditableElement(el) {
637
+ if (el == null || !isHTMLElement(el)) return false;
638
+ try {
639
+ return isInputElement(el) && el.selectionStart != null || TEXTAREA_SELECT_REGEX.test(el.localName) || el.isContentEditable || el.getAttribute("contenteditable") === "true" || el.getAttribute("contenteditable") === "";
640
+ } catch {
641
+ return false;
642
+ }
643
+ }
644
+ function contains(parent, child) {
645
+ var _a;
646
+ if (!parent || !child) return false;
647
+ if (!isHTMLElement(parent) || !isHTMLElement(child)) return false;
648
+ const rootNode = (_a = child.getRootNode) == null ? void 0 : _a.call(child);
649
+ if (parent === child) return true;
650
+ if (parent.contains(child)) return true;
651
+ if (rootNode && isShadowRoot(rootNode)) {
652
+ let next = child;
653
+ while (next) {
654
+ if (parent === next) return true;
655
+ next = next.parentNode || next.host;
656
+ }
657
+ }
658
+ return false;
659
+ }
660
+ function getDocument(el) {
661
+ if (isDocument(el)) return el;
662
+ if (isWindow(el)) return el.document;
663
+ return (el == null ? void 0 : el.ownerDocument) ?? document;
664
+ }
665
+ function getDocumentElement(el) {
666
+ return getDocument(el).documentElement;
667
+ }
668
+ function getWindow(el) {
669
+ var _a;
670
+ if (isShadowRoot(el)) return getWindow(el.host);
671
+ if (isDocument(el)) return el.defaultView ?? window;
672
+ if (isHTMLElement(el)) return ((_a = el.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
673
+ return window;
674
+ }
675
+ function getActiveElement(rootNode) {
676
+ let activeElement = rootNode.activeElement;
677
+ while (activeElement == null ? void 0 : activeElement.shadowRoot) {
678
+ const el = activeElement.shadowRoot.activeElement;
679
+ if (el === activeElement) break;
680
+ else activeElement = el;
681
+ }
682
+ return activeElement;
683
+ }
684
+ function getParentNode$1(node) {
685
+ if (getNodeName(node) === "html") return node;
686
+ const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
687
+ return isShadowRoot(result) ? result.host : result;
688
+ }
689
+ var styleCache = /* @__PURE__ */ new WeakMap();
690
+ function getComputedStyle(el) {
691
+ if (!styleCache.has(el)) {
692
+ styleCache.set(el, getWindow(el).getComputedStyle(el));
693
+ }
694
+ return styleCache.get(el);
695
+ }
696
+ var isDom = () => typeof document !== "undefined";
697
+ function getPlatform() {
698
+ const agent = navigator.userAgentData;
699
+ return (agent == null ? void 0 : agent.platform) ?? navigator.platform;
700
+ }
701
+ var pt = (v2) => isDom() && v2.test(getPlatform());
702
+ var isMac = () => pt(/^Mac/);
703
+ var isIos = () => pt(/iP(hone|ad|od)|iOS/);
704
+ function getComposedPath(event) {
705
+ var _a, _b, _c;
706
+ return ((_a = event.composedPath) == null ? void 0 : _a.call(event)) ?? ((_c = (_b = event.nativeEvent) == null ? void 0 : _b.composedPath) == null ? void 0 : _c.call(_b));
707
+ }
708
+ function getEventTarget(event) {
709
+ const composedPath = getComposedPath(event);
710
+ return (composedPath == null ? void 0 : composedPath[0]) ?? event.target;
711
+ }
712
+ var isContextMenuEvent = (e) => {
713
+ return e.button === 2 || isMac() && e.ctrlKey && e.button === 0;
714
+ };
715
+ var addDomEvent = (target, eventName, handler, options) => {
716
+ const node = typeof target === "function" ? target() : target;
717
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
718
+ return () => {
719
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
720
+ };
721
+ };
722
+ var isFrame = (el) => isHTMLElement(el) && el.tagName === "IFRAME";
723
+ var hasTabIndex = (el) => !Number.isNaN(parseInt(el.getAttribute("tabindex") || "0", 10));
724
+ var hasNegativeTabIndex = (el) => parseInt(el.getAttribute("tabindex") || "0", 10) < 0;
725
+ var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
726
+ var getFocusables = (container, includeContainer = false) => {
727
+ if (!container) return [];
728
+ const elements = Array.from(container.querySelectorAll(focusableSelector));
729
+ const include = includeContainer == true || includeContainer == "if-empty" && elements.length === 0;
730
+ if (include && isHTMLElement(container) && isFocusable(container)) {
731
+ elements.unshift(container);
732
+ }
733
+ const focusableElements = elements.filter(isFocusable);
734
+ focusableElements.forEach((element, i) => {
735
+ if (isFrame(element) && element.contentDocument) {
736
+ const frameBody = element.contentDocument.body;
737
+ focusableElements.splice(i, 1, ...getFocusables(frameBody));
738
+ }
739
+ });
740
+ return focusableElements;
741
+ };
742
+ function isFocusable(element) {
743
+ if (!element || element.closest("[inert]")) return false;
744
+ return element.matches(focusableSelector) && isElementVisible(element);
745
+ }
746
+ function getTabbables(container, includeContainer) {
747
+ if (!container) return [];
748
+ const elements = Array.from(container.querySelectorAll(focusableSelector));
749
+ const tabbableElements = elements.filter(isTabbable);
750
+ tabbableElements.forEach((element, i) => {
751
+ if (isFrame(element) && element.contentDocument) {
752
+ const frameBody = element.contentDocument.body;
753
+ const allFrameTabbable = getTabbables(frameBody);
754
+ tabbableElements.splice(i, 1, ...allFrameTabbable);
755
+ }
756
+ });
757
+ if (!tabbableElements.length && includeContainer) ;
758
+ return tabbableElements;
759
+ }
760
+ function isTabbable(el) {
761
+ if (el != null && el.tabIndex > 0) return true;
762
+ return isFocusable(el) && !hasNegativeTabIndex(el);
763
+ }
764
+ function getTabIndex(node) {
765
+ if (node.tabIndex < 0) {
766
+ if ((/^(audio|video|details)$/.test(node.localName) || isEditableElement(node)) && !hasTabIndex(node)) {
767
+ return 0;
768
+ }
769
+ }
770
+ return node.tabIndex;
771
+ }
772
+ function nextTick(fn) {
773
+ const set2 = /* @__PURE__ */ new Set();
774
+ function raf2(fn2) {
775
+ const id = globalThis.requestAnimationFrame(fn2);
776
+ set2.add(() => globalThis.cancelAnimationFrame(id));
777
+ }
778
+ raf2(() => raf2(fn));
779
+ return function cleanup() {
780
+ set2.forEach((fn2) => fn2());
781
+ };
782
+ }
783
+ function raf$1(fn) {
784
+ let cleanup;
785
+ const id = globalThis.requestAnimationFrame(() => {
786
+ cleanup = fn();
787
+ });
788
+ return () => {
789
+ globalThis.cancelAnimationFrame(id);
790
+ cleanup == null ? void 0 : cleanup();
791
+ };
792
+ }
793
+ function getNearestOverflowAncestor(el) {
794
+ const parentNode = getParentNode$1(el);
795
+ if (isRootElement(parentNode)) return getDocument(parentNode).body;
796
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
797
+ return getNearestOverflowAncestor(parentNode);
798
+ }
799
+ var OVERFLOW_RE = /auto|scroll|overlay|hidden|clip/;
800
+ function isOverflowElement(el) {
801
+ const win = getWindow(el);
802
+ const { overflow, overflowX, overflowY, display } = win.getComputedStyle(el);
803
+ return OVERFLOW_RE.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
804
+ }
805
+ var cleanups = /* @__PURE__ */ new WeakMap();
806
+ function set(element, key, setup) {
807
+ if (!cleanups.has(element)) {
808
+ cleanups.set(element, /* @__PURE__ */ new Map());
809
+ }
810
+ const elementCleanups = cleanups.get(element);
811
+ const prevCleanup = elementCleanups.get(key);
812
+ if (!prevCleanup) {
813
+ elementCleanups.set(key, setup());
814
+ return () => {
815
+ var _a;
816
+ (_a = elementCleanups.get(key)) == null ? void 0 : _a();
817
+ elementCleanups.delete(key);
818
+ };
819
+ }
820
+ const cleanup = setup();
821
+ const nextCleanup = () => {
822
+ cleanup();
823
+ prevCleanup();
824
+ elementCleanups.delete(key);
825
+ };
826
+ elementCleanups.set(key, nextCleanup);
827
+ return () => {
828
+ const isCurrent = elementCleanups.get(key) === nextCleanup;
829
+ if (!isCurrent) return;
830
+ cleanup();
831
+ elementCleanups.set(key, prevCleanup);
832
+ };
833
+ }
834
+ function setStyle(element, style) {
835
+ if (!element) return () => {
836
+ };
837
+ const setup = () => {
838
+ const prevStyle = element.style.cssText;
839
+ Object.assign(element.style, style);
840
+ return () => {
841
+ element.style.cssText = prevStyle;
842
+ };
843
+ };
844
+ return set(element, "style", setup);
845
+ }
846
+ var fps = 1e3 / 60;
847
+ function waitForElement(query2, cb) {
848
+ const el = query2();
849
+ if (isHTMLElement(el) && el.isConnected) {
850
+ cb(el);
851
+ return () => void 0;
852
+ } else {
853
+ const timerId = setInterval(() => {
854
+ const el2 = query2();
855
+ if (isHTMLElement(el2) && el2.isConnected) {
856
+ cb(el2);
857
+ clearInterval(timerId);
858
+ }
859
+ }, fps);
860
+ return () => clearInterval(timerId);
861
+ }
862
+ }
863
+ function waitForElements(queries, cb) {
864
+ const cleanups2 = [];
865
+ queries == null ? void 0 : queries.forEach((query2) => {
866
+ const clean = waitForElement(query2, cb);
867
+ cleanups2.push(clean);
868
+ });
869
+ return () => {
870
+ cleanups2.forEach((fn) => fn());
871
+ };
872
+ }
873
+ var clsx = (...args) => args.map((str) => {
874
+ var _a;
875
+ return (_a = str == null ? void 0 : str.trim) == null ? void 0 : _a.call(str);
876
+ }).filter(Boolean).join(" ");
877
+ var CSS_REGEX = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;
878
+ var serialize = (style) => {
879
+ const res = {};
880
+ let match;
881
+ while (match = CSS_REGEX.exec(style)) {
882
+ res[match[1]] = match[2];
883
+ }
884
+ return res;
885
+ };
886
+ var css = (a, b) => {
887
+ if (isString(a)) {
888
+ if (isString(b)) return `${a};${b}`;
889
+ a = serialize(a);
890
+ } else if (isString(b)) {
891
+ b = serialize(b);
892
+ }
893
+ return Object.assign({}, a ?? {}, b ?? {});
894
+ };
895
+ function mergeProps(...args) {
896
+ let result = {};
897
+ for (let props of args) {
898
+ for (let key in result) {
899
+ if (key.startsWith("on") && typeof result[key] === "function" && typeof props[key] === "function") {
900
+ result[key] = callAll(props[key], result[key]);
901
+ continue;
902
+ }
903
+ if (key === "className" || key === "class") {
904
+ result[key] = clsx(result[key], props[key]);
905
+ continue;
906
+ }
907
+ if (key === "style") {
908
+ result[key] = css(result[key], props[key]);
909
+ continue;
910
+ }
911
+ result[key] = props[key] !== void 0 ? props[key] : result[key];
912
+ }
913
+ for (let key in props) {
914
+ if (result[key] === void 0) {
915
+ result[key] = props[key];
916
+ }
917
+ }
918
+ }
919
+ return result;
920
+ }
921
+ function createMachine(config) {
922
+ return config;
923
+ }
924
+ function createScope(props) {
925
+ const getRootNode = () => {
926
+ var _a;
927
+ return ((_a = props.getRootNode) == null ? void 0 : _a.call(props)) ?? document;
928
+ };
929
+ const getDoc = () => getDocument(getRootNode());
930
+ const getWin = () => getDoc().defaultView ?? window;
931
+ const getActiveElementFn = () => getActiveElement(getRootNode());
932
+ const isActiveElement = (elem) => elem === getActiveElementFn();
933
+ const getById = (id) => getRootNode().getElementById(id);
934
+ return {
935
+ ...props,
936
+ getRootNode,
937
+ getDoc,
938
+ getWin,
939
+ getActiveElement: getActiveElementFn,
940
+ isActiveElement,
941
+ getById
942
+ };
943
+ }
944
+ function createNormalizer(fn) {
945
+ return new Proxy({}, {
946
+ get(_target, key) {
947
+ if (key === "style")
948
+ return (props) => {
949
+ return fn({ style: props }).style;
950
+ };
951
+ return fn;
952
+ }
953
+ });
954
+ }
955
+ var createProps = () => (props) => Array.from(new Set(props));
956
+ var useSafeLayoutEffect = typeof globalThis.document !== "undefined" ? React.useLayoutEffect : React.useEffect;
957
+ function useBindable(props) {
958
+ const initial = props().value ?? props().defaultValue;
959
+ const eq = props().isEqual ?? Object.is;
960
+ const [initialValue] = React.useState(initial);
961
+ const [value, setValue] = React.useState(initialValue);
962
+ const controlled = props().value !== void 0;
963
+ const valueRef = React.useRef(value);
964
+ valueRef.current = controlled ? props().value : value;
965
+ const prevValue = React.useRef(valueRef.current);
966
+ useSafeLayoutEffect(() => {
967
+ prevValue.current = valueRef.current;
968
+ }, [value, props().value]);
969
+ const setFn = (value2) => {
970
+ var _a, _b;
971
+ const prev = prevValue.current;
972
+ const next = isFunction(value2) ? value2(prev) : value2;
973
+ if (props().debug) {
974
+ console.log(`[bindable > ${props().debug}] setValue`, { next, prev });
975
+ }
976
+ if (!controlled) setValue(next);
977
+ if (!eq(next, prev)) {
978
+ (_b = (_a = props()).onChange) == null ? void 0 : _b.call(_a, next, prev);
979
+ }
980
+ };
981
+ function get() {
982
+ return controlled ? props().value : value;
983
+ }
984
+ return {
985
+ initial: initialValue,
986
+ ref: valueRef,
987
+ get,
988
+ set(value2) {
989
+ const exec = props().sync ? reactDom.flushSync : identity;
990
+ exec(() => setFn(value2));
991
+ },
992
+ invoke(nextValue, prevValue2) {
993
+ var _a, _b;
994
+ (_b = (_a = props()).onChange) == null ? void 0 : _b.call(_a, nextValue, prevValue2);
995
+ },
996
+ hash(value2) {
997
+ var _a, _b;
998
+ return ((_b = (_a = props()).hash) == null ? void 0 : _b.call(_a, value2)) ?? String(value2);
999
+ }
1000
+ };
1001
+ }
1002
+ function useRefs(refs) {
1003
+ const ref = React.useRef(refs);
1004
+ return {
1005
+ get(key) {
1006
+ return ref.current[key];
1007
+ },
1008
+ set(key, value) {
1009
+ ref.current[key] = value;
1010
+ }
1011
+ };
1012
+ }
1013
+ var useTrack = (deps, effect) => {
1014
+ const render = React.useRef(false);
1015
+ const called = React.useRef(false);
1016
+ React.useEffect(() => {
1017
+ const mounted = render.current;
1018
+ const run = mounted && called.current;
1019
+ if (run) return effect();
1020
+ called.current = true;
1021
+ }, [...(deps ?? []).map((d) => typeof d === "function" ? d() : d)]);
1022
+ React.useEffect(() => {
1023
+ render.current = true;
1024
+ return () => {
1025
+ render.current = false;
1026
+ };
1027
+ }, []);
1028
+ };
1029
+ function useMachine(machine2, userProps = {}) {
1030
+ var _a, _b, _c, _d;
1031
+ const scope = React.useMemo(() => {
1032
+ const { id, ids, getRootNode } = userProps;
1033
+ return createScope({ id, ids, getRootNode });
1034
+ }, [userProps]);
1035
+ const debug = (...args) => {
1036
+ if (machine2.debug) console.log(...args);
1037
+ };
1038
+ const props = ((_a = machine2.props) == null ? void 0 : _a.call(machine2, { props: compact(userProps), scope })) ?? userProps;
1039
+ const prop = useProp(props);
1040
+ const context2 = (_b = machine2.context) == null ? void 0 : _b.call(machine2, {
1041
+ prop,
1042
+ bindable: useBindable,
1043
+ scope,
1044
+ flush,
1045
+ getContext() {
1046
+ return ctx;
1047
+ },
1048
+ getComputed() {
1049
+ return computed;
1050
+ }
1051
+ });
1052
+ const contextRef = useLiveRef(context2);
1053
+ const ctx = {
1054
+ get(key) {
1055
+ var _a2;
1056
+ return (_a2 = contextRef.current) == null ? void 0 : _a2[key].ref.current;
1057
+ },
1058
+ set(key, value) {
1059
+ var _a2;
1060
+ (_a2 = contextRef.current) == null ? void 0 : _a2[key].set(value);
1061
+ },
1062
+ initial(key) {
1063
+ var _a2;
1064
+ return (_a2 = contextRef.current) == null ? void 0 : _a2[key].initial;
1065
+ },
1066
+ hash(key) {
1067
+ var _a2, _b2;
1068
+ const current = (_a2 = contextRef.current) == null ? void 0 : _a2[key].get();
1069
+ return (_b2 = contextRef.current) == null ? void 0 : _b2[key].hash(current);
1070
+ }
1071
+ };
1072
+ const effects = React.useRef(/* @__PURE__ */ new Map());
1073
+ const transitionRef = React.useRef(null);
1074
+ const previousEventRef = React.useRef(null);
1075
+ const eventRef = React.useRef({ type: "" });
1076
+ const getEvent = () => ({
1077
+ ...eventRef.current,
1078
+ current() {
1079
+ return eventRef.current;
1080
+ },
1081
+ previous() {
1082
+ return previousEventRef.current;
1083
+ }
1084
+ });
1085
+ const getState = () => ({
1086
+ ...state,
1087
+ matches(...values) {
1088
+ return values.includes(state.ref.current);
1089
+ },
1090
+ hasTag(tag) {
1091
+ var _a2, _b2;
1092
+ return !!((_b2 = (_a2 = machine2.states[state.ref.current]) == null ? void 0 : _a2.tags) == null ? void 0 : _b2.includes(tag));
1093
+ }
1094
+ });
1095
+ const refs = useRefs(((_c = machine2.refs) == null ? void 0 : _c.call(machine2, { prop, context: ctx })) ?? {});
1096
+ const getParams = () => ({
1097
+ state: getState(),
1098
+ context: ctx,
1099
+ event: getEvent(),
1100
+ prop,
1101
+ send,
1102
+ action,
1103
+ guard,
1104
+ track: useTrack,
1105
+ refs,
1106
+ computed,
1107
+ flush,
1108
+ scope,
1109
+ choose
1110
+ });
1111
+ const action = (keys) => {
1112
+ const strs = isFunction(keys) ? keys(getParams()) : keys;
1113
+ if (!strs) return;
1114
+ const fns2 = strs.map((s) => {
1115
+ var _a2, _b2;
1116
+ const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.actions) == null ? void 0 : _b2[s];
1117
+ if (!fn) warn(`[zag-js] No implementation found for action "${JSON.stringify(s)}"`);
1118
+ return fn;
1119
+ });
1120
+ for (const fn of fns2) {
1121
+ fn == null ? void 0 : fn(getParams());
1122
+ }
1123
+ };
1124
+ const guard = (str) => {
1125
+ var _a2, _b2;
1126
+ if (isFunction(str)) return str(getParams());
1127
+ return (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.guards) == null ? void 0 : _b2[str](getParams());
1128
+ };
1129
+ const effect = (keys) => {
1130
+ const strs = isFunction(keys) ? keys(getParams()) : keys;
1131
+ if (!strs) return;
1132
+ const fns2 = strs.map((s) => {
1133
+ var _a2, _b2;
1134
+ const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.effects) == null ? void 0 : _b2[s];
1135
+ if (!fn) warn(`[zag-js] No implementation found for effect "${JSON.stringify(s)}"`);
1136
+ return fn;
1137
+ });
1138
+ const cleanups2 = [];
1139
+ for (const fn of fns2) {
1140
+ const cleanup = fn == null ? void 0 : fn(getParams());
1141
+ if (cleanup) cleanups2.push(cleanup);
1142
+ }
1143
+ return () => cleanups2.forEach((fn) => fn == null ? void 0 : fn());
1144
+ };
1145
+ const choose = (transitions) => {
1146
+ return toArray(transitions).find((t) => {
1147
+ let result = !t.guard;
1148
+ if (isString(t.guard)) result = !!guard(t.guard);
1149
+ else if (isFunction(t.guard)) result = t.guard(getParams());
1150
+ return result;
1151
+ });
1152
+ };
1153
+ const computed = (key) => {
1154
+ ensure(machine2.computed, `[zag-js] No computed object found on machine`);
1155
+ const fn = machine2.computed[key];
1156
+ return fn({
1157
+ context: ctx,
1158
+ event: getEvent(),
1159
+ prop,
1160
+ refs,
1161
+ scope,
1162
+ computed
1163
+ });
1164
+ };
1165
+ const state = useBindable(() => ({
1166
+ defaultValue: machine2.initialState({ prop }),
1167
+ onChange(nextState, prevState) {
1168
+ var _a2, _b2, _c2, _d2;
1169
+ if (prevState) {
1170
+ const exitEffects = effects.current.get(prevState);
1171
+ exitEffects == null ? void 0 : exitEffects();
1172
+ effects.current.delete(prevState);
1173
+ }
1174
+ if (prevState) {
1175
+ action((_a2 = machine2.states[prevState]) == null ? void 0 : _a2.exit);
1176
+ }
1177
+ action((_b2 = transitionRef.current) == null ? void 0 : _b2.actions);
1178
+ const cleanup = effect((_c2 = machine2.states[nextState]) == null ? void 0 : _c2.effects);
1179
+ if (cleanup) effects.current.set(nextState, cleanup);
1180
+ if (prevState === "__init__") {
1181
+ action(machine2.entry);
1182
+ const cleanup2 = effect(machine2.effects);
1183
+ if (cleanup2) effects.current.set("__init__", cleanup2);
1184
+ }
1185
+ action((_d2 = machine2.states[nextState]) == null ? void 0 : _d2.entry);
1186
+ }
1187
+ }));
1188
+ const hydratedStateRef = React.useRef(void 0);
1189
+ useSafeLayoutEffect(() => {
1190
+ queueMicrotask(() => {
1191
+ const initialState = hydratedStateRef.current ?? state.initial;
1192
+ state.invoke(initialState, "__init__");
1193
+ });
1194
+ const fns2 = effects.current;
1195
+ return () => {
1196
+ hydratedStateRef.current = state.ref.current;
1197
+ fns2.forEach((fn) => fn == null ? void 0 : fn());
1198
+ effects.current = /* @__PURE__ */ new Map();
1199
+ transitionRef.current = null;
1200
+ queueMicrotask(() => {
1201
+ action(machine2.exit);
1202
+ });
1203
+ };
1204
+ }, []);
1205
+ const getCurrentState = () => {
1206
+ if ("ref" in state) return state.ref.current;
1207
+ return state.get();
1208
+ };
1209
+ const send = (event) => {
1210
+ queueMicrotask(() => {
1211
+ var _a2, _b2;
1212
+ previousEventRef.current = eventRef.current;
1213
+ eventRef.current = event;
1214
+ debug("send", event);
1215
+ let currentState = getCurrentState();
1216
+ const transitions = (
1217
+ // @ts-ignore
1218
+ ((_a2 = machine2.states[currentState].on) == null ? void 0 : _a2[event.type]) ?? // @ts-ignore
1219
+ ((_b2 = machine2.on) == null ? void 0 : _b2[event.type])
1220
+ );
1221
+ const transition = choose(transitions);
1222
+ if (!transition) return;
1223
+ transitionRef.current = transition;
1224
+ const target = transition.target ?? currentState;
1225
+ debug("transition", transition);
1226
+ const changed = target !== currentState;
1227
+ if (changed) {
1228
+ reactDom.flushSync(() => state.set(target));
1229
+ } else if (transition.reenter && !changed) {
1230
+ state.invoke(currentState, currentState);
1231
+ } else {
1232
+ action(transition.actions ?? []);
1233
+ }
1234
+ });
1235
+ };
1236
+ (_d = machine2.watch) == null ? void 0 : _d.call(machine2, getParams());
1237
+ return {
1238
+ state: getState(),
1239
+ send,
1240
+ context: ctx,
1241
+ prop,
1242
+ scope,
1243
+ refs,
1244
+ computed,
1245
+ event: getEvent()
1246
+ };
1247
+ }
1248
+ function useLiveRef(value) {
1249
+ const ref = React.useRef(value);
1250
+ ref.current = value;
1251
+ return ref;
1252
+ }
1253
+ function useProp(value) {
1254
+ const ref = useLiveRef(value);
1255
+ return function get(key) {
1256
+ return ref.current[key];
1257
+ };
1258
+ }
1259
+ function flush(fn) {
1260
+ queueMicrotask(() => {
1261
+ reactDom.flushSync(() => fn());
1262
+ });
1263
+ }
1264
+ var normalizeProps = createNormalizer((v2) => v2);
1265
+ function composeRefs(...refs) {
1266
+ return (node) => {
1267
+ const cleanUps = [];
1268
+ for (const ref of refs) {
1269
+ if (typeof ref === "function") {
1270
+ const cb = ref(node);
1271
+ if (typeof cb === "function") {
1272
+ cleanUps.push(cb);
1273
+ }
1274
+ } else if (ref) {
1275
+ ref.current = node;
1276
+ }
1277
+ }
1278
+ if (cleanUps.length) {
1279
+ return () => {
1280
+ for (const cleanUp of cleanUps) {
1281
+ cleanUp();
1282
+ }
1283
+ };
1284
+ }
1285
+ };
1286
+ }
1287
+ function getRef(element) {
1288
+ var _a, _b;
1289
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
1290
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1291
+ if (mayWarn) {
1292
+ return element.ref;
1293
+ }
1294
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
1295
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1296
+ if (mayWarn) {
1297
+ return element.props.ref;
1298
+ }
1299
+ return element.props.ref || element.ref;
1300
+ }
1301
+ const withAsChild = (Component) => {
1302
+ const Comp = React.memo(
1303
+ React.forwardRef((props, ref) => {
1304
+ const { asChild, children, ...restProps } = props;
1305
+ if (!asChild) {
1306
+ return React.createElement(Component, { ...restProps, ref }, children);
1307
+ }
1308
+ const onlyChild = React.Children.only(children);
1309
+ if (!React.isValidElement(onlyChild)) {
1310
+ return null;
1311
+ }
1312
+ const childRef = getRef(onlyChild);
1313
+ return React.cloneElement(onlyChild, {
1314
+ ...mergeProps(restProps, onlyChild.props),
1315
+ ref: ref ? composeRefs(ref, childRef) : childRef
1316
+ });
1317
+ })
1318
+ );
1319
+ Comp.displayName = Component.displayName || Component.name;
1320
+ return Comp;
1321
+ };
1322
+ const jsxFactory = () => {
1323
+ const cache = /* @__PURE__ */ new Map();
1324
+ return new Proxy(withAsChild, {
1325
+ apply(_target, _thisArg, argArray) {
1326
+ return withAsChild(argArray[0]);
1327
+ },
1328
+ get(_, element) {
1329
+ const asElement = element;
1330
+ if (!cache.has(asElement)) {
1331
+ cache.set(asElement, withAsChild(asElement));
1332
+ }
1333
+ return cache.get(asElement);
1334
+ }
1335
+ });
1336
+ };
1337
+ const ark = jsxFactory();
1338
+ const createSplitProps = () => (props, keys) => keys.reduce(
1339
+ (previousValue, currentValue) => {
1340
+ const [target, source] = previousValue;
1341
+ const key = currentValue;
1342
+ if (source[key] !== void 0) {
1343
+ target[key] = source[key];
1344
+ }
1345
+ delete source[key];
1346
+ return [target, source];
1347
+ },
1348
+ [{}, { ...props }]
1349
+ );
1350
+ var createAnatomy = (name, parts2 = []) => ({
1351
+ parts: (...values) => {
1352
+ if (isEmpty(parts2)) {
1353
+ return createAnatomy(name, values);
1354
+ }
1355
+ throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?");
1356
+ },
1357
+ extendWith: (...values) => createAnatomy(name, [...parts2, ...values]),
1358
+ rename: (newName) => createAnatomy(newName, parts2),
1359
+ keys: () => parts2,
1360
+ build: () => [...new Set(parts2)].reduce(
1361
+ (prev, part) => Object.assign(prev, {
1362
+ [part]: {
1363
+ selector: [
1364
+ `&[data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`,
1365
+ `& [data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`
1366
+ ].join(", "),
1367
+ attrs: { "data-scope": toKebabCase(name), "data-part": toKebabCase(part) }
1368
+ }
1369
+ }),
1370
+ {}
1371
+ )
1372
+ });
1373
+ var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
1374
+ var isEmpty = (v2) => v2.length === 0;
1375
+ const [EnvironmentContextProvider, useEnvironmentContext] = createContext({
1376
+ name: "EnvironmentContext",
1377
+ hookName: "useEnvironmentContext",
1378
+ providerName: "<EnvironmentProvider />",
1379
+ strict: false,
1380
+ defaultValue: {
1381
+ getRootNode: () => document,
1382
+ getDocument: () => document,
1383
+ getWindow: () => window
1384
+ }
1385
+ });
1386
+ const [LocaleContextProvider, useLocaleContext] = createContext({
1387
+ name: "LocaleContext",
1388
+ hookName: "useLocaleContext",
1389
+ providerName: "<LocaleProvider />",
1390
+ strict: false,
1391
+ defaultValue: { dir: "ltr", locale: "en-US" }
1392
+ });
1393
+ function getWindowFrames(win) {
1394
+ const frames = {
1395
+ each(cb) {
1396
+ var _a;
1397
+ for (let i = 0; i < ((_a = win.frames) == null ? void 0 : _a.length); i += 1) {
1398
+ const frame = win.frames[i];
1399
+ if (frame) cb(frame);
1400
+ }
1401
+ },
1402
+ addEventListener(event, listener, options) {
1403
+ frames.each((frame) => {
1404
+ try {
1405
+ frame.document.addEventListener(event, listener, options);
1406
+ } catch {
1407
+ }
1408
+ });
1409
+ return () => {
1410
+ try {
1411
+ frames.removeEventListener(event, listener, options);
1412
+ } catch {
1413
+ }
1414
+ };
1415
+ },
1416
+ removeEventListener(event, listener, options) {
1417
+ frames.each((frame) => {
1418
+ try {
1419
+ frame.document.removeEventListener(event, listener, options);
1420
+ } catch {
1421
+ }
1422
+ });
1423
+ }
1424
+ };
1425
+ return frames;
1426
+ }
1427
+ function getParentWindow(win) {
1428
+ const parent = win.frameElement != null ? win.parent : null;
1429
+ return {
1430
+ addEventListener: (event, listener, options) => {
1431
+ try {
1432
+ parent == null ? void 0 : parent.addEventListener(event, listener, options);
1433
+ } catch {
1434
+ }
1435
+ return () => {
1436
+ try {
1437
+ parent == null ? void 0 : parent.removeEventListener(event, listener, options);
1438
+ } catch {
1439
+ }
1440
+ };
1441
+ },
1442
+ removeEventListener: (event, listener, options) => {
1443
+ try {
1444
+ parent == null ? void 0 : parent.removeEventListener(event, listener, options);
1445
+ } catch {
1446
+ }
1447
+ }
1448
+ };
1449
+ }
1450
+ var POINTER_OUTSIDE_EVENT = "pointerdown.outside";
1451
+ var FOCUS_OUTSIDE_EVENT = "focus.outside";
1452
+ function isComposedPathFocusable(composedPath) {
1453
+ for (const node of composedPath) {
1454
+ if (isHTMLElement(node) && isFocusable(node)) return true;
1455
+ }
1456
+ return false;
1457
+ }
1458
+ var isPointerEvent = (event) => "clientY" in event;
1459
+ function isEventPointWithin(node, event) {
1460
+ if (!isPointerEvent(event) || !node) return false;
1461
+ const rect = node.getBoundingClientRect();
1462
+ if (rect.width === 0 || rect.height === 0) return false;
1463
+ return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
1464
+ }
1465
+ function isPointInRect(rect, point) {
1466
+ return rect.y <= point.y && point.y <= rect.y + rect.height && rect.x <= point.x && point.x <= rect.x + rect.width;
1467
+ }
1468
+ function isEventWithinScrollbar(event, ancestor) {
1469
+ if (!ancestor || !isPointerEvent(event)) return false;
1470
+ const isScrollableY = ancestor.scrollHeight > ancestor.clientHeight;
1471
+ const onScrollbarY = isScrollableY && event.clientX > ancestor.offsetLeft + ancestor.clientWidth;
1472
+ const isScrollableX = ancestor.scrollWidth > ancestor.clientWidth;
1473
+ const onScrollbarX = isScrollableX && event.clientY > ancestor.offsetTop + ancestor.clientHeight;
1474
+ const rect = {
1475
+ x: ancestor.offsetLeft,
1476
+ y: ancestor.offsetTop,
1477
+ width: ancestor.clientWidth + (isScrollableY ? 16 : 0),
1478
+ height: ancestor.clientHeight + (isScrollableX ? 16 : 0)
1479
+ };
1480
+ const point = {
1481
+ x: event.clientX,
1482
+ y: event.clientY
1483
+ };
1484
+ if (!isPointInRect(rect, point)) return false;
1485
+ return onScrollbarY || onScrollbarX;
1486
+ }
1487
+ function trackInteractOutsideImpl(node, options) {
1488
+ const { exclude, onFocusOutside, onPointerDownOutside, onInteractOutside, defer } = options;
1489
+ if (!node) return;
1490
+ const doc = getDocument(node);
1491
+ const win = getWindow(node);
1492
+ const frames = getWindowFrames(win);
1493
+ const parentWin = getParentWindow(win);
1494
+ function isEventOutside(event) {
1495
+ const target = getEventTarget(event);
1496
+ if (!isHTMLElement(target)) return false;
1497
+ if (!target.isConnected) return false;
1498
+ if (contains(node, target)) return false;
1499
+ if (isEventPointWithin(node, event)) return false;
1500
+ const triggerEl = doc.querySelector(`[aria-controls="${node.id}"]`);
1501
+ if (triggerEl) {
1502
+ const triggerAncestor = getNearestOverflowAncestor(triggerEl);
1503
+ if (isEventWithinScrollbar(event, triggerAncestor)) return false;
1504
+ }
1505
+ const nodeAncestor = getNearestOverflowAncestor(node);
1506
+ if (isEventWithinScrollbar(event, nodeAncestor)) return false;
1507
+ return !(exclude == null ? void 0 : exclude(target));
1508
+ }
1509
+ const pointerdownCleanups = /* @__PURE__ */ new Set();
1510
+ function onPointerDown(event) {
1511
+ function handler() {
1512
+ var _a;
1513
+ const func = defer ? raf$1 : (v2) => v2();
1514
+ const composedPath = ((_a = event.composedPath) == null ? void 0 : _a.call(event)) ?? [event.target];
1515
+ func(() => {
1516
+ if (!node || !isEventOutside(event)) return;
1517
+ if (onPointerDownOutside || onInteractOutside) {
1518
+ const handler2 = callAll(onPointerDownOutside, onInteractOutside);
1519
+ node.addEventListener(POINTER_OUTSIDE_EVENT, handler2, { once: true });
1520
+ }
1521
+ fireCustomEvent(node, POINTER_OUTSIDE_EVENT, {
1522
+ bubbles: false,
1523
+ cancelable: true,
1524
+ detail: {
1525
+ originalEvent: event,
1526
+ contextmenu: isContextMenuEvent(event),
1527
+ focusable: isComposedPathFocusable(composedPath)
1528
+ }
1529
+ });
1530
+ });
1531
+ }
1532
+ if (event.pointerType === "touch") {
1533
+ pointerdownCleanups.forEach((fn) => fn());
1534
+ pointerdownCleanups.add(addDomEvent(doc, "click", handler, { once: true }));
1535
+ pointerdownCleanups.add(parentWin.addEventListener("click", handler, { once: true }));
1536
+ pointerdownCleanups.add(frames.addEventListener("click", handler, { once: true }));
1537
+ } else {
1538
+ handler();
1539
+ }
1540
+ }
1541
+ const cleanups2 = /* @__PURE__ */ new Set();
1542
+ const timer = setTimeout(() => {
1543
+ cleanups2.add(addDomEvent(doc, "pointerdown", onPointerDown, true));
1544
+ cleanups2.add(parentWin.addEventListener("pointerdown", onPointerDown, true));
1545
+ cleanups2.add(frames.addEventListener("pointerdown", onPointerDown, true));
1546
+ }, 0);
1547
+ function onFocusin(event) {
1548
+ const func = defer ? raf$1 : (v2) => v2();
1549
+ func(() => {
1550
+ if (!node || !isEventOutside(event)) return;
1551
+ if (onFocusOutside || onInteractOutside) {
1552
+ const handler = callAll(onFocusOutside, onInteractOutside);
1553
+ node.addEventListener(FOCUS_OUTSIDE_EVENT, handler, { once: true });
1554
+ }
1555
+ fireCustomEvent(node, FOCUS_OUTSIDE_EVENT, {
1556
+ bubbles: false,
1557
+ cancelable: true,
1558
+ detail: {
1559
+ originalEvent: event,
1560
+ contextmenu: false,
1561
+ focusable: isFocusable(getEventTarget(event))
1562
+ }
1563
+ });
1564
+ });
1565
+ }
1566
+ cleanups2.add(addDomEvent(doc, "focusin", onFocusin, true));
1567
+ cleanups2.add(parentWin.addEventListener("focusin", onFocusin, true));
1568
+ cleanups2.add(frames.addEventListener("focusin", onFocusin, true));
1569
+ return () => {
1570
+ clearTimeout(timer);
1571
+ pointerdownCleanups.forEach((fn) => fn());
1572
+ cleanups2.forEach((fn) => fn());
1573
+ };
1574
+ }
1575
+ function trackInteractOutside(nodeOrFn, options) {
1576
+ const { defer } = options;
1577
+ const func = defer ? raf$1 : (v2) => v2();
1578
+ const cleanups2 = [];
1579
+ cleanups2.push(
1580
+ func(() => {
1581
+ const node = typeof nodeOrFn === "function" ? nodeOrFn() : nodeOrFn;
1582
+ cleanups2.push(trackInteractOutsideImpl(node, options));
1583
+ })
1584
+ );
1585
+ return () => {
1586
+ cleanups2.forEach((fn) => fn == null ? void 0 : fn());
1587
+ };
1588
+ }
1589
+ function fireCustomEvent(el, type, init) {
1590
+ const win = el.ownerDocument.defaultView || window;
1591
+ const event = new win.CustomEvent(type, init);
1592
+ return el.dispatchEvent(event);
1593
+ }
1594
+ function trackEscapeKeydown(node, fn) {
1595
+ const handleKeyDown = (event) => {
1596
+ if (event.key !== "Escape") return;
1597
+ if (event.isComposing) return;
1598
+ fn == null ? void 0 : fn(event);
1599
+ };
1600
+ return addDomEvent(getDocument(node), "keydown", handleKeyDown, { capture: true });
1601
+ }
1602
+ var layerStack = {
1603
+ layers: [],
1604
+ branches: [],
1605
+ count() {
1606
+ return this.layers.length;
1607
+ },
1608
+ pointerBlockingLayers() {
1609
+ return this.layers.filter((layer) => layer.pointerBlocking);
1610
+ },
1611
+ topMostPointerBlockingLayer() {
1612
+ return [...this.pointerBlockingLayers()].slice(-1)[0];
1613
+ },
1614
+ hasPointerBlockingLayer() {
1615
+ return this.pointerBlockingLayers().length > 0;
1616
+ },
1617
+ isBelowPointerBlockingLayer(node) {
1618
+ var _a;
1619
+ const index = this.indexOf(node);
1620
+ const highestBlockingIndex = this.topMostPointerBlockingLayer() ? this.indexOf((_a = this.topMostPointerBlockingLayer()) == null ? void 0 : _a.node) : -1;
1621
+ return index < highestBlockingIndex;
1622
+ },
1623
+ isTopMost(node) {
1624
+ const layer = this.layers[this.count() - 1];
1625
+ return (layer == null ? void 0 : layer.node) === node;
1626
+ },
1627
+ getNestedLayers(node) {
1628
+ return Array.from(this.layers).slice(this.indexOf(node) + 1);
1629
+ },
1630
+ isInNestedLayer(node, target) {
1631
+ return this.getNestedLayers(node).some((layer) => contains(layer.node, target));
1632
+ },
1633
+ isInBranch(target) {
1634
+ return Array.from(this.branches).some((branch) => contains(branch, target));
1635
+ },
1636
+ add(layer) {
1637
+ const num = this.layers.push(layer);
1638
+ layer.node.style.setProperty("--layer-index", `${num}`);
1639
+ },
1640
+ addBranch(node) {
1641
+ this.branches.push(node);
1642
+ },
1643
+ remove(node) {
1644
+ const index = this.indexOf(node);
1645
+ if (index < 0) return;
1646
+ if (index < this.count() - 1) {
1647
+ const _layers = this.getNestedLayers(node);
1648
+ _layers.forEach((layer) => layer.dismiss());
1649
+ }
1650
+ this.layers.splice(index, 1);
1651
+ node.style.removeProperty("--layer-index");
1652
+ },
1653
+ removeBranch(node) {
1654
+ const index = this.branches.indexOf(node);
1655
+ if (index >= 0) this.branches.splice(index, 1);
1656
+ },
1657
+ indexOf(node) {
1658
+ return this.layers.findIndex((layer) => layer.node === node);
1659
+ },
1660
+ dismiss(node) {
1661
+ var _a;
1662
+ (_a = this.layers[this.indexOf(node)]) == null ? void 0 : _a.dismiss();
1663
+ },
1664
+ clear() {
1665
+ this.remove(this.layers[0].node);
1666
+ }
1667
+ };
1668
+ var originalBodyPointerEvents;
1669
+ function assignPointerEventToLayers() {
1670
+ layerStack.layers.forEach(({ node }) => {
1671
+ node.style.pointerEvents = layerStack.isBelowPointerBlockingLayer(node) ? "none" : "auto";
1672
+ });
1673
+ }
1674
+ function clearPointerEvent(node) {
1675
+ node.style.pointerEvents = "";
1676
+ }
1677
+ function disablePointerEventsOutside(node, persistentElements) {
1678
+ const doc = getDocument(node);
1679
+ const cleanups2 = [];
1680
+ if (layerStack.hasPointerBlockingLayer() && !doc.body.hasAttribute("data-inert")) {
1681
+ originalBodyPointerEvents = document.body.style.pointerEvents;
1682
+ queueMicrotask(() => {
1683
+ doc.body.style.pointerEvents = "none";
1684
+ doc.body.setAttribute("data-inert", "");
1685
+ });
1686
+ }
1687
+ if (persistentElements) {
1688
+ const persistedCleanup = waitForElements(persistentElements, (el) => {
1689
+ cleanups2.push(setStyle(el, { pointerEvents: "auto" }));
1690
+ });
1691
+ cleanups2.push(persistedCleanup);
1692
+ }
1693
+ return () => {
1694
+ if (layerStack.hasPointerBlockingLayer()) return;
1695
+ queueMicrotask(() => {
1696
+ doc.body.style.pointerEvents = originalBodyPointerEvents;
1697
+ doc.body.removeAttribute("data-inert");
1698
+ if (doc.body.style.length === 0) doc.body.removeAttribute("style");
1699
+ });
1700
+ cleanups2.forEach((fn) => fn());
1701
+ };
1702
+ }
1703
+ function trackDismissableElementImpl(node, options) {
1704
+ const { warnOnMissingNode = true } = options;
1705
+ if (warnOnMissingNode && !node) {
1706
+ warn("[@zag-js/dismissable] node is `null` or `undefined`");
1707
+ return;
1708
+ }
1709
+ if (!node) {
1710
+ return;
1711
+ }
1712
+ const { onDismiss, pointerBlocking, exclude: excludeContainers, debug } = options;
1713
+ const layer = { dismiss: onDismiss, node, pointerBlocking };
1714
+ layerStack.add(layer);
1715
+ assignPointerEventToLayers();
1716
+ function onPointerDownOutside(event) {
1717
+ var _a, _b;
1718
+ const target = getEventTarget(event.detail.originalEvent);
1719
+ if (layerStack.isBelowPointerBlockingLayer(node) || layerStack.isInBranch(target)) return;
1720
+ (_a = options.onPointerDownOutside) == null ? void 0 : _a.call(options, event);
1721
+ (_b = options.onInteractOutside) == null ? void 0 : _b.call(options, event);
1722
+ if (event.defaultPrevented) return;
1723
+ if (debug) {
1724
+ console.log("onPointerDownOutside:", event.detail.originalEvent);
1725
+ }
1726
+ onDismiss == null ? void 0 : onDismiss();
1727
+ }
1728
+ function onFocusOutside(event) {
1729
+ var _a, _b;
1730
+ const target = getEventTarget(event.detail.originalEvent);
1731
+ if (layerStack.isInBranch(target)) return;
1732
+ (_a = options.onFocusOutside) == null ? void 0 : _a.call(options, event);
1733
+ (_b = options.onInteractOutside) == null ? void 0 : _b.call(options, event);
1734
+ if (event.defaultPrevented) return;
1735
+ if (debug) {
1736
+ console.log("onFocusOutside:", event.detail.originalEvent);
1737
+ }
1738
+ onDismiss == null ? void 0 : onDismiss();
1739
+ }
1740
+ function onEscapeKeyDown(event) {
1741
+ var _a;
1742
+ if (!layerStack.isTopMost(node)) return;
1743
+ (_a = options.onEscapeKeyDown) == null ? void 0 : _a.call(options, event);
1744
+ if (!event.defaultPrevented && onDismiss) {
1745
+ event.preventDefault();
1746
+ onDismiss();
1747
+ }
1748
+ }
1749
+ function exclude(target) {
1750
+ var _a;
1751
+ if (!node) return false;
1752
+ const containers = typeof excludeContainers === "function" ? excludeContainers() : excludeContainers;
1753
+ const _containers = Array.isArray(containers) ? containers : [containers];
1754
+ const persistentElements = (_a = options.persistentElements) == null ? void 0 : _a.map((fn) => fn()).filter(isHTMLElement);
1755
+ if (persistentElements) _containers.push(...persistentElements);
1756
+ return _containers.some((node2) => contains(node2, target)) || layerStack.isInNestedLayer(node, target);
1757
+ }
1758
+ const cleanups2 = [
1759
+ pointerBlocking ? disablePointerEventsOutside(node, options.persistentElements) : void 0,
1760
+ trackEscapeKeydown(node, onEscapeKeyDown),
1761
+ trackInteractOutside(node, { exclude, onFocusOutside, onPointerDownOutside, defer: options.defer })
1762
+ ];
1763
+ return () => {
1764
+ layerStack.remove(node);
1765
+ assignPointerEventToLayers();
1766
+ clearPointerEvent(node);
1767
+ cleanups2.forEach((fn) => fn == null ? void 0 : fn());
1768
+ };
1769
+ }
1770
+ function trackDismissableElement(nodeOrFn, options) {
1771
+ const { defer } = options;
1772
+ const func = defer ? raf$1 : (v2) => v2();
1773
+ const cleanups2 = [];
1774
+ cleanups2.push(
1775
+ func(() => {
1776
+ const node = isFunction(nodeOrFn) ? nodeOrFn() : nodeOrFn;
1777
+ cleanups2.push(trackDismissableElementImpl(node, options));
1778
+ })
1779
+ );
1780
+ return () => {
1781
+ cleanups2.forEach((fn) => fn == null ? void 0 : fn());
1782
+ };
1783
+ }
1784
+ const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = createContext({
1785
+ name: "RenderStrategyContext",
1786
+ hookName: "useRenderStrategyContext",
1787
+ providerName: "<RenderStrategyPropsProvider />"
1788
+ });
1789
+ const splitRenderStrategyProps = (props) => createSplitProps()(props, ["lazyMount", "unmountOnExit"]);
1790
+ function useEvent(callback, opts = {}) {
1791
+ const { sync = false } = opts;
1792
+ const callbackRef = useLatestRef(callback);
1793
+ return React.useCallback(
1794
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
1795
+ (...args) => {
1796
+ var _a;
1797
+ if (sync) return queueMicrotask(() => {
1798
+ var _a2;
1799
+ return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
1800
+ });
1801
+ return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
1802
+ },
1803
+ [sync, callbackRef]
1804
+ );
1805
+ }
1806
+ function useLatestRef(value) {
1807
+ const ref = React.useRef(value);
1808
+ ref.current = value;
1809
+ return ref;
1810
+ }
1811
+ const [PresenceProvider, usePresenceContext] = createContext({
1812
+ name: "PresenceContext",
1813
+ hookName: "usePresenceContext",
1814
+ providerName: "<PresenceProvider />"
1815
+ });
1816
+ const splitPresenceProps = (props) => createSplitProps()(props, ["immediate", "lazyMount", "onExitComplete", "present", "unmountOnExit"]);
1817
+ function connect$1(service, _normalize) {
1818
+ const { state, send, context: context2 } = service;
1819
+ const present = state.matches("mounted", "unmountSuspended");
1820
+ return {
1821
+ skip: !context2.get("initial"),
1822
+ present,
1823
+ setNode(node) {
1824
+ if (!node) return;
1825
+ send({ type: "NODE.SET", node });
1826
+ },
1827
+ unmount() {
1828
+ send({ type: "UNMOUNT" });
1829
+ }
1830
+ };
1831
+ }
1832
+ var machine$1 = createMachine({
1833
+ props({ props: props2 }) {
1834
+ return { ...props2, present: !!props2.present };
1835
+ },
1836
+ initialState({ prop }) {
1837
+ return prop("present") ? "mounted" : "unmounted";
1838
+ },
1839
+ refs() {
1840
+ return {
1841
+ node: null,
1842
+ styles: null
1843
+ };
1844
+ },
1845
+ context({ bindable }) {
1846
+ return {
1847
+ unmountAnimationName: bindable(() => ({ defaultValue: null })),
1848
+ prevAnimationName: bindable(() => ({ defaultValue: null })),
1849
+ present: bindable(() => ({ defaultValue: false })),
1850
+ initial: bindable(() => ({
1851
+ sync: true,
1852
+ defaultValue: false
1853
+ }))
1854
+ };
1855
+ },
1856
+ exit: ["clearInitial", "cleanupNode"],
1857
+ watch({ track, action, prop }) {
1858
+ track([() => prop("present")], () => {
1859
+ action(["setInitial", "syncPresence"]);
1860
+ });
1861
+ },
1862
+ on: {
1863
+ "NODE.SET": {
1864
+ actions: ["setNode", "setStyles"]
1865
+ }
1866
+ },
1867
+ states: {
1868
+ mounted: {
1869
+ on: {
1870
+ UNMOUNT: {
1871
+ target: "unmounted",
1872
+ actions: ["clearPrevAnimationName", "invokeOnExitComplete"]
1873
+ },
1874
+ "UNMOUNT.SUSPEND": {
1875
+ target: "unmountSuspended"
1876
+ }
1877
+ }
1878
+ },
1879
+ unmountSuspended: {
1880
+ effects: ["trackAnimationEvents"],
1881
+ on: {
1882
+ MOUNT: {
1883
+ target: "mounted",
1884
+ actions: ["setPrevAnimationName"]
1885
+ },
1886
+ UNMOUNT: {
1887
+ target: "unmounted",
1888
+ actions: ["clearPrevAnimationName", "invokeOnExitComplete"]
1889
+ }
1890
+ }
1891
+ },
1892
+ unmounted: {
1893
+ on: {
1894
+ MOUNT: {
1895
+ target: "mounted",
1896
+ actions: ["setPrevAnimationName"]
1897
+ }
1898
+ }
1899
+ }
1900
+ },
1901
+ implementations: {
1902
+ actions: {
1903
+ setInitial: ({ context: context2 }) => {
1904
+ if (context2.get("initial")) return;
1905
+ queueMicrotask(() => {
1906
+ context2.set("initial", true);
1907
+ });
1908
+ },
1909
+ clearInitial: ({ context: context2 }) => {
1910
+ context2.set("initial", false);
1911
+ },
1912
+ cleanupNode: ({ refs }) => {
1913
+ refs.set("node", null);
1914
+ refs.set("styles", null);
1915
+ },
1916
+ invokeOnExitComplete: ({ prop }) => {
1917
+ var _a;
1918
+ (_a = prop("onExitComplete")) == null ? void 0 : _a();
1919
+ },
1920
+ setNode: ({ refs, event }) => {
1921
+ refs.set("node", event.node);
1922
+ },
1923
+ setStyles: ({ refs, event }) => {
1924
+ refs.set("styles", getComputedStyle(event.node));
1925
+ },
1926
+ syncPresence: ({ context: context2, refs, send, prop }) => {
1927
+ const presentProp = prop("present");
1928
+ if (presentProp) {
1929
+ return send({ type: "MOUNT", src: "presence.changed" });
1930
+ }
1931
+ const node = refs.get("node");
1932
+ if (!presentProp && (node == null ? void 0 : node.ownerDocument.visibilityState) === "hidden") {
1933
+ return send({ type: "UNMOUNT", src: "visibilitychange" });
1934
+ }
1935
+ raf$1(() => {
1936
+ var _a, _b;
1937
+ const animationName = getAnimationName(refs.get("styles"));
1938
+ context2.set("unmountAnimationName", animationName);
1939
+ if (animationName === "none" || animationName === context2.get("prevAnimationName") || ((_a = refs.get("styles")) == null ? void 0 : _a.display) === "none" || ((_b = refs.get("styles")) == null ? void 0 : _b.animationDuration) === "0s") {
1940
+ send({ type: "UNMOUNT", src: "presence.changed" });
1941
+ } else {
1942
+ send({ type: "UNMOUNT.SUSPEND" });
1943
+ }
1944
+ });
1945
+ },
1946
+ setPrevAnimationName: ({ context: context2, refs }) => {
1947
+ raf$1(() => {
1948
+ context2.set("prevAnimationName", getAnimationName(refs.get("styles")));
1949
+ });
1950
+ },
1951
+ clearPrevAnimationName: ({ context: context2 }) => {
1952
+ context2.set("prevAnimationName", null);
1953
+ }
1954
+ },
1955
+ effects: {
1956
+ trackAnimationEvents: ({ context: context2, refs, send }) => {
1957
+ const node = refs.get("node");
1958
+ if (!node) return;
1959
+ const onStart = (event) => {
1960
+ var _a, _b;
1961
+ const target = ((_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) ?? event.target;
1962
+ if (target === node) {
1963
+ context2.set("prevAnimationName", getAnimationName(refs.get("styles")));
1964
+ }
1965
+ };
1966
+ const onEnd = (event) => {
1967
+ const animationName = getAnimationName(refs.get("styles"));
1968
+ const target = getEventTarget(event);
1969
+ if (target === node && animationName === context2.get("unmountAnimationName")) {
1970
+ send({ type: "UNMOUNT", src: "animationend" });
1971
+ }
1972
+ };
1973
+ node.addEventListener("animationstart", onStart);
1974
+ node.addEventListener("animationcancel", onEnd);
1975
+ node.addEventListener("animationend", onEnd);
1976
+ const cleanupStyles = setStyle(node, { animationFillMode: "forwards" });
1977
+ return () => {
1978
+ node.removeEventListener("animationstart", onStart);
1979
+ node.removeEventListener("animationcancel", onEnd);
1980
+ node.removeEventListener("animationend", onEnd);
1981
+ nextTick(() => cleanupStyles());
1982
+ };
1983
+ }
1984
+ }
1985
+ }
1986
+ });
1987
+ function getAnimationName(styles) {
1988
+ return (styles == null ? void 0 : styles.animationName) || "none";
1989
+ }
1990
+ createProps()(["onExitComplete", "present", "immediate"]);
1991
+ const usePresence = (props = {}) => {
1992
+ const { lazyMount, unmountOnExit, present, ...rest } = props;
1993
+ const wasEverPresent = React.useRef(false);
1994
+ const machineProps = {
1995
+ ...rest,
1996
+ present,
1997
+ onExitComplete: useEvent(props.onExitComplete)
1998
+ };
1999
+ const service = useMachine(machine$1, machineProps);
2000
+ const api = connect$1(service);
2001
+ if (api.present) {
2002
+ wasEverPresent.current = true;
2003
+ }
2004
+ const unmounted = !api.present && !wasEverPresent.current && lazyMount || unmountOnExit && !api.present && wasEverPresent.current;
2005
+ const getPresenceProps = () => ({
2006
+ "data-state": present ? "open" : "closed",
2007
+ hidden: !api.present
2008
+ });
2009
+ return {
2010
+ ref: api.setNode,
2011
+ getPresenceProps,
2012
+ present: api.present,
2013
+ unmounted
2014
+ };
2015
+ };
2016
+ var counterMap = /* @__PURE__ */ new WeakMap();
2017
+ var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
2018
+ var markerMap = {};
2019
+ var lockCount = 0;
2020
+ var unwrapHost = (node) => node && (node.host || unwrapHost(node.parentNode));
2021
+ var correctTargets = (parent, targets) => targets.map((target) => {
2022
+ if (parent.contains(target)) return target;
2023
+ const correctedTarget = unwrapHost(target);
2024
+ if (correctedTarget && parent.contains(correctedTarget)) {
2025
+ return correctedTarget;
2026
+ }
2027
+ console.error("[zag-js > ariaHidden] target", target, "in not contained inside", parent, ". Doing nothing");
2028
+ return null;
2029
+ }).filter((x) => Boolean(x));
2030
+ var isIgnoredNode = (node) => {
2031
+ if (node.localName === "next-route-announcer") return true;
2032
+ if (node.localName === "script") return true;
2033
+ if (node.hasAttribute("aria-live")) return true;
2034
+ return node.matches("[data-live-announcer]");
2035
+ };
2036
+ var walkTreeOutside = (originalTarget, props) => {
2037
+ const { parentNode, markerName, controlAttribute } = props;
2038
+ const targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
2039
+ markerMap[markerName] || (markerMap[markerName] = /* @__PURE__ */ new WeakMap());
2040
+ const markerCounter = markerMap[markerName];
2041
+ const hiddenNodes = [];
2042
+ const elementsToKeep = /* @__PURE__ */ new Set();
2043
+ const elementsToStop = new Set(targets);
2044
+ const keep = (el) => {
2045
+ if (!el || elementsToKeep.has(el)) return;
2046
+ elementsToKeep.add(el);
2047
+ keep(el.parentNode);
2048
+ };
2049
+ targets.forEach(keep);
2050
+ const deep = (parent) => {
2051
+ if (!parent || elementsToStop.has(parent)) {
2052
+ return;
2053
+ }
2054
+ Array.prototype.forEach.call(parent.children, (node) => {
2055
+ if (elementsToKeep.has(node)) {
2056
+ deep(node);
2057
+ } else {
2058
+ try {
2059
+ if (isIgnoredNode(node)) return;
2060
+ const attr = node.getAttribute(controlAttribute);
2061
+ const alreadyHidden = attr === "true";
2062
+ const counterValue = (counterMap.get(node) || 0) + 1;
2063
+ const markerValue = (markerCounter.get(node) || 0) + 1;
2064
+ counterMap.set(node, counterValue);
2065
+ markerCounter.set(node, markerValue);
2066
+ hiddenNodes.push(node);
2067
+ if (counterValue === 1 && alreadyHidden) {
2068
+ uncontrolledNodes.set(node, true);
2069
+ }
2070
+ if (markerValue === 1) {
2071
+ node.setAttribute(markerName, "");
2072
+ }
2073
+ if (!alreadyHidden) {
2074
+ node.setAttribute(controlAttribute, "true");
2075
+ }
2076
+ } catch (e) {
2077
+ console.error("[zag-js > ariaHidden] cannot operate on ", node, e);
2078
+ }
2079
+ }
2080
+ });
2081
+ };
2082
+ deep(parentNode);
2083
+ elementsToKeep.clear();
2084
+ lockCount++;
2085
+ return () => {
2086
+ hiddenNodes.forEach((node) => {
2087
+ const counterValue = counterMap.get(node) - 1;
2088
+ const markerValue = markerCounter.get(node) - 1;
2089
+ counterMap.set(node, counterValue);
2090
+ markerCounter.set(node, markerValue);
2091
+ if (!counterValue) {
2092
+ if (!uncontrolledNodes.has(node)) {
2093
+ node.removeAttribute(controlAttribute);
2094
+ }
2095
+ uncontrolledNodes.delete(node);
2096
+ }
2097
+ if (!markerValue) {
2098
+ node.removeAttribute(markerName);
2099
+ }
2100
+ });
2101
+ lockCount--;
2102
+ if (!lockCount) {
2103
+ counterMap = /* @__PURE__ */ new WeakMap();
2104
+ counterMap = /* @__PURE__ */ new WeakMap();
2105
+ uncontrolledNodes = /* @__PURE__ */ new WeakMap();
2106
+ markerMap = {};
2107
+ }
2108
+ };
2109
+ };
2110
+ var getParentNode = (originalTarget) => {
2111
+ const target = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
2112
+ return target.ownerDocument.body;
2113
+ };
2114
+ var hideOthers = (originalTarget, parentNode = getParentNode(originalTarget), markerName = "data-aria-hidden") => {
2115
+ if (!parentNode) return;
2116
+ return walkTreeOutside(originalTarget, {
2117
+ parentNode,
2118
+ markerName,
2119
+ controlAttribute: "aria-hidden"
2120
+ });
2121
+ };
2122
+ var raf = (fn) => {
2123
+ const frameId = requestAnimationFrame(() => fn());
2124
+ return () => cancelAnimationFrame(frameId);
2125
+ };
2126
+ function ariaHidden(targetsOrFn, options = {}) {
2127
+ const { defer = true } = options;
2128
+ const func = defer ? raf : (v2) => v2();
2129
+ const cleanups2 = [];
2130
+ cleanups2.push(
2131
+ func(() => {
2132
+ const targets = typeof targetsOrFn === "function" ? targetsOrFn() : targetsOrFn;
2133
+ const elements = targets.filter(Boolean);
2134
+ if (elements.length === 0) return;
2135
+ cleanups2.push(hideOthers(elements));
2136
+ })
2137
+ );
2138
+ return () => {
2139
+ cleanups2.forEach((fn) => fn == null ? void 0 : fn());
2140
+ };
2141
+ }
2142
+ const [DialogProvider, useDialogContext] = createContext({
2143
+ name: "DialogContext",
2144
+ hookName: "useDialogContext",
2145
+ providerName: "<DialogProvider />"
2146
+ });
2147
+ const DialogBackdrop = React.forwardRef((props, ref) => {
2148
+ const dialog = useDialogContext();
2149
+ const renderStrategyProps = useRenderStrategyPropsContext();
2150
+ const presence = usePresence({ ...renderStrategyProps, present: dialog.open });
2151
+ const mergedProps = mergeProps(dialog.getBackdropProps(), presence.getPresenceProps(), props);
2152
+ if (presence.unmounted) {
2153
+ return null;
2154
+ }
2155
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) });
2156
+ });
2157
+ DialogBackdrop.displayName = "DialogBackdrop";
2158
+ const DialogContent = React.forwardRef((props, ref) => {
2159
+ const dialog = useDialogContext();
2160
+ const presence = usePresenceContext();
2161
+ const mergedProps = mergeProps(dialog.getContentProps(), presence.getPresenceProps(), props);
2162
+ if (presence.unmounted) {
2163
+ return null;
2164
+ }
2165
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) });
2166
+ });
2167
+ DialogContent.displayName = "DialogContent";
2168
+ const DialogDescription = React.forwardRef((props, ref) => {
2169
+ const dialog = useDialogContext();
2170
+ const mergedProps = mergeProps(dialog.getDescriptionProps(), props);
2171
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
2172
+ });
2173
+ DialogDescription.displayName = "DialogDescription";
2174
+ const DialogPositioner = React.forwardRef((props, ref) => {
2175
+ const dialog = useDialogContext();
2176
+ const mergedProps = mergeProps(dialog.getPositionerProps(), props);
2177
+ const presence = usePresenceContext();
2178
+ if (presence.unmounted) {
2179
+ return null;
2180
+ }
2181
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
2182
+ });
2183
+ DialogPositioner.displayName = "DialogPositioner";
2184
+ var __defProp = Object.defineProperty;
2185
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2186
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2187
+ var activeFocusTraps = {
2188
+ activateTrap(trapStack, trap) {
2189
+ if (trapStack.length > 0) {
2190
+ const activeTrap = trapStack[trapStack.length - 1];
2191
+ if (activeTrap !== trap) {
2192
+ activeTrap.pause();
2193
+ }
2194
+ }
2195
+ const trapIndex = trapStack.indexOf(trap);
2196
+ if (trapIndex === -1) {
2197
+ trapStack.push(trap);
2198
+ } else {
2199
+ trapStack.splice(trapIndex, 1);
2200
+ trapStack.push(trap);
2201
+ }
2202
+ },
2203
+ deactivateTrap(trapStack, trap) {
2204
+ const trapIndex = trapStack.indexOf(trap);
2205
+ if (trapIndex !== -1) {
2206
+ trapStack.splice(trapIndex, 1);
2207
+ }
2208
+ if (trapStack.length > 0) {
2209
+ trapStack[trapStack.length - 1].unpause();
2210
+ }
2211
+ }
2212
+ };
2213
+ var sharedTrapStack = [];
2214
+ var FocusTrap = class {
2215
+ constructor(elements, options) {
2216
+ __publicField(this, "trapStack");
2217
+ __publicField(this, "config");
2218
+ __publicField(this, "doc");
2219
+ __publicField(this, "state", {
2220
+ containers: [],
2221
+ containerGroups: [],
2222
+ tabbableGroups: [],
2223
+ nodeFocusedBeforeActivation: null,
2224
+ mostRecentlyFocusedNode: null,
2225
+ active: false,
2226
+ paused: false,
2227
+ delayInitialFocusTimer: void 0,
2228
+ recentNavEvent: void 0
2229
+ });
2230
+ __publicField(this, "listenerCleanups", []);
2231
+ __publicField(this, "handleFocus", (event) => {
2232
+ const target = getEventTarget(event);
2233
+ const targetContained = this.findContainerIndex(target, event) >= 0;
2234
+ if (targetContained || isDocument(target)) {
2235
+ if (targetContained) {
2236
+ this.state.mostRecentlyFocusedNode = target;
2237
+ }
2238
+ } else {
2239
+ event.stopImmediatePropagation();
2240
+ let nextNode;
2241
+ let navAcrossContainers = true;
2242
+ if (this.state.mostRecentlyFocusedNode) {
2243
+ if (getTabIndex(this.state.mostRecentlyFocusedNode) > 0) {
2244
+ const mruContainerIdx = this.findContainerIndex(this.state.mostRecentlyFocusedNode);
2245
+ const { tabbableNodes } = this.state.containerGroups[mruContainerIdx];
2246
+ if (tabbableNodes.length > 0) {
2247
+ const mruTabIdx = tabbableNodes.findIndex((node) => node === this.state.mostRecentlyFocusedNode);
2248
+ if (mruTabIdx >= 0) {
2249
+ if (this.config.isKeyForward(this.state.recentNavEvent)) {
2250
+ if (mruTabIdx + 1 < tabbableNodes.length) {
2251
+ nextNode = tabbableNodes[mruTabIdx + 1];
2252
+ navAcrossContainers = false;
2253
+ }
2254
+ } else {
2255
+ if (mruTabIdx - 1 >= 0) {
2256
+ nextNode = tabbableNodes[mruTabIdx - 1];
2257
+ navAcrossContainers = false;
2258
+ }
2259
+ }
2260
+ }
2261
+ }
2262
+ } else {
2263
+ if (!this.state.containerGroups.some((g2) => g2.tabbableNodes.some((n) => getTabIndex(n) > 0))) {
2264
+ navAcrossContainers = false;
2265
+ }
2266
+ }
2267
+ } else {
2268
+ navAcrossContainers = false;
2269
+ }
2270
+ if (navAcrossContainers) {
2271
+ nextNode = this.findNextNavNode({
2272
+ // move FROM the MRU node, not event-related node (which will be the node that is
2273
+ // outside the trap causing the focus escape we're trying to fix)
2274
+ target: this.state.mostRecentlyFocusedNode,
2275
+ isBackward: this.config.isKeyBackward(this.state.recentNavEvent)
2276
+ });
2277
+ }
2278
+ if (nextNode) {
2279
+ this.tryFocus(nextNode);
2280
+ } else {
2281
+ this.tryFocus(this.state.mostRecentlyFocusedNode || this.getInitialFocusNode());
2282
+ }
2283
+ }
2284
+ this.state.recentNavEvent = void 0;
2285
+ });
2286
+ __publicField(this, "handlePointerDown", (event) => {
2287
+ const target = getEventTarget(event);
2288
+ if (this.findContainerIndex(target, event) >= 0) {
2289
+ return;
2290
+ }
2291
+ if (valueOrHandler(this.config.clickOutsideDeactivates, event)) {
2292
+ this.deactivate({ returnFocus: this.config.returnFocusOnDeactivate });
2293
+ return;
2294
+ }
2295
+ if (valueOrHandler(this.config.allowOutsideClick, event)) {
2296
+ return;
2297
+ }
2298
+ event.preventDefault();
2299
+ });
2300
+ __publicField(this, "handleClick", (event) => {
2301
+ const target = getEventTarget(event);
2302
+ if (this.findContainerIndex(target, event) >= 0) {
2303
+ return;
2304
+ }
2305
+ if (valueOrHandler(this.config.clickOutsideDeactivates, event)) {
2306
+ return;
2307
+ }
2308
+ if (valueOrHandler(this.config.allowOutsideClick, event)) {
2309
+ return;
2310
+ }
2311
+ event.preventDefault();
2312
+ event.stopImmediatePropagation();
2313
+ });
2314
+ __publicField(this, "handleTabKey", (event) => {
2315
+ if (this.config.isKeyForward(event) || this.config.isKeyBackward(event)) {
2316
+ this.state.recentNavEvent = event;
2317
+ const isBackward = this.config.isKeyBackward(event);
2318
+ const destinationNode = this.findNextNavNode({ event, isBackward });
2319
+ if (!destinationNode) return;
2320
+ if (isTabEvent(event)) {
2321
+ event.preventDefault();
2322
+ }
2323
+ this.tryFocus(destinationNode);
2324
+ }
2325
+ });
2326
+ __publicField(this, "handleEscapeKey", (event) => {
2327
+ if (isEscapeEvent(event) && valueOrHandler(this.config.escapeDeactivates, event) !== false) {
2328
+ event.preventDefault();
2329
+ this.deactivate();
2330
+ }
2331
+ });
2332
+ __publicField(this, "_mutationObserver");
2333
+ __publicField(this, "setupMutationObserver", () => {
2334
+ const win = this.doc.defaultView || window;
2335
+ this._mutationObserver = new win.MutationObserver((mutations) => {
2336
+ const isFocusedNodeRemoved = mutations.some((mutation) => {
2337
+ const removedNodes = Array.from(mutation.removedNodes);
2338
+ return removedNodes.some((node) => node === this.state.mostRecentlyFocusedNode);
2339
+ });
2340
+ if (isFocusedNodeRemoved) {
2341
+ this.tryFocus(this.getInitialFocusNode());
2342
+ }
2343
+ });
2344
+ });
2345
+ __publicField(this, "updateObservedNodes", () => {
2346
+ var _a;
2347
+ (_a = this._mutationObserver) == null ? void 0 : _a.disconnect();
2348
+ if (this.state.active && !this.state.paused) {
2349
+ this.state.containers.map((container) => {
2350
+ var _a2;
2351
+ (_a2 = this._mutationObserver) == null ? void 0 : _a2.observe(container, { subtree: true, childList: true });
2352
+ });
2353
+ }
2354
+ });
2355
+ __publicField(this, "getInitialFocusNode", () => {
2356
+ let node = this.getNodeForOption("initialFocus", { hasFallback: true });
2357
+ if (node === false) {
2358
+ return false;
2359
+ }
2360
+ if (node === void 0 || node && !isFocusable(node)) {
2361
+ if (this.findContainerIndex(this.doc.activeElement) >= 0) {
2362
+ node = this.doc.activeElement;
2363
+ } else {
2364
+ const firstTabbableGroup = this.state.tabbableGroups[0];
2365
+ const firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
2366
+ node = firstTabbableNode || this.getNodeForOption("fallbackFocus");
2367
+ }
2368
+ } else if (node === null) {
2369
+ node = this.getNodeForOption("fallbackFocus");
2370
+ }
2371
+ if (!node) {
2372
+ throw new Error("Your focus-trap needs to have at least one focusable element");
2373
+ }
2374
+ if (!node.isConnected) {
2375
+ node = this.getNodeForOption("fallbackFocus");
2376
+ }
2377
+ return node;
2378
+ });
2379
+ __publicField(this, "tryFocus", (node) => {
2380
+ if (node === false) return;
2381
+ if (node === getActiveElement(this.doc)) return;
2382
+ if (!node || !node.focus) {
2383
+ this.tryFocus(this.getInitialFocusNode());
2384
+ return;
2385
+ }
2386
+ node.focus({ preventScroll: !!this.config.preventScroll });
2387
+ this.state.mostRecentlyFocusedNode = node;
2388
+ if (isSelectableInput(node)) {
2389
+ node.select();
2390
+ }
2391
+ });
2392
+ __publicField(this, "deactivate", (deactivateOptions) => {
2393
+ if (!this.state.active) return this;
2394
+ const options2 = {
2395
+ onDeactivate: this.config.onDeactivate,
2396
+ onPostDeactivate: this.config.onPostDeactivate,
2397
+ checkCanReturnFocus: this.config.checkCanReturnFocus,
2398
+ ...deactivateOptions
2399
+ };
2400
+ clearTimeout(this.state.delayInitialFocusTimer);
2401
+ this.state.delayInitialFocusTimer = void 0;
2402
+ this.removeListeners();
2403
+ this.state.active = false;
2404
+ this.state.paused = false;
2405
+ this.updateObservedNodes();
2406
+ activeFocusTraps.deactivateTrap(this.trapStack, this);
2407
+ const onDeactivate = this.getOption(options2, "onDeactivate");
2408
+ const onPostDeactivate = this.getOption(options2, "onPostDeactivate");
2409
+ const checkCanReturnFocus = this.getOption(options2, "checkCanReturnFocus");
2410
+ const returnFocus = this.getOption(options2, "returnFocus", "returnFocusOnDeactivate");
2411
+ onDeactivate == null ? void 0 : onDeactivate();
2412
+ const finishDeactivation = () => {
2413
+ delay(() => {
2414
+ if (returnFocus) {
2415
+ const returnFocusNode = this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);
2416
+ this.tryFocus(returnFocusNode);
2417
+ }
2418
+ onPostDeactivate == null ? void 0 : onPostDeactivate();
2419
+ });
2420
+ };
2421
+ if (returnFocus && checkCanReturnFocus) {
2422
+ const returnFocusNode = this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);
2423
+ checkCanReturnFocus(returnFocusNode).then(finishDeactivation, finishDeactivation);
2424
+ return this;
2425
+ }
2426
+ finishDeactivation();
2427
+ return this;
2428
+ });
2429
+ __publicField(this, "pause", (pauseOptions) => {
2430
+ if (this.state.paused || !this.state.active) {
2431
+ return this;
2432
+ }
2433
+ const onPause = this.getOption(pauseOptions, "onPause");
2434
+ const onPostPause = this.getOption(pauseOptions, "onPostPause");
2435
+ this.state.paused = true;
2436
+ onPause == null ? void 0 : onPause();
2437
+ this.removeListeners();
2438
+ this.updateObservedNodes();
2439
+ onPostPause == null ? void 0 : onPostPause();
2440
+ return this;
2441
+ });
2442
+ __publicField(this, "unpause", (unpauseOptions) => {
2443
+ if (!this.state.paused || !this.state.active) {
2444
+ return this;
2445
+ }
2446
+ const onUnpause = this.getOption(unpauseOptions, "onUnpause");
2447
+ const onPostUnpause = this.getOption(unpauseOptions, "onPostUnpause");
2448
+ this.state.paused = false;
2449
+ onUnpause == null ? void 0 : onUnpause();
2450
+ this.updateTabbableNodes();
2451
+ this.addListeners();
2452
+ this.updateObservedNodes();
2453
+ onPostUnpause == null ? void 0 : onPostUnpause();
2454
+ return this;
2455
+ });
2456
+ __publicField(this, "updateContainerElements", (containerElements) => {
2457
+ this.state.containers = Array.isArray(containerElements) ? containerElements.filter(Boolean) : [containerElements].filter(Boolean);
2458
+ if (this.state.active) {
2459
+ this.updateTabbableNodes();
2460
+ }
2461
+ this.updateObservedNodes();
2462
+ return this;
2463
+ });
2464
+ __publicField(this, "getReturnFocusNode", (previousActiveElement) => {
2465
+ const node = this.getNodeForOption("setReturnFocus", {
2466
+ params: [previousActiveElement]
2467
+ });
2468
+ return node ? node : node === false ? false : previousActiveElement;
2469
+ });
2470
+ __publicField(this, "getOption", (configOverrideOptions, optionName, configOptionName) => {
2471
+ return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : (
2472
+ // @ts-expect-error
2473
+ this.config[configOptionName || optionName]
2474
+ );
2475
+ });
2476
+ __publicField(this, "getNodeForOption", (optionName, { hasFallback = false, params = [] } = {}) => {
2477
+ let optionValue = this.config[optionName];
2478
+ if (typeof optionValue === "function") optionValue = optionValue(...params);
2479
+ if (optionValue === true) optionValue = void 0;
2480
+ if (!optionValue) {
2481
+ if (optionValue === void 0 || optionValue === false) {
2482
+ return optionValue;
2483
+ }
2484
+ throw new Error(`\`${optionName}\` was specified but was not a node, or did not return a node`);
2485
+ }
2486
+ let node = optionValue;
2487
+ if (typeof optionValue === "string") {
2488
+ try {
2489
+ node = this.doc.querySelector(optionValue);
2490
+ } catch (err) {
2491
+ throw new Error(`\`${optionName}\` appears to be an invalid selector; error="${err.message}"`);
2492
+ }
2493
+ if (!node) {
2494
+ if (!hasFallback) {
2495
+ throw new Error(`\`${optionName}\` as selector refers to no known node`);
2496
+ }
2497
+ }
2498
+ }
2499
+ return node;
2500
+ });
2501
+ __publicField(this, "findNextNavNode", (opts) => {
2502
+ const { event, isBackward = false } = opts;
2503
+ const target = opts.target || getEventTarget(event);
2504
+ this.updateTabbableNodes();
2505
+ let destinationNode = null;
2506
+ if (this.state.tabbableGroups.length > 0) {
2507
+ const containerIndex = this.findContainerIndex(target, event);
2508
+ const containerGroup = containerIndex >= 0 ? this.state.containerGroups[containerIndex] : void 0;
2509
+ if (containerIndex < 0) {
2510
+ if (isBackward) {
2511
+ destinationNode = this.state.tabbableGroups[this.state.tabbableGroups.length - 1].lastTabbableNode;
2512
+ } else {
2513
+ destinationNode = this.state.tabbableGroups[0].firstTabbableNode;
2514
+ }
2515
+ } else if (isBackward) {
2516
+ let startOfGroupIndex = this.state.tabbableGroups.findIndex(
2517
+ ({ firstTabbableNode }) => target === firstTabbableNode
2518
+ );
2519
+ if (startOfGroupIndex < 0 && ((containerGroup == null ? void 0 : containerGroup.container) === target || isFocusable(target) && !isTabbable(target) && !(containerGroup == null ? void 0 : containerGroup.nextTabbableNode(target, false)))) {
2520
+ startOfGroupIndex = containerIndex;
2521
+ }
2522
+ if (startOfGroupIndex >= 0) {
2523
+ const destinationGroupIndex = startOfGroupIndex === 0 ? this.state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
2524
+ const destinationGroup = this.state.tabbableGroups[destinationGroupIndex];
2525
+ destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
2526
+ } else if (!isTabEvent(event)) {
2527
+ destinationNode = containerGroup == null ? void 0 : containerGroup.nextTabbableNode(target, false);
2528
+ }
2529
+ } else {
2530
+ let lastOfGroupIndex = this.state.tabbableGroups.findIndex(
2531
+ ({ lastTabbableNode }) => target === lastTabbableNode
2532
+ );
2533
+ if (lastOfGroupIndex < 0 && ((containerGroup == null ? void 0 : containerGroup.container) === target || isFocusable(target) && !isTabbable(target) && !(containerGroup == null ? void 0 : containerGroup.nextTabbableNode(target)))) {
2534
+ lastOfGroupIndex = containerIndex;
2535
+ }
2536
+ if (lastOfGroupIndex >= 0) {
2537
+ const destinationGroupIndex = lastOfGroupIndex === this.state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
2538
+ const destinationGroup = this.state.tabbableGroups[destinationGroupIndex];
2539
+ destinationNode = getTabIndex(target) >= 0 ? destinationGroup.firstTabbableNode : destinationGroup.firstDomTabbableNode;
2540
+ } else if (!isTabEvent(event)) {
2541
+ destinationNode = containerGroup == null ? void 0 : containerGroup.nextTabbableNode(target);
2542
+ }
2543
+ }
2544
+ } else {
2545
+ destinationNode = this.getNodeForOption("fallbackFocus");
2546
+ }
2547
+ return destinationNode;
2548
+ });
2549
+ this.trapStack = options.trapStack || sharedTrapStack;
2550
+ const config = {
2551
+ returnFocusOnDeactivate: true,
2552
+ escapeDeactivates: true,
2553
+ delayInitialFocus: true,
2554
+ isKeyForward(e) {
2555
+ return isTabEvent(e) && !e.shiftKey;
2556
+ },
2557
+ isKeyBackward(e) {
2558
+ return isTabEvent(e) && e.shiftKey;
2559
+ },
2560
+ ...options
2561
+ };
2562
+ this.doc = config.document || getDocument(Array.isArray(elements) ? elements[0] : elements);
2563
+ this.config = config;
2564
+ this.updateContainerElements(elements);
2565
+ this.setupMutationObserver();
2566
+ }
2567
+ get active() {
2568
+ return this.state.active;
2569
+ }
2570
+ get paused() {
2571
+ return this.state.paused;
2572
+ }
2573
+ findContainerIndex(element, event) {
2574
+ const composedPath = typeof (event == null ? void 0 : event.composedPath) === "function" ? event.composedPath() : void 0;
2575
+ return this.state.containerGroups.findIndex(
2576
+ ({ container, tabbableNodes }) => container.contains(element) || (composedPath == null ? void 0 : composedPath.includes(container)) || tabbableNodes.find((node) => node === element)
2577
+ );
2578
+ }
2579
+ updateTabbableNodes() {
2580
+ this.state.containerGroups = this.state.containers.map((container) => {
2581
+ const tabbableNodes = getTabbables(container);
2582
+ const focusableNodes = getFocusables(container);
2583
+ const firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : void 0;
2584
+ const lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : void 0;
2585
+ const firstDomTabbableNode = focusableNodes.find((node) => isTabbable(node));
2586
+ const lastDomTabbableNode = focusableNodes.slice().reverse().find((node) => isTabbable(node));
2587
+ const posTabIndexesFound = !!tabbableNodes.find((node) => getTabIndex(node) > 0);
2588
+ function nextTabbableNode(node, forward = true) {
2589
+ const nodeIdx = tabbableNodes.indexOf(node);
2590
+ if (nodeIdx < 0) {
2591
+ if (forward) {
2592
+ return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find((el) => isTabbable(el));
2593
+ }
2594
+ return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find((el) => isTabbable(el));
2595
+ }
2596
+ return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
2597
+ }
2598
+ return {
2599
+ container,
2600
+ tabbableNodes,
2601
+ focusableNodes,
2602
+ posTabIndexesFound,
2603
+ firstTabbableNode,
2604
+ lastTabbableNode,
2605
+ firstDomTabbableNode,
2606
+ lastDomTabbableNode,
2607
+ nextTabbableNode
2608
+ };
2609
+ });
2610
+ this.state.tabbableGroups = this.state.containerGroups.filter((group) => group.tabbableNodes.length > 0);
2611
+ if (this.state.tabbableGroups.length <= 0 && !this.getNodeForOption("fallbackFocus")) {
2612
+ throw new Error(
2613
+ "Your focus-trap must have at least one container with at least one tabbable node in it at all times"
2614
+ );
2615
+ }
2616
+ if (this.state.containerGroups.find((g2) => g2.posTabIndexesFound) && this.state.containerGroups.length > 1) {
2617
+ throw new Error(
2618
+ "At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps."
2619
+ );
2620
+ }
2621
+ }
2622
+ addListeners() {
2623
+ if (!this.state.active) return;
2624
+ activeFocusTraps.activateTrap(this.trapStack, this);
2625
+ this.state.delayInitialFocusTimer = this.config.delayInitialFocus ? delay(() => {
2626
+ this.tryFocus(this.getInitialFocusNode());
2627
+ }) : this.tryFocus(this.getInitialFocusNode());
2628
+ this.listenerCleanups.push(
2629
+ addDomEvent(this.doc, "focusin", this.handleFocus, true),
2630
+ addDomEvent(this.doc, "mousedown", this.handlePointerDown, { capture: true, passive: false }),
2631
+ addDomEvent(this.doc, "touchstart", this.handlePointerDown, { capture: true, passive: false }),
2632
+ addDomEvent(this.doc, "click", this.handleClick, { capture: true, passive: false }),
2633
+ addDomEvent(this.doc, "keydown", this.handleTabKey, { capture: true, passive: false }),
2634
+ addDomEvent(this.doc, "keydown", this.handleEscapeKey)
2635
+ );
2636
+ return this;
2637
+ }
2638
+ removeListeners() {
2639
+ if (!this.state.active) return;
2640
+ this.listenerCleanups.forEach((cleanup) => cleanup());
2641
+ this.listenerCleanups = [];
2642
+ return this;
2643
+ }
2644
+ activate(activateOptions) {
2645
+ if (this.state.active) {
2646
+ return this;
2647
+ }
2648
+ const onActivate = this.getOption(activateOptions, "onActivate");
2649
+ const onPostActivate = this.getOption(activateOptions, "onPostActivate");
2650
+ const checkCanFocusTrap = this.getOption(activateOptions, "checkCanFocusTrap");
2651
+ if (!checkCanFocusTrap) {
2652
+ this.updateTabbableNodes();
2653
+ }
2654
+ this.state.active = true;
2655
+ this.state.paused = false;
2656
+ this.state.nodeFocusedBeforeActivation = this.doc.activeElement || null;
2657
+ onActivate == null ? void 0 : onActivate();
2658
+ const finishActivation = () => {
2659
+ if (checkCanFocusTrap) {
2660
+ this.updateTabbableNodes();
2661
+ }
2662
+ this.addListeners();
2663
+ this.updateObservedNodes();
2664
+ onPostActivate == null ? void 0 : onPostActivate();
2665
+ };
2666
+ if (checkCanFocusTrap) {
2667
+ checkCanFocusTrap(this.state.containers.concat()).then(finishActivation, finishActivation);
2668
+ return this;
2669
+ }
2670
+ finishActivation();
2671
+ return this;
2672
+ }
2673
+ };
2674
+ var isTabEvent = (event) => event.key === "Tab";
2675
+ var valueOrHandler = (value, ...params) => typeof value === "function" ? value(...params) : value;
2676
+ var isEscapeEvent = (event) => !event.isComposing && event.key === "Escape";
2677
+ var delay = (fn) => setTimeout(fn, 0);
2678
+ var isSelectableInput = (node) => node.localName === "input" && "select" in node && typeof node.select === "function";
2679
+ function trapFocus(el, options = {}) {
2680
+ let trap;
2681
+ const cleanup = raf$1(() => {
2682
+ const contentEl = typeof el === "function" ? el() : el;
2683
+ if (!contentEl) return;
2684
+ trap = new FocusTrap(contentEl, {
2685
+ escapeDeactivates: false,
2686
+ allowOutsideClick: true,
2687
+ preventScroll: true,
2688
+ returnFocusOnDeactivate: true,
2689
+ delayInitialFocus: false,
2690
+ fallbackFocus: contentEl,
2691
+ ...options,
2692
+ document: getDocument(contentEl)
2693
+ });
2694
+ try {
2695
+ trap.activate();
2696
+ } catch {
2697
+ }
2698
+ });
2699
+ return function destroy() {
2700
+ trap == null ? void 0 : trap.deactivate();
2701
+ cleanup();
2702
+ };
2703
+ }
2704
+ var LOCK_CLASSNAME = "data-scroll-lock";
2705
+ function assignStyle(el, style) {
2706
+ if (!el) return;
2707
+ const previousStyle = Object.keys(style).reduce(
2708
+ (acc, key) => {
2709
+ acc[key] = el.style.getPropertyValue(key);
2710
+ return acc;
2711
+ },
2712
+ {}
2713
+ );
2714
+ Object.assign(el.style, style);
2715
+ return () => {
2716
+ Object.assign(el.style, previousStyle);
2717
+ };
2718
+ }
2719
+ function setCSSProperty(el, property, value) {
2720
+ if (!el) return;
2721
+ const previousValue = el.style.getPropertyValue(property);
2722
+ el.style.setProperty(property, value);
2723
+ return () => {
2724
+ if (previousValue) {
2725
+ el.style.setProperty(property, previousValue);
2726
+ } else {
2727
+ el.style.removeProperty(property);
2728
+ }
2729
+ };
2730
+ }
2731
+ function getPaddingProperty(documentElement) {
2732
+ const documentLeft = documentElement.getBoundingClientRect().left;
2733
+ const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;
2734
+ return scrollbarX ? "paddingLeft" : "paddingRight";
2735
+ }
2736
+ function preventBodyScroll(_document) {
2737
+ const doc = _document ?? document;
2738
+ const win = doc.defaultView ?? window;
2739
+ const { documentElement, body } = doc;
2740
+ const locked = body.hasAttribute(LOCK_CLASSNAME);
2741
+ if (locked) return;
2742
+ body.setAttribute(LOCK_CLASSNAME, "");
2743
+ const scrollbarWidth = win.innerWidth - documentElement.clientWidth;
2744
+ const setScrollbarWidthProperty = () => setCSSProperty(documentElement, "--scrollbar-width", `${scrollbarWidth}px`);
2745
+ const paddingProperty = getPaddingProperty(documentElement);
2746
+ const setStyle2 = () => assignStyle(body, {
2747
+ overflow: "hidden",
2748
+ [paddingProperty]: `${scrollbarWidth}px`
2749
+ });
2750
+ const setIOSStyle = () => {
2751
+ const { scrollX, scrollY, visualViewport } = win;
2752
+ const offsetLeft = (visualViewport == null ? void 0 : visualViewport.offsetLeft) ?? 0;
2753
+ const offsetTop = (visualViewport == null ? void 0 : visualViewport.offsetTop) ?? 0;
2754
+ const restoreStyle = assignStyle(body, {
2755
+ position: "fixed",
2756
+ overflow: "hidden",
2757
+ top: `${-(scrollY - Math.floor(offsetTop))}px`,
2758
+ left: `${-(scrollX - Math.floor(offsetLeft))}px`,
2759
+ right: "0",
2760
+ [paddingProperty]: `${scrollbarWidth}px`
2761
+ });
2762
+ return () => {
2763
+ restoreStyle == null ? void 0 : restoreStyle();
2764
+ win.scrollTo({ left: scrollX, top: scrollY, behavior: "instant" });
2765
+ };
2766
+ };
2767
+ const cleanups2 = [setScrollbarWidthProperty(), isIos() ? setIOSStyle() : setStyle2()];
2768
+ return () => {
2769
+ cleanups2.forEach((fn) => fn == null ? void 0 : fn());
2770
+ body.removeAttribute(LOCK_CLASSNAME);
2771
+ };
2772
+ }
2773
+ var anatomy = createAnatomy("dialog").parts(
2774
+ "trigger",
2775
+ "backdrop",
2776
+ "positioner",
2777
+ "content",
2778
+ "title",
2779
+ "description",
2780
+ "closeTrigger"
2781
+ );
2782
+ var parts = anatomy.build();
2783
+ var getPositionerId = (ctx) => {
2784
+ var _a;
2785
+ return ((_a = ctx.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx.id}:positioner`;
2786
+ };
2787
+ var getBackdropId = (ctx) => {
2788
+ var _a;
2789
+ return ((_a = ctx.ids) == null ? void 0 : _a.backdrop) ?? `dialog:${ctx.id}:backdrop`;
2790
+ };
2791
+ var getContentId = (ctx) => {
2792
+ var _a;
2793
+ return ((_a = ctx.ids) == null ? void 0 : _a.content) ?? `dialog:${ctx.id}:content`;
2794
+ };
2795
+ var getTriggerId = (ctx) => {
2796
+ var _a;
2797
+ return ((_a = ctx.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx.id}:trigger`;
2798
+ };
2799
+ var getTitleId = (ctx) => {
2800
+ var _a;
2801
+ return ((_a = ctx.ids) == null ? void 0 : _a.title) ?? `dialog:${ctx.id}:title`;
2802
+ };
2803
+ var getDescriptionId = (ctx) => {
2804
+ var _a;
2805
+ return ((_a = ctx.ids) == null ? void 0 : _a.description) ?? `dialog:${ctx.id}:description`;
2806
+ };
2807
+ var getCloseTriggerId = (ctx) => {
2808
+ var _a;
2809
+ return ((_a = ctx.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx.id}:close`;
2810
+ };
2811
+ var getContentEl = (ctx) => ctx.getById(getContentId(ctx));
2812
+ var getPositionerEl = (ctx) => ctx.getById(getPositionerId(ctx));
2813
+ var getBackdropEl = (ctx) => ctx.getById(getBackdropId(ctx));
2814
+ var getTriggerEl = (ctx) => ctx.getById(getTriggerId(ctx));
2815
+ var getTitleEl = (ctx) => ctx.getById(getTitleId(ctx));
2816
+ var getDescriptionEl = (ctx) => ctx.getById(getDescriptionId(ctx));
2817
+ var getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId(ctx));
2818
+ function connect(service, normalize) {
2819
+ const { state, send, context: context2, prop, scope } = service;
2820
+ const ariaLabel = prop("aria-label");
2821
+ const open = state.matches("open");
2822
+ return {
2823
+ open,
2824
+ setOpen(nextOpen) {
2825
+ const open2 = state.matches("open");
2826
+ if (open2 === nextOpen) return;
2827
+ send({ type: nextOpen ? "OPEN" : "CLOSE" });
2828
+ },
2829
+ getTriggerProps() {
2830
+ return normalize.button({
2831
+ ...parts.trigger.attrs,
2832
+ dir: prop("dir"),
2833
+ id: getTriggerId(scope),
2834
+ "aria-haspopup": "dialog",
2835
+ type: "button",
2836
+ "aria-expanded": open,
2837
+ "data-state": open ? "open" : "closed",
2838
+ "aria-controls": getContentId(scope),
2839
+ onClick(event) {
2840
+ if (event.defaultPrevented) return;
2841
+ send({ type: "TOGGLE" });
2842
+ }
2843
+ });
2844
+ },
2845
+ getBackdropProps() {
2846
+ return normalize.element({
2847
+ ...parts.backdrop.attrs,
2848
+ dir: prop("dir"),
2849
+ hidden: !open,
2850
+ id: getBackdropId(scope),
2851
+ "data-state": open ? "open" : "closed"
2852
+ });
2853
+ },
2854
+ getPositionerProps() {
2855
+ return normalize.element({
2856
+ ...parts.positioner.attrs,
2857
+ dir: prop("dir"),
2858
+ id: getPositionerId(scope),
2859
+ style: {
2860
+ pointerEvents: open ? void 0 : "none"
2861
+ }
2862
+ });
2863
+ },
2864
+ getContentProps() {
2865
+ const rendered = context2.get("rendered");
2866
+ return normalize.element({
2867
+ ...parts.content.attrs,
2868
+ dir: prop("dir"),
2869
+ role: prop("role"),
2870
+ hidden: !open,
2871
+ id: getContentId(scope),
2872
+ tabIndex: -1,
2873
+ "data-state": open ? "open" : "closed",
2874
+ "aria-modal": true,
2875
+ "aria-label": ariaLabel || void 0,
2876
+ "aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId(scope),
2877
+ "aria-describedby": rendered.description ? getDescriptionId(scope) : void 0
2878
+ });
2879
+ },
2880
+ getTitleProps() {
2881
+ return normalize.element({
2882
+ ...parts.title.attrs,
2883
+ dir: prop("dir"),
2884
+ id: getTitleId(scope)
2885
+ });
2886
+ },
2887
+ getDescriptionProps() {
2888
+ return normalize.element({
2889
+ ...parts.description.attrs,
2890
+ dir: prop("dir"),
2891
+ id: getDescriptionId(scope)
2892
+ });
2893
+ },
2894
+ getCloseTriggerProps() {
2895
+ return normalize.button({
2896
+ ...parts.closeTrigger.attrs,
2897
+ dir: prop("dir"),
2898
+ id: getCloseTriggerId(scope),
2899
+ type: "button",
2900
+ onClick(event) {
2901
+ if (event.defaultPrevented) return;
2902
+ event.stopPropagation();
2903
+ send({ type: "CLOSE" });
2904
+ }
2905
+ });
2906
+ }
2907
+ };
2908
+ }
2909
+ var machine = createMachine({
2910
+ props({ props: props2, scope }) {
2911
+ const alertDialog = props2.role === "alertdialog";
2912
+ const initialFocusEl = alertDialog ? () => getCloseTriggerEl(scope) : void 0;
2913
+ return {
2914
+ role: "dialog",
2915
+ modal: true,
2916
+ trapFocus: true,
2917
+ preventScroll: true,
2918
+ closeOnInteractOutside: !alertDialog,
2919
+ closeOnEscape: true,
2920
+ restoreFocus: true,
2921
+ initialFocusEl,
2922
+ ...props2
2923
+ };
2924
+ },
2925
+ initialState({ prop }) {
2926
+ const open = prop("open") || prop("defaultOpen");
2927
+ return open ? "open" : "closed";
2928
+ },
2929
+ context({ bindable }) {
2930
+ return {
2931
+ rendered: bindable(() => ({
2932
+ defaultValue: { title: true, description: true }
2933
+ }))
2934
+ };
2935
+ },
2936
+ watch({ track, action, prop }) {
2937
+ track([() => prop("open")], () => {
2938
+ action(["toggleVisibility"]);
2939
+ });
2940
+ },
2941
+ states: {
2942
+ open: {
2943
+ entry: ["checkRenderedElements", "syncZIndex"],
2944
+ effects: ["trackDismissableElement", "trapFocus", "preventScroll", "hideContentBelow"],
2945
+ on: {
2946
+ "CONTROLLED.CLOSE": {
2947
+ target: "closed"
2948
+ },
2949
+ CLOSE: [
2950
+ {
2951
+ guard: "isOpenControlled",
2952
+ actions: ["invokeOnClose"]
2953
+ },
2954
+ {
2955
+ target: "closed",
2956
+ actions: ["invokeOnClose"]
2957
+ }
2958
+ ],
2959
+ TOGGLE: [
2960
+ {
2961
+ guard: "isOpenControlled",
2962
+ actions: ["invokeOnClose"]
2963
+ },
2964
+ {
2965
+ target: "closed",
2966
+ actions: ["invokeOnClose"]
2967
+ }
2968
+ ]
2969
+ }
2970
+ },
2971
+ closed: {
2972
+ on: {
2973
+ "CONTROLLED.OPEN": {
2974
+ target: "open"
2975
+ },
2976
+ OPEN: [
2977
+ {
2978
+ guard: "isOpenControlled",
2979
+ actions: ["invokeOnOpen"]
2980
+ },
2981
+ {
2982
+ target: "open",
2983
+ actions: ["invokeOnOpen"]
2984
+ }
2985
+ ],
2986
+ TOGGLE: [
2987
+ {
2988
+ guard: "isOpenControlled",
2989
+ actions: ["invokeOnOpen"]
2990
+ },
2991
+ {
2992
+ target: "open",
2993
+ actions: ["invokeOnOpen"]
2994
+ }
2995
+ ]
2996
+ }
2997
+ }
2998
+ },
2999
+ implementations: {
3000
+ guards: {
3001
+ isOpenControlled: ({ prop }) => prop("open") != void 0
3002
+ },
3003
+ effects: {
3004
+ trackDismissableElement({ scope, send, prop }) {
3005
+ const getContentEl2 = () => getContentEl(scope);
3006
+ return trackDismissableElement(getContentEl2, {
3007
+ defer: true,
3008
+ pointerBlocking: prop("modal"),
3009
+ exclude: [getTriggerEl(scope)],
3010
+ onInteractOutside(event) {
3011
+ var _a;
3012
+ (_a = prop("onInteractOutside")) == null ? void 0 : _a(event);
3013
+ if (!prop("closeOnInteractOutside")) {
3014
+ event.preventDefault();
3015
+ }
3016
+ },
3017
+ persistentElements: prop("persistentElements"),
3018
+ onFocusOutside: prop("onFocusOutside"),
3019
+ onPointerDownOutside: prop("onPointerDownOutside"),
3020
+ onEscapeKeyDown(event) {
3021
+ var _a;
3022
+ (_a = prop("onEscapeKeyDown")) == null ? void 0 : _a(event);
3023
+ if (!prop("closeOnEscape")) {
3024
+ event.preventDefault();
3025
+ }
3026
+ },
3027
+ onDismiss() {
3028
+ send({ type: "CLOSE", src: "interact-outside" });
3029
+ }
3030
+ });
3031
+ },
3032
+ preventScroll({ scope, prop }) {
3033
+ if (!prop("preventScroll")) return;
3034
+ return preventBodyScroll(scope.getDoc());
3035
+ },
3036
+ trapFocus({ scope, prop }) {
3037
+ if (!prop("trapFocus") || !prop("modal")) return;
3038
+ const contentEl = () => getContentEl(scope);
3039
+ return trapFocus(contentEl, {
3040
+ preventScroll: true,
3041
+ returnFocusOnDeactivate: !!prop("restoreFocus"),
3042
+ initialFocus: prop("initialFocusEl"),
3043
+ setReturnFocus: (el) => {
3044
+ var _a;
3045
+ return ((_a = prop("finalFocusEl")) == null ? void 0 : _a()) ?? el;
3046
+ }
3047
+ });
3048
+ },
3049
+ hideContentBelow({ scope, prop }) {
3050
+ if (!prop("modal")) return;
3051
+ const getElements = () => [getContentEl(scope)];
3052
+ return ariaHidden(getElements, { defer: true });
3053
+ }
3054
+ },
3055
+ actions: {
3056
+ checkRenderedElements({ context: context2, scope }) {
3057
+ raf$1(() => {
3058
+ context2.set("rendered", {
3059
+ title: !!getTitleEl(scope),
3060
+ description: !!getDescriptionEl(scope)
3061
+ });
3062
+ });
3063
+ },
3064
+ syncZIndex({ scope }) {
3065
+ raf$1(() => {
3066
+ const contentEl = getContentEl(scope);
3067
+ if (!contentEl) return;
3068
+ const styles = getComputedStyle(contentEl);
3069
+ const elems = [getPositionerEl(scope), getBackdropEl(scope)];
3070
+ elems.forEach((node) => {
3071
+ node == null ? void 0 : node.style.setProperty("--z-index", styles.zIndex);
3072
+ });
3073
+ });
3074
+ },
3075
+ invokeOnClose({ prop }) {
3076
+ var _a;
3077
+ (_a = prop("onOpenChange")) == null ? void 0 : _a({ open: false });
3078
+ },
3079
+ invokeOnOpen({ prop }) {
3080
+ var _a;
3081
+ (_a = prop("onOpenChange")) == null ? void 0 : _a({ open: true });
3082
+ },
3083
+ toggleVisibility({ prop, send, event }) {
3084
+ send({
3085
+ type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE",
3086
+ previousEvent: event
3087
+ });
3088
+ }
3089
+ }
3090
+ }
3091
+ });
3092
+ createProps()([
3093
+ "aria-label",
3094
+ "closeOnEscape",
3095
+ "closeOnInteractOutside",
3096
+ "dir",
3097
+ "finalFocusEl",
3098
+ "getRootNode",
3099
+ "getRootNode",
3100
+ "id",
3101
+ "id",
3102
+ "ids",
3103
+ "initialFocusEl",
3104
+ "modal",
3105
+ "onEscapeKeyDown",
3106
+ "onFocusOutside",
3107
+ "onInteractOutside",
3108
+ "onOpenChange",
3109
+ "onPointerDownOutside",
3110
+ "defaultOpen",
3111
+ "open",
3112
+ "persistentElements",
3113
+ "preventScroll",
3114
+ "restoreFocus",
3115
+ "role",
3116
+ "trapFocus"
3117
+ ]);
3118
+ const useDialog = (props) => {
3119
+ const id = React.useId();
3120
+ const { getRootNode } = useEnvironmentContext();
3121
+ const { dir } = useLocaleContext();
3122
+ const machineProps = {
3123
+ id,
3124
+ getRootNode,
3125
+ dir,
3126
+ ...props
3127
+ };
3128
+ const service = useMachine(machine, machineProps);
3129
+ return connect(service, normalizeProps);
3130
+ };
3131
+ const DialogRoot = (props) => {
3132
+ const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
3133
+ const [renderStrategyProps] = splitRenderStrategyProps(presenceProps);
3134
+ const dialog = useDialog(localProps);
3135
+ const presence = usePresence(mergeProps({ present: dialog.open }, presenceProps));
3136
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogProvider, { value: dialog, children: /* @__PURE__ */ jsxRuntime.jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsxRuntime.jsx(PresenceProvider, { value: presence, children }) }) });
3137
+ };
3138
+ const DialogTitle = React.forwardRef((props, ref) => {
3139
+ const dialog = useDialogContext();
3140
+ const mergedProps = mergeProps(dialog.getTitleProps(), props);
3141
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.h2, { ...mergedProps, ref });
3142
+ });
3143
+ DialogTitle.displayName = "DialogTitle";
3144
+ const DialogTrigger = React.forwardRef((props, ref) => {
3145
+ const dialog = useDialogContext();
3146
+ const presence = usePresenceContext();
3147
+ const mergedProps = mergeProps(
3148
+ {
3149
+ ...dialog.getTriggerProps(),
3150
+ "aria-controls": presence.unmounted ? void 0 : dialog.getTriggerProps()["aria-controls"]
3151
+ },
3152
+ props
3153
+ );
3154
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
3155
+ });
3156
+ DialogTrigger.displayName = "DialogTrigger";
3157
+ const Portal = (props) => {
3158
+ var _a;
3159
+ const { children, disabled } = props;
3160
+ const [container, setContainer] = React.useState((_a = props.container) == null ? void 0 : _a.current);
3161
+ const isServer = React.useSyncExternalStore(
3162
+ subscribe,
3163
+ () => false,
3164
+ () => true
3165
+ );
3166
+ const { getRootNode } = useEnvironmentContext();
3167
+ React.useEffect(() => {
3168
+ setContainer(() => {
3169
+ var _a2;
3170
+ return (_a2 = props.container) == null ? void 0 : _a2.current;
3171
+ });
3172
+ }, [props.container]);
3173
+ if (isServer || disabled) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
3174
+ const mountNode = container ?? getPortalNode(getRootNode);
3175
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: React.Children.map(children, (child) => reactDom.createPortal(child, mountNode)) });
3176
+ };
3177
+ const getPortalNode = (cb) => {
3178
+ const node = cb == null ? void 0 : cb();
3179
+ const rootNode = node.getRootNode();
3180
+ if (isShadowRoot(rootNode)) return rootNode;
3181
+ return getDocument(node).body;
3182
+ };
3183
+ const subscribe = () => () => {
3184
+ };
3185
+ const spinnerRecipe = cva({
3186
+ base: {
3187
+ display: "inline-block",
3188
+ borderWidth: "md",
3189
+ borderStyle: "solid",
3190
+ borderStartEndRadius: "full",
3191
+ borderEndStartRadius: "full",
3192
+ borderRadius: "full",
3193
+ animation: "spin",
3194
+ animationDuration: "slowest"
3195
+ },
3196
+ defaultVariants: {
3197
+ size: "md"
3198
+ },
3199
+ variants: {
3200
+ size: {
3201
+ sm: { width: 4, height: 4 },
3202
+ md: { width: 6, height: 6 },
3203
+ lg: { width: 12, height: 12 },
3204
+ xl: { width: 24, height: 24 }
3205
+ }
3206
+ }
3207
+ });
3208
+ const Spinner = React.forwardRef((props, ref) => {
3209
+ const { label = "Loading...", color, ...rest } = props;
3210
+ const StyledSpinner = styled(ark.div, spinnerRecipe);
3211
+ return /* @__PURE__ */ jsxRuntime.jsx(
3212
+ StyledSpinner,
3213
+ {
3214
+ ref,
3215
+ ...rest,
3216
+ borderColor: "inherit",
3217
+ borderBottomColor: "transparent",
3218
+ borderLeftColor: "transparent",
3219
+ children: label && /* @__PURE__ */ jsxRuntime.jsx(styled.span, { srOnly: true, children: label })
3220
+ }
3221
+ );
3222
+ });
3223
+ Spinner.displayName = "Spinner";
3224
+ const buttonRecipe = cva({
3225
+ base: {
3226
+ alignItems: "center",
3227
+ appearance: "none",
3228
+ cursor: "pointer",
3229
+ display: "inline-flex",
3230
+ fontWeight: "semibold",
3231
+ isolation: "isolate",
3232
+ minWidth: "0",
3233
+ justifyContent: "center",
3234
+ outline: "none",
3235
+ position: "relative",
3236
+ transitionDuration: "normal",
3237
+ transitionProperty: "background, border-color, color, box-shadow",
3238
+ transitionTimingFunction: "default",
3239
+ userSelect: "none",
3240
+ verticalAlign: "middle",
3241
+ whiteSpace: "nowrap",
3242
+ _hidden: {
3243
+ display: "none"
3244
+ }
3245
+ },
3246
+ defaultVariants: {
3247
+ variant: "solid",
3248
+ size: "md",
3249
+ radius: "full",
3250
+ color: "neutral"
3251
+ },
3252
+ variants: {
3253
+ variant: {
3254
+ solid: {
3255
+ _disabled: {
3256
+ background: "background.neutral.disabled",
3257
+ color: "content.neutral.disabled",
3258
+ cursor: "not-allowed",
3259
+ pointerEvents: "none"
3260
+ }
3261
+ },
3262
+ outline: {
3263
+ background: "transparent",
3264
+ borderWidth: "1px",
3265
+ borderStyle: "solid",
3266
+ borderColor: "border.neutral.default",
3267
+ _disabled: {
3268
+ background: "transparent",
3269
+ color: "content.neutral.disabled",
3270
+ borderColor: "border.neutral.disabled",
3271
+ cursor: "not-allowed",
3272
+ pointerEvents: "none"
3273
+ }
3274
+ },
3275
+ light: {
3276
+ background: "transparent",
3277
+ _disabled: {
3278
+ background: "transparent",
3279
+ color: "content.neutral.disabled",
3280
+ cursor: "not-allowed",
3281
+ pointerEvents: "none"
3282
+ }
3283
+ }
3284
+ },
3285
+ color: {
3286
+ neuroid_primary: {},
3287
+ neuroid_secondary: {},
3288
+ zoltarina_primary: {},
3289
+ zoltarina_secondary: {},
3290
+ heyd_primary: {},
3291
+ heyd_secondary: {},
3292
+ heybee_primary: {},
3293
+ neutral: {},
3294
+ danger: {},
3295
+ warning: {},
3296
+ success: {},
3297
+ informative: {}
3298
+ },
3299
+ size: {
3300
+ xs: {
3301
+ h: 7,
3302
+ textStyle: "label.sm",
3303
+ px: "8px",
3304
+ gap: 1,
3305
+ "& :where(svg)": {
3306
+ width: "20px",
3307
+ height: "20px"
3308
+ }
3309
+ },
3310
+ sm: {
3311
+ h: 8,
3312
+ textStyle: "label.sm",
3313
+ px: "16px",
3314
+ gap: 1,
3315
+ "& :where(svg)": {
3316
+ width: "20px",
3317
+ height: "20px"
3318
+ }
3319
+ },
3320
+ md: {
3321
+ h: 10,
3322
+ textStyle: "label.md",
3323
+ px: "20px",
3324
+ gap: 1,
3325
+ "& :where(svg)": {
3326
+ width: "24px",
3327
+ height: "24px"
3328
+ }
3329
+ },
3330
+ lg: {
3331
+ h: 12,
3332
+ textStyle: "body.lg",
3333
+ px: "28px",
3334
+ gap: 1,
3335
+ "& :where(svg)": {
3336
+ width: "24px",
3337
+ height: "24px"
3338
+ }
3339
+ }
3340
+ },
3341
+ radius: {
3342
+ full: { borderRadius: "full" },
3343
+ lg: { borderRadius: "lg" },
3344
+ md: { borderRadius: "md" }
3345
+ },
3346
+ fullWidth: {
3347
+ true: {
3348
+ width: "full",
3349
+ flexBasis: "auto",
3350
+ flexGrow: 1
3351
+ }
3352
+ }
3353
+ },
3354
+ compoundVariants: [
3355
+ {
3356
+ variant: "solid",
3357
+ color: "neuroid_primary",
3358
+ css: {
3359
+ background: "background.neuroidPrimary.default",
3360
+ color: "content.neutral.bold",
3361
+ _hover: { background: "background.neuroidPrimary.selected" }
3362
+ }
3363
+ },
3364
+ {
3365
+ variant: "solid",
3366
+ color: "neuroid_secondary",
3367
+ css: {
3368
+ background: "background.neuroidSecondary.default",
3369
+ color: "content.static.black.bold",
3370
+ _hover: { background: "background.neuroidSecondary.selected" }
3371
+ }
3372
+ },
3373
+ {
3374
+ variant: "solid",
3375
+ color: "zoltarina_primary",
3376
+ css: {
3377
+ background: "background.zoltarinaPrimary.default",
3378
+ color: "content.static.black.bold",
3379
+ _hover: { background: "background.zoltarinaPrimary.selected" }
3380
+ }
3381
+ },
3382
+ {
3383
+ variant: "solid",
3384
+ color: "zoltarina_secondary",
3385
+ css: {
3386
+ background: "background.zoltarinaSecondary.default",
3387
+ color: "content.static.black.bold",
3388
+ _hover: { background: "background.zoltarinaSecondary.selected" }
3389
+ }
3390
+ },
3391
+ {
3392
+ variant: "solid",
3393
+ color: "heyd_primary",
3394
+ css: {
3395
+ background: "background.heydPrimary.default",
3396
+ color: "content.static.black.bold",
3397
+ _hover: { background: "background.heydPrimary.selected" }
3398
+ }
3399
+ },
3400
+ {
3401
+ variant: "solid",
3402
+ color: "heyd_secondary",
3403
+ css: {
3404
+ background: "background.heydSecondary.default",
3405
+ color: "content.static.black.bold",
3406
+ _hover: { background: "background.heydSecondary.selected" }
3407
+ }
3408
+ },
3409
+ {
3410
+ variant: "solid",
3411
+ color: "heybee_primary",
3412
+ css: {
3413
+ background: "background.heybeePrimary.default",
3414
+ color: "content.static.black.bold",
3415
+ _hover: { background: "background.heybeePrimary.selected" }
3416
+ }
3417
+ },
3418
+ {
3419
+ variant: "solid",
3420
+ color: "neutral",
3421
+ css: {
3422
+ background: "background.neutral.default",
3423
+ color: "content.neutral.bold",
3424
+ _hover: { background: "background.neutral.selected" }
3425
+ }
3426
+ },
3427
+ {
3428
+ variant: "solid",
3429
+ color: "danger",
3430
+ css: {
3431
+ background: "background.danger.default",
3432
+ color: "content.neutral.bold",
3433
+ _hover: { background: "background.danger.selected" }
3434
+ }
3435
+ },
3436
+ {
3437
+ variant: "solid",
3438
+ color: "warning",
3439
+ css: {
3440
+ background: "background.warning.default",
3441
+ color: "content.neutral.bold",
3442
+ _hover: { background: "background.warning.selected" }
3443
+ }
3444
+ },
3445
+ {
3446
+ variant: "solid",
3447
+ color: "success",
3448
+ css: {
3449
+ background: "background.success.default",
3450
+ color: "content.neutral.bold",
3451
+ _hover: { background: "background.success.selected" }
3452
+ }
3453
+ },
3454
+ {
3455
+ variant: "solid",
3456
+ color: "informative",
3457
+ css: {
3458
+ background: "background.informative.default",
3459
+ color: "content.neutral.bold",
3460
+ _hover: { background: "background.informative.selected" }
3461
+ }
3462
+ },
3463
+ {
3464
+ variant: "outline",
3465
+ color: "neuroid_primary",
3466
+ css: {
3467
+ color: "content.neuroidPrimary.default",
3468
+ borderColor: "border.neuroidPrimary.default",
3469
+ _hover: {
3470
+ background: "background.neuroidPrimary.selected",
3471
+ color: "content.neutral.bold"
3472
+ }
3473
+ }
3474
+ },
3475
+ {
3476
+ variant: "outline",
3477
+ color: "zoltarina_primary",
3478
+ css: {
3479
+ color: "content.zoltarinaPrimary.default",
3480
+ borderColor: "border.zoltarinaPrimary.default",
3481
+ _hover: {
3482
+ background: "background.zoltarinaPrimary.selected",
3483
+ color: "content.neutral.bold"
3484
+ }
3485
+ }
3486
+ },
3487
+ {
3488
+ variant: "outline",
3489
+ color: "heyd_primary",
3490
+ css: {
3491
+ color: "content.heydPrimary.default",
3492
+ borderColor: "border.heydPrimary.default",
3493
+ _hover: {
3494
+ background: "background.heydPrimary.selected",
3495
+ color: "content.neutral.bold"
3496
+ }
3497
+ }
3498
+ },
3499
+ {
3500
+ variant: "outline",
3501
+ color: "heybee_primary",
3502
+ css: {
3503
+ color: "content.heybeePrimary.default",
3504
+ borderColor: "border.heybeePrimary.default",
3505
+ _hover: {
3506
+ background: "background.heybeePrimary.selected",
3507
+ color: "content.neutral.bold"
3508
+ }
3509
+ }
3510
+ },
3511
+ {
3512
+ variant: "outline",
3513
+ color: "neutral",
3514
+ css: {
3515
+ color: "content.neutral.default",
3516
+ borderColor: "border.neutral.default",
3517
+ _hover: {
3518
+ background: "background.neutral.selected",
3519
+ color: "content.neutral.bold"
3520
+ }
3521
+ }
3522
+ },
3523
+ {
3524
+ variant: "outline",
3525
+ color: "danger",
3526
+ css: {
3527
+ color: "content.danger.default",
3528
+ borderColor: "border.danger.default",
3529
+ _hover: {
3530
+ background: "background.danger.selected",
3531
+ color: "content.neutral.bold"
3532
+ }
3533
+ }
3534
+ },
3535
+ {
3536
+ variant: "outline",
3537
+ color: "warning",
3538
+ css: {
3539
+ color: "content.warning.default",
3540
+ borderColor: "border.warning.default",
3541
+ _hover: {
3542
+ background: "background.warning.selected",
3543
+ color: "content.neutral.bold"
3544
+ }
3545
+ }
3546
+ },
3547
+ {
3548
+ variant: "outline",
3549
+ color: "success",
3550
+ css: {
3551
+ color: "content.success.default",
3552
+ borderColor: "border.success.default",
3553
+ _hover: {
3554
+ background: "background.success.selected",
3555
+ color: "content.neutral.bold"
3556
+ }
3557
+ }
3558
+ },
3559
+ {
3560
+ variant: "outline",
3561
+ color: "informative",
3562
+ css: {
3563
+ color: "content.informative.default",
3564
+ borderColor: "border.informative.default",
3565
+ _hover: {
3566
+ background: "background.informative.selected",
3567
+ color: "content.neutral.bold"
3568
+ }
3569
+ }
3570
+ },
3571
+ {
3572
+ variant: "light",
3573
+ color: "neuroid_primary",
3574
+ css: {
3575
+ background: "transparent",
3576
+ color: "content.neuroidPrimary.default",
3577
+ _hover: {
3578
+ textDecoration: "underline"
3579
+ }
3580
+ }
3581
+ },
3582
+ {
3583
+ variant: "light",
3584
+ color: "zoltarina_primary",
3585
+ css: {
3586
+ background: "transparent",
3587
+ color: "content.zoltarinaPrimary.default",
3588
+ _hover: {
3589
+ textDecoration: "underline"
3590
+ }
3591
+ }
3592
+ },
3593
+ {
3594
+ variant: "light",
3595
+ color: "heyd_primary",
3596
+ css: {
3597
+ background: "transparent",
3598
+ color: "content.heydPrimary.default",
3599
+ _hover: {
3600
+ textDecoration: "underline"
3601
+ }
3602
+ }
3603
+ },
3604
+ {
3605
+ variant: "light",
3606
+ color: "heybee_primary",
3607
+ css: {
3608
+ background: "transparent",
3609
+ color: "content.heybeePrimary.default",
3610
+ _hover: {
3611
+ textDecoration: "underline"
3612
+ }
3613
+ }
3614
+ },
3615
+ {
3616
+ variant: "light",
3617
+ color: "neutral",
3618
+ css: {
3619
+ background: "transparent",
3620
+ color: "content.neutral.bold",
3621
+ _hover: {
3622
+ textDecoration: "underline"
3623
+ }
3624
+ }
3625
+ },
3626
+ {
3627
+ variant: "light",
3628
+ color: "danger",
3629
+ css: {
3630
+ background: "transparent",
3631
+ color: "content.danger.default",
3632
+ _hover: {
3633
+ textDecoration: "underline"
3634
+ }
3635
+ }
3636
+ },
3637
+ {
3638
+ variant: "light",
3639
+ color: "warning",
3640
+ css: {
3641
+ background: "transparent",
3642
+ color: "content.warning.default",
3643
+ _hover: {
3644
+ textDecoration: "underline"
3645
+ }
3646
+ }
3647
+ },
3648
+ {
3649
+ variant: "light",
3650
+ color: "success",
3651
+ css: {
3652
+ background: "transparent",
3653
+ color: "content.success.default",
3654
+ _hover: {
3655
+ textDecoration: "underline"
3656
+ }
3657
+ }
3658
+ },
3659
+ {
3660
+ variant: "light",
3661
+ color: "informative",
3662
+ css: {
3663
+ background: "transparent",
3664
+ color: "content.informative.default",
3665
+ _hover: {
3666
+ textDecoration: "underline"
3667
+ }
3668
+ }
3669
+ }
3670
+ ]
3671
+ });
3672
+ const Button = React.forwardRef(
3673
+ ({ loading, disabled, loadingText, children, color, variant, size, radius, ...rest }, ref) => {
3674
+ const StyledButton = styled(ark.button, buttonRecipe);
3675
+ return /* @__PURE__ */ jsxRuntime.jsx(
3676
+ StyledButton,
3677
+ {
3678
+ disabled,
3679
+ ref,
3680
+ color,
3681
+ variant,
3682
+ size,
3683
+ radius,
3684
+ pointerEvents: loading ? "none" : "auto",
3685
+ ...rest,
3686
+ children: loading ? loadingText || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3687
+ /* @__PURE__ */ jsxRuntime.jsx(Center, { inline: true, position: "absolute", transform: "translate(-50%, -50%)", top: "50%", insetStart: "50%", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: size === "xs" || size === "sm" ? "sm" : "md" }) }),
3688
+ /* @__PURE__ */ jsxRuntime.jsx(styled.span, { opacity: 0, children })
3689
+ ] }) : children
3690
+ }
3691
+ );
3692
+ }
3693
+ );
3694
+ Button.displayName = "Button";
3695
+ const textRecipe = cva({
3696
+ base: {
3697
+ color: "content.neutral.default"
3698
+ },
3699
+ defaultVariants: {
3700
+ variant: "body.md"
3701
+ },
3702
+ variants: {
3703
+ variant: {
3704
+ "display.lg": {
3705
+ textStyle: "display.lg"
3706
+ },
3707
+ "display.md": {
3708
+ textStyle: "display.md"
3709
+ },
3710
+ "headline.md": {
3711
+ textStyle: "headline.md"
3712
+ },
3713
+ "headline.sm": {
3714
+ textStyle: "headline.sm"
3715
+ },
3716
+ "title.lg": {
3717
+ textStyle: "title.lg"
3718
+ },
3719
+ "title.md": {
3720
+ textStyle: "title.md"
3721
+ },
3722
+ "body.lg": {
3723
+ textStyle: "body.lg"
3724
+ },
3725
+ "body.md": {
3726
+ textStyle: "body.md"
3727
+ },
3728
+ "body.sm": {
3729
+ textStyle: "body.sm"
3730
+ },
3731
+ "label.sm": {
3732
+ textStyle: "label.sm"
3733
+ },
3734
+ "label.md": {
3735
+ textStyle: "label.md"
3736
+ }
3737
+ }
3738
+ }
3739
+ });
3740
+ const Text = React.forwardRef((props, ref) => {
3741
+ const { variant = "body.md", children, ...rest } = props;
3742
+ const textType = (variant == null ? void 0 : variant.split(".")[0]) || "body";
3743
+ const componentMap = {
3744
+ display: styled("h1", textRecipe),
3745
+ headline: styled("h2", textRecipe),
3746
+ title: styled("h3", textRecipe),
3747
+ body: styled("p", textRecipe),
3748
+ label: styled("span", textRecipe)
3749
+ };
3750
+ const TextComponent = componentMap[textType];
3751
+ return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, textStyle: variant, ...rest, children });
3752
+ });
3753
+ Text.displayName = "Text";
3754
+ const shouldForwardProp = (prop, variantKeys, options = {}) => {
3755
+ var _a;
3756
+ return ((_a = options.forwardProps) == null ? void 0 : _a.includes(prop)) || !variantKeys.includes(prop) && !isCssProperty(prop);
3757
+ };
3758
+ const createStyleContext = (recipe) => {
3759
+ const StyleContext = React.createContext(null);
3760
+ const withRootProvider2 = (Component) => {
3761
+ const StyledComponent = (props) => {
3762
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
3763
+ const slotStyles = recipe(variantProps);
3764
+ return /* @__PURE__ */ jsxRuntime.jsx(StyleContext.Provider, { value: slotStyles, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...otherProps }) });
3765
+ };
3766
+ return StyledComponent;
3767
+ };
3768
+ const withProvider = (Component, slot, options) => {
3769
+ const StyledComponent = styled(
3770
+ Component,
3771
+ {},
3772
+ {
3773
+ shouldForwardProp: (prop, variantKeys) => shouldForwardProp(prop, variantKeys, options)
3774
+ }
3775
+ );
3776
+ const StyledSlotProvider = React.forwardRef((props, ref) => {
3777
+ const [variantProps, otherProps] = recipe.splitVariantProps(props);
3778
+ const slotStyles = recipe(variantProps);
3779
+ return /* @__PURE__ */ jsxRuntime.jsx(StyleContext.Provider, { value: slotStyles, children: /* @__PURE__ */ jsxRuntime.jsx(StyledComponent, { ...otherProps, ref, className: cx(slotStyles == null ? void 0 : slotStyles[slot], props.className) }) });
3780
+ });
3781
+ StyledSlotProvider.displayName = Component.displayName || Component.name;
3782
+ return StyledSlotProvider;
3783
+ };
3784
+ const withContext2 = (Component, slot) => {
3785
+ const StyledComponent = styled(Component);
3786
+ const StyledSlotComponent = React.forwardRef((props, ref) => {
3787
+ const slotStyles = React.useContext(StyleContext);
3788
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledComponent, { ...props, ref, className: cx(slotStyles == null ? void 0 : slotStyles[slot], props.className) });
3789
+ });
3790
+ StyledSlotComponent.displayName = Component.displayName || Component.name;
3791
+ return StyledSlotComponent;
3792
+ };
3793
+ return {
3794
+ withRootProvider: withRootProvider2,
3795
+ withProvider,
3796
+ withContext: withContext2
3797
+ };
3798
+ };
3799
+ const dialogRecipe = sva({
3800
+ className: "dialog",
3801
+ slots: anatomy.keys(),
3802
+ base: {
3803
+ backdrop: {
3804
+ backdropFilter: "blur(4px)",
3805
+ background: {
3806
+ _light: "white.100A",
3807
+ _dark: "black.100A"
3808
+ },
3809
+ height: "100vh",
3810
+ left: "0",
3811
+ position: "fixed",
3812
+ top: "0",
3813
+ width: "100vw",
3814
+ zIndex: "overlay",
3815
+ _open: {
3816
+ animation: "backdrop-in"
3817
+ },
3818
+ _closed: {
3819
+ animation: "backdrop-out"
3820
+ }
3821
+ },
3822
+ positioner: {
3823
+ alignItems: "center",
3824
+ display: "flex",
3825
+ justifyContent: "center",
3826
+ left: "0",
3827
+ overflow: "auto",
3828
+ position: "fixed",
3829
+ top: "0",
3830
+ width: "full",
3831
+ height: "full",
3832
+ zIndex: "modal"
3833
+ },
3834
+ content: {
3835
+ background: "white",
3836
+ borderRadius: "sm",
3837
+ boxShadow: "overlay",
3838
+ minW: "sm",
3839
+ position: "relative",
3840
+ p: "3",
3841
+ _open: {
3842
+ animation: "dialog-in"
3843
+ },
3844
+ _closed: {
3845
+ animation: "dialog-out"
3846
+ }
3847
+ },
3848
+ title: {
3849
+ textStyle: "title.lg"
3850
+ },
3851
+ description: {
3852
+ color: "content.neutral.default_inverse",
3853
+ textStyle: "body.md"
3854
+ }
3855
+ }
3856
+ });
3857
+ const { withRootProvider, withContext } = createStyleContext(dialogRecipe);
3858
+ const Root = withRootProvider(DialogRoot);
3859
+ const Backdrop = withContext(DialogBackdrop, "backdrop");
3860
+ const Trigger = withContext(DialogTrigger, "trigger");
3861
+ const Content = withContext(DialogContent, "content");
3862
+ const Title = withContext(DialogTitle, "title");
3863
+ const Description = withContext(DialogDescription, "description");
3864
+ const Positioner = withContext(DialogPositioner, "positioner");
3865
+ const Dialog = {
3866
+ Root,
3867
+ Backdrop,
3868
+ Trigger,
3869
+ Content,
3870
+ Title,
3871
+ Description,
3872
+ Positioner
3873
+ };
3874
+ const iconButtonRecipe = cva({
3875
+ base: {
3876
+ alignItems: "center",
3877
+ appearance: "none",
3878
+ cursor: "pointer",
3879
+ display: "inline-flex",
3880
+ isolation: "isolate",
3881
+ minWidth: "0",
3882
+ justifyContent: "center",
3883
+ outline: "none",
3884
+ position: "relative",
3885
+ transitionDuration: "normal",
3886
+ transitionProperty: "background, border-color, color, box-shadow",
3887
+ transitionTimingFunction: "default",
3888
+ userSelect: "none",
3889
+ verticalAlign: "middle",
3890
+ borderRadius: "full",
3891
+ color: "content.neutral.bold",
3892
+ _hidden: {
3893
+ display: "none"
3894
+ }
3895
+ },
3896
+ defaultVariants: {
3897
+ variant: "solid",
3898
+ size: "md",
3899
+ color: "neutral"
3900
+ },
3901
+ variants: {
3902
+ variant: {
3903
+ solid: {
3904
+ _disabled: {
3905
+ background: "background.neutral.disabled",
3906
+ color: "content.neutral.disabled",
3907
+ cursor: "not-allowed",
3908
+ pointerEvents: "none"
3909
+ }
3910
+ },
3911
+ outline: {
3912
+ background: "transparent",
3913
+ borderWidth: "1px",
3914
+ borderStyle: "solid",
3915
+ borderColor: "border.neutral.default",
3916
+ color: "content.neutral.bold",
3917
+ _disabled: {
3918
+ background: "transparent",
3919
+ color: "content.neutral.disabled",
3920
+ borderColor: "border.neutral.disabled",
3921
+ cursor: "not-allowed",
3922
+ pointerEvents: "none"
3923
+ },
3924
+ _hover: {
3925
+ background: "background.neutral.selected"
3926
+ }
3927
+ },
3928
+ light: {
3929
+ background: "transparent",
3930
+ color: "content.neutral.bold",
3931
+ _disabled: {
3932
+ background: "transparent",
3933
+ color: "content.neutral.disabled",
3934
+ cursor: "not-allowed",
3935
+ pointerEvents: "none"
3936
+ },
3937
+ _hover: {
3938
+ background: "background.neutral.selected"
3939
+ }
3940
+ }
3941
+ },
3942
+ color: {
3943
+ neuroid_primary: {},
3944
+ zoltarina_primary: {},
3945
+ heyd_primary: {},
3946
+ heybee_primary: {},
3947
+ neutral: {}
3948
+ },
3949
+ size: {
3950
+ sm: {
3951
+ h: 7,
3952
+ w: 7,
3953
+ p: "4px",
3954
+ "& :where(svg)": {
3955
+ width: "20px",
3956
+ height: "20px"
3957
+ }
3958
+ },
3959
+ md: {
3960
+ h: 8,
3961
+ w: 8,
3962
+ p: "4px",
3963
+ "& :where(svg)": {
3964
+ width: "24px",
3965
+ height: "24px"
3966
+ }
3967
+ },
3968
+ lg: {
3969
+ h: 10,
3970
+ w: 10,
3971
+ p: "8px",
3972
+ "& :where(svg)": {
3973
+ width: "24px",
3974
+ height: "24px"
3975
+ }
3976
+ }
3977
+ }
3978
+ },
3979
+ compoundVariants: [
3980
+ {
3981
+ variant: "solid",
3982
+ color: "neuroid_primary",
3983
+ css: {
3984
+ background: "background.neuroidPrimary.default",
3985
+ color: "content.neutral.bold",
3986
+ _hover: { background: "background.neuroidPrimary.selected" }
3987
+ }
3988
+ },
3989
+ {
3990
+ variant: "solid",
3991
+ color: "zoltarina_primary",
3992
+ css: {
3993
+ background: "background.zoltarinaPrimary.default",
3994
+ color: "content.static.black.bold",
3995
+ _hover: { background: "background.zoltarinaPrimary.selected" }
3996
+ }
3997
+ },
3998
+ {
3999
+ variant: "solid",
4000
+ color: "heyd_primary",
4001
+ css: {
4002
+ background: "background.heydPrimary.default",
4003
+ color: "content.static.black.bold",
4004
+ _hover: { background: "background.heydPrimary.selected" }
4005
+ }
4006
+ },
4007
+ {
4008
+ variant: "solid",
4009
+ color: "heybee_primary",
4010
+ css: {
4011
+ background: "background.heybeePrimary.default",
4012
+ color: "content.static.black.bold",
4013
+ _hover: { background: "background.heybeePrimary.selected" }
4014
+ }
4015
+ },
4016
+ {
4017
+ variant: "solid",
4018
+ color: "neutral",
4019
+ css: {
4020
+ background: "background.neutral.default",
4021
+ color: "content.neutral.bold",
4022
+ _hover: { background: "background.neutral.selected" }
4023
+ }
4024
+ }
4025
+ ]
4026
+ });
4027
+ const IconButton = React.forwardRef(
4028
+ ({ loading, disabled, children, color, variant, size, ...rest }, ref) => {
4029
+ const StyledButton = styled(ark.button, iconButtonRecipe);
4030
+ return /* @__PURE__ */ jsxRuntime.jsx(
4031
+ StyledButton,
4032
+ {
4033
+ disabled,
4034
+ ref,
4035
+ color,
4036
+ variant,
4037
+ size,
4038
+ pointerEvents: loading ? "none" : "auto",
4039
+ ...rest,
4040
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4041
+ /* @__PURE__ */ jsxRuntime.jsx(Center, { inline: true, position: "absolute", transform: "translate(-50%, -50%)", top: "50%", insetStart: "50%", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: size === "lg" ? "md" : "sm" }) }),
4042
+ /* @__PURE__ */ jsxRuntime.jsx(styled.span, { opacity: 0, children })
4043
+ ] }) : children
4044
+ }
4045
+ );
4046
+ }
4047
+ );
4048
+ IconButton.displayName = "IconButton";
4049
+ function definePreset(preset2) {
4050
+ return preset2;
4051
+ }
4052
+ function defineKeyframes(keyframes2) {
4053
+ return keyframes2;
4054
+ }
4055
+ function defineGlobalStyles(definition) {
4056
+ return definition;
4057
+ }
4058
+ function createProxy() {
4059
+ const identity2 = (v2) => v2;
4060
+ return new Proxy(identity2, {
4061
+ get() {
4062
+ return identity2;
4063
+ }
4064
+ });
4065
+ }
4066
+ var defineTokens = /* @__PURE__ */ createProxy();
4067
+ const globalCss = defineGlobalStyles({});
4068
+ const keyframes = defineKeyframes({
4069
+ "fade-in": {
4070
+ from: { opacity: "0" },
4071
+ to: { opacity: "1" }
4072
+ },
4073
+ "fade-out": {
4074
+ from: { opacity: "1" },
4075
+ to: { opacity: "0" }
4076
+ },
4077
+ "slide-in": {
4078
+ "0%": { opacity: "0", transform: "translateY(64px)" },
4079
+ "100%": { opacity: "1", transform: "translateY(0)" }
4080
+ },
4081
+ "slide-out": {
4082
+ "0%": { opacity: "1", transform: "translateY(0)" },
4083
+ "100%": { opacity: "0", transform: "translateY(64px)" }
4084
+ },
4085
+ "slide-in-left": {
4086
+ "0%": { transform: "translateX(-100%)" },
4087
+ "100%": { transform: "translateX(0%)" }
4088
+ },
4089
+ "slide-out-left": {
4090
+ "0%": { transform: "translateX(0%)" },
4091
+ "100%": { transform: "translateX(-100%)" }
4092
+ },
4093
+ "slide-in-right": {
4094
+ "0%": { transform: "translateX(100%)" },
4095
+ "100%": { transform: "translateX(0%)" }
4096
+ },
4097
+ "slide-out-right": {
4098
+ "0%": { transform: "translateX(0%)" },
4099
+ "100%": { transform: "translateX(100%)" }
4100
+ },
4101
+ "collapse-in": {
4102
+ "0%": { height: "0" },
4103
+ "100%": { height: "var(--height)" }
4104
+ },
4105
+ "collapse-out": {
4106
+ "0%": { height: "var(--height)" },
4107
+ "100%": { height: "0" }
4108
+ },
4109
+ fadeIn: {
4110
+ "0%": { opacity: "0", transform: "translateY(-4px)" },
4111
+ "100%": { opacity: "1", transform: "translateY(0)" }
4112
+ },
4113
+ fadeOut: {
4114
+ "0%": { opacity: "1", transform: "translateY(0)" },
4115
+ "100%": { opacity: "0", transform: "translateY(-4px)" }
4116
+ },
4117
+ "skeleton-pulse": {
4118
+ "50%": { opacity: "0.5" }
4119
+ },
4120
+ spin: {
4121
+ "0%": { transform: "rotate(0deg)" },
4122
+ "100%": { transform: "rotate(360deg)" }
4123
+ }
4124
+ });
4125
+ var m = { colors: { content: { neutral: { bold: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.1100}" } }, default: { value: { base: "{colors.neutral.300}", _dark: "{colors.neutral.1000}" } }, subtle: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.900}" } }, subtlest: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.500}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.600}" } }, default_inverse: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.500}", _dark: "{colors.purple.400}" } }, default_inverse: { value: { base: "{colors.purple.800}", _dark: "{colors.purple.800}" } } }, danger: { default: { value: { base: "{colors.red.600}", _dark: "{colors.red.400}" } } }, warning: { default: { value: { base: "{colors.orange.600}", _dark: "{colors.orange.400}" } } }, success: { default: { value: { base: "{colors.green.600}", _dark: "{colors.green.400}" } } }, informative: { default: { value: { base: "{colors.blue.600}", _dark: "{colors.blue.400}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.800}", _dark: "{colors.ohre.400}" } }, defult_inverse: { value: { base: "{colors.ohre.1000}", _dark: "{colors.ohre.1000}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.800}", _dark: "{colors.cyan.400}" } }, defult_inverse: { value: { base: "{colors.cyan.1000}", _dark: "{colors.cyan.1000}" } } }, static: { white: { bold: { value: { base: "{colors.neutral.1200}", _dark: "{colors.neutral.1200}" } }, default: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.1050}" } }, subtle: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.1000}" } }, subtlest: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.900}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.800}" } } }, black: { bold: { value: { base: "{colors.neutral.0}", _dark: "{colors.neutral.0}" } }, default: { value: { base: "{colors.neutral.200}", _dark: "{colors.neutral.200}" } }, subtle: { value: { base: "{colors.neutral.400}", _dark: "{colors.neutral.400}" } }, subtlest: { value: { base: "{colors.neutral.600}", _dark: "{colors.neutral.600}" } }, disabled: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.800}" } } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.800}", _dark: "{colors.yellow.500}" } }, default_inverse: { value: { base: "{colors.yellow.1000}", _dark: "{colors.yellow.1000}" } } } }, background: { neutral: { default: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.200}" } }, selected: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.300}" } }, disabled: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.400}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.300}", _dark: "{colors.purple.600}" } }, selected: { value: { base: "{colors.purple.400}", _dark: "{colors.purple.700}" } } }, neuroidSecondary: { default: { value: { base: "{colors.purple.200}", _dark: "{colors.purple.300}" } }, selected: { value: { base: "{colors.purple.300}", _dark: "{colors.purple.400}" } } }, danger: { default: { value: { base: "{colors.red.300}", _dark: "{colors.red.700}" } }, selected: { value: { base: "{colors.red.400}", _dark: "{colors.red.800}" } } }, warning: { default: { value: { base: "{colors.orange.300}", _dark: "{colors.orange.700}" } }, selected: { value: { base: "{colors.orange.400}", _dark: "{colors.orange.800}" } } }, success: { default: { value: { base: "{colors.green.300}", _dark: "{colors.green.700}" } }, selected: { value: { base: "{colors.green.400}", _dark: "{colors.green.800}" } } }, informative: { default: { value: { base: "{colors.blue.300}", _dark: "{colors.blue.700}" } }, selected: { value: { base: "{colors.blue.400}", _dark: "{colors.blue.800}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.400}", _dark: "{colors.ohre.400}" } }, selected: { value: { base: "{colors.ohre.500}", _dark: "{colors.ohre.500}" } } }, zoltarinaSecondary: { default: { value: { base: "{colors.ohre.200}", _dark: "{colors.ohre.200}" } }, selected: { value: { base: "{colors.ohre.300}", _dark: "{colors.ohre.300}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.500}", _dark: "{colors.cyan.500}" } }, selected: { value: { base: "{colors.cyan.600}", _dark: "{colors.cyan.600}" } } }, heydSecondary: { default: { value: { base: "{colors.cyan.200}", _dark: "{colors.cyan.200}" } }, selected: { value: { base: "{colors.cyan.300}", _dark: "{colors.cyan.300}" } } }, static: { whiteAlpha: { bold: { value: { base: "{colors.white.700A}", _dark: "{colors.white.700A}" } }, default: { value: { base: "{colors.white.500A}", _dark: "{colors.white.500A}" } }, selected: { value: { base: "{colors.white.600A}", _dark: "{colors.white.600A}" } }, disabled: { value: { base: "{colors.white.500A}", _dark: "{colors.white.500A}" } } }, blackAlpha: { bold: { value: { base: "{colors.black.700A}", _dark: "{colors.black.700A}" } }, default: { value: { base: "{colors.black.500A}", _dark: "{colors.black.500A}" } }, selected: { value: { base: "{colors.black.600A}", _dark: "{colors.black.600A}" } }, disabled: { value: { base: "{colors.black.500A}", _dark: "{colors.black.500A}" } } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.500}", _dark: "{colors.yellow.500}" } }, selected: { value: { base: "{colors.yellow.600}", _dark: "{colors.yellow.600}" } } } }, surface: { base: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.0}" } }, layer_1: { value: { base: "{colors.neutral.1100}", _dark: "{colors.neutral.100}" } }, layer_2: { value: { base: "{colors.neutral.1050}", _dark: "{colors.neutral.200}" } } }, shadow: { overlay: { value: { base: "{colors.black.100A}", _dark: "{colors.black.400A}" } }, raised: { value: { base: "{colors.black.400A}", _dark: "{colors.black.600A}" } } }, scrim: { default: { value: { base: "{colors.black.600A}", _dark: "{colors.black.600A}" } } }, skeleton: { default: { value: { base: "{colors.neutral.800}", _dark: "{colors.neutral.100}" } }, subtle: { value: { base: "{colors.neutral.700}", _dark: "{colors.neutral.200}" } } }, border: { neutral: { default: { value: { base: "{colors.neutral.700}", _dark: "{colors.neutral.400}" } }, subtle: { value: { base: "{colors.neutral.900}", _dark: "{colors.neutral.300}" } }, disabled: { value: { base: "{colors.neutral.1000}", _dark: "{colors.neutral.200}" } } }, neuroidPrimary: { default: { value: { base: "{colors.purple.500}", _dark: "{colors.purple.400}" } } }, danger: { default: { value: { base: "{colors.red.500}", _dark: "{colors.red.400}" } } }, warning: { default: { value: { base: "{colors.orange.500}", _dark: "{colors.orange.400}" } } }, success: { default: { value: { base: "{colors.green.500}", _dark: "{colors.green.400}" } } }, informative: { default: { value: { base: "{colors.blue.500}", _dark: "{colors.blue.400}" } } }, zoltarinaPrimary: { default: { value: { base: "{colors.ohre.800}", _dark: "{colors.ohre.400}" } } }, heydPrimary: { default: { value: { base: "{colors.cyan.800}", _dark: "{colors.cyan.400}" } } }, heybeePrimary: { default: { value: { base: "{colors.yellow.800}", _dark: "{colors.yellow.500}" } } } } }, shadows: { raised: { value: "0px 1px 3px 0px {colors.shadow.raised}" }, overlay: { value: "0px 20px 25px -5px {colors.shadow.overlay}" } } }, v = { colors: { neutral: { 0: { value: "#080A0E" }, 100: { value: "#101216" }, 200: { value: "#181A1E" }, 300: { value: "#282A2E" }, 400: { value: "#383A3E" }, 500: { value: "#505256" }, 600: { value: "#64666A" }, 700: { value: "#787A7E" }, 800: { value: "#A0A2A6" }, 900: { value: "#B4B6BA" }, 1e3: { value: "#F2F4F8" }, 1050: { value: "#EDEEF1" }, 1100: { value: "#FAFCFF" }, 1200: { value: "#F8F9FF" } }, black: { "700A": { value: "rgba(0,0,0,0.8)" }, "600A": { value: "rgba(0,0,0,0.6)" }, "500A": { value: "rgba(0,0,0,0.4)" }, "400A": { value: "rgba(0,0,0,0.32)" }, "300A": { value: "rgba(0,0,0,0.2)" }, "200A": { value: "rgba(0,0,0,0.12)" }, "100A": { value: "rgba(0,0,0,0.08)" } }, white: { "700A": { value: "rgba(255,255,255,0.8)" }, "600A": { value: "rgba(255,255,255,0.6)" }, "500A": { value: "rgba(255,255,255,0.4)" }, "400A": { value: "rgba(255,255,255,0.32)" }, "300A": { value: "rgba(255,255,255,0.2)" }, "200A": { value: "rgba(255,255,255,0.12)" }, "100A": { value: "rgba(255,255,255,0.08)" } }, red: { 100: { value: "#ffeceb" }, 200: { value: "#ffd5d2" }, 300: { value: "#fd9891" }, 400: { value: "#f87168" }, 500: { value: "#f15b50" }, 600: { value: "#e2483d" }, 700: { value: "#c9372c" }, 800: { value: "#87241c" }, 900: { value: "#5d1f1a" }, 1e3: { value: "#42221f" } }, orange: { 100: { value: "#fff5eb" }, 200: { value: "#ffe9d2" }, 300: { value: "#fdc991" }, 400: { value: "#f8b268" }, 500: { value: "#f1a350" }, 600: { value: "#e2923d" }, 700: { value: "#c97d2c" }, 800: { value: "#87531c" }, 900: { value: "#5d3d1a" }, 1e3: { value: "#42311f" } }, blue: { 100: { value: "#ebf2ff" }, 200: { value: "#d2e1ff" }, 300: { value: "#91b5fd" }, 400: { value: "#6898f8" }, 500: { value: "#5086f1" }, 600: { value: "#3d74e2" }, 700: { value: "#2c60c9" }, 800: { value: "#1c4087" }, 900: { value: "#1a305d" }, 1e3: { value: "#1f2b42" } }, green: { 100: { value: "#ebfff5" }, 200: { value: "#9cfccc" }, 300: { value: "#47EB99" }, 400: { value: "#26d980" }, 500: { value: "#14b866" }, 600: { value: "#10934c" }, 700: { value: "#147042" }, 800: { value: "#125433" }, 900: { value: "#104129" }, 1e3: { value: "#0b2819" } }, purple: { 100: { value: "#f3ebff" }, 200: { value: "#e9ddfd" }, 300: { value: "#cbacfb" }, 400: { value: "#ac7cf8" }, 500: { value: "#8d4bf6" }, 600: { value: "#6d19f5" }, 700: { value: "#570ad1" }, 800: { value: "#4308a0" }, 900: { value: "#2f0670" }, 1e3: { value: "#1a033f" } }, ohre: { 100: { value: "#FFF8F1" }, 200: { value: "#FFE6C8" }, 300: { value: "#FFD3A0" }, 400: { value: "#FFC077" }, 500: { value: "#E2A763" }, 600: { value: "#C58F50" }, 700: { value: "#A8773F" }, 800: { value: "#8A6030" }, 900: { value: "#6D4B22" }, 1e3: { value: "#503617" } }, cyan: { 100: { value: "#ecffff" }, 200: { value: "#c1feff" }, 300: { value: "#96feff" }, 400: { value: "#6bfdff" }, 500: { value: "#3df1f3" }, 600: { value: "#2acfd1" }, 700: { value: "#1aadaf" }, 800: { value: "#0e8c8d" }, 900: { value: "#056a6b" }, 1e3: { value: "#004849" } }, yellow: { 100: { value: "#FFFBED" }, 200: { value: "#FFF3C5" }, 300: { value: "#FFEB9D" }, 400: { value: "#FFE375" }, 500: { value: "#FFDB4D" }, 600: { value: "#DDBC38" }, 700: { value: "#BB9D27" }, 800: { value: "#997F19" }, 900: { value: "#77620E" }, 1e3: { value: "#554506" } } }, borderWidths: { none: { value: "0px" }, sm: { value: "1px" }, md: { value: "2px" }, lg: { value: "4px" } }, spacing: { 0: { value: "0rem" }, 1: { value: "0.25rem" }, 2: { value: "0.5rem" }, 3: { value: "0.75rem" }, 4: { value: "1rem" }, 6: { value: "1.5rem" }, 8: { value: "2rem" }, 12: { value: "3rem" }, 20: { value: "5rem" }, 30: { value: "7.5rem" }, 56: { value: "14rem" }, 72: { value: "18rem" }, 98: { value: "24rem" }, 128: { value: "32rem" }, 160: { value: "40rem" } }, radii: { none: { value: "0px" }, xs: { value: "2px" }, sm: { value: "4px" }, md: { value: "8px" }, lg: { value: "16px" }, full: { value: "9999px" } }, fontSizes: { xs: { value: "0.75rem" }, sm: { value: "0.875rem" }, md: { value: "1rem" }, lg: { value: "1.25rem" }, xl: { value: "1.5rem" }, "2xl": { value: "2rem" }, "3xl": { value: "2.5rem" }, "4xl": { value: "3rem" } }, letterSpacings: { xs: { value: "-1.5px" }, sm: { value: "-1.2px" }, md: { value: "-1px" }, lg: { value: "-0.8px" }, xl: { value: "-0.6px" }, "2xl": { value: "-0.4px" }, "3xl": { value: "-0.2px" } }, lineHeights: { md: { value: "1rem" }, lg: { value: "1.25rem" }, xl: { value: "1.5rem" }, "2xl": { value: "1.75rem" }, "3xl": { value: "2.25rem" }, "4xl": { value: "2.75rem" }, "5xl": { value: "3rem" } }, fontWeights: { regular: { value: "400" }, medium: { value: "500" }, semibold: { value: "600" }, bold: { value: "700" }, regularItalic: { value: "Italic" }, mediumItalic: { value: "Medium Italic" } }, fonts: { inter: { value: "Inter" }, notoSans: { value: "Noto Sans" } } }, $ = { body: { md: { value: { fontFamily: "notoSans", fontWeight: "regular", fontSize: "sm", lineHeight: "lg", letterSpacing: "3xl" } }, lg: { value: { fontFamily: "notoSans", fontWeight: "regular", fontSize: "md", lineHeight: "xl", letterSpacing: "3xl" } }, sm: { value: { fontSize: "xs", fontWeight: "regular", fontFamily: "notoSans", lineHeight: "md", letterSpacing: "3xl" } } }, label: { sm: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "xs", lineHeight: "md", letterSpacing: "3xl" } }, md: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "sm", lineHeight: "lg", letterSpacing: "3xl" } } }, title: { sm: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "sm", lineHeight: "lg", letterSpacing: "2xl" } }, md: { value: { fontFamily: "notoSans", fontWeight: "medium", fontSize: "md", lineHeight: "xl", letterSpacing: "xl" } }, lg: { value: { fontFamily: "notoSans", fontWeight: "semibold", fontSize: "lg", lineHeight: "2xl", letterSpacing: "xl" } } }, headline: { sm: { value: { fontFamily: "inter", fontWeight: "semibold", fontSize: "xl", lineHeight: "2xl", letterSpacing: "lg" } }, md: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "2xl", lineHeight: "3xl", letterSpacing: "md" } } }, display: { md: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "3xl", lineHeight: "4xl", letterSpacing: "sm" } }, lg: { value: { fontFamily: "inter", fontWeight: "bold", fontSize: "4xl", lineHeight: "5xl", letterSpacing: "xs" } } } }, g = { semantic: m, primitive: v, textStyles: $ };
4126
+ const conditions = {
4127
+ extend: {
4128
+ collapsed: '&:is([aria-collapsed=true], [data-collapsed], [data-state="collapsed"])',
4129
+ current: "&:is([data-current])",
4130
+ hidden: "&:is([hidden])",
4131
+ hover: ["@media (hover: hover) and (pointer: fine)", "&:is(:hover, [data-hover])"],
4132
+ indeterminate: "&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed], [data-state=indeterminate])",
4133
+ off: '&:is([data-state="off"])',
4134
+ on: '&:is([data-state="on"])',
4135
+ today: "&:is([data-today])",
4136
+ underValue: '&:is([data-state="under-value"])',
4137
+ dark: ".dark &",
4138
+ light: ":root &, .light &",
4139
+ invalid: "&:is([aria-invalid])"
4140
+ }
4141
+ };
4142
+ const breakpoints = {
4143
+ sm: "640px",
4144
+ md: "768px",
4145
+ lg: "1024px",
4146
+ xl: "1280px",
4147
+ "2xl": "1536px"
4148
+ };
4149
+ const animations = defineTokens.animations({
4150
+ "backdrop-in": {
4151
+ value: "fade-in 250ms {easings.emphasized-in}"
4152
+ },
4153
+ "backdrop-out": {
4154
+ value: "fade-out 200ms {easings.emphasized-out}"
4155
+ },
4156
+ "dialog-in": {
4157
+ value: "slide-in 400ms {easings.emphasized-in}"
4158
+ },
4159
+ "dialog-out": {
4160
+ value: "slide-out 200ms {easings.emphasized-out}"
4161
+ },
4162
+ "drawer-in-left": {
4163
+ value: "slide-in-left 400ms {easings.emphasized-in}"
4164
+ },
4165
+ "drawer-out-left": {
4166
+ value: "slide-out-left 200ms {easings.emphasized-out}"
4167
+ },
4168
+ "drawer-in-right": {
4169
+ value: "slide-in-right 400ms {easings.emphasized-in}"
4170
+ },
4171
+ "drawer-out-right": {
4172
+ value: "slide-out-right 200ms {easings.emphasized-out}"
4173
+ },
4174
+ "skeleton-pulse": {
4175
+ value: "skeleton-pulse 2s {easings.pulse} infinite"
4176
+ },
4177
+ "fade-in": {
4178
+ value: "fade-in 400ms {easings.emphasized-in}"
4179
+ },
4180
+ "collapse-in": {
4181
+ value: "collapse-in 250ms {easings.emphasized-in}"
4182
+ },
4183
+ "collapse-out": {
4184
+ value: "collapse-out 200ms {easings.emphasized-out}"
4185
+ },
4186
+ spin: {
4187
+ value: "spin 1s linear infinite"
4188
+ }
4189
+ });
4190
+ const blurs = defineTokens.blurs({
4191
+ sm: { value: "4px" },
4192
+ base: { value: "8px" },
4193
+ md: { value: "12px" },
4194
+ lg: { value: "16px" },
4195
+ xl: { value: "24px" },
4196
+ "2xl": { value: "40px" },
4197
+ "3xl": { value: "64px" }
4198
+ });
4199
+ const borders = {
4200
+ none: { value: "none" }
4201
+ };
4202
+ const durations = defineTokens.durations({
4203
+ fastest: { value: "50ms" },
4204
+ faster: { value: "100ms" },
4205
+ fast: { value: "150ms" },
4206
+ normal: { value: "200ms" },
4207
+ slow: { value: "300ms" },
4208
+ slower: { value: "400ms" },
4209
+ slowest: { value: "500ms" }
4210
+ });
4211
+ const easings = defineTokens.easings({
4212
+ pulse: { value: "cubic-bezier(0.4, 0.0, 0.6, 1.0)" },
4213
+ default: { value: "cubic-bezier(0.2, 0.0, 0, 1.0)" },
4214
+ "emphasized-in": { value: "cubic-bezier(0.05, 0.7, 0.1, 1.0)" },
4215
+ "emphasized-out": { value: "cubic-bezier(0.3, 0.0, 0.8, 0.15)" }
4216
+ });
4217
+ const spacing = defineTokens.spacing({
4218
+ 0: { value: "0rem" },
4219
+ 0.5: { value: "0.125rem" },
4220
+ 1: { value: "0.25rem" },
4221
+ 1.5: { value: "0.375rem" },
4222
+ 2: { value: "0.5rem" },
4223
+ 2.5: { value: "0.625rem" },
4224
+ 3: { value: "0.75rem" },
4225
+ 3.5: { value: "0.875rem" },
4226
+ 4: { value: "1rem" },
4227
+ 4.5: { value: "1.125rem" },
4228
+ 5: { value: "1.25rem" },
4229
+ 6: { value: "1.5rem" },
4230
+ 7: { value: "1.75rem" },
4231
+ 8: { value: "2rem" },
4232
+ 9: { value: "2.25rem" },
4233
+ 10: { value: "2.5rem" },
4234
+ 11: { value: "2.75rem" },
4235
+ 12: { value: "3rem" },
4236
+ 14: { value: "3.5rem" },
4237
+ 16: { value: "4rem" },
4238
+ 20: { value: "5rem" },
4239
+ 24: { value: "6rem" },
4240
+ 28: { value: "7rem" },
4241
+ 32: { value: "8rem" },
4242
+ 36: { value: "9rem" },
4243
+ 40: { value: "10rem" },
4244
+ 44: { value: "11rem" },
4245
+ 48: { value: "12rem" },
4246
+ 52: { value: "13rem" },
4247
+ 56: { value: "14rem" },
4248
+ 60: { value: "15rem" },
4249
+ 64: { value: "16rem" },
4250
+ 72: { value: "18rem" },
4251
+ 80: { value: "20rem" },
4252
+ 96: { value: "24rem" }
4253
+ });
4254
+ const largeSizes = {
4255
+ "2xs": { value: "16rem" },
4256
+ xs: { value: "20rem" },
4257
+ sm: { value: "24rem" },
4258
+ md: { value: "28rem" },
4259
+ lg: { value: "32rem" },
4260
+ xl: { value: "36rem" },
4261
+ "2xl": { value: "42rem" },
4262
+ "3xl": { value: "48rem" },
4263
+ "4xl": { value: "56rem" },
4264
+ "5xl": { value: "64rem" },
4265
+ "6xl": { value: "72rem" },
4266
+ "7xl": { value: "80rem" },
4267
+ "8xl": { value: "90rem" }
4268
+ };
4269
+ const sizes = {
4270
+ ...spacing,
4271
+ ...largeSizes,
4272
+ full: { value: "100%" },
4273
+ min: { value: "min-content" },
4274
+ max: { value: "max-content" },
4275
+ fit: { value: "fit-content" }
4276
+ };
4277
+ const zIndex = defineTokens.zIndex({
4278
+ hide: {
4279
+ value: -1
4280
+ },
4281
+ base: {
4282
+ value: 0
4283
+ },
4284
+ docked: {
4285
+ value: 10
4286
+ },
4287
+ dropdown: {
4288
+ value: 1e3
4289
+ },
4290
+ sticky: {
4291
+ value: 1100
4292
+ },
4293
+ banner: {
4294
+ value: 1200
4295
+ },
4296
+ overlay: {
4297
+ value: 1300
4298
+ },
4299
+ modal: {
4300
+ value: 1400
4301
+ },
4302
+ popover: {
4303
+ value: 1500
4304
+ },
4305
+ skipLink: {
4306
+ value: 1600
4307
+ },
4308
+ toast: {
4309
+ value: 1700
4310
+ },
4311
+ tooltip: {
4312
+ value: 1800
4313
+ }
4314
+ });
4315
+ const tokens = defineTokens({
4316
+ animations,
4317
+ blurs,
4318
+ borders,
4319
+ // colors,
4320
+ durations,
4321
+ easings,
4322
+ // fonts,
4323
+ // fontSizes,
4324
+ // fontWeights,
4325
+ // letterSpacings,
4326
+ // lineHeights,
4327
+ // radii,
4328
+ sizes,
4329
+ // spacing,
4330
+ zIndex,
4331
+ ...g.primitive
4332
+ });
4333
+ const preset = definePreset({
4334
+ name: "@nation-a/theme",
4335
+ conditions,
4336
+ globalCss: {
4337
+ ...globalCss
4338
+ },
4339
+ theme: {
4340
+ extend: {
4341
+ breakpoints,
4342
+ keyframes,
4343
+ tokens,
4344
+ semanticTokens: g.semantic,
4345
+ textStyles: g.textStyles
4346
+ }
4347
+ }
4348
+ });
4349
+ exports.Button = Button;
4350
+ exports.Dialog = Dialog;
4351
+ exports.IconButton = IconButton;
4352
+ exports.Portal = Portal;
4353
+ exports.Spinner = Spinner;
4354
+ exports.Text = Text;
4355
+ exports.preset = preset;
4356
+ //# sourceMappingURL=index.cjs.map