@saas-ui/react 2.11.2 → 3.0.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (343) hide show
  1. package/CHANGELOG.md +13 -148
  2. package/dist/chunk-32JGENDB.js +19 -0
  3. package/dist/chunk-FZW2DYK3.js +19 -0
  4. package/dist/chunk-KHRLZUV4.js +35 -0
  5. package/dist/chunk-KTLWEUNW.js +1 -0
  6. package/dist/chunk-PKI6YH2V.js +31 -0
  7. package/dist/chunk-RTMS5TJN.js +10 -0
  8. package/dist/chunk-VBIVLREP.js +45 -0
  9. package/dist/chunk-VDXTEASE.js +117 -0
  10. package/dist/components/app-shell/index.cjs +68 -0
  11. package/dist/components/app-shell/index.d.cts +30 -0
  12. package/dist/components/app-shell/index.d.ts +30 -0
  13. package/dist/components/app-shell/index.js +45 -0
  14. package/dist/components/breadcrumbs/index.cjs +60 -0
  15. package/dist/components/breadcrumbs/index.d.cts +18 -0
  16. package/dist/components/breadcrumbs/index.d.ts +18 -0
  17. package/dist/components/breadcrumbs/index.js +37 -0
  18. package/dist/components/button/index.cjs +65 -0
  19. package/dist/components/button/index.d.cts +12 -0
  20. package/dist/components/button/index.d.ts +12 -0
  21. package/dist/components/button/index.js +45 -0
  22. package/dist/components/checkbox/index.cjs +45 -0
  23. package/dist/components/checkbox/index.d.cts +11 -0
  24. package/dist/components/checkbox/index.d.ts +11 -0
  25. package/dist/components/checkbox/index.js +20 -0
  26. package/dist/components/close-button/index.cjs +142 -0
  27. package/dist/components/close-button/index.d.cts +8 -0
  28. package/dist/components/close-button/index.d.ts +8 -0
  29. package/dist/components/close-button/index.js +9 -0
  30. package/dist/components/command/index.cjs +56 -0
  31. package/dist/components/command/index.d.cts +6 -0
  32. package/dist/components/command/index.d.ts +6 -0
  33. package/dist/components/command/index.js +33 -0
  34. package/dist/components/dialog/index.cjs +243 -0
  35. package/dist/components/dialog/index.d.cts +27 -0
  36. package/dist/components/dialog/index.d.ts +27 -0
  37. package/dist/components/dialog/index.js +73 -0
  38. package/dist/components/drawer/index.cjs +237 -0
  39. package/dist/components/drawer/index.d.cts +28 -0
  40. package/dist/components/drawer/index.d.ts +28 -0
  41. package/dist/components/drawer/index.js +65 -0
  42. package/dist/components/icon-badge/index.cjs +70 -0
  43. package/dist/components/icon-badge/index.d.cts +16 -0
  44. package/dist/components/icon-badge/index.d.ts +16 -0
  45. package/dist/components/icon-badge/index.js +38 -0
  46. package/dist/components/icons/index.cjs +155 -0
  47. package/dist/components/icons/index.d.cts +19 -0
  48. package/dist/components/icons/index.d.ts +19 -0
  49. package/dist/components/icons/index.js +35 -0
  50. package/dist/components/input-group/index.cjs +56 -0
  51. package/dist/components/input-group/index.d.cts +13 -0
  52. package/dist/components/input-group/index.d.ts +13 -0
  53. package/dist/components/input-group/index.js +8 -0
  54. package/dist/components/link/index.cjs +71 -0
  55. package/dist/components/link/index.d.cts +13 -0
  56. package/dist/components/link/index.d.ts +13 -0
  57. package/dist/components/link/index.js +20 -0
  58. package/dist/components/loading-overlay/index.cjs +1921 -0
  59. package/dist/components/loading-overlay/index.d.cts +13 -0
  60. package/dist/components/loading-overlay/index.d.ts +13 -0
  61. package/dist/components/loading-overlay/index.js +1878 -0
  62. package/dist/components/navbar/index.cjs +65 -0
  63. package/dist/components/navbar/index.d.cts +18 -0
  64. package/dist/components/navbar/index.d.ts +18 -0
  65. package/dist/components/navbar/index.js +42 -0
  66. package/dist/components/number-input/index.cjs +82 -0
  67. package/dist/components/number-input/index.d.cts +13 -0
  68. package/dist/components/number-input/index.d.ts +13 -0
  69. package/dist/components/number-input/index.js +32 -0
  70. package/dist/components/password-input/index.cjs +284 -0
  71. package/dist/components/password-input/index.d.cts +18 -0
  72. package/dist/components/password-input/index.d.ts +18 -0
  73. package/dist/components/password-input/index.js +231 -0
  74. package/dist/components/persona/index.cjs +181 -0
  75. package/dist/components/persona/index.d.cts +93 -0
  76. package/dist/components/persona/index.d.ts +93 -0
  77. package/dist/components/persona/index.js +149 -0
  78. package/dist/components/pin-input/index.cjs +51 -0
  79. package/dist/components/pin-input/index.d.cts +12 -0
  80. package/dist/components/pin-input/index.d.ts +12 -0
  81. package/dist/components/pin-input/index.js +26 -0
  82. package/dist/components/radio/index.cjs +48 -0
  83. package/dist/components/radio/index.d.cts +12 -0
  84. package/dist/components/radio/index.d.ts +12 -0
  85. package/dist/components/radio/index.js +22 -0
  86. package/dist/components/search-input/index.cjs +244 -0
  87. package/dist/components/search-input/index.d.cts +15 -0
  88. package/dist/components/search-input/index.d.ts +15 -0
  89. package/dist/components/search-input/index.js +120 -0
  90. package/dist/components/select/index.cjs +233 -0
  91. package/dist/components/select/index.d.cts +32 -0
  92. package/dist/components/select/index.d.ts +32 -0
  93. package/dist/components/select/index.js +100 -0
  94. package/dist/components/sidebar/index.cjs +134 -0
  95. package/dist/components/sidebar/index.d.cts +85 -0
  96. package/dist/components/sidebar/index.d.ts +85 -0
  97. package/dist/components/sidebar/index.js +108 -0
  98. package/dist/components/spinner/index.cjs +44 -0
  99. package/dist/components/spinner/index.d.cts +10 -0
  100. package/dist/components/spinner/index.d.ts +10 -0
  101. package/dist/components/spinner/index.js +8 -0
  102. package/dist/components/steps/index.cjs +191 -0
  103. package/dist/components/steps/index.d.cts +31 -0
  104. package/dist/components/steps/index.d.ts +31 -0
  105. package/dist/components/steps/index.js +71 -0
  106. package/dist/components/switch/index.cjs +48 -0
  107. package/dist/components/switch/index.d.cts +18 -0
  108. package/dist/components/switch/index.d.ts +18 -0
  109. package/dist/components/switch/index.js +23 -0
  110. package/dist/index.cjs +8460 -0
  111. package/dist/index.d.cts +26 -0
  112. package/dist/index.d.ts +25 -7
  113. package/dist/index.js +8395 -36
  114. package/package.json +26 -22
  115. package/src/components/app-shell/app-shell.recipe.ts +52 -0
  116. package/src/components/app-shell/app-shell.stories.tsx +51 -0
  117. package/src/components/app-shell/app-shell.tsx +94 -0
  118. package/src/components/app-shell/index.ts +3 -0
  119. package/src/components/breadcrumbs/breadcrumb.stories.tsx +17 -0
  120. package/src/components/breadcrumbs/breadcrumb.tsx +36 -0
  121. package/src/components/breadcrumbs/index.ts +1 -0
  122. package/src/components/breadcrumbs/namespace.ts +8 -0
  123. package/src/components/button/button.recipe.ts +182 -0
  124. package/src/components/button/button.stories.tsx +99 -0
  125. package/src/components/button/button.tsx +55 -0
  126. package/src/components/button/index.ts +2 -0
  127. package/src/components/checkbox/checkbox.tsx +26 -0
  128. package/src/components/checkbox/index.ts +2 -0
  129. package/src/components/close-button/close-button.stories.tsx +12 -0
  130. package/src/components/close-button/close-button.tsx +18 -0
  131. package/src/components/close-button/index.ts +2 -0
  132. package/src/components/command/command.recipe.ts +17 -0
  133. package/src/components/command/command.stories.tsx +47 -0
  134. package/src/components/command/command.tsx +50 -0
  135. package/src/components/command/index.ts +1 -0
  136. package/src/components/dialog/dialog.tsx +67 -0
  137. package/src/components/dialog/index.ts +1 -0
  138. package/src/components/dialog/namespace.ts +18 -0
  139. package/src/components/drawer/drawer.tsx +57 -0
  140. package/src/components/drawer/index.ts +3 -0
  141. package/src/components/drawer/namespace.ts +19 -0
  142. package/src/components/grid-list/grid-list.recipe.ts +113 -0
  143. package/src/components/icon-badge/icon-badge.recipe.ts +57 -0
  144. package/src/components/icon-badge/icon-badge.stories.tsx +38 -0
  145. package/src/components/icon-badge/icon-badge.tsx +59 -0
  146. package/src/components/icon-badge/index.ts +2 -0
  147. package/src/components/icons/create-icon.tsx +41 -0
  148. package/src/components/icons/icons.tsx +119 -0
  149. package/src/components/icons/index.ts +1 -0
  150. package/src/components/input-group/index.ts +1 -0
  151. package/src/components/input-group/input-group.tsx +46 -0
  152. package/src/components/link/index.ts +2 -0
  153. package/src/components/link/link.stories.tsx +17 -0
  154. package/src/components/link/link.test.tsx +33 -0
  155. package/src/components/link/link.tsx +27 -0
  156. package/src/components/loading-overlay/index.ts +1 -0
  157. package/src/components/loading-overlay/loading-overlay.recipe.ts +61 -0
  158. package/src/components/loading-overlay/loading-overlay.stories.tsx +68 -0
  159. package/src/components/loading-overlay/loading-overlay.tsx +54 -0
  160. package/src/components/loading-overlay/namespace.ts +7 -0
  161. package/src/components/navbar/index.ts +1 -0
  162. package/src/components/navbar/namespace.ts +9 -0
  163. package/src/components/navbar/navbar.recipe.ts +109 -0
  164. package/src/components/navbar/navbar.stories.tsx +435 -0
  165. package/src/components/navbar/navbar.test.tsx +49 -0
  166. package/src/components/navbar/navbar.tsx +39 -0
  167. package/src/components/number-input/index.ts +2 -0
  168. package/src/components/number-input/number-input.tsx +41 -0
  169. package/src/components/password-input/index.ts +2 -0
  170. package/src/components/password-input/password-input.tsx +93 -0
  171. package/src/components/persona/index.ts +2 -0
  172. package/src/components/persona/namespace.ts +18 -0
  173. package/src/components/persona/persona-primitive.tsx +220 -0
  174. package/src/components/persona/persona.recipe.ts +94 -0
  175. package/src/components/persona/persona.stories.tsx +101 -0
  176. package/src/components/persona/persona.tsx +142 -0
  177. package/src/components/pin-input/index.ts +2 -0
  178. package/src/components/pin-input/pin-input.tsx +36 -0
  179. package/src/components/radio/index.ts +2 -0
  180. package/src/components/radio/radio.tsx +27 -0
  181. package/src/components/search-input/index.ts +2 -0
  182. package/src/components/search-input/search-input.stories.tsx +63 -0
  183. package/src/components/search-input/search-input.tsx +134 -0
  184. package/src/components/select/index.ts +1 -0
  185. package/src/components/select/namespace.ts +18 -0
  186. package/src/components/select/select.tsx +135 -0
  187. package/src/components/sidebar/index.ts +7 -0
  188. package/src/components/sidebar/namespace.ts +27 -0
  189. package/src/components/sidebar/sidebar-item.recipe.ts +65 -0
  190. package/src/components/sidebar/sidebar.recipe.ts +237 -0
  191. package/src/components/sidebar/sidebar.stories.tsx +903 -0
  192. package/src/components/sidebar/sidebar.tsx +208 -0
  193. package/src/components/spinner/index.ts +2 -0
  194. package/src/components/spinner/spinner.stories.tsx +19 -0
  195. package/src/components/spinner/spinner.tsx +21 -0
  196. package/src/components/steps/index.ts +1 -0
  197. package/src/components/steps/namespace.ts +16 -0
  198. package/src/components/steps/steps.tsx +82 -0
  199. package/src/components/switch/index.ts +3 -0
  200. package/src/components/switch/switch.tsx +39 -0
  201. package/src/compositions/accordion.tsx +47 -0
  202. package/src/compositions/action-bar.tsx +40 -0
  203. package/src/compositions/alert.tsx +51 -0
  204. package/src/compositions/avatar.tsx +74 -0
  205. package/src/compositions/blockquote.tsx +31 -0
  206. package/src/compositions/checkbox-card.tsx +57 -0
  207. package/src/compositions/checkbox.tsx +25 -0
  208. package/src/compositions/clipboard.tsx +107 -0
  209. package/src/compositions/color-mode.tsx +65 -0
  210. package/src/compositions/data-list.tsx +37 -0
  211. package/src/compositions/empty-state.tsx +34 -0
  212. package/src/compositions/field.tsx +33 -0
  213. package/src/compositions/file-button.tsx +166 -0
  214. package/src/compositions/hover-card.tsx +35 -0
  215. package/src/compositions/link-button.tsx +12 -0
  216. package/src/compositions/menu.tsx +108 -0
  217. package/src/compositions/native-select.tsx +57 -0
  218. package/src/compositions/pagination.tsx +207 -0
  219. package/src/compositions/popover.tsx +58 -0
  220. package/src/compositions/progress-circle.tsx +37 -0
  221. package/src/compositions/progress.tsx +40 -0
  222. package/src/compositions/prose.tsx +264 -0
  223. package/src/compositions/provider.tsx +12 -0
  224. package/src/compositions/radio-card.tsx +57 -0
  225. package/src/compositions/radio.tsx +24 -0
  226. package/src/compositions/rating.tsx +27 -0
  227. package/src/compositions/segmented-control.tsx +47 -0
  228. package/src/compositions/skeleton.tsx +44 -0
  229. package/src/compositions/slider.tsx +53 -0
  230. package/src/compositions/stat.tsx +75 -0
  231. package/src/compositions/status.tsx +29 -0
  232. package/src/compositions/stepper-input.tsx +49 -0
  233. package/src/compositions/tag.tsx +39 -0
  234. package/src/compositions/timeline.tsx +17 -0
  235. package/src/compositions/toaster.tsx +43 -0
  236. package/src/compositions/toggle-tip.tsx +62 -0
  237. package/src/compositions/tooltip.tsx +46 -0
  238. package/src/index.ts +6 -7
  239. package/src/preset.ts +9 -0
  240. package/src/provider/index.ts +4 -0
  241. package/src/provider/sui-provider.tsx +34 -0
  242. package/src/provider/use-link.test.tsx +60 -0
  243. package/src/provider/use-link.tsx +13 -0
  244. package/src/styled-system/create-recipe-context.tsx +91 -0
  245. package/src/styled-system/create-slot-recipe-context.tsx +188 -0
  246. package/src/styled-system/empty.ts +7 -0
  247. package/src/styled-system/factory.types.ts +11 -0
  248. package/src/theme/animation-styles.ts +53 -0
  249. package/src/theme/breakpoints.ts +11 -0
  250. package/src/theme/conditions.ts +26 -0
  251. package/src/theme/fluid-font-sizes.ts +65 -0
  252. package/src/theme/global-css.ts +94 -0
  253. package/src/theme/index.ts +72 -0
  254. package/src/theme/layer-styles.ts +116 -0
  255. package/src/theme/recipes/chakra/accordion.ts +145 -0
  256. package/src/theme/recipes/chakra/action-bar.ts +62 -0
  257. package/src/theme/recipes/chakra/alert.ts +157 -0
  258. package/src/theme/recipes/chakra/avatar.ts +141 -0
  259. package/src/theme/recipes/chakra/badge.ts +67 -0
  260. package/src/theme/recipes/chakra/blockquote.ts +83 -0
  261. package/src/theme/recipes/chakra/breadcrumb.ts +94 -0
  262. package/src/theme/recipes/chakra/card.ts +99 -0
  263. package/src/theme/recipes/chakra/checkbox-card.ts +212 -0
  264. package/src/theme/recipes/chakra/checkbox.ts +70 -0
  265. package/src/theme/recipes/chakra/checkmark.ts +83 -0
  266. package/src/theme/recipes/chakra/code.ts +17 -0
  267. package/src/theme/recipes/chakra/collapsible.ts +20 -0
  268. package/src/theme/recipes/chakra/container.ts +26 -0
  269. package/src/theme/recipes/chakra/data-list.ts +80 -0
  270. package/src/theme/recipes/chakra/dialog.ts +225 -0
  271. package/src/theme/recipes/chakra/drawer.ts +201 -0
  272. package/src/theme/recipes/chakra/editable.ts +88 -0
  273. package/src/theme/recipes/chakra/empty-state.ts +88 -0
  274. package/src/theme/recipes/chakra/field.ts +68 -0
  275. package/src/theme/recipes/chakra/fieldset.ts +62 -0
  276. package/src/theme/recipes/chakra/file-upload.ts +96 -0
  277. package/src/theme/recipes/chakra/heading.ts +27 -0
  278. package/src/theme/recipes/chakra/hover-card.ts +68 -0
  279. package/src/theme/recipes/chakra/icon.ts +30 -0
  280. package/src/theme/recipes/chakra/input-addon.ts +40 -0
  281. package/src/theme/recipes/chakra/input.ts +96 -0
  282. package/src/theme/recipes/chakra/kbd.ts +60 -0
  283. package/src/theme/recipes/chakra/link.ts +37 -0
  284. package/src/theme/recipes/chakra/list.ts +67 -0
  285. package/src/theme/recipes/chakra/mark.ts +27 -0
  286. package/src/theme/recipes/chakra/menu.ts +124 -0
  287. package/src/theme/recipes/chakra/native-select.ts +140 -0
  288. package/src/theme/recipes/chakra/number-input.ts +115 -0
  289. package/src/theme/recipes/chakra/pin-input.ts +27 -0
  290. package/src/theme/recipes/chakra/popover.ts +86 -0
  291. package/src/theme/recipes/chakra/progress-circle.ts +94 -0
  292. package/src/theme/recipes/chakra/progress.ts +127 -0
  293. package/src/theme/recipes/chakra/radio-card.ts +220 -0
  294. package/src/theme/recipes/chakra/radio-group.ts +72 -0
  295. package/src/theme/recipes/chakra/radiomark.ts +107 -0
  296. package/src/theme/recipes/chakra/rating-group.ts +94 -0
  297. package/src/theme/recipes/chakra/segment-group.ts +117 -0
  298. package/src/theme/recipes/chakra/select.ts +282 -0
  299. package/src/theme/recipes/chakra/separator.ts +51 -0
  300. package/src/theme/recipes/chakra/skeleton.ts +53 -0
  301. package/src/theme/recipes/chakra/skip-nav-link.ts +34 -0
  302. package/src/theme/recipes/chakra/slider.ts +178 -0
  303. package/src/theme/recipes/chakra/spinner.ts +32 -0
  304. package/src/theme/recipes/chakra/stat.ts +79 -0
  305. package/src/theme/recipes/chakra/status.ts +48 -0
  306. package/src/theme/recipes/chakra/steps.ts +218 -0
  307. package/src/theme/recipes/chakra/switch.ts +167 -0
  308. package/src/theme/recipes/chakra/table.ts +172 -0
  309. package/src/theme/recipes/chakra/tabs.ts +280 -0
  310. package/src/theme/recipes/chakra/tag.ts +131 -0
  311. package/src/theme/recipes/chakra/textarea.ts +88 -0
  312. package/src/theme/recipes/chakra/timeline.ts +138 -0
  313. package/src/theme/recipes/chakra/toast.ts +96 -0
  314. package/src/theme/recipes/chakra/tooltip.ts +40 -0
  315. package/src/theme/recipes.ts +46 -0
  316. package/src/theme/semantic-tokens/colors.ts +403 -0
  317. package/src/theme/semantic-tokens/radii.ts +7 -0
  318. package/src/theme/semantic-tokens/shadows.ts +52 -0
  319. package/src/theme/slot-recipes.ts +104 -0
  320. package/src/theme/text-styles.ts +39 -0
  321. package/src/theme/tokens/animations.ts +8 -0
  322. package/src/theme/tokens/aspect-ratios.ts +10 -0
  323. package/src/theme/tokens/blurs.ts +12 -0
  324. package/src/theme/tokens/borders.ts +9 -0
  325. package/src/theme/tokens/colors.ts +177 -0
  326. package/src/theme/tokens/cursor.ts +12 -0
  327. package/src/theme/tokens/durations.ts +11 -0
  328. package/src/theme/tokens/easings.ts +10 -0
  329. package/src/theme/tokens/font-sizes.ts +20 -0
  330. package/src/theme/tokens/font-weights.ts +13 -0
  331. package/src/theme/tokens/fonts.ts +15 -0
  332. package/src/theme/tokens/keyframes.ts +173 -0
  333. package/src/theme/tokens/letter-spacing.ts +9 -0
  334. package/src/theme/tokens/line-heights.ts +19 -0
  335. package/src/theme/tokens/radius.ts +18 -0
  336. package/src/theme/tokens/sizes.ts +71 -0
  337. package/src/theme/tokens/spacing.ts +38 -0
  338. package/src/theme/tokens/z-indices.ts +34 -0
  339. package/src/theme/utils.ts +46 -0
  340. package/dist/index.d.mts +0 -8
  341. package/dist/index.js.map +0 -1
  342. package/dist/index.mjs +0 -11
  343. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,1921 @@
1
+ 'use client'
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/components/loading-overlay/index.ts
32
+ var loading_overlay_exports = {};
33
+ __export(loading_overlay_exports, {
34
+ LoadingOverlay: () => namespace_exports
35
+ });
36
+ module.exports = __toCommonJS(loading_overlay_exports);
37
+
38
+ // src/components/loading-overlay/namespace.ts
39
+ var namespace_exports = {};
40
+ __export(namespace_exports, {
41
+ Root: () => LoadingOverlayRoot,
42
+ Spinner: () => LoadingOverlaySpinner,
43
+ Text: () => LoadingOverlayText
44
+ });
45
+
46
+ // ../../node_modules/@ark-ui/react/dist/components/presence/presence.js
47
+ var import_jsx_runtime2 = require("react/jsx-runtime");
48
+ var import_react6 = require("react");
49
+
50
+ // ../../node_modules/@ark-ui/react/dist/utils/compose-refs.js
51
+ function setRef(ref2, value) {
52
+ if (typeof ref2 === "function") {
53
+ ref2(value);
54
+ } else if (ref2 !== null && ref2 !== void 0) {
55
+ ref2.current = value;
56
+ }
57
+ }
58
+ function composeRefs(...refs) {
59
+ return (node) => {
60
+ for (const ref2 of refs) {
61
+ setRef(ref2, node);
62
+ }
63
+ };
64
+ }
65
+
66
+ // ../../node_modules/proxy-compare/dist/index.js
67
+ var TRACK_MEMO_SYMBOL = Symbol();
68
+ var GET_ORIGINAL_SYMBOL = Symbol();
69
+ var AFFECTED_PROPERTY = "a";
70
+ var IS_TARGET_COPIED_PROPERTY = "f";
71
+ var PROXY_PROPERTY = "p";
72
+ var PROXY_CACHE_PROPERTY = "c";
73
+ var TARGET_CACHE_PROPERTY = "t";
74
+ var NEXT_OBJECT_PROPERTY = "n";
75
+ var CHANGED_PROPERTY = "g";
76
+ var HAS_KEY_PROPERTY = "h";
77
+ var ALL_OWN_KEYS_PROPERTY = "w";
78
+ var HAS_OWN_KEY_PROPERTY = "o";
79
+ var KEYS_PROPERTY = "k";
80
+ var newProxy = (target, handler) => new Proxy(target, handler);
81
+ var getProto = Object.getPrototypeOf;
82
+ var objectsToTrack = /* @__PURE__ */ new WeakMap();
83
+ var isObjectToTrack = (obj) => obj && (objectsToTrack.has(obj) ? objectsToTrack.get(obj) : getProto(obj) === Object.prototype || getProto(obj) === Array.prototype);
84
+ var isObject = (x) => typeof x === "object" && x !== null;
85
+ var needsToCopyTargetObject = (obj) => Object.values(Object.getOwnPropertyDescriptors(obj)).some((descriptor) => !descriptor.configurable && !descriptor.writable);
86
+ var copyTargetObject = (obj) => {
87
+ if (Array.isArray(obj)) {
88
+ return Array.from(obj);
89
+ }
90
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
91
+ Object.values(descriptors).forEach((desc) => {
92
+ desc.configurable = true;
93
+ });
94
+ return Object.create(getProto(obj), descriptors);
95
+ };
96
+ var createProxyHandler = (origObj, isTargetCopied) => {
97
+ const state = {
98
+ [IS_TARGET_COPIED_PROPERTY]: isTargetCopied
99
+ };
100
+ let trackObject = false;
101
+ const recordUsage = (type, key) => {
102
+ if (!trackObject) {
103
+ let used = state[AFFECTED_PROPERTY].get(origObj);
104
+ if (!used) {
105
+ used = {};
106
+ state[AFFECTED_PROPERTY].set(origObj, used);
107
+ }
108
+ if (type === ALL_OWN_KEYS_PROPERTY) {
109
+ used[ALL_OWN_KEYS_PROPERTY] = true;
110
+ } else {
111
+ let set2 = used[type];
112
+ if (!set2) {
113
+ set2 = /* @__PURE__ */ new Set();
114
+ used[type] = set2;
115
+ }
116
+ set2.add(key);
117
+ }
118
+ }
119
+ };
120
+ const recordObjectAsUsed = () => {
121
+ trackObject = true;
122
+ state[AFFECTED_PROPERTY].delete(origObj);
123
+ };
124
+ const handler = {
125
+ get(target, key) {
126
+ if (key === GET_ORIGINAL_SYMBOL) {
127
+ return origObj;
128
+ }
129
+ recordUsage(KEYS_PROPERTY, key);
130
+ return createProxy(Reflect.get(target, key), state[AFFECTED_PROPERTY], state[PROXY_CACHE_PROPERTY], state[TARGET_CACHE_PROPERTY]);
131
+ },
132
+ has(target, key) {
133
+ if (key === TRACK_MEMO_SYMBOL) {
134
+ recordObjectAsUsed();
135
+ return true;
136
+ }
137
+ recordUsage(HAS_KEY_PROPERTY, key);
138
+ return Reflect.has(target, key);
139
+ },
140
+ getOwnPropertyDescriptor(target, key) {
141
+ recordUsage(HAS_OWN_KEY_PROPERTY, key);
142
+ return Reflect.getOwnPropertyDescriptor(target, key);
143
+ },
144
+ ownKeys(target) {
145
+ recordUsage(ALL_OWN_KEYS_PROPERTY);
146
+ return Reflect.ownKeys(target);
147
+ }
148
+ };
149
+ if (isTargetCopied) {
150
+ handler.set = handler.deleteProperty = () => false;
151
+ }
152
+ return [handler, state];
153
+ };
154
+ var getOriginalObject = (obj) => (
155
+ // unwrap proxy
156
+ obj[GET_ORIGINAL_SYMBOL] || // otherwise
157
+ obj
158
+ );
159
+ var createProxy = (obj, affected, proxyCache, targetCache2) => {
160
+ if (!isObjectToTrack(obj))
161
+ return obj;
162
+ let targetAndCopied = targetCache2 && targetCache2.get(obj);
163
+ if (!targetAndCopied) {
164
+ const target2 = getOriginalObject(obj);
165
+ if (needsToCopyTargetObject(target2)) {
166
+ targetAndCopied = [target2, copyTargetObject(target2)];
167
+ } else {
168
+ targetAndCopied = [target2];
169
+ }
170
+ targetCache2 === null || targetCache2 === void 0 ? void 0 : targetCache2.set(obj, targetAndCopied);
171
+ }
172
+ const [target, copiedTarget] = targetAndCopied;
173
+ let handlerAndState = proxyCache && proxyCache.get(target);
174
+ if (!handlerAndState || handlerAndState[1][IS_TARGET_COPIED_PROPERTY] !== !!copiedTarget) {
175
+ handlerAndState = createProxyHandler(target, !!copiedTarget);
176
+ handlerAndState[1][PROXY_PROPERTY] = newProxy(copiedTarget || target, handlerAndState[0]);
177
+ if (proxyCache) {
178
+ proxyCache.set(target, handlerAndState);
179
+ }
180
+ }
181
+ handlerAndState[1][AFFECTED_PROPERTY] = affected;
182
+ handlerAndState[1][PROXY_CACHE_PROPERTY] = proxyCache;
183
+ handlerAndState[1][TARGET_CACHE_PROPERTY] = targetCache2;
184
+ return handlerAndState[1][PROXY_PROPERTY];
185
+ };
186
+ var isAllOwnKeysChanged = (prevObj, nextObj) => {
187
+ const prevKeys = Reflect.ownKeys(prevObj);
188
+ const nextKeys = Reflect.ownKeys(nextObj);
189
+ return prevKeys.length !== nextKeys.length || prevKeys.some((k, i) => k !== nextKeys[i]);
190
+ };
191
+ var isChanged = (prevObj, nextObj, affected, cache, isEqual2 = Object.is) => {
192
+ if (isEqual2(prevObj, nextObj)) {
193
+ return false;
194
+ }
195
+ if (!isObject(prevObj) || !isObject(nextObj))
196
+ return true;
197
+ const used = affected.get(getOriginalObject(prevObj));
198
+ if (!used)
199
+ return true;
200
+ if (cache) {
201
+ const hit = cache.get(prevObj);
202
+ if (hit && hit[NEXT_OBJECT_PROPERTY] === nextObj) {
203
+ return hit[CHANGED_PROPERTY];
204
+ }
205
+ cache.set(prevObj, {
206
+ [NEXT_OBJECT_PROPERTY]: nextObj,
207
+ [CHANGED_PROPERTY]: false
208
+ });
209
+ }
210
+ let changed = null;
211
+ try {
212
+ for (const key of used[HAS_KEY_PROPERTY] || []) {
213
+ changed = Reflect.has(prevObj, key) !== Reflect.has(nextObj, key);
214
+ if (changed)
215
+ return changed;
216
+ }
217
+ if (used[ALL_OWN_KEYS_PROPERTY] === true) {
218
+ changed = isAllOwnKeysChanged(prevObj, nextObj);
219
+ if (changed)
220
+ return changed;
221
+ } else {
222
+ for (const key of used[HAS_OWN_KEY_PROPERTY] || []) {
223
+ const hasPrev = !!Reflect.getOwnPropertyDescriptor(prevObj, key);
224
+ const hasNext = !!Reflect.getOwnPropertyDescriptor(nextObj, key);
225
+ changed = hasPrev !== hasNext;
226
+ if (changed)
227
+ return changed;
228
+ }
229
+ }
230
+ for (const key of used[KEYS_PROPERTY] || []) {
231
+ changed = isChanged(prevObj[key], nextObj[key], affected, cache, isEqual2);
232
+ if (changed)
233
+ return changed;
234
+ }
235
+ if (changed === null)
236
+ changed = true;
237
+ return changed;
238
+ } finally {
239
+ if (cache) {
240
+ cache.set(prevObj, {
241
+ [NEXT_OBJECT_PROPERTY]: nextObj,
242
+ [CHANGED_PROPERTY]: changed
243
+ });
244
+ }
245
+ }
246
+ };
247
+ var getUntracked = (obj) => {
248
+ if (isObjectToTrack(obj)) {
249
+ return obj[GET_ORIGINAL_SYMBOL] || null;
250
+ }
251
+ return null;
252
+ };
253
+ var markToTrack = (obj, mark = true) => {
254
+ objectsToTrack.set(obj, mark);
255
+ };
256
+
257
+ // ../../node_modules/@zag-js/store/dist/index.mjs
258
+ function getGlobal() {
259
+ if (typeof globalThis !== "undefined") return globalThis;
260
+ if (typeof self !== "undefined") return self;
261
+ if (typeof window !== "undefined") return window;
262
+ if (typeof global !== "undefined") return global;
263
+ }
264
+ function makeGlobal(key, value) {
265
+ const g = getGlobal();
266
+ if (!g) return value();
267
+ g[key] || (g[key] = value());
268
+ return g[key];
269
+ }
270
+ var isDev = () => process.env.NODE_ENV !== "production";
271
+ var isObject2 = (x) => typeof x === "object" && x !== null;
272
+ var proxyStateMap = makeGlobal("__zag__proxyStateMap", () => /* @__PURE__ */ new WeakMap());
273
+ var refSet = makeGlobal("__zag__refSet", () => /* @__PURE__ */ new WeakSet());
274
+ var isReactElement = (x) => typeof x === "object" && x !== null && "$$typeof" in x;
275
+ var isVueElement = (x) => typeof x === "object" && x !== null && "__v_isVNode" in x;
276
+ var isDOMElement = (x) => typeof x === "object" && x !== null && "nodeType" in x && typeof x.nodeName === "string";
277
+ var isElement = (x) => isReactElement(x) || isVueElement(x) || isDOMElement(x);
278
+ var buildProxyFunction = (objectIs = Object.is, newProxy2 = (target, handler) => new Proxy(target, handler), canProxy = (x) => isObject2(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !isElement(x) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), defaultHandlePromise = (promise) => {
279
+ switch (promise.status) {
280
+ case "fulfilled":
281
+ return promise.value;
282
+ case "rejected":
283
+ throw promise.reason;
284
+ default:
285
+ throw promise;
286
+ }
287
+ }, snapCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (target, version, handlePromise = defaultHandlePromise) => {
288
+ const cache = snapCache.get(target);
289
+ if ((cache == null ? void 0 : cache[0]) === version) {
290
+ return cache[1];
291
+ }
292
+ const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
293
+ markToTrack(snap, true);
294
+ snapCache.set(target, [version, snap]);
295
+ Reflect.ownKeys(target).forEach((key) => {
296
+ const value = Reflect.get(target, key);
297
+ if (refSet.has(value)) {
298
+ markToTrack(value, false);
299
+ snap[key] = value;
300
+ } else if (value instanceof Promise) {
301
+ Object.defineProperty(snap, key, {
302
+ get() {
303
+ return handlePromise(value);
304
+ }
305
+ });
306
+ } else if (proxyStateMap.has(value)) {
307
+ snap[key] = snapshot(value, handlePromise);
308
+ } else {
309
+ snap[key] = value;
310
+ }
311
+ });
312
+ return Object.freeze(snap);
313
+ }, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1, 1], proxyFunction2 = (initialObject) => {
314
+ if (!isObject2(initialObject)) {
315
+ throw new Error("object required");
316
+ }
317
+ const found = proxyCache.get(initialObject);
318
+ if (found) {
319
+ return found;
320
+ }
321
+ let version = versionHolder[0];
322
+ const listeners = /* @__PURE__ */ new Set();
323
+ const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
324
+ if (version !== nextVersion) {
325
+ version = nextVersion;
326
+ listeners.forEach((listener) => listener(op, nextVersion));
327
+ }
328
+ };
329
+ let checkVersion = versionHolder[1];
330
+ const ensureVersion = (nextCheckVersion = ++versionHolder[1]) => {
331
+ if (checkVersion !== nextCheckVersion && !listeners.size) {
332
+ checkVersion = nextCheckVersion;
333
+ propProxyStates.forEach(([propProxyState]) => {
334
+ const propVersion = propProxyState[1](nextCheckVersion);
335
+ if (propVersion > version) {
336
+ version = propVersion;
337
+ }
338
+ });
339
+ }
340
+ return version;
341
+ };
342
+ const createPropListener = (prop) => (op, nextVersion) => {
343
+ const newOp = [...op];
344
+ newOp[1] = [prop, ...newOp[1]];
345
+ notifyUpdate(newOp, nextVersion);
346
+ };
347
+ const propProxyStates = /* @__PURE__ */ new Map();
348
+ const addPropListener = (prop, propProxyState) => {
349
+ if (isDev() && propProxyStates.has(prop)) {
350
+ throw new Error("prop listener already exists");
351
+ }
352
+ if (listeners.size) {
353
+ const remove = propProxyState[3](createPropListener(prop));
354
+ propProxyStates.set(prop, [propProxyState, remove]);
355
+ } else {
356
+ propProxyStates.set(prop, [propProxyState]);
357
+ }
358
+ };
359
+ const removePropListener = (prop) => {
360
+ var _a;
361
+ const entry = propProxyStates.get(prop);
362
+ if (entry) {
363
+ propProxyStates.delete(prop);
364
+ (_a = entry[1]) == null ? void 0 : _a.call(entry);
365
+ }
366
+ };
367
+ const addListener = (listener) => {
368
+ listeners.add(listener);
369
+ if (listeners.size === 1) {
370
+ propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
371
+ if (isDev() && prevRemove) {
372
+ throw new Error("remove already exists");
373
+ }
374
+ const remove = propProxyState[3](createPropListener(prop));
375
+ propProxyStates.set(prop, [propProxyState, remove]);
376
+ });
377
+ }
378
+ const removeListener = () => {
379
+ listeners.delete(listener);
380
+ if (listeners.size === 0) {
381
+ propProxyStates.forEach(([propProxyState, remove], prop) => {
382
+ if (remove) {
383
+ remove();
384
+ propProxyStates.set(prop, [propProxyState]);
385
+ }
386
+ });
387
+ }
388
+ };
389
+ return removeListener;
390
+ };
391
+ const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
392
+ const handler = {
393
+ deleteProperty(target, prop) {
394
+ const prevValue = Reflect.get(target, prop);
395
+ removePropListener(prop);
396
+ const deleted = Reflect.deleteProperty(target, prop);
397
+ if (deleted) {
398
+ notifyUpdate(["delete", [prop], prevValue]);
399
+ }
400
+ return deleted;
401
+ },
402
+ set(target, prop, value, receiver) {
403
+ var _a;
404
+ const hasPrevValue = Reflect.has(target, prop);
405
+ const prevValue = Reflect.get(target, prop, receiver);
406
+ if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
407
+ return true;
408
+ }
409
+ removePropListener(prop);
410
+ if (isObject2(value)) {
411
+ value = getUntracked(value) || value;
412
+ }
413
+ let nextValue = value;
414
+ if ((_a = Object.getOwnPropertyDescriptor(target, prop)) == null ? void 0 : _a.set) ;
415
+ else if (value instanceof Promise) {
416
+ value.then((v) => {
417
+ Object.assign(value, { status: "fulfilled", value: v });
418
+ notifyUpdate(["resolve", [prop], v]);
419
+ }).catch((e) => {
420
+ Object.assign(value, { status: "rejected", reason: e });
421
+ notifyUpdate(["reject", [prop], e]);
422
+ });
423
+ } else {
424
+ if (!proxyStateMap.has(value) && canProxy(value)) {
425
+ nextValue = proxy(value);
426
+ }
427
+ const childProxyState = !refSet.has(nextValue) && proxyStateMap.get(nextValue);
428
+ if (childProxyState) {
429
+ addPropListener(prop, childProxyState);
430
+ }
431
+ }
432
+ Reflect.set(target, prop, nextValue, receiver);
433
+ notifyUpdate(["set", [prop], value, prevValue]);
434
+ return true;
435
+ }
436
+ };
437
+ const proxyObject = newProxy2(baseObject, handler);
438
+ proxyCache.set(initialObject, proxyObject);
439
+ const proxyState = [baseObject, ensureVersion, createSnapshot, addListener];
440
+ proxyStateMap.set(proxyObject, proxyState);
441
+ Reflect.ownKeys(initialObject).forEach((key) => {
442
+ const desc = Object.getOwnPropertyDescriptor(initialObject, key);
443
+ if (desc.get || desc.set) {
444
+ Object.defineProperty(baseObject, key, desc);
445
+ } else {
446
+ proxyObject[key] = initialObject[key];
447
+ }
448
+ });
449
+ return proxyObject;
450
+ }) => [
451
+ // public functions
452
+ proxyFunction2,
453
+ // shared state
454
+ proxyStateMap,
455
+ refSet,
456
+ // internal things
457
+ objectIs,
458
+ newProxy2,
459
+ canProxy,
460
+ defaultHandlePromise,
461
+ snapCache,
462
+ createSnapshot,
463
+ proxyCache,
464
+ versionHolder
465
+ ];
466
+ var [proxyFunction] = buildProxyFunction();
467
+ function proxy(initialObject = {}) {
468
+ return proxyFunction(initialObject);
469
+ }
470
+ function subscribe(proxyObject, callback, notifyInSync) {
471
+ const proxyState = proxyStateMap.get(proxyObject);
472
+ if (isDev() && !proxyState) {
473
+ console.warn("Please use proxy object");
474
+ }
475
+ let promise;
476
+ const ops = [];
477
+ const addListener = proxyState[3];
478
+ let isListenerActive = false;
479
+ const listener = (op) => {
480
+ ops.push(op);
481
+ if (notifyInSync) {
482
+ callback(ops.splice(0));
483
+ return;
484
+ }
485
+ if (!promise) {
486
+ promise = Promise.resolve().then(() => {
487
+ promise = void 0;
488
+ if (isListenerActive) {
489
+ callback(ops.splice(0));
490
+ }
491
+ });
492
+ }
493
+ };
494
+ const removeListener = addListener(listener);
495
+ isListenerActive = true;
496
+ return () => {
497
+ isListenerActive = false;
498
+ removeListener();
499
+ };
500
+ }
501
+ function snapshot(proxyObject, handlePromise) {
502
+ const proxyState = proxyStateMap.get(proxyObject);
503
+ if (isDev() && !proxyState) {
504
+ console.warn("Please use proxy object");
505
+ }
506
+ const [target, ensureVersion, createSnapshot] = proxyState;
507
+ return createSnapshot(target, ensureVersion(), handlePromise);
508
+ }
509
+ function ref(obj) {
510
+ refSet.add(obj);
511
+ return obj;
512
+ }
513
+ function proxyWithComputed(initialObject, computedFns) {
514
+ const keys = Object.keys(computedFns);
515
+ keys.forEach((key) => {
516
+ if (Object.getOwnPropertyDescriptor(initialObject, key)) {
517
+ throw new Error("object property already defined");
518
+ }
519
+ const computedFn = computedFns[key];
520
+ const { get, set: set2 } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
521
+ const desc = {};
522
+ desc.get = () => get(snapshot(proxyObject));
523
+ if (set2) {
524
+ desc.set = (newValue) => set2(proxyObject, newValue);
525
+ }
526
+ Object.defineProperty(initialObject, key, desc);
527
+ });
528
+ const proxyObject = proxy(initialObject);
529
+ return proxyObject;
530
+ }
531
+
532
+ // ../../node_modules/@zag-js/utils/dist/index.mjs
533
+ function clear(v) {
534
+ while (v.length > 0) v.pop();
535
+ return v;
536
+ }
537
+ var runIfFn = (v, ...a) => {
538
+ const res = typeof v === "function" ? v(...a) : v;
539
+ return res != null ? res : void 0;
540
+ };
541
+ var cast = (v) => v;
542
+ var noop = () => {
543
+ };
544
+ var callAll = (...fns) => (...a) => {
545
+ fns.forEach(function(fn) {
546
+ fn == null ? void 0 : fn(...a);
547
+ });
548
+ };
549
+ var uuid = /* @__PURE__ */ (() => {
550
+ let id = 0;
551
+ return () => {
552
+ id++;
553
+ return id.toString(36);
554
+ };
555
+ })();
556
+ var isDev2 = () => process.env.NODE_ENV !== "production";
557
+ var isArray = (v) => Array.isArray(v);
558
+ var isObjectLike = (v) => v != null && typeof v === "object";
559
+ var isObject3 = (v) => isObjectLike(v) && !isArray(v);
560
+ var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
561
+ var isString = (v) => typeof v === "string";
562
+ var isFunction = (v) => typeof v === "function";
563
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
564
+ var baseGetTag = (v) => Object.prototype.toString.call(v);
565
+ var fnToString = Function.prototype.toString;
566
+ var objectCtorString = fnToString.call(Object);
567
+ var isPlainObject = (v) => {
568
+ if (!isObjectLike(v) || baseGetTag(v) != "[object Object]") return false;
569
+ const proto = Object.getPrototypeOf(v);
570
+ if (proto === null) return true;
571
+ const Ctor = hasProp(proto, "constructor") && proto.constructor;
572
+ return typeof Ctor == "function" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString;
573
+ };
574
+ function compact(obj) {
575
+ if (!isPlainObject2(obj) || obj === void 0) {
576
+ return obj;
577
+ }
578
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
579
+ const filtered = {};
580
+ for (const key of keys) {
581
+ const value = obj[key];
582
+ if (value !== void 0) {
583
+ filtered[key] = compact(value);
584
+ }
585
+ }
586
+ return filtered;
587
+ }
588
+ var isPlainObject2 = (value) => {
589
+ return value && typeof value === "object" && value.constructor === Object;
590
+ };
591
+ function warn(...a) {
592
+ const m = a.length === 1 ? a[0] : a[1];
593
+ const c = a.length === 2 ? a[0] : true;
594
+ if (c && process.env.NODE_ENV !== "production") {
595
+ console.warn(m);
596
+ }
597
+ }
598
+ function invariant(...a) {
599
+ const m = a.length === 1 ? a[0] : a[1];
600
+ const c = a.length === 2 ? a[0] : true;
601
+ if (c && process.env.NODE_ENV !== "production") {
602
+ throw new Error(m);
603
+ }
604
+ }
605
+
606
+ // ../../node_modules/klona/full/index.mjs
607
+ function set(obj, key, val) {
608
+ if (typeof val.value === "object") val.value = klona(val.value);
609
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
610
+ Object.defineProperty(obj, key, val);
611
+ } else obj[key] = val.value;
612
+ }
613
+ function klona(x) {
614
+ if (typeof x !== "object") return x;
615
+ var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
616
+ if (str === "[object Object]") {
617
+ tmp = Object.create(x.__proto__ || null);
618
+ } else if (str === "[object Array]") {
619
+ tmp = Array(x.length);
620
+ } else if (str === "[object Set]") {
621
+ tmp = /* @__PURE__ */ new Set();
622
+ x.forEach(function(val) {
623
+ tmp.add(klona(val));
624
+ });
625
+ } else if (str === "[object Map]") {
626
+ tmp = /* @__PURE__ */ new Map();
627
+ x.forEach(function(val, key) {
628
+ tmp.set(klona(key), klona(val));
629
+ });
630
+ } else if (str === "[object Date]") {
631
+ tmp = /* @__PURE__ */ new Date(+x);
632
+ } else if (str === "[object RegExp]") {
633
+ tmp = new RegExp(x.source, x.flags);
634
+ } else if (str === "[object DataView]") {
635
+ tmp = new x.constructor(klona(x.buffer));
636
+ } else if (str === "[object ArrayBuffer]") {
637
+ tmp = x.slice(0);
638
+ } else if (str.slice(-6) === "Array]") {
639
+ tmp = new x.constructor(x);
640
+ }
641
+ if (tmp) {
642
+ for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
643
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
644
+ }
645
+ for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
646
+ if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k]) continue;
647
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
648
+ }
649
+ }
650
+ return tmp || x;
651
+ }
652
+
653
+ // ../../node_modules/@zag-js/core/dist/index.mjs
654
+ var __defProp2 = Object.defineProperty;
655
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
656
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
657
+ function deepMerge(source, ...objects) {
658
+ for (const obj of objects) {
659
+ const target = compact(obj);
660
+ for (const key in target) {
661
+ if (isPlainObject(obj[key])) {
662
+ if (!source[key]) {
663
+ source[key] = {};
664
+ }
665
+ deepMerge(source[key], obj[key]);
666
+ } else {
667
+ source[key] = obj[key];
668
+ }
669
+ }
670
+ }
671
+ return source;
672
+ }
673
+ function structuredClone(v) {
674
+ return klona(v);
675
+ }
676
+ function toEvent(event) {
677
+ const obj = isString(event) ? { type: event } : event;
678
+ return obj;
679
+ }
680
+ function toArray(value) {
681
+ if (!value) return [];
682
+ return isArray(value) ? value.slice() : [value];
683
+ }
684
+ function isGuardHelper(value) {
685
+ return isObject3(value) && value.predicate != null;
686
+ }
687
+ var Truthy = () => true;
688
+ function determineGuardFn(guard, guardMap) {
689
+ guard = guard != null ? guard : Truthy;
690
+ return (context, event, meta) => {
691
+ if (isString(guard)) {
692
+ const value = guardMap[guard];
693
+ return isFunction(value) ? value(context, event, meta) : value;
694
+ }
695
+ if (isGuardHelper(guard)) {
696
+ return guard.predicate(guardMap)(context, event, meta);
697
+ }
698
+ return guard == null ? void 0 : guard(context, event, meta);
699
+ };
700
+ }
701
+ function determineActionsFn(values, guardMap) {
702
+ return (context, event, meta) => {
703
+ if (isGuardHelper(values)) {
704
+ return values.predicate(guardMap)(context, event, meta);
705
+ }
706
+ return values;
707
+ };
708
+ }
709
+ function createProxy2(config) {
710
+ var _a, _b, _c, _d, _e;
711
+ const computedContext = (_a = config.computed) != null ? _a : cast({});
712
+ const initialContext = (_b = config.context) != null ? _b : cast({});
713
+ const initialTags = config.initial ? (_d = (_c = config.states) == null ? void 0 : _c[config.initial]) == null ? void 0 : _d.tags : [];
714
+ const state = proxy({
715
+ value: (_e = config.initial) != null ? _e : "",
716
+ previousValue: "",
717
+ event: cast({}),
718
+ previousEvent: cast({}),
719
+ context: proxyWithComputed(initialContext, computedContext),
720
+ done: false,
721
+ tags: initialTags != null ? initialTags : [],
722
+ hasTag(tag) {
723
+ return this.tags.includes(tag);
724
+ },
725
+ matches(...value) {
726
+ return value.includes(this.value);
727
+ },
728
+ can(event) {
729
+ return cast(this).nextEvents.includes(event);
730
+ },
731
+ get nextEvents() {
732
+ var _a2, _b2, _c2, _d2;
733
+ const stateEvents = (_c2 = (_b2 = (_a2 = config.states) == null ? void 0 : _a2[this.value]) == null ? void 0 : _b2["on"]) != null ? _c2 : {};
734
+ const globalEvents = (_d2 = config == null ? void 0 : config.on) != null ? _d2 : {};
735
+ return Object.keys({ ...stateEvents, ...globalEvents });
736
+ },
737
+ get changed() {
738
+ if (this.event.value === "machine.init" || !this.previousValue) return false;
739
+ return this.value !== this.previousValue;
740
+ }
741
+ });
742
+ return cast(state);
743
+ }
744
+ function determineDelayFn(delay, delaysMap) {
745
+ return (context, event) => {
746
+ if (isNumber(delay)) return delay;
747
+ if (isFunction(delay)) {
748
+ return delay(context, event);
749
+ }
750
+ if (isString(delay)) {
751
+ const value = Number.parseFloat(delay);
752
+ if (!Number.isNaN(value)) {
753
+ return value;
754
+ }
755
+ if (delaysMap) {
756
+ const valueOrFn = delaysMap == null ? void 0 : delaysMap[delay];
757
+ invariant(
758
+ valueOrFn == null,
759
+ `[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``
760
+ );
761
+ return isFunction(valueOrFn) ? valueOrFn(context, event) : valueOrFn;
762
+ }
763
+ }
764
+ };
765
+ }
766
+ function toTarget(target) {
767
+ return isString(target) ? { target } : target;
768
+ }
769
+ function determineTransitionFn(transitions, guardMap) {
770
+ return (context, event, meta) => {
771
+ return toArray(transitions).map(toTarget).find((transition) => {
772
+ var _a;
773
+ const determineGuard = determineGuardFn(transition.guard, guardMap);
774
+ const guard = determineGuard(context, event, meta);
775
+ return (_a = guard != null ? guard : transition.target) != null ? _a : transition.actions;
776
+ });
777
+ };
778
+ }
779
+ var Machine = class {
780
+ // Let's get started!
781
+ constructor(config, options) {
782
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
783
+ __publicField(
784
+ this,
785
+ "status",
786
+ "Not Started"
787
+ /* NotStarted */
788
+ );
789
+ __publicField(this, "state");
790
+ __publicField(this, "initialState");
791
+ __publicField(this, "initialContext");
792
+ __publicField(this, "id");
793
+ __publicField(
794
+ this,
795
+ "type",
796
+ "machine"
797
+ /* Machine */
798
+ );
799
+ __publicField(this, "activityEvents", /* @__PURE__ */ new Map());
800
+ __publicField(this, "delayedEvents", /* @__PURE__ */ new Map());
801
+ __publicField(this, "stateListeners", /* @__PURE__ */ new Set());
802
+ __publicField(this, "doneListeners", /* @__PURE__ */ new Set());
803
+ __publicField(this, "contextWatchers", /* @__PURE__ */ new Set());
804
+ __publicField(this, "removeStateListener", noop);
805
+ __publicField(this, "parent");
806
+ __publicField(this, "children", /* @__PURE__ */ new Map());
807
+ __publicField(this, "guardMap");
808
+ __publicField(this, "actionMap");
809
+ __publicField(this, "delayMap");
810
+ __publicField(this, "activityMap");
811
+ __publicField(this, "sync");
812
+ __publicField(this, "options");
813
+ __publicField(this, "config");
814
+ __publicField(this, "_created", () => {
815
+ var _a2;
816
+ const event = toEvent(
817
+ "machine.created"
818
+ /* Created */
819
+ );
820
+ this.executeActions((_a2 = this.config) == null ? void 0 : _a2.created, event);
821
+ });
822
+ __publicField(this, "start", (init) => {
823
+ this.state.value = "";
824
+ this.state.tags = [];
825
+ if (this.status === "Running") {
826
+ return this;
827
+ }
828
+ this.status = "Running";
829
+ this.removeStateListener = subscribe(
830
+ this.state,
831
+ () => {
832
+ this.stateListeners.forEach((listener) => {
833
+ listener(this.stateSnapshot);
834
+ });
835
+ },
836
+ this.sync
837
+ );
838
+ this.setupContextWatchers();
839
+ this.executeActivities(
840
+ toEvent(
841
+ "machine.start"
842
+ /* Start */
843
+ ),
844
+ toArray(this.config.activities),
845
+ "machine.start"
846
+ /* Start */
847
+ );
848
+ this.executeActions(this.config.entry, toEvent(
849
+ "machine.start"
850
+ /* Start */
851
+ ));
852
+ const event = toEvent(
853
+ "machine.init"
854
+ /* Init */
855
+ );
856
+ const target = isObject3(init) ? init.value : init;
857
+ const context = isObject3(init) ? init.context : void 0;
858
+ if (context) {
859
+ this.setContext(context);
860
+ }
861
+ const transition = {
862
+ target: target != null ? target : this.config.initial
863
+ };
864
+ const next = this.getNextStateInfo(transition, event);
865
+ this.initialState = next;
866
+ this.performStateChangeEffects(this.state.value, next, event);
867
+ return this;
868
+ });
869
+ __publicField(this, "setupContextWatchers", () => {
870
+ const { watch } = this.config;
871
+ if (!watch) return;
872
+ let prev = snapshot(this.state.context);
873
+ const cleanup = subscribe(this.state.context, () => {
874
+ var _a2, _b2;
875
+ const next = snapshot(this.state.context);
876
+ for (const [key, fn] of Object.entries(watch)) {
877
+ const isEqual2 = (_b2 = (_a2 = this.options.compareFns) == null ? void 0 : _a2[key]) != null ? _b2 : Object.is;
878
+ if (isEqual2(prev[key], next[key])) continue;
879
+ this.executeActions(fn, this.state.event);
880
+ }
881
+ prev = next;
882
+ });
883
+ this.contextWatchers.add(cleanup);
884
+ });
885
+ __publicField(this, "stop", () => {
886
+ if (this.status === "Stopped") return;
887
+ this.performExitEffects(this.state.value, toEvent(
888
+ "machine.stop"
889
+ /* Stop */
890
+ ));
891
+ this.executeActions(this.config.exit, toEvent(
892
+ "machine.stop"
893
+ /* Stop */
894
+ ));
895
+ this.setState("");
896
+ this.setEvent(
897
+ "machine.stop"
898
+ /* Stop */
899
+ );
900
+ this.stopStateListeners();
901
+ this.stopChildren();
902
+ this.stopActivities();
903
+ this.stopDelayedEvents();
904
+ this.stopContextWatchers();
905
+ this.status = "Stopped";
906
+ return this;
907
+ });
908
+ __publicField(this, "stopStateListeners", () => {
909
+ this.removeStateListener();
910
+ this.stateListeners.clear();
911
+ });
912
+ __publicField(this, "stopContextWatchers", () => {
913
+ this.contextWatchers.forEach((fn) => fn());
914
+ this.contextWatchers.clear();
915
+ });
916
+ __publicField(this, "stopDelayedEvents", () => {
917
+ this.delayedEvents.forEach((state) => {
918
+ state.forEach((stop) => stop());
919
+ });
920
+ this.delayedEvents.clear();
921
+ });
922
+ __publicField(this, "stopActivities", (state) => {
923
+ var _a2, _b2;
924
+ if (state) {
925
+ (_a2 = this.activityEvents.get(state)) == null ? void 0 : _a2.forEach((stop) => stop());
926
+ (_b2 = this.activityEvents.get(state)) == null ? void 0 : _b2.clear();
927
+ this.activityEvents.delete(state);
928
+ } else {
929
+ this.activityEvents.forEach((state2) => {
930
+ state2.forEach((stop) => stop());
931
+ state2.clear();
932
+ });
933
+ this.activityEvents.clear();
934
+ }
935
+ });
936
+ __publicField(this, "sendChild", (evt, to) => {
937
+ const event = toEvent(evt);
938
+ const id = runIfFn(to, this.contextSnapshot);
939
+ const child = this.children.get(id);
940
+ if (!child) {
941
+ invariant(`[@zag-js/core] Cannot send '${event.type}' event to unknown child`);
942
+ }
943
+ child.send(event);
944
+ });
945
+ __publicField(this, "stopChild", (id) => {
946
+ if (!this.children.has(id)) {
947
+ invariant(`[@zag-js/core > stop-child] Cannot stop unknown child ${id}`);
948
+ }
949
+ this.children.get(id).stop();
950
+ this.children.delete(id);
951
+ });
952
+ __publicField(this, "removeChild", (id) => {
953
+ this.children.delete(id);
954
+ });
955
+ __publicField(this, "stopChildren", () => {
956
+ this.children.forEach((child) => child.stop());
957
+ this.children.clear();
958
+ });
959
+ __publicField(this, "setParent", (parent) => {
960
+ this.parent = parent;
961
+ });
962
+ __publicField(this, "spawn", (src, id) => {
963
+ const actor = runIfFn(src);
964
+ if (id) actor.id = id;
965
+ actor.type = "machine.actor";
966
+ actor.setParent(this);
967
+ this.children.set(actor.id, cast(actor));
968
+ actor.onDone(() => {
969
+ this.removeChild(actor.id);
970
+ }).start();
971
+ return cast(ref(actor));
972
+ });
973
+ __publicField(this, "stopActivity", (key) => {
974
+ var _a2;
975
+ if (!this.state.value) return;
976
+ const cleanups = this.activityEvents.get(this.state.value);
977
+ (_a2 = cleanups == null ? void 0 : cleanups.get(key)) == null ? void 0 : _a2();
978
+ cleanups == null ? void 0 : cleanups.delete(key);
979
+ });
980
+ __publicField(this, "addActivityCleanup", (state, key, cleanup) => {
981
+ var _a2;
982
+ if (!state) return;
983
+ if (!this.activityEvents.has(state)) {
984
+ this.activityEvents.set(state, /* @__PURE__ */ new Map([[key, cleanup]]));
985
+ } else {
986
+ (_a2 = this.activityEvents.get(state)) == null ? void 0 : _a2.set(key, cleanup);
987
+ }
988
+ });
989
+ __publicField(this, "setState", (target) => {
990
+ this.state.previousValue = this.state.value;
991
+ this.state.value = target;
992
+ const stateNode = this.getStateNode(target);
993
+ if (target == null) {
994
+ clear(this.state.tags);
995
+ } else {
996
+ this.state.tags = toArray(stateNode == null ? void 0 : stateNode.tags);
997
+ }
998
+ });
999
+ __publicField(this, "setContext", (context) => {
1000
+ if (!context) return;
1001
+ deepMerge(this.state.context, compact(context));
1002
+ });
1003
+ __publicField(this, "setOptions", (options2) => {
1004
+ const opts = compact(options2);
1005
+ this.actionMap = { ...this.actionMap, ...opts.actions };
1006
+ this.delayMap = { ...this.delayMap, ...opts.delays };
1007
+ this.activityMap = { ...this.activityMap, ...opts.activities };
1008
+ this.guardMap = { ...this.guardMap, ...opts.guards };
1009
+ });
1010
+ __publicField(this, "getStateNode", (state) => {
1011
+ var _a2;
1012
+ if (!state) return;
1013
+ return (_a2 = this.config.states) == null ? void 0 : _a2[state];
1014
+ });
1015
+ __publicField(this, "getNextStateInfo", (transitions, event) => {
1016
+ var _a2;
1017
+ const transition = this.determineTransition(transitions, event);
1018
+ const isTargetless = !(transition == null ? void 0 : transition.target);
1019
+ const target = (_a2 = transition == null ? void 0 : transition.target) != null ? _a2 : this.state.value;
1020
+ const changed = this.state.value !== target;
1021
+ const stateNode = this.getStateNode(target);
1022
+ const reenter = !isTargetless && !changed && !(transition == null ? void 0 : transition.internal);
1023
+ const info = {
1024
+ reenter,
1025
+ transition,
1026
+ stateNode,
1027
+ target,
1028
+ changed
1029
+ };
1030
+ this.log("NextState:", `[${event.type}]`, this.state.value, "---->", info.target);
1031
+ return info;
1032
+ });
1033
+ __publicField(this, "getAfterActions", (transition, delay) => {
1034
+ let id;
1035
+ const current = this.state.value;
1036
+ return {
1037
+ entry: () => {
1038
+ id = globalThis.setTimeout(() => {
1039
+ const next = this.getNextStateInfo(transition, this.state.event);
1040
+ this.performStateChangeEffects(current, next, this.state.event);
1041
+ }, delay);
1042
+ },
1043
+ exit: () => {
1044
+ globalThis.clearTimeout(id);
1045
+ }
1046
+ };
1047
+ });
1048
+ __publicField(this, "getDelayedEventActions", (state) => {
1049
+ const stateNode = this.getStateNode(state);
1050
+ const event = this.state.event;
1051
+ if (!stateNode || !stateNode.after) return;
1052
+ const entries = [];
1053
+ const exits = [];
1054
+ if (isArray(stateNode.after)) {
1055
+ const transition = this.determineTransition(stateNode.after, event);
1056
+ if (!transition) return;
1057
+ if (!hasProp(transition, "delay")) {
1058
+ throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(transition)}`);
1059
+ }
1060
+ const determineDelay = determineDelayFn(transition.delay, this.delayMap);
1061
+ const __delay = determineDelay(this.contextSnapshot, event);
1062
+ const actions = this.getAfterActions(transition, __delay);
1063
+ entries.push(actions.entry);
1064
+ exits.push(actions.exit);
1065
+ return { entries, exits };
1066
+ }
1067
+ if (isObject3(stateNode.after)) {
1068
+ for (const delay in stateNode.after) {
1069
+ const transition = stateNode.after[delay];
1070
+ const determineDelay = determineDelayFn(delay, this.delayMap);
1071
+ const __delay = determineDelay(this.contextSnapshot, event);
1072
+ const actions = this.getAfterActions(transition, __delay);
1073
+ entries.push(actions.entry);
1074
+ exits.push(actions.exit);
1075
+ }
1076
+ }
1077
+ return { entries, exits };
1078
+ });
1079
+ __publicField(this, "executeActions", (actions, event) => {
1080
+ var _a2;
1081
+ const pickedActions = determineActionsFn(actions, this.guardMap)(this.contextSnapshot, event, this.guardMeta);
1082
+ for (const action of toArray(pickedActions)) {
1083
+ const fn = isString(action) ? (_a2 = this.actionMap) == null ? void 0 : _a2[action] : action;
1084
+ warn(
1085
+ isString(action) && !fn,
1086
+ `[@zag-js/core > execute-actions] No implementation found for action: \`${action}\``
1087
+ );
1088
+ fn == null ? void 0 : fn(this.state.context, event, this.meta);
1089
+ }
1090
+ });
1091
+ __publicField(this, "executeActivities", (event, activities, state) => {
1092
+ var _a2;
1093
+ for (const activity of activities) {
1094
+ const fn = isString(activity) ? (_a2 = this.activityMap) == null ? void 0 : _a2[activity] : activity;
1095
+ if (!fn) {
1096
+ warn(`[@zag-js/core > execute-activity] No implementation found for activity: \`${activity}\``);
1097
+ continue;
1098
+ }
1099
+ const cleanup = fn(this.state.context, event, this.meta);
1100
+ if (cleanup) {
1101
+ const key = isString(activity) ? activity : activity.name || uuid();
1102
+ this.addActivityCleanup(state != null ? state : this.state.value, key, cleanup);
1103
+ }
1104
+ }
1105
+ });
1106
+ __publicField(this, "createEveryActivities", (every, callbackfn) => {
1107
+ if (!every) return;
1108
+ if (isArray(every)) {
1109
+ const picked = toArray(every).find((transition) => {
1110
+ const delayOrFn = transition.delay;
1111
+ const determineDelay2 = determineDelayFn(delayOrFn, this.delayMap);
1112
+ const delay2 = determineDelay2(this.contextSnapshot, this.state.event);
1113
+ const determineGuard = determineGuardFn(transition.guard, this.guardMap);
1114
+ const guard = determineGuard(this.contextSnapshot, this.state.event, this.guardMeta);
1115
+ return guard != null ? guard : delay2 != null;
1116
+ });
1117
+ if (!picked) return;
1118
+ const determineDelay = determineDelayFn(picked.delay, this.delayMap);
1119
+ const delay = determineDelay(this.contextSnapshot, this.state.event);
1120
+ const activity = () => {
1121
+ const id = globalThis.setInterval(() => {
1122
+ this.executeActions(picked.actions, this.state.event);
1123
+ }, delay);
1124
+ return () => {
1125
+ globalThis.clearInterval(id);
1126
+ };
1127
+ };
1128
+ callbackfn(activity);
1129
+ } else {
1130
+ for (const interval in every) {
1131
+ const actions = every == null ? void 0 : every[interval];
1132
+ const determineDelay = determineDelayFn(interval, this.delayMap);
1133
+ const delay = determineDelay(this.contextSnapshot, this.state.event);
1134
+ const activity = () => {
1135
+ const id = globalThis.setInterval(() => {
1136
+ this.executeActions(actions, this.state.event);
1137
+ }, delay);
1138
+ return () => {
1139
+ globalThis.clearInterval(id);
1140
+ };
1141
+ };
1142
+ callbackfn(activity);
1143
+ }
1144
+ }
1145
+ });
1146
+ __publicField(this, "setEvent", (event) => {
1147
+ this.state.previousEvent = this.state.event;
1148
+ this.state.event = ref(toEvent(event));
1149
+ });
1150
+ __publicField(this, "performExitEffects", (current, event) => {
1151
+ const currentState = this.state.value;
1152
+ if (currentState === "") return;
1153
+ const stateNode = current ? this.getStateNode(current) : void 0;
1154
+ this.stopActivities(currentState);
1155
+ const _exit = determineActionsFn(stateNode == null ? void 0 : stateNode.exit, this.guardMap)(this.contextSnapshot, event, this.guardMeta);
1156
+ const exitActions = toArray(_exit);
1157
+ const afterExitActions = this.delayedEvents.get(currentState);
1158
+ if (afterExitActions) {
1159
+ exitActions.push(...afterExitActions);
1160
+ }
1161
+ this.executeActions(exitActions, event);
1162
+ this.delayedEvents.delete(currentState);
1163
+ });
1164
+ __publicField(this, "performEntryEffects", (next, event) => {
1165
+ const stateNode = this.getStateNode(next);
1166
+ const activities = toArray(stateNode == null ? void 0 : stateNode.activities);
1167
+ this.createEveryActivities(stateNode == null ? void 0 : stateNode.every, (activity) => {
1168
+ activities.unshift(activity);
1169
+ });
1170
+ if (activities.length > 0) {
1171
+ this.executeActivities(event, activities);
1172
+ }
1173
+ const pickedActions = determineActionsFn(stateNode == null ? void 0 : stateNode.entry, this.guardMap)(
1174
+ this.contextSnapshot,
1175
+ event,
1176
+ this.guardMeta
1177
+ );
1178
+ const entryActions = toArray(pickedActions);
1179
+ const afterActions = this.getDelayedEventActions(next);
1180
+ if ((stateNode == null ? void 0 : stateNode.after) && afterActions) {
1181
+ this.delayedEvents.set(next, afterActions == null ? void 0 : afterActions.exits);
1182
+ entryActions.push(...afterActions.entries);
1183
+ }
1184
+ this.executeActions(entryActions, event);
1185
+ if ((stateNode == null ? void 0 : stateNode.type) === "final") {
1186
+ this.state.done = true;
1187
+ this.doneListeners.forEach((listener) => {
1188
+ listener(this.stateSnapshot);
1189
+ });
1190
+ this.stop();
1191
+ }
1192
+ });
1193
+ __publicField(this, "performTransitionEffects", (transitions, event) => {
1194
+ const transition = this.determineTransition(transitions, event);
1195
+ this.executeActions(transition == null ? void 0 : transition.actions, event);
1196
+ });
1197
+ __publicField(this, "performStateChangeEffects", (current, next, event) => {
1198
+ this.setEvent(event);
1199
+ const changed = next.changed || next.reenter;
1200
+ if (changed) {
1201
+ this.performExitEffects(current, event);
1202
+ }
1203
+ this.performTransitionEffects(next.transition, event);
1204
+ this.setState(next.target);
1205
+ if (changed) {
1206
+ this.performEntryEffects(next.target, event);
1207
+ }
1208
+ });
1209
+ __publicField(this, "determineTransition", (transition, event) => {
1210
+ const fn = determineTransitionFn(transition, this.guardMap);
1211
+ return fn == null ? void 0 : fn(this.contextSnapshot, event, this.guardMeta);
1212
+ });
1213
+ __publicField(this, "sendParent", (evt) => {
1214
+ var _a2;
1215
+ if (!this.parent) {
1216
+ invariant("[@zag-js/core > send-parent] Cannot send event to an unknown parent");
1217
+ }
1218
+ const event = toEvent(evt);
1219
+ (_a2 = this.parent) == null ? void 0 : _a2.send(event);
1220
+ });
1221
+ __publicField(this, "log", (...args) => {
1222
+ if (isDev2() && this.options.debug) {
1223
+ console.log(...args);
1224
+ }
1225
+ });
1226
+ __publicField(this, "send", (evt) => {
1227
+ const event = toEvent(evt);
1228
+ this.transition(this.state.value, event);
1229
+ });
1230
+ __publicField(this, "transition", (state, evt) => {
1231
+ var _a2, _b2, _c2;
1232
+ const stateNode = isString(state) ? this.getStateNode(state) : state == null ? void 0 : state.stateNode;
1233
+ const event = toEvent(evt);
1234
+ if (!stateNode && !this.config.on) {
1235
+ const msg = this.status === "Stopped" ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${state}, \`event\`: ${event.type}`;
1236
+ warn(msg);
1237
+ return;
1238
+ }
1239
+ const transitions = (
1240
+ // @ts-expect-error - Fix this
1241
+ (_c2 = (_a2 = stateNode == null ? void 0 : stateNode.on) == null ? void 0 : _a2[event.type]) != null ? _c2 : (_b2 = this.config.on) == null ? void 0 : _b2[event.type]
1242
+ );
1243
+ const next = this.getNextStateInfo(transitions, event);
1244
+ this.performStateChangeEffects(this.state.value, next, event);
1245
+ return next.stateNode;
1246
+ });
1247
+ __publicField(this, "subscribe", (listener) => {
1248
+ this.stateListeners.add(listener);
1249
+ if (this.status === "Running") {
1250
+ listener(this.stateSnapshot);
1251
+ }
1252
+ return () => {
1253
+ this.stateListeners.delete(listener);
1254
+ };
1255
+ });
1256
+ __publicField(this, "onDone", (listener) => {
1257
+ this.doneListeners.add(listener);
1258
+ return this;
1259
+ });
1260
+ __publicField(this, "onTransition", (listener) => {
1261
+ this.stateListeners.add(listener);
1262
+ if (this.status === "Running") {
1263
+ listener(this.stateSnapshot);
1264
+ }
1265
+ return this;
1266
+ });
1267
+ this.config = structuredClone(config);
1268
+ this.options = structuredClone(options != null ? options : {});
1269
+ this.id = (_a = this.config.id) != null ? _a : `machine-${uuid()}`;
1270
+ this.guardMap = (_c = (_b = this.options) == null ? void 0 : _b.guards) != null ? _c : {};
1271
+ this.actionMap = (_e = (_d = this.options) == null ? void 0 : _d.actions) != null ? _e : {};
1272
+ this.delayMap = (_g = (_f = this.options) == null ? void 0 : _f.delays) != null ? _g : {};
1273
+ this.activityMap = (_i = (_h = this.options) == null ? void 0 : _h.activities) != null ? _i : {};
1274
+ this.sync = (_k = (_j = this.options) == null ? void 0 : _j.sync) != null ? _k : false;
1275
+ this.state = createProxy2(this.config);
1276
+ this.initialContext = snapshot(this.state.context);
1277
+ }
1278
+ // immutable state value
1279
+ get stateSnapshot() {
1280
+ return cast(snapshot(this.state));
1281
+ }
1282
+ getState() {
1283
+ return this.stateSnapshot;
1284
+ }
1285
+ // immutable context value
1286
+ get contextSnapshot() {
1287
+ return this.stateSnapshot.context;
1288
+ }
1289
+ /**
1290
+ * A reference to the instance methods of the machine.
1291
+ * Useful when spawning child machines and managing the communication between them.
1292
+ */
1293
+ get self() {
1294
+ const self2 = this;
1295
+ return {
1296
+ id: this.id,
1297
+ send: this.send.bind(this),
1298
+ sendParent: this.sendParent.bind(this),
1299
+ sendChild: this.sendChild.bind(this),
1300
+ stop: this.stop.bind(this),
1301
+ stopChild: this.stopChild.bind(this),
1302
+ spawn: this.spawn.bind(this),
1303
+ stopActivity: this.stopActivity.bind(this),
1304
+ get state() {
1305
+ return self2.stateSnapshot;
1306
+ },
1307
+ get initialContext() {
1308
+ return self2.initialContext;
1309
+ },
1310
+ get initialState() {
1311
+ var _a, _b;
1312
+ return (_b = (_a = self2.initialState) == null ? void 0 : _a.target) != null ? _b : "";
1313
+ }
1314
+ };
1315
+ }
1316
+ get meta() {
1317
+ var _a, _b;
1318
+ return {
1319
+ state: this.stateSnapshot,
1320
+ guards: this.guardMap,
1321
+ send: this.send.bind(this),
1322
+ self: this.self,
1323
+ initialContext: this.initialContext,
1324
+ initialState: (_b = (_a = this.initialState) == null ? void 0 : _a.target) != null ? _b : "",
1325
+ getState: () => this.stateSnapshot,
1326
+ getAction: (key) => this.actionMap[key],
1327
+ getGuard: (key) => this.guardMap[key]
1328
+ };
1329
+ }
1330
+ get guardMeta() {
1331
+ return {
1332
+ state: this.stateSnapshot
1333
+ };
1334
+ }
1335
+ get [Symbol.toStringTag]() {
1336
+ return "Machine";
1337
+ }
1338
+ getHydrationState() {
1339
+ const state = this.getState();
1340
+ return {
1341
+ value: state.value,
1342
+ tags: state.tags
1343
+ };
1344
+ }
1345
+ };
1346
+ var createMachine = (config, options) => new Machine(config, options);
1347
+ var clsx = (...args) => args.map((str) => {
1348
+ var _a;
1349
+ return (_a = str == null ? void 0 : str.trim) == null ? void 0 : _a.call(str);
1350
+ }).filter(Boolean).join(" ");
1351
+ var CSS_REGEX = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;
1352
+ var serialize = (style) => {
1353
+ const res = {};
1354
+ let match;
1355
+ while (match = CSS_REGEX.exec(style)) {
1356
+ res[match[1]] = match[2];
1357
+ }
1358
+ return res;
1359
+ };
1360
+ var css = (a, b) => {
1361
+ if (isString(a)) {
1362
+ if (isString(b)) return `${a};${b}`;
1363
+ a = serialize(a);
1364
+ } else if (isString(b)) {
1365
+ b = serialize(b);
1366
+ }
1367
+ return Object.assign({}, a != null ? a : {}, b != null ? b : {});
1368
+ };
1369
+ function mergeProps(...args) {
1370
+ let result = {};
1371
+ for (let props2 of args) {
1372
+ for (let key in result) {
1373
+ if (key.startsWith("on") && typeof result[key] === "function" && typeof props2[key] === "function") {
1374
+ result[key] = callAll(props2[key], result[key]);
1375
+ continue;
1376
+ }
1377
+ if (key === "className" || key === "class") {
1378
+ result[key] = clsx(result[key], props2[key]);
1379
+ continue;
1380
+ }
1381
+ if (key === "style") {
1382
+ result[key] = css(result[key], props2[key]);
1383
+ continue;
1384
+ }
1385
+ result[key] = props2[key] !== void 0 ? props2[key] : result[key];
1386
+ }
1387
+ for (let key in props2) {
1388
+ if (result[key] === void 0) {
1389
+ result[key] = props2[key];
1390
+ }
1391
+ }
1392
+ }
1393
+ return result;
1394
+ }
1395
+
1396
+ // ../../node_modules/@ark-ui/react/dist/components/factory.js
1397
+ var import_react = require("react");
1398
+ function getRef(element) {
1399
+ var _a, _b;
1400
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
1401
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1402
+ if (mayWarn) {
1403
+ return element.ref;
1404
+ }
1405
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
1406
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1407
+ if (mayWarn) {
1408
+ return element.props.ref;
1409
+ }
1410
+ return element.props.ref || element.ref;
1411
+ }
1412
+ var withAsChild = (Component) => {
1413
+ const Comp = (0, import_react.memo)(
1414
+ (0, import_react.forwardRef)((props2, ref2) => {
1415
+ const { asChild, children, ...restProps } = props2;
1416
+ if (!asChild) {
1417
+ return (0, import_react.createElement)(Component, { ...restProps, ref: ref2 }, children);
1418
+ }
1419
+ const onlyChild = import_react.Children.only(children);
1420
+ if (!(0, import_react.isValidElement)(onlyChild)) {
1421
+ return null;
1422
+ }
1423
+ const childRef = getRef(onlyChild);
1424
+ return (0, import_react.cloneElement)(onlyChild, {
1425
+ ...mergeProps(restProps, onlyChild.props),
1426
+ ref: ref2 ? composeRefs(ref2, childRef) : childRef
1427
+ });
1428
+ })
1429
+ );
1430
+ Comp.displayName = Component.displayName || Component.name;
1431
+ return Comp;
1432
+ };
1433
+ var jsxFactory = () => {
1434
+ const cache = /* @__PURE__ */ new Map();
1435
+ return new Proxy(withAsChild, {
1436
+ apply(_target, _thisArg, argArray) {
1437
+ return withAsChild(argArray[0]);
1438
+ },
1439
+ get(_, element) {
1440
+ const asElement = element;
1441
+ if (!cache.has(asElement)) {
1442
+ cache.set(asElement, withAsChild(asElement));
1443
+ }
1444
+ return cache.get(asElement);
1445
+ }
1446
+ });
1447
+ };
1448
+ var ark = jsxFactory();
1449
+
1450
+ // ../../node_modules/@ark-ui/react/dist/utils/create-split-props.js
1451
+ var createSplitProps = () => (props2, keys) => keys.reduce(
1452
+ (previousValue, currentValue) => {
1453
+ const [target, source] = previousValue;
1454
+ const key = currentValue;
1455
+ if (source[key] !== void 0) {
1456
+ target[key] = source[key];
1457
+ }
1458
+ delete source[key];
1459
+ return [target, source];
1460
+ },
1461
+ [{}, { ...props2 }]
1462
+ );
1463
+
1464
+ // ../../node_modules/@ark-ui/react/dist/components/presence/split-presence-props.js
1465
+ var splitPresenceProps = (props2) => createSplitProps()(props2, [
1466
+ "immediate",
1467
+ "lazyMount",
1468
+ "onExitComplete",
1469
+ "present",
1470
+ "unmountOnExit"
1471
+ ]);
1472
+
1473
+ // ../../node_modules/@zag-js/types/dist/index.mjs
1474
+ function createNormalizer(fn) {
1475
+ return new Proxy({}, {
1476
+ get() {
1477
+ return fn;
1478
+ }
1479
+ });
1480
+ }
1481
+ var createProps = () => (props2) => Array.from(new Set(props2));
1482
+
1483
+ // ../../node_modules/@zag-js/presence/dist/index.mjs
1484
+ function connect(state, send, _normalize) {
1485
+ const present = state.matches("mounted", "unmountSuspended");
1486
+ return {
1487
+ skip: !state.context.initial && present,
1488
+ present,
1489
+ setNode(node) {
1490
+ if (!node) return;
1491
+ send({ type: "NODE.SET", node });
1492
+ },
1493
+ unmount() {
1494
+ send({ type: "UNMOUNT" });
1495
+ }
1496
+ };
1497
+ }
1498
+ function machine(ctx) {
1499
+ return createMachine(
1500
+ {
1501
+ initial: ctx.present ? "mounted" : "unmounted",
1502
+ context: {
1503
+ node: null,
1504
+ styles: null,
1505
+ unmountAnimationName: null,
1506
+ prevAnimationName: null,
1507
+ present: false,
1508
+ initial: false,
1509
+ ...ctx
1510
+ },
1511
+ exit: ["clearInitial"],
1512
+ watch: {
1513
+ present: ["setInitial", "syncPresence"]
1514
+ },
1515
+ on: {
1516
+ "NODE.SET": {
1517
+ actions: ["setNode", "setStyles"]
1518
+ }
1519
+ },
1520
+ states: {
1521
+ mounted: {
1522
+ on: {
1523
+ UNMOUNT: {
1524
+ target: "unmounted",
1525
+ actions: ["invokeOnExitComplete"]
1526
+ },
1527
+ "UNMOUNT.SUSPEND": "unmountSuspended"
1528
+ }
1529
+ },
1530
+ unmountSuspended: {
1531
+ activities: ["trackAnimationEvents"],
1532
+ after: {
1533
+ // Fallback to timeout to ensure we exit this state even if the `animationend` event
1534
+ // did not get trigger
1535
+ ANIMATION_DURATION: {
1536
+ target: "unmounted",
1537
+ actions: ["invokeOnExitComplete"]
1538
+ }
1539
+ },
1540
+ on: {
1541
+ MOUNT: {
1542
+ target: "mounted",
1543
+ actions: ["setPrevAnimationName"]
1544
+ },
1545
+ UNMOUNT: {
1546
+ target: "unmounted",
1547
+ actions: ["invokeOnExitComplete"]
1548
+ }
1549
+ }
1550
+ },
1551
+ unmounted: {
1552
+ entry: ["clearPrevAnimationName"],
1553
+ on: {
1554
+ MOUNT: {
1555
+ target: "mounted",
1556
+ actions: ["setPrevAnimationName"]
1557
+ }
1558
+ }
1559
+ }
1560
+ }
1561
+ },
1562
+ {
1563
+ delays: {
1564
+ ANIMATION_DURATION(ctx2) {
1565
+ var _a, _b;
1566
+ return parseMs((_a = ctx2.styles) == null ? void 0 : _a.animationDuration) + parseMs((_b = ctx2.styles) == null ? void 0 : _b.animationDelay) + ANIMATION_TIMEOUT_MARGIN;
1567
+ }
1568
+ },
1569
+ actions: {
1570
+ setInitial(ctx2) {
1571
+ ctx2.initial = true;
1572
+ },
1573
+ clearInitial(ctx2) {
1574
+ ctx2.initial = false;
1575
+ },
1576
+ invokeOnExitComplete(ctx2) {
1577
+ var _a;
1578
+ (_a = ctx2.onExitComplete) == null ? void 0 : _a.call(ctx2);
1579
+ },
1580
+ setNode(ctx2, evt) {
1581
+ ctx2.node = ref(evt.node);
1582
+ },
1583
+ setStyles(ctx2, evt) {
1584
+ const win = evt.node.ownerDocument.defaultView || window;
1585
+ ctx2.styles = ref(win.getComputedStyle(evt.node));
1586
+ },
1587
+ syncPresence(ctx2, _evt, { send }) {
1588
+ var _a;
1589
+ if (ctx2.present) {
1590
+ send({ type: "MOUNT", src: "presence.changed" });
1591
+ return;
1592
+ }
1593
+ if (!ctx2.present && ((_a = ctx2.node) == null ? void 0 : _a.ownerDocument.visibilityState) === "hidden") {
1594
+ send({ type: "UNMOUNT", src: "visibilitychange" });
1595
+ return;
1596
+ }
1597
+ const animationName = getAnimationName(ctx2.styles);
1598
+ const exec = ctx2.immediate ? queueMicrotask : requestAnimationFrame;
1599
+ exec(() => {
1600
+ var _a2, _b;
1601
+ ctx2.unmountAnimationName = animationName;
1602
+ if (animationName === "none" || animationName === ctx2.prevAnimationName || ((_a2 = ctx2.styles) == null ? void 0 : _a2.display) === "none" || ((_b = ctx2.styles) == null ? void 0 : _b.animationDuration) === "0s") {
1603
+ send({ type: "UNMOUNT", src: "presence.changed" });
1604
+ } else {
1605
+ send({ type: "UNMOUNT.SUSPEND" });
1606
+ }
1607
+ });
1608
+ },
1609
+ setPrevAnimationName(ctx2) {
1610
+ const exec = ctx2.immediate ? queueMicrotask : requestAnimationFrame;
1611
+ exec(() => {
1612
+ ctx2.prevAnimationName = getAnimationName(ctx2.styles);
1613
+ });
1614
+ },
1615
+ clearPrevAnimationName(ctx2) {
1616
+ ctx2.prevAnimationName = null;
1617
+ }
1618
+ },
1619
+ activities: {
1620
+ trackAnimationEvents(ctx2, _evt, { send }) {
1621
+ const node = ctx2.node;
1622
+ if (!node) return;
1623
+ const onStart = (event) => {
1624
+ var _a, _b, _c;
1625
+ const target = (_c = (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) != null ? _c : event.target;
1626
+ if (target === node) {
1627
+ ctx2.prevAnimationName = getAnimationName(ctx2.styles);
1628
+ }
1629
+ };
1630
+ const onEnd = (event) => {
1631
+ var _a, _b, _c;
1632
+ const animationName = getAnimationName(ctx2.styles);
1633
+ const target = (_c = (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) != null ? _c : event.target;
1634
+ if (target === node && animationName === ctx2.unmountAnimationName) {
1635
+ send({ type: "UNMOUNT", src: "animationend" });
1636
+ }
1637
+ };
1638
+ node.addEventListener("animationstart", onStart);
1639
+ node.addEventListener("animationcancel", onEnd);
1640
+ node.addEventListener("animationend", onEnd);
1641
+ return () => {
1642
+ node.removeEventListener("animationstart", onStart);
1643
+ node.removeEventListener("animationcancel", onEnd);
1644
+ node.removeEventListener("animationend", onEnd);
1645
+ };
1646
+ }
1647
+ }
1648
+ }
1649
+ );
1650
+ }
1651
+ function getAnimationName(styles) {
1652
+ return (styles == null ? void 0 : styles.animationName) || "none";
1653
+ }
1654
+ function parseMs(value) {
1655
+ return parseFloat(value || "0") * 1e3;
1656
+ }
1657
+ var ANIMATION_TIMEOUT_MARGIN = 16.667;
1658
+ var props = createProps()(["onExitComplete", "present", "immediate"]);
1659
+
1660
+ // ../../node_modules/@zag-js/react/dist/index.mjs
1661
+ var import_react2 = __toESM(require("react"), 1);
1662
+ var import_react_dom = require("react-dom");
1663
+ var import_jsx_runtime = require("react/jsx-runtime");
1664
+ var normalizeProps = createNormalizer((v) => v);
1665
+ var isArrayLike = (value) => (value == null ? void 0 : value.constructor.name) === "Array";
1666
+ var isArrayEqual = (a, b) => {
1667
+ if (a.length !== b.length) return false;
1668
+ for (let i = 0; i < a.length; i++) {
1669
+ if (!isEqual(a[i], b[i])) return false;
1670
+ }
1671
+ return true;
1672
+ };
1673
+ var isEqual = (a, b) => {
1674
+ if (Object.is(a, b)) return true;
1675
+ if (a == null && b != null || a != null && b == null) return false;
1676
+ if (typeof (a == null ? void 0 : a.isEqual) === "function" && typeof (b == null ? void 0 : b.isEqual) === "function") {
1677
+ return a.isEqual(b);
1678
+ }
1679
+ if (typeof a === "function" && typeof b === "function") {
1680
+ return a.toString() === b.toString();
1681
+ }
1682
+ if (isArrayLike(a) && isArrayLike(b)) {
1683
+ return isArrayEqual(Array.from(a), Array.from(b));
1684
+ }
1685
+ if (!(typeof a === "object") || !(typeof b === "object")) return false;
1686
+ const keys = Object.keys(b != null ? b : /* @__PURE__ */ Object.create(null));
1687
+ const length = keys.length;
1688
+ for (let i = 0; i < length; i++) {
1689
+ const hasKey = Reflect.has(a, keys[i]);
1690
+ if (!hasKey) return false;
1691
+ }
1692
+ for (let i = 0; i < length; i++) {
1693
+ const key = keys[i];
1694
+ if (!isEqual(a[key], b[key])) return false;
1695
+ }
1696
+ return true;
1697
+ };
1698
+ var isDev3 = () => process.env.NODE_ENV !== "production";
1699
+ var fnToString2 = Function.prototype.toString;
1700
+ fnToString2.call(Object);
1701
+ function compact2(obj) {
1702
+ if (!isPlainObject3(obj) || obj === void 0) {
1703
+ return obj;
1704
+ }
1705
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
1706
+ const filtered = {};
1707
+ for (const key of keys) {
1708
+ const value = obj[key];
1709
+ if (value !== void 0) {
1710
+ filtered[key] = compact2(value);
1711
+ }
1712
+ }
1713
+ return filtered;
1714
+ }
1715
+ var isPlainObject3 = (value) => {
1716
+ return value && typeof value === "object" && value.constructor === Object;
1717
+ };
1718
+ function useUpdateEffect(callback, deps) {
1719
+ const render = (0, import_react2.useRef)(false);
1720
+ const effect = (0, import_react2.useRef)(false);
1721
+ (0, import_react2.useEffect)(() => {
1722
+ const mounted = render.current;
1723
+ const run = mounted && effect.current;
1724
+ if (run) {
1725
+ return callback();
1726
+ }
1727
+ effect.current = true;
1728
+ }, deps);
1729
+ (0, import_react2.useEffect)(() => {
1730
+ render.current = true;
1731
+ return () => {
1732
+ render.current = false;
1733
+ };
1734
+ }, []);
1735
+ }
1736
+ var { use } = import_react2.default;
1737
+ var targetCache = makeGlobal("__zag__targetCache", () => /* @__PURE__ */ new WeakMap());
1738
+ function useSnapshot(service, options) {
1739
+ const { actions, context, sync: notifyInSync } = options != null ? options : {};
1740
+ const lastSnapshot = (0, import_react2.useRef)();
1741
+ const lastAffected = (0, import_react2.useRef)();
1742
+ const currSnapshot = (0, import_react2.useSyncExternalStore)(
1743
+ (0, import_react2.useCallback)((callback) => subscribe(service.state, callback, notifyInSync), [notifyInSync]),
1744
+ () => {
1745
+ const nextSnapshot = snapshot(service.state, use);
1746
+ try {
1747
+ if (lastSnapshot.current && lastAffected.current && !isChanged(lastSnapshot.current, nextSnapshot, lastAffected.current, /* @__PURE__ */ new WeakMap())) {
1748
+ return lastSnapshot.current;
1749
+ }
1750
+ } catch {
1751
+ }
1752
+ return nextSnapshot;
1753
+ },
1754
+ () => snapshot(service.state, use)
1755
+ );
1756
+ service.setOptions({ actions });
1757
+ const ctx = (0, import_react2.useMemo)(() => compact2(context != null ? context : {}), [context]);
1758
+ useUpdateEffect(() => {
1759
+ var _a;
1760
+ const entries = Object.entries(ctx);
1761
+ const previousCtx = (_a = service.contextSnapshot) != null ? _a : {};
1762
+ const equality = entries.map(([key, value]) => ({
1763
+ key,
1764
+ curr: value,
1765
+ prev: previousCtx[key],
1766
+ equal: isEqual(previousCtx[key], value)
1767
+ }));
1768
+ const allEqual = equality.every(({ equal }) => equal);
1769
+ if (!allEqual) {
1770
+ service.setContext(ctx);
1771
+ }
1772
+ }, [ctx]);
1773
+ const currAffected = /* @__PURE__ */ new WeakMap();
1774
+ (0, import_react2.useEffect)(() => {
1775
+ lastSnapshot.current = currSnapshot;
1776
+ lastAffected.current = currAffected;
1777
+ });
1778
+ const proxyCache = (0, import_react2.useMemo)(() => /* @__PURE__ */ new WeakMap(), []);
1779
+ return createProxy(currSnapshot, currAffected, proxyCache, targetCache);
1780
+ }
1781
+ function useConstant(fn) {
1782
+ const ref2 = (0, import_react2.useRef)();
1783
+ if (!ref2.current) ref2.current = { v: fn() };
1784
+ return ref2.current.v;
1785
+ }
1786
+ var useSafeLayoutEffect = typeof document !== "undefined" ? import_react2.useLayoutEffect : import_react2.useEffect;
1787
+ function useService(machine2, options) {
1788
+ const { state: hydratedState, context } = options != null ? options : {};
1789
+ const service = useConstant(() => {
1790
+ const instance = typeof machine2 === "function" ? machine2() : machine2;
1791
+ if (context) instance.setContext(context);
1792
+ instance._created();
1793
+ return instance;
1794
+ });
1795
+ const snapshotRef = (0, import_react2.useRef)();
1796
+ useSafeLayoutEffect(() => {
1797
+ const stateInit = hydratedState != null ? hydratedState : snapshotRef.current;
1798
+ service.start(stateInit);
1799
+ return () => {
1800
+ if (isDev3()) {
1801
+ snapshotRef.current = service.getHydrationState();
1802
+ }
1803
+ service.stop();
1804
+ };
1805
+ }, []);
1806
+ return service;
1807
+ }
1808
+ function useMachine(machine2, options) {
1809
+ const service = useService(machine2, options);
1810
+ const state = useSnapshot(service, options);
1811
+ return [state, service.send, service];
1812
+ }
1813
+
1814
+ // ../../node_modules/@ark-ui/react/dist/components/presence/use-presence.js
1815
+ var import_react5 = require("react");
1816
+
1817
+ // ../../node_modules/@ark-ui/react/dist/utils/use-event.js
1818
+ var import_react3 = require("react");
1819
+ function useEvent(callback, opts = {}) {
1820
+ const { sync = false } = opts;
1821
+ const callbackRef = useLatestRef(callback);
1822
+ return (0, import_react3.useCallback)(
1823
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
1824
+ (...args) => {
1825
+ var _a;
1826
+ if (sync) return queueMicrotask(() => {
1827
+ var _a2;
1828
+ return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
1829
+ });
1830
+ return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
1831
+ },
1832
+ [sync, callbackRef]
1833
+ );
1834
+ }
1835
+ function useLatestRef(value) {
1836
+ const ref2 = (0, import_react3.useRef)(value);
1837
+ ref2.current = value;
1838
+ return ref2;
1839
+ }
1840
+
1841
+ // ../../node_modules/@ark-ui/react/dist/components/presence/use-presence.js
1842
+ var usePresence = (props2) => {
1843
+ const { lazyMount, unmountOnExit, ...rest } = props2;
1844
+ const wasEverPresent = (0, import_react5.useRef)(false);
1845
+ const context = {
1846
+ ...rest,
1847
+ onExitComplete: useEvent(props2.onExitComplete)
1848
+ };
1849
+ const [state, send] = useMachine(machine(context), { context });
1850
+ const api = connect(state, send, normalizeProps);
1851
+ if (api.present) {
1852
+ wasEverPresent.current = true;
1853
+ }
1854
+ const unmounted = !api.present && !wasEverPresent.current && lazyMount || unmountOnExit && !api.present && wasEverPresent.current;
1855
+ const getPresenceProps = () => ({
1856
+ "data-state": props2.present ? "open" : "closed",
1857
+ hidden: !api.present
1858
+ });
1859
+ return {
1860
+ ref: api.setNode,
1861
+ getPresenceProps,
1862
+ present: api.present,
1863
+ unmounted
1864
+ };
1865
+ };
1866
+
1867
+ // ../../node_modules/@ark-ui/react/dist/components/presence/presence.js
1868
+ var Presence = (0, import_react6.forwardRef)((props2, ref2) => {
1869
+ const [presenceProps, localProps] = splitPresenceProps(props2);
1870
+ const presence = usePresence(presenceProps);
1871
+ if (presence.unmounted) {
1872
+ return null;
1873
+ }
1874
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1875
+ ark.div,
1876
+ {
1877
+ ...localProps,
1878
+ ...presence.getPresenceProps(),
1879
+ "data-scope": "presence",
1880
+ "data-part": "root",
1881
+ ref: composeRefs(presence.ref, ref2)
1882
+ }
1883
+ );
1884
+ });
1885
+ Presence.displayName = "Presence";
1886
+
1887
+ // src/components/loading-overlay/loading-overlay.tsx
1888
+ var import_react9 = require("@chakra-ui/react");
1889
+
1890
+ // src/components/spinner/spinner.tsx
1891
+ var import_react7 = require("react");
1892
+ var import_react8 = require("@chakra-ui/react");
1893
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1894
+ var Spinner = (0, import_react7.forwardRef)(
1895
+ function Spinner2(props2, ref2) {
1896
+ const { loading, children, ...rest } = props2;
1897
+ if (loading === false) {
1898
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
1899
+ }
1900
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react8.Spinner, { ref: ref2, ...rest });
1901
+ }
1902
+ );
1903
+
1904
+ // src/components/loading-overlay/loading-overlay.tsx
1905
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1906
+ var { useStyles, withContext, withProvider } = (0, import_react9.createSlotRecipeContext)({
1907
+ key: "loadingOverlay"
1908
+ });
1909
+ var LoadingOverlay = (props2) => {
1910
+ const { children, loading = true, ...rest } = props2;
1911
+ const [presenceProps, rootProps] = splitPresenceProps(rest);
1912
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Presence, { present: loading, ...presenceProps, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react9.chakra.div, { ...rootProps, children }) });
1913
+ };
1914
+ var LoadingOverlayRoot = withProvider(LoadingOverlay, "root");
1915
+ LoadingOverlayRoot.displayName = "LoadingOverlay";
1916
+ var LoadingOverlaySpinner = Spinner;
1917
+ var LoadingOverlayText = withContext("p", "text");
1918
+ // Annotate the CommonJS export names for ESM import in node:
1919
+ 0 && (module.exports = {
1920
+ LoadingOverlay
1921
+ });