@ariakit/react 0.4.25 → 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 +31 -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,996 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // ../ariakit-utils/dist/index.js
34
+ function toArray(arg) {
35
+ if (Array.isArray(arg)) return arg;
36
+ return typeof arg !== "undefined" ? [arg] : [];
37
+ }
38
+ function flatten2DArray(array) {
39
+ const flattened = [];
40
+ for (const row of array) flattened.push(...row);
41
+ return flattened;
42
+ }
43
+ function reverseArray(array) {
44
+ return array.slice().reverse();
45
+ }
46
+ var canUseDOM = checkIsBrowser();
47
+ function checkIsBrowser() {
48
+ var _a;
49
+ return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
50
+ }
51
+ function getDocument(node) {
52
+ if (!node) return document;
53
+ if ("self" in node) return node.document;
54
+ return node.ownerDocument || document;
55
+ }
56
+ function getWindow(node) {
57
+ if (!node) return self;
58
+ if ("self" in node) return node.self;
59
+ return getDocument(node).defaultView || window;
60
+ }
61
+ function getActiveElement(node, activeDescendant = false) {
62
+ var _a;
63
+ const { activeElement } = getDocument(node);
64
+ if (!(activeElement == null ? void 0 : activeElement.nodeName)) return null;
65
+ if (isFrame(activeElement) && ((_a = activeElement.contentDocument) == null ? void 0 : _a.body)) return getActiveElement(activeElement.contentDocument.body, activeDescendant);
66
+ if (activeDescendant) {
67
+ const id = activeElement.getAttribute("aria-activedescendant");
68
+ if (id) {
69
+ const element = getDocument(activeElement).getElementById(id);
70
+ if (element) return element;
71
+ }
72
+ }
73
+ return activeElement;
74
+ }
75
+ function contains(parent, child) {
76
+ return parent === child || parent.contains(child);
77
+ }
78
+ function isFrame(element) {
79
+ return element.tagName === "IFRAME";
80
+ }
81
+ function isButton(element) {
82
+ const tagName = element.tagName.toLowerCase();
83
+ if (tagName === "button") return true;
84
+ if (tagName === "input" && element.type) return buttonInputTypes.indexOf(element.type) !== -1;
85
+ return false;
86
+ }
87
+ var buttonInputTypes = [
88
+ "button",
89
+ "color",
90
+ "file",
91
+ "image",
92
+ "reset",
93
+ "submit"
94
+ ];
95
+ function isVisible(element) {
96
+ if (typeof element.checkVisibility === "function") return element.checkVisibility();
97
+ const htmlElement = element;
98
+ return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
99
+ }
100
+ function isTextField(element) {
101
+ try {
102
+ const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
103
+ const isTextArea = element.tagName === "TEXTAREA";
104
+ return isTextInput || isTextArea || false;
105
+ } catch (_error) {
106
+ return false;
107
+ }
108
+ }
109
+ function isTextbox(element) {
110
+ return element.isContentEditable || isTextField(element);
111
+ }
112
+ function getTextboxValue(element) {
113
+ if (isTextField(element)) return element.value;
114
+ if (element.isContentEditable) {
115
+ const range = getDocument(element).createRange();
116
+ range.selectNodeContents(element);
117
+ return range.toString();
118
+ }
119
+ return "";
120
+ }
121
+ function getTextboxSelection(element) {
122
+ let start = 0;
123
+ let end = 0;
124
+ if (isTextField(element)) {
125
+ start = element.selectionStart || 0;
126
+ end = element.selectionEnd || 0;
127
+ } else if (element.isContentEditable) {
128
+ const selection = getDocument(element).getSelection();
129
+ if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
130
+ const range = selection.getRangeAt(0);
131
+ const nextRange = range.cloneRange();
132
+ nextRange.selectNodeContents(element);
133
+ nextRange.setEnd(range.startContainer, range.startOffset);
134
+ start = nextRange.toString().length;
135
+ nextRange.setEnd(range.endContainer, range.endOffset);
136
+ end = nextRange.toString().length;
137
+ }
138
+ }
139
+ return {
140
+ start,
141
+ end
142
+ };
143
+ }
144
+ function getPopupRole(element, fallback) {
145
+ const allowedPopupRoles = [
146
+ "dialog",
147
+ "menu",
148
+ "listbox",
149
+ "tree",
150
+ "grid"
151
+ ];
152
+ const role = element == null ? void 0 : element.getAttribute("role");
153
+ if (role && allowedPopupRoles.indexOf(role) !== -1) return role;
154
+ return fallback;
155
+ }
156
+ function getPopupItemRole(element, fallback) {
157
+ var _a;
158
+ const itemRoleByPopupRole = {
159
+ menu: "menuitem",
160
+ listbox: "option",
161
+ tree: "treeitem"
162
+ };
163
+ const popupRole = getPopupRole(element);
164
+ if (!popupRole) return fallback;
165
+ return (_a = itemRoleByPopupRole[popupRole]) != null ? _a : fallback;
166
+ }
167
+ function getScrollingElement(element) {
168
+ if (!element) return null;
169
+ const isScrollableOverflow = (overflow) => {
170
+ if (overflow === "auto") return true;
171
+ if (overflow === "scroll") return true;
172
+ return false;
173
+ };
174
+ if (element.clientHeight && element.scrollHeight > element.clientHeight) {
175
+ const { overflowY } = getComputedStyle(element);
176
+ if (isScrollableOverflow(overflowY)) return element;
177
+ } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
178
+ const { overflowX } = getComputedStyle(element);
179
+ if (isScrollableOverflow(overflowX)) return element;
180
+ }
181
+ return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
182
+ }
183
+ function setSelectionRange(element, ...args) {
184
+ if (/text|search|password|tel|url/i.test(element.type)) element.setSelectionRange(...args);
185
+ }
186
+ function sortBasedOnDOMPosition(items, getElement) {
187
+ const pairs = items.map((item, index) => [index, item]);
188
+ let isOrderDifferent = false;
189
+ pairs.sort(([indexA, a], [indexB, b]) => {
190
+ const elementA = getElement(a);
191
+ const elementB = getElement(b);
192
+ if (elementA === elementB) return 0;
193
+ if (!elementA || !elementB) return 0;
194
+ if (isElementPreceding(elementA, elementB)) {
195
+ if (indexA > indexB) isOrderDifferent = true;
196
+ return -1;
197
+ }
198
+ if (indexA < indexB) isOrderDifferent = true;
199
+ return 1;
200
+ });
201
+ if (isOrderDifferent) return pairs.map(([_, item]) => item);
202
+ return items;
203
+ }
204
+ function isElementPreceding(a, b) {
205
+ return Boolean(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
206
+ }
207
+ function isTouchDevice() {
208
+ return canUseDOM && !!navigator.maxTouchPoints;
209
+ }
210
+ function isApple() {
211
+ if (!canUseDOM) return false;
212
+ return /mac|iphone|ipad|ipod/i.test(navigator.platform);
213
+ }
214
+ function isSafari() {
215
+ return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
216
+ }
217
+ function isFirefox() {
218
+ return canUseDOM && /firefox\//i.test(navigator.userAgent);
219
+ }
220
+ function isMac() {
221
+ return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
222
+ }
223
+ function isPortalEvent(event) {
224
+ return Boolean(event.currentTarget && !contains(event.currentTarget, event.target));
225
+ }
226
+ function isSelfTarget(event) {
227
+ return event.target === event.currentTarget;
228
+ }
229
+ function isOpeningInNewTab(event) {
230
+ const element = event.currentTarget;
231
+ if (!element) return false;
232
+ const isAppleDevice = isApple();
233
+ if (isAppleDevice && !event.metaKey) return false;
234
+ if (!isAppleDevice && !event.ctrlKey) return false;
235
+ const tagName = element.tagName.toLowerCase();
236
+ if (tagName === "a") return true;
237
+ if (tagName === "button" && element.type === "submit") return true;
238
+ if (tagName === "input" && element.type === "submit") return true;
239
+ return false;
240
+ }
241
+ function isDownloading(event) {
242
+ const element = event.currentTarget;
243
+ if (!element) return false;
244
+ const tagName = element.tagName.toLowerCase();
245
+ if (!event.altKey) return false;
246
+ if (tagName === "a") return true;
247
+ if (tagName === "button" && element.type === "submit") return true;
248
+ if (tagName === "input" && element.type === "submit") return true;
249
+ return false;
250
+ }
251
+ function fireEvent(element, type, eventInit) {
252
+ const event = new Event(type, eventInit);
253
+ return element.dispatchEvent(event);
254
+ }
255
+ function fireBlurEvent(element, eventInit) {
256
+ const event = new FocusEvent("blur", eventInit);
257
+ const defaultAllowed = element.dispatchEvent(event);
258
+ const bubbleInit = {
259
+ ...eventInit,
260
+ bubbles: true
261
+ };
262
+ element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
263
+ return defaultAllowed;
264
+ }
265
+ function fireKeyboardEvent(element, type, eventInit) {
266
+ const event = new KeyboardEvent(type, eventInit);
267
+ return element.dispatchEvent(event);
268
+ }
269
+ function fireClickEvent(element, eventInit) {
270
+ const event = new MouseEvent("click", eventInit);
271
+ return element.dispatchEvent(event);
272
+ }
273
+ function isFocusEventOutside(event, container) {
274
+ const containerElement = container || event.currentTarget;
275
+ const relatedTarget = event.relatedTarget;
276
+ return !relatedTarget || !contains(containerElement, relatedTarget);
277
+ }
278
+ function queueBeforeEvent(element, type, callback, timeout) {
279
+ const createTimer = (callback2) => {
280
+ if (timeout) {
281
+ const timerId2 = setTimeout(callback2, timeout);
282
+ return () => clearTimeout(timerId2);
283
+ }
284
+ const timerId = requestAnimationFrame(callback2);
285
+ return () => cancelAnimationFrame(timerId);
286
+ };
287
+ const cancelTimer = createTimer(() => {
288
+ element.removeEventListener(type, callSync, true);
289
+ callback();
290
+ });
291
+ const callSync = () => {
292
+ cancelTimer();
293
+ callback();
294
+ };
295
+ element.addEventListener(type, callSync, {
296
+ once: true,
297
+ capture: true
298
+ });
299
+ return cancelTimer;
300
+ }
301
+ function addGlobalEventListener(type, listener, options, scope = window) {
302
+ const children = [];
303
+ try {
304
+ scope.document.addEventListener(type, listener, options);
305
+ for (const frame of Array.from(scope.frames)) children.push(addGlobalEventListener(type, listener, options, frame));
306
+ } catch (e) {
307
+ }
308
+ const removeEventListener = () => {
309
+ try {
310
+ scope.document.removeEventListener(type, listener, options);
311
+ } catch (e) {
312
+ }
313
+ for (const remove of children) remove();
314
+ };
315
+ return removeEventListener;
316
+ }
317
+ var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
318
+ function hasNegativeTabIndex(element) {
319
+ return Number.parseInt(element.getAttribute("tabindex") || "0", 10) < 0;
320
+ }
321
+ function isFocusable(element) {
322
+ if (!element.matches(selector)) return false;
323
+ if (!isVisible(element)) return false;
324
+ if (element.closest("[inert]")) return false;
325
+ return true;
326
+ }
327
+ function isTabbable(element) {
328
+ if (!isFocusable(element)) return false;
329
+ if (hasNegativeTabIndex(element)) return false;
330
+ if (!("form" in element)) return true;
331
+ if (!element.form) return true;
332
+ if (element.checked) return true;
333
+ if (element.type !== "radio") return true;
334
+ const radioGroup = element.form.elements.namedItem(element.name);
335
+ if (!radioGroup) return true;
336
+ if (!("length" in radioGroup)) return true;
337
+ const activeElement = getActiveElement(element);
338
+ if (!activeElement) return true;
339
+ if (activeElement === element) return true;
340
+ if (!("form" in activeElement)) return true;
341
+ if (activeElement.form !== element.form) return true;
342
+ if (activeElement.name !== element.name) return true;
343
+ return false;
344
+ }
345
+ function getAllFocusableIn(container, includeContainer) {
346
+ const elements = Array.from(container.querySelectorAll(selector));
347
+ if (includeContainer) elements.unshift(container);
348
+ const focusableElements = elements.filter(isFocusable);
349
+ focusableElements.forEach((element, i) => {
350
+ var _a;
351
+ if (!isFrame(element)) return;
352
+ const frameBody = (_a = element.contentDocument) == null ? void 0 : _a.body;
353
+ if (!frameBody) return;
354
+ focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
355
+ });
356
+ return focusableElements;
357
+ }
358
+ function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
359
+ const elements = Array.from(container.querySelectorAll(selector));
360
+ const tabbableElements = elements.filter(isTabbable);
361
+ if (includeContainer && isTabbable(container)) tabbableElements.unshift(container);
362
+ tabbableElements.forEach((element, i) => {
363
+ var _a;
364
+ if (!isFrame(element)) return;
365
+ const frameBody = (_a = element.contentDocument) == null ? void 0 : _a.body;
366
+ if (!frameBody) return;
367
+ const allFrameTabbable = getAllTabbableIn(frameBody, false, fallbackToFocusable);
368
+ tabbableElements.splice(i, 1, ...allFrameTabbable);
369
+ });
370
+ if (!tabbableElements.length && fallbackToFocusable) return elements;
371
+ return tabbableElements;
372
+ }
373
+ function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
374
+ const [first] = getAllTabbableIn(container, includeContainer, fallbackToFocusable);
375
+ return first || null;
376
+ }
377
+ function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
378
+ const activeElement = getActiveElement(container);
379
+ const allFocusable = getAllFocusableIn(container, includeContainer);
380
+ const activeIndex = allFocusable.indexOf(activeElement);
381
+ const nextFocusableElements = allFocusable.slice(activeIndex + 1);
382
+ return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
383
+ }
384
+ function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
385
+ return getNextTabbableIn(document.body, false, fallbackToFirst, fallbackToFocusable);
386
+ }
387
+ function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
388
+ const activeElement = getActiveElement(container);
389
+ const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
390
+ const activeIndex = allFocusable.indexOf(activeElement);
391
+ const previousFocusableElements = allFocusable.slice(activeIndex + 1);
392
+ return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
393
+ }
394
+ function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
395
+ return getPreviousTabbableIn(document.body, false, fallbackToFirst, fallbackToFocusable);
396
+ }
397
+ function hasFocus(element) {
398
+ const activeElement = getActiveElement(element);
399
+ if (!activeElement) return false;
400
+ if (activeElement === element) return true;
401
+ const activeDescendant = activeElement.getAttribute("aria-activedescendant");
402
+ if (!activeDescendant) return false;
403
+ return activeDescendant === element.id;
404
+ }
405
+ function hasFocusWithin(element) {
406
+ const activeElement = getActiveElement(element);
407
+ if (!activeElement) return false;
408
+ if (contains(element, activeElement)) return true;
409
+ const activeDescendant = activeElement.getAttribute("aria-activedescendant");
410
+ if (!activeDescendant) return false;
411
+ if (!("id" in element)) return false;
412
+ if (activeDescendant === element.id) return true;
413
+ return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
414
+ }
415
+ function disableFocus(element) {
416
+ var _a;
417
+ const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
418
+ element.setAttribute("data-tabindex", currentTabindex);
419
+ element.setAttribute("tabindex", "-1");
420
+ }
421
+ function disableFocusIn(container, includeContainer) {
422
+ const tabbableElements = getAllTabbableIn(container, includeContainer);
423
+ for (const element of tabbableElements) disableFocus(element);
424
+ }
425
+ function restoreFocusIn(container) {
426
+ const elements = container.querySelectorAll("[data-tabindex]");
427
+ const restoreTabIndex = (element) => {
428
+ const tabindex = element.getAttribute("data-tabindex");
429
+ element.removeAttribute("data-tabindex");
430
+ if (tabindex) element.setAttribute("tabindex", tabindex);
431
+ else element.removeAttribute("tabindex");
432
+ };
433
+ if (container.hasAttribute("data-tabindex")) restoreTabIndex(container);
434
+ for (const element of elements) restoreTabIndex(element);
435
+ }
436
+ function focusIntoView(element, options) {
437
+ if (!("scrollIntoView" in element)) element.focus();
438
+ else {
439
+ element.focus({ preventScroll: true });
440
+ element.scrollIntoView({
441
+ block: "nearest",
442
+ inline: "nearest",
443
+ ...options
444
+ });
445
+ }
446
+ }
447
+ function noop(..._) {
448
+ }
449
+ function shallowEqual(a, b) {
450
+ if (a === b) return true;
451
+ if (!a) return false;
452
+ if (!b) return false;
453
+ if (typeof a !== "object") return false;
454
+ if (typeof b !== "object") return false;
455
+ const aKeys = Object.keys(a);
456
+ const bKeys = Object.keys(b);
457
+ const { length } = aKeys;
458
+ if (bKeys.length !== length) return false;
459
+ for (const key of aKeys) if (a[key] !== b[key]) return false;
460
+ return true;
461
+ }
462
+ function applyState(argument, currentValue) {
463
+ if (isUpdater(argument)) return argument(isLazyValue(currentValue) ? currentValue() : currentValue);
464
+ return argument;
465
+ }
466
+ function isUpdater(argument) {
467
+ return typeof argument === "function";
468
+ }
469
+ function isLazyValue(value) {
470
+ return typeof value === "function";
471
+ }
472
+ function isObject(arg) {
473
+ return typeof arg === "object" && arg != null;
474
+ }
475
+ function isInteger(arg) {
476
+ if (typeof arg === "number") return Math.floor(arg) === arg;
477
+ return String(Math.floor(Number(arg))) === arg;
478
+ }
479
+ function hasOwnProperty(object, prop) {
480
+ if (typeof Object.hasOwn === "function") return Object.hasOwn(object, prop);
481
+ return Object.prototype.hasOwnProperty.call(object, prop);
482
+ }
483
+ function chain(...fns) {
484
+ return (...args) => {
485
+ for (const fn of fns) if (typeof fn === "function") fn(...args);
486
+ };
487
+ }
488
+ function cx(...args) {
489
+ return args.filter(Boolean).join(" ") || void 0;
490
+ }
491
+ function normalizeString(str) {
492
+ return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
493
+ }
494
+ function omit(object, keys) {
495
+ const result = { ...object };
496
+ for (const key of keys) if (hasOwnProperty(result, key)) delete result[key];
497
+ return result;
498
+ }
499
+ function pick(object, paths) {
500
+ const result = {};
501
+ for (const key of paths) if (hasOwnProperty(object, key)) result[key] = object[key];
502
+ return result;
503
+ }
504
+ function identity(value) {
505
+ return value;
506
+ }
507
+ function invariant(condition, message) {
508
+ if (condition) return;
509
+ if (typeof message !== "string") throw new Error("Invariant failed");
510
+ throw new Error(message);
511
+ }
512
+ function getKeys(obj) {
513
+ return Object.keys(obj);
514
+ }
515
+ function isFalsyBooleanCallback(booleanOrCallback, ...args) {
516
+ const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
517
+ if (result == null) return false;
518
+ return !result;
519
+ }
520
+ function disabledFromProps(props) {
521
+ return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
522
+ }
523
+ function disabledFromElement(element) {
524
+ if (element.getAttribute("aria-disabled") === "true") return true;
525
+ if ("disabled" in element && element.disabled === true) return true;
526
+ return false;
527
+ }
528
+ function removeUndefinedValues(obj) {
529
+ const result = {};
530
+ for (const key in obj) if (obj[key] !== void 0) result[key] = obj[key];
531
+ return result;
532
+ }
533
+ function defaultValue(...values) {
534
+ for (const value of values) if (value !== void 0) return value;
535
+ }
536
+ function createUndoCallback(callback) {
537
+ return async () => {
538
+ const redo = await (callback == null ? void 0 : callback());
539
+ return createUndoCallback(async () => {
540
+ await (redo == null ? void 0 : redo());
541
+ return callback;
542
+ });
543
+ };
544
+ }
545
+ var UndoManager = createUndoManager();
546
+ function createUndoManager({ limit = 100 } = {}) {
547
+ const undoStack = [];
548
+ let redoStack = [];
549
+ let currentGroup = null;
550
+ const canUndo = () => undoStack.length > 0;
551
+ const canRedo = () => redoStack.length > 0;
552
+ const undo = async () => {
553
+ var _a;
554
+ if (!canUndo()) return;
555
+ currentGroup = null;
556
+ redoStack.push(await ((_a = undoStack.pop()) == null ? void 0 : _a()));
557
+ };
558
+ const redo = async () => {
559
+ var _a;
560
+ if (!canRedo()) return;
561
+ currentGroup = null;
562
+ undoStack.push(await ((_a = redoStack.pop()) == null ? void 0 : _a()));
563
+ };
564
+ const execute = async (callback, group) => {
565
+ if (!callback) return;
566
+ while (undoStack.length > limit) undoStack.shift();
567
+ const sameGroup = group === currentGroup;
568
+ currentGroup = group != null ? group : null;
569
+ const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length;
570
+ const undoCallback = await callback();
571
+ if (!undoCallback) return;
572
+ redoStack = [];
573
+ const currentUndo = undoStack[nextIndex];
574
+ undoStack[nextIndex] = createUndoCallback(async () => {
575
+ await (undoCallback == null ? void 0 : undoCallback());
576
+ const currentRedo = await (currentUndo == null ? void 0 : currentUndo());
577
+ return async () => {
578
+ await (currentRedo == null ? void 0 : currentRedo());
579
+ await (callback == null ? void 0 : callback());
580
+ };
581
+ });
582
+ };
583
+ return {
584
+ canUndo,
585
+ canRedo,
586
+ undo,
587
+ redo,
588
+ execute
589
+ };
590
+ }
591
+
592
+ // ../ariakit-react-utils/dist/index.js
593
+ var _react = require('react'); var React = _interopRequireWildcard(_react);
594
+
595
+ var _jsxruntime = require('react/jsx-runtime');
596
+ function setRef(ref, value) {
597
+ if (typeof ref === "function") ref(value);
598
+ else if (ref) ref.current = value;
599
+ }
600
+ function isValidElementWithRef(element) {
601
+ if (!element) return false;
602
+ if (!_react.isValidElement.call(void 0, element)) return false;
603
+ if ("ref" in element.props) return true;
604
+ if ("ref" in element) return true;
605
+ return false;
606
+ }
607
+ function getRefProperty(element) {
608
+ if (!isValidElementWithRef(element)) return null;
609
+ return { ...element.props }.ref || element.ref;
610
+ }
611
+ function mergeProps(base, overrides) {
612
+ const props = { ...base };
613
+ for (const key in overrides) {
614
+ if (!hasOwnProperty(overrides, key)) continue;
615
+ if (key === "className") {
616
+ const prop = "className";
617
+ const baseClass = base[prop];
618
+ const overrideClass = overrides[prop];
619
+ if (baseClass && overrideClass) props[prop] = `${baseClass} ${overrideClass}`;
620
+ else props[prop] = overrideClass || baseClass;
621
+ continue;
622
+ }
623
+ if (key === "style") {
624
+ const prop = "style";
625
+ props[prop] = base[prop] ? {
626
+ ...base[prop],
627
+ ...overrides[prop]
628
+ } : overrides[prop];
629
+ continue;
630
+ }
631
+ const overrideValue = overrides[key];
632
+ if (key.startsWith("on")) {
633
+ if (typeof overrideValue !== "function") continue;
634
+ const baseValue = base[key];
635
+ if (typeof baseValue === "function") {
636
+ props[key] = (...args) => {
637
+ overrideValue(...args);
638
+ baseValue(...args);
639
+ };
640
+ continue;
641
+ }
642
+ }
643
+ props[key] = overrideValue;
644
+ }
645
+ return props;
646
+ }
647
+ var _React = { ...React };
648
+ var useReactId = _React.useId;
649
+ var useReactDeferredValue = _React.useDeferredValue;
650
+ var useReactInsertionEffect = _React.useInsertionEffect;
651
+ var useSafeLayoutEffect = canUseDOM ? _react.useLayoutEffect : _react.useEffect;
652
+ function useInitialValue(value) {
653
+ const [initialValue] = _react.useState.call(void 0, value);
654
+ return initialValue;
655
+ }
656
+ function useLiveRef(value) {
657
+ const ref = _react.useRef.call(void 0, value);
658
+ useSafeLayoutEffect(() => {
659
+ ref.current = value;
660
+ });
661
+ return ref;
662
+ }
663
+ function useEvent(callback) {
664
+ const ref = _react.useRef.call(void 0, () => {
665
+ throw new Error("Cannot call an event handler while rendering.");
666
+ });
667
+ if (useReactInsertionEffect) useReactInsertionEffect(() => {
668
+ ref.current = callback;
669
+ });
670
+ else ref.current = callback;
671
+ return _react.useCallback.call(void 0, (...args) => {
672
+ var _a;
673
+ return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
674
+ }, []);
675
+ }
676
+ function useTransactionState(callback) {
677
+ const [state, setState] = _react.useState.call(void 0, null);
678
+ useSafeLayoutEffect(() => {
679
+ if (state == null) return;
680
+ if (!callback) return;
681
+ let prevState = null;
682
+ callback((prev) => {
683
+ prevState = prev;
684
+ return state;
685
+ });
686
+ return () => {
687
+ callback(prevState);
688
+ };
689
+ }, [state, callback]);
690
+ return [state, setState];
691
+ }
692
+ function useMergeRefs(...refs) {
693
+ return _react.useMemo.call(void 0, () => {
694
+ if (!refs.some(Boolean)) return;
695
+ return (value) => {
696
+ for (const ref of refs) setRef(ref, value);
697
+ };
698
+ }, refs);
699
+ }
700
+ function useId(defaultId) {
701
+ if (useReactId) {
702
+ const reactId = useReactId();
703
+ if (defaultId) return defaultId;
704
+ return reactId;
705
+ }
706
+ const [id, setId] = _react.useState.call(void 0, defaultId);
707
+ useSafeLayoutEffect(() => {
708
+ if (defaultId || id) return;
709
+ setId(`id-${Math.random().toString(36).slice(2, 8)}`);
710
+ }, [defaultId, id]);
711
+ return defaultId || id;
712
+ }
713
+ function useTagName(refOrElement, type) {
714
+ const stringOrUndefined = (type2) => {
715
+ if (typeof type2 !== "string") return;
716
+ return type2;
717
+ };
718
+ const [tagName, setTagName] = _react.useState.call(void 0, () => stringOrUndefined(type));
719
+ useSafeLayoutEffect(() => {
720
+ var _a;
721
+ setTagName(((_a = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement) == null ? void 0 : _a.tagName.toLowerCase()) || stringOrUndefined(type));
722
+ }, [refOrElement, type]);
723
+ return tagName;
724
+ }
725
+ function useAttribute(refOrElement, attributeName, defaultValue2) {
726
+ const initialValue = useInitialValue(defaultValue2);
727
+ const [attribute, setAttribute] = _react.useState.call(void 0, initialValue);
728
+ _react.useEffect.call(void 0, () => {
729
+ const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
730
+ if (!element) return;
731
+ const callback = () => {
732
+ const value = element.getAttribute(attributeName);
733
+ setAttribute(value == null ? initialValue : value);
734
+ };
735
+ const observer = new MutationObserver(callback);
736
+ observer.observe(element, { attributeFilter: [attributeName] });
737
+ callback();
738
+ return () => observer.disconnect();
739
+ }, [
740
+ refOrElement,
741
+ attributeName,
742
+ initialValue
743
+ ]);
744
+ return attribute;
745
+ }
746
+ function useUpdateEffect(effect, deps) {
747
+ const mounted = _react.useRef.call(void 0, false);
748
+ _react.useEffect.call(void 0, () => {
749
+ if (mounted.current) return effect();
750
+ mounted.current = true;
751
+ }, deps);
752
+ _react.useEffect.call(void 0, () => () => {
753
+ mounted.current = false;
754
+ }, []);
755
+ }
756
+ function useUpdateLayoutEffect(effect, deps) {
757
+ const mounted = _react.useRef.call(void 0, false);
758
+ useSafeLayoutEffect(() => {
759
+ if (mounted.current) return effect();
760
+ mounted.current = true;
761
+ }, deps);
762
+ useSafeLayoutEffect(() => () => {
763
+ mounted.current = false;
764
+ }, []);
765
+ }
766
+ function useForceUpdate() {
767
+ return _react.useReducer.call(void 0, () => [], []);
768
+ }
769
+ function useBooleanEvent(booleanOrCallback) {
770
+ return useEvent(typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback);
771
+ }
772
+ function useWrapElement(props, callback, deps = []) {
773
+ const wrapElement = _react.useCallback.call(void 0, (element) => {
774
+ if (props.wrapElement) element = props.wrapElement(element);
775
+ return callback(element);
776
+ }, [...deps, props.wrapElement]);
777
+ return {
778
+ ...props,
779
+ wrapElement
780
+ };
781
+ }
782
+ function usePortalRef(portalProp = false, portalRefProp) {
783
+ const [portalNode, setPortalNode] = _react.useState.call(void 0, null);
784
+ return {
785
+ portalRef: useMergeRefs(setPortalNode, portalRefProp),
786
+ portalNode,
787
+ domReady: !portalProp || portalNode
788
+ };
789
+ }
790
+ function useMetadataProps(props, key, value) {
791
+ const parent = props.onLoadedMetadataCapture;
792
+ const onLoadedMetadataCapture = _react.useMemo.call(void 0, () => {
793
+ return Object.assign(() => {
794
+ }, parent, ...value !== void 0 ? [{ [key]: value }] : []);
795
+ }, [
796
+ parent,
797
+ key,
798
+ value
799
+ ]);
800
+ return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
801
+ }
802
+ var hasInstalledGlobalEventListeners = false;
803
+ function useIsMouseMoving() {
804
+ _react.useEffect.call(void 0, () => {
805
+ if (hasInstalledGlobalEventListeners) return;
806
+ addGlobalEventListener("mousemove", setMouseMoving, true);
807
+ addGlobalEventListener("mousedown", resetMouseMoving, true);
808
+ addGlobalEventListener("mouseup", resetMouseMoving, true);
809
+ addGlobalEventListener("keydown", resetMouseMoving, true);
810
+ addGlobalEventListener("scroll", resetMouseMoving, true);
811
+ hasInstalledGlobalEventListeners = true;
812
+ }, []);
813
+ return useEvent(() => mouseMoving);
814
+ }
815
+ var mouseMoving = false;
816
+ var previousScreenX = 0;
817
+ var previousScreenY = 0;
818
+ function hasMouseMovement(event) {
819
+ const movementX = event.movementX || event.screenX - previousScreenX;
820
+ const movementY = event.movementY || event.screenY - previousScreenY;
821
+ previousScreenX = event.screenX;
822
+ previousScreenY = event.screenY;
823
+ return movementX || movementY || false;
824
+ }
825
+ function setMouseMoving(event) {
826
+ if (!hasMouseMovement(event)) return;
827
+ mouseMoving = true;
828
+ }
829
+ function resetMouseMoving() {
830
+ mouseMoving = false;
831
+ }
832
+ function forwardRef2(render) {
833
+ const Role = React.forwardRef((props, ref) => render({
834
+ ...props,
835
+ ref
836
+ }));
837
+ Role.displayName = render.displayName || render.name;
838
+ return Role;
839
+ }
840
+ function memo2(Component, propsAreEqual) {
841
+ return React.memo(Component, propsAreEqual);
842
+ }
843
+ function createElement(Type, props) {
844
+ const { wrapElement, render, ...rest } = props;
845
+ const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
846
+ let element;
847
+ if (React.isValidElement(render)) {
848
+ const renderProps = {
849
+ ...render.props,
850
+ ref: mergedRef
851
+ };
852
+ element = React.cloneElement(render, mergeProps(rest, renderProps));
853
+ } else if (render) element = render(rest);
854
+ else element = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Type, { ...rest });
855
+ if (wrapElement) return wrapElement(element);
856
+ return element;
857
+ }
858
+ function createHook(useProps) {
859
+ const useRole = (props = {}) => {
860
+ return useProps(props);
861
+ };
862
+ useRole.displayName = useProps.name;
863
+ return useRole;
864
+ }
865
+ function createStoreContext(providers = [], scopedProviders = []) {
866
+ const context = React.createContext(void 0);
867
+ const scopedContext = React.createContext(void 0);
868
+ const useContext2 = () => React.useContext(context);
869
+ const useScopedContext = (onlyScoped = false) => {
870
+ const scoped = React.useContext(scopedContext);
871
+ const store = useContext2();
872
+ if (onlyScoped) return scoped;
873
+ return scoped || store;
874
+ };
875
+ const useProviderContext = () => {
876
+ const scoped = React.useContext(scopedContext);
877
+ const store = useContext2();
878
+ if (scoped && scoped === store) return;
879
+ return store;
880
+ };
881
+ const ContextProvider = (props) => {
882
+ return providers.reduceRight((children, Provider) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Provider, {
883
+ ...props,
884
+ children
885
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, context.Provider, { ...props }));
886
+ };
887
+ const ScopedContextProvider = (props) => {
888
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContextProvider, {
889
+ ...props,
890
+ children: scopedProviders.reduceRight((children, Provider) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Provider, {
891
+ ...props,
892
+ children
893
+ }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, scopedContext.Provider, { ...props }))
894
+ });
895
+ };
896
+ return {
897
+ context,
898
+ scopedContext,
899
+ useContext: useContext2,
900
+ useScopedContext,
901
+ useProviderContext,
902
+ ContextProvider,
903
+ ScopedContextProvider
904
+ };
905
+ }
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+
976
+
977
+
978
+
979
+
980
+
981
+
982
+
983
+
984
+
985
+
986
+
987
+
988
+
989
+
990
+
991
+
992
+
993
+
994
+
995
+
996
+ exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.toArray = toArray; exports.flatten2DArray = flatten2DArray; exports.reverseArray = reverseArray; exports.getDocument = getDocument; exports.getWindow = getWindow; exports.getActiveElement = getActiveElement; exports.contains = contains; exports.isButton = isButton; exports.isTextField = isTextField; exports.isTextbox = isTextbox; exports.getTextboxValue = getTextboxValue; exports.getTextboxSelection = getTextboxSelection; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.getScrollingElement = getScrollingElement; exports.setSelectionRange = setSelectionRange; exports.sortBasedOnDOMPosition = sortBasedOnDOMPosition; exports.isTouchDevice = isTouchDevice; exports.isApple = isApple; exports.isSafari = isSafari; exports.isFirefox = isFirefox; exports.isMac = isMac; exports.isPortalEvent = isPortalEvent; exports.isSelfTarget = isSelfTarget; exports.isOpeningInNewTab = isOpeningInNewTab; exports.isDownloading = isDownloading; exports.fireEvent = fireEvent; exports.fireBlurEvent = fireBlurEvent; exports.fireKeyboardEvent = fireKeyboardEvent; exports.fireClickEvent = fireClickEvent; exports.isFocusEventOutside = isFocusEventOutside; exports.queueBeforeEvent = queueBeforeEvent; exports.addGlobalEventListener = addGlobalEventListener; exports.isFocusable = isFocusable; exports.getAllTabbableIn = getAllTabbableIn; exports.getFirstTabbableIn = getFirstTabbableIn; exports.getNextTabbable = getNextTabbable; exports.getPreviousTabbable = getPreviousTabbable; exports.hasFocus = hasFocus; exports.hasFocusWithin = hasFocusWithin; exports.disableFocusIn = disableFocusIn; exports.restoreFocusIn = restoreFocusIn; exports.focusIntoView = focusIntoView; exports.noop = noop; exports.shallowEqual = shallowEqual; exports.applyState = applyState; exports.isObject = isObject; exports.isInteger = isInteger; exports.hasOwnProperty = hasOwnProperty; exports.chain = chain; exports.cx = cx; exports.normalizeString = normalizeString; exports.omit = omit; exports.pick = pick; exports.identity = identity; exports.invariant = invariant; exports.getKeys = getKeys; exports.isFalsyBooleanCallback = isFalsyBooleanCallback; exports.disabledFromProps = disabledFromProps; exports.disabledFromElement = disabledFromElement; exports.removeUndefinedValues = removeUndefinedValues; exports.defaultValue = defaultValue; exports.setRef = setRef; exports.useSafeLayoutEffect = useSafeLayoutEffect; exports.useInitialValue = useInitialValue; exports.useLiveRef = useLiveRef; exports.useEvent = useEvent; exports.useTransactionState = useTransactionState; exports.useMergeRefs = useMergeRefs; exports.useId = useId; exports.useTagName = useTagName; exports.useAttribute = useAttribute; exports.useUpdateEffect = useUpdateEffect; exports.useUpdateLayoutEffect = useUpdateLayoutEffect; exports.useForceUpdate = useForceUpdate; exports.useBooleanEvent = useBooleanEvent; exports.useWrapElement = useWrapElement; exports.usePortalRef = usePortalRef; exports.useMetadataProps = useMetadataProps; exports.useIsMouseMoving = useIsMouseMoving; exports.forwardRef = forwardRef2; exports.memo = memo2; exports.createElement = createElement; exports.createHook = createHook; exports.createStoreContext = createStoreContext;