@qredence/fleet 0.6.0 → 0.6.2

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 (273) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/web/client/assets/agent-disclosure-CMrxF7L-.js +1 -0
  3. package/dist/web/client/assets/analytics-stub-C2vgmGm_.js +1 -0
  4. package/dist/web/client/assets/artifacts-panel-DmQghvw8.js +1 -0
  5. package/dist/web/client/assets/{bot-Bs7QWJ2q.js → bot-DbB9BKL0.js} +1 -1
  6. package/dist/web/client/assets/bundle-mjs-cJTHqqzI.js +1 -0
  7. package/dist/web/client/assets/button-Dl0ce3Y5.js +1 -0
  8. package/dist/web/client/assets/card-DCEnYd2G.js +1 -0
  9. package/dist/web/client/assets/chat-C24kD2SP.js +52 -0
  10. package/dist/web/client/assets/chat-command-palette-BIwjhE6s.js +1 -0
  11. package/dist/web/client/assets/check-B3LlvM65.js +1 -0
  12. package/dist/web/client/assets/{chevron-down-BEVGmnSb.js → chevron-down-DUUprRP5.js} +1 -1
  13. package/dist/web/client/assets/chevron-right-NVqQIoiO.js +1 -0
  14. package/dist/web/client/assets/{chunk-YOKDWASO-BAf618wr.js → chunk-YOKDWASO-Bte3iwlH.js} +6 -6
  15. package/dist/web/client/assets/citations-BUvM92nt.js +1 -0
  16. package/dist/web/client/assets/collapsible-CUxOjhDJ.js +1 -0
  17. package/dist/web/client/assets/command-Dv96gATQ.js +1 -0
  18. package/dist/web/client/assets/createBaseUIEventDetails-B58Jldei.js +1 -0
  19. package/dist/web/client/assets/createLucideIcon-_dfI7Arx.js +1 -0
  20. package/dist/web/client/assets/dialog-BCb4rQh0.js +1 -0
  21. package/dist/web/client/assets/dist-52wg4XPY.js +1 -0
  22. package/dist/web/client/assets/dist-DbHxXSgQ.js +41 -0
  23. package/dist/web/client/assets/ease-CMumuPlX.js +1 -0
  24. package/dist/web/client/assets/{eye-B0DFz5hL.js → eye-CDHqtVoE.js} +1 -1
  25. package/dist/web/client/assets/file-text-TmalmYrb.js +1 -0
  26. package/dist/web/client/assets/{folder-BC5p7qK7.js → folder-vuNT4shY.js} +1 -1
  27. package/dist/web/client/assets/{fork-picker-dialog-ByBOGVsa.js → fork-picker-dialog-CpwEwsxA.js} +1 -1
  28. package/dist/web/client/assets/gauge-BsDqNM1A.js +1 -0
  29. package/dist/web/client/assets/globals-DCtBkCSD.css +2 -0
  30. package/dist/web/client/assets/{hard-drive-CHqgr7VQ.js → hard-drive-BT7UxHQu.js} +1 -1
  31. package/dist/web/client/assets/highlighted-body-KPVGNVTW-CgT7gqvs.js +1 -0
  32. package/dist/web/client/assets/horizontal-resize-VLjLByUV.js +1 -0
  33. package/dist/web/client/assets/index-BGnQeUYE.js +12 -0
  34. package/dist/web/client/assets/input-CxZp56Im.js +1 -0
  35. package/dist/web/client/assets/input-group-D7lAfKHR.js +1 -0
  36. package/dist/web/client/assets/ipython-tool-CkHaO3PW.js +3 -0
  37. package/dist/web/client/assets/is-ref-object-BcRWZ4l7.js +1 -0
  38. package/dist/web/client/assets/{loader-circle-DjfHXUPB.js → loader-circle-B5GIZGxd.js} +1 -1
  39. package/dist/web/client/assets/markdown-BHkByC9K.js +2 -0
  40. package/dist/web/client/assets/{markdown-code-CuQcR3UO.js → markdown-code-CDTRq-HZ.js} +1 -1
  41. package/dist/web/client/assets/mermaid-HWGCJPDP-CY3N5ECk.js +1 -0
  42. package/dist/web/client/assets/message-queue-Dl8wbCOu.js +1 -0
  43. package/dist/web/client/assets/model-selector-list-CRZCXeBf.js +1 -0
  44. package/dist/web/client/assets/{notify-DgMKgZZW.js → notify-DjVixft7.js} +1 -1
  45. package/dist/web/client/assets/openui-renderer-Bkkx5kmA.js +378 -0
  46. package/dist/web/client/assets/{package-CdcJFPf2.js → package-BKBPgwMP.js} +1 -1
  47. package/dist/web/client/assets/{pencil-DcUwsKLn.js → pencil-CdO6qfv3.js} +1 -1
  48. package/dist/web/client/assets/{plug-Dt6VN0zF.js → plug-BRROUIw-.js} +1 -1
  49. package/dist/web/client/assets/prompt-input-WaGSKZCU.js +1 -0
  50. package/dist/web/client/assets/prompt-suggestions-BNyTcyWg.js +1 -0
  51. package/dist/web/client/assets/provider-catalog-C0XBIasJ.js +1 -0
  52. package/dist/web/client/assets/provider-label-Cka0ep0S.js +1 -0
  53. package/dist/web/client/assets/react-CwJFpaho.js +1 -0
  54. package/dist/web/client/assets/react-dom-DX3XddaT.js +1 -0
  55. package/dist/web/client/assets/{refresh-cw-IThTJ3j-.js → refresh-cw-l9WPHRkq.js} +1 -1
  56. package/dist/web/client/assets/repl-panel-L9dmPqio.js +1 -0
  57. package/dist/web/client/assets/{resource-helpers-Q2T0YCMO.js → resource-helpers-BuWybA8l.js} +1 -1
  58. package/dist/web/client/assets/resources-panel-mT-aMCvV.js +1 -0
  59. package/dist/web/client/assets/right-panel-context-CS8tJMzE.js +1 -0
  60. package/dist/web/client/assets/right-panel-registry-BCW7fQTG.js +2 -0
  61. package/dist/web/client/assets/{rotate-ccw-WNFNkKQD.js → rotate-ccw-CfGhzOv7.js} +1 -1
  62. package/dist/web/client/assets/routes-BWe5Iz-2.js +16 -0
  63. package/dist/web/client/assets/safe-external-url-BbAom7Bm.js +1 -0
  64. package/dist/web/client/assets/search-BjcXAUrI.js +1 -0
  65. package/dist/web/client/assets/session-insights-panel-B0rl37lo.js +1 -0
  66. package/dist/web/client/assets/session-reasoning-panel-8D2P7iaJ.js +1 -0
  67. package/dist/web/client/assets/{fleet-pi-tool-renderer-BEDIO3al.js → session-tool-renderer-3E3cv8D0.js} +30 -30
  68. package/dist/web/client/assets/settings-dialog-B8lHq2tT.js +2 -0
  69. package/dist/web/client/assets/{skeleton-CkR2VmWc.js → skeleton-C3mo31Qu.js} +1 -1
  70. package/dist/web/client/assets/skeleton-loaders-BMa_G4yX.js +1 -0
  71. package/dist/web/client/assets/{shield-check-CkA2viVW.js → sparkles-D8XIY8pN.js} +1 -1
  72. package/dist/web/client/assets/square-DQaQu9bp.js +1 -0
  73. package/dist/web/client/assets/{square-terminal-BYTN_I86.js → square-terminal-BsopiuN7.js} +1 -1
  74. package/dist/web/client/assets/{subagent-chat-panel-Yujplxpb.js → subagent-chat-panel-C5ukYiUx.js} +1 -1
  75. package/dist/web/client/assets/subagent-transcript-lqNcSVbH.js +1 -0
  76. package/dist/web/client/assets/subagents-panel-SJKhaVTr.js +1 -0
  77. package/dist/web/client/assets/{sun-BWiZFty0.js → sun-D0llhiMU.js} +1 -1
  78. package/dist/web/client/assets/surfaces-CpfsGAIA.js +1 -0
  79. package/dist/web/client/assets/switch-D3FhZU-S.js +1 -0
  80. package/dist/web/client/assets/terminal-BQAKkBY6.js +1 -0
  81. package/dist/web/client/assets/toast-lnCWGgSE.js +1 -0
  82. package/dist/web/client/assets/tokens-Ch5WqXC_.js +1 -0
  83. package/dist/web/client/assets/tool-result-B_yb2JoE.js +4 -0
  84. package/dist/web/client/assets/tool-timeline-VnMRQoLS.js +1 -0
  85. package/dist/web/client/assets/{triangle-alert-CU-gd7ui.js → triangle-alert-GAYh_5d3.js} +1 -1
  86. package/dist/web/client/assets/ui-preferences-aG2U2jjW.js +1 -0
  87. package/dist/web/client/assets/use-presence-7I2qv4qI.js +1 -0
  88. package/dist/web/client/assets/use-reduced-motion-BOcG709U.js +9 -0
  89. package/dist/web/client/assets/useBaseUiId-D9ZGPZ6f.js +1 -0
  90. package/dist/web/client/assets/useControlled-CgAAWIy9.js +1 -0
  91. package/dist/web/client/assets/utils-Brtgag-m.js +1 -0
  92. package/dist/web/client/assets/virtualized-turn-list-BgUgX6tM.js +6 -0
  93. package/dist/web/client/assets/workspace-panel-CKF5JQl2.js +1 -0
  94. package/dist/web/client/assets/workspace-path-nav-DqPbETfJ.js +2 -0
  95. package/dist/web/client/assets/{wrench-BJNNe07k.js → wrench-Myc12BTA.js} +1 -1
  96. package/dist/web/client/assets/x-BGsDD848.js +1 -0
  97. package/dist/web/client/bundle-budget.json +6 -6
  98. package/dist/web/launcher.mjs +10 -1
  99. package/dist/web/server/_tanstack-start-manifest_v-BDPifIFN-DTSNCHBX.js +91 -0
  100. package/dist/web/server/{artifacts-panel-CaKrX2XC-R37I4BHF.js → artifacts-panel-BN3DgqfV-N73J6N5Y.js} +39 -44
  101. package/dist/web/server/{chat-command-palette-7gbqEnm9-6XICQZN7.js → chat-command-palette-G8awyZRw-2QE7FXGT.js} +18 -18
  102. package/dist/web/server/{chunk-SALXCFVO.js → chunk-33QA7BQJ.js} +19 -1
  103. package/dist/web/server/{chunk-P6UMR32I.js → chunk-43S5N7SH.js} +80 -47
  104. package/dist/web/server/chunk-4EBSM4JR.js +74 -0
  105. package/dist/web/server/{chunk-BBBS5AS7.js → chunk-4OTHKQMG.js} +753 -677
  106. package/dist/web/server/{chunk-WM4PUT6M.js → chunk-6SOMNRAX.js} +535 -505
  107. package/dist/web/server/chunk-7E76R7MB.js +2138 -0
  108. package/dist/web/server/{chunk-K3BXQG3N.js → chunk-7FK6YEMA.js} +100 -95
  109. package/dist/web/server/chunk-7HXCGBUP.js +56 -0
  110. package/dist/web/server/{chunk-P66QQWUM.js → chunk-7NZ3FJDA.js} +14 -1
  111. package/dist/web/server/{chunk-WHBVQJ4K.js → chunk-7UTDOTOU.js} +11 -9
  112. package/dist/web/server/{chunk-OZO5ARFA.js → chunk-BQROC4PL.js} +11 -2
  113. package/dist/web/server/{chunk-WYL2DW5R.js → chunk-BUXJSBE3.js} +2 -2
  114. package/dist/web/server/{chunk-ZJFA4F5X.js → chunk-CAPTFJOC.js} +9 -7
  115. package/dist/web/server/{chunk-EH4BZ6QM.js → chunk-CCYLHNZJ.js} +1767 -52
  116. package/dist/web/server/{chunk-DJMHPJBP.js → chunk-CHEC7TWB.js} +3 -1
  117. package/dist/web/server/{chunk-PIOFZUOU.js → chunk-CW6KZUKT.js} +7 -6
  118. package/dist/web/server/chunk-DLA5TLKX.js +164 -0
  119. package/dist/web/server/{chunk-7SR6WDM2.js → chunk-E5HALE4M.js} +4 -4
  120. package/dist/web/server/{chunk-DZ2IC3FH.js → chunk-EDAWH2MT.js} +47 -46
  121. package/dist/web/server/{chunk-JQDLJ7KI.js → chunk-ENGEUJIH.js} +2288 -2438
  122. package/dist/web/server/{chunk-DI7XRK2H.js → chunk-ESM7OCRL.js} +4 -4
  123. package/dist/web/server/{chunk-KELEYPVK.js → chunk-FT74GAAH.js} +74861 -74854
  124. package/dist/web/server/{chunk-LZ4Q5KUJ.js → chunk-HQ5TEXHT.js} +40 -60
  125. package/dist/web/server/{chunk-YOM42BKD.js → chunk-IPV4GLJL.js} +16 -16
  126. package/dist/web/server/{chunk-KOUEJ3NU.js → chunk-IXGLKAPN.js} +54 -46
  127. package/dist/web/server/{chunk-EAE2QXRK.js → chunk-JPDRUSUD.js} +2 -3
  128. package/dist/web/server/{chunk-AGFRJQZ7.js → chunk-JVOW2NWC.js} +452 -450
  129. package/dist/web/server/chunk-K6PTNSCW.js +31 -0
  130. package/dist/web/server/{chunk-AR7O7JXD.js → chunk-KBWUBWVJ.js} +24 -1
  131. package/dist/web/server/{chunk-NXJ32VFR.js → chunk-MJXXVQNA.js} +91 -96
  132. package/dist/web/server/{chunk-N6NOTURM.js → chunk-NCK2FJAD.js} +30 -26
  133. package/dist/web/server/{chunk-LXJD6IGW.js → chunk-NMBH57JT.js} +94 -33
  134. package/dist/web/server/{chunk-EAJTWMK5.js → chunk-NZ6KQT2X.js} +2 -2
  135. package/dist/web/server/{chunk-CNXJN5HN.js → chunk-O2UYZT3Z.js} +11 -11
  136. package/dist/web/server/{chunk-YXXRP3NS.js → chunk-OMEDERPG.js} +21 -25
  137. package/dist/web/server/{chunk-BLSX7WHW.js → chunk-OSMP55KI.js} +23 -2
  138. package/dist/web/server/{chunk-S3PQ6HKH.js → chunk-OVJYUWSQ.js} +2 -2
  139. package/dist/web/server/{chunk-XLNCWZMZ.js → chunk-RXUMFFUV.js} +5 -3
  140. package/dist/web/server/{chunk-DO2O27B2.js → chunk-SDV3P3IW.js} +2 -2
  141. package/dist/web/server/chunk-TLNZNR7C.js +46 -0
  142. package/dist/web/server/{chunk-IJPCV6DH.js → chunk-UDD5W4CR.js} +32 -10
  143. package/dist/web/server/{chunk-HSJMLO36.js → chunk-UE32PAV2.js} +47 -57
  144. package/dist/web/server/{chunk-UAPNEWCA.js → chunk-WB2LJC3R.js} +29 -32
  145. package/dist/web/server/{chunk-ETTDO4UO.js → chunk-WTYNN6EV.js} +1 -26
  146. package/dist/web/server/{chunk-2ATMSG7U.js → chunk-WU6X3GPJ.js} +48 -5
  147. package/dist/web/server/{chunk-C5X6G26O.js → chunk-XJ6TGSUB.js} +45 -24
  148. package/dist/web/server/{chunk-YNUWKMNQ.js → chunk-YMPJMHXZ.js} +41 -155
  149. package/dist/web/server/{chunk-GETSIVNU.js → chunk-YVGCPUAW.js} +7 -7
  150. package/dist/web/server/{chunk-4UBOIY2S.js → chunk-ZNFXBGLK.js} +1 -1
  151. package/dist/web/server/chunk-ZOVXMNJM.js +477 -0
  152. package/dist/web/server/{fork-picker-dialog-DlINz9UQ-UWIXFDJX.js → fork-picker-dialog-YKlapaxN-DR5L74ST.js} +9 -8
  153. package/dist/web/server/{markdown-DTnMbD87-FXGGAPJD.js → markdown-BzNejPoZ-6ITTDAV6.js} +2 -3
  154. package/dist/web/server/{markdown-code-BStjFfsy-SSLWUT4S.js → markdown-code-DAwXuW6m-HHVELO6I.js} +3 -4
  155. package/dist/web/server/{fleet-message-queue-BS-cZ56r-GLZXUKDF.js → message-queue-Demph1x4-RBJUC3AT.js} +14 -10
  156. package/dist/web/server/{model-selector-list-jBTZc2Mu-OXJOS5NA.js → model-selector-list-BmzLiCx9-TK6JGGKU.js} +20 -19
  157. package/dist/web/server/{openui-renderer-Biyyjhjn-SJOEKPTJ.js → openui-renderer-moJGf0LA-QCU3PI6H.js} +17 -18
  158. package/dist/web/server/{prompt-suggestions-D4AEEY7K-RZSP7PWV.js → prompt-suggestions-yPZqX__K-3VGJC4IF.js} +7 -6
  159. package/dist/web/server/{repl-panel-D5KsoJik-BQKO53JO.js → repl-panel-CgUF1qUw-3DFD2V53.js} +10 -11
  160. package/dist/web/server/{resources-panel-CE5pD4vy-V5FXBTYC.js → resources-panel-ChUliWV--JITAGS6Q.js} +6 -7
  161. package/dist/web/server/{router-DWALoX_M-I5CBL7FQ.js → router-CPdFlpbe-LAD4MNZB.js} +3117 -241
  162. package/dist/web/server/{routes-BBVirYfL-5WXMOT7M.js → routes-hkom6S6L-DUPPQHPY.js} +8753 -7974
  163. package/dist/web/server/server.js +2 -2
  164. package/dist/web/server/{session-insights-panel-CUhdgvRt-VB2HUCQP.js → session-insights-panel-xgrkX1Rp-FDNURBXZ.js} +9 -9
  165. package/dist/web/server/{fleet-reasoning-panel-BxC2COxi-GPLMQSTT.js → session-reasoning-panel-m1RgcIph-NUXGXVKE.js} +39 -40
  166. package/dist/web/server/session-tool-renderer-CglQ2ky7-2JVYNZG2.js +45 -0
  167. package/dist/web/server/{settings-dialog-DndPbM-v-RFNXXEAN.js → settings-dialog-BCEfmgtP-T3WQEZHB.js} +1912 -3120
  168. package/dist/web/server/{subagent-chat-panel-C0RpnXav-J7VYO7QY.js → subagent-chat-panel-BTwI1kdB-LKBWA4GD.js} +32 -41
  169. package/dist/web/server/{subagents-panel-jDqIn9Nh-YEV6QLUY.js → subagents-panel-8Z9_csoV-HYMEEBHB.js} +37 -45
  170. package/dist/web/server/{fleet-tool-timeline-IB36_PB2-XJENTO6I.js → tool-timeline-QL9k5dzA-RLU26HXT.js} +6 -6
  171. package/dist/web/server/{workspace-panel-CX_Vo6As-EWO6AMPI.js → workspace-panel-BHEB9nRM-TS62SYBA.js} +64 -46
  172. package/package.json +1 -1
  173. package/dist/web/client/assets/action-swap-roll-BB8DFMuf.js +0 -1
  174. package/dist/web/client/assets/agent-activity-CwMDU7aP.js +0 -1
  175. package/dist/web/client/assets/agent-disclosure-B8SnhQXL.js +0 -1
  176. package/dist/web/client/assets/analytics-stub-Cas1He0w.js +0 -1
  177. package/dist/web/client/assets/artifacts-panel-CJ75gQub.js +0 -1
  178. package/dist/web/client/assets/artifacts-utils-N_kUFbz2.js +0 -1
  179. package/dist/web/client/assets/bundle-mjs-DKHVkVWu.js +0 -1
  180. package/dist/web/client/assets/button-BR2WWrFo.js +0 -1
  181. package/dist/web/client/assets/card-BKl76a3R.js +0 -1
  182. package/dist/web/client/assets/chat-Ci2cEQrR.js +0 -52
  183. package/dist/web/client/assets/chat-command-palette-CkISHfKE.js +0 -1
  184. package/dist/web/client/assets/check-JjHKAZas.js +0 -1
  185. package/dist/web/client/assets/chevron-right-DrJxToLs.js +0 -1
  186. package/dist/web/client/assets/chevron-up-CnSvySGH.js +0 -1
  187. package/dist/web/client/assets/circle-alert-CONlFReH.js +0 -1
  188. package/dist/web/client/assets/circle-x-CkKCB__4.js +0 -1
  189. package/dist/web/client/assets/citations-C_tPOJE_.js +0 -2
  190. package/dist/web/client/assets/cn-C8c0S2mI.js +0 -1
  191. package/dist/web/client/assets/collapsible-BoXtZZWN.js +0 -1
  192. package/dist/web/client/assets/command-_WjnervL.js +0 -1
  193. package/dist/web/client/assets/createBaseUIEventDetails-DV0dQrBX.js +0 -1
  194. package/dist/web/client/assets/createLucideIcon-DwxZHm0M.js +0 -1
  195. package/dist/web/client/assets/dialog-BEZuZhzk.js +0 -1
  196. package/dist/web/client/assets/dist-BPaFisIZ.js +0 -41
  197. package/dist/web/client/assets/earth-DGZXAN5r.js +0 -1
  198. package/dist/web/client/assets/ease-u56MhKYS.js +0 -1
  199. package/dist/web/client/assets/file-text-T-NcAlZs.js +0 -1
  200. package/dist/web/client/assets/fleet-message-queue-BCno4XP-.js +0 -1
  201. package/dist/web/client/assets/fleet-reasoning-panel-CbkO7u-v.js +0 -1
  202. package/dist/web/client/assets/fleet-subagent-list-iKUtLJKZ.js +0 -1
  203. package/dist/web/client/assets/fleet-tool-timeline-C8heL7ae.js +0 -1
  204. package/dist/web/client/assets/gauge-DNpstbBn.js +0 -1
  205. package/dist/web/client/assets/globals-B_I1Eq1u.css +0 -2
  206. package/dist/web/client/assets/highlighted-body-KPVGNVTW-sUCZ1fHv.js +0 -1
  207. package/dist/web/client/assets/horizontal-resize-CwoDojST.js +0 -1
  208. package/dist/web/client/assets/image-BbPmlw-n.js +0 -1
  209. package/dist/web/client/assets/index-DJ1fFbQu.js +0 -12
  210. package/dist/web/client/assets/input-0wwjWjKq.js +0 -1
  211. package/dist/web/client/assets/input-group-Tb5TYbzi.js +0 -1
  212. package/dist/web/client/assets/ipython-tool-ldJ9F1Cw.js +0 -3
  213. package/dist/web/client/assets/layout-gyLzPvVv.js +0 -1
  214. package/dist/web/client/assets/markdown-DInPmRUG.js +0 -2
  215. package/dist/web/client/assets/mermaid-HWGCJPDP-Bm7CuruA.js +0 -1
  216. package/dist/web/client/assets/message-square-hbDao-A1.js +0 -1
  217. package/dist/web/client/assets/model-selector-list-Ch05B2nZ.js +0 -1
  218. package/dist/web/client/assets/openui-renderer-Bf60nxNi.js +0 -378
  219. package/dist/web/client/assets/plus-DXN1Bg_z.js +0 -1
  220. package/dist/web/client/assets/prompt-input-qPIXZ-Rb.js +0 -1
  221. package/dist/web/client/assets/prompt-suggestions-Cc--lSNR.js +0 -1
  222. package/dist/web/client/assets/provider-catalog-D8G66gwc.js +0 -1
  223. package/dist/web/client/assets/provider-label-DDLRnZyC.js +0 -1
  224. package/dist/web/client/assets/react-dom-Bwxum3ti.js +0 -1
  225. package/dist/web/client/assets/repl-panel-DsPX04Xr.js +0 -1
  226. package/dist/web/client/assets/resources-panel-D867-goy.js +0 -1
  227. package/dist/web/client/assets/right-panel-context-DHlNWJsF.js +0 -1
  228. package/dist/web/client/assets/right-panel-registry-Dp8yX-oL.js +0 -2
  229. package/dist/web/client/assets/routes-DpgMJZ5n.js +0 -16
  230. package/dist/web/client/assets/safe-external-url-D3PJJIcM.js +0 -1
  231. package/dist/web/client/assets/search-eWVnAJsb.js +0 -1
  232. package/dist/web/client/assets/session-insights-panel-YnaXvTpi.js +0 -1
  233. package/dist/web/client/assets/settings-dialog-YJkvt5EB.js +0 -2
  234. package/dist/web/client/assets/skeleton-loaders-C9vHwAYV.js +0 -1
  235. package/dist/web/client/assets/sparkles-DuclzqlE.js +0 -1
  236. package/dist/web/client/assets/square-Bhn8gjr0.js +0 -1
  237. package/dist/web/client/assets/subagent-transcript-CnI-mqN0.js +0 -1
  238. package/dist/web/client/assets/subagent-utils-DDH5qm9Z.js +0 -1
  239. package/dist/web/client/assets/subagents-panel-CjXEdimj.js +0 -1
  240. package/dist/web/client/assets/surfaces-DI-U-_2a.js +0 -1
  241. package/dist/web/client/assets/switch-9rTeg6J6.js +0 -1
  242. package/dist/web/client/assets/terminal-DOS1s1gm.js +0 -1
  243. package/dist/web/client/assets/toast-Bt9p2OL4.js +0 -1
  244. package/dist/web/client/assets/tool-result-DfnPN0FQ.js +0 -4
  245. package/dist/web/client/assets/ui-preferences-CImQGZm_.js +0 -1
  246. package/dist/web/client/assets/use-reduced-motion-eORd7fqW.js +0 -9
  247. package/dist/web/client/assets/useBaseUiId-CHqXB2UQ.js +0 -1
  248. package/dist/web/client/assets/useControlled-CJJ9BOQB.js +0 -1
  249. package/dist/web/client/assets/utils-Eg7xtNmV.js +0 -1
  250. package/dist/web/client/assets/virtualized-turn-list--Vynre4D.js +0 -6
  251. package/dist/web/client/assets/workspace-panel-CPPIznT9.js +0 -1
  252. package/dist/web/client/assets/workspace-path-nav-C0AQNZyy.js +0 -1
  253. package/dist/web/client/assets/x-CsRC_tCI.js +0 -1
  254. package/dist/web/server/_tanstack-start-manifest_v-DS_CSIFQ-WB3VTKF3.js +0 -95
  255. package/dist/web/server/agent-activity-CS2rbF_C-A3R26CYH.js +0 -514
  256. package/dist/web/server/chunk-3JMESBAT.js +0 -35
  257. package/dist/web/server/chunk-42XU6WV7.js +0 -56
  258. package/dist/web/server/chunk-7SD2ZSEA.js +0 -86
  259. package/dist/web/server/chunk-AQ66E5OW.js +0 -33
  260. package/dist/web/server/chunk-BYXBJQAS.js +0 -0
  261. package/dist/web/server/chunk-FAGDMGLK.js +0 -6589
  262. package/dist/web/server/chunk-FJV6EQDW.js +0 -36
  263. package/dist/web/server/chunk-GL6HWDJB.js +0 -19
  264. package/dist/web/server/chunk-HFQTI7AX.js +0 -42
  265. package/dist/web/server/chunk-L46H6IDX.js +0 -13
  266. package/dist/web/server/chunk-ON33WDZX.js +0 -31
  267. package/dist/web/server/chunk-PVJCTQFK.js +0 -22
  268. package/dist/web/server/chunk-QPNUGF3V.js +0 -35
  269. package/dist/web/server/chunk-TWYHHG5N.js +0 -1196
  270. package/dist/web/server/chunk-YKVGQBZA.js +0 -1262
  271. package/dist/web/server/chunk-ZCVWADNW.js +0 -37
  272. package/dist/web/server/fleet-pi-tool-renderer-umKunT3K-O4GBH35V.js +0 -51
  273. package/dist/web/server/fleet-subagent-list-CpSYzCIq-JDH2LHSS.js +0 -18
@@ -1,14 +1,12 @@
1
- import {
2
- ChevronDown
3
- } from "./chunk-WWJF4RO2.js";
4
1
  import {
5
2
  fieldValidityMapping,
6
3
  useFieldRootContext,
7
4
  useFormContext,
8
5
  useLabelableContext,
9
6
  useLabelableId,
10
- useRegisterFieldControl
11
- } from "./chunk-P6UMR32I.js";
7
+ useRegisterFieldControl,
8
+ useValueChanged
9
+ } from "./chunk-43S5N7SH.js";
12
10
  import {
13
11
  COMPOSITE_KEYS,
14
12
  FOCUSABLE_POPUP_PROPS,
@@ -31,7 +29,7 @@ import {
31
29
  useFloatingTree,
32
30
  useScrollLock,
33
31
  useSurface
34
- } from "./chunk-AGFRJQZ7.js";
32
+ } from "./chunk-JVOW2NWC.js";
35
33
  import {
36
34
  ARROW_DOWN,
37
35
  ARROW_LEFT,
@@ -57,25 +55,28 @@ import {
57
55
  isTypeableElement,
58
56
  jsdom,
59
57
  ownerDocument,
60
- useStore,
61
58
  useTimeout,
62
59
  visuallyHidden,
63
60
  visuallyHiddenInput,
64
61
  webkit
65
- } from "./chunk-LZ4Q5KUJ.js";
62
+ } from "./chunk-HQ5TEXHT.js";
66
63
  import {
67
64
  Check
68
65
  } from "./chunk-4QD4PCVP.js";
66
+ import {
67
+ ChevronDown
68
+ } from "./chunk-WWJF4RO2.js";
69
69
  import {
70
70
  useControlled
71
- } from "./chunk-S3PQ6HKH.js";
71
+ } from "./chunk-OVJYUWSQ.js";
72
72
  import {
73
73
  useTransitionStatus,
74
74
  useValueAsRef
75
- } from "./chunk-7SR6WDM2.js";
75
+ } from "./chunk-E5HALE4M.js";
76
76
  import {
77
77
  EMPTY_ARRAY,
78
78
  EMPTY_OBJECT,
79
+ NOOP,
79
80
  addEventListener,
80
81
  cancelOpen,
81
82
  createChangeEventDetails,
@@ -114,12 +115,12 @@ import {
114
115
  useRenderElement,
115
116
  useStableCallback,
116
117
  windowResize
117
- } from "./chunk-C5X6G26O.js";
118
+ } from "./chunk-XJ6TGSUB.js";
118
119
  import {
119
120
  cn
120
- } from "./chunk-DJMHPJBP.js";
121
+ } from "./chunk-CHEC7TWB.js";
121
122
 
122
- // web/app/dist/server/assets/useRender-CtIKH5Iu.js
123
+ // web/app/dist/server/assets/select-DIXkpVzu.js
123
124
  import * as React$1 from "react";
124
125
  import { useLayoutEffect } from "react";
125
126
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -796,18 +797,18 @@ var size$2 = function(options) {
796
797
  const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
797
798
  const shiftData = state.middlewareData.shift;
798
799
  const noShift = !shiftData;
799
- let availableHeight = overflowAvailableHeight;
800
- let availableWidth = overflowAvailableWidth;
801
- if (shiftData != null && shiftData.enabled.x) availableWidth = maximumClippingWidth;
802
- if (shiftData != null && shiftData.enabled.y) availableHeight = maximumClippingHeight;
800
+ let availableHeight2 = overflowAvailableHeight;
801
+ let availableWidth2 = overflowAvailableWidth;
802
+ if (shiftData != null && shiftData.enabled.x) availableWidth2 = maximumClippingWidth;
803
+ if (shiftData != null && shiftData.enabled.y) availableHeight2 = maximumClippingHeight;
803
804
  if (noShift && !alignment) {
804
- if (isYAxis) availableWidth = width - 2 * max(overflow.left, overflow.right);
805
- else availableHeight = height - 2 * max(overflow.top, overflow.bottom);
805
+ if (isYAxis) availableWidth2 = width - 2 * max(overflow.left, overflow.right);
806
+ else availableHeight2 = height - 2 * max(overflow.top, overflow.bottom);
806
807
  }
807
808
  await apply({
808
809
  ...state,
809
- availableWidth,
810
- availableHeight
810
+ availableWidth: availableWidth2,
811
+ availableHeight: availableHeight2
811
812
  });
812
813
  const nextDimensions = await platform2.getDimensions(elements.floating);
813
814
  if (width !== nextDimensions.width || height !== nextDimensions.height) return { reset: { rects: true } };
@@ -2037,7 +2038,6 @@ function useListNavigation(context, props) {
2037
2038
  ]);
2038
2039
  const floating = React$1.useMemo(() => {
2039
2040
  return {
2040
- "aria-orientation": orientation === "both" ? void 0 : orientation,
2041
2041
  ...!typeableComboboxReference ? ariaActiveDescendantProp : {},
2042
2042
  onKeyDown(event) {
2043
2043
  if (event.key === "Tab" && event.shiftKey && open && !virtual) {
@@ -2059,7 +2059,6 @@ function useListNavigation(context, props) {
2059
2059
  ariaActiveDescendantProp,
2060
2060
  commonOnKeyDown,
2061
2061
  floatingFocusElementRef,
2062
- orientation,
2063
2062
  typeableComboboxReference,
2064
2063
  store,
2065
2064
  open,
@@ -2294,10 +2293,14 @@ var baseArrow = (options) => ({
2294
2293
  };
2295
2294
  }
2296
2295
  });
2297
- var arrow = (options, deps) => ({
2298
- ...baseArrow(options),
2299
- options: [options, deps]
2300
- });
2296
+ var arrow = (options, deps) => {
2297
+ const { name, fn } = baseArrow(options);
2298
+ return {
2299
+ name,
2300
+ fn,
2301
+ options: [options, deps]
2302
+ };
2303
+ };
2301
2304
  var hide = {
2302
2305
  name: "hide",
2303
2306
  async fn(state) {
@@ -2311,8 +2314,13 @@ var DEFAULT_SIDES = {
2311
2314
  sideX: "left",
2312
2315
  sideY: "top"
2313
2316
  };
2314
- var AVAILABLE_WIDTH_VAR = "--available-width";
2315
- var AVAILABLE_HEIGHT_VAR = "--available-height";
2317
+ var availableWidth = "--available-width";
2318
+ var availableHeight = "--available-height";
2319
+ var anchorWidth = "--anchor-width";
2320
+ var anchorHeight = "--anchor-height";
2321
+ var transformOrigin$1 = "--transform-origin";
2322
+ var AVAILABLE_WIDTH_VAR = availableWidth;
2323
+ var AVAILABLE_HEIGHT_VAR = availableHeight;
2316
2324
  function getLogicalSide(sideParam, renderedSide, isRtl) {
2317
2325
  const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
2318
2326
  return {
@@ -2447,47 +2455,37 @@ function useAnchorPositioningWithHook(params, useFloatingHook) {
2447
2455
  else middleware.push(flipMiddleware, shiftMiddleware);
2448
2456
  middleware.push(size({
2449
2457
  ...commonCollisionProps,
2450
- apply({ elements: { floating }, availableWidth, availableHeight, rects }) {
2458
+ apply({ elements: { floating }, availableWidth: availableWidth2, availableHeight: availableHeight2, rects }) {
2451
2459
  if (!mountedRef.current) return;
2452
2460
  const floatingStyle = floating.style;
2453
- floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);
2454
- floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);
2461
+ floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`);
2462
+ floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`);
2455
2463
  const dpr = getWindow(floating).devicePixelRatio || 1;
2456
2464
  const { x: x2, y: y2, width, height } = rects.reference;
2457
- const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr;
2458
- const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr;
2459
- floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`);
2460
- floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`);
2465
+ const anchorWidth$1 = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr;
2466
+ const anchorHeight$1 = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr;
2467
+ floatingStyle.setProperty(anchorWidth, `${anchorWidth$1}px`);
2468
+ floatingStyle.setProperty(anchorHeight, `${anchorHeight$1}px`);
2461
2469
  }
2462
2470
  }), arrow((state) => ({
2463
2471
  element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
2464
- padding: arrowPadding,
2472
+ padding: arrowRef.current ? arrowPadding : 0,
2465
2473
  offsetParent: "floating"
2466
2474
  }), [arrowPadding]), {
2467
2475
  name: "transformOrigin",
2468
2476
  fn(state) {
2469
- const { elements: elements2, middlewareData: middlewareData2, placement: renderedPlacement2, rects, y: y2 } = state;
2470
- const currentRenderedSide = getSide(renderedPlacement2);
2471
- const currentRenderedAxis = getSideAxis(currentRenderedSide);
2477
+ const { elements: { floating }, middlewareData: middlewareData2, placement: renderedPlacement2, platform: platform2, rects, y: y2 } = state;
2478
+ const renderedSide2 = getSide(renderedPlacement2);
2479
+ const renderedAlign2 = getAlignment(renderedPlacement2);
2480
+ const isVertical = getSideAxis(renderedSide2) === "y";
2472
2481
  const arrowEl = arrowRef.current;
2473
- const arrowX = middlewareData2.arrow?.x || 0;
2474
- const arrowY = middlewareData2.arrow?.y || 0;
2475
- const arrowWidth = arrowEl?.clientWidth || 0;
2476
- const arrowHeight = arrowEl?.clientHeight || 0;
2477
- const transformX = arrowX + arrowWidth / 2;
2478
- const transformY = arrowY + arrowHeight / 2;
2479
- const shiftY = Math.abs(middlewareData2.shift?.y || 0);
2480
- const halfAnchorHeight = rects.reference.height / 2;
2481
2482
  const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
2482
- const isOverlappingAnchor = shiftY > sideOffsetValue;
2483
- const adjacentTransformOrigin = {
2484
- top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,
2485
- bottom: `${transformX}px ${-sideOffsetValue}px`,
2486
- left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,
2487
- right: `${-sideOffsetValue}px ${transformY}px`
2488
- }[currentRenderedSide];
2489
- const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y2}px`;
2490
- elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
2483
+ let crossOrigin;
2484
+ if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) crossOrigin = renderedAlign2 === "start" === (isVertical && platform2.isRTL?.(floating) === true) ? "100%" : "0%";
2485
+ else crossOrigin = `${(isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0) + (isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0) / 2}px`;
2486
+ let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;
2487
+ if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y2}px`;
2488
+ floating.style.setProperty(transformOrigin$1, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);
2491
2489
  return {};
2492
2490
  }
2493
2491
  }, hide, adaptiveOrigin);
@@ -2500,6 +2498,7 @@ function useAnchorPositioningWithHook(params, useFloatingHook) {
2500
2498
  });
2501
2499
  }, [mounted, floatingRootContext]);
2502
2500
  const autoUpdateOptions = React$1.useMemo(() => ({
2501
+ ancestorScroll: !disableAnchorTracking,
2503
2502
  elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
2504
2503
  layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
2505
2504
  }), [disableAnchorTracking]);
@@ -2655,231 +2654,6 @@ function usePositioner(componentProps, state, { styles, transitionStatus, props,
2655
2654
  stateAttributesMapping: popupStateMapping
2656
2655
  });
2657
2656
  }
2658
- var CompositeListContext = /* @__PURE__ */ React$1.createContext({
2659
- register: () => {
2660
- },
2661
- unregister: () => {
2662
- },
2663
- subscribeMapChange: () => () => {
2664
- },
2665
- nextIndexRef: { current: 0 }
2666
- });
2667
- function useCompositeListContext() {
2668
- return React$1.useContext(CompositeListContext);
2669
- }
2670
- function CompositeList(props) {
2671
- const { children, elementsRef, labelsRef, onMapChange: onMapChangeProp } = props;
2672
- const onMapChange = useStableCallback(onMapChangeProp);
2673
- const [, setMapTick] = React$1.useState(false);
2674
- const listeners = useRefWithInit(createListeners).current;
2675
- const map = useRefWithInit(createMap).current;
2676
- const nextIndexRef = React$1.useRef(0);
2677
- const isDirtyRef = React$1.useRef(true);
2678
- const itemsRef = React$1.useRef([]);
2679
- const mutationObserverRef = React$1.useRef(null);
2680
- const scheduleMapUpdate = useStableCallback(() => {
2681
- if (isDirtyRef.current) return;
2682
- isDirtyRef.current = true;
2683
- setMapTick((tick) => !tick);
2684
- });
2685
- const register = useStableCallback((node, registration) => {
2686
- map.set(node, registration);
2687
- scheduleMapUpdate();
2688
- });
2689
- const unregister = useStableCallback((node) => {
2690
- map.delete(node);
2691
- scheduleMapUpdate();
2692
- });
2693
- const syncRefs = useStableCallback((items) => {
2694
- const nextMap = /* @__PURE__ */ new Map();
2695
- elementsRef.current.length = 0;
2696
- if (labelsRef) labelsRef.current.length = 0;
2697
- items.forEach((item) => {
2698
- nextMap.set(item.element, {
2699
- ...item.registration.metadata ?? {},
2700
- index: item.index
2701
- });
2702
- elementsRef.current[item.index] = item.element;
2703
- if (labelsRef) labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;
2704
- });
2705
- nextIndexRef.current = elementsRef.current.length;
2706
- return nextMap;
2707
- });
2708
- function observe(sortedNodes) {
2709
- mutationObserverRef.current?.disconnect();
2710
- mutationObserverRef.current = null;
2711
- if (typeof MutationObserver !== "function" || sortedNodes.length < 2) return;
2712
- const mutationObserver = new MutationObserver((entries) => {
2713
- if (!hasMovedNode(entries)) return;
2714
- let previousConnectedNode = null;
2715
- for (const node of sortedNodes) {
2716
- if (!node.isConnected) continue;
2717
- if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {
2718
- mutationObserver.disconnect();
2719
- scheduleMapUpdate();
2720
- return;
2721
- }
2722
- previousConnectedNode = node;
2723
- }
2724
- });
2725
- mutationObserverRef.current = mutationObserver;
2726
- const roots = /* @__PURE__ */ new Set();
2727
- for (let i = 1; i < sortedNodes.length; i += 1) {
2728
- const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);
2729
- if (root) roots.add(root);
2730
- }
2731
- roots.forEach((root) => mutationObserver.observe(root, { childList: true }));
2732
- }
2733
- const flush = useStableCallback(() => {
2734
- const [items, automaticNodes] = getCompositeListSnapshot(map);
2735
- const nextMap = syncRefs(items);
2736
- observe(automaticNodes);
2737
- itemsRef.current = items;
2738
- isDirtyRef.current = false;
2739
- listeners.forEach((listener) => listener(nextMap));
2740
- onMapChange(nextMap);
2741
- });
2742
- useIsoLayoutEffect(() => {
2743
- if (!isDirtyRef.current) syncRefs(itemsRef.current);
2744
- return () => {
2745
- elementsRef.current = [];
2746
- if (labelsRef) labelsRef.current = [];
2747
- };
2748
- }, [
2749
- elementsRef,
2750
- labelsRef,
2751
- syncRefs
2752
- ]);
2753
- useIsoLayoutEffect(() => {
2754
- if (isDirtyRef.current) flush();
2755
- });
2756
- useIsoLayoutEffect(() => {
2757
- return () => {
2758
- mutationObserverRef.current?.disconnect();
2759
- isDirtyRef.current = true;
2760
- };
2761
- }, []);
2762
- const subscribeMapChange = useStableCallback((fn) => {
2763
- listeners.add(fn);
2764
- return () => {
2765
- listeners.delete(fn);
2766
- };
2767
- });
2768
- const contextValue = React$1.useMemo(() => ({
2769
- register,
2770
- unregister,
2771
- subscribeMapChange,
2772
- nextIndexRef
2773
- }), [
2774
- register,
2775
- unregister,
2776
- subscribeMapChange,
2777
- nextIndexRef
2778
- ]);
2779
- return /* @__PURE__ */ jsx(CompositeListContext.Provider, {
2780
- value: contextValue,
2781
- children
2782
- });
2783
- }
2784
- function createMap() {
2785
- return /* @__PURE__ */ new Map();
2786
- }
2787
- function createListeners() {
2788
- return /* @__PURE__ */ new Set();
2789
- }
2790
- function getCompositeListSnapshot(map) {
2791
- const reservedIndices = /* @__PURE__ */ new Set();
2792
- const items = [];
2793
- const automaticItems = [];
2794
- map.forEach((registration, node) => {
2795
- if (!node.isConnected) return;
2796
- const index2 = registration.index;
2797
- const item = {
2798
- index: index2 ?? -1,
2799
- element: node,
2800
- registration
2801
- };
2802
- if (index2 === null) automaticItems.push(item);
2803
- else if (index2 >= 0) {
2804
- reservedIndices.add(index2);
2805
- items.push(item);
2806
- }
2807
- });
2808
- let nextAutomaticIndex = 0;
2809
- automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));
2810
- automaticItems.forEach((item) => {
2811
- while (reservedIndices.has(nextAutomaticIndex)) nextAutomaticIndex += 1;
2812
- item.index = nextAutomaticIndex;
2813
- items.push(item);
2814
- nextAutomaticIndex += 1;
2815
- });
2816
- if (reservedIndices.size > 0) items.sort((a, b) => a.index - b.index);
2817
- return [items, automaticItems.map((item) => item.element)];
2818
- }
2819
- function getCommonAncestor(firstNode, lastNode) {
2820
- let ancestor = firstNode.parentElement;
2821
- while (ancestor && !ancestor.contains(lastNode)) ancestor = ancestor.parentElement;
2822
- return ancestor;
2823
- }
2824
- function hasMovedNode(entries) {
2825
- for (const entry of entries) for (let i = 0; i < entry.removedNodes.length; i += 1) if (entry.removedNodes[i].isConnected) return true;
2826
- return false;
2827
- }
2828
- function sortByDocumentPosition(a, b) {
2829
- return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
2830
- }
2831
- function useCompositeListItem(params = {}) {
2832
- const { guess, label, metadata, textRef, index: externalIndex } = params;
2833
- const { register, unregister, subscribeMapChange, nextIndexRef } = useCompositeListContext();
2834
- const indexRef = React$1.useRef(-1);
2835
- const [internalIndex, setInternalIndex] = React$1.useState(externalIndex == null && guess ? () => {
2836
- if (indexRef.current === -1) {
2837
- const newIndex = nextIndexRef.current;
2838
- nextIndexRef.current += 1;
2839
- indexRef.current = newIndex;
2840
- }
2841
- return indexRef.current;
2842
- } : -1);
2843
- const index2 = externalIndex ?? internalIndex;
2844
- const componentRef = React$1.useRef(null);
2845
- const ref = React$1.useCallback((node) => {
2846
- const previousNode = componentRef.current;
2847
- if (previousNode) unregister(previousNode);
2848
- componentRef.current = node;
2849
- if (node) register(node, {
2850
- metadata: metadata ?? null,
2851
- index: externalIndex ?? null,
2852
- label,
2853
- textRef
2854
- });
2855
- }, [
2856
- externalIndex,
2857
- register,
2858
- unregister,
2859
- metadata,
2860
- label,
2861
- textRef
2862
- ]);
2863
- useIsoLayoutEffect(() => {
2864
- if (externalIndex != null) return;
2865
- return subscribeMapChange((map) => {
2866
- const i = componentRef.current ? map.get(componentRef.current)?.index : null;
2867
- if (i != null) setInternalIndex(i);
2868
- });
2869
- }, [externalIndex, subscribeMapChange]);
2870
- return {
2871
- ref,
2872
- index: index2
2873
- };
2874
- }
2875
- var CSPContext = /* @__PURE__ */ React$1.createContext(void 0);
2876
- var DEFAULT_CSP_CONTEXT_VALUE = { disableStyleElements: false };
2877
- function useCSPContext() {
2878
- return React$1.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
2879
- }
2880
- function isElementDisabled(element) {
2881
- return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
2882
- }
2883
2657
  function useOnFirstRender(fn) {
2884
2658
  const ref = React$1.useRef(true);
2885
2659
  if (ref.current) {
@@ -2898,24 +2672,70 @@ function usePreviousValue(value) {
2898
2672
  });
2899
2673
  return state.previous;
2900
2674
  }
2901
- var SelectRootContext = /* @__PURE__ */ React$1.createContext(null);
2675
+ function isElementDisabled(element) {
2676
+ return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
2677
+ }
2678
+ var SelectRootContext = /* @__PURE__ */ React$1.createContext(void 0);
2679
+ var SelectRootPropsContext = /* @__PURE__ */ React$1.createContext(void 0);
2680
+ var SelectFloatingContext = /* @__PURE__ */ React$1.createContext(void 0);
2902
2681
  function useSelectRootContext() {
2903
- const context = React$1.useContext(SelectRootContext);
2904
- if (context === null) throw new Error(formatErrorMessage(60));
2682
+ const store = React$1.useContext(SelectRootContext);
2683
+ if (store === void 0) throw new Error(formatErrorMessage(60));
2684
+ return store;
2685
+ }
2686
+ function useSelectRootPropsContext() {
2687
+ const context = React$1.useContext(SelectRootPropsContext);
2688
+ if (context === void 0) throw new Error(formatErrorMessage(101));
2689
+ return context;
2690
+ }
2691
+ function useSelectFloatingContext() {
2692
+ const context = React$1.useContext(SelectFloatingContext);
2693
+ if (context === void 0) throw new Error(formatErrorMessage(61));
2905
2694
  return context;
2906
2695
  }
2696
+ function areArraysEqual(array1, array2, itemComparer = Object.is) {
2697
+ const { length } = array1;
2698
+ if (length !== array2.length) return false;
2699
+ for (let i = 0; i < length; i += 1) if (!itemComparer(array1[i], array2[i])) return false;
2700
+ return true;
2701
+ }
2907
2702
  var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
2908
2703
  function compareItemEquality(itemValue, selectedValue, comparer) {
2909
2704
  if (itemValue == null || selectedValue == null) return Object.is(itemValue, selectedValue);
2910
2705
  return comparer(itemValue, selectedValue);
2911
2706
  }
2707
+ function isSelectedValueDirty(currentValue, initialValue, comparer) {
2708
+ if (Array.isArray(currentValue) && Array.isArray(initialValue)) return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer));
2709
+ return currentValue !== initialValue;
2710
+ }
2711
+ function selectedValueIncludes(selectedValues, itemValue, comparer) {
2712
+ if (!selectedValues) return false;
2713
+ return selectedValues.some((selectedValue) => {
2714
+ if (selectedValue === void 0) return false;
2715
+ return compareItemEquality(itemValue, selectedValue, comparer);
2716
+ });
2717
+ }
2912
2718
  function findItemIndex(itemValues, selectedValue, comparer) {
2913
- if (!itemValues || itemValues.length === 0) return -1;
2719
+ if (!itemValues) return -1;
2914
2720
  return itemValues.findIndex((itemValue) => {
2915
2721
  if (itemValue === void 0) return false;
2916
2722
  return compareItemEquality(itemValue, selectedValue, comparer);
2917
2723
  });
2918
2724
  }
2725
+ function createSelectionMatcher(selectedValues, comparer) {
2726
+ if (comparer !== defaultItemEquality) return (itemValue) => selectedValueIncludes(selectedValues, itemValue, comparer);
2727
+ const index2 = new Set(selectedValues);
2728
+ index2.delete(void 0);
2729
+ return (itemValue) => index2.has(itemValue) && (itemValue !== 0 || selectedValues.some((v) => Object.is(itemValue, v)));
2730
+ }
2731
+ function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {
2732
+ const index2 = multiple && Array.isArray(selectedValue) ? itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);
2733
+ return index2 === -1 ? null : index2;
2734
+ }
2735
+ function resolveSelectedIndex(index2, itemValue, registry, selectedValues, comparer, currentIndex) {
2736
+ if (selectedValueIncludes(selectedValues, itemValue, comparer)) return currentIndex != null && index2 > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index2;
2737
+ return index2 === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;
2738
+ }
2919
2739
  function removeItem(selectedValues, itemValue, comparer) {
2920
2740
  return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer));
2921
2741
  }
@@ -2928,8 +2748,14 @@ function serializeValue(value) {
2928
2748
  return String(value);
2929
2749
  }
2930
2750
  }
2751
+ function isGroup(item) {
2752
+ return typeof item === "object" && item != null && Array.isArray(item.items);
2753
+ }
2931
2754
  function isGroupedItems(items) {
2932
- return items != null && items.length > 0 && typeof items[0] === "object" && items[0] != null && "items" in items[0];
2755
+ return isGroup(items?.[0]);
2756
+ }
2757
+ function flattenLeafItems(items) {
2758
+ return isGroupedItems(items) ? items.flatMap((group) => group.items) : items;
2933
2759
  }
2934
2760
  function hasNullItemLabel(items) {
2935
2761
  if (!Array.isArray(items)) return items != null && "null" in items;
@@ -2960,10 +2786,9 @@ function resolveSelectedLabel(value, items, itemToStringLabel) {
2960
2786
  }
2961
2787
  if (itemToStringLabel && value != null) return itemToStringLabel(value);
2962
2788
  if (value && typeof value === "object" && "label" in value && value.label != null) return value.label;
2963
- if (items && !Array.isArray(items)) return items[value] ?? fallback();
2789
+ if (items && !Array.isArray(items)) return (Object.hasOwn(items, value) ? items[value] : void 0) ?? fallback();
2964
2790
  if (Array.isArray(items)) {
2965
- const arrayItems = items;
2966
- const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap((group) => group.items) : arrayItems;
2791
+ const flatItems = flattenLeafItems(items);
2967
2792
  if (value == null || typeof value !== "object") {
2968
2793
  const match = flatItems.find((item) => item.value === value);
2969
2794
  if (match && match.label != null) return match.label;
@@ -3027,17 +2852,6 @@ var selectors = {
3027
2852
  scrollDownArrowVisible: (state) => state.scrollDownArrowVisible,
3028
2853
  hasScrollArrows: (state) => state.hasScrollArrows
3029
2854
  };
3030
- function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
3031
- return array1.length === array2.length && array1.every((value, index2) => itemComparer(value, array2[index2]));
3032
- }
3033
- function useValueChanged(value, onChange) {
3034
- const valueRef = React$1.useRef(value);
3035
- const onChangeCallback = useStableCallback(onChange);
3036
- useIsoLayoutEffect(() => {
3037
- if (valueRef.current !== value) onChangeCallback(valueRef.current);
3038
- valueRef.current = value;
3039
- }, [value, onChangeCallback]);
3040
- }
3041
2855
  function useEnhancedClickHandler(handler) {
3042
2856
  const lastClickInteractionTypeRef = React$1.useRef("");
3043
2857
  const handlePointerDown = React$1.useCallback((event) => {
@@ -3128,6 +2942,7 @@ function SelectRoot(props) {
3128
2942
  dragY: 0
3129
2943
  });
3130
2944
  const alignItemWithTriggerActiveRef = React$1.useRef(false);
2945
+ const initialValueRef = React$1.useRef(value);
3131
2946
  const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
3132
2947
  const { openMethod, triggerProps: interactionTypeProps } = useOpenInteractionType(open);
3133
2948
  const store = useRefWithInit(() => new ReactStore({
@@ -3147,8 +2962,8 @@ function SelectRoot(props) {
3147
2962
  openMethod: null,
3148
2963
  activeIndex: null,
3149
2964
  selectedIndex: null,
3150
- popupProps: {},
3151
- triggerProps: {},
2965
+ popupProps: EMPTY_OBJECT,
2966
+ triggerProps: EMPTY_OBJECT,
3152
2967
  triggerElement: null,
3153
2968
  positionerElement: null,
3154
2969
  listElement: null,
@@ -3156,11 +2971,29 @@ function SelectRoot(props) {
3156
2971
  scrollUpArrowVisible: false,
3157
2972
  scrollDownArrowVisible: false,
3158
2973
  hasScrollArrows: false
3159
- })).current;
3160
- const activeIndex = useStore(store, selectors.activeIndex);
3161
- const selectedIndex = useStore(store, selectors.selectedIndex);
3162
- const triggerElement = useStore(store, selectors.triggerElement);
3163
- const positionerElement = useStore(store, selectors.positionerElement);
2974
+ }, {
2975
+ setValue: NOOP,
2976
+ setOpen: NOOP,
2977
+ handleScrollArrowVisibility: NOOP,
2978
+ onOpenChangeComplete: NOOP,
2979
+ listRef,
2980
+ popupRef,
2981
+ scrollHandlerRef,
2982
+ scrollArrowsMountedCountRef,
2983
+ valueRef,
2984
+ valuesRef,
2985
+ labelsRef,
2986
+ typingRef,
2987
+ selectionRef,
2988
+ firstItemTextRef,
2989
+ selectedItemTextRef,
2990
+ alignItemWithTriggerActiveRef,
2991
+ initialValueRef
2992
+ }, selectors)).current;
2993
+ const activeIndex = store.useState("activeIndex");
2994
+ const selectedIndex = store.useState("selectedIndex");
2995
+ const triggerElement = store.useState("triggerElement");
2996
+ const positionerElement = store.useState("positionerElement");
3164
2997
  const previousOpenMethod = usePreviousValue(openMethod);
3165
2998
  const renderedOpenMethod = openMethod ?? previousOpenMethod;
3166
2999
  const serializedValue = React$1.useMemo(() => {
@@ -3182,21 +3015,12 @@ function SelectRoot(props) {
3182
3015
  const controlRef = useValueAsRef(triggerElement);
3183
3016
  const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);
3184
3017
  useRegisterFieldControl(controlRef, generatedId, value, getStringifiedValueForForm, !disabled, nameProp);
3185
- const initialValueRef = React$1.useRef(value);
3186
3018
  const hasSelectedValue = multiple ? Array.isArray(value) && value.length > 0 : value != null && serializedValue !== "";
3187
3019
  useIsoLayoutEffect(() => {
3188
3020
  setFilled(hasSelectedValue);
3189
3021
  }, [hasSelectedValue, setFilled]);
3190
3022
  useIsoLayoutEffect(function syncSelectedIndex() {
3191
- let target = value;
3192
- let empty = false;
3193
- if (multiple) {
3194
- const currentValue = Array.isArray(value) ? value : [];
3195
- empty = currentValue.length === 0;
3196
- target = currentValue[currentValue.length - 1];
3197
- }
3198
- const index2 = empty ? -1 : findItemIndex(valuesRef.current, target, isItemEqualToValue);
3199
- const nextIndex = index2 === -1 ? null : index2;
3023
+ const nextIndex = findSelectionIndex(valuesRef.current, value, isItemEqualToValue, multiple);
3200
3024
  if (nextIndex === null) selectedItemTextRef.current = null;
3201
3025
  if (open) return;
3202
3026
  store.set("selectedIndex", nextIndex);
@@ -3207,14 +3031,9 @@ function SelectRoot(props) {
3207
3031
  isItemEqualToValue,
3208
3032
  store
3209
3033
  ]);
3210
- function isSelectedValueDirty(currentValue) {
3211
- const initialValue = validityData.initialValue;
3212
- if (Array.isArray(currentValue) && Array.isArray(initialValue)) return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, isItemEqualToValue));
3213
- return currentValue !== initialValue;
3214
- }
3215
3034
  useValueChanged(value, () => {
3216
3035
  clearErrors(name);
3217
- setDirty(isSelectedValueDirty(value));
3036
+ setDirty(isSelectedValueDirty(value, validityData.initialValue, isItemEqualToValue));
3218
3037
  validation.change(value);
3219
3038
  });
3220
3039
  const setOpen = useStableCallback((nextOpen, eventDetails) => {
@@ -3268,12 +3087,12 @@ function SelectRoot(props) {
3268
3087
  }
3269
3088
  });
3270
3089
  const click = useClick(floatingContext, {
3271
- enabled: !readOnly && !disabled,
3090
+ enabled: !disabled,
3272
3091
  event: "mousedown"
3273
3092
  });
3274
3093
  const dismiss = useDismiss(floatingContext);
3275
3094
  const listNavigation2 = useListNavigation(floatingContext, {
3276
- enabled: !readOnly && !disabled,
3095
+ enabled: !disabled,
3277
3096
  listRef,
3278
3097
  activeIndex,
3279
3098
  selectedIndex,
@@ -3285,7 +3104,7 @@ function SelectRoot(props) {
3285
3104
  focusItemOnHover: highlightItemOnHover
3286
3105
  });
3287
3106
  const typeahead = useTypeahead(floatingContext, {
3288
- enabled: !readOnly && !disabled && (open || !multiple),
3107
+ enabled: !disabled && (open || !readOnly && !multiple),
3289
3108
  listRef: labelsRef,
3290
3109
  activeIndex,
3291
3110
  selectedIndex,
@@ -3311,6 +3130,10 @@ function SelectRoot(props) {
3311
3130
  dismiss.floating
3312
3131
  ]);
3313
3132
  const itemProps = listNavigation2.item ?? EMPTY_OBJECT;
3133
+ store.useContextCallback("setValue", setValue);
3134
+ store.useContextCallback("setOpen", setOpen);
3135
+ store.useContextCallback("handleScrollArrowVisibility", handleScrollArrowVisibility);
3136
+ store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
3314
3137
  useOnFirstRender(() => {
3315
3138
  store.update({
3316
3139
  popupProps,
@@ -3333,47 +3156,20 @@ function SelectRoot(props) {
3333
3156
  isItemEqualToValue,
3334
3157
  openMethod: renderedOpenMethod
3335
3158
  });
3336
- const contextValue = React$1.useMemo(() => ({
3337
- store,
3338
- floatingContext,
3339
- required,
3159
+ const rootPropsContextValue = React$1.useMemo(() => ({
3340
3160
  disabled,
3341
3161
  readOnly,
3162
+ required,
3342
3163
  multiple,
3343
3164
  highlightItemOnHover,
3344
- setValue,
3345
- setOpen,
3346
- listRef,
3347
- popupRef,
3348
- scrollHandlerRef,
3349
- handleScrollArrowVisibility,
3350
- scrollArrowsMountedCountRef,
3351
- itemProps,
3352
- valueRef,
3353
- valuesRef,
3354
- labelsRef,
3355
- typingRef,
3356
- selectionRef,
3357
- firstItemTextRef,
3358
- selectedItemTextRef,
3359
- validation,
3360
- onOpenChangeComplete,
3361
- alignItemWithTriggerActiveRef,
3362
- initialValueRef
3165
+ itemProps
3363
3166
  }), [
3364
- store,
3365
- floatingContext,
3366
- required,
3367
3167
  disabled,
3368
3168
  readOnly,
3169
+ required,
3369
3170
  multiple,
3370
3171
  highlightItemOnHover,
3371
- setValue,
3372
- setOpen,
3373
- itemProps,
3374
- validation,
3375
- onOpenChangeComplete,
3376
- handleScrollArrowVisibility
3172
+ itemProps
3377
3173
  ]);
3378
3174
  const ref = useMergedRefs(inputRef, validation.inputRef);
3379
3175
  const hiddenInputName = multiple ? void 0 : name;
@@ -3398,9 +3194,15 @@ function SelectRoot(props) {
3398
3194
  disabled
3399
3195
  ]);
3400
3196
  return /* @__PURE__ */ jsxs(SelectRootContext.Provider, {
3401
- value: contextValue,
3197
+ value: store,
3402
3198
  children: [
3403
- children,
3199
+ /* @__PURE__ */ jsx(SelectRootPropsContext.Provider, {
3200
+ value: rootPropsContextValue,
3201
+ children: /* @__PURE__ */ jsx(SelectFloatingContext.Provider, {
3202
+ value: floatingContext,
3203
+ children
3204
+ })
3205
+ }),
3404
3206
  /* @__PURE__ */ jsx("input", {
3405
3207
  ...validation.getValidationProps(disabled, {
3406
3208
  onFocus() {
@@ -3473,33 +3275,35 @@ function getPseudoElementBounds(element) {
3473
3275
  bottom: elementRect.bottom + heightDiff / 2
3474
3276
  };
3475
3277
  }
3278
+ var popupSide = "data-popup-side";
3476
3279
  var SELECTED_DELAY = 400;
3477
3280
  var stateAttributesMapping$2 = {
3478
3281
  ...pressableTriggerOpenStateMapping,
3479
3282
  ...fieldValidityMapping,
3480
- popupSide: (side) => side ? { "data-popup-side": side } : null,
3283
+ popupSide: (side) => side ? { [popupSide]: side } : null,
3481
3284
  value: () => null
3482
3285
  };
3483
3286
  var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(componentProps, forwardedRef) {
3484
3287
  const { render, className, id: idProp, disabled: disabledProp = false, nativeButton = true, style, ...elementProps } = componentProps;
3485
- const { setTouched, setFocused, validationMode, state: fieldState, disabled: fieldDisabled } = useFieldRootContext();
3288
+ const { setTouched, setFocused, validationMode, validation, state: fieldState, disabled: fieldDisabled } = useFieldRootContext();
3486
3289
  const { labelId: fieldLabelId } = useLabelableContext();
3487
- const { store, setOpen, selectionRef, validation, readOnly, required, alignItemWithTriggerActiveRef, disabled: selectDisabled } = useSelectRootContext();
3290
+ const store = useSelectRootContext();
3291
+ const { readOnly, required, disabled: selectDisabled } = useSelectRootPropsContext();
3488
3292
  const disabled = fieldDisabled || selectDisabled || disabledProp;
3489
- const open = useStore(store, selectors.open);
3490
- const mounted = useStore(store, selectors.mounted);
3491
- const value = useStore(store, selectors.value);
3492
- const triggerProps = useStore(store, selectors.triggerProps);
3493
- const positionerElement = useStore(store, selectors.positionerElement);
3494
- const listElement = useStore(store, selectors.listElement);
3495
- const popupSideValue = useStore(store, selectors.popupSide);
3496
- const rootId = useStore(store, selectors.id);
3497
- const selectLabelId = useStore(store, selectors.labelId);
3498
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
3499
- const popupSide = mounted && positionerElement ? popupSideValue : null;
3293
+ const open = store.useState("open");
3294
+ const mounted = store.useState("mounted");
3295
+ const value = store.useState("value");
3296
+ const triggerProps = store.useState("triggerProps");
3297
+ const positionerElement = store.useState("positionerElement");
3298
+ const listElement = store.useState("listElement");
3299
+ const popupSideValue = store.useState("popupSide");
3300
+ const rootId = store.useState("id");
3301
+ const selectLabelId = store.useState("labelId");
3302
+ const hasSelectedValue = store.useState("hasSelectedValue");
3303
+ const popupSide2 = mounted && positionerElement ? popupSideValue : null;
3500
3304
  const id = idProp ?? rootId;
3501
3305
  const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);
3502
- useLabelableId({ id });
3306
+ useLabelableId({ id: idProp });
3503
3307
  const positionerRef = useValueAsRef(positionerElement);
3504
3308
  const triggerRef = React$1.useRef(null);
3505
3309
  const { getButtonProps, buttonRef } = useButton({
@@ -3513,14 +3317,14 @@ var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(c
3513
3317
  React$1.useEffect(() => {
3514
3318
  if (open) {
3515
3319
  selectedDelayTimeout.start(SELECTED_DELAY, () => {
3516
- selectionRef.current.allowUnselectedMouseUp = true;
3517
- selectionRef.current.allowSelectedMouseUp = true;
3320
+ store.context.selectionRef.current.allowUnselectedMouseUp = true;
3321
+ store.context.selectionRef.current.allowSelectedMouseUp = true;
3518
3322
  });
3519
3323
  return () => {
3520
3324
  selectedDelayTimeout.clear();
3521
3325
  };
3522
3326
  }
3523
- selectionRef.current = {
3327
+ store.context.selectionRef.current = {
3524
3328
  allowSelectedMouseUp: false,
3525
3329
  allowUnselectedMouseUp: false,
3526
3330
  dragY: 0
@@ -3528,7 +3332,7 @@ var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(c
3528
3332
  timeoutMouseDown.clear();
3529
3333
  }, [
3530
3334
  open,
3531
- selectionRef,
3335
+ store,
3532
3336
  timeoutMouseDown,
3533
3337
  selectedDelayTimeout
3534
3338
  ]);
@@ -3544,7 +3348,7 @@ var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(c
3544
3348
  tabIndex: disabled ? -1 : 0,
3545
3349
  onFocus(event) {
3546
3350
  setFocused(true);
3547
- if (open && alignItemWithTriggerActiveRef.current) setOpen(false, createChangeEventDetails(none, event.nativeEvent));
3351
+ if (open && store.context.alignItemWithTriggerActiveRef.current) store.context.setOpen(false, createChangeEventDetails(none, event.nativeEvent));
3548
3352
  timeoutFocus.start(0, () => {
3549
3353
  store.set("forceMount", true);
3550
3354
  });
@@ -3563,7 +3367,7 @@ var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(c
3563
3367
  const mouseUpTarget = mouseEvent.target;
3564
3368
  if (contains(triggerRef.current, mouseUpTarget) || contains(positionerRef.current, mouseUpTarget)) return;
3565
3369
  if (isMouseWithinBounds(mouseEvent, triggerRef.current)) return;
3566
- setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
3370
+ store.context.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
3567
3371
  }
3568
3372
  timeoutMouseDown.start(0, () => {
3569
3373
  doc.addEventListener("mouseup", handleMouseUp, { once: true });
@@ -3578,7 +3382,7 @@ var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(c
3578
3382
  disabled,
3579
3383
  value,
3580
3384
  readOnly,
3581
- popupSide,
3385
+ popupSide: popupSide2,
3582
3386
  placeholder: !hasSelectedValue
3583
3387
  };
3584
3388
  return useRenderElement("button", componentProps, {
@@ -3596,13 +3400,13 @@ var SelectTrigger = /* @__PURE__ */ React$1.forwardRef(function SelectTrigger2(c
3596
3400
  var stateAttributesMapping$1 = { value: () => null };
3597
3401
  var SelectValue = /* @__PURE__ */ React$1.forwardRef(function SelectValue2(componentProps, forwardedRef) {
3598
3402
  const { className, render, children: childrenProp, placeholder, style, ...elementProps } = componentProps;
3599
- const { store, valueRef } = useSelectRootContext();
3600
- const value = useStore(store, selectors.value);
3601
- const items = useStore(store, selectors.items);
3602
- const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
3603
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
3403
+ const store = useSelectRootContext();
3404
+ const value = store.useState("value");
3405
+ const items = store.useState("items");
3406
+ const itemToStringLabel = store.useState("itemToStringLabel");
3407
+ const hasSelectedValue = store.useState("hasSelectedValue");
3604
3408
  const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
3605
- const hasNullLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
3409
+ const hasNullLabel = store.useState("hasNullItemLabel", shouldCheckNullItemLabel);
3606
3410
  const state = {
3607
3411
  value,
3608
3412
  placeholder: !hasSelectedValue
@@ -3615,15 +3419,14 @@ var SelectValue = /* @__PURE__ */ React$1.forwardRef(function SelectValue2(compo
3615
3419
  else children = resolveSelectedLabel(value, items, itemToStringLabel);
3616
3420
  return useRenderElement("span", componentProps, {
3617
3421
  state,
3618
- ref: [forwardedRef, valueRef],
3422
+ ref: [forwardedRef, store.context.valueRef],
3619
3423
  props: [{ children }, elementProps],
3620
3424
  stateAttributesMapping: stateAttributesMapping$1
3621
3425
  });
3622
3426
  });
3623
3427
  var SelectIcon = /* @__PURE__ */ React$1.forwardRef(function SelectIcon2(componentProps, forwardedRef) {
3624
3428
  const { render, className, style, ...elementProps } = componentProps;
3625
- const { store } = useSelectRootContext();
3626
- const state = { open: useStore(store, selectors.open) };
3429
+ const state = { open: useSelectRootContext().useState("open") };
3627
3430
  return useRenderElement("span", componentProps, {
3628
3431
  state,
3629
3432
  ref: forwardedRef,
@@ -3635,15 +3438,194 @@ var SelectIcon = /* @__PURE__ */ React$1.forwardRef(function SelectIcon2(compone
3635
3438
  });
3636
3439
  });
3637
3440
  var SelectPortal = /* @__PURE__ */ React$1.forwardRef(function SelectPortal2(portalProps, forwardedRef) {
3638
- const { store } = useSelectRootContext();
3639
- const mounted = useStore(store, selectors.mounted);
3640
- const forceMount = useStore(store, selectors.forceMount);
3441
+ const store = useSelectRootContext();
3442
+ const mounted = store.useState("mounted");
3443
+ const forceMount = store.useState("forceMount");
3641
3444
  if (!(mounted || forceMount)) return null;
3642
3445
  return /* @__PURE__ */ jsx(FloatingPortal, {
3643
3446
  ref: forwardedRef,
3644
3447
  ...portalProps
3645
3448
  });
3646
3449
  });
3450
+ var CompositeListContext = /* @__PURE__ */ React$1.createContext({
3451
+ register: () => {
3452
+ },
3453
+ unregister: () => {
3454
+ },
3455
+ subscribeMapChange: () => () => {
3456
+ },
3457
+ nextIndexRef: { current: 0 }
3458
+ });
3459
+ function useCompositeListContext() {
3460
+ return React$1.useContext(CompositeListContext);
3461
+ }
3462
+ function CompositeList(props) {
3463
+ const { children, elementsRef, labelsRef, onMapChange: onMapChangeProp } = props;
3464
+ const onMapChange = useStableCallback(onMapChangeProp);
3465
+ const [, setMapTick] = React$1.useState(false);
3466
+ const listeners = useRefWithInit(createListeners).current;
3467
+ const map = useRefWithInit(createMap).current;
3468
+ const nextIndexRef = React$1.useRef(0);
3469
+ const isDirtyRef = React$1.useRef(true);
3470
+ const itemsRef = React$1.useRef(null);
3471
+ const mutationObserverRef = React$1.useRef(null);
3472
+ const scheduleMapUpdate = useStableCallback(() => {
3473
+ if (isDirtyRef.current) return;
3474
+ isDirtyRef.current = true;
3475
+ setMapTick((tick) => !tick);
3476
+ });
3477
+ const register = useStableCallback((node, registration) => {
3478
+ map.set(node, registration);
3479
+ scheduleMapUpdate();
3480
+ });
3481
+ const unregister = useStableCallback((node) => {
3482
+ map.delete(node);
3483
+ scheduleMapUpdate();
3484
+ });
3485
+ const syncRefs = useStableCallback((items) => {
3486
+ const nextMap = /* @__PURE__ */ new Map();
3487
+ elementsRef.current.length = 0;
3488
+ if (labelsRef) labelsRef.current.length = 0;
3489
+ items.forEach((item) => {
3490
+ nextMap.set(item.element, {
3491
+ ...item.registration.metadata ?? {},
3492
+ index: item.index
3493
+ });
3494
+ elementsRef.current[item.index] = item.element;
3495
+ if (labelsRef) labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;
3496
+ });
3497
+ nextIndexRef.current = elementsRef.current.length;
3498
+ return nextMap;
3499
+ });
3500
+ function observe(sortedNodes) {
3501
+ mutationObserverRef.current?.disconnect();
3502
+ mutationObserverRef.current = null;
3503
+ if (typeof MutationObserver !== "function" || sortedNodes.length < 2) return;
3504
+ const mutationObserver = new MutationObserver((entries) => {
3505
+ if (!hasMovedNode(entries)) return;
3506
+ let previousConnectedNode = null;
3507
+ for (const node of sortedNodes) {
3508
+ if (!node.isConnected) continue;
3509
+ if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {
3510
+ mutationObserver.disconnect();
3511
+ scheduleMapUpdate();
3512
+ return;
3513
+ }
3514
+ previousConnectedNode = node;
3515
+ }
3516
+ });
3517
+ mutationObserverRef.current = mutationObserver;
3518
+ const roots = /* @__PURE__ */ new Set();
3519
+ for (let i = 1; i < sortedNodes.length; i += 1) {
3520
+ const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);
3521
+ if (root) roots.add(root);
3522
+ }
3523
+ roots.forEach((root) => mutationObserver.observe(root, { childList: true }));
3524
+ }
3525
+ const flush = useStableCallback(() => {
3526
+ const [items, automaticNodes] = getCompositeListSnapshot(map);
3527
+ const nextMap = syncRefs(items);
3528
+ const previousItems = itemsRef.current;
3529
+ const changed = !previousItems || previousItems.length !== items.length || items.some((item, index2) => {
3530
+ const previousItem = previousItems[index2];
3531
+ return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata;
3532
+ });
3533
+ observe(automaticNodes);
3534
+ itemsRef.current = items;
3535
+ isDirtyRef.current = false;
3536
+ if (!changed) return;
3537
+ listeners.forEach((listener) => listener(nextMap));
3538
+ onMapChange(nextMap);
3539
+ });
3540
+ useIsoLayoutEffect(() => {
3541
+ if (!isDirtyRef.current && itemsRef.current) syncRefs(itemsRef.current);
3542
+ return () => {
3543
+ elementsRef.current = [];
3544
+ if (labelsRef) labelsRef.current = [];
3545
+ };
3546
+ }, [
3547
+ elementsRef,
3548
+ labelsRef,
3549
+ syncRefs
3550
+ ]);
3551
+ useIsoLayoutEffect(() => {
3552
+ if (isDirtyRef.current) flush();
3553
+ });
3554
+ useIsoLayoutEffect(() => {
3555
+ return () => {
3556
+ mutationObserverRef.current?.disconnect();
3557
+ isDirtyRef.current = true;
3558
+ };
3559
+ }, []);
3560
+ const subscribeMapChange = useStableCallback((fn) => {
3561
+ listeners.add(fn);
3562
+ return () => {
3563
+ listeners.delete(fn);
3564
+ };
3565
+ });
3566
+ const contextValue = React$1.useMemo(() => ({
3567
+ register,
3568
+ unregister,
3569
+ subscribeMapChange,
3570
+ nextIndexRef
3571
+ }), [
3572
+ register,
3573
+ unregister,
3574
+ subscribeMapChange,
3575
+ nextIndexRef
3576
+ ]);
3577
+ return /* @__PURE__ */ jsx(CompositeListContext.Provider, {
3578
+ value: contextValue,
3579
+ children
3580
+ });
3581
+ }
3582
+ function createMap() {
3583
+ return /* @__PURE__ */ new Map();
3584
+ }
3585
+ function createListeners() {
3586
+ return /* @__PURE__ */ new Set();
3587
+ }
3588
+ function getCompositeListSnapshot(map) {
3589
+ const reservedIndices = /* @__PURE__ */ new Set();
3590
+ const items = [];
3591
+ const automaticItems = [];
3592
+ map.forEach((registration, node) => {
3593
+ if (!node.isConnected) return;
3594
+ const index2 = registration.index;
3595
+ const item = {
3596
+ index: index2 ?? -1,
3597
+ element: node,
3598
+ registration
3599
+ };
3600
+ if (index2 === null) automaticItems.push(item);
3601
+ else if (index2 >= 0) {
3602
+ reservedIndices.add(index2);
3603
+ items.push(item);
3604
+ }
3605
+ });
3606
+ let nextAutomaticIndex = 0;
3607
+ automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));
3608
+ automaticItems.forEach((item) => {
3609
+ while (reservedIndices.has(nextAutomaticIndex)) nextAutomaticIndex += 1;
3610
+ item.index = nextAutomaticIndex;
3611
+ items.push(item);
3612
+ nextAutomaticIndex += 1;
3613
+ });
3614
+ if (reservedIndices.size > 0) items.sort((a, b) => a.index - b.index);
3615
+ return [items, automaticItems.map((item) => item.element)];
3616
+ }
3617
+ function getCommonAncestor(firstNode, lastNode) {
3618
+ let ancestor = firstNode.parentElement;
3619
+ while (ancestor && !ancestor.contains(lastNode)) ancestor = ancestor.parentElement;
3620
+ return ancestor;
3621
+ }
3622
+ function hasMovedNode(entries) {
3623
+ for (const entry of entries) for (let i = 0; i < entry.removedNodes.length; i += 1) if (entry.removedNodes[i].isConnected) return true;
3624
+ return false;
3625
+ }
3626
+ function sortByDocumentPosition(a, b) {
3627
+ return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
3628
+ }
3647
3629
  var SelectPositionerContext = /* @__PURE__ */ React$1.createContext(void 0);
3648
3630
  function useSelectPositionerContext() {
3649
3631
  const context = React$1.useContext(SelectPositionerContext);
@@ -3680,22 +3662,23 @@ function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, refer
3680
3662
  var FIXED = { position: "fixed" };
3681
3663
  var SelectPositioner = /* @__PURE__ */ React$1.forwardRef(function SelectPositioner2(componentProps, forwardedRef) {
3682
3664
  const { anchor, className, render, positionMethod, side, align, sideOffset, alignOffset, collisionBoundary = "clipping-ancestors", collisionPadding, arrowPadding, sticky, disableAnchorTracking, alignItemWithTrigger = true, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style, ...elementProps } = componentProps;
3683
- const { store, listRef, labelsRef, alignItemWithTriggerActiveRef, selectedItemTextRef, valuesRef, initialValueRef, popupRef, setValue, floatingContext: floatingRootContext } = useSelectRootContext();
3684
- const open = useStore(store, selectors.open);
3685
- const mounted = useStore(store, selectors.mounted);
3686
- const modal = useStore(store, selectors.modal);
3687
- const value = useStore(store, selectors.value);
3688
- const openMethod = useStore(store, selectors.openMethod);
3689
- const positionerElement = useStore(store, selectors.positionerElement);
3690
- const triggerElement = useStore(store, selectors.triggerElement);
3691
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
3692
- const transitionStatus = useStore(store, selectors.transitionStatus);
3665
+ const store = useSelectRootContext();
3666
+ const floatingRootContext = useSelectFloatingContext();
3667
+ const open = store.useState("open");
3668
+ const mounted = store.useState("mounted");
3669
+ const modal = store.useState("modal");
3670
+ const value = store.useState("value");
3671
+ const openMethod = store.useState("openMethod");
3672
+ const positionerElement = store.useState("positionerElement");
3673
+ const triggerElement = store.useState("triggerElement");
3674
+ const isItemEqualToValue = store.useState("isItemEqualToValue");
3675
+ const transitionStatus = store.useState("transitionStatus");
3693
3676
  const scrollUpArrowRef = React$1.useRef(null);
3694
3677
  const scrollDownArrowRef = React$1.useRef(null);
3695
3678
  const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = React$1.useState(alignItemWithTrigger);
3696
3679
  const alignItemWithTriggerActive = mounted && controlledAlignItemWithTrigger && openMethod !== "touch";
3697
3680
  if (!mounted && controlledAlignItemWithTrigger !== alignItemWithTrigger) setControlledAlignItemWithTrigger(alignItemWithTrigger);
3698
- React$1.useImperativeHandle(alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);
3681
+ React$1.useImperativeHandle(store.context.alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);
3699
3682
  useAnchoredPopupScrollLock((alignItemWithTriggerActive || modal) && open, openMethod === "touch", positionerElement, triggerElement);
3700
3683
  const positioning = useAnchorPositioning({
3701
3684
  anchor,
@@ -3735,29 +3718,28 @@ var SelectPositioner = /* @__PURE__ */ React$1.forwardRef(function SelectPositio
3735
3718
  });
3736
3719
  const prevMapSizeRef = React$1.useRef(0);
3737
3720
  const onMapChange = useStableCallback((map) => {
3738
- if (valuesRef.current.length === 0) return;
3721
+ if (store.context.valuesRef.current.length === 0) return;
3739
3722
  const prevSize = prevMapSizeRef.current;
3740
3723
  prevMapSizeRef.current = map.size;
3741
- if (map.size === prevSize) return;
3742
3724
  const eventDetails = createChangeEventDetails(none);
3743
3725
  if (prevSize !== 0 && !store.state.multiple && value !== null) {
3744
- if (findItemIndex(valuesRef.current, value, isItemEqualToValue) === -1) {
3745
- const initialSelectedValue = initialValueRef.current;
3746
- const nextValue = initialSelectedValue != null && findItemIndex(valuesRef.current, initialSelectedValue, isItemEqualToValue) !== -1 ? initialSelectedValue : null;
3747
- setValue(nextValue, eventDetails);
3726
+ if (findItemIndex(store.context.valuesRef.current, value, isItemEqualToValue) === -1) {
3727
+ const initialSelectedValue = store.context.initialValueRef.current;
3728
+ const nextValue = initialSelectedValue != null && findItemIndex(store.context.valuesRef.current, initialSelectedValue, isItemEqualToValue) !== -1 ? initialSelectedValue : null;
3729
+ store.context.setValue(nextValue, eventDetails);
3748
3730
  if (nextValue === null) {
3749
3731
  store.set("selectedIndex", null);
3750
- selectedItemTextRef.current = null;
3732
+ store.context.selectedItemTextRef.current = null;
3751
3733
  }
3752
3734
  }
3753
3735
  }
3754
3736
  if (prevSize !== 0 && store.state.multiple && Array.isArray(value)) {
3755
- const nextValue = value.filter((selectedItemValue) => findItemIndex(valuesRef.current, selectedItemValue, isItemEqualToValue) !== -1);
3737
+ const nextValue = value.filter((selectedItemValue) => findItemIndex(store.context.valuesRef.current, selectedItemValue, isItemEqualToValue) !== -1);
3756
3738
  if (nextValue.length !== value.length) {
3757
- setValue(nextValue, eventDetails);
3739
+ store.context.setValue(nextValue, eventDetails);
3758
3740
  if (nextValue.length === 0) {
3759
3741
  store.set("selectedIndex", null);
3760
- selectedItemTextRef.current = null;
3742
+ store.context.selectedItemTextRef.current = null;
3761
3743
  }
3762
3744
  }
3763
3745
  }
@@ -3768,7 +3750,7 @@ var SelectPositioner = /* @__PURE__ */ React$1.forwardRef(function SelectPositio
3768
3750
  });
3769
3751
  const stylesToClear = { height: "" };
3770
3752
  clearStyles(positionerElement, stylesToClear);
3771
- clearStyles(popupRef.current, stylesToClear);
3753
+ clearStyles(store.context.popupRef.current, stylesToClear);
3772
3754
  }
3773
3755
  });
3774
3756
  const contextValue = React$1.useMemo(() => ({
@@ -3785,8 +3767,8 @@ var SelectPositioner = /* @__PURE__ */ React$1.forwardRef(function SelectPositio
3785
3767
  setControlledAlignItemWithTrigger
3786
3768
  ]);
3787
3769
  return /* @__PURE__ */ jsx(CompositeList, {
3788
- elementsRef: listRef,
3789
- labelsRef,
3770
+ elementsRef: store.context.listRef,
3771
+ labelsRef: store.context.labelsRef,
3790
3772
  onMapChange,
3791
3773
  children: /* @__PURE__ */ jsxs(SelectPositionerContext.Provider, {
3792
3774
  value: contextValue,
@@ -3815,36 +3797,44 @@ function useToolbarRootContext(optional) {
3815
3797
  if (context === void 0 && !optional) throw new Error(formatErrorMessage(69));
3816
3798
  return context;
3817
3799
  }
3800
+ var CSPContext = /* @__PURE__ */ React$1.createContext(void 0);
3801
+ var DEFAULT_CSP_CONTEXT_VALUE = { disableStyleElements: false };
3802
+ function useCSPContext() {
3803
+ return React$1.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
3804
+ }
3805
+ var transformOrigin = "--transform-origin";
3818
3806
  var stateAttributesMapping = {
3819
3807
  ...popupStateMapping,
3820
3808
  ...transitionStatusMapping
3821
3809
  };
3822
3810
  var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(componentProps, forwardedRef) {
3823
3811
  const { render, className, style, finalFocus, ...elementProps } = componentProps;
3824
- const { store, popupRef, onOpenChangeComplete, setOpen, valueRef, firstItemTextRef, selectedItemTextRef, multiple, handleScrollArrowVisibility, scrollHandlerRef, listRef, highlightItemOnHover, floatingContext: floatingRootContext } = useSelectRootContext();
3812
+ const store = useSelectRootContext();
3813
+ const { multiple, readOnly, highlightItemOnHover } = useSelectRootPropsContext();
3814
+ const floatingRootContext = useSelectFloatingContext();
3825
3815
  const { side, align, alignItemWithTriggerActive, isPositioned, setControlledAlignItemWithTrigger } = useSelectPositionerContext();
3826
3816
  const insideToolbar = useToolbarRootContext(true) != null;
3827
3817
  const direction = useDirection();
3828
3818
  const { nonce, disableStyleElements } = useCSPContext();
3829
- const id = useStore(store, selectors.id);
3830
- const open = useStore(store, selectors.open);
3831
- const openMethod = useStore(store, selectors.openMethod);
3832
- const mounted = useStore(store, selectors.mounted);
3833
- const popupProps = useStore(store, selectors.popupProps);
3834
- const transitionStatus = useStore(store, selectors.transitionStatus);
3835
- const triggerElement = useStore(store, selectors.triggerElement);
3836
- const positionerElement = useStore(store, selectors.positionerElement);
3837
- const listElement = useStore(store, selectors.listElement);
3819
+ const id = store.useState("id");
3820
+ const open = store.useState("open");
3821
+ const openMethod = store.useState("openMethod");
3822
+ const mounted = store.useState("mounted");
3823
+ const popupProps = store.useState("popupProps");
3824
+ const transitionStatus = store.useState("transitionStatus");
3825
+ const triggerElement = store.useState("triggerElement");
3826
+ const positionerElement = store.useState("positionerElement");
3827
+ const listElement = store.useState("listElement");
3838
3828
  const reachedMaxHeightRef = React$1.useRef(false);
3839
3829
  const initialPlacedRef = React$1.useRef(false);
3840
3830
  const originalPositionerStylesRef = React$1.useRef({});
3841
3831
  const scrollArrowFrame = useAnimationFrame();
3842
3832
  const handleScroll = useStableCallback((scroller) => {
3843
- if (!positionerElement || !popupRef.current || !initialPlacedRef.current) return;
3833
+ if (!positionerElement || !store.context.popupRef.current || !initialPlacedRef.current) return;
3844
3834
  const isTopPositioned = positionerElement.style.top === "0px";
3845
3835
  const isBottomPositioned = positionerElement.style.bottom === "0px";
3846
3836
  if (reachedMaxHeightRef.current || !alignItemWithTriggerActive || !isTopPositioned && !isBottomPositioned) {
3847
- handleScrollArrowVisibility(scroller);
3837
+ store.context.handleScrollArrowVisibility(scroller);
3848
3838
  return;
3849
3839
  }
3850
3840
  const scale = getScale(positionerElement);
@@ -3854,7 +3844,7 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
3854
3844
  const positionerStyles = win.getComputedStyle(positionerElement);
3855
3845
  const marginTop = parseFloat(positionerStyles.marginTop);
3856
3846
  const marginBottom = parseFloat(positionerStyles.marginBottom);
3857
- const maxPopupHeight = getMaxPopupHeight(win.getComputedStyle(popupRef.current));
3847
+ const maxPopupHeight = getMaxPopupHeight(win.getComputedStyle(store.context.popupRef.current));
3858
3848
  const maxAvailableHeight = Math.min(doc.documentElement.clientHeight - marginTop - marginBottom, maxPopupHeight);
3859
3849
  const scrollTop = scroller.scrollTop;
3860
3850
  const maxScrollTop = getMaxScrollTop(scroller);
@@ -3869,7 +3859,7 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
3869
3859
  if (heightDelta > 0) setHeight(currentHeight + heightDelta);
3870
3860
  scroller.scrollTop = isTopPositioned ? maxScrollTop : 0;
3871
3861
  if (maxAvailableHeight - (currentHeight + heightDelta) <= 1) reachedMaxHeightRef.current = true;
3872
- handleScrollArrowVisibility(scroller);
3862
+ store.context.handleScrollArrowVisibility(scroller);
3873
3863
  return;
3874
3864
  }
3875
3865
  if (maxAvailableHeight - nextHeight > 1) nextScrollTop = isTopPositioned ? Infinity : 0;
@@ -3881,14 +3871,14 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
3881
3871
  if (Math.abs(scroller.scrollTop - target) > 1) scroller.scrollTop = target;
3882
3872
  }
3883
3873
  if (nextPositionerHeight >= maxAvailableHeight - 1) reachedMaxHeightRef.current = true;
3884
- handleScrollArrowVisibility(scroller);
3874
+ store.context.handleScrollArrowVisibility(scroller);
3885
3875
  });
3886
- React$1.useImperativeHandle(scrollHandlerRef, () => handleScroll, [handleScroll]);
3876
+ React$1.useImperativeHandle(store.context.scrollHandlerRef, () => handleScroll, [handleScroll]);
3887
3877
  useOpenChangeComplete({
3888
3878
  open,
3889
- ref: popupRef,
3879
+ ref: store.context.popupRef,
3890
3880
  onComplete() {
3891
- if (open) onOpenChangeComplete?.(true);
3881
+ if (open) store.context.onOpenChangeComplete(true);
3892
3882
  }
3893
3883
  });
3894
3884
  const state = {
@@ -3898,7 +3888,7 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
3898
3888
  align
3899
3889
  };
3900
3890
  useIsoLayoutEffect(() => {
3901
- if (!positionerElement || !popupRef.current || Object.keys(originalPositionerStylesRef.current).length) return;
3891
+ if (!positionerElement || !store.context.popupRef.current || Object.keys(originalPositionerStylesRef.current).length) return;
3902
3892
  originalPositionerStylesRef.current = {
3903
3893
  top: positionerElement.style.top || "0",
3904
3894
  left: positionerElement.style.left || "0",
@@ -3910,7 +3900,7 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
3910
3900
  marginTop: positionerElement.style.marginTop,
3911
3901
  marginBottom: positionerElement.style.marginBottom
3912
3902
  };
3913
- }, [popupRef, positionerElement]);
3903
+ }, [store, positionerElement]);
3914
3904
  useIsoLayoutEffect(() => {
3915
3905
  if (open || alignItemWithTriggerActive) return;
3916
3906
  initialPlacedRef.current = false;
@@ -3919,23 +3909,22 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
3919
3909
  }, [
3920
3910
  open,
3921
3911
  alignItemWithTriggerActive,
3922
- positionerElement,
3923
- popupRef
3912
+ positionerElement
3924
3913
  ]);
3925
3914
  useIsoLayoutEffect(() => {
3926
- const popupElement = popupRef.current;
3915
+ const popupElement = store.context.popupRef.current;
3927
3916
  if (!open || !triggerElement || !positionerElement || !popupElement || alignItemWithTriggerActive && !isPositioned || store.state.transitionStatus === "ending") return;
3928
3917
  initialPlacedRef.current = true;
3929
- popupElement.style.removeProperty("--transform-origin");
3918
+ popupElement.style.removeProperty(transformOrigin);
3930
3919
  if (!alignItemWithTriggerActive) {
3931
- scrollArrowFrame.request(() => handleScrollArrowVisibility(listElement || popupElement));
3920
+ scrollArrowFrame.request(() => store.context.handleScrollArrowVisibility(listElement || popupElement));
3932
3921
  return;
3933
3922
  }
3934
3923
  const restoreTransformStyles = unsetTransformStyles(popupElement);
3935
3924
  try {
3936
- let textElement = selectedItemTextRef.current;
3937
- if (!textElement?.isConnected) textElement = !selectors.hasSelectedValue(store.state) && firstItemTextRef.current?.isConnected ? firstItemTextRef.current : null;
3938
- const valueElement = valueRef.current;
3925
+ let textElement = store.context.selectedItemTextRef.current;
3926
+ if (!textElement?.isConnected) textElement = !store.select("hasSelectedValue") && store.context.firstItemTextRef.current?.isConnected ? store.context.firstItemTextRef.current : null;
3927
+ const valueElement = store.context.valueRef.current;
3939
3928
  const win = getWindow(positionerElement);
3940
3929
  const positionerStyles = win.getComputedStyle(positionerElement);
3941
3930
  const popupStyles = win.getComputedStyle(popupElement);
@@ -4003,11 +3992,11 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
4003
3992
  const popupHeight = positionerRect.height;
4004
3993
  const textCenterY = textRect.top + textRect.height / 2;
4005
3994
  const clampedY = clamp(popupHeight > 0 ? (textCenterY - popupTop) / popupHeight * 100 : 50, 0, 100);
4006
- popupElement.style.setProperty("--transform-origin", `50% ${clampedY}%`);
3995
+ popupElement.style.setProperty(transformOrigin, `50% ${clampedY}%`);
4007
3996
  }
4008
3997
  if (initialHeight === viewportHeight || height >= maxPopupHeight) reachedMaxHeightRef.current = true;
4009
- handleScrollArrowVisibility(scroller);
4010
- if (highlightItemOnHover && store.state.selectedIndex === null && store.state.activeIndex === null && listRef.current[0] != null) store.set("activeIndex", 0);
3998
+ store.context.handleScrollArrowVisibility(scroller);
3999
+ if (highlightItemOnHover && store.state.selectedIndex === null && store.state.activeIndex === null && store.context.listRef.current[0] != null) store.set("activeIndex", 0);
4011
4000
  } finally {
4012
4001
  restoreTransformStyles();
4013
4002
  }
@@ -4016,16 +4005,10 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
4016
4005
  open,
4017
4006
  positionerElement,
4018
4007
  triggerElement,
4019
- valueRef,
4020
- firstItemTextRef,
4021
- selectedItemTextRef,
4022
- popupRef,
4023
- handleScrollArrowVisibility,
4024
4008
  alignItemWithTriggerActive,
4025
4009
  setControlledAlignItemWithTrigger,
4026
4010
  scrollArrowFrame,
4027
4011
  listElement,
4028
- listRef,
4029
4012
  highlightItemOnHover,
4030
4013
  direction,
4031
4014
  isPositioned
@@ -4034,22 +4017,20 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
4034
4017
  if (!alignItemWithTriggerActive || !positionerElement || !open) return;
4035
4018
  const win = getWindow(positionerElement);
4036
4019
  function handleResize(event) {
4037
- setOpen(false, createChangeEventDetails(windowResize, event));
4020
+ store.context.setOpen(false, createChangeEventDetails(windowResize, event));
4038
4021
  }
4039
4022
  return addEventListener(win, "resize", handleResize);
4040
4023
  }, [
4041
- setOpen,
4024
+ store,
4042
4025
  alignItemWithTriggerActive,
4043
4026
  positionerElement,
4044
4027
  open
4045
4028
  ]);
4046
4029
  const defaultProps = {
4047
- ...listElement ? {
4048
- role: "presentation",
4049
- "aria-orientation": void 0
4050
- } : {
4030
+ ...listElement ? { role: "presentation" } : {
4051
4031
  role: "listbox",
4052
4032
  "aria-multiselectable": multiple || void 0,
4033
+ "aria-readonly": readOnly || void 0,
4053
4034
  id: `${id}-list`
4054
4035
  },
4055
4036
  onKeyDown(event) {
@@ -4063,7 +4044,7 @@ var SelectPopup = /* @__PURE__ */ React$1.forwardRef(function SelectPopup2(compo
4063
4044
  className: !listElement && alignItemWithTriggerActive ? styleDisableScrollbar.className : void 0
4064
4045
  };
4065
4046
  const element = useRenderElement("div", componentProps, {
4066
- ref: [forwardedRef, popupRef],
4047
+ ref: [forwardedRef, store.context.popupRef],
4067
4048
  state,
4068
4049
  stateAttributesMapping,
4069
4050
  props: [
@@ -4126,16 +4107,18 @@ function unsetTransformStyles(popupElement) {
4126
4107
  }
4127
4108
  var SelectList = /* @__PURE__ */ React$1.forwardRef(function SelectList2(componentProps, forwardedRef) {
4128
4109
  const { render, className, style, ...elementProps } = componentProps;
4129
- const { store, scrollHandlerRef, multiple } = useSelectRootContext();
4110
+ const store = useSelectRootContext();
4111
+ const { multiple, readOnly } = useSelectRootPropsContext();
4130
4112
  const { alignItemWithTriggerActive } = useSelectPositionerContext();
4131
- const hasScrollArrows = useStore(store, selectors.hasScrollArrows);
4132
- const openMethod = useStore(store, selectors.openMethod);
4113
+ const hasScrollArrows = store.useState("hasScrollArrows");
4114
+ const openMethod = store.useState("openMethod");
4133
4115
  const defaultProps = {
4134
- id: `${useStore(store, selectors.id)}-list`,
4116
+ id: `${store.useState("id")}-list`,
4135
4117
  role: "listbox",
4136
4118
  "aria-multiselectable": multiple || void 0,
4119
+ "aria-readonly": readOnly || void 0,
4137
4120
  onScroll(event) {
4138
- scrollHandlerRef.current?.(event.currentTarget);
4121
+ store.context.scrollHandlerRef.current?.(event.currentTarget);
4139
4122
  },
4140
4123
  ...alignItemWithTriggerActive && { style: LIST_FUNCTIONAL_STYLES },
4141
4124
  className: hasScrollArrows && openMethod !== "touch" ? styleDisableScrollbar.className : void 0
@@ -4146,6 +4129,50 @@ var SelectList = /* @__PURE__ */ React$1.forwardRef(function SelectList2(compone
4146
4129
  props: [defaultProps, elementProps]
4147
4130
  });
4148
4131
  });
4132
+ function useCompositeListItem(params = {}) {
4133
+ const { guess, label, metadata, textRef, index: externalIndex } = params;
4134
+ const { register, unregister, subscribeMapChange, nextIndexRef } = useCompositeListContext();
4135
+ const indexRef = React$1.useRef(-1);
4136
+ const [internalIndex, setInternalIndex] = React$1.useState(externalIndex == null && guess ? () => {
4137
+ if (indexRef.current === -1) {
4138
+ const newIndex = nextIndexRef.current;
4139
+ nextIndexRef.current += 1;
4140
+ indexRef.current = newIndex;
4141
+ }
4142
+ return indexRef.current;
4143
+ } : -1);
4144
+ const index2 = externalIndex ?? internalIndex;
4145
+ const componentRef = React$1.useRef(null);
4146
+ const ref = React$1.useCallback((node) => {
4147
+ const previousNode = componentRef.current;
4148
+ if (previousNode) unregister(previousNode);
4149
+ componentRef.current = node;
4150
+ if (node) register(node, {
4151
+ metadata: metadata ?? null,
4152
+ index: externalIndex ?? null,
4153
+ label,
4154
+ textRef
4155
+ });
4156
+ }, [
4157
+ externalIndex,
4158
+ register,
4159
+ unregister,
4160
+ metadata,
4161
+ label,
4162
+ textRef
4163
+ ]);
4164
+ useIsoLayoutEffect(() => {
4165
+ if (externalIndex != null) return;
4166
+ return subscribeMapChange((map) => {
4167
+ const i = componentRef.current ? map.get(componentRef.current)?.index : null;
4168
+ if (i != null) setInternalIndex(i);
4169
+ });
4170
+ }, [externalIndex, subscribeMapChange]);
4171
+ return {
4172
+ ref,
4173
+ index: index2
4174
+ };
4175
+ }
4149
4176
  var SelectItemContext = /* @__PURE__ */ React$1.createContext(void 0);
4150
4177
  function useSelectItemContext() {
4151
4178
  const context = React$1.useContext(SelectItemContext);
@@ -4160,17 +4187,18 @@ var SelectItem = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef
4160
4187
  label,
4161
4188
  textRef
4162
4189
  });
4163
- const { store, itemProps, setOpen, setValue, selectionRef, typingRef, valuesRef, multiple, selectedItemTextRef, disabled: selectDisabled, readOnly } = useSelectRootContext();
4190
+ const store = useSelectRootContext();
4191
+ const { itemProps, multiple, disabled: selectDisabled, readOnly } = useSelectRootPropsContext();
4164
4192
  const disabled = selectDisabled || disabledProp;
4165
- const highlighted = useStore(store, selectors.isActive, listItem.index);
4166
- const open = useStore(store, selectors.open);
4167
- const selected = useStore(store, selectors.isSelected, itemValue);
4168
- const selectedByFocus = useStore(store, selectors.isSelectedByFocus, listItem.index);
4169
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
4193
+ const highlighted = store.useState("isActive", listItem.index);
4194
+ const open = store.useState("open");
4195
+ const selected = store.useState("isSelected", itemValue);
4196
+ const selectedByFocus = store.useState("isSelectedByFocus", listItem.index);
4197
+ const isItemEqualToValue = store.useState("isItemEqualToValue");
4170
4198
  const index2 = listItem.index;
4171
4199
  const itemRef = React$1.useRef(null);
4172
4200
  useIsoLayoutEffect(() => {
4173
- const values = valuesRef.current;
4201
+ const values = store.context.valuesRef.current;
4174
4202
  values[index2] = itemValue;
4175
4203
  return () => {
4176
4204
  delete values[index2];
@@ -4178,23 +4206,29 @@ var SelectItem = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef
4178
4206
  }, [
4179
4207
  index2,
4180
4208
  itemValue,
4181
- valuesRef
4209
+ store
4182
4210
  ]);
4183
4211
  useIsoLayoutEffect(() => {
4184
4212
  const selectedValue = store.state.value;
4185
- let selectedCandidate = selectedValue;
4186
- if (multiple && Array.isArray(selectedValue)) selectedCandidate = selectedValue.length > 0 ? selectedValue[selectedValue.length - 1] : void 0;
4187
- if (selectedCandidate !== void 0 && compareItemEquality(itemValue, selectedCandidate, isItemEqualToValue)) {
4188
- store.set("selectedIndex", index2);
4189
- if (textRef.current) selectedItemTextRef.current = textRef.current;
4213
+ const currentIndex = store.state.selectedIndex;
4214
+ let nextIndex = currentIndex;
4215
+ let claims;
4216
+ if (multiple && Array.isArray(selectedValue)) {
4217
+ nextIndex = resolveSelectedIndex(index2, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, currentIndex);
4218
+ claims = nextIndex === index2;
4219
+ if (index2 === currentIndex && !claims) store.context.selectedItemTextRef.current = null;
4220
+ } else {
4221
+ claims = selectedValue !== void 0 && compareItemEquality(itemValue, selectedValue, isItemEqualToValue);
4222
+ if (claims) nextIndex = index2;
4190
4223
  }
4224
+ store.set("selectedIndex", nextIndex);
4225
+ if (claims && textRef.current) store.context.selectedItemTextRef.current = textRef.current;
4191
4226
  }, [
4192
4227
  index2,
4193
4228
  multiple,
4194
4229
  isItemEqualToValue,
4195
4230
  store,
4196
- itemValue,
4197
- selectedItemTextRef
4231
+ itemValue
4198
4232
  ]);
4199
4233
  const pointerTypeRef = React$1.useRef("mouse");
4200
4234
  const allowMouseSelectionRef = React$1.useRef(false);
@@ -4215,14 +4249,14 @@ var SelectItem = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef
4215
4249
  if (multiple) {
4216
4250
  const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
4217
4251
  const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];
4218
- setValue(nextValue, createChangeEventDetails(itemPress, event));
4252
+ store.context.setValue(nextValue, createChangeEventDetails(itemPress, event));
4219
4253
  } else {
4220
- setValue(itemValue, createChangeEventDetails(itemPress, event));
4221
- setOpen(false, createChangeEventDetails(itemPress, event));
4254
+ store.context.setValue(itemValue, createChangeEventDetails(itemPress, event));
4255
+ store.context.setOpen(false, createChangeEventDetails(itemPress, event));
4222
4256
  }
4223
4257
  }
4224
4258
  function resetDragMovement() {
4225
- selectionRef.current.dragY = 0;
4259
+ store.context.selectionRef.current.dragY = 0;
4226
4260
  }
4227
4261
  const defaultProps = {
4228
4262
  role: "option",
@@ -4230,7 +4264,7 @@ var SelectItem = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef
4230
4264
  tabIndex: open && highlighted ? 0 : -1,
4231
4265
  onKeyDown(event) {
4232
4266
  store.set("activeIndex", index2);
4233
- if (event.key === " " && typingRef.current) event.preventDefault();
4267
+ if (event.key === " " && store.context.typingRef.current) event.preventDefault();
4234
4268
  },
4235
4269
  onClick(event) {
4236
4270
  const isMouseClick = pointerTypeRef.current !== "touch";
@@ -4246,7 +4280,7 @@ var SelectItem = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef
4246
4280
  },
4247
4281
  onPointerMove(event) {
4248
4282
  if (event.pointerType === "mouse" && event.buttons === 1) {
4249
- const selection = selectionRef.current;
4283
+ const selection = store.context.selectionRef.current;
4250
4284
  selection.dragY += event.movementY;
4251
4285
  if (selection.dragY ** 2 >= 64) selection.allowUnselectedMouseUp = true;
4252
4286
  }
@@ -4260,8 +4294,8 @@ var SelectItem = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef
4260
4294
  resetDragMovement();
4261
4295
  if (disabled || pointerTypeRef.current === "touch") return;
4262
4296
  if (allowMouseSelectionRef.current) return;
4263
- const disallowSelectedMouseUp = !selectionRef.current.allowSelectedMouseUp && selected;
4264
- const disallowUnselectedMouseUp = !selectionRef.current.allowUnselectedMouseUp && !selected;
4297
+ const disallowSelectedMouseUp = !store.context.selectionRef.current.allowSelectedMouseUp && selected;
4298
+ const disallowUnselectedMouseUp = !store.context.selectionRef.current.allowUnselectedMouseUp && !selected;
4265
4299
  if (disallowSelectedMouseUp || disallowUnselectedMouseUp) return;
4266
4300
  allowMouseSelectionRef.current = true;
4267
4301
  itemRef.current?.click();
@@ -4325,6 +4359,8 @@ var Inner = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef((com
4325
4359
  stateAttributesMapping: transitionStatusMapping
4326
4360
  });
4327
4361
  useOpenChangeComplete({
4362
+ batch: true,
4363
+ enabled: !selected,
4328
4364
  open: selected,
4329
4365
  ref: indicatorRef,
4330
4366
  onComplete() {
@@ -4335,15 +4371,14 @@ var Inner = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef((com
4335
4371
  }));
4336
4372
  var SelectItemText = /* @__PURE__ */ React$1.memo(/* @__PURE__ */ React$1.forwardRef(function SelectItemText2(componentProps, forwardedRef) {
4337
4373
  const { index: index2, textRef, selectedByFocus } = useSelectItemContext();
4338
- const { firstItemTextRef, selectedItemTextRef } = useSelectRootContext();
4374
+ const store = useSelectRootContext();
4339
4375
  const { render, className, style, ...elementProps } = componentProps;
4340
4376
  const localRef = React$1.useCallback((node) => {
4341
4377
  if (!node) return;
4342
- if (index2 === 0) firstItemTextRef.current = node;
4343
- if (selectedByFocus) selectedItemTextRef.current = node;
4378
+ if (index2 === 0) store.context.firstItemTextRef.current = node;
4379
+ if (selectedByFocus) store.context.selectedItemTextRef.current = node;
4344
4380
  }, [
4345
- firstItemTextRef,
4346
- selectedItemTextRef,
4381
+ store,
4347
4382
  index2,
4348
4383
  selectedByFocus
4349
4384
  ]);
@@ -4415,9 +4450,6 @@ function Select({ className, onValueChange, options, placeholder, triggerId, val
4415
4450
  }) })]
4416
4451
  });
4417
4452
  }
4418
- function useRender(params) {
4419
- return useRenderElement(params.defaultTagName ?? "div", params, params);
4420
- }
4421
4453
 
4422
4454
  export {
4423
4455
  clamp,
@@ -4435,16 +4467,14 @@ export {
4435
4467
  useAnchorPositioning,
4436
4468
  getDisabledMountTransitionStyles,
4437
4469
  usePositioner,
4438
- CompositeList,
4439
- useCompositeListItem,
4440
- useCSPContext,
4441
4470
  isElementDisabled,
4442
- useValueChanged,
4443
4471
  useOpenMethodTriggerProps,
4444
4472
  normalizeScrollOffset,
4473
+ CompositeList,
4445
4474
  useAnchoredPopupScrollLock,
4446
4475
  styleDisableScrollbar,
4447
4476
  useToolbarRootContext,
4448
- Select,
4449
- useRender
4477
+ useCSPContext,
4478
+ useCompositeListItem,
4479
+ Select
4450
4480
  };