@qredence/fleet 0.6.1 → 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 (271) hide show
  1. package/CHANGELOG.md +11 -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-DA3Vnqay.js → card-DCEnYd2G.js} +1 -1
  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-B7NNpVmW.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-xNyjdZ4g.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-DxL0VD7Z.js → notify-DjVixft7.js} +1 -1
  45. package/dist/web/client/assets/{openui-renderer-TLNe5e_Q.js → openui-renderer-Bkkx5kmA.js} +37 -37
  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/session-tool-renderer-3E3cv8D0.js +1395 -0
  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-oeLDPDAK.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/server/_tanstack-start-manifest_v-BDPifIFN-DTSNCHBX.js +91 -0
  99. package/dist/web/server/{artifacts-panel-D3ySO--V-XSL53CXL.js → artifacts-panel-BN3DgqfV-N73J6N5Y.js} +39 -44
  100. package/dist/web/server/{chat-command-palette-kAbXhWVg-TJWXH2WW.js → chat-command-palette-G8awyZRw-2QE7FXGT.js} +18 -18
  101. package/dist/web/server/{chunk-SALXCFVO.js → chunk-33QA7BQJ.js} +19 -1
  102. package/dist/web/server/{chunk-5UCAJBAH.js → chunk-43S5N7SH.js} +80 -47
  103. package/dist/web/server/chunk-4EBSM4JR.js +74 -0
  104. package/dist/web/server/{chunk-ZIFSJ3HQ.js → chunk-4OTHKQMG.js} +185 -109
  105. package/dist/web/server/{chunk-NNKJTKOQ.js → chunk-6SOMNRAX.js} +309 -279
  106. package/dist/web/server/chunk-7E76R7MB.js +2138 -0
  107. package/dist/web/server/{chunk-EBG3XFGQ.js → chunk-7FK6YEMA.js} +49 -44
  108. package/dist/web/server/chunk-7HXCGBUP.js +56 -0
  109. package/dist/web/server/{chunk-P66QQWUM.js → chunk-7NZ3FJDA.js} +14 -1
  110. package/dist/web/server/{chunk-HF7DG7PC.js → chunk-7UTDOTOU.js} +80 -78
  111. package/dist/web/server/{chunk-OZO5ARFA.js → chunk-BQROC4PL.js} +11 -2
  112. package/dist/web/server/{chunk-JTCCQZLN.js → chunk-BUXJSBE3.js} +2 -2
  113. package/dist/web/server/{chunk-NIZBFVJF.js → chunk-CAPTFJOC.js} +9 -7
  114. package/dist/web/server/{chunk-YGYOBX7G.js → chunk-CCYLHNZJ.js} +1767 -52
  115. package/dist/web/server/{chunk-DJMHPJBP.js → chunk-CHEC7TWB.js} +3 -1
  116. package/dist/web/server/{chunk-NJ4QEZHK.js → chunk-CW6KZUKT.js} +7 -5
  117. package/dist/web/server/chunk-DLA5TLKX.js +164 -0
  118. package/dist/web/server/{chunk-MNBGB2SP.js → chunk-E5HALE4M.js} +4 -4
  119. package/dist/web/server/{chunk-D27LRYVT.js → chunk-EDAWH2MT.js} +10 -9
  120. package/dist/web/server/{chunk-NGCQJ33Y.js → chunk-ENGEUJIH.js} +1494 -1644
  121. package/dist/web/server/{chunk-RIP3PBWT.js → chunk-ESM7OCRL.js} +4 -4
  122. package/dist/web/server/{chunk-O3HDELZ2.js → chunk-FT74GAAH.js} +676 -670
  123. package/dist/web/server/{chunk-WNCAL4HN.js → chunk-HQ5TEXHT.js} +132 -152
  124. package/dist/web/server/{chunk-YOM42BKD.js → chunk-IPV4GLJL.js} +16 -16
  125. package/dist/web/server/{chunk-UL2725KQ.js → chunk-IXGLKAPN.js} +54 -46
  126. package/dist/web/server/{chunk-3TIMGWWI.js → chunk-JPDRUSUD.js} +2 -2
  127. package/dist/web/server/{chunk-4WBFCB4O.js → chunk-JVOW2NWC.js} +179 -177
  128. package/dist/web/server/chunk-K6PTNSCW.js +31 -0
  129. package/dist/web/server/{chunk-AR7O7JXD.js → chunk-KBWUBWVJ.js} +24 -1
  130. package/dist/web/server/{chunk-QIULBRTU.js → chunk-MJXXVQNA.js} +79 -84
  131. package/dist/web/server/{chunk-NWDI3OWB.js → chunk-NCK2FJAD.js} +30 -26
  132. package/dist/web/server/{chunk-QFRCJWQQ.js → chunk-NMBH57JT.js} +94 -33
  133. package/dist/web/server/{chunk-EAJTWMK5.js → chunk-NZ6KQT2X.js} +2 -2
  134. package/dist/web/server/{chunk-2DDWXTVG.js → chunk-O2UYZT3Z.js} +11 -11
  135. package/dist/web/server/{chunk-DLUZFOG3.js → chunk-OMEDERPG.js} +21 -25
  136. package/dist/web/server/{chunk-BLSX7WHW.js → chunk-OSMP55KI.js} +23 -2
  137. package/dist/web/server/{chunk-S3PQ6HKH.js → chunk-OVJYUWSQ.js} +2 -2
  138. package/dist/web/server/{chunk-UCUFC553.js → chunk-RXUMFFUV.js} +3 -3
  139. package/dist/web/server/{chunk-DO2O27B2.js → chunk-SDV3P3IW.js} +2 -2
  140. package/dist/web/server/chunk-TLNZNR7C.js +46 -0
  141. package/dist/web/server/{chunk-FYDQK6UX.js → chunk-UDD5W4CR.js} +32 -10
  142. package/dist/web/server/{chunk-MNPHMZU7.js → chunk-UE32PAV2.js} +47 -57
  143. package/dist/web/server/{chunk-KP2PNDGL.js → chunk-WB2LJC3R.js} +29 -32
  144. package/dist/web/server/{chunk-ETTDO4UO.js → chunk-WTYNN6EV.js} +1 -26
  145. package/dist/web/server/{chunk-EJEPDVK6.js → chunk-WU6X3GPJ.js} +48 -5
  146. package/dist/web/server/{chunk-XIB6XNUX.js → chunk-XJ6TGSUB.js} +425 -404
  147. package/dist/web/server/{chunk-PLYZ7P2Y.js → chunk-YMPJMHXZ.js} +41 -4
  148. package/dist/web/server/{chunk-GETSIVNU.js → chunk-YVGCPUAW.js} +7 -7
  149. package/dist/web/server/{chunk-4UBOIY2S.js → chunk-ZNFXBGLK.js} +1 -1
  150. package/dist/web/server/chunk-ZOVXMNJM.js +477 -0
  151. package/dist/web/server/{fork-picker-dialog-Ds6Tgtu3-DIBWN7MV.js → fork-picker-dialog-YKlapaxN-DR5L74ST.js} +9 -8
  152. package/dist/web/server/{markdown-DTnMbD87-FXGGAPJD.js → markdown-BzNejPoZ-6ITTDAV6.js} +2 -3
  153. package/dist/web/server/{markdown-code-BStjFfsy-SSLWUT4S.js → markdown-code-DAwXuW6m-HHVELO6I.js} +3 -4
  154. package/dist/web/server/{fleet-message-queue-D_w8lSeY-T3HB7HVQ.js → message-queue-Demph1x4-RBJUC3AT.js} +14 -10
  155. package/dist/web/server/{model-selector-list-DxeGZoD2-P6S6FSJH.js → model-selector-list-BmzLiCx9-TK6JGGKU.js} +20 -19
  156. package/dist/web/server/{openui-renderer-MKFv6LlH-MDRSVFEY.js → openui-renderer-moJGf0LA-QCU3PI6H.js} +17 -18
  157. package/dist/web/server/{prompt-suggestions-BOItmGnD-YQA7RHLG.js → prompt-suggestions-yPZqX__K-3VGJC4IF.js} +7 -6
  158. package/dist/web/server/{repl-panel-CuyF8wt5-CHDT2Q3N.js → repl-panel-CgUF1qUw-3DFD2V53.js} +10 -11
  159. package/dist/web/server/{resources-panel-CE5pD4vy-V5FXBTYC.js → resources-panel-ChUliWV--JITAGS6Q.js} +6 -7
  160. package/dist/web/server/{router-Dg72SESP-PCWKLFRG.js → router-CPdFlpbe-LAD4MNZB.js} +3111 -235
  161. package/dist/web/server/{routes-BGrVtPYF-SURPAJN6.js → routes-hkom6S6L-DUPPQHPY.js} +5045 -4285
  162. package/dist/web/server/server.js +2 -2
  163. package/dist/web/server/{session-insights-panel-CUhdgvRt-VB2HUCQP.js → session-insights-panel-xgrkX1Rp-FDNURBXZ.js} +9 -9
  164. package/dist/web/server/{fleet-reasoning-panel-DG_vuvv0-NCZWEEIT.js → session-reasoning-panel-m1RgcIph-NUXGXVKE.js} +21 -22
  165. package/dist/web/server/session-tool-renderer-CglQ2ky7-2JVYNZG2.js +45 -0
  166. package/dist/web/server/{settings-dialog-CK0FJlTg-HZRBAXDZ.js → settings-dialog-BCEfmgtP-T3WQEZHB.js} +175 -1373
  167. package/dist/web/server/{subagent-chat-panel-gzamnTgK-PQ2TLLJF.js → subagent-chat-panel-BTwI1kdB-LKBWA4GD.js} +32 -41
  168. package/dist/web/server/{subagents-panel-Berjd7HJ-EI5ZKC6V.js → subagents-panel-8Z9_csoV-HYMEEBHB.js} +37 -45
  169. package/dist/web/server/{fleet-tool-timeline-D6yM4ZMz-ZSFVRRRI.js → tool-timeline-QL9k5dzA-RLU26HXT.js} +6 -6
  170. package/dist/web/server/{workspace-panel-CBBa_3UO-B4PPFPMA.js → workspace-panel-BHEB9nRM-TS62SYBA.js} +24 -31
  171. package/package.json +1 -1
  172. package/dist/web/client/assets/action-swap-roll-COzQ86wm.js +0 -1
  173. package/dist/web/client/assets/agent-activity-svETLf_5.js +0 -1
  174. package/dist/web/client/assets/agent-disclosure-DAMuuGcM.js +0 -1
  175. package/dist/web/client/assets/analytics-stub-B6zGMuSV.js +0 -1
  176. package/dist/web/client/assets/artifacts-panel-HVjqBMyx.js +0 -1
  177. package/dist/web/client/assets/artifacts-utils-N_kUFbz2.js +0 -1
  178. package/dist/web/client/assets/bundle-mjs-DKHVkVWu.js +0 -1
  179. package/dist/web/client/assets/button-C5wFDY5_.js +0 -1
  180. package/dist/web/client/assets/chat-BhYseKd6.js +0 -52
  181. package/dist/web/client/assets/chat-command-palette-LILDO_vG.js +0 -1
  182. package/dist/web/client/assets/check-JjHKAZas.js +0 -1
  183. package/dist/web/client/assets/chevron-right-DrJxToLs.js +0 -1
  184. package/dist/web/client/assets/chevron-up-CnSvySGH.js +0 -1
  185. package/dist/web/client/assets/circle-alert-CONlFReH.js +0 -1
  186. package/dist/web/client/assets/circle-x-CkKCB__4.js +0 -1
  187. package/dist/web/client/assets/citations-BPv8HIpf.js +0 -2
  188. package/dist/web/client/assets/cn-C8c0S2mI.js +0 -1
  189. package/dist/web/client/assets/collapsible-BoXtZZWN.js +0 -1
  190. package/dist/web/client/assets/command-PhicLCoO.js +0 -1
  191. package/dist/web/client/assets/createBaseUIEventDetails-DV0dQrBX.js +0 -1
  192. package/dist/web/client/assets/createLucideIcon-DwxZHm0M.js +0 -1
  193. package/dist/web/client/assets/dialog-pBGUjAQ7.js +0 -1
  194. package/dist/web/client/assets/dist-BPaFisIZ.js +0 -41
  195. package/dist/web/client/assets/earth-DGZXAN5r.js +0 -1
  196. package/dist/web/client/assets/ease-u56MhKYS.js +0 -1
  197. package/dist/web/client/assets/file-text-T-NcAlZs.js +0 -1
  198. package/dist/web/client/assets/fleet-message-queue-fbYYwMj0.js +0 -1
  199. package/dist/web/client/assets/fleet-pi-tool-renderer-BRgNnmaJ.js +0 -1395
  200. package/dist/web/client/assets/fleet-reasoning-panel-CjA2dwUJ.js +0 -1
  201. package/dist/web/client/assets/fleet-subagent-list-iKUtLJKZ.js +0 -1
  202. package/dist/web/client/assets/fleet-tool-timeline-C8heL7ae.js +0 -1
  203. package/dist/web/client/assets/gauge-DNpstbBn.js +0 -1
  204. package/dist/web/client/assets/globals-CuIiqOTg.css +0 -2
  205. package/dist/web/client/assets/highlighted-body-KPVGNVTW-sUCZ1fHv.js +0 -1
  206. package/dist/web/client/assets/horizontal-resize-Cp3iHMH7.js +0 -1
  207. package/dist/web/client/assets/image-BbPmlw-n.js +0 -1
  208. package/dist/web/client/assets/index-CSGplyr_.js +0 -12
  209. package/dist/web/client/assets/input-PcdubeKn.js +0 -1
  210. package/dist/web/client/assets/input-group-C2HJEZvl.js +0 -1
  211. package/dist/web/client/assets/ipython-tool-CyuMOxz1.js +0 -3
  212. package/dist/web/client/assets/layout-gyLzPvVv.js +0 -1
  213. package/dist/web/client/assets/markdown-lvexwooo.js +0 -2
  214. package/dist/web/client/assets/mermaid-HWGCJPDP-Bm7CuruA.js +0 -1
  215. package/dist/web/client/assets/message-square-hbDao-A1.js +0 -1
  216. package/dist/web/client/assets/model-selector-list-CoXX358G.js +0 -1
  217. package/dist/web/client/assets/plus-DXN1Bg_z.js +0 -1
  218. package/dist/web/client/assets/prompt-input-fwP8TsgQ.js +0 -1
  219. package/dist/web/client/assets/prompt-suggestions-BlGXmWS7.js +0 -1
  220. package/dist/web/client/assets/provider-catalog-DYMFdbKc.js +0 -1
  221. package/dist/web/client/assets/provider-label-B4q5mI65.js +0 -1
  222. package/dist/web/client/assets/react-dom-Bwxum3ti.js +0 -1
  223. package/dist/web/client/assets/repl-panel-C5om8MGU.js +0 -1
  224. package/dist/web/client/assets/resources-panel-D867-goy.js +0 -1
  225. package/dist/web/client/assets/right-panel-context-DHlNWJsF.js +0 -1
  226. package/dist/web/client/assets/right-panel-registry-BBlxLxnx.js +0 -2
  227. package/dist/web/client/assets/routes-XGsAIqBJ.js +0 -16
  228. package/dist/web/client/assets/safe-external-url-D3PJJIcM.js +0 -1
  229. package/dist/web/client/assets/search-eWVnAJsb.js +0 -1
  230. package/dist/web/client/assets/session-insights-panel-YnaXvTpi.js +0 -1
  231. package/dist/web/client/assets/settings-dialog-BSBasR3o.js +0 -2
  232. package/dist/web/client/assets/skeleton-loaders-C9vHwAYV.js +0 -1
  233. package/dist/web/client/assets/sparkles-DuclzqlE.js +0 -1
  234. package/dist/web/client/assets/square-Bhn8gjr0.js +0 -1
  235. package/dist/web/client/assets/subagent-transcript-DaVHjNUH.js +0 -1
  236. package/dist/web/client/assets/subagent-utils-DDH5qm9Z.js +0 -1
  237. package/dist/web/client/assets/subagents-panel-D_aVgSCi.js +0 -1
  238. package/dist/web/client/assets/surfaces-BhAXz9So.js +0 -1
  239. package/dist/web/client/assets/switch-WhXeJNNY.js +0 -1
  240. package/dist/web/client/assets/terminal-DOS1s1gm.js +0 -1
  241. package/dist/web/client/assets/toast-D3c9XeGe.js +0 -1
  242. package/dist/web/client/assets/tool-result-Cki8WUNc.js +0 -4
  243. package/dist/web/client/assets/ui-preferences-CImQGZm_.js +0 -1
  244. package/dist/web/client/assets/use-reduced-motion-eORd7fqW.js +0 -9
  245. package/dist/web/client/assets/useBaseUiId-CHqXB2UQ.js +0 -1
  246. package/dist/web/client/assets/useControlled-CJJ9BOQB.js +0 -1
  247. package/dist/web/client/assets/utils-Eg7xtNmV.js +0 -1
  248. package/dist/web/client/assets/virtualized-turn-list-CdMa-ydT.js +0 -6
  249. package/dist/web/client/assets/workspace-panel-77bDbprs.js +0 -1
  250. package/dist/web/client/assets/workspace-path-nav-C0AQNZyy.js +0 -1
  251. package/dist/web/client/assets/x-CsRC_tCI.js +0 -1
  252. package/dist/web/server/_tanstack-start-manifest_v-0L7fqnH4-KMVGUFE4.js +0 -95
  253. package/dist/web/server/agent-activity-BuEE6iVw-CDZLK4D2.js +0 -514
  254. package/dist/web/server/chunk-2JHTYWD5.js +0 -1196
  255. package/dist/web/server/chunk-3JMESBAT.js +0 -35
  256. package/dist/web/server/chunk-42XU6WV7.js +0 -56
  257. package/dist/web/server/chunk-AQ66E5OW.js +0 -33
  258. package/dist/web/server/chunk-BYXBJQAS.js +0 -0
  259. package/dist/web/server/chunk-FAGDMGLK.js +0 -6589
  260. package/dist/web/server/chunk-FJV6EQDW.js +0 -36
  261. package/dist/web/server/chunk-GL6HWDJB.js +0 -19
  262. package/dist/web/server/chunk-L46H6IDX.js +0 -13
  263. package/dist/web/server/chunk-NIDBN7BQ.js +0 -86
  264. package/dist/web/server/chunk-ON33WDZX.js +0 -31
  265. package/dist/web/server/chunk-PVJCTQFK.js +0 -22
  266. package/dist/web/server/chunk-QPNUGF3V.js +0 -35
  267. package/dist/web/server/chunk-S5LFXXDY.js +0 -1265
  268. package/dist/web/server/chunk-VPKX7QRU.js +0 -42
  269. package/dist/web/server/chunk-ZCVWADNW.js +0 -37
  270. package/dist/web/server/fleet-pi-tool-renderer-qwc-qZFq-4U556N5Q.js +0 -51
  271. package/dist/web/server/fleet-subagent-list-BGb0PjhF-2X67FMUV.js +0 -18
@@ -1,3 +1,6 @@
1
+ import {
2
+ isModelPatternEnabled
3
+ } from "./chunk-WTYNN6EV.js";
1
4
  import {
2
5
  ChatMcpDeleteRequestSchema,
3
6
  ChatMcpOAuthLoginRequestSchema,
@@ -8,22 +11,48 @@ import {
8
11
  ChatProviderUpdateRequestSchema,
9
12
  ChatSettingsUpdateRequestSchema,
10
13
  FLEET_ADAPTER_CAPABILITIES,
11
- LazyMotion,
14
+ HTMLVisualElement,
15
+ MotionConfig,
12
16
  NETWORK_DISCONNECTED_MESSAGE,
13
17
  QueryClient,
14
18
  QueryClientProvider,
15
- domAnimation,
19
+ SVGVisualElement,
20
+ addValueToWillChange,
21
+ animateMotionValue,
22
+ animateSingleValue,
23
+ animateTarget,
24
+ applyBoxDelta,
25
+ applyTreeDeltas,
26
+ circOut,
27
+ convertBoundingBoxToBox,
28
+ convertBoxToBoundingBox,
29
+ getOptimisedAppearId,
30
+ getValueTransition,
31
+ has2DTranslate,
32
+ hasScale,
33
+ hasTransform,
16
34
  initAnalytics,
17
- isServer
18
- } from "./chunk-YGYOBX7G.js";
35
+ isKeyframesTarget,
36
+ isSVGElement,
37
+ isSVGSVGElement,
38
+ isServer,
39
+ measurePageBox,
40
+ pipe,
41
+ progress,
42
+ resolveElements,
43
+ resolveVariant,
44
+ scalePoint,
45
+ transformBox,
46
+ translateAxis
47
+ } from "./chunk-CCYLHNZJ.js";
19
48
  import {
20
49
  DEFAULT_UI_PREFERENCES,
21
- isModelPatternEnabled,
50
+ applyUiPreferencesToDocument,
22
51
  readUiPreferences
23
- } from "./chunk-ETTDO4UO.js";
52
+ } from "./chunk-4EBSM4JR.js";
24
53
  import {
25
54
  Toaster
26
- } from "./chunk-UL2725KQ.js";
55
+ } from "./chunk-IXGLKAPN.js";
27
56
  import {
28
57
  fallbackSessionLabel,
29
58
  meaningfulSessionLabel,
@@ -32,9 +61,44 @@ import {
32
61
  import "./chunk-SZJUXVWG.js";
33
62
  import "./chunk-TNL4YV63.js";
34
63
  import {
35
- drag,
36
- layout
37
- } from "./chunk-FAGDMGLK.js";
64
+ isHTMLElement,
65
+ usePresence
66
+ } from "./chunk-K6PTNSCW.js";
67
+ import {
68
+ LayoutGroupContext,
69
+ LazyContext,
70
+ SubscriptionManager,
71
+ SwitchLayoutGroupContext,
72
+ addUniqueItem,
73
+ cancelFrame,
74
+ clamp,
75
+ cornerRadiusProps,
76
+ createBox,
77
+ createDelta,
78
+ frame,
79
+ frameData,
80
+ frameSteps,
81
+ invariant,
82
+ isAnimationControls,
83
+ isRefObject,
84
+ isSVGComponent,
85
+ isVariantLabel,
86
+ loadFeatures,
87
+ microtask,
88
+ millisecondsToSeconds,
89
+ mixNumber,
90
+ motionValue,
91
+ noop,
92
+ percent,
93
+ px,
94
+ removeItem,
95
+ resolveMotionValue,
96
+ scaleCorrectors,
97
+ secondsToMilliseconds,
98
+ time,
99
+ variantPriorityOrder,
100
+ variantProps
101
+ } from "./chunk-7E76R7MB.js";
38
102
  import {
39
103
  Card,
40
104
  CardContent,
@@ -42,7 +106,7 @@ import {
42
106
  CardHeader,
43
107
  CardTitle,
44
108
  validateAndNormalizeOpenUIHtmlArtifact
45
- } from "./chunk-3TIMGWWI.js";
109
+ } from "./chunk-JPDRUSUD.js";
46
110
  import {
47
111
  ChatNewRequestSchema,
48
112
  ChatOpenUIArtifactUpsertRequestSchema,
@@ -62,7 +126,7 @@ import {
62
126
  UploadedAttachmentSchema,
63
127
  ZodError,
64
128
  external_exports
65
- } from "./chunk-PLYZ7P2Y.js";
129
+ } from "./chunk-YMPJMHXZ.js";
66
130
  import {
67
131
  KNOWN_PROVIDERS,
68
132
  OPENAI_CHAT_COMPLETIONS_PROVIDER_ID,
@@ -77,12 +141,13 @@ import {
77
141
  toInstanceSlug,
78
142
  toOccInstanceId
79
143
  } from "./chunk-RJOANOT4.js";
80
- import "./chunk-WNCAL4HN.js";
144
+ import "./chunk-HQ5TEXHT.js";
145
+ import "./chunk-TLNZNR7C.js";
81
146
  import "./chunk-JBLHIEVG.js";
82
- import "./chunk-XIB6XNUX.js";
147
+ import "./chunk-XJ6TGSUB.js";
83
148
  import "./chunk-HFQZLPU2.js";
84
149
  import "./chunk-4ZIEVI5O.js";
85
- import "./chunk-DJMHPJBP.js";
150
+ import "./chunk-CHEC7TWB.js";
86
151
  import {
87
152
  HeadContent,
88
153
  Outlet,
@@ -96,8 +161,8 @@ import "./chunk-JDCCC7A7.js";
96
161
  import "./chunk-L547YHC4.js";
97
162
  import "./chunk-MLKGABMK.js";
98
163
 
99
- // web/app/dist/server/assets/router-Dg72SESP.js
100
- import { useEffect, useLayoutEffect } from "react";
164
+ // web/app/dist/server/assets/router-CPdFlpbe.js
165
+ import { Component, Fragment, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
101
166
  import { jsx, jsxs } from "react/jsx-runtime";
102
167
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
103
168
  import { fileURLToPath } from "node:url";
@@ -107,8 +172,2868 @@ import { AuthStorage, DAEMON_PROTOCOL_NAME, DAEMON_PROTOCOL_VERSION, DaemonAgent
107
172
  import { spawn } from "node:child_process";
108
173
  import { homedir } from "node:os";
109
174
  import { getProviders, getSupportedThinkingLevels } from "@earendil-works/pi-ai";
175
+ function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) {
176
+ const index = Array.from(children).sort((a, b) => a.sortNodePosition(b)).indexOf(child);
177
+ const numChildren = children.size;
178
+ const maxStaggerDuration = (numChildren - 1) * staggerChildren;
179
+ return typeof delayChildren === "function" ? delayChildren(index, numChildren) : staggerDirection === 1 ? index * staggerChildren : maxStaggerDuration - index * staggerChildren;
180
+ }
181
+ function animateVariant(visualElement, variant, options = {}) {
182
+ const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? visualElement.presenceContext?.custom : void 0);
183
+ let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
184
+ if (options.transitionOverride) transition = options.transitionOverride;
185
+ const getAnimation = resolved ? () => Promise.all(animateTarget(visualElement, resolved, options)) : () => Promise.resolve();
186
+ const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size ? (forwardDelay = 0) => {
187
+ const { delayChildren = 0, staggerChildren, staggerDirection } = transition;
188
+ return animateChildren(visualElement, variant, forwardDelay, delayChildren, staggerChildren, staggerDirection, options);
189
+ } : () => Promise.resolve();
190
+ const { when } = transition;
191
+ if (when) {
192
+ const [first, last] = when === "beforeChildren" ? [getAnimation, getChildAnimations] : [getChildAnimations, getAnimation];
193
+ return first().then(() => last());
194
+ } else return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
195
+ }
196
+ function animateChildren(visualElement, variant, delay2 = 0, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
197
+ const animations2 = [];
198
+ for (const child of visualElement.variantChildren) {
199
+ child.notify("AnimationStart", variant);
200
+ animations2.push(animateVariant(child, variant, {
201
+ ...options,
202
+ delay: delay2 + (typeof delayChildren === "function" ? 0 : delayChildren) + calcChildStagger(visualElement.variantChildren, child, delayChildren, staggerChildren, staggerDirection)
203
+ }).then(() => child.notify("AnimationComplete", variant)));
204
+ }
205
+ return Promise.all(animations2);
206
+ }
207
+ function animateVisualElement(visualElement, definition, options = {}) {
208
+ visualElement.notify("AnimationStart", definition);
209
+ let animation;
210
+ if (Array.isArray(definition)) {
211
+ const animations2 = definition.map((variant) => animateVariant(visualElement, variant, options));
212
+ animation = Promise.all(animations2);
213
+ } else if (typeof definition === "string") animation = animateVariant(visualElement, definition, options);
214
+ else {
215
+ const resolvedDefinition = typeof definition === "function" ? resolveVariant(visualElement, definition, options.custom) : definition;
216
+ animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
217
+ }
218
+ return animation.then(() => {
219
+ visualElement.notify("AnimationComplete", definition);
220
+ });
221
+ }
222
+ var isDragging = {
223
+ x: false,
224
+ y: false
225
+ };
226
+ function isDragActive() {
227
+ return isDragging.x || isDragging.y;
228
+ }
229
+ function setDragLock(axis) {
230
+ if (axis === "x" || axis === "y") {
231
+ if (isDragging[axis]) return null;
232
+ else {
233
+ isDragging[axis] = true;
234
+ return () => {
235
+ isDragging[axis] = false;
236
+ };
237
+ }
238
+ } else if (isDragging.x || isDragging.y) return null;
239
+ else {
240
+ isDragging.x = isDragging.y = true;
241
+ return () => {
242
+ isDragging.x = isDragging.y = false;
243
+ };
244
+ }
245
+ }
246
+ function setupGesture(elementOrSelector, options) {
247
+ const elements = resolveElements(elementOrSelector);
248
+ const gestureAbortController = new AbortController();
249
+ const eventOptions = {
250
+ passive: true,
251
+ ...options,
252
+ signal: gestureAbortController.signal
253
+ };
254
+ const cancel = () => gestureAbortController.abort();
255
+ return [
256
+ elements,
257
+ eventOptions,
258
+ cancel
259
+ ];
260
+ }
261
+ function isValidHover(event) {
262
+ return !(event.pointerType === "touch" || isDragActive());
263
+ }
264
+ function hover(elementOrSelector, onHoverStart, options = {}) {
265
+ const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);
266
+ elements.forEach((element) => {
267
+ let isPressed = false;
268
+ let deferredHoverEnd = false;
269
+ let hoverEndCallback;
270
+ const removePointerLeave = () => {
271
+ element.removeEventListener("pointerleave", onPointerLeave);
272
+ };
273
+ const endHover = (event) => {
274
+ if (hoverEndCallback) {
275
+ hoverEndCallback(event);
276
+ hoverEndCallback = void 0;
277
+ }
278
+ removePointerLeave();
279
+ };
280
+ const onPointerUp = (event) => {
281
+ isPressed = false;
282
+ window.removeEventListener("pointerup", onPointerUp);
283
+ window.removeEventListener("pointercancel", onPointerUp);
284
+ if (deferredHoverEnd) {
285
+ deferredHoverEnd = false;
286
+ endHover(event);
287
+ }
288
+ };
289
+ const onPointerDown = () => {
290
+ isPressed = true;
291
+ window.addEventListener("pointerup", onPointerUp, eventOptions);
292
+ window.addEventListener("pointercancel", onPointerUp, eventOptions);
293
+ };
294
+ const onPointerLeave = (leaveEvent) => {
295
+ if (leaveEvent.pointerType === "touch") return;
296
+ if (isPressed) {
297
+ deferredHoverEnd = true;
298
+ return;
299
+ }
300
+ endHover(leaveEvent);
301
+ };
302
+ const onPointerEnter = (enterEvent) => {
303
+ if (!isValidHover(enterEvent)) return;
304
+ deferredHoverEnd = false;
305
+ const onHoverEnd = onHoverStart(element, enterEvent);
306
+ if (typeof onHoverEnd !== "function") return;
307
+ hoverEndCallback = onHoverEnd;
308
+ element.addEventListener("pointerleave", onPointerLeave, eventOptions);
309
+ };
310
+ element.addEventListener("pointerenter", onPointerEnter, eventOptions);
311
+ element.addEventListener("pointerdown", onPointerDown, eventOptions);
312
+ });
313
+ return cancel;
314
+ }
315
+ var isNodeOrChild = (parent, child) => {
316
+ if (!child) return false;
317
+ else if (parent === child) return true;
318
+ else return isNodeOrChild(parent, child.parentElement);
319
+ };
320
+ var isPrimaryPointer = (event) => {
321
+ if (event.pointerType === "mouse") return typeof event.button !== "number" || event.button <= 0;
322
+ else
323
+ return event.isPrimary !== false;
324
+ };
325
+ var keyboardAccessibleElements = /* @__PURE__ */ new Set([
326
+ "BUTTON",
327
+ "INPUT",
328
+ "SELECT",
329
+ "TEXTAREA",
330
+ "A"
331
+ ]);
332
+ function isElementKeyboardAccessible(element) {
333
+ return keyboardAccessibleElements.has(element.tagName) || element.isContentEditable === true;
334
+ }
335
+ var textInputElements = /* @__PURE__ */ new Set([
336
+ "INPUT",
337
+ "SELECT",
338
+ "TEXTAREA"
339
+ ]);
340
+ function isElementTextInput(element) {
341
+ return textInputElements.has(element.tagName) || element.isContentEditable === true;
342
+ }
343
+ var isPressing = /* @__PURE__ */ new WeakSet();
344
+ function filterEvents(callback) {
345
+ return (event) => {
346
+ if (event.key !== "Enter") return;
347
+ callback(event);
348
+ };
349
+ }
350
+ function firePointerEvent(target, type) {
351
+ target.dispatchEvent(new PointerEvent("pointer" + type, {
352
+ isPrimary: true,
353
+ bubbles: true
354
+ }));
355
+ }
356
+ var enableKeyboardPress = (focusEvent, eventOptions) => {
357
+ const element = focusEvent.currentTarget;
358
+ if (!element) return;
359
+ const handleKeydown = filterEvents(() => {
360
+ if (isPressing.has(element)) return;
361
+ firePointerEvent(element, "down");
362
+ const handleKeyup = filterEvents(() => {
363
+ firePointerEvent(element, "up");
364
+ });
365
+ const handleBlur = () => firePointerEvent(element, "cancel");
366
+ element.addEventListener("keyup", handleKeyup, eventOptions);
367
+ element.addEventListener("blur", handleBlur, eventOptions);
368
+ });
369
+ element.addEventListener("keydown", handleKeydown, eventOptions);
370
+ element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions);
371
+ };
372
+ function isValidPressEvent(event) {
373
+ return isPrimaryPointer(event) && !isDragActive();
374
+ }
375
+ var claimedPointerDownEvents = /* @__PURE__ */ new WeakSet();
376
+ function press(targetOrSelector, onPressStart, options = {}) {
377
+ const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);
378
+ const startPress = (startEvent) => {
379
+ const target = startEvent.currentTarget;
380
+ if (!isValidPressEvent(startEvent)) return;
381
+ if (claimedPointerDownEvents.has(startEvent)) return;
382
+ isPressing.add(target);
383
+ if (options.stopPropagation) claimedPointerDownEvents.add(startEvent);
384
+ const onPressEnd = onPressStart(target, startEvent);
385
+ const endEventOptions = {
386
+ ...eventOptions,
387
+ capture: true
388
+ };
389
+ const onPointerEnd = (endEvent, success) => {
390
+ window.removeEventListener("pointerup", onPointerUp, endEventOptions);
391
+ window.removeEventListener("pointercancel", onPointerCancel, endEventOptions);
392
+ if (isPressing.has(target)) isPressing.delete(target);
393
+ if (!isValidPressEvent(endEvent)) return;
394
+ if (typeof onPressEnd === "function") onPressEnd(endEvent, { success });
395
+ };
396
+ const onPointerUp = (upEvent) => {
397
+ onPointerEnd(upEvent, target === window || target === document || options.useGlobalTarget || isNodeOrChild(target, upEvent.target));
398
+ };
399
+ const onPointerCancel = (cancelEvent) => {
400
+ onPointerEnd(cancelEvent, false);
401
+ };
402
+ window.addEventListener("pointerup", onPointerUp, endEventOptions);
403
+ window.addEventListener("pointercancel", onPointerCancel, endEventOptions);
404
+ };
405
+ targets.forEach((target) => {
406
+ (options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions);
407
+ if (isHTMLElement(target)) {
408
+ target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
409
+ if (!isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex")) target.tabIndex = 0;
410
+ }
411
+ });
412
+ return cancelEvents;
413
+ }
414
+ var resizeHandlers = /* @__PURE__ */ new WeakMap();
415
+ var observer;
416
+ var getSize = (borderBoxAxis, svgAxis, htmlAxis) => (target, borderBoxSize) => {
417
+ if (borderBoxSize && borderBoxSize[0]) return borderBoxSize[0][borderBoxAxis + "Size"];
418
+ else if (isSVGElement(target) && "getBBox" in target) return target.getBBox()[svgAxis];
419
+ else return target[htmlAxis];
420
+ };
421
+ var getWidth = /* @__PURE__ */ getSize("inline", "width", "offsetWidth");
422
+ var getHeight = /* @__PURE__ */ getSize("block", "height", "offsetHeight");
423
+ function notifyTarget({ target, borderBoxSize }) {
424
+ resizeHandlers.get(target)?.forEach((handler) => {
425
+ handler(target, {
426
+ get width() {
427
+ return getWidth(target, borderBoxSize);
428
+ },
429
+ get height() {
430
+ return getHeight(target, borderBoxSize);
431
+ }
432
+ });
433
+ });
434
+ }
435
+ function notifyAll(entries) {
436
+ entries.forEach(notifyTarget);
437
+ }
438
+ function createResizeObserver() {
439
+ if (typeof ResizeObserver === "undefined") return;
440
+ observer = new ResizeObserver(notifyAll);
441
+ }
442
+ function resizeElement(target, handler) {
443
+ if (!observer) createResizeObserver();
444
+ const elements = resolveElements(target);
445
+ elements.forEach((element) => {
446
+ let elementHandlers = resizeHandlers.get(element);
447
+ if (!elementHandlers) {
448
+ elementHandlers = /* @__PURE__ */ new Set();
449
+ resizeHandlers.set(element, elementHandlers);
450
+ }
451
+ elementHandlers.add(handler);
452
+ observer?.observe(element);
453
+ });
454
+ return () => {
455
+ elements.forEach((element) => {
456
+ const elementHandlers = resizeHandlers.get(element);
457
+ elementHandlers?.delete(handler);
458
+ if (!elementHandlers?.size) observer?.unobserve(element);
459
+ });
460
+ };
461
+ }
462
+ var windowCallbacks = /* @__PURE__ */ new Set();
463
+ var windowResizeHandler;
464
+ function createWindowResizeHandler() {
465
+ windowResizeHandler = () => {
466
+ const info = {
467
+ get width() {
468
+ return window.innerWidth;
469
+ },
470
+ get height() {
471
+ return window.innerHeight;
472
+ }
473
+ };
474
+ windowCallbacks.forEach((callback) => callback(info));
475
+ };
476
+ window.addEventListener("resize", windowResizeHandler);
477
+ }
478
+ function resizeWindow(callback) {
479
+ windowCallbacks.add(callback);
480
+ if (!windowResizeHandler) createWindowResizeHandler();
481
+ return () => {
482
+ windowCallbacks.delete(callback);
483
+ if (!windowCallbacks.size && typeof windowResizeHandler === "function") {
484
+ window.removeEventListener("resize", windowResizeHandler);
485
+ windowResizeHandler = void 0;
486
+ }
487
+ };
488
+ }
489
+ function resize(a, b) {
490
+ return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b);
491
+ }
492
+ var statsBuffer = {
493
+ value: null,
494
+ addProjectionMetrics: null
495
+ };
496
+ var Feature = class {
497
+ constructor(node) {
498
+ this.isMounted = false;
499
+ this.node = node;
500
+ }
501
+ update() {
502
+ }
503
+ };
504
+ var numVariantProps = variantProps.length;
505
+ function getVariantContext(visualElement) {
506
+ if (!visualElement) return void 0;
507
+ if (!visualElement.isControllingVariants) {
508
+ const context2 = visualElement.parent ? getVariantContext(visualElement.parent) || {} : {};
509
+ if (visualElement.props.initial !== void 0) context2.initial = visualElement.props.initial;
510
+ return context2;
511
+ }
512
+ const context = {};
513
+ for (let i = 0; i < numVariantProps; i++) {
514
+ const name = variantProps[i];
515
+ const prop = visualElement.props[name];
516
+ if (isVariantLabel(prop) || prop === false) context[name] = prop;
517
+ }
518
+ return context;
519
+ }
520
+ function shallowCompare(next, prev) {
521
+ if (!Array.isArray(prev)) return false;
522
+ const prevLength = prev.length;
523
+ if (prevLength !== next.length) return false;
524
+ for (let i = 0; i < prevLength; i++) if (prev[i] !== next[i]) return false;
525
+ return true;
526
+ }
527
+ var reversePriorityOrder = [...variantPriorityOrder].reverse();
528
+ var numAnimationTypes = variantPriorityOrder.length;
529
+ function createAnimateFunction(visualElement) {
530
+ return (animations2) => {
531
+ return Promise.all(animations2.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
532
+ };
533
+ }
534
+ function createAnimationState(visualElement) {
535
+ let animate = createAnimateFunction(visualElement);
536
+ let state = createState$1();
537
+ let isInitialRender = true;
538
+ let wasReset = false;
539
+ const buildResolvedTypeValues = (type) => (acc, definition) => {
540
+ const resolved = resolveVariant(visualElement, definition, type === "exit" ? visualElement.presenceContext?.custom : void 0);
541
+ if (resolved) {
542
+ const { transition, transitionEnd, ...target } = resolved;
543
+ acc = {
544
+ ...acc,
545
+ ...target,
546
+ ...transitionEnd
547
+ };
548
+ }
549
+ return acc;
550
+ };
551
+ function setAnimateFunction(makeAnimator) {
552
+ animate = makeAnimator(visualElement);
553
+ }
554
+ function animateChanges(changedActiveType) {
555
+ const { props } = visualElement;
556
+ const context = getVariantContext(visualElement.parent) || {};
557
+ const animations2 = [];
558
+ const removedKeys = /* @__PURE__ */ new Set();
559
+ let encounteredKeys = {};
560
+ let removedVariantIndex = Infinity;
561
+ for (let i = 0; i < numAnimationTypes; i++) {
562
+ const type = reversePriorityOrder[i];
563
+ const typeState = state[type];
564
+ const prop = props[type] !== void 0 ? props[type] : context[type];
565
+ const propIsVariant = isVariantLabel(prop);
566
+ const activeDelta = type === changedActiveType ? typeState.isActive : null;
567
+ if (activeDelta === false) removedVariantIndex = i;
568
+ let isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
569
+ if (isInherited && (isInitialRender || wasReset) && visualElement.manuallyAnimateOnMount) isInherited = false;
570
+ typeState.protectedKeys = { ...encounteredKeys };
571
+ if (!typeState.isActive && activeDelta === null || !prop && !typeState.prevProp || isAnimationControls(prop) || typeof prop === "boolean") continue;
572
+ if (type === "exit" && typeState.isActive && activeDelta !== true) {
573
+ if (typeState.prevResolvedValues) encounteredKeys = {
574
+ ...encounteredKeys,
575
+ ...typeState.prevResolvedValues
576
+ };
577
+ continue;
578
+ }
579
+ const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
580
+ let shouldAnimateType = variantDidChange || type === changedActiveType && typeState.isActive && !isInherited && propIsVariant || i > removedVariantIndex && propIsVariant;
581
+ let handledRemovedValues = false;
582
+ const definitionList = Array.isArray(prop) ? prop : [prop];
583
+ let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
584
+ if (activeDelta === false) resolvedValues = {};
585
+ const { prevResolvedValues = {} } = typeState;
586
+ const allKeys = {
587
+ ...prevResolvedValues,
588
+ ...resolvedValues
589
+ };
590
+ const markToAnimate = (key) => {
591
+ shouldAnimateType = true;
592
+ if (removedKeys.has(key)) {
593
+ handledRemovedValues = true;
594
+ removedKeys.delete(key);
595
+ }
596
+ typeState.needsAnimating[key] = true;
597
+ const motionValue2 = visualElement.getValue(key);
598
+ if (motionValue2) motionValue2.liveStyle = false;
599
+ };
600
+ for (const key in allKeys) {
601
+ const next = resolvedValues[key];
602
+ const prev = prevResolvedValues[key];
603
+ if (encounteredKeys.hasOwnProperty(key)) continue;
604
+ let valueHasChanged = false;
605
+ if (isKeyframesTarget(next) && isKeyframesTarget(prev)) valueHasChanged = !shallowCompare(next, prev) || variantDidChange;
606
+ else valueHasChanged = next !== prev;
607
+ if (valueHasChanged) {
608
+ if (next !== void 0 && next !== null) markToAnimate(key);
609
+ else removedKeys.add(key);
610
+ } else if (next !== void 0 && removedKeys.has(key))
611
+ markToAnimate(key);
612
+ else
613
+ typeState.protectedKeys[key] = true;
614
+ }
615
+ typeState.prevProp = prop;
616
+ typeState.prevResolvedValues = resolvedValues;
617
+ if (typeState.isActive) encounteredKeys = {
618
+ ...encounteredKeys,
619
+ ...resolvedValues
620
+ };
621
+ if ((isInitialRender || wasReset) && visualElement.blockInitialAnimation) shouldAnimateType = false;
622
+ const willAnimateViaParent = isInherited && variantDidChange;
623
+ if (shouldAnimateType && (!willAnimateViaParent || handledRemovedValues)) animations2.push(...definitionList.map((animation) => {
624
+ const options = { type };
625
+ if (typeof animation === "string" && (isInitialRender || wasReset) && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
626
+ const { parent } = visualElement;
627
+ const parentVariant = resolveVariant(parent, animation);
628
+ if (parent.enteringChildren && parentVariant) {
629
+ const { delayChildren } = parentVariant.transition || {};
630
+ options.delay = calcChildStagger(parent.enteringChildren, visualElement, delayChildren);
631
+ }
632
+ }
633
+ return {
634
+ animation,
635
+ options
636
+ };
637
+ }));
638
+ }
639
+ if (removedKeys.size) {
640
+ const fallbackAnimation = {};
641
+ if (typeof props.initial !== "boolean") {
642
+ const initialTransition = resolveVariant(visualElement, Array.isArray(props.initial) ? props.initial[0] : props.initial);
643
+ if (initialTransition && initialTransition.transition) fallbackAnimation.transition = initialTransition.transition;
644
+ }
645
+ removedKeys.forEach((key) => {
646
+ const fallbackTarget = visualElement.getBaseTarget(key);
647
+ const motionValue2 = visualElement.getValue(key);
648
+ if (motionValue2) motionValue2.liveStyle = true;
649
+ fallbackAnimation[key] = fallbackTarget ?? null;
650
+ });
651
+ animations2.push({ animation: fallbackAnimation });
652
+ }
653
+ let shouldAnimate = Boolean(animations2.length);
654
+ if (isInitialRender && (props.initial === false || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount) shouldAnimate = false;
655
+ isInitialRender = false;
656
+ wasReset = false;
657
+ return shouldAnimate ? animate(animations2) : Promise.resolve();
658
+ }
659
+ function setActive(type, isActive) {
660
+ if (state[type].isActive === isActive) return Promise.resolve();
661
+ visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));
662
+ state[type].isActive = isActive;
663
+ const animations2 = animateChanges(type);
664
+ for (const key in state) state[key].protectedKeys = {};
665
+ return animations2;
666
+ }
667
+ return {
668
+ animateChanges,
669
+ setActive,
670
+ setAnimateFunction,
671
+ getState: () => state,
672
+ reset: () => {
673
+ state = createState$1();
674
+ wasReset = true;
675
+ }
676
+ };
677
+ }
678
+ function checkVariantsDidChange(prev, next) {
679
+ if (typeof next === "string") return next !== prev;
680
+ else if (Array.isArray(next)) return !shallowCompare(next, prev);
681
+ return false;
682
+ }
683
+ function createTypeState(isActive = false) {
684
+ return {
685
+ isActive,
686
+ protectedKeys: {},
687
+ needsAnimating: {},
688
+ prevResolvedValues: {}
689
+ };
690
+ }
691
+ function createState$1() {
692
+ return {
693
+ animate: createTypeState(true),
694
+ whileInView: createTypeState(),
695
+ whileHover: createTypeState(),
696
+ whileTap: createTypeState(),
697
+ whileDrag: createTypeState(),
698
+ whileFocus: createTypeState(),
699
+ exit: createTypeState()
700
+ };
701
+ }
702
+ function copyAxisInto(axis, originAxis) {
703
+ axis.min = originAxis.min;
704
+ axis.max = originAxis.max;
705
+ }
706
+ function copyBoxInto(box, originBox) {
707
+ copyAxisInto(box.x, originBox.x);
708
+ copyAxisInto(box.y, originBox.y);
709
+ }
710
+ function copyAxisDeltaInto(delta, originDelta) {
711
+ delta.translate = originDelta.translate;
712
+ delta.scale = originDelta.scale;
713
+ delta.originPoint = originDelta.originPoint;
714
+ delta.origin = originDelta.origin;
715
+ }
716
+ var SCALE_MIN = 0.9999;
717
+ var SCALE_MAX = 1.0001;
718
+ var TRANSLATE_MIN = -0.01;
719
+ var TRANSLATE_MAX = 0.01;
720
+ function calcLength(axis) {
721
+ return axis.max - axis.min;
722
+ }
723
+ function isNear(value, target, maxDistance) {
724
+ return Math.abs(value - target) <= maxDistance;
725
+ }
726
+ function calcAxisDelta(delta, source, target, origin = 0.5) {
727
+ delta.origin = origin;
728
+ delta.originPoint = mixNumber(source.min, source.max, delta.origin);
729
+ delta.scale = calcLength(target) / calcLength(source);
730
+ delta.translate = mixNumber(target.min, target.max, delta.origin) - delta.originPoint;
731
+ if (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX || isNaN(delta.scale)) delta.scale = 1;
732
+ if (delta.translate >= TRANSLATE_MIN && delta.translate <= TRANSLATE_MAX || isNaN(delta.translate)) delta.translate = 0;
733
+ }
734
+ function calcBoxDelta(delta, source, target, origin) {
735
+ calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : void 0);
736
+ calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : void 0);
737
+ }
738
+ function calcRelativeAxis(target, relative2, parent, anchor = 0) {
739
+ target.min = (anchor ? mixNumber(parent.min, parent.max, anchor) : parent.min) + relative2.min;
740
+ target.max = target.min + calcLength(relative2);
741
+ }
742
+ function calcRelativeBox(target, relative2, parent, anchor) {
743
+ calcRelativeAxis(target.x, relative2.x, parent.x, anchor?.x);
744
+ calcRelativeAxis(target.y, relative2.y, parent.y, anchor?.y);
745
+ }
746
+ function calcRelativeAxisPosition(target, layout2, parent, anchor = 0) {
747
+ const anchorPoint = anchor ? mixNumber(parent.min, parent.max, anchor) : parent.min;
748
+ target.min = layout2.min - anchorPoint;
749
+ target.max = target.min + calcLength(layout2);
750
+ }
751
+ function calcRelativePosition(target, layout2, parent, anchor) {
752
+ calcRelativeAxisPosition(target.x, layout2.x, parent.x, anchor?.x);
753
+ calcRelativeAxisPosition(target.y, layout2.y, parent.y, anchor?.y);
754
+ }
755
+ function removePointDelta(point, translate, scale, originPoint, boxScale) {
756
+ point -= translate;
757
+ point = scalePoint(point, 1 / scale, originPoint);
758
+ if (boxScale !== void 0) point = scalePoint(point, 1 / boxScale, originPoint);
759
+ return point;
760
+ }
761
+ function removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {
762
+ if (percent.test(translate)) {
763
+ translate = parseFloat(translate);
764
+ translate = mixNumber(sourceAxis.min, sourceAxis.max, translate / 100) - sourceAxis.min;
765
+ }
766
+ if (typeof translate !== "number") return;
767
+ let originPoint = mixNumber(originAxis.min, originAxis.max, origin);
768
+ if (axis === originAxis) originPoint -= translate;
769
+ axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
770
+ axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
771
+ }
772
+ function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) {
773
+ removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);
774
+ }
775
+ var xKeys = [
776
+ "x",
777
+ "scaleX",
778
+ "originX"
779
+ ];
780
+ var yKeys = [
781
+ "y",
782
+ "scaleY",
783
+ "originY"
784
+ ];
785
+ function removeBoxTransforms(box, transforms, originBox, sourceBox) {
786
+ removeAxisTransforms(box.x, transforms, xKeys, originBox ? originBox.x : void 0, sourceBox ? sourceBox.x : void 0);
787
+ removeAxisTransforms(box.y, transforms, yKeys, originBox ? originBox.y : void 0, sourceBox ? sourceBox.y : void 0);
788
+ }
789
+ function isAxisDeltaZero(delta) {
790
+ return delta.translate === 0 && delta.scale === 1;
791
+ }
792
+ function isDeltaZero(delta) {
793
+ return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
794
+ }
795
+ function axisEquals(a, b) {
796
+ return a.min === b.min && a.max === b.max;
797
+ }
798
+ function boxEquals(a, b) {
799
+ return axisEquals(a.x, b.x) && axisEquals(a.y, b.y);
800
+ }
801
+ function axisEqualsRounded(a, b) {
802
+ return Math.round(a.min) === Math.round(b.min) && Math.round(a.max) === Math.round(b.max);
803
+ }
804
+ function boxEqualsRounded(a, b) {
805
+ return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y);
806
+ }
807
+ function aspectRatio(box) {
808
+ return calcLength(box.x) / calcLength(box.y);
809
+ }
810
+ function axisDeltaEquals(a, b) {
811
+ return a.translate === b.translate && a.scale === b.scale && a.originPoint === b.originPoint;
812
+ }
813
+ function eachAxis(callback) {
814
+ return [callback("x"), callback("y")];
815
+ }
816
+ function buildProjectionTransform(delta, treeScale, latestTransform) {
817
+ let transform = "";
818
+ const xTranslate = delta.x.translate / treeScale.x;
819
+ const yTranslate = delta.y.translate / treeScale.y;
820
+ const zTranslate = latestTransform?.z || 0;
821
+ if (xTranslate || yTranslate || zTranslate) transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
822
+ if (treeScale.x !== 1 || treeScale.y !== 1) transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
823
+ if (latestTransform) {
824
+ const { transformPerspective, rotate, pathRotation, rotateX, rotateY, skewX, skewY } = latestTransform;
825
+ if (transformPerspective) transform = `perspective(${transformPerspective}px) ${transform}`;
826
+ if (rotate) transform += `rotate(${rotate}deg) `;
827
+ if (pathRotation) transform += `rotate(${pathRotation}deg) `;
828
+ if (rotateX) transform += `rotateX(${rotateX}deg) `;
829
+ if (rotateY) transform += `rotateY(${rotateY}deg) `;
830
+ if (skewX) transform += `skewX(${skewX}deg) `;
831
+ if (skewY) transform += `skewY(${skewY}deg) `;
832
+ }
833
+ const elementScaleX = delta.x.scale * treeScale.x;
834
+ const elementScaleY = delta.y.scale * treeScale.y;
835
+ if (elementScaleX !== 1 || elementScaleY !== 1) transform += `scale(${elementScaleX}, ${elementScaleY})`;
836
+ return transform || "none";
837
+ }
838
+ var numBorders = cornerRadiusProps.length;
839
+ var asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
840
+ var isPx = (value) => typeof value === "number" || px.test(value);
841
+ function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOnlyMember) {
842
+ if (shouldCrossfadeOpacity) {
843
+ target.opacity = mixNumber(0, lead.opacity ?? 1, easeCrossfadeIn(progress2));
844
+ target.opacityExit = mixNumber(follow.opacity ?? 1, 0, easeCrossfadeOut(progress2));
845
+ } else if (isOnlyMember) target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress2);
846
+ for (let i = 0; i < numBorders; i++) {
847
+ const borderLabel = cornerRadiusProps[i];
848
+ let followRadius = getRadius(follow, borderLabel);
849
+ let leadRadius = getRadius(lead, borderLabel);
850
+ if (followRadius === void 0 && leadRadius === void 0) continue;
851
+ followRadius || (followRadius = 0);
852
+ leadRadius || (leadRadius = 0);
853
+ if (followRadius === 0 || leadRadius === 0 || isPx(followRadius) === isPx(leadRadius)) {
854
+ target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress2), 0);
855
+ if (percent.test(leadRadius) || percent.test(followRadius)) target[borderLabel] += "%";
856
+ } else target[borderLabel] = leadRadius;
857
+ }
858
+ if (follow.rotate || lead.rotate) target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress2);
859
+ }
860
+ function getRadius(values, radiusName) {
861
+ return values[radiusName] !== void 0 ? values[radiusName] : values.borderRadius;
862
+ }
863
+ var easeCrossfadeIn = /* @__PURE__ */ compress(0, 0.5, circOut);
864
+ var easeCrossfadeOut = /* @__PURE__ */ compress(0.5, 0.95, noop);
865
+ function compress(min, max, easing) {
866
+ return (p) => {
867
+ if (p < min) return 0;
868
+ if (p > max) return 1;
869
+ return easing(progress(min, max, p));
870
+ };
871
+ }
872
+ function addDomEvent(target, eventName, handler, options = { passive: true }) {
873
+ target.addEventListener(eventName, handler, options);
874
+ return () => target.removeEventListener(eventName, handler, options);
875
+ }
876
+ var compareByDepth = (a, b) => a.depth - b.depth;
877
+ var FlatTree = class {
878
+ constructor() {
879
+ this.children = [];
880
+ this.isDirty = false;
881
+ }
882
+ add(child) {
883
+ addUniqueItem(this.children, child);
884
+ this.isDirty = true;
885
+ }
886
+ remove(child) {
887
+ removeItem(this.children, child);
888
+ this.isDirty = true;
889
+ }
890
+ forEach(callback) {
891
+ this.isDirty && this.children.sort(compareByDepth);
892
+ this.isDirty = false;
893
+ this.children.forEach(callback);
894
+ }
895
+ };
896
+ function delay$1(callback, timeout) {
897
+ const start = time.now();
898
+ const checkElapsed = ({ timestamp }) => {
899
+ const elapsed = timestamp - start;
900
+ if (elapsed >= timeout) {
901
+ cancelFrame(checkElapsed);
902
+ callback(elapsed - timeout);
903
+ }
904
+ };
905
+ frame.setup(checkElapsed, true);
906
+ return () => cancelFrame(checkElapsed);
907
+ }
908
+ var NodeStack = class {
909
+ constructor() {
910
+ this.members = [];
911
+ }
912
+ add(node) {
913
+ addUniqueItem(this.members, node);
914
+ for (let i = this.members.length - 1; i >= 0; i--) {
915
+ const member = this.members[i];
916
+ if (member === node || member === this.lead || member === this.prevLead) continue;
917
+ const inst = member.instance;
918
+ if ((!inst || inst.isConnected === false) && !member.snapshot) {
919
+ removeItem(this.members, member);
920
+ member.unmount();
921
+ }
922
+ }
923
+ node.scheduleRender();
924
+ }
925
+ remove(node) {
926
+ removeItem(this.members, node);
927
+ if (node === this.prevLead) this.prevLead = void 0;
928
+ if (node === this.lead) {
929
+ const prevLead = this.members[this.members.length - 1];
930
+ if (prevLead) this.promote(prevLead);
931
+ }
932
+ }
933
+ relegate(node) {
934
+ for (let i = this.members.indexOf(node) - 1; i >= 0; i--) {
935
+ const member = this.members[i];
936
+ if (member.isPresent !== false && member.instance?.isConnected !== false) {
937
+ this.promote(member);
938
+ return true;
939
+ }
940
+ }
941
+ return false;
942
+ }
943
+ promote(node, preserveFollowOpacity) {
944
+ const prevLead = this.lead;
945
+ if (node === prevLead) return;
946
+ this.prevLead = prevLead;
947
+ this.lead = node;
948
+ node.show();
949
+ if (prevLead) {
950
+ prevLead.updateSnapshot();
951
+ node.scheduleRender();
952
+ const { layoutDependency: prevDep } = prevLead.options;
953
+ const { layoutDependency: nextDep } = node.options;
954
+ if (prevDep === void 0 || prevDep !== nextDep) {
955
+ node.resumeFrom = prevLead;
956
+ if (preserveFollowOpacity) prevLead.preserveOpacity = true;
957
+ if (prevLead.snapshot) {
958
+ node.snapshot = prevLead.snapshot;
959
+ node.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues;
960
+ }
961
+ if (node.root?.isUpdating) node.isLayoutDirty = true;
962
+ }
963
+ if (node.options.crossfade === false) prevLead.hide();
964
+ }
965
+ }
966
+ exitAnimationComplete() {
967
+ this.members.forEach((member) => {
968
+ member.options.onExitComplete?.();
969
+ member.resumingFrom?.options.onExitComplete?.();
970
+ });
971
+ }
972
+ scheduleRender() {
973
+ this.members.forEach((member) => member.instance && member.scheduleRender(false));
974
+ }
975
+ removeLeadSnapshot() {
976
+ if (this.lead?.snapshot) this.lead.snapshot = void 0;
977
+ }
978
+ };
979
+ var globalProjectionState = {
980
+ /**
981
+ * Global flag as to whether the tree has animated since the last time
982
+ * we resized the window
983
+ */
984
+ hasAnimatedSinceResize: true,
985
+ /**
986
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
987
+ * update will be given a `data-projection-id` attribute.
988
+ */
989
+ hasEverUpdated: false
990
+ };
991
+ var metrics = {
992
+ nodes: 0,
993
+ calculatedTargetDeltas: 0,
994
+ calculatedProjections: 0
995
+ };
996
+ var transformAxes = [
997
+ "",
998
+ "X",
999
+ "Y",
1000
+ "Z"
1001
+ ];
1002
+ var animationTarget = 1e3;
1003
+ var id$1 = 0;
1004
+ function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
1005
+ const { latestValues } = visualElement;
1006
+ if (latestValues[key]) {
1007
+ values[key] = latestValues[key];
1008
+ visualElement.setStaticValue(key, 0);
1009
+ if (sharedAnimationValues) sharedAnimationValues[key] = 0;
1010
+ }
1011
+ }
1012
+ function cancelTreeOptimisedTransformAnimations(projectionNode) {
1013
+ projectionNode.hasCheckedOptimisedAppear = true;
1014
+ if (projectionNode.root === projectionNode) return;
1015
+ const { visualElement } = projectionNode.options;
1016
+ if (!visualElement) return;
1017
+ const appearId = getOptimisedAppearId(visualElement);
1018
+ if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
1019
+ const { layout: layout2, layoutId } = projectionNode.options;
1020
+ window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout2 || layoutId));
1021
+ }
1022
+ const { parent } = projectionNode;
1023
+ if (parent && !parent.hasCheckedOptimisedAppear) cancelTreeOptimisedTransformAnimations(parent);
1024
+ }
1025
+ function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform }) {
1026
+ return class ProjectionNode {
1027
+ constructor(latestValues = {}, parent = defaultParent?.()) {
1028
+ this.id = id$1++;
1029
+ this.animationId = 0;
1030
+ this.animationCommitId = 0;
1031
+ this.children = /* @__PURE__ */ new Set();
1032
+ this.options = {};
1033
+ this.isTreeAnimating = false;
1034
+ this.isAnimationBlocked = false;
1035
+ this.isLayoutDirty = false;
1036
+ this.isProjectionDirty = false;
1037
+ this.isSharedProjectionDirty = false;
1038
+ this.isTransformDirty = false;
1039
+ this.updateManuallyBlocked = false;
1040
+ this.updateBlockedByResize = false;
1041
+ this.isUpdating = false;
1042
+ this.isSVG = false;
1043
+ this.needsReset = false;
1044
+ this.shouldResetTransform = false;
1045
+ this.hasCheckedOptimisedAppear = false;
1046
+ this.treeScale = {
1047
+ x: 1,
1048
+ y: 1
1049
+ };
1050
+ this.eventHandlers = /* @__PURE__ */ new Map();
1051
+ this.hasTreeAnimated = false;
1052
+ this.layoutVersion = 0;
1053
+ this.updateScheduled = false;
1054
+ this.scheduleUpdate = () => this.update();
1055
+ this.projectionUpdateScheduled = false;
1056
+ this.checkUpdateFailed = () => {
1057
+ if (this.isUpdating) {
1058
+ this.isUpdating = false;
1059
+ this.clearAllSnapshots();
1060
+ }
1061
+ };
1062
+ this.updateProjection = () => {
1063
+ this.projectionUpdateScheduled = false;
1064
+ if (statsBuffer.value) metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0;
1065
+ this.nodes.forEach(propagateDirtyNodes);
1066
+ this.nodes.forEach(resolveTargetDelta);
1067
+ this.nodes.forEach(calcProjection);
1068
+ this.nodes.forEach(cleanDirtyNodes);
1069
+ if (statsBuffer.addProjectionMetrics) statsBuffer.addProjectionMetrics(metrics);
1070
+ };
1071
+ this.resolvedRelativeTargetAt = 0;
1072
+ this.linkedParentVersion = 0;
1073
+ this.hasProjected = false;
1074
+ this.isVisible = true;
1075
+ this.animationProgress = 0;
1076
+ this.sharedNodes = /* @__PURE__ */ new Map();
1077
+ this.latestValues = latestValues;
1078
+ this.root = parent ? parent.root || parent : this;
1079
+ this.path = parent ? [...parent.path, parent] : [];
1080
+ this.parent = parent;
1081
+ this.depth = parent ? parent.depth + 1 : 0;
1082
+ for (let i = 0; i < this.path.length; i++) this.path[i].shouldResetTransform = true;
1083
+ if (this.root === this) this.nodes = new FlatTree();
1084
+ }
1085
+ addEventListener(name, handler) {
1086
+ if (!this.eventHandlers.has(name)) this.eventHandlers.set(name, new SubscriptionManager());
1087
+ return this.eventHandlers.get(name).add(handler);
1088
+ }
1089
+ notifyListeners(name, ...args) {
1090
+ const subscriptionManager = this.eventHandlers.get(name);
1091
+ subscriptionManager && subscriptionManager.notify(...args);
1092
+ }
1093
+ hasListeners(name) {
1094
+ return this.eventHandlers.has(name);
1095
+ }
1096
+ /**
1097
+ * Lifecycles
1098
+ */
1099
+ mount(instance) {
1100
+ if (this.instance) return;
1101
+ this.isSVG = isSVGElement(instance) && !isSVGSVGElement(instance);
1102
+ this.instance = instance;
1103
+ const { layoutId, layout: layout2, visualElement } = this.options;
1104
+ if (visualElement && !visualElement.current) visualElement.mount(instance);
1105
+ this.root.nodes.add(this);
1106
+ this.parent && this.parent.children.add(this);
1107
+ if (this.root.hasTreeAnimated && (layout2 || layoutId)) this.isLayoutDirty = true;
1108
+ if (attachResizeListener) {
1109
+ let cancelDelay;
1110
+ let innerWidth = 0;
1111
+ const resizeUnblockUpdate = () => this.root.updateBlockedByResize = false;
1112
+ frame.read(() => {
1113
+ innerWidth = window.innerWidth;
1114
+ });
1115
+ attachResizeListener(instance, () => {
1116
+ const newInnerWidth = window.innerWidth;
1117
+ if (newInnerWidth === innerWidth) return;
1118
+ innerWidth = newInnerWidth;
1119
+ this.root.updateBlockedByResize = true;
1120
+ cancelDelay && cancelDelay();
1121
+ cancelDelay = delay$1(resizeUnblockUpdate, 250);
1122
+ if (globalProjectionState.hasAnimatedSinceResize) {
1123
+ globalProjectionState.hasAnimatedSinceResize = false;
1124
+ this.nodes.forEach(finishAnimation);
1125
+ }
1126
+ });
1127
+ }
1128
+ if (layoutId) this.root.registerSharedNode(layoutId, this);
1129
+ if (this.options.animate !== false && visualElement && (layoutId || layout2)) this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeLayoutChanged, layout: newLayout }) => {
1130
+ if (this.isTreeAnimationBlocked()) {
1131
+ this.target = void 0;
1132
+ this.relativeTarget = void 0;
1133
+ return;
1134
+ }
1135
+ const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition;
1136
+ const { onLayoutAnimationStart, onLayoutAnimationComplete } = visualElement.getProps();
1137
+ const hasTargetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout);
1138
+ const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeLayoutChanged;
1139
+ if (this.options.layoutRoot || this.resumeFrom || hasOnlyRelativeTargetChanged || hasLayoutChanged && (hasTargetChanged || !this.currentAnimation)) {
1140
+ if (this.resumeFrom) {
1141
+ this.resumingFrom = this.resumeFrom;
1142
+ this.resumingFrom.resumingFrom = void 0;
1143
+ }
1144
+ const animationOptions = {
1145
+ ...getValueTransition(layoutTransition, "layout"),
1146
+ onPlay: onLayoutAnimationStart,
1147
+ onComplete: onLayoutAnimationComplete
1148
+ };
1149
+ if (visualElement.shouldReduceMotion || this.options.layoutRoot) {
1150
+ animationOptions.delay = 0;
1151
+ animationOptions.type = false;
1152
+ }
1153
+ this.startAnimation(animationOptions);
1154
+ this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged, animationOptions.path);
1155
+ } else {
1156
+ if (!hasLayoutChanged) finishAnimation(this);
1157
+ if (this.isLead() && this.options.onExitComplete) this.options.onExitComplete();
1158
+ }
1159
+ this.targetLayout = newLayout;
1160
+ });
1161
+ }
1162
+ unmount() {
1163
+ this.options.layoutId && this.willUpdate();
1164
+ this.root.nodes.remove(this);
1165
+ const stack = this.getStack();
1166
+ stack && stack.remove(this);
1167
+ this.parent && this.parent.children.delete(this);
1168
+ this.instance = void 0;
1169
+ this.eventHandlers.clear();
1170
+ cancelFrame(this.updateProjection);
1171
+ }
1172
+ blockUpdate() {
1173
+ this.updateManuallyBlocked = true;
1174
+ }
1175
+ unblockUpdate() {
1176
+ this.updateManuallyBlocked = false;
1177
+ }
1178
+ isUpdateBlocked() {
1179
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
1180
+ }
1181
+ isTreeAnimationBlocked() {
1182
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || false;
1183
+ }
1184
+ startUpdate() {
1185
+ if (this.isUpdateBlocked()) return;
1186
+ this.isUpdating = true;
1187
+ this.nodes && this.nodes.forEach(resetSkewAndRotation);
1188
+ this.animationId++;
1189
+ }
1190
+ getTransformTemplate() {
1191
+ const { visualElement } = this.options;
1192
+ return visualElement && visualElement.getProps().transformTemplate;
1193
+ }
1194
+ willUpdate(shouldNotifyListeners = true) {
1195
+ this.root.hasTreeAnimated = true;
1196
+ if (this.root.isUpdateBlocked()) {
1197
+ this.options.onExitComplete && this.options.onExitComplete();
1198
+ return;
1199
+ }
1200
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear) cancelTreeOptimisedTransformAnimations(this);
1201
+ !this.root.isUpdating && this.root.startUpdate();
1202
+ if (this.isLayoutDirty) return;
1203
+ this.isLayoutDirty = true;
1204
+ for (let i = 0; i < this.path.length; i++) {
1205
+ const node = this.path[i];
1206
+ node.shouldResetTransform = true;
1207
+ if (typeof node.latestValues.x === "string" || typeof node.latestValues.y === "string") node.isLayoutDirty = true;
1208
+ node.updateScroll("snapshot");
1209
+ if (node.options.layoutRoot) node.willUpdate(false);
1210
+ }
1211
+ const { layoutId, layout: layout2 } = this.options;
1212
+ if (layoutId === void 0 && !layout2) return;
1213
+ const transformTemplate = this.getTransformTemplate();
1214
+ this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
1215
+ this.updateSnapshot();
1216
+ shouldNotifyListeners && this.notifyListeners("willUpdate");
1217
+ }
1218
+ update() {
1219
+ this.updateScheduled = false;
1220
+ if (this.isUpdateBlocked()) {
1221
+ const wasBlockedByResize = this.updateBlockedByResize;
1222
+ this.unblockUpdate();
1223
+ this.updateBlockedByResize = false;
1224
+ this.clearAllSnapshots();
1225
+ if (wasBlockedByResize) this.nodes.forEach(forceLayoutMeasure);
1226
+ this.nodes.forEach(clearMeasurements);
1227
+ return;
1228
+ }
1229
+ if (this.animationId <= this.animationCommitId) {
1230
+ this.nodes.forEach(clearIsLayoutDirty);
1231
+ return;
1232
+ }
1233
+ this.animationCommitId = this.animationId;
1234
+ if (!this.isUpdating) this.nodes.forEach(clearIsLayoutDirty);
1235
+ else {
1236
+ this.isUpdating = false;
1237
+ this.nodes.forEach(ensureDraggedNodesSnapshotted);
1238
+ this.nodes.forEach(resetTransformStyle);
1239
+ this.nodes.forEach(updateLayout);
1240
+ this.nodes.forEach(notifyLayoutUpdate);
1241
+ }
1242
+ this.clearAllSnapshots();
1243
+ const now2 = time.now();
1244
+ frameData.delta = clamp(0, 1e3 / 60, now2 - frameData.timestamp);
1245
+ frameData.timestamp = now2;
1246
+ frameData.isProcessing = true;
1247
+ frameSteps.update.process(frameData);
1248
+ frameSteps.preRender.process(frameData);
1249
+ frameSteps.render.process(frameData);
1250
+ frameData.isProcessing = false;
1251
+ }
1252
+ didUpdate() {
1253
+ if (!this.updateScheduled) {
1254
+ this.updateScheduled = true;
1255
+ microtask.read(this.scheduleUpdate);
1256
+ }
1257
+ }
1258
+ clearAllSnapshots() {
1259
+ this.nodes.forEach(clearSnapshot);
1260
+ this.sharedNodes.forEach(removeLeadSnapshots);
1261
+ }
1262
+ scheduleUpdateProjection() {
1263
+ if (!this.projectionUpdateScheduled) {
1264
+ this.projectionUpdateScheduled = true;
1265
+ frame.preRender(this.updateProjection, false, true);
1266
+ }
1267
+ }
1268
+ scheduleCheckAfterUnmount() {
1269
+ frame.postRender(() => {
1270
+ if (this.isLayoutDirty) this.root.didUpdate();
1271
+ else this.root.checkUpdateFailed();
1272
+ });
1273
+ }
1274
+ /**
1275
+ * Update measurements
1276
+ */
1277
+ updateSnapshot() {
1278
+ if (this.snapshot || !this.instance) return;
1279
+ this.snapshot = this.measure();
1280
+ if (this.snapshot && !calcLength(this.snapshot.measuredBox.x) && !calcLength(this.snapshot.measuredBox.y)) this.snapshot = void 0;
1281
+ }
1282
+ updateLayout() {
1283
+ if (!this.instance) return;
1284
+ this.updateScroll();
1285
+ if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) return;
1286
+ if (this.resumeFrom && !this.resumeFrom.instance) for (let i = 0; i < this.path.length; i++) this.path[i].updateScroll();
1287
+ const prevLayout = this.layout;
1288
+ this.layout = this.measure(false);
1289
+ this.layoutVersion++;
1290
+ if (!this.layoutCorrected) this.layoutCorrected = createBox();
1291
+ this.isLayoutDirty = false;
1292
+ this.projectionDelta = void 0;
1293
+ this.notifyListeners("measure", this.layout.layoutBox);
1294
+ const { visualElement } = this.options;
1295
+ visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : void 0);
1296
+ }
1297
+ updateScroll(phase = "measure") {
1298
+ let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
1299
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) needsMeasurement = false;
1300
+ if (needsMeasurement && this.instance) {
1301
+ const isRoot = checkIsScrollRoot(this.instance);
1302
+ this.scroll = {
1303
+ animationId: this.root.animationId,
1304
+ phase,
1305
+ isRoot,
1306
+ offset: measureScroll(this.instance),
1307
+ wasRoot: this.scroll ? this.scroll.isRoot : isRoot
1308
+ };
1309
+ }
1310
+ }
1311
+ resetTransform() {
1312
+ if (!resetTransform) return;
1313
+ const isResetRequested = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout;
1314
+ const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
1315
+ const transformTemplate = this.getTransformTemplate();
1316
+ const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
1317
+ const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
1318
+ if (isResetRequested && this.instance && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) {
1319
+ resetTransform(this.instance, transformTemplateValue);
1320
+ this.shouldResetTransform = false;
1321
+ this.scheduleRender();
1322
+ }
1323
+ }
1324
+ measure(removeTransform = true) {
1325
+ const pageBox = this.measurePageBox();
1326
+ let layoutBox = this.removeElementScroll(pageBox);
1327
+ if (removeTransform) layoutBox = this.removeTransform(layoutBox);
1328
+ roundBox(layoutBox);
1329
+ return {
1330
+ animationId: this.root.animationId,
1331
+ measuredBox: pageBox,
1332
+ layoutBox,
1333
+ latestValues: {},
1334
+ source: this.id
1335
+ };
1336
+ }
1337
+ measurePageBox() {
1338
+ const { visualElement } = this.options;
1339
+ if (!visualElement) return createBox();
1340
+ const box = visualElement.measureViewportBox();
1341
+ if (!(this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot))) {
1342
+ const { scroll } = this.root;
1343
+ if (scroll) {
1344
+ translateAxis(box.x, scroll.offset.x);
1345
+ translateAxis(box.y, scroll.offset.y);
1346
+ }
1347
+ }
1348
+ return box;
1349
+ }
1350
+ removeElementScroll(box) {
1351
+ const boxWithoutScroll = createBox();
1352
+ copyBoxInto(boxWithoutScroll, box);
1353
+ if (this.scroll?.wasRoot) return boxWithoutScroll;
1354
+ for (let i = 0; i < this.path.length; i++) {
1355
+ const node = this.path[i];
1356
+ const { scroll, options } = node;
1357
+ if (node !== this.root && scroll && options.layoutScroll) {
1358
+ if (scroll.wasRoot) copyBoxInto(boxWithoutScroll, box);
1359
+ translateAxis(boxWithoutScroll.x, scroll.offset.x);
1360
+ translateAxis(boxWithoutScroll.y, scroll.offset.y);
1361
+ }
1362
+ }
1363
+ return boxWithoutScroll;
1364
+ }
1365
+ applyTransform(box, transformOnly = false, output) {
1366
+ const withTransforms = output || createBox();
1367
+ copyBoxInto(withTransforms, box);
1368
+ for (let i = 0; i < this.path.length; i++) {
1369
+ const node = this.path[i];
1370
+ if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) {
1371
+ translateAxis(withTransforms.x, -node.scroll.offset.x);
1372
+ translateAxis(withTransforms.y, -node.scroll.offset.y);
1373
+ }
1374
+ if (!hasTransform(node.latestValues)) continue;
1375
+ transformBox(withTransforms, node.latestValues, node.layout?.layoutBox);
1376
+ }
1377
+ if (hasTransform(this.latestValues)) transformBox(withTransforms, this.latestValues, this.layout?.layoutBox);
1378
+ return withTransforms;
1379
+ }
1380
+ removeTransform(box) {
1381
+ const boxWithoutTransform = createBox();
1382
+ copyBoxInto(boxWithoutTransform, box);
1383
+ for (let i = 0; i < this.path.length; i++) {
1384
+ const node = this.path[i];
1385
+ if (!hasTransform(node.latestValues)) continue;
1386
+ let sourceBox;
1387
+ if (node.instance) {
1388
+ hasScale(node.latestValues) && node.updateSnapshot();
1389
+ sourceBox = createBox();
1390
+ copyBoxInto(sourceBox, node.measurePageBox());
1391
+ }
1392
+ removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot?.layoutBox, sourceBox);
1393
+ }
1394
+ if (hasTransform(this.latestValues)) removeBoxTransforms(boxWithoutTransform, this.latestValues);
1395
+ return boxWithoutTransform;
1396
+ }
1397
+ setTargetDelta(delta) {
1398
+ this.targetDelta = delta;
1399
+ this.root.scheduleUpdateProjection();
1400
+ this.isProjectionDirty = true;
1401
+ }
1402
+ setOptions(options) {
1403
+ this.options = {
1404
+ ...this.options,
1405
+ ...options,
1406
+ crossfade: options.crossfade !== void 0 ? options.crossfade : true
1407
+ };
1408
+ }
1409
+ clearMeasurements() {
1410
+ this.scroll = void 0;
1411
+ this.layout = void 0;
1412
+ this.snapshot = void 0;
1413
+ this.prevTransformTemplateValue = void 0;
1414
+ this.targetDelta = void 0;
1415
+ this.target = void 0;
1416
+ this.isLayoutDirty = false;
1417
+ }
1418
+ forceRelativeParentToResolveTarget() {
1419
+ if (!this.relativeParent) return;
1420
+ if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) this.relativeParent.resolveTargetDelta(true);
1421
+ }
1422
+ resolveTargetDelta(forceRecalculation = false) {
1423
+ const lead = this.getLead();
1424
+ this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
1425
+ this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
1426
+ this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
1427
+ const isShared = Boolean(this.resumingFrom) || this !== lead;
1428
+ if (!(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return;
1429
+ const { layout: layout2, layoutId } = this.options;
1430
+ if (!this.layout || !(layout2 || layoutId)) return;
1431
+ this.resolvedRelativeTargetAt = frameData.timestamp;
1432
+ const relativeParent = this.getClosestProjectingParent();
1433
+ if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) this.removeRelativeTarget();
1434
+ if (!this.targetDelta && !this.relativeTarget) {
1435
+ if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
1436
+ else this.removeRelativeTarget();
1437
+ }
1438
+ if (!this.relativeTarget && !this.targetDelta) return;
1439
+ if (!this.target) {
1440
+ this.target = createBox();
1441
+ this.targetWithTransforms = createBox();
1442
+ }
1443
+ if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) {
1444
+ this.forceRelativeParentToResolveTarget();
1445
+ calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0);
1446
+ } else if (this.targetDelta) {
1447
+ if (Boolean(this.resumingFrom)) this.applyTransform(this.layout.layoutBox, false, this.target);
1448
+ else copyBoxInto(this.target, this.layout.layoutBox);
1449
+ applyBoxDelta(this.target, this.targetDelta);
1450
+ } else
1451
+ copyBoxInto(this.target, this.layout.layoutBox);
1452
+ if (this.attemptToResolveRelativeTarget) {
1453
+ this.attemptToResolveRelativeTarget = false;
1454
+ if (this.options.layoutAnchor !== false && relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
1455
+ else this.relativeParent = this.relativeTarget = void 0;
1456
+ }
1457
+ if (statsBuffer.value) metrics.calculatedTargetDeltas++;
1458
+ }
1459
+ getClosestProjectingParent() {
1460
+ if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) return;
1461
+ if (this.parent.isProjecting()) return this.parent;
1462
+ else return this.parent.getClosestProjectingParent();
1463
+ }
1464
+ isProjecting() {
1465
+ return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
1466
+ }
1467
+ createRelativeTarget(relativeParent, layout2, parentLayout) {
1468
+ this.relativeParent = relativeParent;
1469
+ this.linkedParentVersion = relativeParent.layoutVersion;
1470
+ this.forceRelativeParentToResolveTarget();
1471
+ this.relativeTarget = createBox();
1472
+ this.relativeTargetOrigin = createBox();
1473
+ calcRelativePosition(this.relativeTargetOrigin, layout2, parentLayout, this.options.layoutAnchor || void 0);
1474
+ copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
1475
+ }
1476
+ removeRelativeTarget() {
1477
+ this.relativeParent = this.relativeTarget = void 0;
1478
+ }
1479
+ calcProjection() {
1480
+ const lead = this.getLead();
1481
+ const isShared = Boolean(this.resumingFrom) || this !== lead;
1482
+ let canSkip = true;
1483
+ if (this.isProjectionDirty || this.parent?.isProjectionDirty) canSkip = false;
1484
+ if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) canSkip = false;
1485
+ if (this.resolvedRelativeTargetAt === frameData.timestamp) canSkip = false;
1486
+ if (canSkip) return;
1487
+ const { layout: layout2, layoutId } = this.options;
1488
+ this.isTreeAnimating = Boolean(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation);
1489
+ if (!this.isTreeAnimating) this.targetDelta = this.relativeTarget = void 0;
1490
+ if (!this.layout || !(layout2 || layoutId)) return;
1491
+ copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
1492
+ const prevTreeScaleX = this.treeScale.x;
1493
+ const prevTreeScaleY = this.treeScale.y;
1494
+ applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
1495
+ if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
1496
+ lead.target = lead.layout.layoutBox;
1497
+ lead.targetWithTransforms = createBox();
1498
+ }
1499
+ const { target } = lead;
1500
+ if (!target) {
1501
+ if (this.prevProjectionDelta) {
1502
+ this.createProjectionDeltas();
1503
+ this.scheduleRender();
1504
+ }
1505
+ return;
1506
+ }
1507
+ if (!this.projectionDelta || !this.prevProjectionDelta) this.createProjectionDeltas();
1508
+ else {
1509
+ copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
1510
+ copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
1511
+ }
1512
+ calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
1513
+ if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
1514
+ this.hasProjected = true;
1515
+ this.scheduleRender();
1516
+ this.notifyListeners("projectionUpdate", target);
1517
+ }
1518
+ if (statsBuffer.value) metrics.calculatedProjections++;
1519
+ }
1520
+ hide() {
1521
+ this.isVisible = false;
1522
+ }
1523
+ show() {
1524
+ this.isVisible = true;
1525
+ }
1526
+ scheduleRender(notifyAll2 = true) {
1527
+ this.options.visualElement?.scheduleRender();
1528
+ if (notifyAll2) {
1529
+ const stack = this.getStack();
1530
+ stack && stack.scheduleRender();
1531
+ }
1532
+ if (this.resumingFrom && !this.resumingFrom.instance) this.resumingFrom = void 0;
1533
+ }
1534
+ createProjectionDeltas() {
1535
+ this.prevProjectionDelta = createDelta();
1536
+ this.projectionDelta = createDelta();
1537
+ this.projectionDeltaWithTransform = createDelta();
1538
+ }
1539
+ setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false, pathFn) {
1540
+ const snapshot2 = this.snapshot;
1541
+ const snapshotLatestValues = snapshot2 ? snapshot2.latestValues : {};
1542
+ const mixedValues = { ...this.latestValues };
1543
+ const targetDelta = createDelta();
1544
+ if (!this.relativeParent || !this.relativeParent.options.layoutRoot) this.relativeTarget = this.relativeTargetOrigin = void 0;
1545
+ this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
1546
+ const relativeLayout = createBox();
1547
+ const isSharedLayoutAnimation = (snapshot2 ? snapshot2.source : void 0) !== (this.layout ? this.layout.source : void 0);
1548
+ const stack = this.getStack();
1549
+ const isOnlyMember = !stack || stack.members.length <= 1;
1550
+ const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade));
1551
+ this.animationProgress = 0;
1552
+ let prevRelativeTarget;
1553
+ const interpolate = pathFn?.interpolateProjection(delta);
1554
+ this.mixTargetDelta = (latest) => {
1555
+ const progress2 = latest / 1e3;
1556
+ const point = interpolate?.(progress2);
1557
+ if (point) {
1558
+ targetDelta.x.translate = point.x;
1559
+ targetDelta.x.scale = mixNumber(delta.x.scale, 1, progress2);
1560
+ targetDelta.x.origin = delta.x.origin;
1561
+ targetDelta.x.originPoint = delta.x.originPoint;
1562
+ targetDelta.y.translate = point.y;
1563
+ targetDelta.y.scale = mixNumber(delta.y.scale, 1, progress2);
1564
+ targetDelta.y.origin = delta.y.origin;
1565
+ targetDelta.y.originPoint = delta.y.originPoint;
1566
+ } else {
1567
+ mixAxisDeltaLinear(targetDelta.x, delta.x, progress2);
1568
+ mixAxisDeltaLinear(targetDelta.y, delta.y, progress2);
1569
+ }
1570
+ this.setTargetDelta(targetDelta);
1571
+ if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) {
1572
+ calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0);
1573
+ mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress2);
1574
+ if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) this.isProjectionDirty = false;
1575
+ if (!prevRelativeTarget) prevRelativeTarget = createBox();
1576
+ copyBoxInto(prevRelativeTarget, this.relativeTarget);
1577
+ }
1578
+ if (isSharedLayoutAnimation) {
1579
+ this.animationValues = mixedValues;
1580
+ mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress2, shouldCrossfadeOpacity, isOnlyMember);
1581
+ }
1582
+ if (point && point.rotate !== void 0) {
1583
+ if (!this.animationValues) this.animationValues = mixedValues;
1584
+ this.animationValues.pathRotation = point.rotate;
1585
+ }
1586
+ this.root.scheduleUpdateProjection();
1587
+ this.scheduleRender();
1588
+ this.animationProgress = progress2;
1589
+ };
1590
+ this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
1591
+ }
1592
+ startAnimation(options) {
1593
+ this.notifyListeners("animationStart");
1594
+ this.currentAnimation?.stop();
1595
+ this.resumingFrom?.currentAnimation?.stop();
1596
+ if (this.pendingAnimation) {
1597
+ cancelFrame(this.pendingAnimation);
1598
+ this.pendingAnimation = void 0;
1599
+ }
1600
+ this.pendingAnimation = frame.update(() => {
1601
+ globalProjectionState.hasAnimatedSinceResize = true;
1602
+ this.motionValue || (this.motionValue = motionValue(0));
1603
+ this.motionValue.jump(0, false);
1604
+ this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
1605
+ ...options,
1606
+ velocity: 0,
1607
+ isSync: true,
1608
+ onUpdate: (latest) => {
1609
+ this.mixTargetDelta(latest);
1610
+ options.onUpdate && options.onUpdate(latest);
1611
+ },
1612
+ onComplete: () => {
1613
+ options.onComplete && options.onComplete();
1614
+ this.completeAnimation();
1615
+ }
1616
+ });
1617
+ if (this.resumingFrom) this.resumingFrom.currentAnimation = this.currentAnimation;
1618
+ this.pendingAnimation = void 0;
1619
+ });
1620
+ }
1621
+ completeAnimation() {
1622
+ if (this.resumingFrom) {
1623
+ this.resumingFrom.currentAnimation = void 0;
1624
+ this.resumingFrom.preserveOpacity = void 0;
1625
+ }
1626
+ const stack = this.getStack();
1627
+ stack && stack.exitAnimationComplete();
1628
+ this.resumingFrom = this.currentAnimation = this.animationValues = void 0;
1629
+ this.notifyListeners("animationComplete");
1630
+ }
1631
+ finishAnimation() {
1632
+ if (this.currentAnimation) {
1633
+ this.mixTargetDelta && this.mixTargetDelta(animationTarget);
1634
+ this.currentAnimation.stop();
1635
+ }
1636
+ this.completeAnimation();
1637
+ }
1638
+ applyTransformsToTarget() {
1639
+ const lead = this.getLead();
1640
+ let { targetWithTransforms, target, layout: layout2, latestValues } = lead;
1641
+ if (!targetWithTransforms || !target || !layout2) return;
1642
+ if (this !== lead && this.layout && layout2 && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout2.layoutBox)) {
1643
+ target = this.target || createBox();
1644
+ const xLength = calcLength(this.layout.layoutBox.x);
1645
+ target.x.min = lead.target.x.min;
1646
+ target.x.max = target.x.min + xLength;
1647
+ const yLength = calcLength(this.layout.layoutBox.y);
1648
+ target.y.min = lead.target.y.min;
1649
+ target.y.max = target.y.min + yLength;
1650
+ }
1651
+ copyBoxInto(targetWithTransforms, target);
1652
+ transformBox(targetWithTransforms, latestValues);
1653
+ calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
1654
+ }
1655
+ registerSharedNode(layoutId, node) {
1656
+ if (!this.sharedNodes.has(layoutId)) this.sharedNodes.set(layoutId, new NodeStack());
1657
+ this.sharedNodes.get(layoutId).add(node);
1658
+ const config = node.options.initialPromotionConfig;
1659
+ node.promote({
1660
+ transition: config ? config.transition : void 0,
1661
+ preserveFollowOpacity: config && config.shouldPreserveFollowOpacity ? config.shouldPreserveFollowOpacity(node) : void 0
1662
+ });
1663
+ }
1664
+ isLead() {
1665
+ const stack = this.getStack();
1666
+ return stack ? stack.lead === this : true;
1667
+ }
1668
+ getLead() {
1669
+ const { layoutId } = this.options;
1670
+ return layoutId ? this.getStack()?.lead || this : this;
1671
+ }
1672
+ getPrevLead() {
1673
+ const { layoutId } = this.options;
1674
+ return layoutId ? this.getStack()?.prevLead : void 0;
1675
+ }
1676
+ getStack() {
1677
+ const { layoutId } = this.options;
1678
+ if (layoutId) return this.root.sharedNodes.get(layoutId);
1679
+ }
1680
+ promote({ needsReset, transition, preserveFollowOpacity } = {}) {
1681
+ const stack = this.getStack();
1682
+ if (stack) stack.promote(this, preserveFollowOpacity);
1683
+ if (needsReset) {
1684
+ this.projectionDelta = void 0;
1685
+ this.needsReset = true;
1686
+ }
1687
+ if (transition) this.setOptions({ transition });
1688
+ }
1689
+ relegate() {
1690
+ const stack = this.getStack();
1691
+ if (stack) return stack.relegate(this);
1692
+ else return false;
1693
+ }
1694
+ resetSkewAndRotation() {
1695
+ const { visualElement } = this.options;
1696
+ if (!visualElement) return;
1697
+ let hasDistortingTransform = false;
1698
+ const { latestValues } = visualElement;
1699
+ if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) hasDistortingTransform = true;
1700
+ if (!hasDistortingTransform) return;
1701
+ const resetValues = {};
1702
+ if (latestValues.z) resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
1703
+ for (let i = 0; i < transformAxes.length; i++) {
1704
+ resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
1705
+ resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
1706
+ }
1707
+ visualElement.render();
1708
+ for (const key in resetValues) {
1709
+ visualElement.setStaticValue(key, resetValues[key]);
1710
+ if (this.animationValues) this.animationValues[key] = resetValues[key];
1711
+ }
1712
+ visualElement.scheduleRender();
1713
+ }
1714
+ applyProjectionStyles(targetStyle, styleProp) {
1715
+ if (!this.instance || this.isSVG) return;
1716
+ if (!this.isVisible) {
1717
+ targetStyle.visibility = "hidden";
1718
+ return;
1719
+ }
1720
+ const transformTemplate = this.getTransformTemplate();
1721
+ if (this.needsReset) {
1722
+ this.needsReset = false;
1723
+ targetStyle.visibility = "";
1724
+ targetStyle.opacity = "";
1725
+ targetStyle.pointerEvents = resolveMotionValue(styleProp?.pointerEvents) || "";
1726
+ targetStyle.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
1727
+ return;
1728
+ }
1729
+ const lead = this.getLead();
1730
+ if (!this.projectionDelta || !this.layout || !lead.target) {
1731
+ if (this.options.layoutId) {
1732
+ targetStyle.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1;
1733
+ targetStyle.pointerEvents = resolveMotionValue(styleProp?.pointerEvents) || "";
1734
+ }
1735
+ if (this.hasProjected && !hasTransform(this.latestValues)) {
1736
+ targetStyle.transform = transformTemplate ? transformTemplate({}, "") : "none";
1737
+ this.hasProjected = false;
1738
+ }
1739
+ return;
1740
+ }
1741
+ targetStyle.visibility = "";
1742
+ const valuesToRender = lead.animationValues || lead.latestValues;
1743
+ this.applyTransformsToTarget();
1744
+ let transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
1745
+ if (transformTemplate) transform = transformTemplate(valuesToRender, transform);
1746
+ targetStyle.transform = transform;
1747
+ const { x, y } = this.projectionDelta;
1748
+ targetStyle.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
1749
+ if (lead.animationValues)
1750
+ targetStyle.opacity = lead === this ? valuesToRender.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
1751
+ else
1752
+ targetStyle.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
1753
+ for (const key in scaleCorrectors) {
1754
+ if (valuesToRender[key] === void 0) continue;
1755
+ const { correct, applyTo, isCSSVariable } = scaleCorrectors[key];
1756
+ const corrected = transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
1757
+ if (applyTo) {
1758
+ const num = applyTo.length;
1759
+ for (let i = 0; i < num; i++) targetStyle[applyTo[i]] = corrected;
1760
+ } else if (isCSSVariable) this.options.visualElement.renderState.vars[key] = corrected;
1761
+ else targetStyle[key] = corrected;
1762
+ }
1763
+ if (this.options.layoutId) targetStyle.pointerEvents = lead === this ? resolveMotionValue(styleProp?.pointerEvents) || "" : "none";
1764
+ }
1765
+ clearSnapshot() {
1766
+ this.resumeFrom = this.snapshot = void 0;
1767
+ }
1768
+ resetTree() {
1769
+ this.root.nodes.forEach((node) => node.currentAnimation?.stop());
1770
+ this.root.nodes.forEach(clearMeasurements);
1771
+ this.root.sharedNodes.clear();
1772
+ }
1773
+ };
1774
+ }
1775
+ function updateLayout(node) {
1776
+ node.updateLayout();
1777
+ }
1778
+ function notifyLayoutUpdate(node) {
1779
+ const snapshot2 = node.resumeFrom?.snapshot || node.snapshot;
1780
+ if (node.isLead() && node.layout && snapshot2 && node.hasListeners("didUpdate")) {
1781
+ const { layoutBox: layout2, measuredBox: measuredLayout } = node.layout;
1782
+ const { animationType } = node.options;
1783
+ const isShared = snapshot2.source !== node.layout.source;
1784
+ if (animationType === "size") eachAxis((axis) => {
1785
+ const axisSnapshot = isShared ? snapshot2.measuredBox[axis] : snapshot2.layoutBox[axis];
1786
+ const length = calcLength(axisSnapshot);
1787
+ axisSnapshot.min = layout2[axis].min;
1788
+ axisSnapshot.max = axisSnapshot.min + length;
1789
+ });
1790
+ else if (animationType === "x" || animationType === "y") {
1791
+ const snapAxis = animationType === "x" ? "y" : "x";
1792
+ copyAxisInto(isShared ? snapshot2.measuredBox[snapAxis] : snapshot2.layoutBox[snapAxis], layout2[snapAxis]);
1793
+ } else if (shouldAnimatePositionOnly(animationType, snapshot2.layoutBox, layout2)) eachAxis((axis) => {
1794
+ const axisSnapshot = isShared ? snapshot2.measuredBox[axis] : snapshot2.layoutBox[axis];
1795
+ const length = calcLength(layout2[axis]);
1796
+ axisSnapshot.max = axisSnapshot.min + length;
1797
+ if (node.relativeTarget && !node.currentAnimation) {
1798
+ node.isProjectionDirty = true;
1799
+ node.relativeTarget[axis].max = node.relativeTarget[axis].min + length;
1800
+ }
1801
+ });
1802
+ const layoutDelta = createDelta();
1803
+ calcBoxDelta(layoutDelta, layout2, snapshot2.layoutBox);
1804
+ const visualDelta = createDelta();
1805
+ if (isShared) calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot2.measuredBox);
1806
+ else calcBoxDelta(visualDelta, layout2, snapshot2.layoutBox);
1807
+ const hasLayoutChanged = !isDeltaZero(layoutDelta);
1808
+ let hasRelativeLayoutChanged = false;
1809
+ if (!node.resumeFrom) {
1810
+ const relativeParent = node.getClosestProjectingParent();
1811
+ if (relativeParent && !relativeParent.resumeFrom) {
1812
+ const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
1813
+ if (parentSnapshot && parentLayout) {
1814
+ const anchor = node.options.layoutAnchor || void 0;
1815
+ const relativeSnapshot = createBox();
1816
+ calcRelativePosition(relativeSnapshot, snapshot2.layoutBox, parentSnapshot.layoutBox, anchor);
1817
+ const relativeLayout = createBox();
1818
+ calcRelativePosition(relativeLayout, layout2, parentLayout.layoutBox, anchor);
1819
+ if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) hasRelativeLayoutChanged = true;
1820
+ if (relativeParent.options.layoutRoot) {
1821
+ node.relativeTarget = relativeLayout;
1822
+ node.relativeTargetOrigin = relativeSnapshot;
1823
+ node.relativeParent = relativeParent;
1824
+ }
1825
+ }
1826
+ }
1827
+ }
1828
+ node.notifyListeners("didUpdate", {
1829
+ layout: layout2,
1830
+ snapshot: snapshot2,
1831
+ delta: visualDelta,
1832
+ layoutDelta,
1833
+ hasLayoutChanged,
1834
+ hasRelativeLayoutChanged
1835
+ });
1836
+ } else if (node.isLead()) {
1837
+ const { onExitComplete } = node.options;
1838
+ onExitComplete && onExitComplete();
1839
+ }
1840
+ node.options.transition = void 0;
1841
+ }
1842
+ function propagateDirtyNodes(node) {
1843
+ if (statsBuffer.value) metrics.nodes++;
1844
+ if (!node.parent) return;
1845
+ if (!node.isProjecting()) node.isProjectionDirty = node.parent.isProjectionDirty;
1846
+ node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty || node.parent.isProjectionDirty || node.parent.isSharedProjectionDirty));
1847
+ node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
1848
+ }
1849
+ function cleanDirtyNodes(node) {
1850
+ node.isProjectionDirty = node.isSharedProjectionDirty = node.isTransformDirty = false;
1851
+ }
1852
+ function clearSnapshot(node) {
1853
+ node.clearSnapshot();
1854
+ }
1855
+ function clearMeasurements(node) {
1856
+ node.clearMeasurements();
1857
+ }
1858
+ function forceLayoutMeasure(node) {
1859
+ node.isLayoutDirty = true;
1860
+ node.updateLayout();
1861
+ }
1862
+ function clearIsLayoutDirty(node) {
1863
+ node.isLayoutDirty = false;
1864
+ }
1865
+ function ensureDraggedNodesSnapshotted(node) {
1866
+ if (node.isAnimationBlocked && node.layout && !node.isLayoutDirty) {
1867
+ node.snapshot = node.layout;
1868
+ node.isLayoutDirty = true;
1869
+ }
1870
+ }
1871
+ function resetTransformStyle(node) {
1872
+ const { visualElement } = node.options;
1873
+ if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) visualElement.notify("BeforeLayoutMeasure");
1874
+ node.resetTransform();
1875
+ }
1876
+ function finishAnimation(node) {
1877
+ node.finishAnimation();
1878
+ node.targetDelta = node.relativeTarget = node.target = void 0;
1879
+ node.isProjectionDirty = true;
1880
+ }
1881
+ function resolveTargetDelta(node) {
1882
+ node.resolveTargetDelta();
1883
+ }
1884
+ function calcProjection(node) {
1885
+ node.calcProjection();
1886
+ }
1887
+ function resetSkewAndRotation(node) {
1888
+ node.resetSkewAndRotation();
1889
+ }
1890
+ function removeLeadSnapshots(stack) {
1891
+ stack.removeLeadSnapshot();
1892
+ }
1893
+ function mixAxisDeltaLinear(output, delta, p) {
1894
+ output.translate = mixNumber(delta.translate, 0, p);
1895
+ output.scale = mixNumber(delta.scale, 1, p);
1896
+ output.origin = delta.origin;
1897
+ output.originPoint = delta.originPoint;
1898
+ }
1899
+ function mixAxis(output, from, to, p) {
1900
+ output.min = mixNumber(from.min, to.min, p);
1901
+ output.max = mixNumber(from.max, to.max, p);
1902
+ }
1903
+ function mixBox(output, from, to, p) {
1904
+ mixAxis(output.x, from.x, to.x, p);
1905
+ mixAxis(output.y, from.y, to.y, p);
1906
+ }
1907
+ function hasOpacityCrossfade(node) {
1908
+ return node.animationValues && node.animationValues.opacityExit !== void 0;
1909
+ }
1910
+ var defaultLayoutTransition = {
1911
+ duration: 0.45,
1912
+ ease: [
1913
+ 0.4,
1914
+ 0,
1915
+ 0.1,
1916
+ 1
1917
+ ]
1918
+ };
1919
+ var userAgentContains = (string) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string);
1920
+ var roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop;
1921
+ function roundAxis(axis) {
1922
+ axis.min = roundPoint(axis.min);
1923
+ axis.max = roundPoint(axis.max);
1924
+ }
1925
+ function roundBox(box) {
1926
+ roundAxis(box.x);
1927
+ roundAxis(box.y);
1928
+ }
1929
+ function shouldAnimatePositionOnly(animationType, snapshot2, layout2) {
1930
+ return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot2), aspectRatio(layout2), 0.2);
1931
+ }
1932
+ function checkNodeWasScrollRoot(node) {
1933
+ return node !== node.root && node.scroll?.wasRoot;
1934
+ }
1935
+ var DocumentProjectionNode = createProjectionNode({
1936
+ attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
1937
+ measureScroll: () => ({
1938
+ x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,
1939
+ y: document.documentElement.scrollTop || document.body?.scrollTop || 0
1940
+ }),
1941
+ checkIsScrollRoot: () => true
1942
+ });
1943
+ var rootProjectionNode = { current: void 0 };
1944
+ var HTMLProjectionNode = createProjectionNode({
1945
+ measureScroll: (instance) => ({
1946
+ x: instance.scrollLeft,
1947
+ y: instance.scrollTop
1948
+ }),
1949
+ defaultParent: () => {
1950
+ if (!rootProjectionNode.current) {
1951
+ const documentNode = new DocumentProjectionNode({});
1952
+ documentNode.mount(window);
1953
+ documentNode.setOptions({ layoutScroll: true });
1954
+ rootProjectionNode.current = documentNode;
1955
+ }
1956
+ return rootProjectionNode.current;
1957
+ },
1958
+ resetTransform: (instance, value) => {
1959
+ instance.style.transform = value !== void 0 ? value : "none";
1960
+ },
1961
+ checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed")
1962
+ });
1963
+ function LazyMotion({ children, features, strict = false }) {
1964
+ const [, setIsLoaded] = useState(!isLazyBundle(features));
1965
+ const loadedRenderer = useRef(void 0);
1966
+ if (!isLazyBundle(features)) {
1967
+ const { renderer, ...loadedFeatures } = features;
1968
+ loadedRenderer.current = renderer;
1969
+ loadFeatures(loadedFeatures);
1970
+ }
1971
+ useEffect(() => {
1972
+ if (isLazyBundle(features)) features().then(({ renderer, ...loadedFeatures }) => {
1973
+ loadFeatures(loadedFeatures);
1974
+ loadedRenderer.current = renderer;
1975
+ setIsLoaded(true);
1976
+ });
1977
+ }, []);
1978
+ return jsx(LazyContext.Provider, {
1979
+ value: {
1980
+ renderer: loadedRenderer.current,
1981
+ strict
1982
+ },
1983
+ children
1984
+ });
1985
+ }
1986
+ function isLazyBundle(features) {
1987
+ return typeof features === "function";
1988
+ }
1989
+ var createDomVisualElement = (Component2, options) => {
1990
+ return options.isSVG ?? isSVGComponent(Component2) ? new SVGVisualElement(options) : new HTMLVisualElement(options, { allowProjection: Component2 !== Fragment });
1991
+ };
1992
+ var AnimationFeature = class extends Feature {
1993
+ /**
1994
+ * We dynamically generate the AnimationState manager as it contains a reference
1995
+ * to the underlying animation library. We only want to load that if we load this,
1996
+ * so people can optionally code split it out using the `m` component.
1997
+ */
1998
+ constructor(node) {
1999
+ super(node);
2000
+ node.animationState || (node.animationState = createAnimationState(node));
2001
+ }
2002
+ updateAnimationControlsSubscription() {
2003
+ const { animate } = this.node.getProps();
2004
+ if (isAnimationControls(animate)) this.unmountControls = animate.subscribe(this.node);
2005
+ }
2006
+ /**
2007
+ * Subscribe any provided AnimationControls to the component's VisualElement
2008
+ */
2009
+ mount() {
2010
+ this.updateAnimationControlsSubscription();
2011
+ }
2012
+ update() {
2013
+ const { animate } = this.node.getProps();
2014
+ const { animate: prevAnimate } = this.node.prevProps || {};
2015
+ if (animate !== prevAnimate) this.updateAnimationControlsSubscription();
2016
+ }
2017
+ unmount() {
2018
+ this.node.animationState.reset();
2019
+ this.unmountControls?.();
2020
+ }
2021
+ };
2022
+ var id = 0;
2023
+ var ExitAnimationFeature = class extends Feature {
2024
+ constructor() {
2025
+ super(...arguments);
2026
+ this.id = id++;
2027
+ this.isExitComplete = false;
2028
+ }
2029
+ update() {
2030
+ if (!this.node.presenceContext) return;
2031
+ const { isPresent, onExitComplete } = this.node.presenceContext;
2032
+ const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
2033
+ if (!this.node.animationState || isPresent === prevIsPresent) return;
2034
+ if (isPresent && prevIsPresent === false) {
2035
+ if (this.isExitComplete) {
2036
+ const { initial, custom } = this.node.getProps();
2037
+ if (typeof initial === "string" || typeof initial === "object" && initial !== null && !Array.isArray(initial)) {
2038
+ const resolved = resolveVariant(this.node, initial, custom);
2039
+ if (resolved) {
2040
+ const { transition, transitionEnd, ...target } = resolved;
2041
+ for (const key in target) this.node.getValue(key)?.jump(target[key]);
2042
+ }
2043
+ }
2044
+ this.node.animationState.reset();
2045
+ this.node.animationState.animateChanges();
2046
+ } else this.node.animationState.setActive("exit", false);
2047
+ this.isExitComplete = false;
2048
+ return;
2049
+ }
2050
+ const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
2051
+ if (onExitComplete && !isPresent) exitAnimation.then(() => {
2052
+ this.isExitComplete = true;
2053
+ onExitComplete(this.id);
2054
+ });
2055
+ }
2056
+ mount() {
2057
+ const { register, onExitComplete } = this.node.presenceContext || {};
2058
+ if (onExitComplete) onExitComplete(this.id);
2059
+ if (register) this.unmount = register(this.id);
2060
+ }
2061
+ unmount() {
2062
+ }
2063
+ };
2064
+ var animations = {
2065
+ animation: { Feature: AnimationFeature },
2066
+ exit: { Feature: ExitAnimationFeature }
2067
+ };
2068
+ function extractEventInfo(event) {
2069
+ return { point: {
2070
+ x: event.pageX,
2071
+ y: event.pageY
2072
+ } };
2073
+ }
2074
+ var addPointerInfo = (handler) => (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
2075
+ function addPointerEvent(target, eventName, handler, options) {
2076
+ return addDomEvent(target, eventName, addPointerInfo(handler), options);
2077
+ }
2078
+ var getContextWindow = ({ current }) => {
2079
+ return current ? current.ownerDocument.defaultView : null;
2080
+ };
2081
+ var distance = (a, b) => Math.abs(a - b);
2082
+ function distance2D(a, b) {
2083
+ const xDelta = distance(a.x, b.x);
2084
+ const yDelta = distance(a.y, b.y);
2085
+ return Math.sqrt(xDelta ** 2 + yDelta ** 2);
2086
+ }
2087
+ var overflowStyles = /* @__PURE__ */ new Set(["auto", "scroll"]);
2088
+ var PanSession = class {
2089
+ constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, element } = {}) {
2090
+ this.startEvent = null;
2091
+ this.lastMoveEvent = null;
2092
+ this.lastMoveEventInfo = null;
2093
+ this.lastRawMoveEventInfo = null;
2094
+ this.handlers = {};
2095
+ this.contextWindow = window;
2096
+ this.scrollPositions = /* @__PURE__ */ new Map();
2097
+ this.removeScrollListeners = null;
2098
+ this.onElementScroll = (event2) => {
2099
+ this.handleScroll(event2.target);
2100
+ };
2101
+ this.onWindowScroll = () => {
2102
+ this.handleScroll(window);
2103
+ };
2104
+ this.updatePoint = () => {
2105
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
2106
+ if (this.lastRawMoveEventInfo) this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint);
2107
+ const info = getPanInfo(this.lastMoveEventInfo, this.history);
2108
+ const isPanStarted = this.startEvent !== null;
2109
+ const isDistancePastThreshold = distance2D(info.offset, {
2110
+ x: 0,
2111
+ y: 0
2112
+ }) >= this.distanceThreshold;
2113
+ if (!isPanStarted && !isDistancePastThreshold) return;
2114
+ const { point: point2 } = info;
2115
+ const { timestamp: timestamp2 } = frameData;
2116
+ this.history.push({
2117
+ ...point2,
2118
+ timestamp: timestamp2
2119
+ });
2120
+ const { onStart, onMove } = this.handlers;
2121
+ if (!isPanStarted) {
2122
+ onStart && onStart(this.lastMoveEvent, info);
2123
+ this.startEvent = this.lastMoveEvent;
2124
+ }
2125
+ onMove && onMove(this.lastMoveEvent, info);
2126
+ };
2127
+ this.handlePointerMove = (event2, info) => {
2128
+ this.lastMoveEvent = event2;
2129
+ this.lastRawMoveEventInfo = info;
2130
+ this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);
2131
+ frame.update(this.updatePoint, true);
2132
+ };
2133
+ this.handlePointerUp = (event2, info) => {
2134
+ this.end();
2135
+ const { onEnd, onSessionEnd, resumeAnimation } = this.handlers;
2136
+ if (this.dragSnapToOrigin || !this.startEvent) resumeAnimation && resumeAnimation();
2137
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
2138
+ const panInfo = getPanInfo(event2.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(info, this.transformPagePoint), this.history);
2139
+ if (this.startEvent && onEnd) onEnd(event2, panInfo);
2140
+ onSessionEnd && onSessionEnd(event2, panInfo);
2141
+ };
2142
+ if (!isPrimaryPointer(event)) return;
2143
+ this.dragSnapToOrigin = dragSnapToOrigin;
2144
+ this.handlers = handlers;
2145
+ this.transformPagePoint = transformPagePoint;
2146
+ this.distanceThreshold = distanceThreshold;
2147
+ this.contextWindow = contextWindow || window;
2148
+ const initialInfo = transformPoint(extractEventInfo(event), this.transformPagePoint);
2149
+ const { point } = initialInfo;
2150
+ const { timestamp } = frameData;
2151
+ this.history = [{
2152
+ ...point,
2153
+ timestamp
2154
+ }];
2155
+ const { onSessionStart } = handlers;
2156
+ onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
2157
+ const eventOptions = {
2158
+ passive: true,
2159
+ capture: true
2160
+ };
2161
+ this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove, eventOptions), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp, eventOptions), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp, eventOptions));
2162
+ if (element) this.startScrollTracking(element);
2163
+ }
2164
+ /**
2165
+ * Start tracking scroll on ancestors and window.
2166
+ */
2167
+ startScrollTracking(element) {
2168
+ let current = element.parentElement;
2169
+ while (current) {
2170
+ const style = getComputedStyle(current);
2171
+ if (overflowStyles.has(style.overflowX) || overflowStyles.has(style.overflowY)) this.scrollPositions.set(current, {
2172
+ x: current.scrollLeft,
2173
+ y: current.scrollTop
2174
+ });
2175
+ current = current.parentElement;
2176
+ }
2177
+ this.scrollPositions.set(window, {
2178
+ x: window.scrollX,
2179
+ y: window.scrollY
2180
+ });
2181
+ window.addEventListener("scroll", this.onElementScroll, { capture: true });
2182
+ window.addEventListener("scroll", this.onWindowScroll);
2183
+ this.removeScrollListeners = () => {
2184
+ window.removeEventListener("scroll", this.onElementScroll, { capture: true });
2185
+ window.removeEventListener("scroll", this.onWindowScroll);
2186
+ };
2187
+ }
2188
+ /**
2189
+ * Handle scroll compensation during drag.
2190
+ *
2191
+ * For element scroll: adjusts history origin since pageX/pageY doesn't change.
2192
+ * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
2193
+ */
2194
+ handleScroll(target) {
2195
+ const initial = this.scrollPositions.get(target);
2196
+ if (!initial) return;
2197
+ const isWindow = target === window;
2198
+ const current = isWindow ? {
2199
+ x: window.scrollX,
2200
+ y: window.scrollY
2201
+ } : {
2202
+ x: target.scrollLeft,
2203
+ y: target.scrollTop
2204
+ };
2205
+ const delta = {
2206
+ x: current.x - initial.x,
2207
+ y: current.y - initial.y
2208
+ };
2209
+ if (delta.x === 0 && delta.y === 0) return;
2210
+ if (isWindow) {
2211
+ if (this.lastMoveEventInfo) {
2212
+ this.lastMoveEventInfo.point.x += delta.x;
2213
+ this.lastMoveEventInfo.point.y += delta.y;
2214
+ }
2215
+ } else if (this.history.length > 0) {
2216
+ this.history[0].x -= delta.x;
2217
+ this.history[0].y -= delta.y;
2218
+ }
2219
+ this.scrollPositions.set(target, current);
2220
+ frame.update(this.updatePoint, true);
2221
+ }
2222
+ updateHandlers(handlers) {
2223
+ this.handlers = handlers;
2224
+ }
2225
+ end() {
2226
+ this.removeListeners && this.removeListeners();
2227
+ this.removeScrollListeners && this.removeScrollListeners();
2228
+ this.scrollPositions.clear();
2229
+ cancelFrame(this.updatePoint);
2230
+ }
2231
+ };
2232
+ function transformPoint(info, transformPagePoint) {
2233
+ return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
2234
+ }
2235
+ function subtractPoint(a, b) {
2236
+ return {
2237
+ x: a.x - b.x,
2238
+ y: a.y - b.y
2239
+ };
2240
+ }
2241
+ function getPanInfo({ point }, history) {
2242
+ return {
2243
+ point,
2244
+ delta: subtractPoint(point, lastDevicePoint(history)),
2245
+ offset: subtractPoint(point, startDevicePoint(history)),
2246
+ velocity: getVelocity(history, 0.1)
2247
+ };
2248
+ }
2249
+ function startDevicePoint(history) {
2250
+ return history[0];
2251
+ }
2252
+ function lastDevicePoint(history) {
2253
+ return history[history.length - 1];
2254
+ }
2255
+ function getVelocity(history, timeDelta) {
2256
+ if (history.length < 2) return {
2257
+ x: 0,
2258
+ y: 0
2259
+ };
2260
+ let i = history.length - 1;
2261
+ let timestampedPoint = null;
2262
+ const lastPoint = lastDevicePoint(history);
2263
+ while (i >= 0) {
2264
+ timestampedPoint = history[i];
2265
+ if (lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta)) break;
2266
+ i--;
2267
+ }
2268
+ if (!timestampedPoint) return {
2269
+ x: 0,
2270
+ y: 0
2271
+ };
2272
+ if (timestampedPoint === history[0] && history.length > 2 && lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta) * 2) timestampedPoint = history[1];
2273
+ const time2 = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
2274
+ if (time2 === 0) return {
2275
+ x: 0,
2276
+ y: 0
2277
+ };
2278
+ const currentVelocity = {
2279
+ x: (lastPoint.x - timestampedPoint.x) / time2,
2280
+ y: (lastPoint.y - timestampedPoint.y) / time2
2281
+ };
2282
+ if (currentVelocity.x === Infinity) currentVelocity.x = 0;
2283
+ if (currentVelocity.y === Infinity) currentVelocity.y = 0;
2284
+ return currentVelocity;
2285
+ }
2286
+ function applyConstraints(point, { min, max }, elastic) {
2287
+ if (min !== void 0 && point < min) point = elastic ? mixNumber(min, point, elastic.min) : Math.max(point, min);
2288
+ else if (max !== void 0 && point > max) point = elastic ? mixNumber(max, point, elastic.max) : Math.min(point, max);
2289
+ return point;
2290
+ }
2291
+ function calcRelativeAxisConstraints(axis, min, max) {
2292
+ return {
2293
+ min: min !== void 0 ? axis.min + min : void 0,
2294
+ max: max !== void 0 ? axis.max + max - (axis.max - axis.min) : void 0
2295
+ };
2296
+ }
2297
+ function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) {
2298
+ return {
2299
+ x: calcRelativeAxisConstraints(layoutBox.x, left, right),
2300
+ y: calcRelativeAxisConstraints(layoutBox.y, top, bottom)
2301
+ };
2302
+ }
2303
+ function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
2304
+ let min = constraintsAxis.min - layoutAxis.min;
2305
+ let max = constraintsAxis.max - layoutAxis.max;
2306
+ if (constraintsAxis.max - constraintsAxis.min < layoutAxis.max - layoutAxis.min) [min, max] = [max, min];
2307
+ return {
2308
+ min,
2309
+ max
2310
+ };
2311
+ }
2312
+ function calcViewportConstraints(layoutBox, constraintsBox) {
2313
+ return {
2314
+ x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
2315
+ y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y)
2316
+ };
2317
+ }
2318
+ function calcOrigin(source, target) {
2319
+ let origin = 0.5;
2320
+ const sourceLength = calcLength(source);
2321
+ const targetLength = calcLength(target);
2322
+ if (targetLength > sourceLength) origin = progress(target.min, target.max - sourceLength, source.min);
2323
+ else if (sourceLength > targetLength) origin = progress(source.min, source.max - targetLength, target.min);
2324
+ return clamp(0, 1, origin);
2325
+ }
2326
+ function rebaseAxisConstraints(layout2, constraints) {
2327
+ const relativeConstraints = {};
2328
+ if (constraints.min !== void 0) relativeConstraints.min = constraints.min - layout2.min;
2329
+ if (constraints.max !== void 0) relativeConstraints.max = constraints.max - layout2.min;
2330
+ return relativeConstraints;
2331
+ }
2332
+ var defaultElastic = 0.35;
2333
+ function resolveDragElastic(dragElastic = defaultElastic) {
2334
+ if (dragElastic === false) dragElastic = 0;
2335
+ else if (dragElastic === true) dragElastic = defaultElastic;
2336
+ return {
2337
+ x: resolveAxisElastic(dragElastic, "left", "right"),
2338
+ y: resolveAxisElastic(dragElastic, "top", "bottom")
2339
+ };
2340
+ }
2341
+ function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
2342
+ return {
2343
+ min: resolvePointElastic(dragElastic, minLabel),
2344
+ max: resolvePointElastic(dragElastic, maxLabel)
2345
+ };
2346
+ }
2347
+ function resolvePointElastic(dragElastic, label) {
2348
+ return typeof dragElastic === "number" ? dragElastic : dragElastic[label] || 0;
2349
+ }
2350
+ var elementDragControls = /* @__PURE__ */ new WeakMap();
2351
+ var VisualElementDragControls = class {
2352
+ constructor(visualElement) {
2353
+ this.openDragLock = null;
2354
+ this.isDragging = false;
2355
+ this.currentDirection = null;
2356
+ this.originPoint = {
2357
+ x: 0,
2358
+ y: 0
2359
+ };
2360
+ this.constraints = false;
2361
+ this.hasMutatedConstraints = false;
2362
+ this.elastic = createBox();
2363
+ this.latestPointerEvent = null;
2364
+ this.latestPanInfo = null;
2365
+ this.visualElement = visualElement;
2366
+ }
2367
+ start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {
2368
+ const { presenceContext } = this.visualElement;
2369
+ if (presenceContext && presenceContext.isPresent === false) return;
2370
+ const onSessionStart = (event) => {
2371
+ if (snapToCursor) this.snapToCursor(extractEventInfo(event).point);
2372
+ this.stopAnimation();
2373
+ };
2374
+ const onStart = (event, info) => {
2375
+ const { drag: drag2, dragPropagation, onDragStart } = this.getProps();
2376
+ if (drag2 && !dragPropagation) {
2377
+ if (this.openDragLock) this.openDragLock();
2378
+ this.openDragLock = setDragLock(drag2);
2379
+ if (!this.openDragLock) return;
2380
+ }
2381
+ this.latestPointerEvent = event;
2382
+ this.latestPanInfo = info;
2383
+ this.isDragging = true;
2384
+ this.currentDirection = null;
2385
+ this.resolveConstraints();
2386
+ if (this.visualElement.projection) {
2387
+ this.visualElement.projection.isAnimationBlocked = true;
2388
+ this.visualElement.projection.target = void 0;
2389
+ }
2390
+ eachAxis((axis) => {
2391
+ let current = this.getAxisMotionValue(axis).get() || 0;
2392
+ if (percent.test(current)) {
2393
+ const { projection } = this.visualElement;
2394
+ if (projection && projection.layout) {
2395
+ const measuredAxis = projection.layout.layoutBox[axis];
2396
+ if (measuredAxis) current = calcLength(measuredAxis) * (parseFloat(current) / 100);
2397
+ }
2398
+ }
2399
+ this.originPoint[axis] = current;
2400
+ });
2401
+ if (onDragStart) frame.update(() => onDragStart(event, info), false, true);
2402
+ addValueToWillChange(this.visualElement, "transform");
2403
+ const { animationState } = this.visualElement;
2404
+ animationState && animationState.setActive("whileDrag", true);
2405
+ };
2406
+ const onMove = (event, info) => {
2407
+ this.latestPointerEvent = event;
2408
+ this.latestPanInfo = info;
2409
+ const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag } = this.getProps();
2410
+ if (!dragPropagation && !this.openDragLock) return;
2411
+ const { offset } = info;
2412
+ if (dragDirectionLock && this.currentDirection === null) {
2413
+ this.currentDirection = getCurrentDirection(offset);
2414
+ if (this.currentDirection !== null) onDirectionLock && onDirectionLock(this.currentDirection);
2415
+ return;
2416
+ }
2417
+ this.updateAxis("x", info.point, offset);
2418
+ this.updateAxis("y", info.point, offset);
2419
+ this.visualElement.render();
2420
+ if (onDrag) frame.update(() => onDrag(event, info), false, true);
2421
+ };
2422
+ const onSessionEnd = (event, info) => {
2423
+ this.latestPointerEvent = event;
2424
+ this.latestPanInfo = info;
2425
+ this.stop(event, info);
2426
+ this.latestPointerEvent = null;
2427
+ this.latestPanInfo = null;
2428
+ };
2429
+ const resumeAnimation = () => {
2430
+ const { dragSnapToOrigin: snap } = this.getProps();
2431
+ if (snap || this.constraints) this.startAnimation({
2432
+ x: 0,
2433
+ y: 0
2434
+ });
2435
+ };
2436
+ const { dragSnapToOrigin } = this.getProps();
2437
+ this.panSession = new PanSession(originEvent, {
2438
+ onSessionStart,
2439
+ onStart,
2440
+ onMove,
2441
+ onSessionEnd,
2442
+ resumeAnimation
2443
+ }, {
2444
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
2445
+ dragSnapToOrigin,
2446
+ distanceThreshold,
2447
+ contextWindow: getContextWindow(this.visualElement),
2448
+ element: this.visualElement.current
2449
+ });
2450
+ }
2451
+ /**
2452
+ * @internal
2453
+ */
2454
+ stop(event, panInfo) {
2455
+ const finalEvent = event || this.latestPointerEvent;
2456
+ const finalPanInfo = panInfo || this.latestPanInfo;
2457
+ const isDragging2 = this.isDragging;
2458
+ this.cancel();
2459
+ if (!isDragging2 || !finalPanInfo || !finalEvent) return;
2460
+ const { velocity } = finalPanInfo;
2461
+ this.startAnimation(velocity);
2462
+ const { onDragEnd } = this.getProps();
2463
+ if (onDragEnd) frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));
2464
+ }
2465
+ /**
2466
+ * @internal
2467
+ */
2468
+ cancel() {
2469
+ this.isDragging = false;
2470
+ const { projection, animationState } = this.visualElement;
2471
+ if (projection) projection.isAnimationBlocked = false;
2472
+ this.endPanSession();
2473
+ const { dragPropagation } = this.getProps();
2474
+ if (!dragPropagation && this.openDragLock) {
2475
+ this.openDragLock();
2476
+ this.openDragLock = null;
2477
+ }
2478
+ animationState && animationState.setActive("whileDrag", false);
2479
+ }
2480
+ /**
2481
+ * Clean up the pan session without modifying other drag state.
2482
+ * This is used during unmount to ensure event listeners are removed
2483
+ * without affecting projection animations or drag locks.
2484
+ * @internal
2485
+ */
2486
+ endPanSession() {
2487
+ this.panSession && this.panSession.end();
2488
+ this.panSession = void 0;
2489
+ }
2490
+ updateAxis(axis, _point, offset) {
2491
+ const { drag: drag2 } = this.getProps();
2492
+ if (!offset || !shouldDrag(axis, drag2, this.currentDirection)) return;
2493
+ const axisValue = this.getAxisMotionValue(axis);
2494
+ let next = this.originPoint[axis] + offset[axis];
2495
+ if (this.constraints && this.constraints[axis]) next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
2496
+ axisValue.set(next);
2497
+ }
2498
+ resolveConstraints() {
2499
+ const { dragConstraints, dragElastic } = this.getProps();
2500
+ const layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : this.visualElement.projection?.layout;
2501
+ const prevConstraints = this.constraints;
2502
+ if (dragConstraints && isRefObject(dragConstraints)) {
2503
+ if (!this.constraints) this.constraints = this.resolveRefConstraints();
2504
+ } else if (dragConstraints && layout2) this.constraints = calcRelativeConstraints(layout2.layoutBox, dragConstraints);
2505
+ else this.constraints = false;
2506
+ this.elastic = resolveDragElastic(dragElastic);
2507
+ if (prevConstraints !== this.constraints && !isRefObject(dragConstraints) && layout2 && this.constraints && !this.hasMutatedConstraints) eachAxis((axis) => {
2508
+ if (this.constraints !== false && this.getAxisMotionValue(axis)) this.constraints[axis] = rebaseAxisConstraints(layout2.layoutBox[axis], this.constraints[axis]);
2509
+ });
2510
+ }
2511
+ resolveRefConstraints() {
2512
+ const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
2513
+ if (!constraints || !isRefObject(constraints)) return false;
2514
+ const constraintsElement = constraints.current;
2515
+ invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
2516
+ const { projection } = this.visualElement;
2517
+ if (!projection || !projection.layout) return false;
2518
+ if (projection.root) {
2519
+ projection.root.scroll = void 0;
2520
+ projection.root.updateScroll();
2521
+ }
2522
+ const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
2523
+ let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
2524
+ if (onMeasureDragConstraints) {
2525
+ const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
2526
+ this.hasMutatedConstraints = !!userConstraints;
2527
+ if (userConstraints) measuredConstraints = convertBoundingBoxToBox(userConstraints);
2528
+ }
2529
+ return measuredConstraints;
2530
+ }
2531
+ startAnimation(velocity) {
2532
+ const { drag: drag2, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd } = this.getProps();
2533
+ const constraints = this.constraints || {};
2534
+ const momentumAnimations = eachAxis((axis) => {
2535
+ if (!shouldDrag(axis, drag2, this.currentDirection)) return;
2536
+ let transition = constraints && constraints[axis] || {};
2537
+ if (dragSnapToOrigin === true || dragSnapToOrigin === axis) transition = {
2538
+ min: 0,
2539
+ max: 0
2540
+ };
2541
+ const bounceStiffness = dragElastic ? 200 : 1e6;
2542
+ const bounceDamping = dragElastic ? 40 : 1e7;
2543
+ const inertia = {
2544
+ type: "inertia",
2545
+ velocity: dragMomentum ? velocity[axis] : 0,
2546
+ bounceStiffness,
2547
+ bounceDamping,
2548
+ timeConstant: 750,
2549
+ restDelta: 1,
2550
+ restSpeed: 10,
2551
+ ...dragTransition,
2552
+ ...transition
2553
+ };
2554
+ return this.startAxisValueAnimation(axis, inertia);
2555
+ });
2556
+ return Promise.all(momentumAnimations).then(onDragTransitionEnd);
2557
+ }
2558
+ startAxisValueAnimation(axis, transition) {
2559
+ const axisValue = this.getAxisMotionValue(axis);
2560
+ addValueToWillChange(this.visualElement, axis);
2561
+ return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));
2562
+ }
2563
+ stopAnimation() {
2564
+ eachAxis((axis) => this.getAxisMotionValue(axis).stop());
2565
+ }
2566
+ /**
2567
+ * Drag works differently depending on which props are provided.
2568
+ *
2569
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
2570
+ * - Otherwise, we apply the delta to the x/y motion values.
2571
+ */
2572
+ getAxisMotionValue(axis) {
2573
+ const dragKey = `_drag${axis.toUpperCase()}`;
2574
+ const externalMotionValue = this.visualElement.getProps()[dragKey];
2575
+ return externalMotionValue ? externalMotionValue : this.visualElement.getValue(axis, this.visualElement.latestValues[axis] ?? 0);
2576
+ }
2577
+ snapToCursor(point) {
2578
+ eachAxis((axis) => {
2579
+ const { drag: drag2 } = this.getProps();
2580
+ if (!shouldDrag(axis, drag2, this.currentDirection)) return;
2581
+ const { projection } = this.visualElement;
2582
+ const axisValue = this.getAxisMotionValue(axis);
2583
+ if (projection && projection.layout) {
2584
+ const { min, max } = projection.layout.layoutBox[axis];
2585
+ const current = axisValue.get() || 0;
2586
+ axisValue.set(point[axis] - mixNumber(min, max, 0.5) + current);
2587
+ }
2588
+ });
2589
+ }
2590
+ /**
2591
+ * When the viewport resizes we want to check if the measured constraints
2592
+ * have changed and, if so, reposition the element within those new constraints
2593
+ * relative to where it was before the resize.
2594
+ */
2595
+ scalePositionWithinConstraints() {
2596
+ if (!this.visualElement.current) return;
2597
+ const { drag: drag2, dragConstraints } = this.getProps();
2598
+ const { projection } = this.visualElement;
2599
+ if (!isRefObject(dragConstraints) || !projection || !this.constraints) return;
2600
+ this.stopAnimation();
2601
+ const boxProgress = {
2602
+ x: 0,
2603
+ y: 0
2604
+ };
2605
+ eachAxis((axis) => {
2606
+ const axisValue = this.getAxisMotionValue(axis);
2607
+ if (axisValue && this.constraints !== false) {
2608
+ const latest = axisValue.get();
2609
+ boxProgress[axis] = calcOrigin({
2610
+ min: latest,
2611
+ max: latest
2612
+ }, this.constraints[axis]);
2613
+ }
2614
+ });
2615
+ const { transformTemplate } = this.visualElement.getProps();
2616
+ this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none";
2617
+ projection.root && projection.root.updateScroll();
2618
+ projection.updateLayout();
2619
+ this.constraints = false;
2620
+ this.resolveConstraints();
2621
+ eachAxis((axis) => {
2622
+ if (!shouldDrag(axis, drag2, null)) return;
2623
+ const axisValue = this.getAxisMotionValue(axis);
2624
+ const { min, max } = this.constraints[axis];
2625
+ axisValue.set(mixNumber(min, max, boxProgress[axis]));
2626
+ });
2627
+ this.visualElement.render();
2628
+ }
2629
+ addListeners() {
2630
+ if (!this.visualElement.current) return;
2631
+ elementDragControls.set(this.visualElement, this);
2632
+ const element = this.visualElement.current;
2633
+ const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => {
2634
+ const { drag: drag2, dragListener = true } = this.getProps();
2635
+ const target = event.target;
2636
+ const isClickingTextInputChild = target !== element && isElementTextInput(target);
2637
+ if (drag2 && dragListener && !isClickingTextInputChild) this.start(event);
2638
+ });
2639
+ let stopResizeObservers;
2640
+ const measureDragConstraints = () => {
2641
+ const { dragConstraints } = this.getProps();
2642
+ if (isRefObject(dragConstraints) && dragConstraints.current) {
2643
+ this.constraints = this.resolveRefConstraints();
2644
+ if (!stopResizeObservers) stopResizeObservers = startResizeObservers(element, dragConstraints.current, () => this.scalePositionWithinConstraints());
2645
+ }
2646
+ };
2647
+ const { projection } = this.visualElement;
2648
+ const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
2649
+ if (projection && !projection.layout) {
2650
+ projection.root && projection.root.updateScroll();
2651
+ projection.updateLayout();
2652
+ }
2653
+ frame.read(measureDragConstraints);
2654
+ const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
2655
+ const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => {
2656
+ if (this.isDragging && hasLayoutChanged) {
2657
+ eachAxis((axis) => {
2658
+ const motionValue2 = this.getAxisMotionValue(axis);
2659
+ if (!motionValue2) return;
2660
+ this.originPoint[axis] += delta[axis].translate;
2661
+ motionValue2.set(motionValue2.get() + delta[axis].translate);
2662
+ });
2663
+ this.visualElement.render();
2664
+ }
2665
+ }));
2666
+ return () => {
2667
+ stopResizeListener();
2668
+ stopPointerListener();
2669
+ stopMeasureLayoutListener();
2670
+ stopLayoutUpdateListener && stopLayoutUpdateListener();
2671
+ stopResizeObservers && stopResizeObservers();
2672
+ };
2673
+ }
2674
+ getProps() {
2675
+ const props = this.visualElement.getProps();
2676
+ const { drag: drag2 = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true } = props;
2677
+ return {
2678
+ ...props,
2679
+ drag: drag2,
2680
+ dragDirectionLock,
2681
+ dragPropagation,
2682
+ dragConstraints,
2683
+ dragElastic,
2684
+ dragMomentum
2685
+ };
2686
+ }
2687
+ };
2688
+ function skipFirstCall(callback) {
2689
+ let isFirst = true;
2690
+ return () => {
2691
+ if (isFirst) {
2692
+ isFirst = false;
2693
+ return;
2694
+ }
2695
+ callback();
2696
+ };
2697
+ }
2698
+ function startResizeObservers(element, constraintsElement, onResize) {
2699
+ const stopElement = resize(element, skipFirstCall(onResize));
2700
+ const stopContainer = resize(constraintsElement, skipFirstCall(onResize));
2701
+ return () => {
2702
+ stopElement();
2703
+ stopContainer();
2704
+ };
2705
+ }
2706
+ function shouldDrag(direction, drag2, currentDirection) {
2707
+ return (drag2 === true || drag2 === direction) && (currentDirection === null || currentDirection === direction);
2708
+ }
2709
+ function getCurrentDirection(offset, lockThreshold = 10) {
2710
+ let direction = null;
2711
+ if (Math.abs(offset.y) > lockThreshold) direction = "y";
2712
+ else if (Math.abs(offset.x) > lockThreshold) direction = "x";
2713
+ return direction;
2714
+ }
2715
+ var DragGesture = class extends Feature {
2716
+ constructor(node) {
2717
+ super(node);
2718
+ this.removeGroupControls = noop;
2719
+ this.removeListeners = noop;
2720
+ this.controls = new VisualElementDragControls(node);
2721
+ }
2722
+ mount() {
2723
+ const { dragControls } = this.node.getProps();
2724
+ if (dragControls) this.removeGroupControls = dragControls.subscribe(this.controls);
2725
+ this.removeListeners = this.controls.addListeners() || noop;
2726
+ }
2727
+ update() {
2728
+ const { dragControls } = this.node.getProps();
2729
+ const { dragControls: prevDragControls } = this.node.prevProps || {};
2730
+ if (dragControls !== prevDragControls) {
2731
+ this.removeGroupControls();
2732
+ if (dragControls) this.removeGroupControls = dragControls.subscribe(this.controls);
2733
+ }
2734
+ }
2735
+ unmount() {
2736
+ this.removeGroupControls();
2737
+ this.removeListeners();
2738
+ if (!this.controls.isDragging) this.controls.endPanSession();
2739
+ }
2740
+ };
2741
+ var asyncHandler = (handler) => (event, info) => {
2742
+ if (handler) frame.update(() => handler(event, info), false, true);
2743
+ };
2744
+ var PanGesture = class extends Feature {
2745
+ constructor() {
2746
+ super(...arguments);
2747
+ this.removePointerDownListener = noop;
2748
+ }
2749
+ onPointerDown(pointerDownEvent) {
2750
+ this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {
2751
+ transformPagePoint: this.node.getTransformPagePoint(),
2752
+ contextWindow: getContextWindow(this.node)
2753
+ });
2754
+ }
2755
+ createPanHandlers() {
2756
+ const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
2757
+ return {
2758
+ onSessionStart: asyncHandler(onPanSessionStart),
2759
+ onStart: asyncHandler(onPanStart),
2760
+ onMove: asyncHandler(onPan),
2761
+ onEnd: (event, info) => {
2762
+ delete this.session;
2763
+ if (onPanEnd) frame.postRender(() => onPanEnd(event, info));
2764
+ }
2765
+ };
2766
+ }
2767
+ mount() {
2768
+ this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
2769
+ }
2770
+ update() {
2771
+ this.session && this.session.updateHandlers(this.createPanHandlers());
2772
+ }
2773
+ unmount() {
2774
+ this.removePointerDownListener();
2775
+ this.session && this.session.end();
2776
+ }
2777
+ };
2778
+ var hasTakenAnySnapshot = false;
2779
+ var MeasureLayoutWithContext = class extends Component {
2780
+ /**
2781
+ * This only mounts projection nodes for components that
2782
+ * need measuring, we might want to do it for all components
2783
+ * in order to incorporate transforms
2784
+ */
2785
+ componentDidMount() {
2786
+ const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
2787
+ const { projection } = visualElement;
2788
+ if (projection) {
2789
+ if (layoutGroup.group) layoutGroup.group.add(projection);
2790
+ if (switchLayoutGroup && switchLayoutGroup.register && layoutId) switchLayoutGroup.register(projection);
2791
+ if (hasTakenAnySnapshot) projection.root.didUpdate();
2792
+ projection.addEventListener("animationComplete", () => {
2793
+ this.safeToRemove();
2794
+ });
2795
+ projection.setOptions({
2796
+ ...projection.options,
2797
+ layoutDependency: this.props.layoutDependency,
2798
+ onExitComplete: () => this.safeToRemove()
2799
+ });
2800
+ }
2801
+ globalProjectionState.hasEverUpdated = true;
2802
+ }
2803
+ getSnapshotBeforeUpdate(prevProps) {
2804
+ const { layoutDependency, visualElement, drag: drag2, isPresent } = this.props;
2805
+ const { projection } = visualElement;
2806
+ if (!projection) return null;
2807
+ projection.isPresent = isPresent;
2808
+ if (prevProps.layoutDependency !== layoutDependency) projection.setOptions({
2809
+ ...projection.options,
2810
+ layoutDependency
2811
+ });
2812
+ hasTakenAnySnapshot = true;
2813
+ if (drag2 || prevProps.layoutDependency !== layoutDependency || layoutDependency === void 0 || prevProps.isPresent !== isPresent) projection.willUpdate();
2814
+ else this.safeToRemove();
2815
+ if (prevProps.isPresent !== isPresent) {
2816
+ if (isPresent) projection.promote();
2817
+ else if (!projection.relegate())
2818
+ frame.postRender(() => {
2819
+ const stack = projection.getStack();
2820
+ if (!stack || !stack.members.length) this.safeToRemove();
2821
+ });
2822
+ }
2823
+ return null;
2824
+ }
2825
+ componentDidUpdate() {
2826
+ const { visualElement, layoutAnchor } = this.props;
2827
+ const { projection } = visualElement;
2828
+ if (projection) {
2829
+ projection.options.layoutAnchor = layoutAnchor;
2830
+ projection.root.didUpdate();
2831
+ microtask.postRender(() => {
2832
+ if (!projection.currentAnimation && projection.isLead()) this.safeToRemove();
2833
+ });
2834
+ }
2835
+ }
2836
+ componentWillUnmount() {
2837
+ const { visualElement, layoutGroup, switchLayoutGroup: promoteContext } = this.props;
2838
+ const { projection } = visualElement;
2839
+ hasTakenAnySnapshot = true;
2840
+ if (projection) {
2841
+ projection.scheduleCheckAfterUnmount();
2842
+ if (layoutGroup && layoutGroup.group) layoutGroup.group.remove(projection);
2843
+ if (promoteContext && promoteContext.deregister) promoteContext.deregister(projection);
2844
+ }
2845
+ }
2846
+ safeToRemove() {
2847
+ const { safeToRemove } = this.props;
2848
+ safeToRemove && safeToRemove();
2849
+ }
2850
+ render() {
2851
+ return null;
2852
+ }
2853
+ };
2854
+ function MeasureLayout(props) {
2855
+ const [isPresent, safeToRemove] = usePresence();
2856
+ const layoutGroup = useContext(LayoutGroupContext);
2857
+ return jsx(MeasureLayoutWithContext, {
2858
+ ...props,
2859
+ layoutGroup,
2860
+ switchLayoutGroup: useContext(SwitchLayoutGroupContext),
2861
+ isPresent,
2862
+ safeToRemove
2863
+ });
2864
+ }
2865
+ var drag = {
2866
+ pan: { Feature: PanGesture },
2867
+ drag: {
2868
+ Feature: DragGesture,
2869
+ ProjectionNode: HTMLProjectionNode,
2870
+ MeasureLayout
2871
+ }
2872
+ };
2873
+ function handleHoverEvent(node, event, lifecycle) {
2874
+ const { props } = node;
2875
+ if (node.animationState && props.whileHover) node.animationState.setActive("whileHover", lifecycle === "Start");
2876
+ const callback = props["onHover" + lifecycle];
2877
+ if (callback) frame.postRender(() => callback(event, extractEventInfo(event)));
2878
+ }
2879
+ var HoverGesture = class extends Feature {
2880
+ mount() {
2881
+ const { current } = this.node;
2882
+ if (!current) return;
2883
+ this.unmount = hover(current, (_element, startEvent) => {
2884
+ handleHoverEvent(this.node, startEvent, "Start");
2885
+ return (endEvent) => handleHoverEvent(this.node, endEvent, "End");
2886
+ });
2887
+ }
2888
+ unmount() {
2889
+ }
2890
+ };
2891
+ var FocusGesture = class extends Feature {
2892
+ constructor() {
2893
+ super(...arguments);
2894
+ this.isActive = false;
2895
+ }
2896
+ onFocus() {
2897
+ let isFocusVisible = false;
2898
+ try {
2899
+ isFocusVisible = this.node.current.matches(":focus-visible");
2900
+ } catch (e) {
2901
+ isFocusVisible = true;
2902
+ }
2903
+ if (!isFocusVisible || !this.node.animationState) return;
2904
+ this.node.animationState.setActive("whileFocus", true);
2905
+ this.isActive = true;
2906
+ }
2907
+ onBlur() {
2908
+ if (!this.isActive || !this.node.animationState) return;
2909
+ this.node.animationState.setActive("whileFocus", false);
2910
+ this.isActive = false;
2911
+ }
2912
+ mount() {
2913
+ this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
2914
+ }
2915
+ unmount() {
2916
+ }
2917
+ };
2918
+ function handlePressEvent(node, event, lifecycle) {
2919
+ const { props } = node;
2920
+ if (node.current instanceof HTMLButtonElement && node.current.disabled) return;
2921
+ if (node.animationState && props.whileTap) node.animationState.setActive("whileTap", lifecycle === "Start");
2922
+ const callback = props["onTap" + (lifecycle === "End" ? "" : lifecycle)];
2923
+ if (callback) frame.postRender(() => callback(event, extractEventInfo(event)));
2924
+ }
2925
+ var PressGesture = class extends Feature {
2926
+ mount() {
2927
+ const { current } = this.node;
2928
+ if (!current) return;
2929
+ const { globalTapTarget, propagate } = this.node.props;
2930
+ this.unmount = press(current, (_element, startEvent) => {
2931
+ handlePressEvent(this.node, startEvent, "Start");
2932
+ return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel");
2933
+ }, {
2934
+ useGlobalTarget: globalTapTarget,
2935
+ stopPropagation: propagate?.tap === false
2936
+ });
2937
+ }
2938
+ unmount() {
2939
+ }
2940
+ };
2941
+ var observerCallbacks = /* @__PURE__ */ new WeakMap();
2942
+ var observers = /* @__PURE__ */ new WeakMap();
2943
+ var fireObserverCallback = (entry) => {
2944
+ const callback = observerCallbacks.get(entry.target);
2945
+ callback && callback(entry);
2946
+ };
2947
+ var fireAllObserverCallbacks = (entries) => {
2948
+ entries.forEach(fireObserverCallback);
2949
+ };
2950
+ function initIntersectionObserver({ root: root2, ...options }) {
2951
+ const lookupRoot = root2 || document;
2952
+ if (!observers.has(lookupRoot)) observers.set(lookupRoot, {});
2953
+ const rootObservers = observers.get(lookupRoot);
2954
+ const key = JSON.stringify(options);
2955
+ if (!rootObservers[key]) rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, {
2956
+ root: root2,
2957
+ ...options
2958
+ });
2959
+ return rootObservers[key];
2960
+ }
2961
+ function observeIntersection(element, options, callback) {
2962
+ const rootInteresectionObserver = initIntersectionObserver(options);
2963
+ observerCallbacks.set(element, callback);
2964
+ rootInteresectionObserver.observe(element);
2965
+ return () => {
2966
+ observerCallbacks.delete(element);
2967
+ rootInteresectionObserver.unobserve(element);
2968
+ };
2969
+ }
2970
+ var thresholdNames = {
2971
+ some: 0,
2972
+ all: 1
2973
+ };
2974
+ var InViewFeature = class extends Feature {
2975
+ constructor() {
2976
+ super(...arguments);
2977
+ this.hasEnteredView = false;
2978
+ this.isInView = false;
2979
+ }
2980
+ startObserver() {
2981
+ this.stopObserver?.();
2982
+ const { viewport = {} } = this.node.getProps();
2983
+ const { root: root2, margin: rootMargin, amount = "some", once } = viewport;
2984
+ const options = {
2985
+ root: root2 ? root2.current : void 0,
2986
+ rootMargin,
2987
+ threshold: typeof amount === "number" ? amount : thresholdNames[amount]
2988
+ };
2989
+ const onIntersectionUpdate = (entry) => {
2990
+ const { isIntersecting } = entry;
2991
+ if (this.isInView === isIntersecting) return;
2992
+ this.isInView = isIntersecting;
2993
+ if (once && !isIntersecting && this.hasEnteredView) return;
2994
+ else if (isIntersecting) this.hasEnteredView = true;
2995
+ if (this.node.animationState) this.node.animationState.setActive("whileInView", isIntersecting);
2996
+ const { onViewportEnter, onViewportLeave } = this.node.getProps();
2997
+ const callback = isIntersecting ? onViewportEnter : onViewportLeave;
2998
+ callback && callback(entry);
2999
+ };
3000
+ this.stopObserver = observeIntersection(this.node.current, options, onIntersectionUpdate);
3001
+ }
3002
+ mount() {
3003
+ this.startObserver();
3004
+ }
3005
+ update() {
3006
+ if (typeof IntersectionObserver === "undefined") return;
3007
+ const { props, prevProps } = this.node;
3008
+ if ([
3009
+ "amount",
3010
+ "margin",
3011
+ "root"
3012
+ ].some(hasViewportOptionChanged(props, prevProps))) this.startObserver();
3013
+ }
3014
+ unmount() {
3015
+ this.stopObserver?.();
3016
+ this.hasEnteredView = false;
3017
+ this.isInView = false;
3018
+ }
3019
+ };
3020
+ function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
3021
+ return (name) => viewport[name] !== prevViewport[name];
3022
+ }
3023
+ var gestureAnimations = {
3024
+ inView: { Feature: InViewFeature },
3025
+ tap: { Feature: PressGesture },
3026
+ focus: { Feature: FocusGesture },
3027
+ hover: { Feature: HoverGesture }
3028
+ };
3029
+ var layout = { layout: {
3030
+ ProjectionNode: HTMLProjectionNode,
3031
+ MeasureLayout
3032
+ } };
110
3033
  var domMax = {
111
- ...domAnimation,
3034
+ renderer: createDomVisualElement,
3035
+ ...animations,
3036
+ ...gestureAnimations,
112
3037
  ...drag,
113
3038
  ...layout
114
3039
  };
@@ -125,13 +3050,33 @@ function NotFoundPage({ title = "404", description = "The requested page could n
125
3050
  })
126
3051
  });
127
3052
  }
3053
+ function useHtmlReducedMotionClass() {
3054
+ const [reduced, setReduced] = useState(false);
3055
+ useLayoutEffect(() => {
3056
+ const root2 = document.documentElement;
3057
+ const sync = () => setReduced(root2.classList.contains("reduce-motion"));
3058
+ sync();
3059
+ const observer2 = new MutationObserver(sync);
3060
+ observer2.observe(root2, {
3061
+ attributes: true,
3062
+ attributeFilter: ["class"]
3063
+ });
3064
+ return () => observer2.disconnect();
3065
+ }, []);
3066
+ return reduced;
3067
+ }
128
3068
  function MotionRuntime({ children }) {
3069
+ const htmlReduced = useHtmlReducedMotionClass();
129
3070
  return /* @__PURE__ */ jsx(LazyMotion, {
130
3071
  features: domMax,
131
- children
3072
+ strict: true,
3073
+ children: /* @__PURE__ */ jsx(MotionConfig, {
3074
+ reducedMotion: htmlReduced ? "always" : "user",
3075
+ children
3076
+ })
132
3077
  });
133
3078
  }
134
- var globals_default = "/assets/globals-CuIiqOTg.css";
3079
+ var globals_default = "/assets/globals-DCtBkCSD.css";
135
3080
  function makeQueryClient() {
136
3081
  return new QueryClient({ defaultOptions: { queries: {
137
3082
  staleTime: 6e4,
@@ -145,7 +3090,7 @@ function getQueryClient() {
145
3090
  if (!browserQueryClient) browserQueryClient = makeQueryClient();
146
3091
  return browserQueryClient;
147
3092
  }
148
- var Route$29 = createRootRoute({
3093
+ var Route$26 = createRootRoute({
149
3094
  head: () => ({
150
3095
  meta: [
151
3096
  { charSet: "utf-8" },
@@ -192,9 +3137,7 @@ var Route$29 = createRootRoute({
192
3137
  });
193
3138
  function RootComponent() {
194
3139
  useLayoutEffect(() => {
195
- const preferences = readUiPreferences();
196
- document.documentElement.dataset.density = preferences.density;
197
- document.documentElement.classList.toggle("reduce-motion", preferences.motion === "reduced");
3140
+ applyUiPreferencesToDocument(readUiPreferences());
198
3141
  }, []);
199
3142
  useEffect(() => {
200
3143
  initAnalytics();
@@ -215,8 +3158,8 @@ function RootDocument({ children }) {
215
3158
  ] })]
216
3159
  });
217
3160
  }
218
- var $$splitComponentImporter = () => import("./routes-BGrVtPYF-SURPAJN6.js");
219
- var Route$28 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter, "component") });
3161
+ var $$splitComponentImporter = () => import("./routes-hkom6S6L-DUPPQHPY.js");
3162
+ var Route$25 = createFileRoute("/")({ component: lazyRouteComponent($$splitComponentImporter, "component") });
220
3163
  var ManagedAttachmentValidationError = class extends Error {
221
3164
  status;
222
3165
  constructor(message, status) {
@@ -2292,8 +5235,8 @@ function createPrimeConfig(initialCwd) {
2292
5235
  const authStorage = AuthStorage.create();
2293
5236
  const modelRegistry2 = ModelRegistry.create(authStorage);
2294
5237
  const projectRegistry = new ProjectRegistry(agentDir, initialCwd);
2295
- let currentDefaultCwd = resolve(initialCwd);
2296
- let defaultSettings = SettingsManager.create(currentDefaultCwd);
5238
+ const currentDefaultCwd = resolve(initialCwd);
5239
+ const defaultSettings = SettingsManager.create(currentDefaultCwd);
2297
5240
  const settingsByCwd = /* @__PURE__ */ new Map();
2298
5241
  settingsByCwd.set(currentDefaultCwd, defaultSettings);
2299
5242
  return {
@@ -2325,17 +5268,6 @@ function createPrimeConfig(initialCwd) {
2325
5268
  await loader.reload();
2326
5269
  return loader;
2327
5270
  },
2328
- setDefaultCwd(cwd) {
2329
- const next = resolve(cwd);
2330
- currentDefaultCwd = next;
2331
- const existing = settingsByCwd.get(next);
2332
- if (existing) {
2333
- defaultSettings = existing;
2334
- return;
2335
- }
2336
- defaultSettings = SettingsManager.create(next);
2337
- settingsByCwd.set(next, defaultSettings);
2338
- },
2339
5271
  reloadAuth() {
2340
5272
  this.authStorage.reload();
2341
5273
  this.modelRegistry.refresh();
@@ -2345,7 +5277,7 @@ function createPrimeConfig(initialCwd) {
2345
5277
  function getPrimeConfig() {
2346
5278
  const globalStore2 = globalThis;
2347
5279
  const existing = globalStore2.__primeConfig;
2348
- if (!existing || typeof existing.setDefaultCwd !== "function" || !existing.projectRegistry) globalStore2.__primeConfig = createPrimeConfig(resolveDefaultWorkspaceRoot(process.cwd()));
5280
+ if (!existing || !existing.projectRegistry) globalStore2.__primeConfig = createPrimeConfig(resolveDefaultWorkspaceRoot(process.cwd()));
2349
5281
  return globalStore2.__primeConfig;
2350
5282
  }
2351
5283
  var DAEMON_STARTUP_TIMEOUT_MS = 3e4;
@@ -2942,11 +5874,11 @@ function stringifyPayload(value) {
2942
5874
  return String(value);
2943
5875
  }
2944
5876
  }
2945
- function createPayloadPart(kind, title, payload, text, id) {
5877
+ function createPayloadPart(kind, title, payload, text, id2) {
2946
5878
  const safePayload = browserSafePayload(payload);
2947
5879
  return {
2948
5880
  type: "payload",
2949
- ...id ? { id } : {},
5881
+ ...id2 ? { id: id2 } : {},
2950
5882
  kind,
2951
5883
  title,
2952
5884
  ...text ? { text } : {},
@@ -2956,7 +5888,7 @@ function createPayloadPart(kind, title, payload, text, id) {
2956
5888
  function textFromChatParts(parts) {
2957
5889
  return parts.filter((part) => part.type === "text").map((part) => part.text).join("\n");
2958
5890
  }
2959
- function toChatMessageFromRuntimeMessage(message, id) {
5891
+ function toChatMessageFromRuntimeMessage(message, id2) {
2960
5892
  const value = message;
2961
5893
  const role = typeof value.role === "string" ? value.role : "runtime";
2962
5894
  const timestamp = getTimestamp(message);
@@ -2974,7 +5906,7 @@ function toChatMessageFromRuntimeMessage(message, id) {
2974
5906
  cancelled ? "(cancelled)" : status
2975
5907
  ].filter((part) => Boolean(part)).join("\n");
2976
5908
  return {
2977
- id,
5909
+ id: id2,
2978
5910
  role: "assistant",
2979
5911
  parts: [createPayloadPart("bashExecution", "Bash", {
2980
5912
  command,
@@ -2983,7 +5915,7 @@ function toChatMessageFromRuntimeMessage(message, id) {
2983
5915
  cancelled,
2984
5916
  truncated,
2985
5917
  excludeFromContext: value.excludeFromContext === true
2986
- }, text, id)],
5918
+ }, text, id2)],
2987
5919
  createdAt: timestamp
2988
5920
  };
2989
5921
  }
@@ -2997,23 +5929,23 @@ function toChatMessageFromRuntimeMessage(message, id) {
2997
5929
  ...details !== void 0 ? { details } : {}
2998
5930
  };
2999
5931
  return {
3000
- id,
5932
+ id: id2,
3001
5933
  role: "assistant",
3002
- parts: [...contentParts2, createPayloadPart(customType, `[${customType}]`, payload2, textFromChatParts(contentParts2) ? void 0 : stringifyPayload(details), id)],
5934
+ parts: [...contentParts2, createPayloadPart(customType, `[${customType}]`, payload2, textFromChatParts(contentParts2) ? void 0 : stringifyPayload(details), id2)],
3003
5935
  createdAt: timestamp
3004
5936
  };
3005
5937
  }
3006
5938
  if (role === "branchSummary") {
3007
5939
  const summary = typeof value.summary === "string" ? value.summary : "";
3008
5940
  return {
3009
- id,
5941
+ id: id2,
3010
5942
  role: "assistant",
3011
5943
  parts: [createPayloadPart("branchSummary", "Branch summary", {
3012
5944
  fromId: value.fromId,
3013
5945
  summary
3014
5946
  }, `Branch Summary
3015
5947
 
3016
- ${summary}`, id)],
5948
+ ${summary}`, id2)],
3017
5949
  createdAt: timestamp
3018
5950
  };
3019
5951
  }
@@ -3023,7 +5955,7 @@ ${summary}`, id)],
3023
5955
  const customInstructions = typeof value.customInstructions === "string" ? value.customInstructions : void 0;
3024
5956
  const tokenLabel = tokensBefore === void 0 ? "" : `Compacted from ${tokensBefore.toLocaleString()} tokens`;
3025
5957
  return {
3026
- id,
5958
+ id: id2,
3027
5959
  role: "assistant",
3028
5960
  parts: [createPayloadPart("compactionSummary", "Compaction summary", {
3029
5961
  summary,
@@ -3034,7 +5966,7 @@ ${summary}`, id)],
3034
5966
  tokenLabel,
3035
5967
  customInstructions ? `Focus: ${customInstructions}` : void 0,
3036
5968
  summary
3037
- ].filter((part) => Boolean(part)).join("\n\n"), id)],
5969
+ ].filter((part) => Boolean(part)).join("\n\n"), id2)],
3038
5970
  createdAt: timestamp
3039
5971
  };
3040
5972
  }
@@ -3042,13 +5974,13 @@ ${summary}`, id)],
3042
5974
  const contentParts = contentToChatParts(value.content);
3043
5975
  const payload = browserSafePayload(Object.fromEntries(Object.entries(value).filter(([key]) => key !== "content")));
3044
5976
  return {
3045
- id,
5977
+ id: id2,
3046
5978
  role: "assistant",
3047
- parts: [...contentParts, createPayloadPart(role, `[${role}]`, payload, textFromChatParts(contentParts) ? void 0 : stringifyPayload(payload), id)],
5979
+ parts: [...contentParts, createPayloadPart(role, `[${role}]`, payload, textFromChatParts(contentParts) ? void 0 : stringifyPayload(payload), id2)],
3048
5980
  createdAt: timestamp
3049
5981
  };
3050
5982
  }
3051
- function toChatMessageFromAssistant(msg, id) {
5983
+ function toChatMessageFromAssistant(msg, id2) {
3052
5984
  const parts = [];
3053
5985
  for (const block of msg.content) {
3054
5986
  const value = block;
@@ -3082,15 +6014,15 @@ function toChatMessageFromAssistant(msg, id) {
3082
6014
  message: errorMessage
3083
6015
  });
3084
6016
  return {
3085
- id,
6017
+ id: id2,
3086
6018
  role: "assistant",
3087
6019
  parts,
3088
6020
  createdAt: getTimestamp(msg)
3089
6021
  };
3090
6022
  }
3091
- function toChatMessageFromUser(msg, id) {
6023
+ function toChatMessageFromUser(msg, id2) {
3092
6024
  return {
3093
- id,
6025
+ id: id2,
3094
6026
  role: "user",
3095
6027
  parts: contentToChatParts(msg.content),
3096
6028
  createdAt: getTimestamp(msg)
@@ -3224,16 +6156,16 @@ function toChatMessagesFromAgentMessages(messages, sessionId) {
3224
6156
  const output = [];
3225
6157
  for (const [index, message] of messages.entries()) {
3226
6158
  const role = message.role;
3227
- const id = `${sessionId}-m${index}`;
6159
+ const id2 = `${sessionId}-m${index}`;
3228
6160
  if (role === "assistant") {
3229
- output.push(toChatMessageFromAssistant(message, id));
6161
+ output.push(toChatMessageFromAssistant(message, id2));
3230
6162
  continue;
3231
6163
  }
3232
6164
  if (role === "user") {
3233
- output.push(toChatMessageFromUser(message, id));
6165
+ output.push(toChatMessageFromUser(message, id2));
3234
6166
  continue;
3235
6167
  }
3236
- const runtimeMessage = toChatMessageFromRuntimeMessage(message, id);
6168
+ const runtimeMessage = toChatMessageFromRuntimeMessage(message, id2);
3237
6169
  if (runtimeMessage) {
3238
6170
  output.push(runtimeMessage);
3239
6171
  continue;
@@ -3250,10 +6182,10 @@ function toChatMessagesFromAgentMessages(messages, sessionId) {
3250
6182
  let attached = false;
3251
6183
  if (toolCallId) for (let messageIndex = output.length - 1; messageIndex >= 0 && !attached; messageIndex -= 1) {
3252
6184
  const candidate = output[messageIndex];
3253
- const partIndex = candidate.parts.findIndex((part2) => part2.type.startsWith("tool-") && part2.toolCallId === toolCallId);
6185
+ const partIndex = candidate.parts.findIndex((part2) => isChatToolPart(part2) && part2.toolCallId === toolCallId);
3254
6186
  if (partIndex < 0) continue;
3255
6187
  const part = candidate.parts[partIndex];
3256
- if (!part.type.startsWith("tool-")) continue;
6188
+ if (!isChatToolPart(part)) continue;
3257
6189
  const nextPart = {
3258
6190
  ...part,
3259
6191
  state: isError ? "output-error" : "output-available",
@@ -3270,7 +6202,7 @@ function toChatMessagesFromAgentMessages(messages, sessionId) {
3270
6202
  attached = true;
3271
6203
  }
3272
6204
  if (!attached) output.push({
3273
- id,
6205
+ id: id2,
3274
6206
  role: "assistant",
3275
6207
  createdAt: typeof result.timestamp === "number" ? result.timestamp : void 0,
3276
6208
  parts: [{
@@ -3395,8 +6327,8 @@ function computeRlmExecutionTree(rootSessionId, children, activeNodeId) {
3395
6327
  };
3396
6328
  for (const child of children) if (child.parentId && child.parentId !== rootSessionId && nodes[child.parentId]) nodes[child.parentId].childrenIds.push(child.id);
3397
6329
  else rootChildrenIds.push(child.id);
3398
- const queue = rootChildrenIds.map((id) => ({
3399
- id,
6330
+ const queue = rootChildrenIds.map((id2) => ({
6331
+ id: id2,
3400
6332
  depth: 1
3401
6333
  }));
3402
6334
  const visited = /* @__PURE__ */ new Set();
@@ -3621,8 +6553,8 @@ function rememberSentAgentMessage(state, toolCallId, message) {
3621
6553
  const safeMessage = browserSafePayload(message);
3622
6554
  if (safeMessage === void 0) return;
3623
6555
  const messages = state.currentToolSentAgentMessages[toolCallId] ?? [];
3624
- const id = sentAgentMessageId(safeMessage);
3625
- if (id && messages.some((entry) => sentAgentMessageId(entry) === id)) return;
6556
+ const id2 = sentAgentMessageId(safeMessage);
6557
+ if (id2 && messages.some((entry) => sentAgentMessageId(entry) === id2)) return;
3626
6558
  state.currentToolSentAgentMessages[toolCallId] = [...messages, safeMessage];
3627
6559
  }
3628
6560
  function withSentAgentMessages(state, toolCallId, value) {
@@ -3740,8 +6672,8 @@ function mapCoreAgentEvent(state, event) {
3740
6672
  }];
3741
6673
  case "message_start":
3742
6674
  if (isUserMessage(event.message)) {
3743
- const id = `${state.runId}-u${state.userMessages.length}`;
3744
- const message = toChatMessageFromUser(event.message, id);
6675
+ const id2 = `${state.runId}-u${state.userMessages.length}`;
6676
+ const message = toChatMessageFromUser(event.message, id2);
3745
6677
  state.userMessages.push(message);
3746
6678
  return [{
3747
6679
  type: "message",
@@ -4056,10 +6988,10 @@ function mapSessionSpecificEvent(state, event) {
4056
6988
  })];
4057
6989
  case "bash_start": {
4058
6990
  const runId = event.runId ?? stablePresentationId(`bash:${state.sessionId}:${state.userBashSequence++}:${event.command}`);
4059
- const id = stablePresentationId(`user-bash:${runId}`);
4060
- state.activeUserBashId = id;
6991
+ const id2 = stablePresentationId(`user-bash:${runId}`);
6992
+ state.activeUserBashId = id2;
4061
6993
  const entry = {
4062
- id,
6994
+ id: id2,
4063
6995
  runId,
4064
6996
  command: event.command,
4065
6997
  output: "",
@@ -4113,10 +7045,10 @@ function mapSessionSpecificEvent(state, event) {
4113
7045
  }))];
4114
7046
  }
4115
7047
  case "refine_failed": {
4116
- const id = stablePresentationId(`${presentationRunId(state)}:refinement:${state.presentation.refinements.length}`);
7048
+ const id2 = stablePresentationId(`${presentationRunId(state)}:refinement:${state.presentation.refinements.length}`);
4117
7049
  const timestamp = Date.now();
4118
7050
  const refinement = {
4119
- id,
7051
+ id: id2,
4120
7052
  summary: "Refinement failed",
4121
7053
  rationale: "",
4122
7054
  expectedOutcome: "",
@@ -4129,9 +7061,9 @@ function mapSessionSpecificEvent(state, event) {
4129
7061
  ...state.presentation,
4130
7062
  refinements: [...state.presentation.refinements, refinement]
4131
7063
  }, {
4132
- id: stablePresentationId(`${presentationRunId(state)}:${id}:refinement`),
7064
+ id: stablePresentationId(`${presentationRunId(state)}:${id2}:refinement`),
4133
7065
  runId: presentationRunId(state),
4134
- sourceToolCallId: id,
7066
+ sourceToolCallId: id2,
4135
7067
  kind: "refinement",
4136
7068
  title: refinement.summary,
4137
7069
  status: "error",
@@ -4449,7 +7381,7 @@ var PendingDialogRegistry = class {
4449
7381
  if (!dialog) return false;
4450
7382
  clearTimeout(dialog.timer);
4451
7383
  this.bySession.get(sessionId)?.delete(toolCallId);
4452
- const frame = {
7384
+ const frame2 = {
4453
7385
  type: "tool",
4454
7386
  part: {
4455
7387
  type: "tool-Question",
@@ -4462,7 +7394,7 @@ var PendingDialogRegistry = class {
4462
7394
  }
4463
7395
  }
4464
7396
  };
4465
- this.emitFrame(sessionId, frame);
7397
+ this.emitFrame(sessionId, frame2);
4466
7398
  dialog.reject(/* @__PURE__ */ new Error(`Question cancelled: ${reason}`));
4467
7399
  return true;
4468
7400
  }
@@ -4857,7 +7789,7 @@ var PrimeBridge = class {
4857
7789
  this.#childPromptStarter = options.childPromptStarter ?? startDaemonChildPrompt;
4858
7790
  this.#dialogs = new PendingDialogRegistry({
4859
7791
  defaultTimeoutMs: options.dialogTimeoutMs ?? 6e4,
4860
- emitFrame: (sessionId, frame) => this.#dispatch(sessionId, frame)
7792
+ emitFrame: (sessionId, frame2) => this.#dispatch(sessionId, frame2)
4861
7793
  });
4862
7794
  }
4863
7795
  /** Late-boot kernel readiness gate. Boot-time callers await this; failures cause `/api/chat` to 503. */
@@ -4896,11 +7828,11 @@ var PrimeBridge = class {
4896
7828
  return () => this.#listeners.delete(listener);
4897
7829
  }
4898
7830
  /** Emit a frame to ring buffer (SSE replay) and all live listeners. */
4899
- #dispatch(sessionId, frame) {
4900
- const next = frame.type === "done" && !(frame.sessionId ?? "").trim() ? {
4901
- ...frame,
7831
+ #dispatch(sessionId, frame2) {
7832
+ const next = frame2.type === "done" && !(frame2.sessionId ?? "").trim() ? {
7833
+ ...frame2,
4902
7834
  sessionId
4903
- } : frame;
7835
+ } : frame2;
4904
7836
  const buffer = this.#ringBuffers.get(sessionId);
4905
7837
  if (buffer) buffer.push(next);
4906
7838
  for (const listener of this.#listeners) listener(sessionId, next);
@@ -5040,7 +7972,7 @@ var PrimeBridge = class {
5040
7972
  await getPrimeConfig().projectRegistry.assignSession(sessionId, resolvedProjectId);
5041
7973
  const uiContext = createWebUIContext({
5042
7974
  sessionId,
5043
- emitFrame: (frame) => this.#dispatch(sessionId, frame),
7975
+ emitFrame: (frame2) => this.#dispatch(sessionId, frame2),
5044
7976
  dialogs: this.#dialogs
5045
7977
  });
5046
7978
  await webAgent.bindUiContext?.(uiContext);
@@ -5073,9 +8005,9 @@ var PrimeBridge = class {
5073
8005
  } catch {
5074
8006
  }
5075
8007
  const frames = mapAgentConnectionEvent(mapperState, event);
5076
- for (const frame of frames) {
5077
- if (frame.type === "presentation") this.#persistPresentation(sessionId, sessionPath, frame.presentation);
5078
- this.#dispatch(sessionId, frame);
8008
+ for (const frame2 of frames) {
8009
+ if (frame2.type === "presentation") this.#persistPresentation(sessionId, sessionPath, frame2.presentation);
8010
+ this.#dispatch(sessionId, frame2);
5079
8011
  }
5080
8012
  if (event.type === "session_resynced" || event.type === "session_event" && event.event.type === "rlm_child_update") this.#queueRlmChildMetadataRefresh(sessionId);
5081
8013
  });
@@ -5215,7 +8147,7 @@ var PrimeBridge = class {
5215
8147
  sessions2 = await this.#sessionLister();
5216
8148
  } catch {
5217
8149
  for (const child of parent.mapperState.presentation.rlmChildren) parent.mapperState.rlmChildOverrides.delete(child.id);
5218
- for (const frame of applyRlmChildStatusOverrides(parent.mapperState, /* @__PURE__ */ new Map())) this.#dispatch(rootSessionId, frame);
8150
+ for (const frame2 of applyRlmChildStatusOverrides(parent.mapperState, /* @__PURE__ */ new Map())) this.#dispatch(rootSessionId, frame2);
5219
8151
  return;
5220
8152
  }
5221
8153
  const { sessionsByIdentifier, sessionsByPath, rootIdentifiers, rootPaths } = await this.#resolveRlmLineage(sessions2, rootSessionId, parent.sessionPath);
@@ -5226,9 +8158,9 @@ var PrimeBridge = class {
5226
8158
  else parent.mapperState.rlmChildOverrides.delete(child.id);
5227
8159
  }
5228
8160
  const frames = applyRlmChildStatusOverrides(parent.mapperState, overrides);
5229
- for (const frame of frames) {
5230
- if (frame.type === "presentation") this.#persistPresentation(rootSessionId, parent.sessionPath, frame.presentation);
5231
- this.#dispatch(rootSessionId, frame);
8161
+ for (const frame2 of frames) {
8162
+ if (frame2.type === "presentation") this.#persistPresentation(rootSessionId, parent.sessionPath, frame2.presentation);
8163
+ this.#dispatch(rootSessionId, frame2);
5232
8164
  }
5233
8165
  }
5234
8166
  #childStreamStatus(child, summary) {
@@ -5323,12 +8255,12 @@ var PrimeBridge = class {
5323
8255
  terminal: true
5324
8256
  };
5325
8257
  const frames = mapAgentConnectionEvent(stream.mapperState, event);
5326
- for (const frame of frames) {
5327
- if (frame.type === "error") stream.snapshot = {
8258
+ for (const frame2 of frames) {
8259
+ if (frame2.type === "error") stream.snapshot = {
5328
8260
  ...stream.snapshot,
5329
8261
  status: "error"
5330
8262
  };
5331
- this.#dispatch(stream.channelId, frame);
8263
+ this.#dispatch(stream.channelId, frame2);
5332
8264
  }
5333
8265
  if (event.type === "session_event" && event.event.type === "rlm_child_update") this.#queueRlmChildMetadataRefresh(stream.parentSessionId);
5334
8266
  if (event.type === "session_replaced" || event.type === "session_resynced" || event.type === "closed" || event.type === "session_event" && (event.event.type === "agent_end" || event.event.type === "turn_end")) this.#queueRlmChildSnapshot(stream);
@@ -5625,12 +8557,6 @@ var PrimeBridge = class {
5625
8557
  session.openUIPrompt.artifact = artifact;
5626
8558
  session.openUIPrompt.prompt = nextPrompt;
5627
8559
  }
5628
- async steer(sessionId, text) {
5629
- await this.#requireSession(sessionId).connection.steer(text);
5630
- }
5631
- async followUp(sessionId, text) {
5632
- await this.#requireSession(sessionId).connection.followUp(text);
5633
- }
5634
8560
  async mutateQueuedMessage(sessionId, lane, index, expectedText, mutation) {
5635
8561
  const session = this.#requireSession(sessionId);
5636
8562
  const upstreamMutation = mutation.type === "delete" ? { type: "delete" } : {
@@ -5648,9 +8574,6 @@ var PrimeBridge = class {
5648
8574
  }
5649
8575
  };
5650
8576
  }
5651
- async deleteQueuedMessage(sessionId, lane, index, expectedText) {
5652
- return this.mutateQueuedMessage(sessionId, lane, index, expectedText, { type: "delete" });
5653
- }
5654
8577
  async abort(sessionId) {
5655
8578
  const session = this.#requireSession(sessionId);
5656
8579
  this.#dialogs.cancelAll(sessionId, "user-abort");
@@ -6097,10 +9020,10 @@ async function handleChatChildPost(bridge, parentSessionId, childId, message, st
6097
9020
  } catch {
6098
9021
  }
6099
9022
  };
6100
- const write = (frame) => {
9023
+ const write = (frame2) => {
6101
9024
  if (closed) return;
6102
9025
  try {
6103
- controller.enqueue(encoder.encode(`${JSON.stringify(frame)}
9026
+ controller.enqueue(encoder.encode(`${JSON.stringify(frame2)}
6104
9027
  `));
6105
9028
  } catch {
6106
9029
  }
@@ -6232,21 +9155,21 @@ ${attachmentContext.join("\n\n")}` : message;
6232
9155
  } catch {
6233
9156
  }
6234
9157
  };
6235
- const write = (frame) => {
9158
+ const write = (frame2) => {
6236
9159
  if (closed) return;
6237
9160
  try {
6238
- controller.enqueue(encoder.encode(`${JSON.stringify(frame)}
9161
+ controller.enqueue(encoder.encode(`${JSON.stringify(frame2)}
6239
9162
  `));
6240
9163
  } catch {
6241
9164
  }
6242
9165
  };
6243
- removeListener = bridge.addEventListener((sid, frame) => {
9166
+ removeListener = bridge.addEventListener((sid, frame2) => {
6244
9167
  if (sid !== session.sessionId) return;
6245
9168
  if (backendSessionCommand) return;
6246
- const nextFrame = frame.type === "done" && !frame.sessionReset ? {
6247
- ...frame,
9169
+ const nextFrame = frame2.type === "done" && !frame2.sessionReset ? {
9170
+ ...frame2,
6248
9171
  presentation: bridge.getPresentation(session.sessionId)
6249
- } : frame;
9172
+ } : frame2;
6250
9173
  write(nextFrame);
6251
9174
  if (nextFrame.type === "done" && !nextFrame.sessionReset) terminalDoneSent = true;
6252
9175
  if (nextFrame.type === "error" || nextFrame.type === "done" && !nextFrame.sessionReset) close();
@@ -6329,14 +9252,14 @@ ${attachmentContext.join("\n\n")}` : message;
6329
9252
  } });
6330
9253
  }, request);
6331
9254
  }
6332
- var BodySchema$3 = external_exports.object({
9255
+ var BodySchema$2 = external_exports.object({
6333
9256
  sessionId: SessionIdSchema.optional(),
6334
9257
  childId: external_exports.string().min(1).max(160).optional()
6335
9258
  });
6336
9259
  function handleChatAbortPost(request) {
6337
9260
  return wrapApiHandler(async () => {
6338
9261
  const raw = await request.json().catch(() => ({}));
6339
- const body = BodySchema$3.parse(raw);
9262
+ const body = BodySchema$2.parse(raw);
6340
9263
  const sessionId = body.sessionId;
6341
9264
  if (!sessionId) return Response.json({ message: "abort requires sessionId" }, { status: 400 });
6342
9265
  const bridge = getBridge();
@@ -6423,14 +9346,14 @@ function handleChatAttachmentGet(request) {
6423
9346
  } });
6424
9347
  }, request);
6425
9348
  }
6426
- var BodySchema$2 = external_exports.object({
9349
+ var BodySchema$1 = external_exports.object({
6427
9350
  sessionId: SessionIdSchema,
6428
9351
  command: external_exports.string(),
6429
9352
  args: external_exports.string().max(1024).optional()
6430
9353
  });
6431
9354
  function handleChatCommandPost(request) {
6432
9355
  return wrapApiHandler(async () => {
6433
- const body = BodySchema$2.parse(await request.json().catch(() => ({})));
9356
+ const body = BodySchema$1.parse(await request.json().catch(() => ({})));
6434
9357
  const bridge = getBridge();
6435
9358
  const args = body.args?.trim() ?? "";
6436
9359
  switch (body.command) {
@@ -6724,9 +9647,9 @@ function handleChatCommandsGet(request) {
6724
9647
  function shouldReplaySseEvent(event, pendingQuestionIds) {
6725
9648
  if (!pendingQuestionIds) return true;
6726
9649
  if (!event || typeof event !== "object") return true;
6727
- const frame = event;
6728
- if (frame.type !== "tool" || frame.part?.type !== "tool-Question") return true;
6729
- const toolCallId = frame.part.toolCallId;
9650
+ const frame2 = event;
9651
+ if (frame2.type !== "tool" || frame2.part?.type !== "tool-Question") return true;
9652
+ const toolCallId = frame2.part.toolCallId;
6730
9653
  return typeof toolCallId === "string" && pendingQuestionIds.has(toolCallId);
6731
9654
  }
6732
9655
  function normalizeSseReplayEvent(event) {
@@ -34219,7 +37142,7 @@ var MODELS = {
34219
37142
  var modelRegistry = /* @__PURE__ */ new Map();
34220
37143
  for (const [provider, models] of Object.entries(MODELS)) {
34221
37144
  const providerModels = /* @__PURE__ */ new Map();
34222
- for (const [id, model] of Object.entries(models)) providerModels.set(id, model);
37145
+ for (const [id2, model] of Object.entries(models)) providerModels.set(id2, model);
34223
37146
  modelRegistry.set(provider, providerModels);
34224
37147
  }
34225
37148
  function getModels(provider) {
@@ -34755,8 +37678,8 @@ var oauthProviderRegistry = new Map([
34755
37678
  }
34756
37679
  }
34757
37680
  ].map((provider) => [provider.id, provider]));
34758
- function getOAuthProvider(id) {
34759
- return oauthProviderRegistry.get(id);
37681
+ function getOAuthProvider(id2) {
37682
+ return oauthProviderRegistry.get(id2);
34760
37683
  }
34761
37684
  function registerOAuthProvider(provider) {
34762
37685
  oauthProviderRegistry.set(provider.id, provider);
@@ -35373,7 +38296,7 @@ function addCustomProviderModelIds(filePath, providerId, modelIds) {
35373
38296
  if (!existing) return;
35374
38297
  providers[providerId] = {
35375
38298
  ...existing,
35376
- models: mergeModelDefinitions(existing.models, [...existing.models ?? [], ...modelIds.map((id) => ({ id }))])
38299
+ models: mergeModelDefinitions(existing.models, [...existing.models ?? [], ...modelIds.map((id2) => ({ id: id2 }))])
35377
38300
  };
35378
38301
  writeModelsJson(filePath, {
35379
38302
  ...data,
@@ -35495,23 +38418,23 @@ function buildProviders() {
35495
38418
  const builtinIds = new Set(getProviders());
35496
38419
  const allIds = /* @__PURE__ */ new Set([...builtinIds, ...Object.keys(custom)]);
35497
38420
  allIds.add(OPENAI_CHAT_COMPLETIONS_PROVIDER_ID);
35498
- return [...allIds].map((id) => {
35499
- const isCustom = !builtinIds.has(id);
35500
- const customEntry = isCustom ? custom[id] : void 0;
35501
- const status = config.modelRegistry.getProviderAuthStatus(id);
35502
- const catalogEntry = KNOWN_PROVIDER_BY_ID.get(id);
35503
- const name = isCustom ? customEntry?.name ?? catalogEntry?.name ?? id : BUILT_IN_PROVIDER_DISPLAY_NAMES[id] ?? catalogEntry?.name ?? id;
35504
- const envVarName = isCustom ? customEntry?.apiKey ?? catalogEntry?.envVarName ?? "" : envHintForBuiltin(id);
38421
+ return [...allIds].map((id2) => {
38422
+ const isCustom = !builtinIds.has(id2);
38423
+ const customEntry = isCustom ? custom[id2] : void 0;
38424
+ const status = config.modelRegistry.getProviderAuthStatus(id2);
38425
+ const catalogEntry = KNOWN_PROVIDER_BY_ID.get(id2);
38426
+ const name = isCustom ? customEntry?.name ?? catalogEntry?.name ?? id2 : BUILT_IN_PROVIDER_DISPLAY_NAMES[id2] ?? catalogEntry?.name ?? id2;
38427
+ const envVarName = isCustom ? customEntry?.apiKey ?? catalogEntry?.envVarName ?? "" : envHintForBuiltin(id2);
35505
38428
  const row = {
35506
- id,
38429
+ id: id2,
35507
38430
  name,
35508
38431
  envVarName,
35509
- ...resolveProviderAuthFields(id, envVarName, oauthIds),
38432
+ ...resolveProviderAuthFields(id2, envVarName, oauthIds),
35510
38433
  isConfigured: status.configured
35511
38434
  };
35512
- if (isOccProviderId(id) || isCustomProviderId(id)) {
35513
- row.providerFamily = isOccProviderId(id) ? OPENAI_CHAT_COMPLETIONS_PROVIDER_ID : "custom";
35514
- if (customEntry?.name && (isNamedOccInstanceId(id) || isCustomProviderId(id))) row.displayName = customEntry.name;
38435
+ if (isOccProviderId(id2) || isCustomProviderId(id2)) {
38436
+ row.providerFamily = isOccProviderId(id2) ? OPENAI_CHAT_COMPLETIONS_PROVIDER_ID : "custom";
38437
+ if (customEntry?.name && (isNamedOccInstanceId(id2) || isCustomProviderId(id2))) row.displayName = customEntry.name;
35515
38438
  const customApi = uiApiForCustomProvider(customEntry?.api);
35516
38439
  if (customApi) row.api = customApi;
35517
38440
  if (customEntry?.baseUrl) row.baseUrl = customEntry.baseUrl;
@@ -35585,7 +38508,7 @@ function handleChatProvidersPost(request) {
35585
38508
  baseUrl,
35586
38509
  api,
35587
38510
  apiKey: envVarNameForManagedProvider(providerId),
35588
- models: modelIds.map((id) => ({ id }))
38511
+ models: modelIds.map((id2) => ({ id: id2 }))
35589
38512
  });
35590
38513
  config.authStorage.set(providerId, {
35591
38514
  type: "api_key",
@@ -35938,27 +38861,6 @@ function handleChatMcpOAuthPost(request, deps = defaultMcpDeps()) {
35938
38861
  return Response.json(toMcpOAuthResponse(startOAuthLogin(providerId, oauthDeps(deps))));
35939
38862
  }, request);
35940
38863
  }
35941
- var BodySchema$1 = external_exports.object({
35942
- sessionId: SessionIdSchema,
35943
- model: external_exports.object({
35944
- provider: external_exports.string(),
35945
- id: external_exports.string()
35946
- })
35947
- });
35948
- function handleChatModelPost(request) {
35949
- return wrapApiHandler(async () => {
35950
- const raw = await request.json().catch(() => ({}));
35951
- const body = BodySchema$1.parse(raw);
35952
- const bridge = getBridge();
35953
- const session = bridge.getSession(body.sessionId) ?? await bridge.resumeSessionById(body.sessionId);
35954
- if (!session || !await requireProjectSession(session)) return Response.json({ message: `Unknown session: ${body.sessionId}` }, { status: 404 });
35955
- await bridge.setModel(body.sessionId, {
35956
- provider: body.model.provider,
35957
- id: body.model.id
35958
- });
35959
- return Response.json({ ok: true });
35960
- }, request);
35961
- }
35962
38864
  function toPatternCandidate(model) {
35963
38865
  return {
35964
38866
  id: model.id,
@@ -36406,9 +39308,9 @@ function sessionSourcePath(source) {
36406
39308
  const raw = source;
36407
39309
  return stringValue(raw.sessionFile) ?? stringValue(raw.path);
36408
39310
  }
36409
- function latestBy(entries, time) {
39311
+ function latestBy(entries, time2) {
36410
39312
  if (entries.length === 0) return void 0;
36411
- return entries.reduce((latest, entry) => time(entry) >= time(latest) ? entry : latest);
39313
+ return entries.reduce((latest, entry) => time2(entry) >= time2(latest) ? entry : latest);
36412
39314
  }
36413
39315
  function presentationListActivity(presentation) {
36414
39316
  if (!presentation) return { activityCount: 0 };
@@ -36658,11 +39560,6 @@ function handleHealthGet(request) {
36658
39560
  });
36659
39561
  }, request);
36660
39562
  }
36661
- function handleWorkspaceBrowseGet(request) {
36662
- return wrapApiHandler(async () => {
36663
- return Response.json({ message: "Workspace root switching is disabled; use /api/projects/browse for opaque directory tokens." }, { status: 410 });
36664
- }, request);
36665
- }
36666
39563
  function canonicalizePath(path) {
36667
39564
  try {
36668
39565
  return realpathSync(path);
@@ -36864,188 +39761,170 @@ function handleWorkspaceTreeGet(_request) {
36864
39761
  });
36865
39762
  }, _request);
36866
39763
  }
36867
- var Route$27 = createFileRoute("/api/chat")({ server: { handlers: { POST: ({ request }) => handleChatPost(request) } } });
36868
- var Route$26 = createFileRoute("/api/health")({ server: { handlers: { GET: ({ request }) => handleHealthGet(request) } } });
36869
- var Route$25 = createFileRoute("/api/projects")({ server: { handlers: {
39764
+ var Route$24 = createFileRoute("/api/chat")({ server: { handlers: { POST: ({ request }) => handleChatPost(request) } } });
39765
+ var Route$23 = createFileRoute("/api/health")({ server: { handlers: { GET: ({ request }) => handleHealthGet(request) } } });
39766
+ var Route$22 = createFileRoute("/api/projects")({ server: { handlers: {
36870
39767
  DELETE: ({ request }) => handleProjectDelete(request),
36871
39768
  GET: ({ request }) => handleProjectsGet(request),
36872
39769
  PATCH: ({ request }) => handleProjectPatch(request),
36873
39770
  POST: ({ request }) => handleProjectsPost(request)
36874
39771
  } } });
36875
- var Route$24 = createFileRoute("/api/chat/abort")({ server: { handlers: { POST: ({ request }) => handleChatAbortPost(request) } } });
36876
- var Route$23 = createFileRoute("/api/chat/artifacts")({ server: { handlers: { PUT: ({ request }) => handleChatOpenUIArtifactPut(request) } } });
36877
- var Route$22 = createFileRoute("/api/chat/command")({ server: { handlers: { POST: ({ request }) => handleChatCommandPost(request) } } });
36878
- var Route$21 = createFileRoute("/api/chat/commands")({ server: { handlers: { GET: ({ request }) => handleChatCommandsGet(request) } } });
36879
- var Route$20 = createFileRoute("/api/chat/events")({ server: { handlers: { GET: ({ request }) => handleChatEventsGet(request) } } });
36880
- var Route$19 = createFileRoute("/api/chat/mcp")({ server: { handlers: {
39772
+ var Route$21 = createFileRoute("/api/chat/abort")({ server: { handlers: { POST: ({ request }) => handleChatAbortPost(request) } } });
39773
+ var Route$20 = createFileRoute("/api/chat/artifacts")({ server: { handlers: { PUT: ({ request }) => handleChatOpenUIArtifactPut(request) } } });
39774
+ var Route$19 = createFileRoute("/api/chat/command")({ server: { handlers: { POST: ({ request }) => handleChatCommandPost(request) } } });
39775
+ var Route$18 = createFileRoute("/api/chat/commands")({ server: { handlers: { GET: ({ request }) => handleChatCommandsGet(request) } } });
39776
+ var Route$17 = createFileRoute("/api/chat/events")({ server: { handlers: { GET: ({ request }) => handleChatEventsGet(request) } } });
39777
+ var Route$16 = createFileRoute("/api/chat/mcp")({ server: { handlers: {
36881
39778
  GET: ({ request }) => handleChatMcpGet(request),
36882
39779
  POST: ({ request }) => handleChatMcpPost(request),
36883
39780
  DELETE: ({ request }) => handleChatMcpDelete(request)
36884
39781
  } } });
36885
- var Route$18 = createFileRoute("/api/chat/model")({ server: { handlers: { POST: ({ request }) => handleChatModelPost(request) } } });
36886
- var Route$17 = createFileRoute("/api/chat/models")({ server: { handlers: { GET: ({ request }) => handleChatModelsGet(request) } } });
36887
- var Route$16 = createFileRoute("/api/chat/new")({ server: { handlers: { POST: ({ request }) => handleChatNewPost(request) } } });
36888
- var Route$15 = createFileRoute("/api/chat/providers")({ server: { handlers: {
39782
+ var Route$15 = createFileRoute("/api/chat/models")({ server: { handlers: { GET: ({ request }) => handleChatModelsGet(request) } } });
39783
+ var Route$14 = createFileRoute("/api/chat/new")({ server: { handlers: { POST: ({ request }) => handleChatNewPost(request) } } });
39784
+ var Route$13 = createFileRoute("/api/chat/providers")({ server: { handlers: {
36889
39785
  GET: ({ request }) => handleChatProvidersGet(request),
36890
39786
  POST: ({ request }) => handleChatProvidersPost(request),
36891
39787
  DELETE: ({ request }) => handleChatProvidersDelete(request)
36892
39788
  } } });
36893
- var Route$14 = createFileRoute("/api/chat/question")({ server: { handlers: { POST: ({ request }) => handleChatQuestionPost(request) } } });
36894
- var Route$13 = createFileRoute("/api/chat/resources")({ server: { handlers: { GET: ({ request }) => handleChatResourcesGet(request) } } });
36895
- var Route$12 = createFileRoute("/api/chat/resume")({ server: { handlers: { POST: ({ request }) => handleChatResumePost(request) } } });
36896
- var Route$11 = createFileRoute("/api/chat/session")({ server: { handlers: {
39789
+ var Route$12 = createFileRoute("/api/chat/question")({ server: { handlers: { POST: ({ request }) => handleChatQuestionPost(request) } } });
39790
+ var Route$11 = createFileRoute("/api/chat/resources")({ server: { handlers: { GET: ({ request }) => handleChatResourcesGet(request) } } });
39791
+ var Route$10 = createFileRoute("/api/chat/resume")({ server: { handlers: { POST: ({ request }) => handleChatResumePost(request) } } });
39792
+ var Route$9 = createFileRoute("/api/chat/session")({ server: { handlers: {
36897
39793
  GET: ({ request }) => new URL(request.url).searchParams.has("attachmentId") ? handleChatAttachmentGet(request) : handleChatSessionGet(request),
36898
39794
  POST: ({ request }) => handleChatAttachmentsPost(request),
36899
39795
  PUT: ({ request }) => handleChatPlanPresentationPut(request),
36900
39796
  PATCH: ({ request }) => handleChatQueueMutationPost(request)
36901
39797
  } } });
36902
- var Route$10 = createFileRoute("/api/chat/sessions")({ server: { handlers: {
39798
+ var Route$8 = createFileRoute("/api/chat/sessions")({ server: { handlers: {
36903
39799
  DELETE: ({ request }) => handleChatSessionDelete(request),
36904
39800
  GET: ({ request }) => handleChatSessionsGet(request),
36905
39801
  PATCH: ({ request }) => handleChatSessionRenamePatch(request)
36906
39802
  } } });
36907
- var Route$9 = createFileRoute("/api/chat/settings")({ server: { handlers: {
39803
+ var Route$7 = createFileRoute("/api/chat/settings")({ server: { handlers: {
36908
39804
  GET: ({ request }) => handleChatSettingsGet(request),
36909
39805
  PATCH: ({ request }) => handleChatSettingsPatch(request)
36910
39806
  } } });
36911
- var Route$8 = createFileRoute("/api/projects/browse")({ server: { handlers: { GET: ({ request }) => handleProjectBrowseGet(request) } } });
36912
- var Route$7 = createFileRoute("/api/projects/fork")({ server: { handlers: { POST: ({ request }) => handleProjectSessionFork(request) } } });
36913
- var Route$6 = createFileRoute("/api/workspace/browse")({ server: { handlers: { GET: ({ request }) => handleWorkspaceBrowseGet(request) } } });
36914
- var Route$5 = createFileRoute("/api/workspace/file")({ server: { handlers: { GET: ({ request }) => handleWorkspaceFileGet(request) } } });
36915
- var Route$4 = createFileRoute("/api/workspace/root")({ server: { handlers: { POST: () => Response.json({ message: "The workspace root is fixed when Fleet starts" }, { status: 405 }) } } });
39807
+ var Route$6 = createFileRoute("/api/projects/browse")({ server: { handlers: { GET: ({ request }) => handleProjectBrowseGet(request) } } });
39808
+ var Route$5 = createFileRoute("/api/projects/fork")({ server: { handlers: { POST: ({ request }) => handleProjectSessionFork(request) } } });
39809
+ var Route$4 = createFileRoute("/api/workspace/file")({ server: { handlers: { GET: ({ request }) => handleWorkspaceFileGet(request) } } });
36916
39810
  var Route$3 = createFileRoute("/api/workspace/tree")({ server: { handlers: { GET: ({ request }) => handleWorkspaceTreeGet(request) } } });
36917
39811
  var Route$2 = createFileRoute("/api/chat/mcp/oauth")({ server: { handlers: { POST: ({ request }) => handleChatMcpOAuthPost(request) } } });
36918
39812
  var Route$1 = createFileRoute("/api/chat/models/discover")({ server: { handlers: { POST: ({ request }) => handleChatModelsDiscoverPost(request) } } });
36919
39813
  var Route = createFileRoute("/api/chat/providers/oauth")({ server: { handlers: { POST: ({ request }) => handleChatProvidersOAuthPost(request) } } });
36920
- var IndexRoute = Route$28.update({
39814
+ var IndexRoute = Route$25.update({
36921
39815
  id: "/",
36922
39816
  path: "/",
36923
- getParentRoute: () => Route$29
39817
+ getParentRoute: () => Route$26
36924
39818
  });
36925
- var ApiChatRoute = Route$27.update({
39819
+ var ApiChatRoute = Route$24.update({
36926
39820
  id: "/api/chat",
36927
39821
  path: "/api/chat",
36928
- getParentRoute: () => Route$29
39822
+ getParentRoute: () => Route$26
36929
39823
  });
36930
- var ApiHealthRoute = Route$26.update({
39824
+ var ApiHealthRoute = Route$23.update({
36931
39825
  id: "/api/health",
36932
39826
  path: "/api/health",
36933
- getParentRoute: () => Route$29
39827
+ getParentRoute: () => Route$26
36934
39828
  });
36935
- var ApiProjectsRoute = Route$25.update({
39829
+ var ApiProjectsRoute = Route$22.update({
36936
39830
  id: "/api/projects",
36937
39831
  path: "/api/projects",
36938
- getParentRoute: () => Route$29
39832
+ getParentRoute: () => Route$26
36939
39833
  });
36940
- var ApiChatAbortRoute = Route$24.update({
39834
+ var ApiChatAbortRoute = Route$21.update({
36941
39835
  id: "/abort",
36942
39836
  path: "/abort",
36943
39837
  getParentRoute: () => ApiChatRoute
36944
39838
  });
36945
- var ApiChatArtifactsRoute = Route$23.update({
39839
+ var ApiChatArtifactsRoute = Route$20.update({
36946
39840
  id: "/artifacts",
36947
39841
  path: "/artifacts",
36948
39842
  getParentRoute: () => ApiChatRoute
36949
39843
  });
36950
- var ApiChatCommandRoute = Route$22.update({
39844
+ var ApiChatCommandRoute = Route$19.update({
36951
39845
  id: "/command",
36952
39846
  path: "/command",
36953
39847
  getParentRoute: () => ApiChatRoute
36954
39848
  });
36955
- var ApiChatCommandsRoute = Route$21.update({
39849
+ var ApiChatCommandsRoute = Route$18.update({
36956
39850
  id: "/commands",
36957
39851
  path: "/commands",
36958
39852
  getParentRoute: () => ApiChatRoute
36959
39853
  });
36960
- var ApiChatEventsRoute = Route$20.update({
39854
+ var ApiChatEventsRoute = Route$17.update({
36961
39855
  id: "/events",
36962
39856
  path: "/events",
36963
39857
  getParentRoute: () => ApiChatRoute
36964
39858
  });
36965
- var ApiChatMcpRoute = Route$19.update({
39859
+ var ApiChatMcpRoute = Route$16.update({
36966
39860
  id: "/mcp",
36967
39861
  path: "/mcp",
36968
39862
  getParentRoute: () => ApiChatRoute
36969
39863
  });
36970
- var ApiChatModelRoute = Route$18.update({
36971
- id: "/model",
36972
- path: "/model",
36973
- getParentRoute: () => ApiChatRoute
36974
- });
36975
- var ApiChatModelsRoute = Route$17.update({
39864
+ var ApiChatModelsRoute = Route$15.update({
36976
39865
  id: "/models",
36977
39866
  path: "/models",
36978
39867
  getParentRoute: () => ApiChatRoute
36979
39868
  });
36980
- var ApiChatNewRoute = Route$16.update({
39869
+ var ApiChatNewRoute = Route$14.update({
36981
39870
  id: "/new",
36982
39871
  path: "/new",
36983
39872
  getParentRoute: () => ApiChatRoute
36984
39873
  });
36985
- var ApiChatProvidersRoute = Route$15.update({
39874
+ var ApiChatProvidersRoute = Route$13.update({
36986
39875
  id: "/providers",
36987
39876
  path: "/providers",
36988
39877
  getParentRoute: () => ApiChatRoute
36989
39878
  });
36990
- var ApiChatQuestionRoute = Route$14.update({
39879
+ var ApiChatQuestionRoute = Route$12.update({
36991
39880
  id: "/question",
36992
39881
  path: "/question",
36993
39882
  getParentRoute: () => ApiChatRoute
36994
39883
  });
36995
- var ApiChatResourcesRoute = Route$13.update({
39884
+ var ApiChatResourcesRoute = Route$11.update({
36996
39885
  id: "/resources",
36997
39886
  path: "/resources",
36998
39887
  getParentRoute: () => ApiChatRoute
36999
39888
  });
37000
- var ApiChatResumeRoute = Route$12.update({
39889
+ var ApiChatResumeRoute = Route$10.update({
37001
39890
  id: "/resume",
37002
39891
  path: "/resume",
37003
39892
  getParentRoute: () => ApiChatRoute
37004
39893
  });
37005
- var ApiChatSessionRoute = Route$11.update({
39894
+ var ApiChatSessionRoute = Route$9.update({
37006
39895
  id: "/session",
37007
39896
  path: "/session",
37008
39897
  getParentRoute: () => ApiChatRoute
37009
39898
  });
37010
- var ApiChatSessionsRoute = Route$10.update({
39899
+ var ApiChatSessionsRoute = Route$8.update({
37011
39900
  id: "/sessions",
37012
39901
  path: "/sessions",
37013
39902
  getParentRoute: () => ApiChatRoute
37014
39903
  });
37015
- var ApiChatSettingsRoute = Route$9.update({
39904
+ var ApiChatSettingsRoute = Route$7.update({
37016
39905
  id: "/settings",
37017
39906
  path: "/settings",
37018
39907
  getParentRoute: () => ApiChatRoute
37019
39908
  });
37020
- var ApiProjectsBrowseRoute = Route$8.update({
39909
+ var ApiProjectsBrowseRoute = Route$6.update({
37021
39910
  id: "/browse",
37022
39911
  path: "/browse",
37023
39912
  getParentRoute: () => ApiProjectsRoute
37024
39913
  });
37025
- var ApiProjectsForkRoute = Route$7.update({
39914
+ var ApiProjectsForkRoute = Route$5.update({
37026
39915
  id: "/fork",
37027
39916
  path: "/fork",
37028
39917
  getParentRoute: () => ApiProjectsRoute
37029
39918
  });
37030
- var ApiWorkspaceBrowseRoute = Route$6.update({
37031
- id: "/api/workspace/browse",
37032
- path: "/api/workspace/browse",
37033
- getParentRoute: () => Route$29
37034
- });
37035
- var ApiWorkspaceFileRoute = Route$5.update({
39919
+ var ApiWorkspaceFileRoute = Route$4.update({
37036
39920
  id: "/api/workspace/file",
37037
39921
  path: "/api/workspace/file",
37038
- getParentRoute: () => Route$29
37039
- });
37040
- var ApiWorkspaceRootRoute = Route$4.update({
37041
- id: "/api/workspace/root",
37042
- path: "/api/workspace/root",
37043
- getParentRoute: () => Route$29
39922
+ getParentRoute: () => Route$26
37044
39923
  });
37045
39924
  var ApiWorkspaceTreeRoute = Route$3.update({
37046
39925
  id: "/api/workspace/tree",
37047
39926
  path: "/api/workspace/tree",
37048
- getParentRoute: () => Route$29
39927
+ getParentRoute: () => Route$26
37049
39928
  });
37050
39929
  var ApiChatMcpOauthRoute = Route$2.update({
37051
39930
  id: "/oauth",
@@ -37074,7 +39953,6 @@ var ApiChatRouteChildren = {
37074
39953
  ApiChatCommandsRoute,
37075
39954
  ApiChatEventsRoute,
37076
39955
  ApiChatMcpRoute: ApiChatMcpRouteWithChildren,
37077
- ApiChatModelRoute,
37078
39956
  ApiChatModelsRoute: ApiChatModelsRouteWithChildren,
37079
39957
  ApiChatNewRoute,
37080
39958
  ApiChatProvidersRoute: ApiChatProvidersRoute._addFileChildren(ApiChatProvidersRouteChildren),
@@ -37095,12 +39973,10 @@ var rootRouteChildren = {
37095
39973
  ApiChatRoute: ApiChatRouteWithChildren,
37096
39974
  ApiHealthRoute,
37097
39975
  ApiProjectsRoute: ApiProjectsRoute._addFileChildren(ApiProjectsRouteChildren),
37098
- ApiWorkspaceBrowseRoute,
37099
39976
  ApiWorkspaceFileRoute,
37100
- ApiWorkspaceRootRoute,
37101
39977
  ApiWorkspaceTreeRoute
37102
39978
  };
37103
- var routeTree = Route$29._addFileChildren(rootRouteChildren)._addFileTypes();
39979
+ var routeTree = Route$26._addFileChildren(rootRouteChildren)._addFileTypes();
37104
39980
  function getRouter() {
37105
39981
  return createRouter({
37106
39982
  routeTree,