@ariakit/react 0.4.26 → 0.4.27

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 (319) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/cjs/__chunks/2HXQHKBC.cjs +59 -0
  3. package/cjs/__chunks/2MDC3Z3V.cjs +43 -0
  4. package/cjs/__chunks/334WKW6I.cjs +19 -0
  5. package/cjs/__chunks/34UJGLOZ.cjs +236 -0
  6. package/cjs/__chunks/3FIXGHZ2.cjs +59 -0
  7. package/cjs/__chunks/4RKQMGBK.cjs +1179 -0
  8. package/cjs/__chunks/5NTEPQ2U.cjs +148 -0
  9. package/cjs/__chunks/66G6K4UR.cjs +1 -0
  10. package/cjs/__chunks/6GNM57O7.cjs +1 -0
  11. package/cjs/__chunks/7M4GY5DS.cjs +255 -0
  12. package/cjs/__chunks/7MXJT4IN.cjs +17 -0
  13. package/cjs/__chunks/7POA4244.cjs +184 -0
  14. package/cjs/__chunks/ASOIXRUN.cjs +305 -0
  15. package/cjs/__chunks/C4NVIV6V.cjs +455 -0
  16. package/cjs/__chunks/CR6AS7WL.cjs +1 -0
  17. package/cjs/__chunks/D4HCGWOU.cjs +464 -0
  18. package/cjs/__chunks/DVWS2XPY.cjs +107 -0
  19. package/cjs/__chunks/DWSXHZYM.cjs +20 -0
  20. package/cjs/__chunks/E6EV2Q5P.cjs +1 -0
  21. package/cjs/__chunks/FELYQPO5.cjs +1025 -0
  22. package/cjs/__chunks/FHQ5DVYQ.cjs +34 -0
  23. package/cjs/__chunks/FIPBE5IX.cjs +23 -0
  24. package/cjs/__chunks/FVIS5BFZ.cjs +41 -0
  25. package/cjs/__chunks/GUB6WHB6.cjs +51 -0
  26. package/cjs/__chunks/GUY4MKX2.cjs +56 -0
  27. package/cjs/__chunks/IF5DZKAR.cjs +1 -0
  28. package/cjs/__chunks/IFZV5LA3.cjs +94 -0
  29. package/cjs/__chunks/IHVFJGGN.cjs +32 -0
  30. package/cjs/__chunks/L2IFVMDU.cjs +96 -0
  31. package/cjs/__chunks/LCX235VJ.cjs +53 -0
  32. package/cjs/__chunks/LMCBLO3G.cjs +42 -0
  33. package/cjs/__chunks/LS5VO6AA.cjs +44 -0
  34. package/cjs/__chunks/LVHC4DSB.cjs +117 -0
  35. package/cjs/__chunks/MN5TONXW.cjs +123 -0
  36. package/cjs/__chunks/N3DLR7OL.cjs +34 -0
  37. package/cjs/__chunks/NFZWL7LE.cjs +24 -0
  38. package/cjs/__chunks/NG34QRI6.cjs +264 -0
  39. package/cjs/__chunks/NIOJG7C4.cjs +1 -0
  40. package/cjs/__chunks/NMUCJYMR.cjs +496 -0
  41. package/cjs/__chunks/OOFUBC32.cjs +109 -0
  42. package/cjs/__chunks/OQRQJNBU.cjs +1 -0
  43. package/cjs/__chunks/PDPE2VAZ.cjs +1035 -0
  44. package/cjs/__chunks/PTE2IJM5.cjs +143 -0
  45. package/cjs/__chunks/PU63IQFD.cjs +447 -0
  46. package/cjs/__chunks/PZXRBFZF.cjs +38 -0
  47. package/cjs/__chunks/QAUJZR6Y.cjs +996 -0
  48. package/cjs/__chunks/QYDAT3QF.cjs +1 -0
  49. package/cjs/__chunks/QYLMYWKV.cjs +1 -0
  50. package/cjs/__chunks/RGH2H3WL.cjs +34 -0
  51. package/cjs/__chunks/RLKC7JVT.cjs +19 -0
  52. package/cjs/__chunks/RR46KI45.cjs +17 -0
  53. package/cjs/__chunks/RVXPEX7O.cjs +150 -0
  54. package/cjs/__chunks/RXZPZPJX.cjs +95 -0
  55. package/cjs/__chunks/SIF7IN4L.cjs +62 -0
  56. package/cjs/__chunks/SQ72MZ63.cjs +294 -0
  57. package/cjs/__chunks/SXAPGTJ4.cjs +23 -0
  58. package/cjs/__chunks/TLUFYZC7.cjs +37 -0
  59. package/cjs/__chunks/TSBEWPNT.cjs +1922 -0
  60. package/cjs/__chunks/U2UYQT45.cjs +1 -0
  61. package/cjs/__chunks/UUEFM3TG.cjs +75 -0
  62. package/cjs/__chunks/UV7CXZEM.cjs +36 -0
  63. package/cjs/__chunks/VXDLN5CP.cjs +234 -0
  64. package/cjs/__chunks/VXUZM542.cjs +789 -0
  65. package/cjs/__chunks/W27WRDUB.cjs +1 -0
  66. package/cjs/__chunks/X4U3XKYQ.cjs +7 -0
  67. package/cjs/__chunks/XH4GE3VE.cjs +29 -0
  68. package/cjs/__chunks/XPQIHUQ7.cjs +172 -0
  69. package/cjs/__chunks/YEXJT4IL.cjs +55 -0
  70. package/cjs/__chunks/Z5PDS46M.cjs +975 -0
  71. package/cjs/__chunks/ZNW2LLWJ.cjs +108 -0
  72. package/cjs/__chunks/ZYPARRXG.cjs +19 -0
  73. package/cjs/button.cjs +7 -3
  74. package/cjs/button.d.cts +2 -2
  75. package/cjs/button.d.ts +2 -2
  76. package/cjs/checkbox.cjs +11 -2
  77. package/cjs/checkbox.d.cts +9 -9
  78. package/cjs/checkbox.d.ts +9 -9
  79. package/cjs/collection.cjs +8 -2
  80. package/cjs/collection.d.cts +9 -9
  81. package/cjs/collection.d.ts +9 -9
  82. package/cjs/combobox.cjs +33 -2
  83. package/cjs/combobox.d.cts +33 -33
  84. package/cjs/combobox.d.ts +33 -33
  85. package/cjs/command.cjs +6 -3
  86. package/cjs/command.d.cts +2 -2
  87. package/cjs/command.d.ts +2 -2
  88. package/cjs/composite.cjs +24 -2
  89. package/cjs/composite.d.cts +21 -21
  90. package/cjs/composite.d.ts +21 -21
  91. package/cjs/dialog.cjs +24 -2
  92. package/cjs/dialog.d.cts +15 -15
  93. package/cjs/dialog.d.ts +15 -15
  94. package/cjs/disclosure.cjs +11 -2
  95. package/cjs/disclosure.d.cts +9 -9
  96. package/cjs/disclosure.d.ts +9 -9
  97. package/cjs/focus-trap.cjs +6 -2
  98. package/cjs/focus-trap.d.cts +4 -4
  99. package/cjs/focus-trap.d.ts +4 -4
  100. package/cjs/focusable.cjs +5 -3
  101. package/cjs/focusable.d.cts +2 -2
  102. package/cjs/focusable.d.ts +2 -2
  103. package/cjs/form.cjs +15 -2
  104. package/cjs/form.d.cts +37 -37
  105. package/cjs/form.d.ts +37 -37
  106. package/cjs/group.cjs +5 -3
  107. package/cjs/group.d.cts +4 -4
  108. package/cjs/group.d.ts +4 -4
  109. package/cjs/heading.cjs +7 -3
  110. package/cjs/heading.d.cts +4 -4
  111. package/cjs/heading.d.ts +4 -4
  112. package/cjs/hovercard.cjs +28 -2
  113. package/cjs/hovercard.d.cts +19 -19
  114. package/cjs/hovercard.d.ts +19 -19
  115. package/cjs/index.cjs +103 -28
  116. package/cjs/menu.cjs +44 -2
  117. package/cjs/menu.d.cts +41 -41
  118. package/cjs/menu.d.ts +41 -41
  119. package/cjs/menubar.cjs +10 -3
  120. package/cjs/menubar.d.cts +7 -7
  121. package/cjs/menubar.d.ts +7 -7
  122. package/cjs/popover.cjs +33 -2
  123. package/cjs/popover.d.cts +21 -21
  124. package/cjs/popover.d.ts +21 -21
  125. package/cjs/portal.cjs +7 -3
  126. package/cjs/portal.d.cts +3 -3
  127. package/cjs/portal.d.ts +3 -3
  128. package/cjs/radio.cjs +13 -2
  129. package/cjs/radio.d.cts +9 -9
  130. package/cjs/radio.d.ts +9 -9
  131. package/cjs/role.cjs +5 -3
  132. package/cjs/role.d.cts +2 -2
  133. package/cjs/role.d.ts +2 -2
  134. package/cjs/select.cjs +39 -2
  135. package/cjs/select.d.cts +33 -33
  136. package/cjs/select.d.ts +33 -33
  137. package/cjs/separator.cjs +5 -3
  138. package/cjs/separator.d.cts +2 -2
  139. package/cjs/separator.d.ts +2 -2
  140. package/cjs/store.cjs +5 -3
  141. package/cjs/store.d.cts +1 -1
  142. package/cjs/store.d.ts +1 -1
  143. package/cjs/tab.cjs +15 -2
  144. package/cjs/tab.d.cts +11 -11
  145. package/cjs/tab.d.ts +11 -11
  146. package/cjs/toolbar.cjs +13 -2
  147. package/cjs/toolbar.d.cts +15 -15
  148. package/cjs/toolbar.d.ts +15 -15
  149. package/cjs/tooltip.cjs +16 -2
  150. package/cjs/tooltip.d.cts +11 -11
  151. package/cjs/tooltip.d.ts +11 -11
  152. package/cjs/visually-hidden.cjs +5 -3
  153. package/cjs/visually-hidden.d.cts +2 -2
  154. package/cjs/visually-hidden.d.ts +2 -2
  155. package/esm/__chunks/2RKMXQTW.js +10 -0
  156. package/esm/__chunks/3Y4V2DTP.js +8 -0
  157. package/esm/__chunks/5FGJT4YF.js +10 -0
  158. package/esm/__chunks/ASWYYI35.js +26 -0
  159. package/esm/__chunks/BCX2X2B5.js +40 -0
  160. package/esm/__chunks/BLUBZ7NO.js +28 -0
  161. package/esm/__chunks/CKEWLSMJ.js +8 -0
  162. package/esm/__chunks/CSCX5ZBZ.js +40 -0
  163. package/esm/__chunks/CTJDBGJU.js +18 -0
  164. package/esm/__chunks/DAO5N24L.js +16 -0
  165. package/esm/__chunks/E3G6CWS6.js +16 -0
  166. package/esm/__chunks/IVVNCX6W.js +16 -0
  167. package/esm/__chunks/LQB76ROL.js +16 -0
  168. package/esm/__chunks/MALDUIAO.js +28 -0
  169. package/esm/__chunks/MP5ILXF3.js +14 -0
  170. package/esm/__chunks/O3FPWSHV.js +10 -0
  171. package/esm/__chunks/OKEWM6H4.js +10 -0
  172. package/esm/__chunks/QL3WKMBE.js +8 -0
  173. package/esm/__chunks/RD2DI27Y.js +44 -0
  174. package/esm/__chunks/SB7MN4B3.js +22 -0
  175. package/esm/__chunks/UA4GRLAL.js +52 -0
  176. package/esm/__chunks/UBB5N3OM.js +22 -0
  177. package/esm/__chunks/WC6KFHZH.js +8 -0
  178. package/esm/__chunks/WFREFNZD.js +8 -0
  179. package/esm/__chunks/WH35KJXV.js +8 -0
  180. package/esm/__chunks/WQKZESWL.js +18 -0
  181. package/esm/__chunks/YAS6EMRP.js +8 -0
  182. package/esm/button.d.ts +2 -2
  183. package/esm/button.js +1 -1
  184. package/esm/checkbox.d.ts +9 -9
  185. package/esm/checkbox.js +1 -1
  186. package/esm/collection.d.ts +9 -9
  187. package/esm/collection.js +1 -1
  188. package/esm/combobox.d.ts +33 -33
  189. package/esm/combobox.js +1 -1
  190. package/esm/command.d.ts +2 -2
  191. package/esm/command.js +1 -1
  192. package/esm/composite.d.ts +21 -21
  193. package/esm/composite.js +1 -1
  194. package/esm/dialog.d.ts +15 -15
  195. package/esm/dialog.js +1 -1
  196. package/esm/disclosure.d.ts +9 -9
  197. package/esm/disclosure.js +1 -1
  198. package/esm/focus-trap.d.ts +4 -4
  199. package/esm/focus-trap.js +1 -1
  200. package/esm/focusable.d.ts +2 -2
  201. package/esm/focusable.js +1 -1
  202. package/esm/form.d.ts +37 -37
  203. package/esm/form.js +1 -1
  204. package/esm/group.d.ts +4 -4
  205. package/esm/group.js +1 -1
  206. package/esm/heading.d.ts +4 -4
  207. package/esm/heading.js +1 -1
  208. package/esm/hovercard.d.ts +19 -19
  209. package/esm/hovercard.js +1 -1
  210. package/esm/index.js +27 -27
  211. package/esm/menu.d.ts +41 -41
  212. package/esm/menu.js +1 -1
  213. package/esm/menubar.d.ts +7 -7
  214. package/esm/menubar.js +1 -1
  215. package/esm/popover.d.ts +21 -21
  216. package/esm/popover.js +1 -1
  217. package/esm/portal.d.ts +3 -3
  218. package/esm/portal.js +1 -1
  219. package/esm/radio.d.ts +9 -9
  220. package/esm/radio.js +1 -1
  221. package/esm/role.d.ts +2 -2
  222. package/esm/role.js +1 -1
  223. package/esm/select.d.ts +33 -33
  224. package/esm/select.js +1 -1
  225. package/esm/separator.d.ts +2 -2
  226. package/esm/separator.js +1 -1
  227. package/esm/store.d.ts +1 -1
  228. package/esm/store.js +1 -1
  229. package/esm/tab.d.ts +11 -11
  230. package/esm/tab.js +1 -1
  231. package/esm/toolbar.d.ts +15 -15
  232. package/esm/toolbar.js +1 -1
  233. package/esm/tooltip.d.ts +11 -11
  234. package/esm/tooltip.js +1 -1
  235. package/esm/visually-hidden.d.ts +2 -2
  236. package/esm/visually-hidden.js +1 -1
  237. package/package.json +2 -2
  238. package/src/button.ts +5 -0
  239. package/src/checkbox.ts +19 -0
  240. package/src/collection.ts +19 -0
  241. package/src/combobox.ts +76 -0
  242. package/src/command.ts +5 -0
  243. package/src/composite.ts +49 -0
  244. package/src/dialog.ts +34 -0
  245. package/src/disclosure.ts +19 -0
  246. package/src/focus-trap.ts +11 -0
  247. package/src/focusable.ts +5 -0
  248. package/src/form.ts +90 -0
  249. package/src/group.ts +10 -0
  250. package/src/heading.ts +7 -0
  251. package/src/hovercard.ts +44 -0
  252. package/src/index.ts +27 -0
  253. package/src/menu.ts +100 -0
  254. package/src/menubar.ts +14 -0
  255. package/src/popover.ts +49 -0
  256. package/src/portal.ts +6 -0
  257. package/src/radio.ts +19 -0
  258. package/src/role.ts +5 -0
  259. package/src/select.ts +76 -0
  260. package/src/separator.ts +5 -0
  261. package/src/store.ts +1 -0
  262. package/src/tab.ts +21 -0
  263. package/src/toolbar.ts +34 -0
  264. package/src/tooltip.ts +24 -0
  265. package/src/visually-hidden.ts +5 -0
  266. package/cjs/__chunks/24MX6KII.cjs +0 -14
  267. package/cjs/__chunks/2IFRJ7YS.cjs +0 -6
  268. package/cjs/__chunks/32YVOHOP.cjs +0 -50
  269. package/cjs/__chunks/4BAIAF3U.cjs +0 -14
  270. package/cjs/__chunks/4J2CIZDN.cjs +0 -14
  271. package/cjs/__chunks/4TTUYQMJ.cjs +0 -20
  272. package/cjs/__chunks/6QAXTQNM.cjs +0 -16
  273. package/cjs/__chunks/6WNPYLAU.cjs +0 -6
  274. package/cjs/__chunks/A2CP2RQF.cjs +0 -24
  275. package/cjs/__chunks/AEV4Y6LH.cjs +0 -8
  276. package/cjs/__chunks/APHGV4DJ.cjs +0 -6
  277. package/cjs/__chunks/B34XK6WF.cjs +0 -8
  278. package/cjs/__chunks/BFD7ZBIV.cjs +0 -26
  279. package/cjs/__chunks/CZIDOP5N.cjs +0 -38
  280. package/cjs/__chunks/ETUDK33Z.cjs +0 -26
  281. package/cjs/__chunks/GJC4LCYO.cjs +0 -16
  282. package/cjs/__chunks/KGVA5X7R.cjs +0 -38
  283. package/cjs/__chunks/LAX4QA6C.cjs +0 -42
  284. package/cjs/__chunks/MDOKA7B5.cjs +0 -6
  285. package/cjs/__chunks/Q2GGGIV7.cjs +0 -6
  286. package/cjs/__chunks/QKCQWENM.cjs +0 -6
  287. package/cjs/__chunks/QPSUJCLN.cjs +0 -12
  288. package/cjs/__chunks/TDX6HS73.cjs +0 -8
  289. package/cjs/__chunks/UPMOBIQ3.cjs +0 -20
  290. package/cjs/__chunks/W6XMZ4GT.cjs +0 -14
  291. package/cjs/__chunks/WXEUE6MJ.cjs +0 -6
  292. package/cjs/__chunks/XTZIX6PF.cjs +0 -8
  293. package/esm/__chunks/3IMSX6M3.js +0 -8
  294. package/esm/__chunks/4H6IIOQF.js +0 -22
  295. package/esm/__chunks/5OF2JM6T.js +0 -16
  296. package/esm/__chunks/6FL2IFMJ.js +0 -16
  297. package/esm/__chunks/6N4GEF7O.js +0 -18
  298. package/esm/__chunks/6OHDLPN7.js +0 -8
  299. package/esm/__chunks/7FQAKYJR.js +0 -26
  300. package/esm/__chunks/AJMZU3YP.js +0 -28
  301. package/esm/__chunks/DZPSY7QT.js +0 -22
  302. package/esm/__chunks/H2GJECQG.js +0 -8
  303. package/esm/__chunks/JBAWBCWC.js +0 -8
  304. package/esm/__chunks/LI3X5M2M.js +0 -8
  305. package/esm/__chunks/NV5BVS3O.js +0 -8
  306. package/esm/__chunks/PGIWSRTG.js +0 -28
  307. package/esm/__chunks/PRYHFEBA.js +0 -10
  308. package/esm/__chunks/UTW5KHW6.js +0 -16
  309. package/esm/__chunks/VGHCPDMA.js +0 -8
  310. package/esm/__chunks/VHD2YK6B.js +0 -18
  311. package/esm/__chunks/WA3BE3AY.js +0 -10
  312. package/esm/__chunks/XHSNLTYJ.js +0 -10
  313. package/esm/__chunks/XIMRDTWX.js +0 -14
  314. package/esm/__chunks/YQF2RGHD.js +0 -44
  315. package/esm/__chunks/ZDPYYVJP.js +0 -40
  316. package/esm/__chunks/ZFJPKQV6.js +0 -52
  317. package/esm/__chunks/ZL4AJIDL.js +0 -10
  318. package/esm/__chunks/ZQSDMYJA.js +0 -16
  319. package/esm/__chunks/ZVIXWGHS.js +0 -40
@@ -0,0 +1,1035 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _VXDLN5CPcjs = require('./VXDLN5CP.cjs');
4
+
5
+
6
+ var _LCX235VJcjs = require('./LCX235VJ.cjs');
7
+
8
+
9
+ var _DWSXHZYMcjs = require('./DWSXHZYM.cjs');
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+ var _7M4GY5DScjs = require('./7M4GY5DS.cjs');
21
+
22
+
23
+
24
+
25
+ var _D4HCGWOUcjs = require('./D4HCGWOU.cjs');
26
+
27
+
28
+
29
+ var _NG34QRI6cjs = require('./NG34QRI6.cjs');
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+ var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
56
+
57
+ // ../ariakit-components/dist/dialog/dialog-store.js
58
+ function createDialogStore(props = {}) {
59
+ return _7M4GY5DScjs.createDisclosureStore.call(void 0, props);
60
+ }
61
+
62
+ // ../ariakit-react-components/dist/dialog/dialog-store.js
63
+ function useDialogStoreProps(store, update, props) {
64
+ return _7M4GY5DScjs.useDisclosureStoreProps.call(void 0, store, update, props);
65
+ }
66
+ function useDialogStore(props = {}) {
67
+ const [store, update] = _D4HCGWOUcjs.useStore.call(void 0, createDialogStore, props);
68
+ return useDialogStoreProps(store, update, props);
69
+ }
70
+
71
+ // ../ariakit-react-components/dist/focusable/focusable-container.js
72
+ var _jsxruntime = require('react/jsx-runtime');
73
+ var TagName = "div";
74
+ var useFocusableContainer = _QAUJZR6Ycjs.createHook.call(void 0, function useFocusableContainer2({ autoFocusOnShow = true, ...props }) {
75
+ props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _NG34QRI6cjs.FocusableContext.Provider, {
76
+ value: autoFocusOnShow,
77
+ children: element
78
+ }), [autoFocusOnShow]);
79
+ return props;
80
+ });
81
+ var FocusableContainer = _QAUJZR6Ycjs.forwardRef.call(void 0, function FocusableContainer2(props) {
82
+ return _QAUJZR6Ycjs.createElement.call(void 0, TagName, useFocusableContainer(props));
83
+ });
84
+
85
+ // ../ariakit-react-components/dist/dialog/utils/orchestrate.js
86
+ var cleanups = /* @__PURE__ */ new WeakMap();
87
+ function orchestrate(element, key, setup) {
88
+ if (!cleanups.has(element)) cleanups.set(element, /* @__PURE__ */ new Map());
89
+ const elementCleanups = cleanups.get(element);
90
+ const prevCleanup = elementCleanups.get(key);
91
+ if (!prevCleanup) {
92
+ elementCleanups.set(key, setup());
93
+ return () => {
94
+ var _a;
95
+ (_a = elementCleanups.get(key)) == null ? void 0 : _a();
96
+ elementCleanups.delete(key);
97
+ };
98
+ }
99
+ const cleanup = setup();
100
+ const nextCleanup = () => {
101
+ cleanup();
102
+ prevCleanup();
103
+ elementCleanups.delete(key);
104
+ };
105
+ elementCleanups.set(key, nextCleanup);
106
+ return () => {
107
+ if (!(elementCleanups.get(key) === nextCleanup)) return;
108
+ cleanup();
109
+ elementCleanups.set(key, prevCleanup);
110
+ };
111
+ }
112
+ function setAttribute(element, attr, value) {
113
+ const setup = () => {
114
+ const previousValue = element.getAttribute(attr);
115
+ element.setAttribute(attr, value);
116
+ return () => {
117
+ if (previousValue == null) element.removeAttribute(attr);
118
+ else element.setAttribute(attr, previousValue);
119
+ };
120
+ };
121
+ return orchestrate(element, attr, setup);
122
+ }
123
+ function setProperty(element, property, value) {
124
+ const setup = () => {
125
+ const exists = property in element;
126
+ const previousValue = element[property];
127
+ element[property] = value;
128
+ return () => {
129
+ if (!exists) delete element[property];
130
+ else element[property] = previousValue;
131
+ };
132
+ };
133
+ return orchestrate(element, property, setup);
134
+ }
135
+ function assignStyle(element, style) {
136
+ if (!element) return () => {
137
+ };
138
+ const setup = () => {
139
+ const prevStyle = element.style.cssText;
140
+ Object.assign(element.style, style);
141
+ return () => {
142
+ element.style.cssText = prevStyle;
143
+ };
144
+ };
145
+ return orchestrate(element, "style", setup);
146
+ }
147
+ function setCSSProperty(element, property, value) {
148
+ if (!element) return () => {
149
+ };
150
+ const setup = () => {
151
+ const previousValue = element.style.getPropertyValue(property);
152
+ element.style.setProperty(property, value);
153
+ return () => {
154
+ if (previousValue) element.style.setProperty(property, previousValue);
155
+ else element.style.removeProperty(property);
156
+ };
157
+ };
158
+ return orchestrate(element, property, setup);
159
+ }
160
+
161
+ // ../ariakit-react-components/dist/dialog/utils/walk-tree-outside.js
162
+ var ignoreTags = ["SCRIPT", "STYLE"];
163
+ function getSnapshotPropertyName(id) {
164
+ return `__ariakit-dialog-snapshot-${id}`;
165
+ }
166
+ function inSnapshot(id, element) {
167
+ const doc = _QAUJZR6Ycjs.getDocument.call(void 0, element);
168
+ const propertyName = getSnapshotPropertyName(id);
169
+ if (!doc.body[propertyName]) return true;
170
+ do {
171
+ if (element === doc.body) return false;
172
+ if (element[propertyName]) return true;
173
+ if (!element.parentElement) return false;
174
+ element = element.parentElement;
175
+ } while (true);
176
+ }
177
+ function isValidElement(id, element, ignoredElements) {
178
+ if (ignoreTags.includes(element.tagName)) return false;
179
+ if (!inSnapshot(id, element)) return false;
180
+ return !ignoredElements.some((enabledElement) => enabledElement && _QAUJZR6Ycjs.contains.call(void 0, element, enabledElement));
181
+ }
182
+ function walkTreeOutside(id, elements, callback, ancestorCallback) {
183
+ for (let element of elements) {
184
+ if (!(element == null ? void 0 : element.isConnected)) continue;
185
+ const hasAncestorAlready = elements.some((maybeAncestor) => {
186
+ if (!maybeAncestor) return false;
187
+ if (maybeAncestor === element) return false;
188
+ return maybeAncestor.contains(element);
189
+ });
190
+ const doc = _QAUJZR6Ycjs.getDocument.call(void 0, element);
191
+ const originalElement = element;
192
+ while (element.parentElement && element !== doc.body) {
193
+ ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement, originalElement);
194
+ if (!hasAncestorAlready) {
195
+ for (const child of element.parentElement.children) if (isValidElement(id, child, elements)) callback(child, originalElement);
196
+ }
197
+ element = element.parentElement;
198
+ }
199
+ }
200
+ }
201
+ function createWalkTreeSnapshot(id, elements) {
202
+ const { body } = _QAUJZR6Ycjs.getDocument.call(void 0, elements[0]);
203
+ const cleanups2 = [];
204
+ const markElement2 = (element) => {
205
+ cleanups2.push(setProperty(element, getSnapshotPropertyName(id), true));
206
+ };
207
+ walkTreeOutside(id, elements, markElement2);
208
+ return _QAUJZR6Ycjs.chain.call(void 0, setProperty(body, getSnapshotPropertyName(id), true), () => {
209
+ for (const cleanup of cleanups2) cleanup();
210
+ });
211
+ }
212
+
213
+ // ../ariakit-react-components/dist/dialog/utils/is-backdrop.js
214
+ function isBackdrop(element, ...ids) {
215
+ if (!element) return false;
216
+ const backdrop = element.getAttribute("data-backdrop");
217
+ if (backdrop == null) return false;
218
+ if (backdrop === "") return true;
219
+ if (backdrop === "true") return true;
220
+ if (!ids.length) return true;
221
+ return ids.some((id) => backdrop === id);
222
+ }
223
+
224
+ // ../ariakit-react-components/dist/dialog/utils/mark-tree-outside.js
225
+ function getPropertyName(id = "", ancestor = false) {
226
+ return `__ariakit-dialog-${ancestor ? "ancestor" : "outside"}${id ? `-${id}` : ""}`;
227
+ }
228
+ function markElement(element, id = "") {
229
+ return _QAUJZR6Ycjs.chain.call(void 0, setProperty(element, getPropertyName(), true), setProperty(element, getPropertyName(id), true));
230
+ }
231
+ function markAncestor(element, id = "") {
232
+ return _QAUJZR6Ycjs.chain.call(void 0, setProperty(element, getPropertyName("", true), true), setProperty(element, getPropertyName(id, true), true));
233
+ }
234
+ function isElementMarked(element, id) {
235
+ const ancestorProperty = getPropertyName(id, true);
236
+ if (element[ancestorProperty]) return true;
237
+ const elementProperty = getPropertyName(id);
238
+ do {
239
+ if (element[elementProperty]) return true;
240
+ if (!element.parentElement) return false;
241
+ element = element.parentElement;
242
+ } while (true);
243
+ }
244
+ function markTreeOutside(id, elements) {
245
+ const cleanups2 = [];
246
+ const ids = elements.map((el) => el == null ? void 0 : el.id);
247
+ walkTreeOutside(id, elements, (element) => {
248
+ if (isBackdrop(element, ...ids)) return;
249
+ cleanups2.unshift(markElement(element, id));
250
+ }, (ancestor, element) => {
251
+ if (element.hasAttribute("data-dialog") && element.id !== id) return;
252
+ cleanups2.unshift(markAncestor(ancestor, id));
253
+ });
254
+ const restoreAccessibilityTree = () => {
255
+ for (const cleanup of cleanups2) cleanup();
256
+ };
257
+ return restoreAccessibilityTree;
258
+ }
259
+
260
+ // ../ariakit-react-components/dist/dialog/dialog-backdrop.js
261
+ var _react = require('react');
262
+
263
+ function DialogBackdrop({ store, backdrop, alwaysVisible, hidden }) {
264
+ const ref = _react.useRef.call(void 0, null);
265
+ const disclosure = _7M4GY5DScjs.useDisclosureStore.call(void 0, { disclosure: store });
266
+ const contentElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "contentElement");
267
+ _react.useEffect.call(void 0, () => {
268
+ const backdrop2 = ref.current;
269
+ const dialog = contentElement;
270
+ if (!backdrop2) return;
271
+ if (!dialog) return;
272
+ backdrop2.style.zIndex = getComputedStyle(dialog).zIndex;
273
+ }, [contentElement]);
274
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
275
+ const id = contentElement == null ? void 0 : contentElement.id;
276
+ if (!id) return;
277
+ const backdrop2 = ref.current;
278
+ if (!backdrop2) return;
279
+ return markAncestor(backdrop2, id);
280
+ }, [contentElement]);
281
+ const props = _7M4GY5DScjs.useDisclosureContent.call(void 0, {
282
+ ref,
283
+ store: disclosure,
284
+ role: "presentation",
285
+ "data-backdrop": (contentElement == null ? void 0 : contentElement.id) || "",
286
+ alwaysVisible,
287
+ hidden: hidden != null ? hidden : void 0,
288
+ style: {
289
+ position: "fixed",
290
+ top: 0,
291
+ right: 0,
292
+ bottom: 0,
293
+ left: 0
294
+ }
295
+ });
296
+ if (!backdrop) return null;
297
+ if (_react.isValidElement.call(void 0, backdrop)) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LCX235VJcjs.Role, {
298
+ ...props,
299
+ render: backdrop
300
+ });
301
+ const Component = typeof backdrop !== "boolean" ? backdrop : "div";
302
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LCX235VJcjs.Role, {
303
+ ...props,
304
+ render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, {})
305
+ });
306
+ }
307
+
308
+ // ../ariakit-react-components/dist/dialog/utils/supports-inert.js
309
+ function supportsInert() {
310
+ return "inert" in HTMLElement.prototype;
311
+ }
312
+
313
+ // ../ariakit-react-components/dist/dialog/utils/disable-accessibility-tree-outside.js
314
+ function hideElementFromAccessibilityTree(element) {
315
+ return setAttribute(element, "aria-hidden", "true");
316
+ }
317
+
318
+ // ../ariakit-react-components/dist/dialog/utils/is-focus-trap.js
319
+ function isFocusTrap(element, ...ids) {
320
+ if (!element) return false;
321
+ const attr = element.getAttribute("data-focus-trap");
322
+ if (attr == null) return false;
323
+ if (!ids.length) return true;
324
+ if (attr === "") return false;
325
+ return ids.some((id) => attr === id);
326
+ }
327
+
328
+ // ../ariakit-react-components/dist/dialog/utils/disable-tree.js
329
+ function disableTree(element, ignoredElements) {
330
+ if (!("style" in element)) return _QAUJZR6Ycjs.noop;
331
+ if (supportsInert()) return setProperty(element, "inert", true);
332
+ return _QAUJZR6Ycjs.chain.call(void 0, ..._QAUJZR6Ycjs.getAllTabbableIn.call(void 0, element, true).map((element2) => {
333
+ if (ignoredElements == null ? void 0 : ignoredElements.some((el) => el && _QAUJZR6Ycjs.contains.call(void 0, el, element2))) return _QAUJZR6Ycjs.noop;
334
+ const restoreFocusMethod = orchestrate(element2, "focus", () => {
335
+ element2.focus = _QAUJZR6Ycjs.noop;
336
+ return () => {
337
+ delete element2.focus;
338
+ };
339
+ });
340
+ return _QAUJZR6Ycjs.chain.call(void 0, setAttribute(element2, "tabindex", "-1"), restoreFocusMethod);
341
+ }), hideElementFromAccessibilityTree(element), assignStyle(element, {
342
+ pointerEvents: "none",
343
+ userSelect: "none",
344
+ cursor: "default"
345
+ }));
346
+ }
347
+ function disableTreeOutside(id, elements) {
348
+ const cleanups2 = [];
349
+ const ids = elements.map((el) => el == null ? void 0 : el.id);
350
+ walkTreeOutside(id, elements, (element) => {
351
+ if (isBackdrop(element, ...ids)) return;
352
+ if (isFocusTrap(element, ...ids)) return;
353
+ cleanups2.unshift(disableTree(element, elements));
354
+ }, (element) => {
355
+ if (!element.hasAttribute("role")) return;
356
+ if (elements.some((el) => el && _QAUJZR6Ycjs.contains.call(void 0, el, element))) return;
357
+ cleanups2.unshift(setAttribute(element, "role", "none"));
358
+ });
359
+ const restoreTreeOutside = () => {
360
+ for (const cleanup of cleanups2) cleanup();
361
+ };
362
+ return restoreTreeOutside;
363
+ }
364
+
365
+ // ../ariakit-react-components/dist/dialog/utils/prepend-hidden-dismiss.js
366
+ function prependHiddenDismiss(container, onClick) {
367
+ const button = _QAUJZR6Ycjs.getDocument.call(void 0, container).createElement("button");
368
+ button.type = "button";
369
+ button.tabIndex = -1;
370
+ button.textContent = "Dismiss popup";
371
+ Object.assign(button.style, {
372
+ border: "0px",
373
+ clip: "rect(0 0 0 0)",
374
+ height: "1px",
375
+ margin: "-1px",
376
+ overflow: "hidden",
377
+ padding: "0px",
378
+ position: "absolute",
379
+ whiteSpace: "nowrap",
380
+ width: "1px"
381
+ });
382
+ button.addEventListener("click", onClick);
383
+ container.prepend(button);
384
+ const removeHiddenDismiss = () => {
385
+ button.removeEventListener("click", onClick);
386
+ button.remove();
387
+ };
388
+ return removeHiddenDismiss;
389
+ }
390
+
391
+ // ../ariakit-react-components/dist/dialog/utils/use-previous-mouse-down-ref.js
392
+
393
+ function usePreviousMouseDownRef(enabled, scope) {
394
+ const previousMouseDownRef = _react.useRef.call(void 0, null);
395
+ _react.useEffect.call(void 0, () => {
396
+ if (!enabled) {
397
+ previousMouseDownRef.current = null;
398
+ return;
399
+ }
400
+ const onMouseDown = (event) => {
401
+ previousMouseDownRef.current = event.target;
402
+ };
403
+ return _QAUJZR6Ycjs.addGlobalEventListener.call(void 0, "mousedown", onMouseDown, true, scope);
404
+ }, [enabled, scope]);
405
+ return previousMouseDownRef;
406
+ }
407
+
408
+ // ../ariakit-react-components/dist/dialog/utils/use-hide-on-interact-outside.js
409
+
410
+ function isInDocument(target) {
411
+ if (target.tagName === "HTML") return true;
412
+ return _QAUJZR6Ycjs.contains.call(void 0, _QAUJZR6Ycjs.getDocument.call(void 0, target).body, target);
413
+ }
414
+ function isDisclosure(disclosure, target) {
415
+ if (!disclosure) return false;
416
+ if (_QAUJZR6Ycjs.contains.call(void 0, disclosure, target)) return true;
417
+ const activeId = target.getAttribute("aria-activedescendant");
418
+ if (activeId) {
419
+ const activeElement = _QAUJZR6Ycjs.getDocument.call(void 0, disclosure).getElementById(activeId);
420
+ if (activeElement) return _QAUJZR6Ycjs.contains.call(void 0, disclosure, activeElement);
421
+ }
422
+ return false;
423
+ }
424
+ function isMouseEventOnDialog(event, dialog) {
425
+ if (!("clientY" in event)) return false;
426
+ const rect = dialog.getBoundingClientRect();
427
+ if (rect.width === 0 || rect.height === 0) return false;
428
+ return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
429
+ }
430
+ function useEventOutside({ store, type, listener, capture, domReady }) {
431
+ const callListener = _QAUJZR6Ycjs.useEvent.call(void 0, listener);
432
+ const open = _D4HCGWOUcjs.useStoreState.call(void 0, store, "open");
433
+ const contentElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "contentElement");
434
+ const focusedRef = _react.useRef.call(void 0, false);
435
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
436
+ if (!open) return;
437
+ if (!domReady) return;
438
+ if (!contentElement) return;
439
+ const onFocus = () => {
440
+ focusedRef.current = true;
441
+ };
442
+ contentElement.addEventListener("focusin", onFocus, true);
443
+ return () => contentElement.removeEventListener("focusin", onFocus, true);
444
+ }, [
445
+ open,
446
+ domReady,
447
+ contentElement
448
+ ]);
449
+ _react.useEffect.call(void 0, () => {
450
+ if (!open) return;
451
+ const onEvent = (event) => {
452
+ const { contentElement: contentElement2, disclosureElement } = store.getState();
453
+ const target = event.target;
454
+ if (!contentElement2) return;
455
+ if (!target) return;
456
+ if (!isInDocument(target)) return;
457
+ if (_QAUJZR6Ycjs.contains.call(void 0, contentElement2, target)) return;
458
+ if (isDisclosure(disclosureElement, target)) return;
459
+ if (target.hasAttribute("data-focus-trap")) return;
460
+ if (isMouseEventOnDialog(event, contentElement2)) return;
461
+ if (focusedRef.current && !isElementMarked(target, contentElement2.id)) return;
462
+ callListener(event);
463
+ };
464
+ return _QAUJZR6Ycjs.addGlobalEventListener.call(void 0, type, onEvent, capture, contentElement ? _QAUJZR6Ycjs.getWindow.call(void 0, contentElement) : void 0);
465
+ }, [
466
+ open,
467
+ capture,
468
+ store,
469
+ type,
470
+ callListener,
471
+ contentElement
472
+ ]);
473
+ }
474
+ function shouldHideOnInteractOutside(hideOnInteractOutside, event) {
475
+ if (typeof hideOnInteractOutside === "function") return hideOnInteractOutside(event);
476
+ return !!hideOnInteractOutside;
477
+ }
478
+ function useHideOnInteractOutside(store, hideOnInteractOutside, domReady, interactedOutsideRef) {
479
+ const open = _D4HCGWOUcjs.useStoreState.call(void 0, store, "open");
480
+ const contentElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "contentElement");
481
+ const previousMouseDownRef = usePreviousMouseDownRef(open, contentElement ? _QAUJZR6Ycjs.getWindow.call(void 0, contentElement) : void 0);
482
+ const props = {
483
+ store,
484
+ domReady,
485
+ capture: true
486
+ };
487
+ useEventOutside({
488
+ ...props,
489
+ type: "click",
490
+ listener: (event) => {
491
+ const { contentElement: contentElement2 } = store.getState();
492
+ const previousMouseDown = previousMouseDownRef.current;
493
+ if (!previousMouseDown) return;
494
+ if (!isElementMarked(previousMouseDown, contentElement2 == null ? void 0 : contentElement2.id)) return;
495
+ if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
496
+ if (interactedOutsideRef) interactedOutsideRef.current = true;
497
+ store.hide();
498
+ }
499
+ });
500
+ useEventOutside({
501
+ ...props,
502
+ type: "focusin",
503
+ listener: (event) => {
504
+ const { contentElement: contentElement2 } = store.getState();
505
+ if (!contentElement2) return;
506
+ if (event.target === _QAUJZR6Ycjs.getDocument.call(void 0, contentElement2)) return;
507
+ if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
508
+ store.hide();
509
+ }
510
+ });
511
+ useEventOutside({
512
+ ...props,
513
+ type: "contextmenu",
514
+ listener: (event) => {
515
+ if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
516
+ if (interactedOutsideRef) interactedOutsideRef.current = true;
517
+ store.hide();
518
+ }
519
+ });
520
+ }
521
+
522
+ // ../ariakit-react-components/dist/dialog/utils/use-nested-dialogs.js
523
+
524
+
525
+ var NestedDialogsContext = _react.createContext.call(void 0, {});
526
+ function useNestedDialogs(store) {
527
+ const context = _react.useContext.call(void 0, NestedDialogsContext);
528
+ const [dialogs, setDialogs] = _react.useState.call(void 0, []);
529
+ const add = _react.useCallback.call(void 0, (dialog) => {
530
+ var _a;
531
+ setDialogs((dialogs2) => [...dialogs2, dialog]);
532
+ return _QAUJZR6Ycjs.chain.call(void 0, (_a = context.add) == null ? void 0 : _a.call(context, dialog), () => {
533
+ setDialogs((dialogs2) => dialogs2.filter((d) => d !== dialog));
534
+ });
535
+ }, [context]);
536
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
537
+ return _D4HCGWOUcjs.sync.call(void 0, store, ["open", "contentElement"], (state) => {
538
+ var _a;
539
+ if (!state.open) return;
540
+ if (!state.contentElement) return;
541
+ return (_a = context.add) == null ? void 0 : _a.call(context, store);
542
+ });
543
+ }, [store, context]);
544
+ const providerValue = _react.useMemo.call(void 0, () => ({
545
+ store,
546
+ add
547
+ }), [store, add]);
548
+ return {
549
+ wrapElement: _react.useCallback.call(void 0, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NestedDialogsContext.Provider, {
550
+ value: providerValue,
551
+ children: element
552
+ }), [providerValue]),
553
+ nestedDialogs: dialogs
554
+ };
555
+ }
556
+
557
+ // ../ariakit-react-components/dist/dialog/utils/use-root-dialog.js
558
+
559
+ var _reactdom = require('react-dom');
560
+ function useRootDialog({ attribute, contentId, contentElement, enabled }) {
561
+ const [updated, retry] = _QAUJZR6Ycjs.useForceUpdate.call(void 0, );
562
+ const isRootDialog = _react.useCallback.call(void 0, () => {
563
+ if (!enabled) return false;
564
+ if (!contentElement) return false;
565
+ const { body } = _QAUJZR6Ycjs.getDocument.call(void 0, contentElement);
566
+ const id = body.getAttribute(attribute);
567
+ return !id || id === contentId;
568
+ }, [
569
+ updated,
570
+ enabled,
571
+ contentElement,
572
+ attribute,
573
+ contentId
574
+ ]);
575
+ _react.useEffect.call(void 0, () => {
576
+ if (!enabled) return;
577
+ if (!contentId) return;
578
+ if (!contentElement) return;
579
+ const { body } = _QAUJZR6Ycjs.getDocument.call(void 0, contentElement);
580
+ if (isRootDialog()) {
581
+ body.setAttribute(attribute, contentId);
582
+ return () => body.removeAttribute(attribute);
583
+ }
584
+ const observer = new MutationObserver(() => _reactdom.flushSync.call(void 0, retry));
585
+ observer.observe(body, { attributeFilter: [attribute] });
586
+ return () => observer.disconnect();
587
+ }, [
588
+ updated,
589
+ enabled,
590
+ contentId,
591
+ contentElement,
592
+ isRootDialog,
593
+ attribute
594
+ ]);
595
+ return isRootDialog;
596
+ }
597
+
598
+ // ../ariakit-react-components/dist/dialog/utils/use-prevent-body-scroll.js
599
+
600
+ function getPaddingProperty(documentElement) {
601
+ const documentLeft = documentElement.getBoundingClientRect().left;
602
+ return Math.round(documentLeft) + documentElement.scrollLeft ? "paddingLeft" : "paddingRight";
603
+ }
604
+ function usePreventBodyScroll(contentElement, contentId, enabled) {
605
+ const isRootDialog = useRootDialog({
606
+ attribute: "data-dialog-prevent-body-scroll",
607
+ contentElement,
608
+ contentId,
609
+ enabled
610
+ });
611
+ _react.useEffect.call(void 0, () => {
612
+ if (!isRootDialog()) return;
613
+ if (!contentElement) return;
614
+ const doc = _QAUJZR6Ycjs.getDocument.call(void 0, contentElement);
615
+ const win = _QAUJZR6Ycjs.getWindow.call(void 0, contentElement);
616
+ const { documentElement, body } = doc;
617
+ const cssScrollbarWidth = documentElement.style.getPropertyValue("--scrollbar-width");
618
+ const scrollbarWidth = cssScrollbarWidth ? Number.parseInt(cssScrollbarWidth, 10) : win.innerWidth - documentElement.clientWidth;
619
+ const setScrollbarWidthProperty = () => setCSSProperty(documentElement, "--scrollbar-width", `${scrollbarWidth}px`);
620
+ const paddingProperty = getPaddingProperty(documentElement);
621
+ const setStyle = () => assignStyle(body, {
622
+ overflow: "hidden",
623
+ [paddingProperty]: `${scrollbarWidth}px`
624
+ });
625
+ const setIOSStyle = () => {
626
+ var _a, _b;
627
+ const { scrollX, scrollY, visualViewport } = win;
628
+ const offsetLeft = (_a = visualViewport == null ? void 0 : visualViewport.offsetLeft) != null ? _a : 0;
629
+ const offsetTop = (_b = visualViewport == null ? void 0 : visualViewport.offsetTop) != null ? _b : 0;
630
+ const restoreStyle = assignStyle(body, {
631
+ position: "fixed",
632
+ overflow: "hidden",
633
+ top: `${-(scrollY - Math.floor(offsetTop))}px`,
634
+ left: `${-(scrollX - Math.floor(offsetLeft))}px`,
635
+ right: "0",
636
+ [paddingProperty]: `${scrollbarWidth}px`
637
+ });
638
+ return () => {
639
+ restoreStyle();
640
+ win.scrollTo({
641
+ left: scrollX,
642
+ top: scrollY,
643
+ behavior: "instant"
644
+ });
645
+ };
646
+ };
647
+ const isIOS = _QAUJZR6Ycjs.isApple.call(void 0, ) && !_QAUJZR6Ycjs.isMac.call(void 0, );
648
+ return _QAUJZR6Ycjs.chain.call(void 0, setScrollbarWidthProperty(), isIOS ? setIOSStyle() : setStyle());
649
+ }, [isRootDialog, contentElement]);
650
+ }
651
+
652
+ // ../ariakit-react-components/dist/dialog/dialog.js
653
+
654
+
655
+ var TagName2 = "div";
656
+ var isSafariBrowser = _QAUJZR6Ycjs.isSafari.call(void 0, );
657
+ function isAlreadyFocusingAnotherElement(dialog) {
658
+ const activeElement = _QAUJZR6Ycjs.getActiveElement.call(void 0, dialog);
659
+ if (!activeElement) return false;
660
+ if (dialog && _QAUJZR6Ycjs.contains.call(void 0, dialog, activeElement)) return false;
661
+ if (_QAUJZR6Ycjs.isFocusable.call(void 0, activeElement)) return true;
662
+ return false;
663
+ }
664
+ function getElementFromProp(prop, focusable = false) {
665
+ if (!prop) return null;
666
+ const element = "current" in prop ? prop.current : prop;
667
+ if (!element) return null;
668
+ if (focusable) return _QAUJZR6Ycjs.isFocusable.call(void 0, element) ? element : null;
669
+ return element;
670
+ }
671
+ var useDialog = _QAUJZR6Ycjs.createHook.call(void 0, function useDialog2({ store: storeProp, open: openProp, onClose, focusable = true, modal = true, portal = modal, backdrop = modal, hideOnEscape = true, hideOnInteractOutside = true, getPersistentElements, preventBodyScroll = modal, autoFocusOnShow = true, autoFocusOnHide = true, initialFocus, finalFocus, unmountOnHide, unstable_treeSnapshotKey, ...props }) {
672
+ const context = _7M4GY5DScjs.useDialogProviderContext.call(void 0, );
673
+ const ref = _react.useRef.call(void 0, null);
674
+ const store = useDialogStore({
675
+ store: storeProp || context,
676
+ open: openProp,
677
+ setOpen(open2) {
678
+ if (open2) return;
679
+ const dialog = ref.current;
680
+ if (!dialog) return;
681
+ const event = new Event("close", {
682
+ bubbles: false,
683
+ cancelable: true
684
+ });
685
+ if (onClose) dialog.addEventListener("close", onClose, { once: true });
686
+ dialog.dispatchEvent(event);
687
+ if (!event.defaultPrevented) return;
688
+ store.setOpen(true);
689
+ }
690
+ });
691
+ const { portalRef, domReady } = _QAUJZR6Ycjs.usePortalRef.call(void 0, portal, props.portalRef);
692
+ const preserveTabOrderProp = props.preserveTabOrder;
693
+ const preserveTabOrder = _D4HCGWOUcjs.useStoreState.call(void 0, store, (state) => preserveTabOrderProp && !modal && state.mounted);
694
+ const id = _QAUJZR6Ycjs.useId.call(void 0, props.id);
695
+ const open = _D4HCGWOUcjs.useStoreState.call(void 0, store, "open");
696
+ const mounted = _D4HCGWOUcjs.useStoreState.call(void 0, store, "mounted");
697
+ const contentElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "contentElement");
698
+ const hidden = _7M4GY5DScjs.isHidden.call(void 0, mounted, props.hidden, props.alwaysVisible);
699
+ usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);
700
+ const interactedOutsideRef = _react.useRef.call(void 0, false);
701
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
702
+ return _D4HCGWOUcjs.sync.call(void 0, store, ["open"], (state) => {
703
+ if (!state.open) return;
704
+ interactedOutsideRef.current = false;
705
+ });
706
+ }, [store]);
707
+ useHideOnInteractOutside(store, hideOnInteractOutside, domReady, interactedOutsideRef);
708
+ const { wrapElement, nestedDialogs } = useNestedDialogs(store);
709
+ props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, wrapElement, [wrapElement]);
710
+ const lastMousedownRef = _react.useRef.call(void 0, null);
711
+ if (isSafariBrowser) _react.useEffect.call(void 0, () => {
712
+ if (!domReady) return;
713
+ const dialog = ref.current;
714
+ if (!dialog) return;
715
+ const doc = _QAUJZR6Ycjs.getDocument.call(void 0, dialog);
716
+ const onMousedown = (event) => {
717
+ lastMousedownRef.current = event.target;
718
+ };
719
+ doc.addEventListener("mousedown", onMousedown, true);
720
+ return () => {
721
+ doc.removeEventListener("mousedown", onMousedown, true);
722
+ };
723
+ }, [domReady]);
724
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
725
+ if (!open) return;
726
+ const dialog = ref.current;
727
+ const activeElement = _QAUJZR6Ycjs.getActiveElement.call(void 0, dialog, true);
728
+ if (!activeElement) return;
729
+ if (activeElement.tagName === "BODY") {
730
+ const fallback = lastMousedownRef.current;
731
+ lastMousedownRef.current = null;
732
+ if (!(fallback == null ? void 0 : fallback.isConnected)) return;
733
+ if (!_QAUJZR6Ycjs.isFocusable.call(void 0, fallback)) return;
734
+ if (dialog && _QAUJZR6Ycjs.contains.call(void 0, dialog, fallback)) return;
735
+ store.setDisclosureElement(fallback);
736
+ return;
737
+ }
738
+ if (dialog && _QAUJZR6Ycjs.contains.call(void 0, dialog, activeElement)) return;
739
+ store.setDisclosureElement(activeElement);
740
+ }, [store, open]);
741
+ _react.useEffect.call(void 0, () => {
742
+ if (!mounted) return;
743
+ if (!domReady) return;
744
+ const dialog = ref.current;
745
+ if (!dialog) return;
746
+ const win = _QAUJZR6Ycjs.getWindow.call(void 0, dialog);
747
+ const viewport = win.visualViewport || win;
748
+ const setViewportHeight = () => {
749
+ var _a, _b;
750
+ const height = (_b = (_a = win.visualViewport) == null ? void 0 : _a.height) != null ? _b : win.innerHeight;
751
+ dialog.style.setProperty("--dialog-viewport-height", `${height}px`);
752
+ };
753
+ setViewportHeight();
754
+ viewport.addEventListener("resize", setViewportHeight);
755
+ return () => {
756
+ viewport.removeEventListener("resize", setViewportHeight);
757
+ };
758
+ }, [mounted, domReady]);
759
+ _react.useEffect.call(void 0, () => {
760
+ if (!modal) return;
761
+ if (!mounted) return;
762
+ if (!domReady) return;
763
+ const dialog = ref.current;
764
+ if (!dialog) return;
765
+ if (dialog.querySelector("[data-dialog-dismiss]")) return;
766
+ return prependHiddenDismiss(dialog, store.hide);
767
+ }, [
768
+ store,
769
+ modal,
770
+ mounted,
771
+ domReady
772
+ ]);
773
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
774
+ if (!supportsInert()) return;
775
+ if (open) return;
776
+ if (!mounted) return;
777
+ if (!domReady) return;
778
+ const dialog = ref.current;
779
+ if (!dialog) return;
780
+ return disableTree(dialog);
781
+ }, [
782
+ open,
783
+ mounted,
784
+ domReady
785
+ ]);
786
+ const canTakeTreeSnapshot = open && domReady;
787
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
788
+ if (!id) return;
789
+ if (!canTakeTreeSnapshot) return;
790
+ const dialog = ref.current;
791
+ return createWalkTreeSnapshot(id, [dialog]);
792
+ }, [
793
+ id,
794
+ canTakeTreeSnapshot,
795
+ unstable_treeSnapshotKey
796
+ ]);
797
+ const getPersistentElementsProp = _QAUJZR6Ycjs.useEvent.call(void 0, getPersistentElements);
798
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
799
+ if (!id) return;
800
+ if (!canTakeTreeSnapshot) return;
801
+ const { disclosureElement } = store.getState();
802
+ const allElements = [
803
+ ref.current,
804
+ ...getPersistentElementsProp() || [],
805
+ ...nestedDialogs.map((dialog) => dialog.getState().contentElement)
806
+ ];
807
+ if (modal) return _QAUJZR6Ycjs.chain.call(void 0, markTreeOutside(id, allElements), disableTreeOutside(id, allElements));
808
+ return markTreeOutside(id, [disclosureElement, ...allElements]);
809
+ }, [
810
+ id,
811
+ store,
812
+ canTakeTreeSnapshot,
813
+ getPersistentElementsProp,
814
+ nestedDialogs,
815
+ modal,
816
+ unstable_treeSnapshotKey
817
+ ]);
818
+ const mayAutoFocusOnShow = !!autoFocusOnShow;
819
+ const autoFocusOnShowProp = _QAUJZR6Ycjs.useBooleanEvent.call(void 0, autoFocusOnShow);
820
+ const [autoFocusEnabled, setAutoFocusEnabled] = _react.useState.call(void 0, false);
821
+ _react.useEffect.call(void 0, () => {
822
+ if (!open) return;
823
+ if (!mayAutoFocusOnShow) return;
824
+ if (!domReady) return;
825
+ if (!(contentElement == null ? void 0 : contentElement.isConnected)) return;
826
+ const element = getElementFromProp(initialFocus, true) || contentElement.querySelector("[data-autofocus=true],[autofocus]") || _QAUJZR6Ycjs.getFirstTabbableIn.call(void 0, contentElement, true, portal && preserveTabOrder) || contentElement;
827
+ const isElementFocusable = _QAUJZR6Ycjs.isFocusable.call(void 0, element);
828
+ if (!autoFocusOnShowProp(isElementFocusable ? element : null)) return;
829
+ setAutoFocusEnabled(true);
830
+ queueMicrotask(() => {
831
+ if (!store.getState().open) return;
832
+ element.focus();
833
+ if (!isSafariBrowser) return;
834
+ if (!isElementFocusable) return;
835
+ element.scrollIntoView({
836
+ block: "nearest",
837
+ inline: "nearest"
838
+ });
839
+ });
840
+ }, [
841
+ open,
842
+ mayAutoFocusOnShow,
843
+ domReady,
844
+ contentElement,
845
+ initialFocus,
846
+ portal,
847
+ preserveTabOrder,
848
+ store,
849
+ autoFocusOnShowProp
850
+ ]);
851
+ const mayAutoFocusOnHide = !!autoFocusOnHide;
852
+ const autoFocusOnHideProp = _QAUJZR6Ycjs.useBooleanEvent.call(void 0, autoFocusOnHide);
853
+ const [hasOpened, setHasOpened] = _react.useState.call(void 0, false);
854
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
855
+ if (!open) return;
856
+ setHasOpened(true);
857
+ return () => setHasOpened(false);
858
+ }, [open]);
859
+ const focusOnHide = _react.useCallback.call(void 0, (dialog, retry = true) => {
860
+ if (interactedOutsideRef.current) return;
861
+ const { disclosureElement } = store.getState();
862
+ if (isAlreadyFocusingAnotherElement(dialog)) return;
863
+ let element = getElementFromProp(finalFocus) || disclosureElement;
864
+ if (element == null ? void 0 : element.id) {
865
+ const doc = _QAUJZR6Ycjs.getDocument.call(void 0, element);
866
+ const selector = `[aria-activedescendant="${element.id}"]`;
867
+ const composite = doc.querySelector(selector);
868
+ if (composite) element = composite;
869
+ }
870
+ if (element && !_QAUJZR6Ycjs.isFocusable.call(void 0, element)) {
871
+ const maybeParentDialog = element.closest("[data-dialog]");
872
+ if (maybeParentDialog == null ? void 0 : maybeParentDialog.id) {
873
+ const doc = _QAUJZR6Ycjs.getDocument.call(void 0, maybeParentDialog);
874
+ const selector = `[aria-controls~="${maybeParentDialog.id}"]`;
875
+ const control = doc.querySelector(selector);
876
+ if (control) element = control;
877
+ }
878
+ }
879
+ const isElementFocusable = element && _QAUJZR6Ycjs.isFocusable.call(void 0, element);
880
+ if (!isElementFocusable && retry) {
881
+ requestAnimationFrame(() => focusOnHide(dialog, false));
882
+ return;
883
+ }
884
+ if (!autoFocusOnHideProp(isElementFocusable ? element : null)) return;
885
+ if (!isElementFocusable) return;
886
+ element == null ? void 0 : element.focus();
887
+ }, [
888
+ store,
889
+ finalFocus,
890
+ autoFocusOnHideProp
891
+ ]);
892
+ const focusedOnHideRef = _react.useRef.call(void 0, false);
893
+ _QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
894
+ if (open) return;
895
+ if (!hasOpened) return;
896
+ if (!mayAutoFocusOnHide) return;
897
+ const dialog = ref.current;
898
+ focusedOnHideRef.current = true;
899
+ focusOnHide(dialog);
900
+ }, [
901
+ open,
902
+ hasOpened,
903
+ domReady,
904
+ mayAutoFocusOnHide,
905
+ focusOnHide
906
+ ]);
907
+ _react.useEffect.call(void 0, () => {
908
+ if (!hasOpened) return;
909
+ if (!mayAutoFocusOnHide) return;
910
+ const dialog = ref.current;
911
+ return () => {
912
+ if (focusedOnHideRef.current) {
913
+ focusedOnHideRef.current = false;
914
+ return;
915
+ }
916
+ focusOnHide(dialog);
917
+ };
918
+ }, [
919
+ hasOpened,
920
+ mayAutoFocusOnHide,
921
+ focusOnHide
922
+ ]);
923
+ const hideOnEscapeProp = _QAUJZR6Ycjs.useBooleanEvent.call(void 0, hideOnEscape);
924
+ _react.useEffect.call(void 0, () => {
925
+ if (!domReady) return;
926
+ if (!mounted) return;
927
+ const onKeyDown = (event) => {
928
+ if (event.key !== "Escape") return;
929
+ if (event.defaultPrevented) return;
930
+ const dialog = ref.current;
931
+ if (!dialog) return;
932
+ if (isElementMarked(dialog)) return;
933
+ const target = event.target;
934
+ if (!target) return;
935
+ const { disclosureElement } = store.getState();
936
+ const isValidTarget = () => {
937
+ if (target.tagName === "BODY") return true;
938
+ if (_QAUJZR6Ycjs.contains.call(void 0, dialog, target)) return true;
939
+ if (!disclosureElement) return true;
940
+ if (_QAUJZR6Ycjs.contains.call(void 0, disclosureElement, target)) return true;
941
+ return false;
942
+ };
943
+ if (!isValidTarget()) return;
944
+ if (!hideOnEscapeProp(event)) return;
945
+ store.hide();
946
+ };
947
+ return _QAUJZR6Ycjs.addGlobalEventListener.call(void 0, "keydown", onKeyDown, true, contentElement ? _QAUJZR6Ycjs.getWindow.call(void 0, contentElement) : void 0);
948
+ }, [
949
+ store,
950
+ domReady,
951
+ mounted,
952
+ contentElement,
953
+ hideOnEscapeProp
954
+ ]);
955
+ props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _DWSXHZYMcjs.HeadingLevel, {
956
+ level: modal ? 1 : void 0,
957
+ children: element
958
+ }), [modal]);
959
+ const hiddenProp = props.hidden;
960
+ const alwaysVisible = props.alwaysVisible;
961
+ props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => {
962
+ if (!backdrop) return element;
963
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogBackdrop, {
964
+ store,
965
+ backdrop,
966
+ hidden: hiddenProp,
967
+ alwaysVisible
968
+ }), element] });
969
+ }, [
970
+ store,
971
+ backdrop,
972
+ hiddenProp,
973
+ alwaysVisible
974
+ ]);
975
+ const [headingId, setHeadingId] = _react.useState.call(void 0, );
976
+ const [descriptionId, setDescriptionId] = _react.useState.call(void 0, );
977
+ props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _7M4GY5DScjs.DialogScopedContextProvider, {
978
+ value: store,
979
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _7M4GY5DScjs.DialogHeadingContext.Provider, {
980
+ value: setHeadingId,
981
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _7M4GY5DScjs.DialogDescriptionContext.Provider, {
982
+ value: setDescriptionId,
983
+ children: element
984
+ })
985
+ })
986
+ }), [store]);
987
+ props = {
988
+ "data-dialog": "",
989
+ role: "dialog",
990
+ tabIndex: focusable ? -1 : void 0,
991
+ "aria-labelledby": props["aria-label"] != null ? void 0 : headingId,
992
+ "aria-describedby": descriptionId,
993
+ ...props,
994
+ id,
995
+ ref: _QAUJZR6Ycjs.useMergeRefs.call(void 0, ref, props.ref)
996
+ };
997
+ props = useFocusableContainer({
998
+ ...props,
999
+ autoFocusOnShow: autoFocusEnabled
1000
+ });
1001
+ props = _7M4GY5DScjs.useDisclosureContent.call(void 0, {
1002
+ store,
1003
+ ...props
1004
+ });
1005
+ props = _NG34QRI6cjs.useFocusable.call(void 0, {
1006
+ ...props,
1007
+ focusable
1008
+ });
1009
+ props = _VXDLN5CPcjs.usePortal.call(void 0, {
1010
+ portal,
1011
+ ...props,
1012
+ portalRef,
1013
+ preserveTabOrder
1014
+ });
1015
+ return props;
1016
+ });
1017
+ function createDialogComponent(Component, useProviderContext = _7M4GY5DScjs.useDialogProviderContext) {
1018
+ return _QAUJZR6Ycjs.forwardRef.call(void 0, function DialogComponent(props) {
1019
+ const context = useProviderContext();
1020
+ if (!_D4HCGWOUcjs.useStoreState.call(void 0, props.store || context, (state) => !props.unmountOnHide || (state == null ? void 0 : state.mounted) || !!props.open)) return null;
1021
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { ...props });
1022
+ });
1023
+ }
1024
+ var Dialog = createDialogComponent(_QAUJZR6Ycjs.forwardRef.call(void 0, function Dialog2(props) {
1025
+ return _QAUJZR6Ycjs.createElement.call(void 0, TagName2, useDialog(props));
1026
+ }), _7M4GY5DScjs.useDialogProviderContext);
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+ exports.createDialogStore = createDialogStore; exports.useDialogStoreProps = useDialogStoreProps; exports.useDialogStore = useDialogStore; exports.useDialog = useDialog; exports.createDialogComponent = createDialogComponent; exports.Dialog = Dialog;