@qredence/fleet 0.5.1 → 0.5.7

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 (200) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/fleet-prime.mjs +6 -0
  3. package/dist/web/client/assets/action-swap-roll-BB8DFMuf.js +1 -0
  4. package/dist/web/client/assets/agent-activity-CDcDNVC6.js +1 -0
  5. package/dist/web/client/assets/agent-disclosure-B8SnhQXL.js +1 -0
  6. package/dist/web/client/assets/analytics-stub-B8MIkiDB.js +1 -0
  7. package/dist/web/client/assets/{artifacts-panel-CX62LQ13.js → artifacts-panel-CmHYXfoo.js} +1 -1
  8. package/dist/web/client/assets/button-BV9NafmI.js +1 -0
  9. package/dist/web/client/assets/{chat-CsepBQwy.js → chat-W-yOMyG_.js} +1 -1
  10. package/dist/web/client/assets/chat-command-palette-DiG-i3uJ.js +1 -0
  11. package/dist/web/client/assets/check-JjHKAZas.js +1 -0
  12. package/dist/web/client/assets/chevron-up-CnSvySGH.js +1 -0
  13. package/dist/web/client/assets/circle-alert-CONlFReH.js +1 -0
  14. package/dist/web/client/assets/circle-x-CkKCB__4.js +1 -0
  15. package/dist/web/client/assets/citations-CpTFUvx7.js +2 -0
  16. package/dist/web/client/assets/collapsible-BoXtZZWN.js +1 -0
  17. package/dist/web/client/assets/command-Cx-UYeQ9.js +1 -0
  18. package/dist/web/client/assets/createBaseUIEventDetails-DV0dQrBX.js +1 -0
  19. package/dist/web/client/assets/dialog-Dh7WpGIu.js +1 -0
  20. package/dist/web/client/assets/dist-BPaFisIZ.js +41 -0
  21. package/dist/web/client/assets/earth-DGZXAN5r.js +1 -0
  22. package/dist/web/client/assets/ease-u56MhKYS.js +1 -0
  23. package/dist/web/client/assets/file-text-T-NcAlZs.js +1 -0
  24. package/dist/web/client/assets/fleet-message-queue-B6zAK-hX.js +1 -0
  25. package/dist/web/client/assets/{fleet-pi-tool-renderer-BD_ZAjlG.js → fleet-pi-tool-renderer-Btq9mDUe.js} +29 -29
  26. package/dist/web/client/assets/fleet-reasoning-panel-MtbSdoCv.js +1 -0
  27. package/dist/web/client/assets/fleet-subagent-list-iszvrvy_.js +1 -0
  28. package/dist/web/client/assets/fleet-tool-timeline-COzPrwr8.js +1 -0
  29. package/dist/web/client/assets/{fork-picker-dialog-C2cVJUbf.js → fork-picker-dialog-CAhWx0G5.js} +1 -1
  30. package/dist/web/client/assets/gauge-DNpstbBn.js +1 -0
  31. package/dist/web/client/assets/generative-text-renderer-C1JrmYfx.js +6 -0
  32. package/dist/web/client/assets/globals-Bfr0jrPq.css +2 -0
  33. package/dist/web/client/assets/horizontal-resize-Bl3AyBJg.js +1 -0
  34. package/dist/web/client/assets/image-BbPmlw-n.js +1 -0
  35. package/dist/web/client/assets/index-QgUwd4m8.js +12 -0
  36. package/dist/web/client/assets/input-Bol3TP4v.js +1 -0
  37. package/dist/web/client/assets/input-group-D5gi9zBK.js +1 -0
  38. package/dist/web/client/assets/{ipython-tool-BfeIa0nK.js → ipython-tool-BrMePqD-.js} +1 -1
  39. package/dist/web/client/assets/{markdown-DG7pUdsX.js → markdown-RD_ydkyD.js} +2 -2
  40. package/dist/web/client/assets/{markdown-code-BgMzpy7O.js → markdown-code-ETqXqY8E.js} +1 -1
  41. package/dist/web/client/assets/message-square-hbDao-A1.js +1 -0
  42. package/dist/web/client/assets/model-selector-list-CJY9pyt2.js +1 -0
  43. package/dist/web/client/assets/notify-DKTqXChG.js +1 -0
  44. package/dist/web/client/assets/{openui-renderer-DlUo6ehT.js → openui-renderer-BZMghkzQ.js} +8 -8
  45. package/dist/web/client/assets/{prime-agent-artifacts-CHGb5V_j.js → prime-agent-artifacts-C-g1VPiW.js} +1 -1
  46. package/dist/web/client/assets/prompt-suggestions-CXM6knMK.js +1 -0
  47. package/dist/web/client/assets/provider-catalog-CHKFGwHr.js +1 -0
  48. package/dist/web/client/assets/provider-label-KkqVX1CI.js +1 -0
  49. package/dist/web/client/assets/range-BWOHiLNe.js +1 -0
  50. package/dist/web/client/assets/refresh-cw-IThTJ3j-.js +1 -0
  51. package/dist/web/client/assets/repl-panel-CCh4ly7J.js +1 -0
  52. package/dist/web/client/assets/{resource-helpers-ULlyU8qK.js → resource-helpers-Q2T0YCMO.js} +1 -1
  53. package/dist/web/client/assets/resources-panel-Bo8dfUdm.js +1 -0
  54. package/dist/web/client/assets/right-panel-context-B2VAZ2p4.js +1 -0
  55. package/dist/web/client/assets/right-panel-registry-C5fQcBKw.js +2 -0
  56. package/dist/web/client/assets/routes-C1hRkRkv.js +16 -0
  57. package/dist/web/client/assets/safe-external-url-D3PJJIcM.js +1 -0
  58. package/dist/web/client/assets/session-insights-panel-CQdT90Op.js +1 -0
  59. package/dist/web/client/assets/settings-dialog-CvvM6T0m.js +1 -0
  60. package/dist/web/client/assets/{sparkles-C5H3Jtgf.js → shield-check-CkA2viVW.js} +1 -1
  61. package/dist/web/client/assets/{skeleton-loaders-fStjEeRP.js → skeleton-loaders-DjGv9LLA.js} +1 -1
  62. package/dist/web/client/assets/sparkles-DuclzqlE.js +1 -0
  63. package/dist/web/client/assets/subagent-chat-panel-tGCg6gcn.js +1 -0
  64. package/dist/web/client/assets/subagent-transcript-NO0PR8RU.js +1 -0
  65. package/dist/web/client/assets/subagent-utils-CQbaJ1g-.js +1 -0
  66. package/dist/web/client/assets/subagents-panel-BkFLsQQY.js +1 -0
  67. package/dist/web/client/assets/surfaces-cW-gp56p.js +1 -0
  68. package/dist/web/client/assets/switch-CcOFiQBK.js +1 -0
  69. package/dist/web/client/assets/terminal-DOS1s1gm.js +1 -0
  70. package/dist/web/client/assets/toast-ATq44uAL.js +1 -0
  71. package/dist/web/client/assets/tool-result-pklnrxSW.js +4 -0
  72. package/dist/web/client/assets/use-reduced-motion-eORd7fqW.js +9 -0
  73. package/dist/web/client/assets/useBaseUiId-CHqXB2UQ.js +1 -0
  74. package/dist/web/client/assets/useControlled-CJJ9BOQB.js +1 -0
  75. package/dist/web/client/assets/workspace-panel-BmMW7h7b.js +1 -0
  76. package/dist/web/client/assets/wrench-BJNNe07k.js +1 -0
  77. package/dist/web/client/assets/x-CsRC_tCI.js +1 -0
  78. package/dist/web/client/bundle-budget.json +10 -0
  79. package/dist/web/server/_tanstack-start-manifest_v-B4BnRTa_-DR7WQTT5.js +90 -0
  80. package/dist/web/server/agent-activity-Dx6AlDhN-JXOL2EXK.js +514 -0
  81. package/dist/web/server/{artifacts-panel-D9w1DHAN-FGRDCYU2.js → artifacts-panel-CloS3-ij-XWYXKL6A.js} +30 -22
  82. package/dist/web/server/{chat-command-palette-BaenPkCN-BHSOPGU4.js → chat-command-palette-Cc0uGvNm-GKENKTO7.js} +48 -22
  83. package/dist/web/server/{chunk-KPNGZR2R.js → chunk-3B6M63AO.js} +206 -209
  84. package/dist/web/server/chunk-3D4Z32XA.js +22 -0
  85. package/dist/web/server/chunk-3SSHBMDS.js +196 -0
  86. package/dist/web/server/chunk-4PQ6OD6J.js +22 -0
  87. package/dist/web/server/{chunk-5AVQZ4AZ.js → chunk-4UBOIY2S.js} +2 -1
  88. package/dist/web/server/chunk-56SEDI5N.js +19 -0
  89. package/dist/web/server/chunk-6QNW66XR.js +19 -0
  90. package/dist/web/server/chunk-744IIIDL.js +19 -0
  91. package/dist/web/server/{chunk-52SJQXO4.js → chunk-7PQTPSEE.js} +568 -568
  92. package/dist/web/server/{chunk-XYYNYFFD.js → chunk-7SR6WDM2.js} +2 -2
  93. package/dist/web/server/chunk-ANL4B775.js +60 -0
  94. package/dist/web/server/chunk-BNQWMQHD.js +35 -0
  95. package/dist/web/server/{chunk-X2TUFLTP.js → chunk-C5X6G26O.js} +436 -454
  96. package/dist/web/server/chunk-C66BSNA6.js +42 -0
  97. package/dist/web/server/{chunk-3GSFXWL5.js → chunk-DEUBJJZN.js} +4 -59
  98. package/dist/web/server/chunk-E365EOXJ.js +35 -0
  99. package/dist/web/server/{chunk-5WZFFNFY.js → chunk-EFAGCVZ3.js} +2 -23
  100. package/dist/web/server/{chunk-Y6LJ4WBI.js → chunk-EGQ6ZX4D.js} +563 -830
  101. package/dist/web/server/{chunk-DO3TVNGA.js → chunk-EKBKGAWX.js} +12 -10
  102. package/dist/web/server/{chunk-RPROZ2JC.js → chunk-F6MGAW3L.js} +133 -133
  103. package/dist/web/server/chunk-GABXCOY3.js +37 -0
  104. package/dist/web/server/chunk-GV7DJIHY.js +36 -0
  105. package/dist/web/server/{chunk-PWK2HJIV.js → chunk-HSJMLO36.js} +5 -252
  106. package/dist/web/server/{chunk-46VQY7SG.js → chunk-HU4AIJV3.js} +4 -4
  107. package/dist/web/server/{chunk-H64JLONZ.js → chunk-HZY3LBGP.js} +146 -2
  108. package/dist/web/server/{chunk-3IKSPTYI.js → chunk-J6MRJXUH.js} +22 -15
  109. package/dist/web/server/{chunk-FE4KN6T2.js → chunk-JOSTE7WK.js} +7 -5
  110. package/dist/web/server/{chunk-QJBEWT4E.js → chunk-K3BXQG3N.js} +27 -292
  111. package/dist/web/server/chunk-K4ESBQ3R.js +20 -0
  112. package/dist/web/server/chunk-KOIPYBJF.js +3773 -0
  113. package/dist/web/server/{chunk-44IVTHDV.js → chunk-KZSM3BHO.js} +28 -119
  114. package/dist/web/server/chunk-L46H6IDX.js +13 -0
  115. package/dist/web/server/chunk-LNGWHEE6.js +206 -0
  116. package/dist/web/server/{chunk-2U7PWSJX.js → chunk-MOSVTKH5.js} +262 -3661
  117. package/dist/web/server/{chunk-MDYA4NXK.js → chunk-NJRYX4A2.js} +4 -4
  118. package/dist/web/server/chunk-NNMZQN7Q.js +296 -0
  119. package/dist/web/server/{chunk-VHCAD46L.js → chunk-NPPG2GTW.js} +7 -7
  120. package/dist/web/server/{chunk-AZZHUVJR.js → chunk-PJNYH5SR.js} +7 -303
  121. package/dist/web/server/{chunk-7APYEQIO.js → chunk-QAE5SXDK.js} +1 -24
  122. package/dist/web/server/chunk-QTFCJGOY.js +189 -0
  123. package/dist/web/server/{chunk-FBOO3G67.js → chunk-RANJ6OJ3.js} +9 -9
  124. package/dist/web/server/chunk-RPBSDXJ4.js +62 -0
  125. package/dist/web/server/{chunk-PCJ5EKFE.js → chunk-RYHIJMFD.js} +63 -34
  126. package/dist/web/server/{chunk-NLIUTTKL.js → chunk-S3PQ6HKH.js} +1 -16
  127. package/dist/web/server/chunk-SG4W4SPQ.js +31 -0
  128. package/dist/web/server/{chunk-LESNF5O4.js → chunk-T23OO4SC.js} +2 -11
  129. package/dist/web/server/{chunk-FVWDJNXR.js → chunk-UNZJQ7CY.js} +6 -4
  130. package/dist/web/server/chunk-V3S6BVXO.js +22 -0
  131. package/dist/web/server/{chunk-M2FGGPNA.js → chunk-VGDP4YDU.js} +70 -45
  132. package/dist/web/server/{chunk-WK7CQS2N.js → chunk-W5GRNHV5.js} +51 -49
  133. package/dist/web/server/{chunk-HBZ6YKRB.js → chunk-WN77JNYY.js} +2 -2
  134. package/dist/web/server/{chunk-B2F6MLVZ.js → chunk-XFVL5ITL.js} +2246 -2228
  135. package/dist/web/server/{chunk-EIVNRYP3.js → chunk-XKYEXPLQ.js} +2 -17
  136. package/dist/web/server/{chunk-6GMKRR3C.js → chunk-XNYQSCB2.js} +2 -2
  137. package/dist/web/server/chunk-YHXAXJ6I.js +22 -0
  138. package/dist/web/server/chunk-YLMXYMLG.js +86 -0
  139. package/dist/web/server/chunk-YNGDUWCF.js +56 -0
  140. package/dist/web/server/chunk-ZJFA4F5X.js +280 -0
  141. package/dist/web/server/fleet-message-queue-Bn0_3Efe-G4BZR2EU.js +74 -0
  142. package/dist/web/server/fleet-pi-tool-renderer-C52SZmPx-CIAH3IV7.js +51 -0
  143. package/dist/web/server/fleet-reasoning-panel-C_e7wzVm-SDHEWDQT.js +199 -0
  144. package/dist/web/server/fleet-subagent-list-CQltKswG-EKCMQHDI.js +18 -0
  145. package/dist/web/server/fleet-tool-timeline-KENErMKg-HTN7SW3D.js +16 -0
  146. package/dist/web/server/{fork-picker-dialog-BZzfxdQd-Y725VJ7G.js → fork-picker-dialog-DK9YGQuB-4QEFWRU4.js} +6 -5
  147. package/dist/web/server/{markdown-Boni3lHk-AZGKDNAR.js → markdown-QcSUaLyd-6DJUK5NC.js} +1 -1
  148. package/dist/web/server/{markdown-code-BrWukbg3-D2GN4Y77.js → markdown-code-Dyo1_13a-52ZQZSPE.js} +2 -2
  149. package/dist/web/server/model-selector-list-CEfWjRc--GBW2GUO6.js +289 -0
  150. package/dist/web/server/{openui-renderer-Cg4RSE9k-7BTJIYZJ.js → openui-renderer-Dk0Ak9cW-MUJQHDAS.js} +19 -16
  151. package/dist/web/server/prompt-suggestions-BOmHi4-J-C563CHFU.js +30 -0
  152. package/dist/web/server/{repl-panel-BEQrC2ef-V3YEZ7EO.js → repl-panel-D9E8nkQy-L45ZNG2V.js} +4 -3
  153. package/dist/web/server/{resources-panel-CwKh4U9f-D3VDEMDW.js → resources-panel-B03M8bEp-SZG726N5.js} +7 -6
  154. package/dist/web/server/{router-CEahIUpn-SRG7XKIH.js → router-BE9HcX2W-JMQ3JWE5.js} +1756 -1374
  155. package/dist/web/server/{routes-BznemByz-F4DJAYIM.js → routes-CJTRGB1Z-WJKXJFFT.js} +3748 -3955
  156. package/dist/web/server/server.js +3 -3
  157. package/dist/web/server/{session-insights-panel-JfeTHE0d-3HZB3ZWI.js → session-insights-panel-BHZyKDTo-LRMAMA3O.js} +4 -2
  158. package/dist/web/server/{settings-dialog-DgeBMORv-7SRSENPM.js → settings-dialog-yDibpbBH-TCLJ7NRJ.js} +172 -161
  159. package/dist/web/server/{start-CLAD7RcD-56S4BWMM.js → start-BYVnok_H-IA6TWGA3.js} +1 -1
  160. package/dist/web/server/subagent-chat-panel-B1YoZIKO-DFRUDQJ2.js +82 -0
  161. package/dist/web/server/subagents-panel-dJJwpsEL-FTWWCHND.js +200 -0
  162. package/dist/web/server/{workspace-panel-y54P79_B-VPIYUXF6.js → workspace-panel-BC_H8Jri-5MHAEQQS.js} +22 -18
  163. package/package.json +5 -5
  164. package/dist/web/client/assets/analytics-stub-Jh3lkb8P.js +0 -1
  165. package/dist/web/client/assets/button-0At5xSyU.js +0 -1
  166. package/dist/web/client/assets/chat-command-palette-C4sSf8Kg.js +0 -1
  167. package/dist/web/client/assets/collapsible-DmyYcezk.js +0 -1
  168. package/dist/web/client/assets/command-CB6emP8m.js +0 -2
  169. package/dist/web/client/assets/conversation-turns-ByFoWPXe.js +0 -6
  170. package/dist/web/client/assets/dialog-DZ44tBtH.js +0 -1
  171. package/dist/web/client/assets/dist-MNgIFxqY.js +0 -41
  172. package/dist/web/client/assets/ease-vFBiNFNK.js +0 -9
  173. package/dist/web/client/assets/file-text-BhQ0ZnoU.js +0 -1
  174. package/dist/web/client/assets/globals-CqqQdk2S.css +0 -2
  175. package/dist/web/client/assets/horizontal-resize-C1TpRLNC.js +0 -1
  176. package/dist/web/client/assets/index-DweoFRMs.js +0 -12
  177. package/dist/web/client/assets/input-CqC82Agz.js +0 -1
  178. package/dist/web/client/assets/input-group-H0TG-mkU.js +0 -1
  179. package/dist/web/client/assets/notify-Duj26eeZ.js +0 -1
  180. package/dist/web/client/assets/provider-catalog-BZhZuKSz.js +0 -1
  181. package/dist/web/client/assets/provider-label-jKm8v18u.js +0 -1
  182. package/dist/web/client/assets/range-vSJ7Ux_5.js +0 -2
  183. package/dist/web/client/assets/repl-panel-DiGS6uCw.js +0 -1
  184. package/dist/web/client/assets/resources-panel-DSU7VGX2.js +0 -1
  185. package/dist/web/client/assets/routes-CxlNCi_v.js +0 -16
  186. package/dist/web/client/assets/safe-external-url-Bl_78dpZ.js +0 -1
  187. package/dist/web/client/assets/session-insights-panel-DwmwiikS.js +0 -1
  188. package/dist/web/client/assets/settings-dialog-CkfpTKfM.js +0 -1
  189. package/dist/web/client/assets/subagents-panel-DGnsK6Nx.js +0 -1
  190. package/dist/web/client/assets/switch-BFEBpUEU.js +0 -1
  191. package/dist/web/client/assets/toast-C4s7FYYa.js +0 -1
  192. package/dist/web/client/assets/tool-result-CBzwwUE9.js +0 -4
  193. package/dist/web/client/assets/useBaseUiId-B9f7fokB.js +0 -1
  194. package/dist/web/client/assets/useControlled-CoY1jSuL.js +0 -1
  195. package/dist/web/client/assets/workspace-panel-CjdXlEvd.js +0 -1
  196. package/dist/web/client/assets/x-BgciQ7_C.js +0 -1
  197. package/dist/web/server/_tanstack-start-manifest_v-bDUlyKY0-KFW35JRO.js +0 -82
  198. package/dist/web/server/chunk-ZEVZFLIY.js +0 -334
  199. package/dist/web/server/fleet-pi-tool-renderer-lJvZWmBJ-4M5YI6VS.js +0 -35
  200. package/dist/web/server/subagents-panel-CzZe3co7-2VZ5JTWF.js +0 -332
@@ -1,4 +1,4 @@
1
- // web/app/dist/server/assets/dist-PLYubdCU.js
1
+ // web/app/dist/server/assets/dist-CBTaWHTc.js
2
2
  import * as React$1 from "react";
3
3
  import { useState as useState2 } from "react";
4
4
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
@@ -8,84 +8,11 @@ var __name$14 = (target, value) => __defProp$14(target, "name", {
8
8
  value,
9
9
  configurable: true
10
10
  });
11
- var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
12
- function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
13
- return /* @__PURE__ */ __name$14(function handleEvent(event) {
14
- originalEventHandler?.(event);
15
- if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) return ourEventHandler?.(event);
16
- }, "handleEvent");
17
- }
18
- __name$14(composeEventHandlers, "composeEventHandlers");
19
- function getOwnerWindow(element) {
20
- if (!canUseDOM) throw new Error("Cannot access window outside of the DOM");
21
- return element?.ownerDocument?.defaultView ?? window;
22
- }
23
- __name$14(getOwnerWindow, "getOwnerWindow");
24
- function getOwnerDocument(element) {
25
- if (!canUseDOM) throw new Error("Cannot access document outside of the DOM");
26
- return element?.ownerDocument ?? document;
27
- }
28
- __name$14(getOwnerDocument, "getOwnerDocument");
29
- function getActiveElement(node, activeDescendant = false) {
30
- const { activeElement } = getOwnerDocument(node);
31
- if (!activeElement?.nodeName) return null;
32
- if (isFrame(activeElement) && activeElement.contentDocument) return getActiveElement(activeElement.contentDocument.body, activeDescendant);
33
- if (activeDescendant) {
34
- const id = activeElement.getAttribute("aria-activedescendant");
35
- if (id) {
36
- const element = getOwnerDocument(activeElement).getElementById(id);
37
- if (element) return element;
38
- }
39
- }
40
- return activeElement;
41
- }
42
- __name$14(getActiveElement, "getActiveElement");
43
- function isFrame(element) {
44
- return element.tagName === "IFRAME";
45
- }
46
- __name$14(isFrame, "isFrame");
47
- var __defProp$13 = Object.defineProperty;
48
- var __name$13 = (target, value) => __defProp$13(target, "name", {
49
- value,
50
- configurable: true
51
- });
52
- function setRef$1(ref, value) {
53
- if (typeof ref === "function") return ref(value);
54
- else if (ref !== null && ref !== void 0) ref.current = value;
55
- }
56
- __name$13(setRef$1, "setRef");
57
- function composeRefs(...refs) {
58
- return (node) => {
59
- let hasCleanup = false;
60
- const cleanups = refs.map((ref) => {
61
- const cleanup = setRef$1(ref, node);
62
- if (!hasCleanup && typeof cleanup == "function") hasCleanup = true;
63
- return cleanup;
64
- });
65
- if (hasCleanup) return () => {
66
- for (let i = 0; i < cleanups.length; i++) {
67
- const cleanup = cleanups[i];
68
- if (typeof cleanup == "function") cleanup();
69
- else setRef$1(refs[i], null);
70
- }
71
- };
72
- };
73
- }
74
- __name$13(composeRefs, "composeRefs");
75
- function useComposedRefs(...refs) {
76
- return React$1.useCallback(composeRefs(...refs), refs);
77
- }
78
- __name$13(useComposedRefs, "useComposedRefs");
79
- var __defProp$12 = Object.defineProperty;
80
- var __name$12 = (target, value) => __defProp$12(target, "name", {
81
- value,
82
- configurable: true
83
- });
84
11
  // @__NO_SIDE_EFFECTS__
85
12
  function createContext2(rootComponentName, defaultContext) {
86
13
  const Context = React$1.createContext(defaultContext);
87
14
  Context.displayName = rootComponentName + "Context";
88
- const Provider = /* @__PURE__ */ __name$12((props) => {
15
+ const Provider = /* @__PURE__ */ __name$14((props) => {
89
16
  const { children, ...context } = props;
90
17
  const value = React$1.useMemo(() => context, Object.values(context));
91
18
  return /* @__PURE__ */ jsx(Context.Provider, {
@@ -102,10 +29,10 @@ function createContext2(rootComponentName, defaultContext) {
102
29
  if (optional) return void 0;
103
30
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
104
31
  }
105
- __name$12(useContext2, "useContext");
32
+ __name$14(useContext2, "useContext");
106
33
  return [Provider, useContext2];
107
34
  }
108
- __name$12(createContext2, "createContext");
35
+ __name$14(createContext2, "createContext");
109
36
  // @__NO_SIDE_EFFECTS__
110
37
  function createContextScope(scopeName, createContextScopeDeps = []) {
111
38
  let defaultContexts = [];
@@ -114,7 +41,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
114
41
  BaseContext.displayName = rootComponentName + "Context";
115
42
  const index = defaultContexts.length;
116
43
  defaultContexts = [...defaultContexts, defaultContext];
117
- const Provider = /* @__PURE__ */ __name$12((props) => {
44
+ const Provider = /* @__PURE__ */ __name$14((props) => {
118
45
  const { scope, children, ...context } = props;
119
46
  const Context = scope?.[scopeName]?.[index] || BaseContext;
120
47
  const value = React$1.useMemo(() => context, Object.values(context));
@@ -133,15 +60,15 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
133
60
  if (optional) return void 0;
134
61
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
135
62
  }
136
- __name$12(useContext2, "useContext");
63
+ __name$14(useContext2, "useContext");
137
64
  return [Provider, useContext2];
138
65
  }
139
- __name$12(createContext3, "createContext");
140
- const createScope = /* @__PURE__ */ __name$12(() => {
66
+ __name$14(createContext3, "createContext");
67
+ const createScope = /* @__PURE__ */ __name$14(() => {
141
68
  const scopeContexts = defaultContexts.map((defaultContext) => {
142
69
  return React$1.createContext(defaultContext);
143
70
  });
144
- return /* @__PURE__ */ __name$12(function useScope(scope) {
71
+ return /* @__PURE__ */ __name$14(function useScope(scope) {
145
72
  const contexts = scope?.[scopeName] || scopeContexts;
146
73
  return React$1.useMemo(() => ({ [`__scope${scopeName}`]: {
147
74
  ...scope,
@@ -152,16 +79,16 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
152
79
  createScope.scopeName = scopeName;
153
80
  return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
154
81
  }
155
- __name$12(createContextScope, "createContextScope");
82
+ __name$14(createContextScope, "createContextScope");
156
83
  function composeContextScopes(...scopes) {
157
84
  const baseScope = scopes[0];
158
85
  if (scopes.length === 1) return baseScope;
159
- const createScope = /* @__PURE__ */ __name$12(() => {
86
+ const createScope = /* @__PURE__ */ __name$14(() => {
160
87
  const scopeHooks = scopes.map((createScope2) => ({
161
88
  useScope: createScope2(),
162
89
  scopeName: createScope2.scopeName
163
90
  }));
164
- return /* @__PURE__ */ __name$12(function useComposedScopes(overrideScopes) {
91
+ return /* @__PURE__ */ __name$14(function useComposedScopes(overrideScopes) {
165
92
  const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
166
93
  const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
167
94
  return {
@@ -175,24 +102,194 @@ function composeContextScopes(...scopes) {
175
102
  createScope.scopeName = baseScope.scopeName;
176
103
  return createScope;
177
104
  }
178
- __name$12(composeContextScopes, "composeContextScopes");
179
- var useLayoutEffect2 = globalThis?.document ? React$1.useLayoutEffect : () => {
180
- };
105
+ __name$14(composeContextScopes, "composeContextScopes");
106
+ var __defProp$13 = Object.defineProperty;
107
+ var __name$13 = (target, value) => __defProp$13(target, "name", {
108
+ value,
109
+ configurable: true
110
+ });
111
+ function setRef$1(ref, value) {
112
+ if (typeof ref === "function") return ref(value);
113
+ else if (ref !== null && ref !== void 0) ref.current = value;
114
+ }
115
+ __name$13(setRef$1, "setRef");
116
+ function composeRefs(...refs) {
117
+ return (node) => {
118
+ let hasCleanup = false;
119
+ const cleanups = refs.map((ref) => {
120
+ const cleanup = setRef$1(ref, node);
121
+ if (!hasCleanup && typeof cleanup == "function") hasCleanup = true;
122
+ return cleanup;
123
+ });
124
+ if (hasCleanup) return () => {
125
+ for (let i = 0; i < cleanups.length; i++) {
126
+ const cleanup = cleanups[i];
127
+ if (typeof cleanup == "function") cleanup();
128
+ else setRef$1(refs[i], null);
129
+ }
130
+ };
131
+ };
132
+ }
133
+ __name$13(composeRefs, "composeRefs");
134
+ function useComposedRefs(...refs) {
135
+ return React$1.useCallback(composeRefs(...refs), refs);
136
+ }
137
+ __name$13(useComposedRefs, "useComposedRefs");
138
+ var __defProp$12 = Object.defineProperty;
139
+ var __name$12 = (target, value) => __defProp$12(target, "name", {
140
+ value,
141
+ configurable: true
142
+ });
143
+ // @__NO_SIDE_EFFECTS__
144
+ function createSlot(ownerName) {
145
+ const Slot2 = React$1.forwardRef((props, forwardedRef) => {
146
+ let { children, ...slotProps } = props;
147
+ let slottableElement = null;
148
+ let hasSlottable = false;
149
+ const newChildren = [];
150
+ if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
151
+ React$1.Children.forEach(children, (maybeSlottable) => {
152
+ if (isSlottable(maybeSlottable)) {
153
+ hasSlottable = true;
154
+ const slottable = maybeSlottable;
155
+ let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
156
+ if (isLazyComponent(child) && typeof use === "function") child = use(child._payload);
157
+ slottableElement = getSlottableElementFromSlottable(slottable, child);
158
+ newChildren.push(slottableElement?.props?.children);
159
+ } else newChildren.push(maybeSlottable);
160
+ });
161
+ if (slottableElement) slottableElement = React$1.cloneElement(slottableElement, void 0, newChildren);
162
+ else if (!hasSlottable && React$1.Children.count(children) === 1 && React$1.isValidElement(children)) slottableElement = children;
163
+ const slottableElementRef = slottableElement ? getElementRef$1(slottableElement) : void 0;
164
+ const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
165
+ if (!slottableElement) {
166
+ if (children || children === 0) throw new Error(hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName));
167
+ return children;
168
+ }
169
+ const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
170
+ if (slottableElement.type !== React$1.Fragment) mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
171
+ return React$1.cloneElement(slottableElement, mergedProps);
172
+ });
173
+ Slot2.displayName = `${ownerName}.Slot`;
174
+ return Slot2;
175
+ }
176
+ __name$12(createSlot, "createSlot");
177
+ var Slot$1 = /* @__PURE__ */ createSlot("Slot");
178
+ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol.for("radix.slottable");
179
+ // @__NO_SIDE_EFFECTS__
180
+ function createSlottable(ownerName) {
181
+ const Slottable2 = /* @__PURE__ */ __name$12((props) => "child" in props ? props.children(props.child) : props.children, "Slottable");
182
+ Slottable2.displayName = `${ownerName}.Slottable`;
183
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
184
+ return Slottable2;
185
+ }
186
+ __name$12(createSlottable, "createSlottable");
187
+ var Slottable = /* @__PURE__ */ createSlottable("Slottable");
188
+ var getSlottableElementFromSlottable = /* @__PURE__ */ __name$12((slottable, child) => {
189
+ if ("child" in slottable.props) {
190
+ const child2 = slottable.props.child;
191
+ if (!React$1.isValidElement(child2)) return null;
192
+ return React$1.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
193
+ }
194
+ return React$1.isValidElement(child) ? child : null;
195
+ }, "getSlottableElementFromSlottable");
196
+ function mergeProps(slotProps, childProps) {
197
+ const overrideProps = { ...childProps };
198
+ for (const propName in childProps) {
199
+ const slotPropValue = slotProps[propName];
200
+ const childPropValue = childProps[propName];
201
+ if (/^on[A-Z]/.test(propName)) {
202
+ if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
203
+ const result = childPropValue(...args);
204
+ slotPropValue(...args);
205
+ return result;
206
+ };
207
+ else if (slotPropValue) overrideProps[propName] = slotPropValue;
208
+ } else if (propName === "style") overrideProps[propName] = {
209
+ ...slotPropValue,
210
+ ...childPropValue
211
+ };
212
+ else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
213
+ }
214
+ return {
215
+ ...slotProps,
216
+ ...overrideProps
217
+ };
218
+ }
219
+ __name$12(mergeProps, "mergeProps");
220
+ function getElementRef$1(element) {
221
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
222
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
223
+ if (mayWarn) return element.ref;
224
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
225
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
226
+ if (mayWarn) return element.props.ref;
227
+ return element.props.ref || element.ref;
228
+ }
229
+ __name$12(getElementRef$1, "getElementRef");
230
+ function isSlottable(child) {
231
+ return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
232
+ }
233
+ __name$12(isSlottable, "isSlottable");
234
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
235
+ function isLazyComponent(element) {
236
+ return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
237
+ }
238
+ __name$12(isLazyComponent, "isLazyComponent");
239
+ function isPromiseLike(value) {
240
+ return typeof value === "object" && value !== null && "then" in value;
241
+ }
242
+ __name$12(isPromiseLike, "isPromiseLike");
243
+ var createSlotError = /* @__PURE__ */ __name$12((ownerName) => {
244
+ return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
245
+ }, "createSlotError");
246
+ var createSlottableError = /* @__PURE__ */ __name$12((ownerName) => {
247
+ return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
248
+ }, "createSlottableError");
249
+ var use = React$1[" use ".trim().toString()];
181
250
  var __defProp$11 = Object.defineProperty;
182
251
  var __name$11 = (target, value) => __defProp$11(target, "name", {
183
252
  value,
184
253
  configurable: true
185
254
  });
186
- var useReactId = React$1[" useId ".trim().toString()] || (() => void 0);
187
- var count$1 = 0;
188
- function useId$1(deterministicId) {
189
- const [id, setId] = React$1.useState(useReactId());
190
- useLayoutEffect2(() => {
191
- if (!deterministicId) setId((reactId) => reactId ?? String(count$1++));
192
- }, [deterministicId]);
193
- return deterministicId || (id ? `radix-${id}` : "");
255
+ var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
256
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
257
+ return /* @__PURE__ */ __name$11(function handleEvent(event) {
258
+ originalEventHandler?.(event);
259
+ if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) return ourEventHandler?.(event);
260
+ }, "handleEvent");
261
+ }
262
+ __name$11(composeEventHandlers, "composeEventHandlers");
263
+ function getOwnerWindow(element) {
264
+ if (!canUseDOM) throw new Error("Cannot access window outside of the DOM");
265
+ return element?.ownerDocument?.defaultView ?? window;
266
+ }
267
+ __name$11(getOwnerWindow, "getOwnerWindow");
268
+ function getOwnerDocument(element) {
269
+ if (!canUseDOM) throw new Error("Cannot access document outside of the DOM");
270
+ return element?.ownerDocument ?? document;
271
+ }
272
+ __name$11(getOwnerDocument, "getOwnerDocument");
273
+ function getActiveElement(node, activeDescendant = false) {
274
+ const { activeElement } = getOwnerDocument(node);
275
+ if (!activeElement?.nodeName) return null;
276
+ if (isFrame(activeElement) && activeElement.contentDocument) return getActiveElement(activeElement.contentDocument.body, activeDescendant);
277
+ if (activeDescendant) {
278
+ const id = activeElement.getAttribute("aria-activedescendant");
279
+ if (id) {
280
+ const element = getOwnerDocument(activeElement).getElementById(id);
281
+ if (element) return element;
282
+ }
283
+ }
284
+ return activeElement;
285
+ }
286
+ __name$11(getActiveElement, "getActiveElement");
287
+ function isFrame(element) {
288
+ return element.tagName === "IFRAME";
194
289
  }
195
- __name$11(useId$1, "useId");
290
+ __name$11(isFrame, "isFrame");
291
+ var useLayoutEffect2 = globalThis?.document ? React$1.useLayoutEffect : () => {
292
+ };
196
293
  var __defProp$10 = Object.defineProperty;
197
294
  var __name$10 = (target, value) => __defProp$10(target, "name", {
198
295
  value,
@@ -320,118 +417,6 @@ var __name$8 = (target, value) => __defProp$8(target, "name", {
320
417
  value,
321
418
  configurable: true
322
419
  });
323
- // @__NO_SIDE_EFFECTS__
324
- function createSlot(ownerName) {
325
- const Slot2 = React$1.forwardRef((props, forwardedRef) => {
326
- let { children, ...slotProps } = props;
327
- let slottableElement = null;
328
- let hasSlottable = false;
329
- const newChildren = [];
330
- if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
331
- React$1.Children.forEach(children, (maybeSlottable) => {
332
- if (isSlottable(maybeSlottable)) {
333
- hasSlottable = true;
334
- const slottable = maybeSlottable;
335
- let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
336
- if (isLazyComponent(child) && typeof use === "function") child = use(child._payload);
337
- slottableElement = getSlottableElementFromSlottable(slottable, child);
338
- newChildren.push(slottableElement?.props?.children);
339
- } else newChildren.push(maybeSlottable);
340
- });
341
- if (slottableElement) slottableElement = React$1.cloneElement(slottableElement, void 0, newChildren);
342
- else if (!hasSlottable && React$1.Children.count(children) === 1 && React$1.isValidElement(children)) slottableElement = children;
343
- const slottableElementRef = slottableElement ? getElementRef$1(slottableElement) : void 0;
344
- const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
345
- if (!slottableElement) {
346
- if (children || children === 0) throw new Error(hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName));
347
- return children;
348
- }
349
- const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
350
- if (slottableElement.type !== React$1.Fragment) mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
351
- return React$1.cloneElement(slottableElement, mergedProps);
352
- });
353
- Slot2.displayName = `${ownerName}.Slot`;
354
- return Slot2;
355
- }
356
- __name$8(createSlot, "createSlot");
357
- var Slot$1 = /* @__PURE__ */ createSlot("Slot");
358
- var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol.for("radix.slottable");
359
- // @__NO_SIDE_EFFECTS__
360
- function createSlottable(ownerName) {
361
- const Slottable2 = /* @__PURE__ */ __name$8((props) => "child" in props ? props.children(props.child) : props.children, "Slottable");
362
- Slottable2.displayName = `${ownerName}.Slottable`;
363
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
364
- return Slottable2;
365
- }
366
- __name$8(createSlottable, "createSlottable");
367
- var Slottable = /* @__PURE__ */ createSlottable("Slottable");
368
- var getSlottableElementFromSlottable = /* @__PURE__ */ __name$8((slottable, child) => {
369
- if ("child" in slottable.props) {
370
- const child2 = slottable.props.child;
371
- if (!React$1.isValidElement(child2)) return null;
372
- return React$1.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
373
- }
374
- return React$1.isValidElement(child) ? child : null;
375
- }, "getSlottableElementFromSlottable");
376
- function mergeProps(slotProps, childProps) {
377
- const overrideProps = { ...childProps };
378
- for (const propName in childProps) {
379
- const slotPropValue = slotProps[propName];
380
- const childPropValue = childProps[propName];
381
- if (/^on[A-Z]/.test(propName)) {
382
- if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
383
- const result = childPropValue(...args);
384
- slotPropValue(...args);
385
- return result;
386
- };
387
- else if (slotPropValue) overrideProps[propName] = slotPropValue;
388
- } else if (propName === "style") overrideProps[propName] = {
389
- ...slotPropValue,
390
- ...childPropValue
391
- };
392
- else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
393
- }
394
- return {
395
- ...slotProps,
396
- ...overrideProps
397
- };
398
- }
399
- __name$8(mergeProps, "mergeProps");
400
- function getElementRef$1(element) {
401
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
402
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
403
- if (mayWarn) return element.ref;
404
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
405
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
406
- if (mayWarn) return element.props.ref;
407
- return element.props.ref || element.ref;
408
- }
409
- __name$8(getElementRef$1, "getElementRef");
410
- function isSlottable(child) {
411
- return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
412
- }
413
- __name$8(isSlottable, "isSlottable");
414
- var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
415
- function isLazyComponent(element) {
416
- return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
417
- }
418
- __name$8(isLazyComponent, "isLazyComponent");
419
- function isPromiseLike(value) {
420
- return typeof value === "object" && value !== null && "then" in value;
421
- }
422
- __name$8(isPromiseLike, "isPromiseLike");
423
- var createSlotError = /* @__PURE__ */ __name$8((ownerName) => {
424
- return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
425
- }, "createSlotError");
426
- var createSlottableError = /* @__PURE__ */ __name$8((ownerName) => {
427
- return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
428
- }, "createSlottableError");
429
- var use = React$1[" use ".trim().toString()];
430
- var __defProp$7 = Object.defineProperty;
431
- var __name$7 = (target, value) => __defProp$7(target, "name", {
432
- value,
433
- configurable: true
434
- });
435
420
  var Primitive = [
436
421
  "a",
437
422
  "button",
@@ -470,12 +455,167 @@ var Primitive = [
470
455
  function dispatchDiscreteCustomEvent(target, event) {
471
456
  if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
472
457
  }
473
- __name$7(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
458
+ __name$8(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
459
+ var __defProp$7 = Object.defineProperty;
460
+ var __name$7 = (target, value) => __defProp$7(target, "name", {
461
+ value,
462
+ configurable: true
463
+ });
464
+ function useStateMachine(initialState, machine) {
465
+ return React$1.useReducer((state, event) => {
466
+ return machine[state][event] ?? state;
467
+ }, initialState);
468
+ }
469
+ __name$7(useStateMachine, "useStateMachine");
470
+ var Presence = /* @__PURE__ */ __name$7((props) => {
471
+ const { present, children } = props;
472
+ const presence = usePresence(present);
473
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React$1.Children.only(children);
474
+ const ref = useStableComposedRefs(presence.ref, getElementRef(child));
475
+ return typeof children === "function" || presence.isPresent ? React$1.cloneElement(child, { ref }) : null;
476
+ }, "Presence");
477
+ function usePresence(present) {
478
+ const [node, setNode] = React$1.useState();
479
+ const stylesRef = React$1.useRef(null);
480
+ const prevPresentRef = React$1.useRef(present);
481
+ const prevAnimationNameRef = React$1.useRef("none");
482
+ const mountAnimationNameRef = React$1.useRef(void 0);
483
+ const [state, send] = useStateMachine(present ? "mounted" : "unmounted", {
484
+ mounted: {
485
+ UNMOUNT: "unmounted",
486
+ ANIMATION_OUT: "unmountSuspended"
487
+ },
488
+ unmountSuspended: {
489
+ MOUNT: "mounted",
490
+ ANIMATION_END: "unmounted"
491
+ },
492
+ unmounted: { MOUNT: "mounted" }
493
+ });
494
+ React$1.useEffect(() => {
495
+ if (state === "mounted") {
496
+ prevAnimationNameRef.current = mountAnimationNameRef.current ?? getAnimationName(stylesRef.current);
497
+ mountAnimationNameRef.current = void 0;
498
+ } else prevAnimationNameRef.current = "none";
499
+ }, [state]);
500
+ useLayoutEffect2(() => {
501
+ const styles = stylesRef.current;
502
+ const wasPresent = prevPresentRef.current;
503
+ if (wasPresent !== present) {
504
+ const prevAnimationName = prevAnimationNameRef.current;
505
+ const currentAnimationName = getAnimationName(styles);
506
+ if (present) {
507
+ mountAnimationNameRef.current = currentAnimationName;
508
+ send("MOUNT");
509
+ } else if (currentAnimationName === "none" || styles?.display === "none") send("UNMOUNT");
510
+ else if (wasPresent && prevAnimationName !== currentAnimationName) send("ANIMATION_OUT");
511
+ else send("UNMOUNT");
512
+ prevPresentRef.current = present;
513
+ }
514
+ }, [present, send]);
515
+ useLayoutEffect2(() => {
516
+ if (node) {
517
+ let timeoutId;
518
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
519
+ const handleAnimationEnd = /* @__PURE__ */ __name$7((event) => {
520
+ const isCurrentAnimation = getAnimationName(stylesRef.current).includes(CSS.escape(event.animationName));
521
+ if (event.target === node && isCurrentAnimation) {
522
+ send("ANIMATION_END");
523
+ if (!prevPresentRef.current) {
524
+ const currentFillMode = node.style.animationFillMode;
525
+ node.style.animationFillMode = "forwards";
526
+ timeoutId = ownerWindow.setTimeout(() => {
527
+ if (node.style.animationFillMode === "forwards") node.style.animationFillMode = currentFillMode;
528
+ });
529
+ }
530
+ }
531
+ }, "handleAnimationEnd");
532
+ const handleAnimationStart = /* @__PURE__ */ __name$7((event) => {
533
+ if (event.target === node) prevAnimationNameRef.current = getAnimationName(stylesRef.current);
534
+ }, "handleAnimationStart");
535
+ node.addEventListener("animationstart", handleAnimationStart);
536
+ node.addEventListener("animationcancel", handleAnimationEnd);
537
+ node.addEventListener("animationend", handleAnimationEnd);
538
+ return () => {
539
+ ownerWindow.clearTimeout(timeoutId);
540
+ node.removeEventListener("animationstart", handleAnimationStart);
541
+ node.removeEventListener("animationcancel", handleAnimationEnd);
542
+ node.removeEventListener("animationend", handleAnimationEnd);
543
+ };
544
+ } else send("ANIMATION_END");
545
+ }, [node, send]);
546
+ return {
547
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
548
+ ref: React$1.useCallback((node2) => {
549
+ if (node2) {
550
+ const styles = getComputedStyle(node2);
551
+ stylesRef.current = styles;
552
+ mountAnimationNameRef.current = getAnimationName(styles);
553
+ } else stylesRef.current = null;
554
+ setNode(node2);
555
+ }, [])
556
+ };
557
+ }
558
+ __name$7(usePresence, "usePresence");
559
+ function setRef(ref, value) {
560
+ if (typeof ref === "function") return ref(value);
561
+ else if (ref !== null && ref !== void 0) ref.current = value;
562
+ }
563
+ __name$7(setRef, "setRef");
564
+ function useStableComposedRefs(...refs) {
565
+ const refsRef = React$1.useRef(refs);
566
+ refsRef.current = refs;
567
+ return React$1.useCallback((node) => {
568
+ const currentRefs = refsRef.current;
569
+ let hasCleanup = false;
570
+ const cleanups = currentRefs.map((ref) => {
571
+ const cleanup = setRef(ref, node);
572
+ if (!hasCleanup && typeof cleanup === "function") hasCleanup = true;
573
+ return cleanup;
574
+ });
575
+ if (hasCleanup) return () => {
576
+ for (let i = 0; i < cleanups.length; i++) {
577
+ const cleanup = cleanups[i];
578
+ if (typeof cleanup === "function") cleanup();
579
+ else setRef(currentRefs[i], null);
580
+ }
581
+ };
582
+ }, []);
583
+ }
584
+ __name$7(useStableComposedRefs, "useStableComposedRefs");
585
+ function getAnimationName(styles) {
586
+ return styles?.animationName || "none";
587
+ }
588
+ __name$7(getAnimationName, "getAnimationName");
589
+ function getElementRef(element) {
590
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
591
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
592
+ if (mayWarn) return element.ref;
593
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
594
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
595
+ if (mayWarn) return element.props.ref;
596
+ return element.props.ref || element.ref;
597
+ }
598
+ __name$7(getElementRef, "getElementRef");
474
599
  var __defProp$6 = Object.defineProperty;
475
600
  var __name$6 = (target, value) => __defProp$6(target, "name", {
476
601
  value,
477
602
  configurable: true
478
603
  });
604
+ var useReactId = React$1[" useId ".trim().toString()] || (() => void 0);
605
+ var count$1 = 0;
606
+ function useId$1(deterministicId) {
607
+ const [id, setId] = React$1.useState(useReactId());
608
+ useLayoutEffect2(() => {
609
+ if (!deterministicId) setId((reactId) => reactId ?? String(count$1++));
610
+ }, [deterministicId]);
611
+ return deterministicId || (id ? `radix-${id}` : "");
612
+ }
613
+ __name$6(useId$1, "useId");
614
+ var __defProp$5 = Object.defineProperty;
615
+ var __name$5 = (target, value) => __defProp$5(target, "name", {
616
+ value,
617
+ configurable: true
618
+ });
479
619
  function useCallbackRef$1(callback) {
480
620
  const callbackRef = React$1.useRef(callback);
481
621
  React$1.useEffect(() => {
@@ -483,9 +623,9 @@ function useCallbackRef$1(callback) {
483
623
  });
484
624
  return React$1.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
485
625
  }
486
- __name$6(useCallbackRef$1, "useCallbackRef");
487
- var __defProp$5 = Object.defineProperty;
488
- var __name$5 = (target, value) => __defProp$5(target, "name", {
626
+ __name$5(useCallbackRef$1, "useCallbackRef");
627
+ var __defProp$4 = Object.defineProperty;
628
+ var __name$4 = (target, value) => __defProp$4(target, "name", {
489
629
  value,
490
630
  configurable: true
491
631
  });
@@ -499,7 +639,7 @@ var DismissableLayerContext = React$1.createContext({
499
639
  branches: /* @__PURE__ */ new Set(),
500
640
  dismissableSurfaces: /* @__PURE__ */ new Set()
501
641
  });
502
- var DismissableLayer = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$5(function DismissableLayer2(props, forwardedRef) {
642
+ var DismissableLayer = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$4(function DismissableLayer2(props, forwardedRef) {
503
643
  const { disableOutsidePointerEvents = false, deferPointerDownOutside = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
504
644
  const context = React$1.useContext(DismissableLayerContext);
505
645
  const [node, setNode] = React$1.useState(null);
@@ -586,7 +726,7 @@ var DismissableLayer = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name
586
726
  };
587
727
  }, [node, context]);
588
728
  React$1.useEffect(() => {
589
- const handleUpdate = /* @__PURE__ */ __name$5(() => force({}), "handleUpdate");
729
+ const handleUpdate = /* @__PURE__ */ __name$4(() => force({}), "handleUpdate");
590
730
  document.addEventListener(CONTEXT_UPDATE, handleUpdate);
591
731
  return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
592
732
  }, []);
@@ -614,8 +754,8 @@ function useDismissableLayerSurface() {
614
754
  }, [node, context.dismissableSurfaces]);
615
755
  return setNode;
616
756
  }
617
- __name$5(useDismissableLayerSurface, "useDismissableLayerSurface");
618
- var IS_TRUE = /* @__PURE__ */ __name$5(() => true, "IS_TRUE");
757
+ __name$4(useDismissableLayerSurface, "useDismissableLayerSurface");
758
+ var IS_TRUE = /* @__PURE__ */ __name$4(() => true, "IS_TRUE");
619
759
  function usePointerDownOutside(onPointerDownOutside, args) {
620
760
  const { ownerDocument = globalThis?.document, deferPointerDownOutside = false, isDeferredPointerDownOutsideRef, dismissableSurfaces, shouldHandlePointerDownOutside = IS_TRUE } = args;
621
761
  const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
@@ -630,11 +770,11 @@ function usePointerDownOutside(onPointerDownOutside, args) {
630
770
  isDeferredPointerDownOutsideRef.current = false;
631
771
  interceptedOutsideInteractionEventsRef.current.clear();
632
772
  }
633
- __name$5(resetOutsideInteraction, "resetOutsideInteraction");
773
+ __name$4(resetOutsideInteraction, "resetOutsideInteraction");
634
774
  function isOutsideInteractionIntercepted() {
635
775
  return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
636
776
  }
637
- __name$5(isOutsideInteractionIntercepted, "isOutsideInteractionIntercepted");
777
+ __name$4(isOutsideInteractionIntercepted, "isOutsideInteractionIntercepted");
638
778
  function handleInteractionCapture(event) {
639
779
  if (!isPointerDownOutsideRef.current) return;
640
780
  const target = event.target;
@@ -643,12 +783,12 @@ function usePointerDownOutside(onPointerDownOutside, args) {
643
783
  if (isPointerDownOutsideRef.current) handleClickRef.current();
644
784
  }, 0);
645
785
  }
646
- __name$5(handleInteractionCapture, "handleInteractionCapture");
786
+ __name$4(handleInteractionCapture, "handleInteractionCapture");
647
787
  function handleInteractionBubble(event) {
648
788
  if (isPointerDownOutsideRef.current) interceptedOutsideInteractionEventsRef.current.set(event.type, false);
649
789
  }
650
- __name$5(handleInteractionBubble, "handleInteractionBubble");
651
- const handlePointerDown = /* @__PURE__ */ __name$5((event) => {
790
+ __name$4(handleInteractionBubble, "handleInteractionBubble");
791
+ const handlePointerDown = /* @__PURE__ */ __name$4((event) => {
652
792
  if (event.target && !isPointerInsideReactTreeRef.current) {
653
793
  let handleAndDispatchPointerDownOutsideEvent2 = function() {
654
794
  ownerDocument.removeEventListener("click", handleClickRef.current);
@@ -656,7 +796,7 @@ function usePointerDownOutside(onPointerDownOutside, args) {
656
796
  resetOutsideInteraction();
657
797
  if (!wasOutsideInteractionIntercepted) handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { discrete: true });
658
798
  };
659
- __name$5(handleAndDispatchPointerDownOutsideEvent2, "handleAndDispatchPointerDownOutsideEvent");
799
+ __name$4(handleAndDispatchPointerDownOutsideEvent2, "handleAndDispatchPointerDownOutsideEvent");
660
800
  if (!shouldHandlePointerDownOutside(event.target)) {
661
801
  ownerDocument.removeEventListener("click", handleClickRef.current);
662
802
  resetOutsideInteraction();
@@ -711,30 +851,30 @@ function usePointerDownOutside(onPointerDownOutside, args) {
711
851
  dismissableSurfaces,
712
852
  shouldHandlePointerDownOutside
713
853
  ]);
714
- return { onPointerDownCapture: /* @__PURE__ */ __name$5(() => isPointerInsideReactTreeRef.current = true, "onPointerDownCapture") };
854
+ return { onPointerDownCapture: /* @__PURE__ */ __name$4(() => isPointerInsideReactTreeRef.current = true, "onPointerDownCapture") };
715
855
  }
716
- __name$5(usePointerDownOutside, "usePointerDownOutside");
856
+ __name$4(usePointerDownOutside, "usePointerDownOutside");
717
857
  function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
718
858
  const handleFocusOutside = useCallbackRef$1(onFocusOutside);
719
859
  const isFocusInsideReactTreeRef = React$1.useRef(false);
720
860
  React$1.useEffect(() => {
721
- const handleFocus = /* @__PURE__ */ __name$5((event) => {
861
+ const handleFocus = /* @__PURE__ */ __name$4((event) => {
722
862
  if (event.target && !isFocusInsideReactTreeRef.current) handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, { originalEvent: event }, { discrete: false });
723
863
  }, "handleFocus");
724
864
  ownerDocument.addEventListener("focusin", handleFocus);
725
865
  return () => ownerDocument.removeEventListener("focusin", handleFocus);
726
866
  }, [ownerDocument, handleFocusOutside]);
727
867
  return {
728
- onFocusCapture: /* @__PURE__ */ __name$5(() => isFocusInsideReactTreeRef.current = true, "onFocusCapture"),
729
- onBlurCapture: /* @__PURE__ */ __name$5(() => isFocusInsideReactTreeRef.current = false, "onBlurCapture")
868
+ onFocusCapture: /* @__PURE__ */ __name$4(() => isFocusInsideReactTreeRef.current = true, "onFocusCapture"),
869
+ onBlurCapture: /* @__PURE__ */ __name$4(() => isFocusInsideReactTreeRef.current = false, "onBlurCapture")
730
870
  };
731
871
  }
732
- __name$5(useFocusOutside, "useFocusOutside");
872
+ __name$4(useFocusOutside, "useFocusOutside");
733
873
  function dispatchUpdate() {
734
874
  const event = new CustomEvent(CONTEXT_UPDATE);
735
875
  document.dispatchEvent(event);
736
876
  }
737
- __name$5(dispatchUpdate, "dispatchUpdate");
877
+ __name$4(dispatchUpdate, "dispatchUpdate");
738
878
  function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
739
879
  const target = detail.originalEvent.target;
740
880
  const event = new CustomEvent(name, {
@@ -746,9 +886,68 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
746
886
  if (discrete) dispatchDiscreteCustomEvent(target, event);
747
887
  else target.dispatchEvent(event);
748
888
  }
749
- __name$5(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
750
- var __defProp$4 = Object.defineProperty;
751
- var __name$4 = (target, value) => __defProp$4(target, "name", {
889
+ __name$4(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
890
+ var __defProp$3 = Object.defineProperty;
891
+ var __name$3 = (target, value) => __defProp$3(target, "name", {
892
+ value,
893
+ configurable: true
894
+ });
895
+ var Portal = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$3(function Portal2(props, forwardedRef) {
896
+ const { container: containerProp, ...portalProps } = props;
897
+ const [mounted, setMounted] = React$1.useState(false);
898
+ useLayoutEffect2(() => setMounted(true), []);
899
+ const container = containerProp || mounted && globalThis?.document?.body;
900
+ return container ? ReactDOM.createPortal(/* @__PURE__ */ jsx(Primitive.div, {
901
+ ...portalProps,
902
+ ref: forwardedRef
903
+ }), container) : null;
904
+ }, "Portal"));
905
+ var __defProp$2 = Object.defineProperty;
906
+ var __name$2 = (target, value) => __defProp$2(target, "name", {
907
+ value,
908
+ configurable: true
909
+ });
910
+ var count = 0;
911
+ var guards = null;
912
+ function FocusGuards(props) {
913
+ useFocusGuards();
914
+ return props.children;
915
+ }
916
+ __name$2(FocusGuards, "FocusGuards");
917
+ function useFocusGuards() {
918
+ React$1.useEffect(() => {
919
+ if (!guards) guards = {
920
+ start: createFocusGuard(),
921
+ end: createFocusGuard()
922
+ };
923
+ const { start, end } = guards;
924
+ if (document.body.firstElementChild !== start) document.body.insertAdjacentElement("afterbegin", start);
925
+ if (document.body.lastElementChild !== end) document.body.insertAdjacentElement("beforeend", end);
926
+ count++;
927
+ return () => {
928
+ if (count === 1) {
929
+ guards?.start.remove();
930
+ guards?.end.remove();
931
+ guards = null;
932
+ }
933
+ count = Math.max(0, count - 1);
934
+ };
935
+ }, []);
936
+ }
937
+ __name$2(useFocusGuards, "useFocusGuards");
938
+ function createFocusGuard() {
939
+ const element = document.createElement("span");
940
+ element.setAttribute("data-radix-focus-guard", "");
941
+ element.tabIndex = 0;
942
+ element.style.outline = "none";
943
+ element.style.opacity = "0";
944
+ element.style.position = "fixed";
945
+ element.style.pointerEvents = "none";
946
+ return element;
947
+ }
948
+ __name$2(createFocusGuard, "createFocusGuard");
949
+ var __defProp$1 = Object.defineProperty;
950
+ var __name$1 = (target, value) => __defProp$1(target, "name", {
752
951
  value,
753
952
  configurable: true
754
953
  });
@@ -758,7 +957,7 @@ var EVENT_OPTIONS = {
758
957
  bubbles: false,
759
958
  cancelable: true
760
959
  };
761
- var FocusScope = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$4(function FocusScope2(props, forwardedRef) {
960
+ var FocusScope = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$1(function FocusScope2(props, forwardedRef) {
762
961
  const { loop = false, trapped = false, onMountAutoFocus: onMountAutoFocusProp, onUnmountAutoFocus: onUnmountAutoFocusProp, ...scopeProps } = props;
763
962
  const [container, setContainer] = React$1.useState(null);
764
963
  const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
@@ -790,9 +989,9 @@ var FocusScope = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$4(fun
790
989
  if (document.activeElement !== document.body) return;
791
990
  for (const mutation of mutations) if (mutation.removedNodes.length > 0) focus(container);
792
991
  };
793
- __name$4(handleFocusIn2, "handleFocusIn");
794
- __name$4(handleFocusOut2, "handleFocusOut");
795
- __name$4(handleMutations2, "handleMutations");
992
+ __name$1(handleFocusIn2, "handleFocusIn");
993
+ __name$1(handleFocusOut2, "handleFocusOut");
994
+ __name$1(handleMutations2, "handleMutations");
796
995
  document.addEventListener("focusin", handleFocusIn2);
797
996
  document.addEventListener("focusout", handleFocusOut2);
798
997
  const mutationObserver = new MutationObserver(handleMutations2);
@@ -879,15 +1078,15 @@ function focusFirst(candidates, { select = false } = {}) {
879
1078
  if (document.activeElement !== previouslyFocusedElement) return;
880
1079
  }
881
1080
  }
882
- __name$4(focusFirst, "focusFirst");
1081
+ __name$1(focusFirst, "focusFirst");
883
1082
  function getTabbableEdges(container) {
884
1083
  const candidates = getTabbableCandidates(container);
885
1084
  return [findVisible(candidates, container), findVisible(candidates.reverse(), container)];
886
1085
  }
887
- __name$4(getTabbableEdges, "getTabbableEdges");
1086
+ __name$1(getTabbableEdges, "getTabbableEdges");
888
1087
  function getTabbableCandidates(container) {
889
1088
  const nodes = [];
890
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode: /* @__PURE__ */ __name$4((node) => {
1089
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode: /* @__PURE__ */ __name$1((node) => {
891
1090
  const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
892
1091
  if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
893
1092
  return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
@@ -895,12 +1094,12 @@ function getTabbableCandidates(container) {
895
1094
  while (walker.nextNode()) nodes.push(walker.currentNode);
896
1095
  return nodes;
897
1096
  }
898
- __name$4(getTabbableCandidates, "getTabbableCandidates");
1097
+ __name$1(getTabbableCandidates, "getTabbableCandidates");
899
1098
  function findVisible(elements, container) {
900
1099
  const canUseCheckVisibility = typeof container.checkVisibility === "function" && container.checkVisibility({ checkVisibilityCSS: true });
901
1100
  for (const element of elements) if (!(canUseCheckVisibility ? !element.checkVisibility({ checkVisibilityCSS: true }) : isHidden(element, { upTo: container }))) return element;
902
1101
  }
903
- __name$4(findVisible, "findVisible");
1102
+ __name$1(findVisible, "findVisible");
904
1103
  function isHidden(node, { upTo }) {
905
1104
  if (getComputedStyle(node).visibility === "hidden") return true;
906
1105
  while (node) {
@@ -910,246 +1109,136 @@ function isHidden(node, { upTo }) {
910
1109
  }
911
1110
  return false;
912
1111
  }
913
- __name$4(isHidden, "isHidden");
1112
+ __name$1(isHidden, "isHidden");
914
1113
  function isSelectableInput(element) {
915
1114
  return element instanceof HTMLInputElement && "select" in element;
916
1115
  }
917
- __name$4(isSelectableInput, "isSelectableInput");
1116
+ __name$1(isSelectableInput, "isSelectableInput");
918
1117
  function focus(element, { select = false } = {}) {
919
1118
  if (element && element.focus) {
920
1119
  const previouslyFocusedElement = document.activeElement;
921
1120
  element.focus({ preventScroll: true });
922
- if (element !== previouslyFocusedElement && isSelectableInput(element) && select) element.select();
923
- }
924
- }
925
- __name$4(focus, "focus");
926
- var focusScopesStack = createFocusScopesStack();
927
- function createFocusScopesStack() {
928
- let stack = [];
929
- return {
930
- add(focusScope) {
931
- const activeFocusScope = stack[0];
932
- if (focusScope !== activeFocusScope) activeFocusScope?.pause();
933
- stack = arrayRemove(stack, focusScope);
934
- stack.unshift(focusScope);
935
- },
936
- remove(focusScope) {
937
- stack = arrayRemove(stack, focusScope);
938
- stack[0]?.resume();
939
- }
940
- };
941
- }
942
- __name$4(createFocusScopesStack, "createFocusScopesStack");
943
- function arrayRemove(array, item) {
944
- const updatedArray = [...array];
945
- const index = updatedArray.indexOf(item);
946
- if (index !== -1) updatedArray.splice(index, 1);
947
- return updatedArray;
948
- }
949
- __name$4(arrayRemove, "arrayRemove");
950
- function removeLinks(items) {
951
- return items.filter((item) => item.tagName !== "A");
952
- }
953
- __name$4(removeLinks, "removeLinks");
954
- var __defProp$3 = Object.defineProperty;
955
- var __name$3 = (target, value) => __defProp$3(target, "name", {
956
- value,
957
- configurable: true
958
- });
959
- var Portal = /* @__PURE__ */ React$1.forwardRef(/* @__PURE__ */ __name$3(function Portal2(props, forwardedRef) {
960
- const { container: containerProp, ...portalProps } = props;
961
- const [mounted, setMounted] = React$1.useState(false);
962
- useLayoutEffect2(() => setMounted(true), []);
963
- const container = containerProp || mounted && globalThis?.document?.body;
964
- return container ? ReactDOM.createPortal(/* @__PURE__ */ jsx(Primitive.div, {
965
- ...portalProps,
966
- ref: forwardedRef
967
- }), container) : null;
968
- }, "Portal"));
969
- var __defProp$2 = Object.defineProperty;
970
- var __name$2 = (target, value) => __defProp$2(target, "name", {
971
- value,
972
- configurable: true
973
- });
974
- function useStateMachine(initialState, machine) {
975
- return React$1.useReducer((state, event) => {
976
- return machine[state][event] ?? state;
977
- }, initialState);
978
- }
979
- __name$2(useStateMachine, "useStateMachine");
980
- var Presence = /* @__PURE__ */ __name$2((props) => {
981
- const { present, children } = props;
982
- const presence = usePresence(present);
983
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React$1.Children.only(children);
984
- const ref = useStableComposedRefs(presence.ref, getElementRef(child));
985
- return typeof children === "function" || presence.isPresent ? React$1.cloneElement(child, { ref }) : null;
986
- }, "Presence");
987
- function usePresence(present) {
988
- const [node, setNode] = React$1.useState();
989
- const stylesRef = React$1.useRef(null);
990
- const prevPresentRef = React$1.useRef(present);
991
- const prevAnimationNameRef = React$1.useRef("none");
992
- const mountAnimationNameRef = React$1.useRef(void 0);
993
- const [state, send] = useStateMachine(present ? "mounted" : "unmounted", {
994
- mounted: {
995
- UNMOUNT: "unmounted",
996
- ANIMATION_OUT: "unmountSuspended"
997
- },
998
- unmountSuspended: {
999
- MOUNT: "mounted",
1000
- ANIMATION_END: "unmounted"
1001
- },
1002
- unmounted: { MOUNT: "mounted" }
1003
- });
1004
- React$1.useEffect(() => {
1005
- if (state === "mounted") {
1006
- prevAnimationNameRef.current = mountAnimationNameRef.current ?? getAnimationName(stylesRef.current);
1007
- mountAnimationNameRef.current = void 0;
1008
- } else prevAnimationNameRef.current = "none";
1009
- }, [state]);
1010
- useLayoutEffect2(() => {
1011
- const styles = stylesRef.current;
1012
- const wasPresent = prevPresentRef.current;
1013
- if (wasPresent !== present) {
1014
- const prevAnimationName = prevAnimationNameRef.current;
1015
- const currentAnimationName = getAnimationName(styles);
1016
- if (present) {
1017
- mountAnimationNameRef.current = currentAnimationName;
1018
- send("MOUNT");
1019
- } else if (currentAnimationName === "none" || styles?.display === "none") send("UNMOUNT");
1020
- else if (wasPresent && prevAnimationName !== currentAnimationName) send("ANIMATION_OUT");
1021
- else send("UNMOUNT");
1022
- prevPresentRef.current = present;
1023
- }
1024
- }, [present, send]);
1025
- useLayoutEffect2(() => {
1026
- if (node) {
1027
- let timeoutId;
1028
- const ownerWindow = node.ownerDocument.defaultView ?? window;
1029
- const handleAnimationEnd = /* @__PURE__ */ __name$2((event) => {
1030
- const isCurrentAnimation = getAnimationName(stylesRef.current).includes(CSS.escape(event.animationName));
1031
- if (event.target === node && isCurrentAnimation) {
1032
- send("ANIMATION_END");
1033
- if (!prevPresentRef.current) {
1034
- const currentFillMode = node.style.animationFillMode;
1035
- node.style.animationFillMode = "forwards";
1036
- timeoutId = ownerWindow.setTimeout(() => {
1037
- if (node.style.animationFillMode === "forwards") node.style.animationFillMode = currentFillMode;
1038
- });
1039
- }
1040
- }
1041
- }, "handleAnimationEnd");
1042
- const handleAnimationStart = /* @__PURE__ */ __name$2((event) => {
1043
- if (event.target === node) prevAnimationNameRef.current = getAnimationName(stylesRef.current);
1044
- }, "handleAnimationStart");
1045
- node.addEventListener("animationstart", handleAnimationStart);
1046
- node.addEventListener("animationcancel", handleAnimationEnd);
1047
- node.addEventListener("animationend", handleAnimationEnd);
1048
- return () => {
1049
- ownerWindow.clearTimeout(timeoutId);
1050
- node.removeEventListener("animationstart", handleAnimationStart);
1051
- node.removeEventListener("animationcancel", handleAnimationEnd);
1052
- node.removeEventListener("animationend", handleAnimationEnd);
1053
- };
1054
- } else send("ANIMATION_END");
1055
- }, [node, send]);
1056
- return {
1057
- isPresent: ["mounted", "unmountSuspended"].includes(state),
1058
- ref: React$1.useCallback((node2) => {
1059
- if (node2) {
1060
- const styles = getComputedStyle(node2);
1061
- stylesRef.current = styles;
1062
- mountAnimationNameRef.current = getAnimationName(styles);
1063
- } else stylesRef.current = null;
1064
- setNode(node2);
1065
- }, [])
1066
- };
1067
- }
1068
- __name$2(usePresence, "usePresence");
1069
- function setRef(ref, value) {
1070
- if (typeof ref === "function") return ref(value);
1071
- else if (ref !== null && ref !== void 0) ref.current = value;
1072
- }
1073
- __name$2(setRef, "setRef");
1074
- function useStableComposedRefs(...refs) {
1075
- const refsRef = React$1.useRef(refs);
1076
- refsRef.current = refs;
1077
- return React$1.useCallback((node) => {
1078
- const currentRefs = refsRef.current;
1079
- let hasCleanup = false;
1080
- const cleanups = currentRefs.map((ref) => {
1081
- const cleanup = setRef(ref, node);
1082
- if (!hasCleanup && typeof cleanup === "function") hasCleanup = true;
1083
- return cleanup;
1084
- });
1085
- if (hasCleanup) return () => {
1086
- for (let i = 0; i < cleanups.length; i++) {
1087
- const cleanup = cleanups[i];
1088
- if (typeof cleanup === "function") cleanup();
1089
- else setRef(currentRefs[i], null);
1090
- }
1091
- };
1092
- }, []);
1093
- }
1094
- __name$2(useStableComposedRefs, "useStableComposedRefs");
1095
- function getAnimationName(styles) {
1096
- return styles?.animationName || "none";
1097
- }
1098
- __name$2(getAnimationName, "getAnimationName");
1099
- function getElementRef(element) {
1100
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1101
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1102
- if (mayWarn) return element.ref;
1103
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1104
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1105
- if (mayWarn) return element.props.ref;
1106
- return element.props.ref || element.ref;
1121
+ if (element !== previouslyFocusedElement && isSelectableInput(element) && select) element.select();
1122
+ }
1107
1123
  }
1108
- __name$2(getElementRef, "getElementRef");
1109
- var __defProp$1 = Object.defineProperty;
1110
- var __name$1 = (target, value) => __defProp$1(target, "name", {
1111
- value,
1112
- configurable: true
1113
- });
1114
- var count = 0;
1115
- var guards = null;
1116
- function FocusGuards(props) {
1117
- useFocusGuards();
1118
- return props.children;
1124
+ __name$1(focus, "focus");
1125
+ var focusScopesStack = createFocusScopesStack();
1126
+ function createFocusScopesStack() {
1127
+ let stack = [];
1128
+ return {
1129
+ add(focusScope) {
1130
+ const activeFocusScope = stack[0];
1131
+ if (focusScope !== activeFocusScope) activeFocusScope?.pause();
1132
+ stack = arrayRemove(stack, focusScope);
1133
+ stack.unshift(focusScope);
1134
+ },
1135
+ remove(focusScope) {
1136
+ stack = arrayRemove(stack, focusScope);
1137
+ stack[0]?.resume();
1138
+ }
1139
+ };
1119
1140
  }
1120
- __name$1(FocusGuards, "FocusGuards");
1121
- function useFocusGuards() {
1122
- React$1.useEffect(() => {
1123
- if (!guards) guards = {
1124
- start: createFocusGuard(),
1125
- end: createFocusGuard()
1126
- };
1127
- const { start, end } = guards;
1128
- if (document.body.firstElementChild !== start) document.body.insertAdjacentElement("afterbegin", start);
1129
- if (document.body.lastElementChild !== end) document.body.insertAdjacentElement("beforeend", end);
1130
- count++;
1131
- return () => {
1132
- if (count === 1) {
1133
- guards?.start.remove();
1134
- guards?.end.remove();
1135
- guards = null;
1136
- }
1137
- count = Math.max(0, count - 1);
1138
- };
1139
- }, []);
1141
+ __name$1(createFocusScopesStack, "createFocusScopesStack");
1142
+ function arrayRemove(array, item) {
1143
+ const updatedArray = [...array];
1144
+ const index = updatedArray.indexOf(item);
1145
+ if (index !== -1) updatedArray.splice(index, 1);
1146
+ return updatedArray;
1140
1147
  }
1141
- __name$1(useFocusGuards, "useFocusGuards");
1142
- function createFocusGuard() {
1143
- const element = document.createElement("span");
1144
- element.setAttribute("data-radix-focus-guard", "");
1145
- element.tabIndex = 0;
1146
- element.style.outline = "none";
1147
- element.style.opacity = "0";
1148
- element.style.position = "fixed";
1149
- element.style.pointerEvents = "none";
1150
- return element;
1148
+ __name$1(arrayRemove, "arrayRemove");
1149
+ function removeLinks(items) {
1150
+ return items.filter((item) => item.tagName !== "A");
1151
1151
  }
1152
- __name$1(createFocusGuard, "createFocusGuard");
1152
+ __name$1(removeLinks, "removeLinks");
1153
+ var getDefaultParent = function(originalTarget) {
1154
+ if (typeof document === "undefined") return null;
1155
+ return (Array.isArray(originalTarget) ? originalTarget[0] : originalTarget).ownerDocument.body;
1156
+ };
1157
+ var counterMap = /* @__PURE__ */ new WeakMap();
1158
+ var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1159
+ var markerMap = {};
1160
+ var lockCount = 0;
1161
+ var unwrapHost = function(node) {
1162
+ return node && (node.host || unwrapHost(node.parentNode));
1163
+ };
1164
+ var correctTargets = function(parent, targets) {
1165
+ return targets.map(function(target) {
1166
+ if (parent.contains(target)) return target;
1167
+ var correctedTarget = unwrapHost(target);
1168
+ if (correctedTarget && parent.contains(correctedTarget)) return correctedTarget;
1169
+ console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
1170
+ return null;
1171
+ }).filter(function(x) {
1172
+ return Boolean(x);
1173
+ });
1174
+ };
1175
+ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
1176
+ var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1177
+ if (!markerMap[markerName]) markerMap[markerName] = /* @__PURE__ */ new WeakMap();
1178
+ var markerCounter = markerMap[markerName];
1179
+ var hiddenNodes = [];
1180
+ var elementsToKeep = /* @__PURE__ */ new Set();
1181
+ var elementsToStop = new Set(targets);
1182
+ var keep = function(el) {
1183
+ if (!el || elementsToKeep.has(el)) return;
1184
+ elementsToKeep.add(el);
1185
+ keep(el.parentNode);
1186
+ };
1187
+ targets.forEach(keep);
1188
+ var deep = function(parent) {
1189
+ if (!parent || elementsToStop.has(parent)) return;
1190
+ Array.prototype.forEach.call(parent.children, function(node) {
1191
+ if (elementsToKeep.has(node)) deep(node);
1192
+ else try {
1193
+ var attr = node.getAttribute(controlAttribute);
1194
+ var alreadyHidden = attr !== null && attr !== "false";
1195
+ var counterValue = (counterMap.get(node) || 0) + 1;
1196
+ var markerValue = (markerCounter.get(node) || 0) + 1;
1197
+ counterMap.set(node, counterValue);
1198
+ markerCounter.set(node, markerValue);
1199
+ hiddenNodes.push(node);
1200
+ if (counterValue === 1 && alreadyHidden) uncontrolledNodes.set(node, true);
1201
+ if (markerValue === 1) node.setAttribute(markerName, "true");
1202
+ if (!alreadyHidden) node.setAttribute(controlAttribute, "true");
1203
+ } catch (e) {
1204
+ console.error("aria-hidden: cannot operate on ", node, e);
1205
+ }
1206
+ });
1207
+ };
1208
+ deep(parentNode);
1209
+ elementsToKeep.clear();
1210
+ lockCount++;
1211
+ return function() {
1212
+ hiddenNodes.forEach(function(node) {
1213
+ var counterValue = counterMap.get(node) - 1;
1214
+ var markerValue = markerCounter.get(node) - 1;
1215
+ counterMap.set(node, counterValue);
1216
+ markerCounter.set(node, markerValue);
1217
+ if (!counterValue) {
1218
+ if (!uncontrolledNodes.has(node)) node.removeAttribute(controlAttribute);
1219
+ uncontrolledNodes.delete(node);
1220
+ }
1221
+ if (!markerValue) node.removeAttribute(markerName);
1222
+ });
1223
+ lockCount--;
1224
+ if (!lockCount) {
1225
+ counterMap = /* @__PURE__ */ new WeakMap();
1226
+ counterMap = /* @__PURE__ */ new WeakMap();
1227
+ uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1228
+ markerMap = {};
1229
+ }
1230
+ };
1231
+ };
1232
+ var hideOthers = function(originalTarget, parentNode, markerName) {
1233
+ if (markerName === void 0) markerName = "data-aria-hidden";
1234
+ var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1235
+ var activeParentNode = parentNode || getDefaultParent(originalTarget);
1236
+ if (!activeParentNode) return function() {
1237
+ return null;
1238
+ };
1239
+ targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
1240
+ return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1241
+ };
1153
1242
  var __assign = function() {
1154
1243
  __assign = Object.assign || function __assign2(t) {
1155
1244
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -1754,95 +1843,6 @@ var ReactRemoveScroll = React$1.forwardRef(function(props, ref) {
1754
1843
  }));
1755
1844
  });
1756
1845
  ReactRemoveScroll.classNames = RemoveScroll.classNames;
1757
- var getDefaultParent = function(originalTarget) {
1758
- if (typeof document === "undefined") return null;
1759
- return (Array.isArray(originalTarget) ? originalTarget[0] : originalTarget).ownerDocument.body;
1760
- };
1761
- var counterMap = /* @__PURE__ */ new WeakMap();
1762
- var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1763
- var markerMap = {};
1764
- var lockCount = 0;
1765
- var unwrapHost = function(node) {
1766
- return node && (node.host || unwrapHost(node.parentNode));
1767
- };
1768
- var correctTargets = function(parent, targets) {
1769
- return targets.map(function(target) {
1770
- if (parent.contains(target)) return target;
1771
- var correctedTarget = unwrapHost(target);
1772
- if (correctedTarget && parent.contains(correctedTarget)) return correctedTarget;
1773
- console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
1774
- return null;
1775
- }).filter(function(x) {
1776
- return Boolean(x);
1777
- });
1778
- };
1779
- var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
1780
- var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1781
- if (!markerMap[markerName]) markerMap[markerName] = /* @__PURE__ */ new WeakMap();
1782
- var markerCounter = markerMap[markerName];
1783
- var hiddenNodes = [];
1784
- var elementsToKeep = /* @__PURE__ */ new Set();
1785
- var elementsToStop = new Set(targets);
1786
- var keep = function(el) {
1787
- if (!el || elementsToKeep.has(el)) return;
1788
- elementsToKeep.add(el);
1789
- keep(el.parentNode);
1790
- };
1791
- targets.forEach(keep);
1792
- var deep = function(parent) {
1793
- if (!parent || elementsToStop.has(parent)) return;
1794
- Array.prototype.forEach.call(parent.children, function(node) {
1795
- if (elementsToKeep.has(node)) deep(node);
1796
- else try {
1797
- var attr = node.getAttribute(controlAttribute);
1798
- var alreadyHidden = attr !== null && attr !== "false";
1799
- var counterValue = (counterMap.get(node) || 0) + 1;
1800
- var markerValue = (markerCounter.get(node) || 0) + 1;
1801
- counterMap.set(node, counterValue);
1802
- markerCounter.set(node, markerValue);
1803
- hiddenNodes.push(node);
1804
- if (counterValue === 1 && alreadyHidden) uncontrolledNodes.set(node, true);
1805
- if (markerValue === 1) node.setAttribute(markerName, "true");
1806
- if (!alreadyHidden) node.setAttribute(controlAttribute, "true");
1807
- } catch (e) {
1808
- console.error("aria-hidden: cannot operate on ", node, e);
1809
- }
1810
- });
1811
- };
1812
- deep(parentNode);
1813
- elementsToKeep.clear();
1814
- lockCount++;
1815
- return function() {
1816
- hiddenNodes.forEach(function(node) {
1817
- var counterValue = counterMap.get(node) - 1;
1818
- var markerValue = markerCounter.get(node) - 1;
1819
- counterMap.set(node, counterValue);
1820
- markerCounter.set(node, markerValue);
1821
- if (!counterValue) {
1822
- if (!uncontrolledNodes.has(node)) node.removeAttribute(controlAttribute);
1823
- uncontrolledNodes.delete(node);
1824
- }
1825
- if (!markerValue) node.removeAttribute(markerName);
1826
- });
1827
- lockCount--;
1828
- if (!lockCount) {
1829
- counterMap = /* @__PURE__ */ new WeakMap();
1830
- counterMap = /* @__PURE__ */ new WeakMap();
1831
- uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1832
- markerMap = {};
1833
- }
1834
- };
1835
- };
1836
- var hideOthers = function(originalTarget, parentNode, markerName) {
1837
- if (markerName === void 0) markerName = "data-aria-hidden";
1838
- var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1839
- var activeParentNode = parentNode || getDefaultParent(originalTarget);
1840
- if (!activeParentNode) return function() {
1841
- return null;
1842
- };
1843
- targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
1844
- return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1845
- };
1846
1846
  var __defProp = Object.defineProperty;
1847
1847
  var __name = (target, value) => __defProp(target, "name", {
1848
1848
  value,
@@ -2063,27 +2063,27 @@ function getState(open) {
2063
2063
  __name(getState, "getState");
2064
2064
 
2065
2065
  export {
2066
- composeEventHandlers,
2066
+ createContextScope,
2067
2067
  composeRefs,
2068
2068
  useComposedRefs,
2069
- createContextScope,
2070
- useLayoutEffect2,
2071
- useId$1,
2072
- useControllableState,
2073
2069
  createSlot,
2074
2070
  Slot$1,
2075
2071
  createSlottable,
2076
2072
  Slottable,
2073
+ composeEventHandlers,
2074
+ useLayoutEffect2,
2075
+ useControllableState,
2077
2076
  Primitive,
2078
2077
  dispatchDiscreteCustomEvent,
2078
+ Presence,
2079
+ useId$1,
2079
2080
  useCallbackRef$1,
2080
2081
  DismissableLayer,
2081
- FocusScope,
2082
2082
  Portal,
2083
- Presence,
2084
2083
  useFocusGuards,
2085
- ReactRemoveScroll,
2084
+ FocusScope,
2086
2085
  hideOthers,
2086
+ ReactRemoveScroll,
2087
2087
  Dialog,
2088
2088
  DialogTrigger,
2089
2089
  DialogPortal,